Commit 3f3c278c authored by Mahesh Bandewar's avatar Mahesh Bandewar Committed by David S. Miller

bonding: fix active-backup transition

Earlier patch c4adfc82 ("bonding: make speed, duplex setting
consistent with link state") made an attempt to keep slave state
consistent with speed and duplex settings. Unfortunately link-state
transition is used to change the active link especially when used
in conjunction with mii-mon. The above mentioned patch broke that
logic. Also when speed and duplex settings for a link are updated
during a link-event, the link-status should not be changed to
invoke correct transition logic.

This patch fixes this issue by moving the link-state update outside
of the bond_update_speed_duplex() fn and to the places where this fn
is called and update link-state selectively.

Fixes: c4adfc82 ("bonding: make speed, duplex setting consistent
with link state")
Signed-off-by: default avatarMahesh Bandewar <maheshb@google.com>
Reviewed-by: default avatarAndy Gospodarek <andy@greyhouse.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 457c79e5
......@@ -378,20 +378,15 @@ static int bond_update_speed_duplex(struct slave *slave)
slave->duplex = DUPLEX_UNKNOWN;
res = __ethtool_get_link_ksettings(slave_dev, &ecmd);
if (res < 0) {
slave->link = BOND_LINK_DOWN;
if (res < 0)
return 1;
}
if (ecmd.base.speed == 0 || ecmd.base.speed == ((__u32)-1)) {
slave->link = BOND_LINK_DOWN;
if (ecmd.base.speed == 0 || ecmd.base.speed == ((__u32)-1))
return 1;
}
switch (ecmd.base.duplex) {
case DUPLEX_FULL:
case DUPLEX_HALF:
break;
default:
slave->link = BOND_LINK_DOWN;
return 1;
}
......@@ -1563,7 +1558,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
new_slave->delay = 0;
new_slave->link_failure_count = 0;
bond_update_speed_duplex(new_slave);
if (bond_update_speed_duplex(new_slave))
new_slave->link = BOND_LINK_DOWN;
new_slave->last_rx = jiffies -
(msecs_to_jiffies(bond->params.arp_interval) + 1);
......@@ -2126,6 +2122,7 @@ static void bond_miimon_commit(struct bonding *bond)
case BOND_LINK_UP:
if (bond_update_speed_duplex(slave)) {
slave->link = BOND_LINK_DOWN;
netdev_warn(bond->dev,
"failed to get link speed/duplex for %s\n",
slave->dev->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment