Subject: Re: [PATCH v3 net-next 1/4] net: bonding: Notify ports about their initial state

From: Jay Vosburgh <[email-masked]>
Date: Wed, 02 Dec 2020 11:09:39 -0800

Tobias Waldekranz <[email-masked]> wrote:

>When creating a static bond (e.g. balance-xor), all ports will always
>be enabled. This is set, and the corresponding notification is sent
>out, before the port is linked to the bond upper.
>
>In the offloaded case, this ordering is hard to deal with.
>
>The lower will first see a notification that it can not associate with
>any bond. Then the bond is joined. After that point no more
>notifications are sent, so all ports remain disabled.
>
>This change simply sends an extra notification once the port has been
>linked to the upper to synchronize the initial state.

	I'm not objecting to this per se, but looking at team and
net_failover (failover_slave_register), those drivers do not send the
same first notification that bonding does (the "can not associate" one),
but only send a notification after netdev_master_upper_dev_link is
complete.

	Does it therefore make more sense to move the existing
notification within bonding to take place after the upper_dev_link
(where you're adding this new call to bond_lower_state_changed)?  If the
existing notification is effectively useless, this would make the
sequence of notifications consistent across drivers.

	-J

>Signed-off-by: Tobias Waldekranz <[email-masked]>
>---
> drivers/net/bonding/bond_main.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index e0880a3840d7..d6e1f9cf28d5 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -1922,6 +1922,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
> 		goto err_unregister;
> 	}
> 
>+	bond_lower_state_changed(new_slave);
>+
> 	res = bond_sysfs_slave_add(new_slave);
> 	if (res) {
> 		slave_dbg(bond_dev, slave_dev, "Error %d calling bond_sysfs_slave_add\n", res);
>-- 
>2.17.1
>

---
	-Jay Vosburgh, [email-masked]