Skip to content

Commit 4d2c0cd

Browse files
Mahesh Bandewardavem330
authored andcommitted
bonding: speed/duplex update at NETDEV_UP event
Some NIC drivers don't have correct speed/duplex settings at the time they send NETDEV_UP notification and that messes up the bonding state. Especially 802.3ad mode which is very sensitive to these settings. In the current implementation we invoke bond_update_speed_duplex() when we receive NETDEV_UP, however, ignore the return value. If the values we get are invalid (UNKNOWN), then slave gets removed from the aggregator with speed and duplex set to UNKNOWN while link is still marked as UP. This patch fixes this scenario. Also 802.3ad mode is sensitive to these conditions while other modes are not, so making sure that it doesn't change the behavior for other modes. Signed-off-by: Mahesh Bandewar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b5c7d4e commit 4d2c0cd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3073,7 +3073,16 @@ static int bond_slave_netdev_event(unsigned long event,
30733073
break;
30743074
case NETDEV_UP:
30753075
case NETDEV_CHANGE:
3076-
bond_update_speed_duplex(slave);
3076+
/* For 802.3ad mode only:
3077+
* Getting invalid Speed/Duplex values here will put slave
3078+
* in weird state. So mark it as link-down for the time
3079+
* being and let link-monitoring (miimon) set it right when
3080+
* correct speeds/duplex are available.
3081+
*/
3082+
if (bond_update_speed_duplex(slave) &&
3083+
BOND_MODE(bond) == BOND_MODE_8023AD)
3084+
slave->link = BOND_LINK_DOWN;
3085+
30773086
if (BOND_MODE(bond) == BOND_MODE_8023AD)
30783087
bond_3ad_adapter_speed_duplex_changed(slave);
30793088
/* Fallthrough */

0 commit comments

Comments
 (0)