Skip to content

Commit dedfd8d

Browse files
jarodwilsonSomasundaram Krishnasamy
authored andcommitted
bonding/802.3ad: fix slave link initialization transition states
Orabug: 31730609 Once in a while, with just the right timing, 802.3ad slaves will fail to properly initialize, winding up in a weird state, with a partner system mac address of 00:00:00:00:00:00. This started happening after a fix to properly track link_failure_count tracking, where an 802.3ad slave that reported itself as link up in the miimon code, but wasn't able to get a valid speed/duplex, started getting set to BOND_LINK_FAIL instead of BOND_LINK_DOWN. That was the proper thing to do for the general "my link went down" case, but has created a link initialization race that can put the interface in this odd state. The simple fix is to instead set the slave link to BOND_LINK_DOWN again, if the link has never been up (last_link_up == 0), so the link state doesn't bounce from BOND_LINK_DOWN to BOND_LINK_FAIL -- it hasn't failed in this case, it simply hasn't been up yet, and this prevents the unnecessary state change from DOWN to FAIL and getting stuck in an init failure w/o a partner mac. Fixes: ea53abf ("bonding/802.3ad: fix link_failure_count tracking") CC: Jay Vosburgh <[email protected]> CC: Veaceslav Falico <[email protected]> CC: Andy Gospodarek <[email protected]> CC: "David S. Miller" <[email protected]> CC: [email protected] Tested-by: Heesoon Kim <[email protected]> Signed-off-by: Jarod Wilson <[email protected]> Acked-by: Jay Vosburgh <[email protected]> Signed-off-by: David S. Miller <[email protected]> (cherry picked from commit 3340312) Signed-off-by: Brian Maly <[email protected]> Reviewed-by: Venkat Venkatsubra <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent 6956f80 commit dedfd8d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3089,13 +3089,18 @@ static int bond_slave_netdev_event(unsigned long event,
30893089
case NETDEV_CHANGE:
30903090
/* For 802.3ad mode only:
30913091
* Getting invalid Speed/Duplex values here will put slave
3092-
* in weird state. So mark it as link-fail for the time
3093-
* being and let link-monitoring (miimon) set it right when
3094-
* correct speeds/duplex are available.
3092+
* in weird state. Mark it as link-fail if the link was
3093+
* previously up or link-down if it hasn't yet come up, and
3094+
* let link-monitoring (miimon) set it right when correct
3095+
* speeds/duplex are available.
30953096
*/
30963097
if (bond_update_speed_duplex(slave) &&
3097-
BOND_MODE(bond) == BOND_MODE_8023AD)
3098-
slave->link = BOND_LINK_FAIL;
3098+
BOND_MODE(bond) == BOND_MODE_8023AD) {
3099+
if (slave->last_link_up)
3100+
slave->link = BOND_LINK_FAIL;
3101+
else
3102+
slave->link = BOND_LINK_DOWN;
3103+
}
30993104

31003105
if (BOND_MODE(bond) == BOND_MODE_8023AD)
31013106
bond_3ad_adapter_speed_duplex_changed(slave);

0 commit comments

Comments
 (0)