From: Hangbin Liu <liuhangbin@gmail.com>
To: Tonghao Zhang <tonghao@bamaicloud.com>
Cc: netdev@vger.kernel.org, Jay Vosburgh <jv@jvosburgh.net>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Nikolay Aleksandrov <razor@blackwall.org>,
Jason Xing <kerneljasonxing@gmail.com>
Subject: Re: [PATCH net-next v3 1/4] net: bonding: use workqueue to make sure peer notify updated in lacp mode
Date: Mon, 1 Dec 2025 10:05:38 +0000 [thread overview]
Message-ID: <aS1ocogQc01owxSC@fedora> (raw)
In-Reply-To: <AACE3A98-C0C0-4B24-BC29-B8EC3A758D90@bamaicloud.com>
On Mon, Dec 01, 2025 at 05:45:49PM +0800, Tonghao Zhang wrote:
> >> * bond_change_active_slave - change the active slave into the specified one
> >> * @bond: our bonding struct
> >> @@ -1270,8 +1299,6 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
> >> BOND_SLAVE_NOTIFY_NOW);
> >>
> >> if (new_active) {
> >> - bool should_notify_peers = false;
> >> -
> >> bond_set_slave_active_flags(new_active,
> >> BOND_SLAVE_NOTIFY_NOW);
> >>
> >> @@ -1280,19 +1307,17 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
> >> old_active);
> >>
> >> if (netif_running(bond->dev)) {
> >> - bond->send_peer_notif =
> >> - bond->params.num_peer_notif *
> >> - max(1, bond->params.peer_notif_delay);
> >> - should_notify_peers =
> >> - bond_should_notify_peers(bond);
> >> + bond_peer_notify_reset(bond);
> >> +
> >> + if (bond_should_notify_peers(bond)) {
> >> + bond->send_peer_notif--;
> >> + call_netdevice_notifiers(
> >> + NETDEV_NOTIFY_PEERS,
> >> + bond->dev);
> >> + }
> >> }
> >>
> >> call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, bond->dev);
> >> - if (should_notify_peers) {
> >> - bond->send_peer_notif--;
> >> - call_netdevice_notifiers(NETDEV_NOTIFY_PEERS,
> >> - bond->dev);
> >> - }
> >> }
> >> }
> >
> > I don’t see the benefit of moving NETDEV_NOTIFY_PEERS before NETDEV_BONDING_FAILOVER.
> > Is there a specific reason or scenario where this ordering change is required?
> No, to simplify the code, and use common peer notify reset function.
bond_change_active_slave() is called under RTNL lock. We can use
bond_peer_notify_reset() here. But I don't think there is a need to move
NETDEV_NOTIFY_PEERS before NETDEV_BONDING_FAILOVER.
Thanks
Hangbin
next prev parent reply other threads:[~2025-12-01 10:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-30 7:48 [PATCH net-next v3 0/4] A series of minor optimizations of the bonding module Tonghao Zhang
2025-11-30 7:48 ` [PATCH net-next v3 1/4] net: bonding: use workqueue to make sure peer notify updated in lacp mode Tonghao Zhang
2025-12-01 6:57 ` Hangbin Liu
2025-12-01 9:45 ` Tonghao Zhang
2025-12-01 10:05 ` Hangbin Liu [this message]
2025-12-01 11:01 ` Tonghao Zhang
2025-12-01 13:56 ` Hangbin Liu
2025-12-22 13:53 ` Tonghao Zhang
2025-11-30 7:48 ` [PATCH net-next v3 2/4] net: bonding: move bond_should_notify_peers, e.g. into rtnl lock block Tonghao Zhang
2025-12-01 7:23 ` Hangbin Liu
2025-12-02 1:54 ` Jason Xing
2025-12-22 14:24 ` Tonghao Zhang
2025-11-30 7:48 ` [PATCH net-next v3 3/4] net: bonding: skip the 2nd trylock when first one fail Tonghao Zhang
2025-12-01 7:35 ` Hangbin Liu
2025-12-22 14:15 ` Tonghao Zhang
2025-12-24 6:00 ` Hangbin Liu
2025-11-30 7:48 ` [PATCH net-next v3 4/4] net: bonding: add the READ_ONCE/WRITE_ONCE for outside lock accessing Tonghao Zhang
2025-12-01 7:43 ` Hangbin Liu
2025-12-01 7:24 ` [PATCH net-next v3 0/4] A series of minor optimizations of the bonding module Hangbin Liu
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=aS1ocogQc01owxSC@fedora \
--to=liuhangbin@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jv@jvosburgh.net \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.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;
as well as URLs for NNTP newsgroup(s).