Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@kernel.org, jv@jvosburgh.net, andrew+netdev@lunn.ch,
	petrm@nvidia.com, sridhar.samudrala@intel.com, jiri@resnulli.us,
	horms@kernel.org, shuah@kernel.org,
	linux-kselftest@vger.kernel.org, razor@blackwall.org,
	Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next 4/6] selftests: bonding: Test notifications in COLLECTING state
Date: Wed, 18 Nov 2026 10:34:40 +0200	[thread overview]
Message-ID: <20261118083442.1061289-5-idosch@nvidia.com> (raw)
In-Reply-To: <20261118083442.1061289-1-idosch@nvidia.com>

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 <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 .../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


  parent reply	other threads:[~2026-11-18  8:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  8:34 [PATCH net-next 0/6] bonding: 3ad: Support independent control with LAG offload Ido Schimmel
2026-11-18  8:34 ` [PATCH net-next 1/6] net: Add Rx enabled state to LAG lower state information Ido Schimmel
2026-11-18  8:34 ` [PATCH net-next 2/6] bonding: 3ad: Notify Rx state changes Ido Schimmel
2026-11-18  8:34 ` [PATCH net-next 3/6] mlxsw: Enable LAG collector independently of distributor Ido Schimmel
2026-11-18  8:34 ` Ido Schimmel [this message]
2026-11-18  8:34 ` [PATCH net-next 5/6] bonding: 3ad: Advertise Collecting only after collection is enabled Ido Schimmel
2026-11-18  8:34 ` [PATCH net-next 6/6] selftests: bonding: Test that Collecting is advertised after notification Ido Schimmel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261118083442.1061289-5-idosch@nvidia.com \
    --to=idosch@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=jv@jvosburgh.net \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=razor@blackwall.org \
    --cc=shuah@kernel.org \
    --cc=sridhar.samudrala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox