Article View: linux.kernel.netdev
Article #22859[PATCH net 0/3] bonding: ignore updelay when no active links for broadcast mode
From: Hangbin Liu
Date: Thu, 26 Nov 2026 02:30
Date: Thu, 26 Nov 2026 02:30
126 lines
13522 bytes
13522 bytes
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 <liuhangbin@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 | 14 +++----
.../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, 12 insertions(+), 63 deletions(-)
---
base-commit: 1ab3fb564f20b78615a6d88b8c90da292f29e227
change-id: 20261126-bond_broadcast_updelay-cc4cfb6e0e37
Best regards,
--
Hangbin Liu <liuhangbin@kylinos.cn>
Technical Details
Message-ID:
<20261126-bond_broadcast_updelay-v1-0-188e5538d6ca@kylinos.cn>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371823-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371823-linux-kernel-netdev=dewy.ru From: hangbin.liu@linux.dev (Hangbin Liu) Newsgroups: linux.kernel.netdev Subject: [PATCH net 0/3] bonding: ignore updelay when no active links for broadcast mode Date: Thu, 26 Nov 2026 10:30:54 +0800 Organization: Usenet Network Message-ID: <20261126-bond_broadcast_updelay-v1-0-188e5538d6ca@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="361562"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:OdZYcs2ge7rKx2ZeHEynrY8ElP4= sha256:A9/B8U1KEF1nru7rQYek8YYrnrpvtM9YLJuTulEzWA0= sha1:18+N9ReXuLsiJIt1os7BwIzMOKE= sha256:xNTX8aknPDEesoYunyDdypc7IjaIGaGTYC79sYL03+Y= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id B0B4E125EAE; Thu, 26 Nov 2026 05:31:32 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=linux.dev X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iIInln1Wpu_4; Thu, 26 Nov 2026 05:31:29 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-371823-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 26468125EA3; Thu, 26 Nov 2026 05:31:21 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 6036B3C47A; Thu, 26 Nov 2026 02:31:17 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795660270; b=ai81zVfeJI1Rh/X9DPNDAgZPbGFHq1bre8P/7sPcBjJ3WrlJ1u7jw7TqstcYQfXu1Uep aFJLkwcx3aXFbMzmu0mdEzSkfDnYjynuXJLGfECBS8PwNtkkN5aFpTXzTsivUPHFMMzfK cUUQsk3mGTJYiqKrNlyab3zl8R5rM9GG1cyrev4C7OL5jmtX6tH6hO/g6hLIGu4//RvQI 7sg9/BEBP4FuBT6D8wCGzMyxsahU6+vRzIsXoPbGTTijSrLot2r/FXdjz2pK4i2IKeDgx duCsdAVVu6XOrAdGKA4LZPvWMZQ2WqJZQeD4cfuFKBQPyhGvjUmXgwUxROO+14o/ZNA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795660270; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:From:Subject: Date:Message-Id:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Type:Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To: Cc:X-Mailer; bh=kMxeDlOyVy246zFNkjFb6a+Vb4c4RNhRRen/Z5ufh8I=; b=wXXg3wxGUOtUtpdwWfNdTU0pdhIt/Gss2YCAeHBj+ZFOvz2UHPGQCIf2oU9pUSmRW2Dv 66nxq1N1c1PRR50iPBevWYIjtESwyQgKlSo0GLt+jSkDdaRCygmbFuXo8xgQDet6KVAHs gDRgo9XMSYPByKFqOj4BsePNrxDijnUJU96qX8PIZKl6+3b4mcVe2QgSxLfCWeQU06kDr cdeVpU4LusiwBQodgfG/hkndWLxufcpDYzKCmHSI7PDgjfn7EH9oDU80PaOlDHKI0Ec0s u9e3FTw+Zl/hDQ2IjwdBskFXh/jmGBvLs8bEtv/eCbhuGGqatARCs5okUhBX2SFDYAA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=l7tVnGWO; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79720606A69A; Thu, 26 Nov 2026 02:31:10 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=l7tVnGWO X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.37 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795660269; b=nMQhZ+EKtRHlDln/WrJvmm5CVdOzG/RSrEnQtZidcyeWDYr8Kg2dA5JnWrmmtjvgTSmi k/I3b39wQaTEH+Z1SG9kG5UQjvGjR5NR3EhpWD7dJ8chtTZuM1d47P8jwCZIfz+RtgOxJ B3+cXIbYnObCuYushWicPx3LJsxq/I8HHh99NwNcYThxd4Z2TQDEdZs8HSNzgi+M/8dJ0 0NYDxW3dmZcbkNKuK3+NU8lyD1eGG34H5dG7dVBhqWuBFK8vlhm16vv8NwxjUx1YFg0P9 TWRWHbs1CKJWfjn/y5MsAm67NNcApvQapGevif22gCcKkemUOrNw+KRF713XsRNrDfw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795660269; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:Subject:Date:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer; bh=kMxeDlOyVy246zFNkjFb6a+Vb4c4RNhRRen/Z5ufh8I=; b=azex2a95uHANH79JRj3Wd5VdER71POq3GSK5qg2AsCqB8juosXJsI/Msd7JeuOn+cOot IQ1HYsBqEtiV9L70VdM5j08MYSAFvzHEYYbG6xJS45Dj5od3c9mphx5N55zNngb2JvJzk DBEXgRhVFOeZWH9/FHvAwK7+G8azj03wNq5ispjFuvGX7CV+65TmNlaipcPPeENqPllO1 9kUmQLNIchUNDUuYMbWR3Np23DObvxfnvu94xVNSI7/qbaGqYuqgEXZXGpZgOmsBIiAeh bL0EI1F3o9R5RR0JFZagTFxyk40jvW+ABxm2ZwfSQMMrH5W5ec2eRD3fMGfzFVSWXNw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=l7tVnGWO; arc=none smtp.remote-ip=91.218.175.37 X-Received: from mta0.migadu.com (out-37.mta0.migadu.com [91.218.175.37]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06122606A334 for <netdev@vger.kernel.org>; Thu, 26 Nov 2026 02:31:07 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 06122606A334 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=en3ED6HDdCtLFu2umCErAM1rLJXWL3SVuTu7Aq5hR8I=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1795660266; v=1; x=1796265066; b=l7tVnGWOgrKtXzohludXdLI0s1muEZzOrVp5uwPqF7resYTTsiTgzObnlkTzOmkpYrmboMx0 1zzFcA5uGbmP1vZ5cBtXSFicmlHRTIIV/WGCOVIjO/Z4bM3P4QTYKBaDDcnyZyaizjd2uzaezfr ptm/8OSJ/OwqPQxXk2tCZ7+A= X-Envelope-To: netdev@vger.kernel.org X-Received: by mta11.migadu.com with ESMTPS id 1df46ec555e3532f; Thu, 26 Nov 2026 02:31:05 +0000 X-Mizu-Trace-ID: 1df46ec555e3532f X-Migadu-Flow: FLOW_OUT X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-B4-Tracking: v=1; b=H4sIAAAAAAAC/yWMUQrCMBAFr1L220ATSwSvIlKSzatGJCnZVJTSu zfq5wzMrCQoEULnbqWCV5SYUwN96IjvLt2gYmhMpjdWa2OVzymMvmQX2Ekdlzng6T6KeeDJW/Q 4nqjFc8EU37/xhRIqXf9SFv8A1++Stm0HCSsO6H8AAAA= X-Change-ID: 20261126-bond_broadcast_updelay-cc4cfb6e0e37 X-Cc: "jiangjiehua (A)" <jiangjiehua1@huawei.com>, Hangbin Liu <hangbin.liu@linux.dev>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Hangbin Liu <hangbin.liu@linux.dev> X-Mailer: b4 0.16.0