Skip to contentSkip to conversation

hv_netvsc: do not use VF device if link is down

PATCH In review Stephen Hemminger 3 participants 3 messages Aug 4, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hv_netvsc: do not use VF device if link is down

If the accelerated networking SRIOV VF device has lost carrier use the synthetic network device which is available as backup path. This is a rare case since if VF link goes down, normally the VMBus device will also loose external connectivity as well. But if the communication is between two VM's on the same host the VMBus device will still work.

Fixes 0c195567a8f6 ("netvsc: transparent VF management")
---
 drivers/net/hyperv/netvsc_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/hyperv/netvsc_drv.c +4 -3
index 6267f706e8ee..0d779bba1b01 100644
@@ -532,12 +532,13 @@ static int netvsc_xmit(struct sk_buff *skb, struct net_device *net, bool xdp_tx)
 	u32 hash;
 	struct hv_page_buffer pb[MAX_PAGE_BUFFER_COUNT];
 
-	/* if VF is present and up then redirect packets
-	 * already called with rcu_read_lock_bh
+	/* If VF is present and up then redirect packets to it.
+	 * Skip the VF if it is marked down or has no carrier.
+	 * If netpoll is in uses, then VF can not be used either.
 	 */
 	vf_netdev = rcu_dereference_bh(net_device_ctx->vf_netdev);
 	if (vf_netdev && netif_running(vf_netdev) &&
-	    !netpoll_tx_running(net))
+	    netif_carrier_ok(vf_netdev) && !netpoll_tx_running(net))
 		return netvsc_vf_xmit(net, vf_netdev, skb);
 
 	/* We will atmost need two pages to describe the rndis
Signature · 1 line
2.27.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, August 4, 2020 12:54 PM
To: Haiyang Zhang <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Stephen Hemminger <[email protected]>; Shah, Ashish N <[email protected]>
Subject: [PATCH] hv_netvsc: do not use VF device if link is down

If the accelerated networking SRIOV VF device has lost carrier use the synthetic network device which is available as backup path. This is a rare case since if VF link goes down, normally the VMBus device will also loose external connectivity as well. But if the communication is between two VM's on the same host the VMBus device will still work.

Quoted 3 lines
Fixes 0c195567a8f6 ("netvsc: transparent VF management")

Thank you.

maintainer
#2 lore raw
In reply to Stephen Hemminger

From: Stephen Hemminger <[email protected]>
Date: Tue, 4 Aug 2020 09:54:15 -0700

Quoted 10 lines

If the accelerated networking SRIOV VF device has lost carrier use the synthetic network device which is available as backup path. This is a rare case since if VF link goes down, normally the VMBus device will also loose external connectivity as well. But if the communication is between two VM's on the same host the VMBus device will still work.

Fixes 0c195567a8f6 ("netvsc: transparent VF management")

Applied and queued up for -stable, thanks.