summaryrefslogtreecommitdiffstats
path: root/drivers/net/hyperv/netvsc_drv.c
diff options
context:
space:
mode:
authorHaiyang Zhang2017-06-22 01:40:47 +0200
committerDavid S. Miller2017-06-22 19:30:37 +0200
commit53fa1a6f33520f01f9dbee48369074b34d77616b (patch)
treea5ac78cde6ec8aeb09cb3e92cbb886ccc39f42d8 /drivers/net/hyperv/netvsc_drv.c
parenthv_netvsc: Remove unnecessary var link_state from struct netvsc_device_info (diff)
downloadkernel-qcow2-linux-53fa1a6f33520f01f9dbee48369074b34d77616b.tar.gz
kernel-qcow2-linux-53fa1a6f33520f01f9dbee48369074b34d77616b.tar.xz
kernel-qcow2-linux-53fa1a6f33520f01f9dbee48369074b34d77616b.zip
hv_netvsc: Fix the carrier state error when data path is off
When the VF NIC is opened, the synthetic NIC's carrier state is set to off. This tells the host to transitions data path to the VF device. But if startup script or user manipulates the admin state of the netvsc device directly for example: # ifconfig eth0 down # ifconfig eth0 up Then the carrier state of the synthetic NIC would be on, even though the data path was still over the VF NIC. This patch sets the carrier state of synthetic NIC with consideration of the related VF state. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv/netvsc_drv.c')
-rw-r--r--drivers/net/hyperv/netvsc_drv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 9a6c5864bc04..991372150463 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -68,7 +68,8 @@ static void netvsc_set_multicast_list(struct net_device *net)
static int netvsc_open(struct net_device *net)
{
- struct netvsc_device *nvdev = net_device_to_netvsc_device(net);
+ struct net_device_context *ndev_ctx = netdev_priv(net);
+ struct netvsc_device *nvdev = ndev_ctx->nvdev;
struct rndis_device *rdev;
int ret = 0;
@@ -84,7 +85,7 @@ static int netvsc_open(struct net_device *net)
netif_tx_wake_all_queues(net);
rdev = nvdev->extension;
- if (!rdev->link_state)
+ if (!rdev->link_state && !ndev_ctx->datapath)
netif_carrier_on(net);
return ret;
@@ -1284,7 +1285,8 @@ static void netvsc_link_change(struct work_struct *w)
case RNDIS_STATUS_MEDIA_CONNECT:
if (rdev->link_state) {
rdev->link_state = false;
- netif_carrier_on(net);
+ if (!ndev_ctx->datapath)
+ netif_carrier_on(net);
netif_tx_wake_all_queues(net);
} else {
notify = true;