bonding: 802.3ad: fix no transmission of LACPDUs
Subsystems (4)
v2 cover bonding: 802.3ad: fix no transmission of LACPDUs
The first patch adds some kselftest infrastructure and the reproducer that demonstrates the problem. The second patch fixes the issue.
Jonathan Toppins (2):
selftests: include bonding tests into the kselftest infra
bonding: 802.3ad: fix no transmission of LACPDUs
MAINTAINERS | 1 + drivers/net/bonding/bond_3ad.c | 3 +- tools/testing/selftests/Makefile | 1 + .../selftests/drivers/net/bonding/Makefile | 6 ++ .../net/bonding/bond-break-lacpdu-tx.sh | 82 +++++++++++++++++++ .../selftests/drivers/net/bonding/config | 1 + .../selftests/drivers/net/bonding/settings | 1 + 7 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/drivers/net/bonding/Makefile create mode 100755 tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh create mode 100644 tools/testing/selftests/drivers/net/bonding/config create mode 100644 tools/testing/selftests/drivers/net/bonding/settings
Signature · 1 line
2.31.1
PATCH v2 1/2 selftests: include bonding tests into the kselftest infra
This creates a test collection in drivers/net/bonding for bonding specific kernel selftests.
The first test is a reproducer that provisions a bond and given the specific order in how the ip-link(8) commands are issued the bond never transmits an LACPDU frame on any of its slaves.
---
Notes:
v2:
* fully integrated the test into the kselftests infrastructure
* moved the reproducer to under tools/testing/selftests/drivers/net/bonding
* reduced the test to its minimial amount and used ip-link(8) for all bond interface configuration
MAINTAINERS | 1 + tools/testing/selftests/Makefile | 1 + .../selftests/drivers/net/bonding/Makefile | 6 ++ .../net/bonding/bond-break-lacpdu-tx.sh | 82 +++++++++++++++++++ .../selftests/drivers/net/bonding/config | 1 + .../selftests/drivers/net/bonding/settings | 1 + 6 files changed, 92 insertions(+) create mode 100644 tools/testing/selftests/drivers/net/bonding/Makefile create mode 100755 tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh create mode 100644 tools/testing/selftests/drivers/net/bonding/config create mode 100644 tools/testing/selftests/drivers/net/bonding/settings
MAINTAINERS +1 -0
@@ -3636,6 +3636,7 @@ F: Documentation/networking/bonding.rst F: drivers/net/bonding/ F: include/net/bond* F: include/uapi/linux/if_bonding.h +F: tools/testing/selftests/net/bonding/ BOSCH SENSORTEC BMA400 ACCELEROMETER IIO DRIVER M: Dan Robertson <[email protected]>
tools/testing/selftests/Makefile +1 -0
@@ -12,6 +12,7 @@ TARGETS += cpu-hotplug TARGETS += damon TARGETS += drivers/dma-buf TARGETS += drivers/s390x/uvdevice +TARGETS += drivers/net/bonding TARGETS += efivarfs TARGETS += exec TARGETS += filesystems
tools/testing/selftests/drivers/net/bonding/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 +# Makefile for net selftests + +TEST_PROGS := bond-break-lacpdu-tx.sh + +include ../../../lib.mk
tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh new file +82 -0
82 lines not on this page · raw message
tools/testing/selftests/drivers/net/bonding/config new file +1 -0
@@ -0,0 +1 @@ +CONFIG_BONDING=y
tools/testing/selftests/drivers/net/bonding/settings new file +1 -0
@@ -0,0 +1 @@ +timeout=60
Signature · 1 line
2.31.1
PATCH v2 2/2 bonding: 802.3ad: fix no transmission of LACPDUs
In reply to Jonathan ToppinsThis is caused by the global variable ad_ticks_per_sec being zero as demonstrated by the reproducer script discussed below. This causes all timer values in __ad_timer_to_ticks to be zero, resulting in the periodic timer to never fire.
To reproduce:
Run the script in tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh which puts bonding into a state where it never transmits LACPDUs.
line 44: ip link add fbond type bond mode 4 miimon 200 \
xmit_hash_policy 1 ad_actor_sys_prio 65535 lacp_rate fast
setting bond param: ad_actor_sys_prio
given:
params.ad_actor_system = 0
call stack:
bond_option_ad_actor_sys_prio()
-> bond_3ad_update_ad_actor_settings()
-> set ad.system.sys_priority = bond->params.ad_actor_sys_prio
-> ad.system.sys_mac_addr = bond->dev->dev_addr; because
params.ad_actor_system == 0
results:
ad.system.sys_mac_addr = bond->dev->dev_addrline 48: ip link set fbond address 52:54:00:3B:7C:A6 setting bond MAC addr
call stack:
bond->dev->dev_addr = new_mac
line 52: ip link set fbond type bond ad_actor_sys_prio 65535 setting bond param: ad_actor_sys_prio
given:
params.ad_actor_system = 0
call stack:
bond_option_ad_actor_sys_prio()
-> bond_3ad_update_ad_actor_settings()
-> set ad.system.sys_priority = bond->params.ad_actor_sys_prio
-> ad.system.sys_mac_addr = bond->dev->dev_addr; because
params.ad_actor_system == 0
results:
ad.system.sys_mac_addr = bond->dev->dev_addrline 60: ip link set veth1-bond down master fbond
given:
params.ad_actor_system = 0
params.mode = BOND_MODE_8023AD
ad.system.sys_mac_addr == bond->dev->dev_addr
call stack:
bond_enslave
-> bond_3ad_initialize(); because first slave
-> if ad.system.sys_mac_addr != bond->dev->dev_addr
returnresults:
Nothing is run in bond_3ad_initialize() because dev_add equals sys_mac_addr leaving the global ad_ticks_per_sec zero as it is never initialized anywhere else.
---
Notes:
v2:
* split this fix from the reproducer
drivers/net/bonding/bond_3ad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/bonding/bond_3ad.c +2 -1
@@ -84,7 +84,8 @@ enum ad_link_speed_type { static const u8 null_mac_addr[ETH_ALEN + 2] __long_aligned = {0 ,0 ,0 ,0 ,0 ,0 }; -static u16 ad_ticks_per_sec; + +static u16 ad_ticks_per_sec =1000 /AD_TIMER_INTERVAL ;static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL *HZ ) /1000 ; static const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned =
Signature · 1 line
2.31.1
Re: [PATCH net v2 1/2] selftests: include bonding tests into the kselftest infra
In reply to Jonathan ToppinsQuoted 17 lines · Jonathan Toppins
+++
b/tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.shtools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh new file +15
-0@@ -0,0 +1,82 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +# Regression Test: +# Verify LACPDUs get transmitted after setting the MAC address of +# the bond. +# +# https://bugzilla.redhat.com/show_bug.cgi?id=2020773 +# +# +---------+ +# | fab-br0 | +# +---------+ +# | +# +---------+ +# | fbond |
tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh line 25
Quoted 10 lines
tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh new file +10
-0+# +---------+ +# | | +# +------+ +------+ +# |veth1 | |veth2 | +# +------+ +------+ +# +# We use veths instead of physical interfaces + +set -e +#set -x
nit: maybe remove this debug comment when you post a new version?
Others looks good to me.
Thanks
Hangbin