lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <82317367-CCF4-4E21-84B1-911F8388E3E7@bamaicloud.com>
Date: Sun, 11 May 2025 22:34:17 +0800
From: Tonghao Zhang <tonghao@...aicloud.com>
To: Jay Vosburgh <jv@...sburgh.net>
Cc: netdev@...r.kernel.org,
 "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>,
 Paolo Abeni <pabeni@...hat.com>,
 Simon Horman <horms@...nel.org>,
 Jonathan Corbet <corbet@....net>,
 Andrew Lunn <andrew+netdev@...n.ch>
Subject: Re: [PATCH net-next 3/4] net: bonding: send peer notify when failure
 recovery



> 2025年5月10日 下午9:01,Jay Vosburgh <jv@...sburgh.net> 写道:
> 
> tonghao@...aicloud.com wrote:
> 
>> From: Tonghao Zhang <tonghao@...aicloud.com>
>> 
>> While hardware failures in NICs, optical transceivers, or switches
>> are unavoidable, rapid system recovery can be achieved post-restoration.
>> For example, triggering immediate ARP/ND packet transmission upon
>> LACP failure recovery enables the system to swiftly resume normal
>> operations, thereby minimizing service downtime.
> 
> 	I think this comment needs to be prefaced with something that
> explains that this logic is for the "no stack" architecture.  It don't
> need the entire blurb about what that is, though.
Ok, Update the commit message in v2.
> 
>> Cc: Jay Vosburgh <jv@...sburgh.net>
>> Cc: "David S. Miller" <davem@...emloft.net>
>> Cc: Eric Dumazet <edumazet@...gle.com>
>> Cc: Jakub Kicinski <kuba@...nel.org>
>> Cc: Paolo Abeni <pabeni@...hat.com>
>> Cc: Simon Horman <horms@...nel.org>
>> Cc: Jonathan Corbet <corbet@....net>
>> Cc: Andrew Lunn <andrew+netdev@...n.ch>
>> Signed-off-by: Tonghao Zhang <tonghao@...aicloud.com>
>> ---
>> drivers/net/bonding/bond_3ad.c | 14 ++++++++++++++
>> 1 file changed, 14 insertions(+)
>> 
>> diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>> index c6807e473ab7..6577ce54d115 100644
>> --- a/drivers/net/bonding/bond_3ad.c
>> +++ b/drivers/net/bonding/bond_3ad.c
>> @@ -982,6 +982,19 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker)
>> 	return 0;
>> }
>> 
>> +static void ad_peer_notif_send(struct port *port)
>> +{
>> +	if (!port->aggregator->is_active)
>> +		return;
>> +
>> +	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();
>> +	}
>> +}
>> +
> 
> 	I'm not a fan of the function name, as this doesn't actually
> send any notifications.  Perhaps "ad_cond_set_peer_notif"?  I.e.,
> conditionally set peer notifications on?
> 
>> /**
>> * ad_mux_machine - handle a port's mux state machine
>> * @port: the port we're looking at
>> @@ -1164,6 +1177,7 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
>> 			port->actor_oper_port_state |= LACP_STATE_COLLECTING;
>> 			port->actor_oper_port_state |= LACP_STATE_DISTRIBUTING;
>> 			port->actor_oper_port_state |= LACP_STATE_SYNCHRONIZATION;
>> +			ad_peer_notif_send(port);
>> 			ad_enable_collecting_distributing(port,
>> 							  update_slave_arr);
>> 			port->ntt = true;
> 
> 	This is in the AD_MUX_COLLECTING_DISTRIBUTING case, I think you
> need another one of these in the AD_MUX_DISTRIBUTING case a few lines
> further down to handle the situation when coupled_control is disabled.
pretty good, moving the ad_cond_set_peer_notif to ad_enable_collecting_distributing makes more sense.

diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index c6807e473ab7..d1c2d416ac87 100644
--- 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);
        }
 }


By the way, bond_should_notify_peers should check params.broadcast_neighbor, because curr_active_slave may be NULL. In my test environment, ip li set slave-ethx down and when up again, bond_change_active_slave will set bond->curr_active_slave in lacp mode.

static bool bond_should_notify_peers(struct bonding *bond)
{
        struct bond_up_slave *slaves;
        struct slave *slave = NULL;

        if (BOND_MODE(bond) == BOND_MODE_8023AD) {
                if (!bond->params.broadcast_neighbor)
                        return false;

                slaves = rtnl_dereference(bond->usable_slaves);
                if (!slaves || !READ_ONCE(slaves->count))
                        return false;
        } else {
                slave = rcu_dereference_rtnl(bond->curr_active_slave);
                if (!save || test_bit(__LINK_STATE_LINKWATCH_PENDING,
                                      &slave->dev->state))
                        return false;
        }

        if (!bond->send_peer_notif ||
            bond->send_peer_notif %
            max(1, bond->params.peer_notif_delay) != 0 ||
            !netif_carrier_ok(bond->dev))
                return false;

        netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n",
                   slave ? slave->dev->name : "all");

        return true;
}

> 
> 	-J
> 
>> -- 
>> 2.34.1
>> 
> 
> ---
> 	-Jay Vosburgh, jv@...sburgh.net


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ