Skip to contentSkip to conversation

net: link_watch: mark bonding link events urgent

PATCH Superseded Roopa Prabhu 2 participants 4 messages Jan 22, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: link_watch: mark bonding link events urgent

From: Roopa Prabhu <[email protected]>

It takes 1sec for bond link down notification to hit user-space when all slaves of the bond go down. 1sec is too long for protocol daemons in user-space relying on bond link notification to failover/recover (eg: multichassis lag implementations in user-space). Since the link event code already marks team device port link events
urgent, this patch does the same for bonding link events.

---
 net/core/link_watch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/link_watch.c +1 -1
index 9828616..63bb2ad 100644
@@ -92,7 +92,7 @@ static bool linkwatch_urgent_event(struct net_device *dev)
 	if (dev->ifindex != dev_get_iflink(dev))
 		return true;
 
-	if (dev->priv_flags & IFF_TEAM_PORT)
+	if (dev->priv_flags & (IFF_TEAM_PORT | IFF_BONDING))
 		return true;
 
 	return netif_carrier_ok(dev) &&	qdisc_tx_changing(dev);
Signature · 1 line
2.1.4
#1 lore raw
Quoted 19 lines · Mon, Jan 22, 2018 at 07:07:53AM CET, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

It takes 1sec for bond link down notification to hit user-space when all slaves of the bond go down. 1sec is too long for protocol daemons in user-space relying on bond link notification to failover/recover (eg: multichassis lag implementations in user-space). Since the link event code already marks team device port link events urgent, this patch does the same for bonding link events.

---
net/core/link_watch.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/core/link_watch.c +0 -0
index 9828616..63bb2ad 100644

net/core/link_watch.c static bool linkwatch_urgent_event(struct net_device *dev) · line 95

Quoted 5 lines
net/core/link_watch.c +1 -1
@@ -92,7 +92,7 @@ static bool linkwatch_urgent_event(struct net_device *dev)
 	if (dev->ifindex != dev_get_iflink(dev))
 		return true;
 
-	if (dev->priv_flags & IFF_TEAM_PORT)
+	if (dev->priv_flags & (IFF_TEAM_PORT | IFF_BONDING))

Don't you want to do that for bonding slaves? IFF_BONDING is set for both master and slave. netif_is_bond_slave() helper checks that. In fact netif_is_team_port() should be used here instead of checking IFF_TEAM_PORT directly. And then you can use netif_is_lag_port() to check them both.

Quoted 6 lines
net/core/link_watch.c +0 -0
 		return true;
 
 	return netif_carrier_ok(dev) &&	qdisc_tx_changing(dev);
Signature · 1 line
2.1.4
#2 lore raw
Quoted 23 lines · Jiri Pirko
Quoted 22 lines · Mon, Jan 22, 2018 at 07:07:53AM CET, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

It takes 1sec for bond link down notification to hit user-space when all slaves of the bond go down. 1sec is too long for protocol daemons in user-space relying on bond link notification to failover/recover (eg: multichassis lag implementations in user-space). Since the link event code already marks team device port link events urgent, this patch does the same for bonding link events.

---
net/core/link_watch.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/core/link_watch.c +0 -0
index 9828616..63bb2ad 100644
@@ -92,7 +92,7 @@ static bool linkwatch_urgent_event(struct net_device *dev)
      if (dev->ifindex != dev_get_iflink(dev))
              return true;
 
Quoted 7 lines

net/core/link_watch.c static bool linkwatch_urgent_event(struct net_device *dev) · line 95

Quoted 2 lines
net/core/link_watch.c +1 -1
-      if (dev->priv_flags & IFF_TEAM_PORT)
+      if (dev->priv_flags & (IFF_TEAM_PORT | IFF_BONDING))

Don't you want to do that for bonding slaves? IFF_BONDING is set for both master and slave. netif_is_bond_slave() helper checks that. In fact netif_is_team_port() should be used here instead of checking IFF_TEAM_PORT directly. And then you can use netif_is_lag_port() to check them both.

IFF_BONDING Is set for both slaves and master (and thats what I need). In my case I consistently see link_watch throttle bond link down event ...since it follows immediately after the the bond slave link down events
(any optimizations in the bonding driver for link events are squashed at this point by link watch).
so I do need to cover the bond master case. I think for the use-case I am talking about, team master device might also have the same problem....if somebody else in
user-space is relying on the team master link down (though i do understand the sequence of events are a bit different there...where you set the master link down from user-space).

thanks for the pointers to the helpers..., given above, are you ok if I move the check to netif_is_lag_port || netif_is_lag_master ?

#3 lore raw
Quoted 46 lines · Mon, Jan 22, 2018 at 04:14:17PM CET, [email protected] wrote:
Quoted 23 lines · Jiri Pirko
Quoted 22 lines · Mon, Jan 22, 2018 at 07:07:53AM CET, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

It takes 1sec for bond link down notification to hit user-space when all slaves of the bond go down. 1sec is too long for protocol daemons in user-space relying on bond link notification to failover/recover (eg: multichassis lag implementations in user-space). Since the link event code already marks team device port link events urgent, this patch does the same for bonding link events.

---
net/core/link_watch.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/core/link_watch.c +0 -0
index 9828616..63bb2ad 100644
@@ -92,7 +92,7 @@ static bool linkwatch_urgent_event(struct net_device *dev)
      if (dev->ifindex != dev_get_iflink(dev))
              return true;
 
Quoted 7 lines

net/core/link_watch.c static bool linkwatch_urgent_event(struct net_device *dev) · line 95

Quoted 2 lines
net/core/link_watch.c +1 -1
-      if (dev->priv_flags & IFF_TEAM_PORT)
+      if (dev->priv_flags & (IFF_TEAM_PORT | IFF_BONDING))

Don't you want to do that for bonding slaves? IFF_BONDING is set for both master and slave. netif_is_bond_slave() helper checks that. In fact netif_is_team_port() should be used here instead of checking IFF_TEAM_PORT directly. And then you can use netif_is_lag_port() to check them both.

IFF_BONDING Is set for both slaves and master (and thats what I need). In my case I consistently see link_watch throttle bond link down event ...since it follows immediately after the the bond slave link down events
(any optimizations in the bonding driver for link events are squashed at this point by link watch).
so I do need to cover the bond master case. I think for the use-case I am talking about, team master device might also have the same problem....if somebody else in
user-space is relying on the team master link down (though i do understand the sequence of events are a bit different there...where you set the master link down from user-space).

Quoted 2 lines

thanks for the pointers to the helpers..., given above, are you ok if I move the check to netif_is_lag_port || netif_is_lag_master ?

Looks fine. Thanks.