🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24989

[PATCH net v2 0/3] bonding: ignore updelay when no active links for broadcast mode

#24989
From: Hangbin Liu
Date: Tue, 01 Dec 2026 06:29
132 lines
13852 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>
---
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/20261126-bond_broadcast_updelay-v1-0-188e5538d6ca@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 <liuhangbin@kylinos.cn>
Technical Details
Message-ID: <20261201-bond_broadcast_updelay-v2-0-969e1844f2c4@kylinos.cn>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374726-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374726-linux-kernel-netdev=dewy.ru
From: hangbin.liu@linux.dev (Hangbin Liu)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 0/3] bonding: ignore updelay when no active links
 for broadcast mode
Date: Tue, 01 Dec 2026 14:29:15 +0800
Organization: Usenet Network
Message-ID: <20261201-bond_broadcast_updelay-v2-0-969e1844f2c4@kylinos.cn>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1634862"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Y5Jbpn1sqyeaWcvbhYQ57mBBwuY= sha256:bzTieT8uMES3z+FDOmXyzr/+5/Nzx8j8vP/O414ZRQg=
	sha1:vY+lxwRtcEzBy2sW8PcFV6Y/KbE= sha256:h/7m7lSCyn/523mjqM3ikKxCBzjL1x92oO+np6fJi0Q=
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 7E6DD11725A; Tue,  1 Dec 2026 09:29:59 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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, URIBL_BLOCKED=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 4fQDyCH27nGg;
	Tue,  1 Dec 2026 09:29:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374726-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id EBE16117244; Tue,  1 Dec 2026 09:29:41 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 0707C2698F; Tue,  1 Dec 2026 06:29:39 +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=1796106578;
	b=J+wt3SdbC/isr3NbPtXPRzXHwioXpnihu5VJPK7wRWBo1Z/fPJdx5JJfq7WQce42geoh
	 jDoxyxJ7YhCZJJfiDbk5NVSLvfDyW68jnkv2U6leD0D6e3DXTFvDLr0N/mnCo3IKAcnFN
	 cLcP6RUqFzMUmMqwUg84BSiCYTmTuSb12G/9kI1Q0qrkUkprszr6/oNI8TChl9+sSI4H1
	 TiNmyZgK5H+UjipK/1Gjse1i2m1GEComTQRAoHrcsc4AI8+nm/x4Ft2bZVxPfgy8B/CsO
	 gn5xXNiVnij2kyWPOtmptUbJrZFgdM8aP/pGxipbnIYcp2Zy6EHHcQSK9BpQwmIvYoQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796106578;
	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=X5lG0cGMFjYXCyWvaLKRt9uNxFv+53o9f3BW3cam+kM=;
	b=sIwP3rNpqJ4jbFCe6Jgrf//Ggh5JXPGF6l3XhfYPP1M/yT9n7Pq4AGnfNEyuhJlsa0sl
	 qNtkKgmqj+5ViMmnLep6yBOqFLHx/eQF0CzlET7NSBYpFqqdXt9g0uUI0LAIWsV9f/j8r
	 dCC//dxyqgxWQbLBwSDkB237Na07PTMWjxHCMrtUAcTG94Lac7C2d2WYPjqbZEKmZiOjy
	 ArlL9I4QgeMKQK3Pxbcl84qaxM7zup7qK9HXckiFDet2oRUs+sjxCJXd3lTaZtolRNt+f
	 nyYJNxo2XTeUupk1ar5kVxA4qnqjikmEhkWRtpaZDUOkUd25d8fG9jG+aZJCEuzhojg==
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="F/LRoveS";
	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 201E8606A339;
	Tue,  1 Dec 2026 06:29:38 +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=F/LRoveS
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.13
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796106577;
	b=0dP4MCfyFv91R/kf2/3y6QndGhLWaOrmwVqRWny3ugg/987OLCjiKNL0cevooQgwXXaE
	 7NGG6IsvOFxQxhSZDAzxlpppmryLsP29olVjPa3acZNxyC/45oMXM7OOiDpAf0mKMGDV/
	 hRSPeiNmfQJOnV25fCA3T0/sIYqpYr0gkMDdoVv9dj1KbbpUs7ErYdoenscBdQzpVKeGK
	 NLhE+Yyvtx06oh64lfQk+TCbkoip3kDceQ5nXSDzdXtVMXfGLFqwVBB6FEgIcDZe4Nw/C
	 +m7tMsAJUajshC64De76awzGoA9j/raUCC1NjL0oF/DE3sIeK/LrcU+eR2xz9N/O+CQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796106577;
	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=X5lG0cGMFjYXCyWvaLKRt9uNxFv+53o9f3BW3cam+kM=;
	b=Jrf+oiQOSevnEegEVMMvbbgMGY7gWXkr98AAeCwqHG9FAT7t87cF1cuS+9HMCKb+dmMG
	 mbCXtijePfgzqEvirV/HxSHajVZ2hDkkF6nMk9eR6689ZhTbtxfji9NKtJ6zUELZOFzCQ
	 PU3A0lf8nOxt6nFrMAH3WPRquOjupmN7kWWDoGpPnqwVxA3u5wYfijRsNaKSHJWzqHjht
	 ui8xsMOcyFfWvR78SgJrm28mZldCTJw0CxIiwFNLZLc57FeOS3hhlj863Ul0PDIH2YSMN
	 rM+BVOsoQntgmra7mzieKYEfW7NC2oeChjoEV7zumVDLxwPy1X13SZLY4nzCfnKvE3A==
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="F/LRoveS";
	arc=none smtp.remote-ip=91.218.175.13
X-Received: from mta0.migadu.com (out-13.mta0.migadu.com [91.218.175.13])
	(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 4545F606A68A
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 06:29:35 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4545F606A68A
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=FYbslv45PMJTQTFnn9yu1MpVYZlOYy/Dn5DFTMIk4aA=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1796106574; v=1; x=1796711374;
 b=F/LRoveSxuU0hkI3+Gfl5msnOkrDnO9vqRbC5RTQM6h6MfCHIqpZYV/8yugiXwmyK6FIY1wY
 kIeLrbR5o63ISJ3+sNruy/4tCR1yCmd4jq+1t3WkTcAQkvagknNY+XY+QY57IhqD1pCGHSlUiMR
 KSI5rMwFHXIVmPnzjXeTnuwo=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta11.migadu.com with ESMTPS id 3f04040e873d97f6;
	Tue, 01 Dec 2026 06:29:34 +0000
X-Mizu-Trace-ID: 3f04040e873d97f6
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/4WNQQ6CMBREr0L+2hpapBJX3sMQ0v5+pEpa0hYiI
 dxdwAO4nMmbNwtECpYi3LIFAk02Wu+2IE4ZYKfck5g1WwaRC8m5kEx7ZxodvDKoYmrGwVCvZoZ
 4wVZLyqm4wjYeArX2c4gf4ChB/SvjqF+EaVfuWGdj8mE+7id+wP+eJs5yxquKyrKojER1f8+9d
 T6e0UG9rusXUczMJdQAAAA=
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>, stable@vger.kernel.org
X-Mailer: b4 0.16.0