This patchset fixes updelay handling for bonding broadcast mode (mode 3) to align with bonding documentation section 13.1 paragraph 4: when a bond has no active links, the first link that comes up must be reused immediately even if updelay is configured; when usable links exist, updelay must be honored. Commit 45fc134bcfad ("bonding: do not set usable_slaves for broadcast mode") tried to fix the second half of that rule by never updating usable_slaves in broadcast mode. That made ignore_updelay permanently false, so updelay was always applied and a broadcast bond with no active links could not recover within the miimon window when one usable slave up. We revert 45fc134bcfad to restore the enslave/release side of the usable_slaves updates, and add the missing bond_miimon_link_change() case so the snapshot also tracks link-state transitions. Both halves are needed: - revert alone: the snapshot is only rebuilt on enslave/release, so batch enslave with updelay (new slaves start in BOND_LINK_BACK) leaves count == 0 forever and updelay is never honored, even once other slaves are usable; - link_change case alone: with 45fc134bcfad applied, bond_set_slave_arr() discards the refreshed array for broadcast. A selftest is added to cover mode 3; the existing mode 1 and mode 2 recovery-updelay tests are merged into a single script covering modes 1, 2 and 3. Before revert 45fc134bcfad: TEST: mode (3) bond recovery [FAIL] No connectivity TEST: mode (3) bond recovery [FAIL] No connectivity TEST: mode (3) bond recovery [FAIL] No connectivity After revert 45fc134bcfad: TEST: mode (3) bond recovery [ OK ] TEST: mode (3) bond recovery [ OK ] TEST: mode (3) bond recovery [ OK ] For the second patch, I use test script ``` ip link add veth0 type veth peer name veth0p ip link add veth1 type veth peer name veth1p ip link set veth0p up ip link set veth1p up ip link add bond0 type bond mode broadcast miimon 100 updelay 1000 ip link set veth0 down ip link set veth1 down ip link set veth0 master bond0 && ip link set veth1 master bond0 ip link set bond0 up sleep 2 dmesg -C # Test A — bullet 1: batch enslave, snapshot stuck at count == 0, # updelay never honored ip link set veth0p down sleep 2 ip link set veth0p up sleep 1 dmesg | tail -n 5 # Test B — bullet 2: stale non-empty snapshot, recovery delayed with # zero usable links ip link set veth0 nomaster ip link set veth1 nomaster ip link set veth0 master bond0 sleep 2 # wait veth0 up ip link set veth1 master bond0 sleep 2 # veth1 comes up after its own updelay; snapshot stays # drop both links (bond has zero usable links after this) ip link set veth0p down ip link set veth1p down sleep 2 ip link set veth0p up sleep 2 dmesg | tail -n 5 ``` With revert only: Test A: [ 13.190593] bond0: (slave veth0): link status definitely down, disabling slave [ 15.165875] bond0: (slave veth0): link status up, enabling it in 0 ms [ 15.165919] bond0: (slave veth0): link status definitely up, 10000 Mbps full duplex Test B: [ 20.366724] bond0: (slave veth1): link status definitely down, disabling slave [ 20.366957] bond0: now running without any active interface! [ 22.341960] bond0: (slave veth0): link status up, enabling it in 1000 ms [ 23.382194] bond0: (slave veth0): link status definitely up, 10000 Mbps full duplex [ 23.382428] bond0: active interface up! With the second patch Test A: [ 6.208526] bond0: (slave veth0): link status definitely down, disabling slave [ 8.184359] bond0: (slave veth0): link status up, enabling it in 1000 ms Test B: [ 13.384852] bond0: (slave veth1): link status definitely down, disabling slave [ 13.385093] bond0: now running without any active interface! [ 15.360849] bond0: (slave veth0): link status up, enabling it in 0 ms We can see when there is active slave, the second slave follow the updelay rule (Test A). When there is no active slave, the first up slave will be in use immediately (Test B). Signed-off-by: Hangbin Liu <liuh…@kylinos.cn> --- Changes in v2: - For patch 2, also rebuild the array in arp monitor in case user changed from arp to miimon. - Link to v1: https://patch.msgid.link/2026…@kylinos.cn --- Hangbin Liu (3): Revert "bonding: do not set usable_slaves for broadcast mode" bonding: update slave array on link change for broadcast mode selftests: bonding: add recovery updelay test for broadcast mode drivers/net/bonding/bond_main.c | 23 ++++++----- .../testing/selftests/drivers/net/bonding/Makefile | 3 +- .../drivers/net/bonding/mode-2-recovery-updelay.sh | 45 ---------------------- ...e-1-recovery-updelay.sh => recovery-updelay.sh} | 13 +++---- 4 files changed, 18 insertions(+), 66 deletions(-) --- base-commit: 1ab3fb564f20b78615a6d88b8c90da292f29e227 change-id: 20261126-bond_broadcast_updelay-cc4cfb6e0e37 Best regards, -- Hangbin Liu <liuh…@kylinos.cn>