Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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" <ashish.n.shah@intel.com>
Fixes: 0c195567a8f6 ("netvsc: transparent VF management")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Stephen Hemminger and committed by
David S. Miller
7c9864bb 02afa9c6

+4 -3
+4 -3
drivers/net/hyperv/netvsc_drv.c
··· 532 532 u32 hash; 533 533 struct hv_page_buffer pb[MAX_PAGE_BUFFER_COUNT]; 534 534 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. 537 538 */ 538 539 vf_netdev = rcu_dereference_bh(net_device_ctx->vf_netdev); 539 540 if (vf_netdev && netif_running(vf_netdev) && 540 - !netpoll_tx_running(net)) 541 + netif_carrier_ok(vf_netdev) && !netpoll_tx_running(net)) 541 542 return netvsc_vf_xmit(net, vf_netdev, skb); 542 543 543 544 /* We will atmost need two pages to describe the rndis