bonding: 3ad: Receive packets in COLLECTING state
Subsystems (4)
PATCH 1/2 bonding: 3ad: Receive packets in COLLECTING state
When coupled control is disabled, a port in COLLECTING state is supposed to receive packets, but it does not. The bond only delivers packets from slaves whose 'inactive' flag is cleared, whereas bond_set_slave_rx_enabled_flags() only clears 'rx_disabled'.
Fix by clearing 'inactive' as well.
---
Notes:
Targeting at net-next since this never worked.
Known issues that this patch does not address:
1. Changing 'all_slaves_active' from 1 to 0 while a port is in COLLECTING state sets its 'inactive' flag and the port stops receiving until the next mux state transition. This is not new, COLLECTING is a transient state and the option is off by default, so I do not think it is worth handling.
2. The 'inactive' flag shares a bitfield with other slave flags. The 802.3ad state machine writes them under the mode lock, while the 'all_slaves_active' handler writes 'inactive' under RTNL only. This is not new.
include/net/bonding.h | 1 + 1 file changed, 1 insertion(+)
include/net/bonding.h +1 -0
@@ -594,6 +594,7 @@ static inline void bond_set_slave_active_flags(struct slave *slave,static inline void bond_set_slave_rx_enabled_flags (struct slave *slave,bool notify) { + slave->inactive =0 ; slave->rx_disabled =0 ; }
Signature · 1 line
2.56.0
PATCH 2/2 selftests: bonding: Add a test for 802.3ad with coupled control disabled
Test that with coupled control disabled, a port in COLLECTING state receives packets.
In this mode, a port only transitions from COLLECTING to DISTRIBUTING state if its partner sets the Collecting bit in its LACPDUs. Therefore, keep the port in COLLECTING state by clearing the Collecting bit in received LACPDUs.
Also test that ping works once the port moves to DISTRIBUTING state.
Use VRFs rather than network namespaces so that the test could be run with a veth pair or a pair of physically connected ports.
Output without "bonding: 3ad: Receive packets in COLLECTING state":
# ./bond_lacp_independent_control.sh
TEST: Receive in COLLECTING state [FAIL]
Packets not received in COLLECTING state
TEST: Ping in DISTRIBUTING state [ OK ]Output with the fix:
# ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [ OK ] TEST: Ping in DISTRIBUTING state [ OK ]
--- .../selftests/drivers/net/bonding/Makefile | 1 + .../bonding/bond_lacp_independent_control.sh | 144 ++++++++++++++++++ .../selftests/drivers/net/bonding/config | 6 + 3 files changed, 151 insertions(+) create mode 100755 tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh
tools/testing/selftests/drivers/net/bonding/Makefile +1 -0
@@ -7,6 +7,7 @@ TEST_PROGS := \ bond-eth-type-change.sh \ bond-lladdr-target.sh \ bond_ipsec_offload.sh \ + bond_lacp_independent_control.sh \ bond_lacp_prio.sh \ bond_lacp_strict.sh \ bond_macvlan_ipvlan.sh \
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +144 -0
144 lines not on this page · raw message
tools/testing/selftests/drivers/net/bonding/config +6 -0
@@ -1,13 +1,17 @@ CONFIG_BONDING=y +CONFIG_BPF_SYSCALL=y CONFIG_BRIDGE=y +CONFIG_CGROUP_BPF=y CONFIG_CONFIGFS_FS=y CONFIG_DUMMY=y CONFIG_INET_ESP=y CONFIG_INET_ESP_OFFLOAD=y CONFIG_IPV6=y +CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_IPVLAN=y CONFIG_MACVLAN=y CONFIG_NET_ACT_GACT=y +CONFIG_NET_ACT_PEDIT=m CONFIG_NET_CLS_FLOWER=y CONFIG_NET_CLS_MATCHALL=m CONFIG_NETCONSOLE=m
@@ -15,7 +19,9 @@ CONFIG_NETCONSOLE_DYNAMIC=y CONFIG_NETCONSOLE_EXTENDED_LOG=y CONFIG_NETDEVSIM=m CONFIG_NET_IPGRE=y +CONFIG_NET_L3_MASTER_DEV=y CONFIG_NET_SCH_INGRESS=y +CONFIG_NET_VRF=y CONFIG_NLMON=y CONFIG_VETH=y CONFIG_VLAN_8021Q=m
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH net-next 2/2] selftests: bonding: Add a test for 802.3ad with coupled control disabled
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you…
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The bonding selftest config fragment (tools/testing/selftests/drivers/net/bonding/config) now asks for…
- [Low] In bond_lacp_independent_control.sh, collecting() reads the total packet count of the bond1 ingress ICMP echo-request filter (handle…
--
selftests: bonding: Add a test for 802.3ad with coupled control disabled
This adds a VRF based selftest which checks that a bond port with coupled_control off receives packets in COLLECTING state. It keeps the port in COLLECTING state by clearing the Collecting bit in received LACPDUs, and then checks that ping works in DISTRIBUTING state. The bonding selftest config fragment gains the VRF, pedit and policy routing options the test needs.
Quoted 5 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +0
-0
[ ... ]
Quoted 18 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +18
-0+h1_create() +{ + adf_ip_link_add bond1 type bond mode 802.3ad lacp_rate fast \ + coupled_control off + adf_ip_link_set_master "$h1" bond1 + adf_simple_if_init bond1 192.0.2.1/28 + + tc qdisc add dev "$h1" clsact + defer tc qdisc del dev "$h1" clsact + + tc qdisc add dev bond1 clsact + defer tc qdisc del dev bond1 clsact + + tc filter add dev bond1 ingress pref 1 handle 101 proto ip \ + flower skip_hw src_ip 192.0.2.2 dst_ip 192.0.2.1 \ + ip_proto icmp type 8 action pass + defer tc filter del dev bond1 ingress pref 1 handle 101 flower +}
[ ... ]
Quoted 2 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +2
-0+collecting() +{
[ ... ]
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh line 119
Quoted 4 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +4
-0+ ping_do bond2 192.0.2.1 + pkts=$(tc_rule_handle_stats_get "dev bond1 ingress" 101) + ((pkts >= PING_COUNT)) + check_err $? "Packets not received in COLLECTING state"
[Severity: Low]
Can this check pass when no packets were received in COLLECTING state?
The bond1 ingress filter with handle 101 is installed once by h1_create() from setup_prepare(), outside the per-test defer scopes, so its counter keeps growing across tests. collecting() compares the absolute counter with PING_COUNT and does not take a baseline before ping_do.
tests_run() in net/lib.sh iterates over ${TESTS:-$ALL_TESTS}. Take TESTS="distributing collecting" as an example:
distributing()
ping_do bond2 192.0.2.1 <- PING_COUNT echo requests hit filter 101collecting()
port moved to COLLECTING state
ping_do bond2 192.0.2.1 <- nothing received without the fix
pkts >= PING_COUNT <- still true from the earlier test
The same thing happens if collecting is listed twice. The default ALL_TESTS order runs collecting first, so the default run is not affected.
Since the ping_do return value is ignored here, this counter is the only check of the fix. Would it make sense to read the counter before ping_do and check the delta, or to create the filter inside collecting() with a matching defer?
Quoted 3 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +3
-0+ + log_test "Receive in COLLECTING state" +}
[ ... ]
Quoted 4 lines
tools/testing/selftests/drivers/net/bonding/config +0
-0
[ ... ]
tools/testing/selftests/drivers/net/bonding/config CONFIG_NETCONSOLE_DYNAMIC=y · line 24
Quoted 7 lines
tools/testing/selftests/drivers/net/bonding/config +2
-0@@ -15,7 +19,9 @@ CONFIG_NETCONSOLE_DYNAMIC=y CONFIG_NETCONSOLE_EXTENDED_LOG=y CONFIG_NETDEVSIM=m CONFIG_NET_IPGRE=y +CONFIG_NET_L3_MASTER_DEV=y CONFIG_NET_SCH_INGRESS=y +CONFIG_NET_VRF=y
[Severity: Low]
Should this fragment also enable CONFIG_IP_ADVANCED_ROUTER=y and CONFIG_IP_MULTIPLE_TABLES=y?
NET_VRF depends on IP_MULTIPLE_TABLES in drivers/net/Kconfig:
config NET_VRF
tristate "Virtual Routing and Forwarding (Lite)" depends on IP_MULTIPLE_TABLES
depends on NET_L3_MASTER_DEV
depends on IPV6_MULTIPLE_TABLES || IPV6=n
and in net/ipv4/Kconfig, IP_MULTIPLE_TABLES depends on IP_ADVANCED_ROUTER and has no default:
config IP_MULTIPLE_TABLES
bool "IP: policy routing"
depends on IP_ADVANCED_ROUTER
The patch adds the NET_L3_MASTER_DEV and IPV6_MULTIPLE_TABLES dependencies but not the IPv4 ones. If the fragment is merged onto a base config that lacks them, Kconfig silently drops NET_VRF. arm64 defconfig is one example: it sets neither symbol, while x86_64_defconfig sets both.
In that case setup_prepare()->adf_vrf_prepare()->vrf_prepare() runs:
ip -4 rule add pref 32765 table local
which needs IPv4 policy routing, and adf_simple_if_init() cannot create the VRF devices. The test then fails during setup and never exercises the bonding change.
Several other net selftest fragments have the same gap, while net/mptcp/config lists IP_MULTIPLE_TABLES explicitly.
Quoted 3 lines
tools/testing/selftests/drivers/net/bonding/config +0
-0CONFIG_NLMON=y CONFIG_VETH=y CONFIG_VLAN_8021Q=m
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261111171947.2816258-1-idosch%40nvidia.com
Re: [PATCH net-next 2/2] selftests: bonding: Add a test for 802.3ad with coupled control disabled
tl;dr - I believe the patch is fine as-is.
Quoted 80 lines · On Thu, Nov 12, 2026 at 08:21:58PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The bonding selftest config fragment (
tools/testing/selftests/drivers/net/bonding/config) now asks for…
- [Low] Inbond_lacp_independent_control.sh,collecting()reads the total packet count of the bond1 ingress ICMP echo-request filter (handle…--
selftests: bonding: Add a test for 802.3ad with coupled control disabled
This adds a VRF based selftest which checks that a bond port with
coupled_controloff receives packets in COLLECTING state. It keeps the port in COLLECTING state by clearing the Collecting bit in received LACPDUs, and then checks that ping works in DISTRIBUTING state. The bonding selftest config fragment gains the VRF, pedit and policy routing options the test needs.Quoted 5 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +0
-0[ ... ]
Quoted 18 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +18
-0+h1_create() +{ + adf_ip_link_add bond1 type bond mode 802.3ad lacp_rate fast \ + coupled_control off + adf_ip_link_set_master "$h1" bond1 + adf_simple_if_init bond1 192.0.2.1/28 + + tc qdisc add dev "$h1" clsact + defer tc qdisc del dev "$h1" clsact + + tc qdisc add dev bond1 clsact + defer tc qdisc del dev bond1 clsact + + tc filter add dev bond1 ingress pref 1 handle 101 proto ip \ + flower skip_hw src_ip 192.0.2.2 dst_ip 192.0.2.1 \ + ip_proto icmp type 8 action pass + defer tc filter del dev bond1 ingress pref 1 handle 101 flower +}[ ... ]
Quoted 2 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +2
-0+collecting() +{[ ... ]
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh line 119
Quoted 4 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +4
-0+ ping_do bond2 192.0.2.1 + pkts=$(tc_rule_handle_stats_get "dev bond1 ingress" 101) + ((pkts >= PING_COUNT)) + check_err $? "Packets not received in COLLECTING state"[Severity: Low]
Can this check pass when no packets were received in COLLECTING state?The bond1 ingress filter with handle 101 is installed once by
h1_create()fromsetup_prepare(), outside the per-test defer scopes, so its counter keeps growing across tests.collecting()compares the absolute counter withPING_COUNTand does not take a baseline beforeping_do.
tests_run()innet/lib.shiterates over ${TESTS:-$ALL_TESTS}. Take TESTS="distributing collecting" as an example:
distributing()
ping_dobond2 192.0.2.1 <-PING_COUNTecho requests hit filter 101collecting()
port moved to COLLECTING state
ping_dobond2 192.0.2.1 <- nothing received without the fix
pkts >=PING_COUNT<- still true from the earlier test
Quoted 8 lines
The same thing happens if collecting is listed twice. The default
ALL_TESTSorder runs collecting first, so the default run is not affected.Since the
ping_doreturn value is ignored here, this counter is the only check of the fix. Would it make sense to read the counter beforeping_doand check the delta, or to create the filter insidecollecting()with a matching defer?
Noise. This is not a problem with the default test order and I don't think it's worth handling other orders.
Quoted 48 lines
Quoted 4 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +3
-0+ + log_test "Receive in COLLECTING state" +}[ ... ]
Quoted 4 lines
tools/testing/selftests/drivers/net/bonding/config +0
-0[ ... ]
tools/testing/selftests/drivers/net/bonding/config CONFIG_NETCONSOLE_DYNAMIC=y · line 24
Quoted 7 lines
tools/testing/selftests/drivers/net/bonding/config +2
-0@@ -15,7 +19,9 @@ CONFIG_NETCONSOLE_DYNAMIC=y CONFIG_NETCONSOLE_EXTENDED_LOG=y CONFIG_NETDEVSIM=m CONFIG_NET_IPGRE=y +CONFIG_NET_L3_MASTER_DEV=y CONFIG_NET_SCH_INGRESS=y +CONFIG_NET_VRF=y[Severity: Low]
Should this fragment also enableCONFIG_IP_ADVANCED_ROUTER=yandCONFIG_IP_MULTIPLE_TABLES=y?
NET_VRFdepends onIP_MULTIPLE_TABLESindrivers/net/Kconfig:config
NET_VRF
tristate "Virtual Routing and Forwarding (Lite)" depends onIP_MULTIPLE_TABLES
depends onNET_L3_MASTER_DEV
depends onIPV6_MULTIPLE_TABLES|| IPV6=nand in
net/ipv4/Kconfig,IP_MULTIPLE_TABLESdepends onIP_ADVANCED_ROUTERand has no default:config
IP_MULTIPLE_TABLES
bool "IP: policy routing"
depends onIP_ADVANCED_ROUTERThe patch adds the
NET_L3_MASTER_DEVandIPV6_MULTIPLE_TABLESdependencies but not the IPv4 ones. If the fragment is merged onto a base config that lacks them,Kconfigsilently dropsNET_VRF. arm64 defconfig is one example: it sets neither symbol, whilex86_64_defconfigsets both.In that case setup_prepare()->adf_vrf_prepare()->vrf_prepare() runs:
Quoted 8 lines
ip -4 rule add pref 32765 table local
which needs IPv4 policy routing, and
adf_simple_if_init()cannot create the VRF devices. The test then fails during setup and never exercises the bonding change.Several other net selftest fragments have the same gap, while
net/mptcp/configlistsIP_MULTIPLE_TABLESexplicitly.
Both options are enabled by x86_64_defconfig and other config files that enable CONFIG_NET_VRF do not list them either (e.g., net/forwarding/config). The test is running fine in the netdev CI.
Re: [PATCH net-next 2/2] selftests: bonding: Add a test for 802.3ad with coupled control disabled
In reply to Ido SchimmelQuoted 232 lines · Ido Schimmel
Test that with coupled control disabled, a port in COLLECTING state receives packets.
In this mode, a port only transitions from COLLECTING to DISTRIBUTING state if its partner sets the Collecting bit in its LACPDUs. Therefore, keep the port in COLLECTING state by clearing the Collecting bit in received LACPDUs.
Also test that ping works once the port moves to DISTRIBUTING state.
Use VRFs rather than network namespaces so that the test could be run with a veth pair or a pair of physically connected ports.
Output without "bonding: 3ad: Receive packets in COLLECTING state":
# ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [FAIL] Packets not received in COLLECTING state TEST: Ping in DISTRIBUTING state [ OK ]Output with the fix:
# ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [ OK ] TEST: Ping in DISTRIBUTING state [ OK ]Reviewed-by Petr Machata <[email protected]>Signed-off-by Ido Schimmel <[email protected]>--- .../selftests/drivers/net/bonding/Makefile | 1 + .../bonding/bond_lacp_independent_control.sh | 144 ++++++++++++++++++ .../selftests/drivers/net/bonding/config | 6 + 3 files changed, 151 insertions(+) create mode 100755 tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.shtools/testing/selftests/drivers/net/bonding/Makefile +1
-0@@ -7,6 +7,7 @@ TEST_PROGS := \ bond-eth-type-change.sh \ bond-lladdr-target.sh \ bond_ipsec_offload.sh \ + bond_lacp_independent_control.sh \ bond_lacp_prio.sh \ bond_lacp_strict.sh \ bond_macvlan_ipvlan.sh \tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +144
-0@@ -0,0 +1,144 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# +-------------------------+ +-------------------------+ +# | H1 (vrf) | | H2 (vrf) | +# | + bond1 (802.3ad) | | + bond2 (802.3ad) | +# | | coupled_control off | | | | +# | | 192.0.2.1/28 | | | 192.0.2.2/28 | +# | | | | | | +# | + $h1 | | + $h2 | +# +--|----------------------+ +--|----------------------+ +# | | +# +---------------------------+ + +# shellcheck disable=SC2034,SC2329 +ALL_TESTS=" + collecting + distributing +" +NUM_NETIFS=2 +REQUIRE_MZ=no +lib_dir=$(dirname "$0") +# shellcheck disable=SC1091 +source "$lib_dir"/../../../net/forwarding/lib.sh + +lacp_state_get() +{ + local dev=$1; shift + + ip -d -j link show dev "$dev" | \ + jq '.[].linkinfo.info_slave_data.ad_actor_oper_port_state' +} + +# The actor state of a port in ATTACHED state is 0x0f: Activity (0x01), +# Timeout (0x02), Aggregation (0x04) and Synchronization (0x08). The +# Collecting (0x10) bit is added in COLLECTING state (0x1f) and the +# Distributing (0x20) bit in DISTRIBUTING state (0x3f). +lacp_state_wait() +{ + local dev=$1; shift + local state=$1; shift + + slowwait "$WAIT_TIMEOUT" until_counter_is "== $state" \ + lacp_state_get "$dev" > /dev/null +} + +partner_state_clear() +{ + local bits=$1; shift + + tc filter replace dev "$h1" ingress pref 1 handle 101 protocol 0x8809 \ + flower skip_hw action pedit munge offset 18 u8 set 0 \ + retain "$bits" +} + +h1_create() +{ + adf_ip_link_add bond1 type bond mode 802.3ad lacp_rate fast \ + coupled_control off + adf_ip_link_set_master "$h1" bond1 + adf_simple_if_init bond1 192.0.2.1/28 + + tc qdisc add dev "$h1" clsact + defer tc qdisc del dev "$h1" clsact + + tc qdisc add dev bond1 clsact + defer tc qdisc del dev bond1 clsact + + tc filter add dev bond1 ingress pref 1 handle 101 proto ip \ + flower skip_hw src_ip 192.0.2.2 dst_ip 192.0.2.1 \ + ip_proto icmp type 8 action pass + defer tc filter del dev bond1 ingress pref 1 handle 101 flower +} + +h2_create() +{ + adf_ip_link_add bond2 type bond mode 802.3ad lacp_rate fast + adf_ip_link_set_master "$h2" bond2 + adf_simple_if_init bond2 192.0.2.2/28 +} + +setup_prepare() +{ + h1=${NETIFS[p1]} + h2=${NETIFS[p2]} + + adf_vrf_prepare + + h1_create + h2_create +} + +collecting() +{ + local pkts + + RET=0 + + # Clear the Synchronization (0x08) and Collecting (0x10) bits in the + # partner's state to move $h1 to ATTACHED state and then only clear + # the Collecting bit to move it to COLLECTING state. + 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" + + partner_state_clear 0x10 + lacp_state_wait "$h1" 0x1f + check_err $? "Port did not reach COLLECTING state" + + # $h1 cannot reply to ARP requests in COLLECTING state. + ip neigh add 192.0.2.1 lladdr "$(mac_get bond1)" dev bond2 \ + nud permanent + defer ip neigh del 192.0.2.1 dev bond2 + + ping_do bond2 192.0.2.1 + pkts=$(tc_rule_handle_stats_get "dev bond1 ingress" 101) + ((pkts >= PING_COUNT)) + check_err $? "Packets not received in COLLECTING state" + + log_test "Receive in COLLECTING state" +} + +distributing() +{ + RET=0 + + lacp_state_wait "$h1" 0x3f + check_err $? "Port did not reach DISTRIBUTING state" + + ping_do bond2 192.0.2.1 + check_err $? "Ping failed" + + log_test "Ping in DISTRIBUTING state" +} + +trap cleanup EXIT + +setup_prepare +setup_wait + +tests_run + +exit "$EXIT_STATUS"tools/testing/selftests/drivers/net/bonding/config +6
-0@@ -1,13 +1,17 @@ CONFIG_BONDING=y +CONFIG_BPF_SYSCALL=y CONFIG_BRIDGE=y +CONFIG_CGROUP_BPF=y CONFIG_CONFIGFS_FS=y CONFIG_DUMMY=y CONFIG_INET_ESP=y CONFIG_INET_ESP_OFFLOAD=y CONFIG_IPV6=y +CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_IPVLAN=y CONFIG_MACVLAN=y CONFIG_NET_ACT_GACT=y +CONFIG_NET_ACT_PEDIT=m CONFIG_NET_CLS_FLOWER=y CONFIG_NET_CLS_MATCHALL=m CONFIG_NETCONSOLE=m@@ -15,7 +19,9 @@ CONFIG_NETCONSOLE_DYNAMIC=y CONFIG_NETCONSOLE_EXTENDED_LOG=y CONFIG_NETDEVSIM=m CONFIG_NET_IPGRE=y +CONFIG_NET_L3_MASTER_DEV=y CONFIG_NET_SCH_INGRESS=y +CONFIG_NET_VRF=y CONFIG_NLMON=y CONFIG_VETH=y CONFIG_VLAN_8021Q=mSignature · 1 line
2.56.0
Re: [PATCH net-next 2/2] selftests: bonding: Add a test for 802.3ad with coupled control disabled
In reply to Ido SchimmelHi Ido,
Quoted 130 lines · Ido Schimmel
Test that with coupled control disabled, a port in COLLECTING state receives packets.
In this mode, a port only transitions from COLLECTING to DISTRIBUTING state if its partner sets the Collecting bit in its LACPDUs. Therefore, keep the port in COLLECTING state by clearing the Collecting bit in received LACPDUs.
Also test that ping works once the port moves to DISTRIBUTING state.
Use VRFs rather than network namespaces so that the test could be run with a veth pair or a pair of physically connected ports.
Output without "bonding: 3ad: Receive packets in COLLECTING state":
# ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [FAIL] Packets not received in COLLECTING state TEST: Ping in DISTRIBUTING state [ OK ]Output with the fix:
# ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [ OK ] TEST: Ping in DISTRIBUTING state [ OK ]Reviewed-by Petr Machata <[email protected]>Signed-off-by Ido Schimmel <[email protected]>--- .../selftests/drivers/net/bonding/Makefile | 1 + .../bonding/bond_lacp_independent_control.sh | 144 ++++++++++++++++++ .../selftests/drivers/net/bonding/config | 6 + 3 files changed, 151 insertions(+) create mode 100755 tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.shtools/testing/selftests/drivers/net/bonding/Makefile +1
-0@@ -7,6 +7,7 @@ TEST_PROGS := \ bond-eth-type-change.sh \ bond-lladdr-target.sh \ bond_ipsec_offload.sh \ + bond_lacp_independent_control.sh \ bond_lacp_prio.sh \ bond_lacp_strict.sh \ bond_macvlan_ipvlan.sh \tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +77
-0@@ -0,0 +1,144 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# +-------------------------+ +-------------------------+ +# | H1 (vrf) | | H2 (vrf) | +# | + bond1 (802.3ad) | | + bond2 (802.3ad) | +# | | coupled_control off | | | | +# | | 192.0.2.1/28 | | | 192.0.2.2/28 | +# | | | | | | +# | + $h1 | | + $h2 | +# +--|----------------------+ +--|----------------------+ +# | | +# +---------------------------+ + +# shellcheck disable=SC2034,SC2329 +ALL_TESTS=" + collecting + distributing +" +NUM_NETIFS=2 +REQUIRE_MZ=no +lib_dir=$(dirname "$0") +# shellcheck disable=SC1091 +source "$lib_dir"/../../../net/forwarding/lib.sh + +lacp_state_get() +{ + local dev=$1; shift + + ip -d -j link show dev "$dev" | \ + jq '.[].linkinfo.info_slave_data.ad_actor_oper_port_state' +} + +# The actor state of a port in ATTACHED state is 0x0f: Activity (0x01), +# Timeout (0x02), Aggregation (0x04) and Synchronization (0x08). The +# Collecting (0x10) bit is added in COLLECTING state (0x1f) and the +# Distributing (0x20) bit in DISTRIBUTING state (0x3f). +lacp_state_wait() +{ + local dev=$1; shift + local state=$1; shift + + slowwait "$WAIT_TIMEOUT" until_counter_is "== $state" \ + lacp_state_get "$dev" > /dev/null +} + +partner_state_clear() +{ + local bits=$1; shift + + tc filter replace dev "$h1" ingress pref 1 handle 101 protocol 0x8809 \ + flower skip_hw action pedit munge offset 18 u8 set 0 \ + retain "$bits" +} + +h1_create() +{ + adf_ip_link_add bond1 type bond mode 802.3ad lacp_rate fast \ + coupled_control off + adf_ip_link_set_master "$h1" bond1 + adf_simple_if_init bond1 192.0.2.1/28 + + tc qdisc add dev "$h1" clsact + defer tc qdisc del dev "$h1" clsact + + tc qdisc add dev bond1 clsact + defer tc qdisc del dev bond1 clsact + + tc filter add dev bond1 ingress pref 1 handle 101 proto ip \ + flower skip_hw src_ip 192.0.2.2 dst_ip 192.0.2.1 \ + ip_proto icmp type 8 action pass + defer tc filter del dev bond1 ingress pref 1 handle 101 flower +} + +h2_create() +{ + adf_ip_link_add bond2 type bond mode 802.3ad lacp_rate fast
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh line 87
Quoted 10 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +10
-0+ adf_ip_link_set_master "$h2" bond2 + adf_simple_if_init bond2 192.0.2.2/28 +} + +setup_prepare() +{ + h1=${NETIFS[p1]} + h2=${NETIFS[p2]} + + adf_vrf_prepare
Nit: why we need the vrf prepare? The h1/h2 should be veth interface, no?
Quoted 5 lines
tools/testing/selftests/drivers/net/bonding/config +0
-0
tools/testing/selftests/drivers/net/bonding/config line 10
Quoted 10 lines
tools/testing/selftests/drivers/net/bonding/config +3
-0@@ -1,13 +1,17 @@ CONFIG_BONDING=y +CONFIG_BPF_SYSCALL=y CONFIG_BRIDGE=y +CONFIG_CGROUP_BPF=y CONFIG_CONFIGFS_FS=y CONFIG_DUMMY=y CONFIG_INET_ESP=y CONFIG_INET_ESP_OFFLOAD=y CONFIG_IPV6=y +CONFIG_IPV6_MULTIPLE_TABLES=y
Do we need this config ?
Quoted 8 lines
tools/testing/selftests/drivers/net/bonding/config +1
-0CONFIG_IPVLAN=y CONFIG_MACVLAN=y CONFIG_NET_ACT_GACT=y +CONFIG_NET_ACT_PEDIT=m CONFIG_NET_CLS_FLOWER=y CONFIG_NET_CLS_MATCHALL=m CONFIG_NETCONSOLE=m
tools/testing/selftests/drivers/net/bonding/config CONFIG_NETCONSOLE_DYNAMIC=y · line 24
Quoted 6 lines
tools/testing/selftests/drivers/net/bonding/config +2
-0@@ -15,7 +19,9 @@ CONFIG_NETCONSOLE_DYNAMIC=y CONFIG_NETCONSOLE_EXTENDED_LOG=y CONFIG_NETDEVSIM=m CONFIG_NET_IPGRE=y +CONFIG_NET_L3_MASTER_DEV=y CONFIG_NET_SCH_INGRESS=y +CONFIG_NET_VRF=y
If yes, this config could be removed. And the H1 (vrf) description in the chart.
Thanks
Hangbin
Re: [PATCH net-next 2/2] selftests: bonding: Add a test for 802.3ad with coupled control disabled
Quoted 136 lines · Hangbin Liu
Hi Ido,
Quoted 134 lines · Ido Schimmel
Test that with coupled control disabled, a port in COLLECTING state receives packets.
In this mode, a port only transitions from COLLECTING to DISTRIBUTING state if its partner sets the Collecting bit in its LACPDUs. Therefore, keep the port in COLLECTING state by clearing the Collecting bit in received LACPDUs.
Also test that ping works once the port moves to DISTRIBUTING state.
Use VRFs rather than network namespaces so that the test could be run with a veth pair or a pair of physically connected ports.
Output without "bonding: 3ad: Receive packets in COLLECTING state":
# ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [FAIL] Packets not received in COLLECTING state TEST: Ping in DISTRIBUTING state [ OK ]Output with the fix:
# ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [ OK ] TEST: Ping in DISTRIBUTING state [ OK ]Reviewed-by Petr Machata <[email protected]>Signed-off-by Ido Schimmel <[email protected]>--- .../selftests/drivers/net/bonding/Makefile | 1 + .../bonding/bond_lacp_independent_control.sh | 144 ++++++++++++++++++ .../selftests/drivers/net/bonding/config | 6 + 3 files changed, 151 insertions(+) create mode 100755 tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.shtools/testing/selftests/drivers/net/bonding/Makefile +1
-0@@ -7,6 +7,7 @@ TEST_PROGS := \ bond-eth-type-change.sh \ bond-lladdr-target.sh \ bond_ipsec_offload.sh \ + bond_lacp_independent_control.sh \ bond_lacp_prio.sh \ bond_lacp_strict.sh \ bond_macvlan_ipvlan.sh \tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +81
-0@@ -0,0 +1,144 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# +-------------------------+ +-------------------------+ +# | H1 (vrf) | | H2 (vrf) | +# | + bond1 (802.3ad) | | + bond2 (802.3ad) | +# | | coupled_control off | | | | +# | | 192.0.2.1/28 | | | 192.0.2.2/28 | +# | | | | | | +# | + $h1 | | + $h2 | +# +--|----------------------+ +--|----------------------+ +# | | +# +---------------------------+ + +# shellcheck disable=SC2034,SC2329 +ALL_TESTS=" + collecting + distributing +" +NUM_NETIFS=2 +REQUIRE_MZ=no +lib_dir=$(dirname "$0") +# shellcheck disable=SC1091 +source "$lib_dir"/../../../net/forwarding/lib.sh + +lacp_state_get() +{ + local dev=$1; shift + + ip -d -j link show dev "$dev" | \ + jq '.[].linkinfo.info_slave_data.ad_actor_oper_port_state' +} + +# The actor state of a port in ATTACHED state is 0x0f: Activity (0x01), +# Timeout (0x02), Aggregation (0x04) and Synchronization (0x08). The +# Collecting (0x10) bit is added in COLLECTING state (0x1f) and the +# Distributing (0x20) bit in DISTRIBUTING state (0x3f). +lacp_state_wait() +{ + local dev=$1; shift + local state=$1; shift + + slowwait "$WAIT_TIMEOUT" until_counter_is "== $state" \ + lacp_state_get "$dev" > /dev/null +} + +partner_state_clear() +{ + local bits=$1; shift + + tc filter replace dev "$h1" ingress pref 1 handle 101 protocol 0x8809 \ + flower skip_hw action pedit munge offset 18 u8 set 0 \ + retain "$bits" +} + +h1_create() +{ + adf_ip_link_add bond1 type bond mode 802.3ad lacp_rate fast \ + coupled_control off + adf_ip_link_set_master "$h1" bond1 + adf_simple_if_init bond1 192.0.2.1/28 + + tc qdisc add dev "$h1" clsact + defer tc qdisc del dev "$h1" clsact + + tc qdisc add dev bond1 clsact + defer tc qdisc del dev bond1 clsact + + tc filter add dev bond1 ingress pref 1 handle 101 proto ip \ + flower skip_hw src_ip 192.0.2.2 dst_ip 192.0.2.1 \ + ip_proto icmp type 8 action pass + defer tc filter del dev bond1 ingress pref 1 handle 101 flower +} + +h2_create() +{ + adf_ip_link_add bond2 type bond mode 802.3ad lacp_rate fast + adf_ip_link_set_master "$h2" bond2 + adf_simple_if_init bond2 192.0.2.2/28 +} +
Quoted 8 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh line 87
Quoted 6 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +6
-0+setup_prepare() +{ + h1=${NETIFS[p1]} + h2=${NETIFS[p2]} + + adf_vrf_prepareNit: why we need the vrf prepare? The h1/h2 should be veth interface, no?
No. The VRF usage is intentional. From the commit message:
"Use VRFs rather than network namespaces so that the test could be run with a veth pair or a pair of physically connected ports."
Quoted 10 lines
Quoted 10 lines
tools/testing/selftests/drivers/net/bonding/config +2
-0@@ -1,13 +1,17 @@ CONFIG_BONDING=y +CONFIG_BPF_SYSCALL=y CONFIG_BRIDGE=y +CONFIG_CGROUP_BPF=y
Quoted 8 lines
tools/testing/selftests/drivers/net/bonding/config line 10
Quoted 6 lines
tools/testing/selftests/drivers/net/bonding/config +1
-0CONFIG_CONFIGFS_FS=y CONFIG_DUMMY=y CONFIG_INET_ESP=y CONFIG_INET_ESP_OFFLOAD=y CONFIG_IPV6=y +CONFIG_IPV6_MULTIPLE_TABLES=yDo we need this config ?
Yes. CONFIG_NET_VRF depends on it when IPv6 is enabled and it's not enabled by default. Other config files that enable CONFIG_NET_VRF list it as well.
Quoted 10 lines
Quoted 10 lines
tools/testing/selftests/drivers/net/bonding/config +1
-0CONFIG_IPVLAN=y CONFIG_MACVLAN=y CONFIG_NET_ACT_GACT=y +CONFIG_NET_ACT_PEDIT=m CONFIG_NET_CLS_FLOWER=y CONFIG_NET_CLS_MATCHALL=m CONFIG_NETCONSOLE=m@@ -15,7 +19,9 @@ CONFIG_NETCONSOLE_DYNAMIC=y CONFIG_NETCONSOLE_EXTENDED_LOG=y
Quoted 8 lines
tools/testing/selftests/drivers/net/bonding/config CONFIG_NETCONSOLE_DYNAMIC=y · line 24
Quoted 5 lines
tools/testing/selftests/drivers/net/bonding/config +2
-0CONFIG_NETDEVSIM=m CONFIG_NET_IPGRE=y +CONFIG_NET_L3_MASTER_DEV=y CONFIG_NET_SCH_INGRESS=y +CONFIG_NET_VRF=yIf yes, this config could be removed. And the H1 (vrf) description in the chart.
See above. VRF is needed.
Re: [PATCH net-next 2/2] selftests: bonding: Add a test for 802.3ad with coupled control disabled
Hi Ido,
Quoted 146 lines · Ido Schimmel
Quoted 136 lines · Hangbin Liu
Hi Ido,
Quoted 134 lines · Ido Schimmel
Test that with coupled control disabled, a port in COLLECTING state receives packets.
In this mode, a port only transitions from COLLECTING to DISTRIBUTING state if its partner sets the Collecting bit in its LACPDUs. Therefore, keep the port in COLLECTING state by clearing the Collecting bit in received LACPDUs.
Also test that ping works once the port moves to DISTRIBUTING state.
Use VRFs rather than network namespaces so that the test could be run with a veth pair or a pair of physically connected ports.
Output without "bonding: 3ad: Receive packets in COLLECTING state":
# ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [FAIL] Packets not received in COLLECTING state TEST: Ping in DISTRIBUTING state [ OK ]Output with the fix:
# ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [ OK ] TEST: Ping in DISTRIBUTING state [ OK ]Reviewed-by Petr Machata <[email protected]>Signed-off-by Ido Schimmel <[email protected]>--- .../selftests/drivers/net/bonding/Makefile | 1 + .../bonding/bond_lacp_independent_control.sh | 144 ++++++++++++++++++ .../selftests/drivers/net/bonding/config | 6 + 3 files changed, 151 insertions(+) create mode 100755 tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.shtools/testing/selftests/drivers/net/bonding/Makefile +1
-0@@ -7,6 +7,7 @@ TEST_PROGS := \ bond-eth-type-change.sh \ bond-lladdr-target.sh \ bond_ipsec_offload.sh \ + bond_lacp_independent_control.sh \ bond_lacp_prio.sh \ bond_lacp_strict.sh \ bond_macvlan_ipvlan.sh \tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +81
-0@@ -0,0 +1,144 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# +-------------------------+ +-------------------------+ +# | H1 (vrf) | | H2 (vrf) | +# | + bond1 (802.3ad) | | + bond2 (802.3ad) | +# | | coupled_control off | | | | +# | | 192.0.2.1/28 | | | 192.0.2.2/28 | +# | | | | | | +# | + $h1 | | + $h2 | +# +--|----------------------+ +--|----------------------+ +# | | +# +---------------------------+ + +# shellcheck disable=SC2034,SC2329 +ALL_TESTS=" + collecting + distributing +" +NUM_NETIFS=2 +REQUIRE_MZ=no +lib_dir=$(dirname "$0") +# shellcheck disable=SC1091 +source "$lib_dir"/../../../net/forwarding/lib.sh + +lacp_state_get() +{ + local dev=$1; shift + + ip -d -j link show dev "$dev" | \ + jq '.[].linkinfo.info_slave_data.ad_actor_oper_port_state' +} + +# The actor state of a port in ATTACHED state is 0x0f: Activity (0x01), +# Timeout (0x02), Aggregation (0x04) and Synchronization (0x08). The +# Collecting (0x10) bit is added in COLLECTING state (0x1f) and the +# Distributing (0x20) bit in DISTRIBUTING state (0x3f). +lacp_state_wait() +{ + local dev=$1; shift + local state=$1; shift + + slowwait "$WAIT_TIMEOUT" until_counter_is "== $state" \ + lacp_state_get "$dev" > /dev/null +} + +partner_state_clear() +{ + local bits=$1; shift + + tc filter replace dev "$h1" ingress pref 1 handle 101 protocol 0x8809 \ + flower skip_hw action pedit munge offset 18 u8 set 0 \ + retain "$bits" +} + +h1_create() +{ + adf_ip_link_add bond1 type bond mode 802.3ad lacp_rate fast \ + coupled_control off + adf_ip_link_set_master "$h1" bond1 + adf_simple_if_init bond1 192.0.2.1/28 + + tc qdisc add dev "$h1" clsact + defer tc qdisc del dev "$h1" clsact + + tc qdisc add dev bond1 clsact + defer tc qdisc del dev bond1 clsact + + tc filter add dev bond1 ingress pref 1 handle 101 proto ip \ + flower skip_hw src_ip 192.0.2.2 dst_ip 192.0.2.1 \ + ip_proto icmp type 8 action pass + defer tc filter del dev bond1 ingress pref 1 handle 101 flower +} + +h2_create() +{ + adf_ip_link_add bond2 type bond mode 802.3ad lacp_rate fast + adf_ip_link_set_master "$h2" bond2 + adf_simple_if_init bond2 192.0.2.2/28 +} +Quoted 8 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh line 87
Quoted 6 lines
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh new file +6
-0+setup_prepare() +{ + h1=${NETIFS[p1]} + h2=${NETIFS[p2]} + + adf_vrf_prepareNit: why we need the vrf prepare? The h1/h2 should be veth interface, no?
Quoted 5 lines
No. The VRF usage is intentional. From the commit message:
"Use VRFs rather than network namespaces so that the test could be run with a veth pair or a pair of physically connected ports."
Oh, I wrote too few VRF tests. I just noticed that we use adf_simple_if_init to create the VRF interfaces.
For a pair of physically connected ports, do you mean two ports connected back-to-back on the *same* host? Otherwise I’m not sure how to run the test using two physical ports across two different hosts.
Quoted 42 lines
Quoted 10 lines
Quoted 10 lines
tools/testing/selftests/drivers/net/bonding/config +2
-0@@ -1,13 +1,17 @@ CONFIG_BONDING=y +CONFIG_BPF_SYSCALL=y CONFIG_BRIDGE=y +CONFIG_CGROUP_BPF=yQuoted 8 lines
tools/testing/selftests/drivers/net/bonding/config line 10
Quoted 6 lines
tools/testing/selftests/drivers/net/bonding/config +1
-0CONFIG_CONFIGFS_FS=y CONFIG_DUMMY=y CONFIG_INET_ESP=y CONFIG_INET_ESP_OFFLOAD=y CONFIG_IPV6=y +CONFIG_IPV6_MULTIPLE_TABLES=yDo we need this config ?
Yes.
CONFIG_NET_VRFdepends on it when IPv6 is enabled and it's not enabled by default. Other config files that enableCONFIG_NET_VRFlist it as well.Quoted 10 lines
Quoted 10 lines
tools/testing/selftests/drivers/net/bonding/config +1
-0CONFIG_IPVLAN=y CONFIG_MACVLAN=y CONFIG_NET_ACT_GACT=y +CONFIG_NET_ACT_PEDIT=m CONFIG_NET_CLS_FLOWER=y CONFIG_NET_CLS_MATCHALL=m CONFIG_NETCONSOLE=m@@ -15,7 +19,9 @@ CONFIG_NETCONSOLE_DYNAMIC=y CONFIG_NETCONSOLE_EXTENDED_LOG=yQuoted 8 lines
tools/testing/selftests/drivers/net/bonding/config CONFIG_NETCONSOLE_DYNAMIC=y · line 24
Quoted 5 lines
tools/testing/selftests/drivers/net/bonding/config +2
-0CONFIG_NETDEVSIM=m CONFIG_NET_IPGRE=y +CONFIG_NET_L3_MASTER_DEV=y CONFIG_NET_SCH_INGRESS=y +CONFIG_NET_VRF=yIf yes, this config could be removed. And the H1 (vrf) description in the chart.
Quoted 1 line
See above. VRF is needed.
Thanks for the explanation.
Regards
Hangbin
Re: [PATCH net-next 2/2] selftests: bonding: Add a test for 802.3ad with coupled control disabled
Quoted 3 lines · Hangbin Liu
For a pair of physically connected ports, do you mean two ports connected back-to-back on the *same* host? Otherwise I’m not sure how to run the test using two physical ports across two different hosts.
Yes, on the same host. That way we can test both the hardware data path and the software data path (with veth pairs). See tools/testing/selftests/net/forwarding/README
Re: [PATCH net-next 2/2] selftests: bonding: Add a test for 802.3ad with coupled control disabled
Quoted 8 lines · Ido Schimmel
Quoted 3 lines · Hangbin Liu
For a pair of physically connected ports, do you mean two ports connected back-to-back on the *same* host? Otherwise I’m not sure how to run the test using two physical ports across two different hosts.
Yes, on the same host. That way we can test both the hardware data path and the software data path (with veth pairs). See
tools/testing/selftests/net/forwarding/README
Got it, thanks for this info.
Regards
Hangbin
Re: [PATCH net-next 2/2] selftests: bonding: Add a test for 802.3ad with coupled control disabled
In reply to Ido SchimmelQuoted 26 lines · Ido Schimmel
Test that with coupled control disabled, a port in COLLECTING state receives packets.
In this mode, a port only transitions from COLLECTING to DISTRIBUTING state if its partner sets the Collecting bit in its LACPDUs. Therefore, keep the port in COLLECTING state by clearing the Collecting bit in received LACPDUs.
Also test that ping works once the port moves to DISTRIBUTING state.
Use VRFs rather than network namespaces so that the test could be run with a veth pair or a pair of physically connected ports.
Output without "bonding: 3ad: Receive packets in COLLECTING state":
# ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [FAIL] Packets not received in COLLECTING state TEST: Ping in DISTRIBUTING state [ OK ]Output with the fix:
# ./bond_lacp_independent_control.sh TEST: Receive in COLLECTING state [ OK ] TEST: Ping in DISTRIBUTING state [ OK ]
Quoted 9 lines
Reviewed-by Petr Machata <[email protected]>Signed-off-by Ido Schimmel <[email protected]>--- .../selftests/drivers/net/bonding/Makefile | 1 + .../bonding/bond_lacp_independent_control.sh | 144 ++++++++++++++++++ .../selftests/drivers/net/bonding/config | 6 + 3 files changed, 151 insertions(+)create mode 100755
tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] The fix clears 'inactive' only when ad_enable_collecting() runs.
- [Low] The patch fixes a real, user-visible bug but has no Fixes: tag.
--
bonding: 3ad: Receive packets in COLLECTING state
With coupled control disabled, an 802.3ad port in COLLECTING state should receive packets, but the RX path only delivers from slaves whose inactive flag is cleared. This patch makes bond_set_slave_rx_enabled_flags() clear slave->inactive in addition to slave->rx_disabled.
Quoted 6 lines
When coupled control is disabled, a port in COLLECTING state is supposed to receive packets, but it does not. The bond only delivers packets from slaves whose 'inactive' flag is cleared, whereas
bond_set_slave_rx_enabled_flags()only clears 'rx_disabled'.Fix by clearing 'inactive' as well.
[Severity: Low]
Should this carry a Fixes: tag?
bond_set_slave_rx_enabled_flags() was added by commit 240fd405528b ("bonding: Add independent control state machine"), and that commit only cleared rx_disabled. The RX gate in bond_should_deliver_exact_match() checks only bond_is_slave_inactive(), so the bug goes back to that commit.
The notes say this targets net-next because it never worked, and that makes sense. A tag would still let stable and distro maintainers link the fix to the original commit:
include/net/bonding.h static inline void bond_set_slave_active_flags(struct slave *slave, · line 599
Quoted 11 lines
include/net/bonding.h +1
-0@@ -594,6 +594,7 @@ static inline void bond_set_slave_active_flags(struct slave *slave,static inline void bond_set_slave_rx_enabled_flags (struct slave *slave,bool notify) { + slave->inactive =0 ; slave->rx_disabled =0 ; }
[Severity: Medium]
With this change, inactive is only cleared when ad_enable_collecting() runs. Can a COLLECTING port still be left with inactive=1 and rx_disabled=0?
bond_option_all_slaves_active_set() can still set inactive without touching rx_disabled when all_slaves_active goes from 1 to 0:
drivers/net/bonding/bond_options.c:bond_option_all_slaves_active_set() {
...
bond_for_each_slave(bond, slave, iter) {
if (!bond_is_active_slave(slave)) {
if (newval->value)
slave->inactive = 0;
else
slave->inactive = 1;
}
}
...
}A COLLECTING port matches !bond_is_active_slave(). This is because ad_disable_distributing()->__disable_distributing_port()-> bond_set_slave_tx_disabled_flags() left it in BOND_STATE_BACKUP.
The steady-state COLLECTING recheck in ad_mux_machine() only looks at rx_disabled:
drivers/net/bonding/bond_3ad.c:ad_mux_machine() {
...
if (aggregator->is_active &&
bond_is_slave_rx_disabled(slave)) {
ad_enable_collecting(port);
*update_slave_arr = true;
}
...
}Since rx_disabled stays 0, the recheck never fires. Until the next mux transition, bond_should_deliver_exact_match() keeps returning true, and every non-LACPDU frame on that port gets RX_HANDLER_EXACT.
The notes list this as known issue 1 and describe COLLECTING as transient. However, the companion selftest ("selftests: bonding: Add a test for 802.3ad with coupled control disabled") keeps a port in COLLECTING indefinitely by clearing the partner's Collecting bit. So a partner that never sets LACP_STATE_COLLECTING would keep the port dropping traffic.
Would it work to also check bond_is_slave_inactive(slave) in the recheck, for example:
bond_is_slave_rx_disabled(slave) || bond_is_slave_inactive(slave)
That would let the port recover on the next state machine tick.
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261111171947.2816258-1-idosch%40nvidia.com
Hi Ido,
Quoted 39 lines · On Thu, Nov 12, 2026 at 08:21:57PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] The fix clears 'inactive' only when
ad_enable_collecting()runs.
- [Low] The patch fixes a real, user-visible bug but has no Fixes: tag.--
bonding: 3ad: Receive packets in COLLECTING state
With coupled control disabled, an 802.3ad port in COLLECTING state should receive packets, but the RX path only delivers from slaves whose inactive flag is cleared. This patch makes
bond_set_slave_rx_enabled_flags()clearslave->inactivein addition toslave->rx_disabled.Quoted 6 lines
When coupled control is disabled, a port in COLLECTING state is supposed to receive packets, but it does not. The bond only delivers packets from slaves whose 'inactive' flag is cleared, whereas
bond_set_slave_rx_enabled_flags()only clears 'rx_disabled'.Fix by clearing 'inactive' as well.
[Severity: Low]
Should this carry a Fixes: tag?
bond_set_slave_rx_enabled_flags()was added by commit240fd405528b("bonding: Add independent control state machine"), and that commit only clearedrx_disabled. The RX gate inbond_should_deliver_exact_match()checks onlybond_is_slave_inactive(), so the bug goes back to that commit.
Quoted 5 lines
The notes say this targets net-next because it never worked, and that makes sense. A tag would still let stable and distro maintainers link the fix to the original commit:
Fixes 240fd405528b ("bonding: Add independent control state machine")
Makes sense to me.
Quoted 55 lines
include/net/bonding.h static inline void bond_set_slave_active_flags(struct slave *slave, · line 599
Quoted 12 lines
include/net/bonding.h +1
-0@@ -594,6 +594,7 @@ static inline void bond_set_slave_active_flags(struct slave *slave,static inline void bond_set_slave_rx_enabled_flags (struct slave *slave,bool notify) { + slave->inactive =0 ; slave->rx_disabled =0 ; }[Severity: Medium]
With this change, inactive is only cleared whenad_enable_collecting()runs. Can a COLLECTING port still be left with inactive=1 and rx_disabled=0?
bond_option_all_slaves_active_set()can still set inactive without touchingrx_disabledwhenall_slaves_activegoes from 1 to 0:drivers/net/bonding/bond_options.c:bond_option_all_slaves_active_set() { ... bond_for_each_slave(bond, slave, iter) { if (!bond_is_active_slave(slave)) { if (newval->value) slave->inactive = 0; else slave->inactive = 1; } } ... }A COLLECTING port matches !bond_is_active_slave(). This is because ad_disable_distributing()->__disable_distributing_port()->
bond_set_slave_tx_disabled_flags()left it inBOND_STATE_BACKUP.The steady-state COLLECTING recheck in
ad_mux_machine()only looks atrx_disabled:drivers/net/bonding/bond_3ad.c:ad_mux_machine() { ... if (aggregator->is_active && bond_is_slave_rx_disabled(slave)) { ad_enable_collecting(port); *update_slave_arr = true; } ... }Since
rx_disabledstays 0, the recheck never fires. Until the next mux transition,bond_should_deliver_exact_match()keeps returning true, and every non-LACPDU frame on that port getsRX_HANDLER_EXACT.
Quoted 6 lines
The notes list this as known issue 1 and describe COLLECTING as transient. However, the companion selftest ("selftests: bonding: Add a test for 802.3ad with coupled control disabled") keeps a port in COLLECTING indefinitely by clearing the partner's Collecting bit. So a partner that never sets
LACP_STATE_COLLECTINGwould keep the port dropping traffic.
If the partner does not set LACP_STATE_COLLECTING, it is not supposed to send any packets.
Quoted 6 lines
Would it work to also check
bond_is_slave_inactive(slave)in the recheck, for example:bond_is_slave_rx_disabled(slave) || bond_is_slave_inactive(slave)That would let the port recover on the next state machine tick.
I'm fine with or without this checking. But having this check looks better. Up to you.
Thanks
Hangbin
tl;dr - I believe the patch is fine as-is.
Quoted 39 lines · On Thu, Nov 12, 2026 at 08:21:57PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] The fix clears 'inactive' only when
ad_enable_collecting()runs.
- [Low] The patch fixes a real, user-visible bug but has no Fixes: tag.--
bonding: 3ad: Receive packets in COLLECTING state
With coupled control disabled, an 802.3ad port in COLLECTING state should receive packets, but the RX path only delivers from slaves whose inactive flag is cleared. This patch makes
bond_set_slave_rx_enabled_flags()clearslave->inactivein addition toslave->rx_disabled.Quoted 6 lines
When coupled control is disabled, a port in COLLECTING state is supposed to receive packets, but it does not. The bond only delivers packets from slaves whose 'inactive' flag is cleared, whereas
bond_set_slave_rx_enabled_flags()only clears 'rx_disabled'.Fix by clearing 'inactive' as well.
[Severity: Low]
Should this carry a Fixes: tag?
bond_set_slave_rx_enabled_flags()was added by commit240fd405528b("bonding: Add independent control state machine"), and that commit only clearedrx_disabled. The RX gate inbond_should_deliver_exact_match()checks onlybond_is_slave_inactive(), so the bug goes back to that commit.
Quoted 5 lines
The notes say this targets net-next because it never worked, and that makes sense. A tag would still let stable and distro maintainers link the fix to the original commit:
Fixes 240fd405528b ("bonding: Add independent control state machine")
Addressed in the notes. Not a regression and therefore should go via net-next and shouldn't be picked up for stable.
Quoted 62 lines
include/net/bonding.h static inline void bond_set_slave_active_flags(struct slave *slave, · line 599
Quoted 12 lines
include/net/bonding.h +1
-0@@ -594,6 +594,7 @@ static inline void bond_set_slave_active_flags(struct slave *slave,static inline void bond_set_slave_rx_enabled_flags (struct slave *slave,bool notify) { + slave->inactive =0 ; slave->rx_disabled =0 ; }[Severity: Medium]
With this change, inactive is only cleared whenad_enable_collecting()runs. Can a COLLECTING port still be left with inactive=1 and rx_disabled=0?
bond_option_all_slaves_active_set()can still set inactive without touchingrx_disabledwhenall_slaves_activegoes from 1 to 0:drivers/net/bonding/bond_options.c:bond_option_all_slaves_active_set() { ... bond_for_each_slave(bond, slave, iter) { if (!bond_is_active_slave(slave)) { if (newval->value) slave->inactive = 0; else slave->inactive = 1; } } ... }A COLLECTING port matches !bond_is_active_slave(). This is because ad_disable_distributing()->__disable_distributing_port()->
bond_set_slave_tx_disabled_flags()left it inBOND_STATE_BACKUP.The steady-state COLLECTING recheck in
ad_mux_machine()only looks atrx_disabled:drivers/net/bonding/bond_3ad.c:ad_mux_machine() { ... if (aggregator->is_active && bond_is_slave_rx_disabled(slave)) { ad_enable_collecting(port); *update_slave_arr = true; } ... }Since
rx_disabledstays 0, the recheck never fires. Until the next mux transition,bond_should_deliver_exact_match()keeps returning true, and every non-LACPDU frame on that port getsRX_HANDLER_EXACT.The notes list this as known issue 1 and describe COLLECTING as transient. However, the companion selftest ("selftests: bonding: Add a test for 802.3ad with coupled control disabled") keeps a port in COLLECTING indefinitely by clearing the partner's Collecting bit. So a partner that never sets
LACP_STATE_COLLECTINGwould keep the port dropping traffic.
Quoted 6 lines
Would it work to also check
bond_is_slave_inactive(slave)in the recheck, for example:bond_is_slave_rx_disabled(slave) || bond_is_slave_inactive(slave)That would let the port recover on the next state machine tick.
Again, addressed in the notes. COLLECTING is not a steady state. A partner that never sets the Collecting bit is not distributing either, so there is no traffic to drop. Once it sets the bit, the port moves to DISTRIBUTING and 'inactive' is cleared. The selftest is only able to send traffic to a port in COLLECTING state because it is clearing the Collecting bit in received LACPDUs using tc-pedit.
Quoted 35 lines · Ido Schimmel
When coupled control is disabled, a port in COLLECTING state is supposed to receive packets, but it does not. The bond only delivers packets from slaves whose 'inactive' flag is cleared, whereas
bond_set_slave_rx_enabled_flags()only clears 'rx_disabled'.Fix by clearing 'inactive' as well.
Reviewed-by Petr Machata <[email protected]>Signed-off-by Ido Schimmel <[email protected]>---
Notes:
Targeting at net-next since this never worked.Known issues that this patch does not address:
1. Changing '
all_slaves_active' from 1 to 0 while a port is in COLLECTING state sets its 'inactive' flag and the port stops receiving until the next mux state transition. This is not new, COLLECTING is a transient state and the option is off by default, so I do not think it is worth handling.2. The 'inactive' flag shares a bitfield with other slave flags. The 802.3ad state machine writes them under the mode lock, while the '
all_slaves_active' handler writes 'inactive' under RTNL only. This is not new.include/net/bonding.h | 1 + 1 file changed, 1 insertion(+)include/net/bonding.h +0
-0
include/net/bonding.h static inline void bond_set_slave_active_flags(struct slave *slave, · line 600
Quoted 7 lines
include/net/bonding.h +1
-0@@ -594,6 +594,7 @@ static inline void bond_set_slave_active_flags(struct slave *slave,static inline void bond_set_slave_rx_enabled_flags (struct slave *slave,bool notify) { + slave->inactive =0 ; slave->rx_disabled =0 ; }
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 11 Nov 2026 19:19:46 +0200 you wrote:
When coupled control is disabled, a port in COLLECTING state is supposed to receive packets, but it does not. The bond only delivers packets from slaves whose 'inactive' flag is cleared, whereas
bond_set_slave_rx_enabled_flags()only clears 'rx_disabled'.Fix by clearing 'inactive' as well.
[...]
Here is the summary with links:
- [net-next,1/2] bonding: 3ad: Receive packets in COLLECTING state
https://git.kernel.org/netdev/net-next/c/ee97179b6851 - [net-next,2/2] selftests: bonding: Add a test for 802.3ad with coupled control disabled https://git.kernel.org/netdev/net-next/c/478d2905efce
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html