Article View: linux.kernel.netdev
Article #24991[PATCH net v2 2/3] bonding: update slave array on link change for broadcast mode
From: Hangbin Liu
Date: Tue, 01 Dec 2026 06:29
Date: Tue, 01 Dec 2026 06:29
83 lines
11398 bytes
11398 bytes
From: Hangbin Liu <liuhangbin@kylinos.cn>
The MII monitor uses the usable-slave array to decide whether to
bypass updelay. When no slave can transmit, the first recovering
slave should become usable without waiting for updelay (bonding.rst
section 13.1 paragraph 4). When another slave can still transmit,
the recovering slave should wait.
In broadcast mode, the array is rebuilt when a slave is added or
removed, but not when its link state changes. A stale empty array can
make a recovering slave bypass updelay while another slave is still
forwarding. A stale nonempty array can make the first recovering
slave wait even though no slave can transmit.
Rebuild the arrays upon MII link-state changes. The ARP monitor
`bond_loadbalance_arp_mon` also needs to be updated, since the bonding
monitor mode may be changed at runtime. Apply the same logic in
`bond_open()` and `bond_slave_netdev_event()`.
This relies on the preceding revert of commit 45fc134bcfad ("bonding: do
not set usable_slaves for broadcast mode") to publish the refreshed
usable-slave array.
Fixes: e0caeb24f538 ("net: bonding: update the slave array for broadcast mode")
Cc: stable@vger.kernel.org
Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
---
For Sashiko:
When the bond mode switch from balance-xor to balance-rr, or broadcast
to balance-rr, the published usable_slaves is not changed. This is
issue for balance-rr and will be addressed in another patch.
---
drivers/net/bonding/bond_main.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d6675e87d06b..a8c79fa9f5bf 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2780,6 +2780,7 @@ static void bond_miimon_link_change(struct bonding *bond,
bond_alb_handle_link_change(bond, slave, link);
break;
case BOND_MODE_XOR:
+ case BOND_MODE_BROADCAST:
bond_update_slave_arr(bond, NULL);
break;
}
@@ -3588,7 +3589,8 @@ static void bond_loadbalance_arp_mon(struct bonding *bond)
if (slave_state_changed) {
bond_slave_state_change(bond);
- if (BOND_MODE(bond) == BOND_MODE_XOR)
+ if (BOND_MODE(bond) == BOND_MODE_XOR ||
+ BOND_MODE(bond) == BOND_MODE_BROADCAST)
bond_update_slave_arr(bond, NULL);
}
if (do_failover) {
@@ -4010,7 +4012,8 @@ static int bond_slave_netdev_event(unsigned long event,
* events. If these (miimon/arpmon) parameters are configured
* then array gets refreshed twice and that should be fine!
*/
- if (bond_mode_can_use_xmit_hash(bond))
+ if (bond_mode_can_use_xmit_hash(bond) ||
+ BOND_MODE(bond) == BOND_MODE_BROADCAST)
bond_update_slave_arr(bond, NULL);
break;
case NETDEV_CHANGEMTU:
@@ -4411,7 +4414,8 @@ static int bond_open(struct net_device *bond_dev)
static_branch_inc(&bond_bcast_neigh_enabled);
}
- if (bond_mode_can_use_xmit_hash(bond))
+ if (bond_mode_can_use_xmit_hash(bond) ||
+ BOND_MODE(bond) == BOND_MODE_BROADCAST)
bond_update_slave_arr(bond, NULL);
return 0;
--
2.56.0
Technical Details
Message-ID:
<20261201-bond_broadcast_updelay-v2-2-969e1844f2c4@kylinos.cn>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374728-linux-kernel-netdev=dewy.ruReferences:
<20261201-bond_broadcast_updelay-v2-0-969e1844f2c4@kylinos.cn>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374728-linux-kernel-netdev=dewy.ru From: hangbin.liu@linux.dev (Hangbin Liu) Newsgroups: linux.kernel.netdev Subject: [PATCH net v2 2/3] bonding: update slave array on link change for broadcast mode Date: Tue, 01 Dec 2026 14:29:17 +0800 Organization: Usenet Network Message-ID: <20261201-bond_broadcast_updelay-v2-2-969e1844f2c4@kylinos.cn> References: <20261201-bond_broadcast_updelay-v2-0-969e1844f2c4@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1635015"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:9QsDYP2y89nLw6ARLT1LlC1gAeY= sha256:/oMHmDKg9p2nVnGQGjiChv52oesNTmSRBC7tBgn8fdo= sha1:V/+g8R5DYx1LjNeSNSOlUFNMhqg= sha256:o+ylLRiPVbxiuqBmtIldEpLt8EFRDx/gabV3dZ53H5E= 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 C8CFA11725C; Tue, 1 Dec 2026 09:30:12 +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 NXCNAR_lahpX; Tue, 1 Dec 2026 09:30:10 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374728-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 AF613117254; Tue, 1 Dec 2026 09:30:01 +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 6F4D0230F7; Tue, 1 Dec 2026 06:29:53 +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=1796106592; b=YdVxMuldGRzLPGb+jtmxUwL3bgRUchtwa52mVYIVtdY2+3AIR5Vss5Y5xcAFfjpuFWRb 4VDSQ0gUfN0cDWa8bywEuBAKgeLE2p/vzmccNGEtv3zKmZyykWOT7MKD6d3GcLJnyP1Of 94xm2Olp2rpkmIxT39vHl0eoBIVapPoCwI9RQmgyVSY2iVHE9G6LTVaYU98SJOHnjEzD3 EDcFWA5LLJ3c/27e7Gkf+ua8Idkm60H2k838TnLX6U4a0Cx6Vr7RBsSqwy3wh0/tOpvaK QHa+kFubQ/W2rDqTwYabLhoeJHskfHc/iikjWLBnX4cqYabKskcDyxGGE58wAp0IjIw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796106592; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:From:Date: Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer; bh=UwPGexQ6wfGeqFW+ocS9nGn7dRgH9RJEuiGwB+SD6TI=; b=o+X023yS8eOE2CIRKnxPTdCRrcnboWjm/Bw0g9nEwYT+VLCppDtibh46Tn1tGN+1OSnf P8hB6bojfLdeSx428pH3y1z7uNx12Qz8METvUqd8wsyORA2Yb9D6dYY98FN5nEbu/k8Vy ylLH245Wv2E8I2p3hr9ymUdG5ytVSramUCABldiZQCv5ZajDHQXb6y0KJsq2Q3i+sHgDQ BX5G2w0u7DDxBarVRKg9mAt8nTAbVnhRtlOXSaZSNPbzWF/Pi74gIBONDKu3BPqucHBtC qJwKnseHfhobsXd5xPQohNcQuech0uX12tYMH4RJqMpE1D/lq51HdBpgxfYyQkXRaEQ== 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=BNBic0e8; 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 497F4606A68A; Tue, 1 Dec 2026 06:29:52 +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=BNBic0e8 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.27 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796106591; b=ZmdGLcx/TIL7oxcqzKbtGBxjlPYms2K6z4fiqs5NWi91sFQC1fCrokd+DP/D6gKRhCkm 6I6OBsyvik6CVIn0Q2JV9gyOloKkcKcSrhGv5FQ8C8VwYvxKhbkgro24QYkLZsHA+7Vu1 rN+Kzk4K2v1N3VF485hoMtWetSfpAffzMsCHGCamiHVsy5QwEAciPCT/N8F719DdRYGyF kRpsYg1wvKT4HySLQjpCyZ8nxGfwCPvIcOKk3L7qQyx3K3sFP2Ammke5VR0mj/JRL5Hpk b8TwDSNO5b4qst9hSVzgb0WDBTaHu4h7hSyiuQkwbiX6jWlwBSPeri/lnSnLDZOpb7Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796106591; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer; bh=UwPGexQ6wfGeqFW+ocS9nGn7dRgH9RJEuiGwB+SD6TI=; b=LzIzt8apZnKm4hT9+/TROB6jCPU1Q8xXrSZknf6v5jb20qfCfS+HP90hRVdaYD5adU3i ekwVwrY9ADerqvJSKaRihuvMlJDl3BaBwl3TDgHzL5DHN6m7xCMZ1XlINlKaH6jt8GZ1Z DOK8rrloxeo7XEjeqVu1I2eX50zS6rsspceo9no0f8FfbqIKy9sFUOH5ZA1GBOJwvrudA 2+0njJcB7gP3cmk4+jl1DBzktwAKyU9wrUN/uCaOBftmL82GHWS5L/rmV9QxA8Sj+zKeI GsqkswUhg2c973W9Bz5KSRh8lIX2XVwmfjNcXLuVcuWJZqIUkB1fE3g647RXQaYKS4A== 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=BNBic0e8; arc=none smtp.remote-ip=91.218.175.27 X-Received: from mta0.migadu.com (out-27.mta0.migadu.com [91.218.175.27]) (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 CCBA6606A339 for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 06:29:50 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CCBA6606A339 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=4RtW805D4h/8c4ttC8MvTYJM1XZ8sn6TujANJN4Kh3s=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796106589; v=1; x=1796711389; b=BNBic0e8CCR8CoN2pgunYDWLA/RU0A3bet3+KcBwfIcYHgP9eyXP8VUSZeOW+KwzPzXGF7VF 0gQwQlv29ljviTAaXf/DoPfiH4uIJtCqJS0mBY3pwZxGA7xFxPaKrTVkVO09wlFdteV1G0kWNMA IF/X0RiyUE9aEvrUdfvH8R+4= X-Envelope-To: netdev@vger.kernel.org X-Received: by mta11.migadu.com with ESMTPS id 69820afaf9a9f04d; Tue, 01 Dec 2026 06:29:48 +0000 X-Mizu-Trace-ID: 69820afaf9a9f04d 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-In-Reply-To: <20261201-bond_broadcast_updelay-v2-0-969e1844f2c4@kylinos.cn> 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