mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "jiangjiehua (A)" <jiangjiehua1@huawei.com>
To: Hangbin Liu <hangbin.liu@linux.dev>,
	Jay Vosburgh <jv@jvosburgh.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Tonghao Zhang <tonghao@bamaicloud.com>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Shuah Khan <shuah@kernel.org>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH net 0/3] bonding: ignore updelay when no active links for broadcast mode
Date: Thu, 26 Nov 2026 15:28:52 +0800	[thread overview]
Message-ID: <6cde295b-4c7b-4878-8fda-3732a2ff7c7d@huawei.com> (raw)
In-Reply-To: <20261126-bond_broadcast_updelay-v1-0-188e5538d6ca@kylinos.cn>

Hi Hangbin,

On 11/26/2026 10:30 AM, Hangbin Liu wrote:
> 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>

Tested on v7.4-rc4 in a virtme-ng guest. Ran recovery-updelay.sh (21/21 
OK) and the cover-letter Test A/B; both match the expected updelay behavior.

Tested-by: JiangJieHua <jiangjiehua1@huawei.com>

Thanks,
Jiehua


      parent reply	other threads:[~2026-11-26  7:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  2:30 Hangbin Liu
2026-11-26  2:30 ` [PATCH net 1/3] Revert "bonding: do not set usable_slaves for broadcast mode" Hangbin Liu
2026-11-26  2:30 ` [PATCH net 2/3] bonding: update slave array on link change for broadcast mode Hangbin Liu
2026-11-26  2:30 ` [PATCH net 3/3] selftests: bonding: add recovery updelay test " Hangbin Liu
2026-11-26  2:32 ` [PATCH net 0/3] bonding: ignore updelay when no active links " netdev-bot+sinfo
2026-11-26  7:28 ` jiangjiehua (A) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6cde295b-4c7b-4878-8fda-3732a2ff7c7d@huawei.com \
    --to=jiangjiehua1@huawei.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hangbin.liu@linux.dev \
    --cc=jv@jvosburgh.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=shuah@kernel.org \
    --cc=tonghao@bamaicloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®