* [PATCH next] bonding: fix active-backup transition
@ 2017-04-04 1:38 Mahesh Bandewar
2017-04-04 17:32 ` Andy Gospodarek
2017-04-05 14:16 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Mahesh Bandewar @ 2017-04-04 1:38 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, Veaceslav Falico,
Nikolay Aleksandrov, David Miller, Eric Dumazet
Cc: netdev, Mahesh Bandewar, Mahesh Bandewar
From: Mahesh Bandewar <maheshb@google.com>
Earlier patch c4adfc822bf5 ("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: c4adfc822bf5 ("bonding: make speed, duplex setting consistent
with link state")
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
drivers/net/bonding/bond_main.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 27359dab78a1..535388b15cde 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -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);
--
2.12.2.715.g7642488e1d-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH next] bonding: fix active-backup transition
2017-04-04 1:38 [PATCH next] bonding: fix active-backup transition Mahesh Bandewar
@ 2017-04-04 17:32 ` Andy Gospodarek
2017-04-05 14:16 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Andy Gospodarek @ 2017-04-04 17:32 UTC (permalink / raw)
To: Mahesh Bandewar
Cc: Jay Vosburgh, Veaceslav Falico, Nikolay Aleksandrov,
David Miller, Eric Dumazet, netdev, Mahesh Bandewar
On Mon, Apr 03, 2017 at 06:38:39PM -0700, Mahesh Bandewar wrote:
> From: Mahesh Bandewar <maheshb@google.com>
>
> Earlier patch c4adfc822bf5 ("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: c4adfc822bf5 ("bonding: make speed, duplex setting consistent
> with link state")
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Reviewed-by: Andy Gospodarek <andy@greyhouse.net>
> ---
> drivers/net/bonding/bond_main.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 27359dab78a1..535388b15cde 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -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);
> --
> 2.12.2.715.g7642488e1d-goog
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH next] bonding: fix active-backup transition
2017-04-04 1:38 [PATCH next] bonding: fix active-backup transition Mahesh Bandewar
2017-04-04 17:32 ` Andy Gospodarek
@ 2017-04-05 14:16 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-04-05 14:16 UTC (permalink / raw)
To: mahesh; +Cc: j.vosburgh, andy, vfalico, nikolay, edumazet, netdev, maheshb
From: Mahesh Bandewar <mahesh@bandewar.net>
Date: Mon, 3 Apr 2017 18:38:39 -0700
> From: Mahesh Bandewar <maheshb@google.com>
>
> Earlier patch c4adfc822bf5 ("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: c4adfc822bf5 ("bonding: make speed, duplex setting consistent
> with link state")
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-05 14:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 1:38 [PATCH next] bonding: fix active-backup transition Mahesh Bandewar
2017-04-04 17:32 ` Andy Gospodarek
2017-04-05 14:16 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.