Test that with coupled control disabled, a notification is emitted when a port enters or leaves COLLECTING state. Output without "bonding: 3ad: Notify Rx state changes": # ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [ OK ] TEST: Notifications in COLLECTING state [FAIL] No notification upon entering COLLECTING state TEST: Ping in DISTRIBUTING state [ OK ] Output with the fix: # ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [ OK ] TEST: Notifications in COLLECTING state [ OK ] TEST: Ping in DISTRIBUTING state [ OK ] Reviewed-by: Petr Machata Signed-off-by: Ido Schimmel --- .../bonding/bond_lacp_independent_control.sh | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh b/tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh index c29712e01e49..a2b83b581e40 100755 --- a/tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh +++ b/tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh @@ -15,6 +15,7 @@ # shellcheck disable=SC2034,SC2329 ALL_TESTS=" collecting + collecting_notify distributing " NUM_NETIFS=2 @@ -121,6 +122,46 @@ collecting() log_test "Receive in COLLECTING state" } +collecting_notify() +{ + local tmp_file + + RET=0 + + partner_state_clear 0x18 + defer tc filter del dev "$h1" ingress pref 1 handle 101 flower + lacp_state_wait "$h1" 0x0f + check_err $? "Port did not reach ATTACHED state" + + tmp_file=$(mktemp) + defer rm "$tmp_file" + ip -d monitor link dev "$h1" >> "$tmp_file" & + defer kill_process $! + sleep 1 + + partner_state_clear 0x10 + lacp_state_wait "$h1" 0x1f + check_err $? "Port did not reach COLLECTING state" + + slowwait "$WAIT_TIMEOUT" grep -qw \ + "ad_actor_oper_port_state $((0x1f))" "$tmp_file" + check_err $? "No notification upon entering COLLECTING state" + + # Discard previous notifications so that only a notification upon + # leaving COLLECTING state can match below. The monitor appends to + # the file, so truncating it is safe. + : > "$tmp_file" + partner_state_clear 0x18 + lacp_state_wait "$h1" 0x0f + check_err $? "Port did not reach ATTACHED state" + + slowwait "$WAIT_TIMEOUT" grep -qw \ + "ad_actor_oper_port_state $((0x0f))" "$tmp_file" + check_err $? "No notification upon leaving COLLECTING state" + + log_test "Notifications in COLLECTING state" +} + distributing() { RET=0 -- 2.56.0