Skip to content

Commit 7c9864b

Browse files
shemmingerdavem330
authored andcommitted
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. Reported-by: "Shah, Ashish N" <[email protected]> Fixes: 0c19556 ("netvsc: transparent VF management") Signed-off-by: Stephen Hemminger <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 02afa9c commit 7c9864b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/net/hyperv/netvsc_drv.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,12 +532,13 @@ static int netvsc_xmit(struct sk_buff *skb, struct net_device *net, bool xdp_tx)
532532
u32 hash;
533533
struct hv_page_buffer pb[MAX_PAGE_BUFFER_COUNT];
534534

535-
/* if VF is present and up then redirect packets
536-
* already called with rcu_read_lock_bh
535+
/* If VF is present and up then redirect packets to it.
536+
* Skip the VF if it is marked down or has no carrier.
537+
* If netpoll is in uses, then VF can not be used either.
537538
*/
538539
vf_netdev = rcu_dereference_bh(net_device_ctx->vf_netdev);
539540
if (vf_netdev && netif_running(vf_netdev) &&
540-
!netpoll_tx_running(net))
541+
netif_carrier_ok(vf_netdev) && !netpoll_tx_running(net))
541542
return netvsc_vf_xmit(net, vf_netdev, skb);
542543

543544
/* We will atmost need two pages to describe the rndis

0 commit comments

Comments
 (0)