[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <7D86A40E-5B09-4ED6-A836-A3DB8050020C@bamaicloud.com>
Date: Tue, 27 May 2025 23:46:12 +0800
From: Tonghao Zhang <tonghao@...aicloud.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org,
Jay Vosburgh <jv@...sburgh.net>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Simon Horman <horms@...nel.org>,
Jonathan Corbet <corbet@....net>,
Andrew Lunn <andrew+netdev@...n.ch>,
Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Nikolay Aleksandrov <razor@...ckwall.org>,
Zengbing Tu <tuzengbing@...iglobal.com>
Subject: Re: [PATCH RESEND net-next v5 3/4] net: bonding: send peer notify
when failure recovery
> 2025年5月27日 22:09,Paolo Abeni <pabeni@...hat.com> 写道:
>
> On 5/22/25 10:55 AM, Tonghao Zhang wrote:
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index b5c34d7f126c..7f03ca9bcbba 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -1242,17 +1242,28 @@ static struct slave *bond_find_best_slave(struct bonding *bond)
>> /* must be called in RCU critical section or with RTNL held */
>> static bool bond_should_notify_peers(struct bonding *bond)
>> {
>> - struct slave *slave = rcu_dereference_rtnl(bond->curr_active_slave);
>> + struct bond_up_slave *usable;
>> + struct slave *slave = NULL;
>>
>> - if (!slave || !bond->send_peer_notif ||
>> + if (!bond->send_peer_notif ||
>> bond->send_peer_notif %
>> max(1, bond->params.peer_notif_delay) != 0 ||
>> - !netif_carrier_ok(bond->dev) ||
>> - test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
>> + !netif_carrier_ok(bond->dev))
>> return false;
>>
>> + if (BOND_MODE(bond) == BOND_MODE_8023AD) {
>> + usable = rcu_dereference_rtnl(bond->usable_slaves);
>> + if (!usable || !READ_ONCE(usable->count))
>> + return false;
>
> The above unconditionally changes the current behavior for
> BOND_MODE_8023AD regardless of the `broadcast_neighbor` value. Why the
> new behavior is not conditioned by broadcast_neighbor == true?
In active-backup or lacp mode, we can the change send_peer_notif, so we check send_peer_notif firstly in this fuction. This is common function for sending ARP/ND packets.
For lacp mode, if usable_slaves is null, so unnecessarily sending ARP/ND packets, and we change send_peer_notif in mux state and add the comment in patch 3.
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -982,6 +982,17 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker)
return 0;
}
+static void ad_cond_set_peer_notif(struct port *port)
+{
+ struct bonding *bond = port->slave->bond;
+
+ if (bond->params.broadcast_neighbor && rtnl_trylock()) {
+ bond->send_peer_notif = bond->params.num_peer_notif *
+ max(1, bond->params.peer_notif_delay);
+ rtnl_unlock();
+ }
+}
+
/**
* ad_mux_machine - handle a port's mux state machine
* @port: the port we're looking at
@@ -2061,6 +2072,8 @@ static void ad_enable_collecting_distributing(struct port *port,
__enable_port(port);
/* Slave array needs update */
*update_slave_arr = true;
+ /* Should notify peers if possible */
+ ad_cond_set_peer_notif(port);
}
}
>
> At least a code comment is deserved.
>
> Thanks,
>
> Paolo
>
>
>
Powered by blists - more mailing lists