Skip to content

Commit f6f13c1

Browse files
haiyangzdavem330
authored andcommitted
hv_netvsc: Fix unwanted wakeup in netvsc_attach()
When netvsc_attach() is called by operations like changing MTU, etc., an extra wakeup may happen while netvsc_attach() calling rndis_filter_device_add() which sends rndis messages when queue is stopped in netvsc_detach(). The completion message will wake up queue 0. We can reproduce the issue by changing MTU etc., then the wake_queue counter from "ethtool -S" will increase beyond stop_queue counter: stop_queue: 0 wake_queue: 1 The issue causes queue wake up, and counter increment, no other ill effects in current code. So we didn't see any network problem for now. To fix this, initialize tx_disable to true, and set it to false when the NIC is ready to be attached or registered. Fixes: 7b2ee50 ("hv_netvsc: common detach logic") Signed-off-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent eae7172 commit f6f13c1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

drivers/net/hyperv/netvsc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static struct netvsc_device *alloc_net_device(void)
9999

100100
init_waitqueue_head(&net_device->wait_drain);
101101
net_device->destroy = false;
102-
net_device->tx_disable = false;
102+
net_device->tx_disable = true;
103103

104104
net_device->max_pkt = RNDIS_MAX_PKT_DEFAULT;
105105
net_device->pkt_align = RNDIS_PKT_ALIGN_DEFAULT;

drivers/net/hyperv/netvsc_drv.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,7 @@ static int netvsc_attach(struct net_device *ndev,
10681068
}
10691069

10701070
/* In any case device is now ready */
1071+
nvdev->tx_disable = false;
10711072
netif_device_attach(ndev);
10721073

10731074
/* Note: enable and attach happen when sub-channels setup */
@@ -2476,6 +2477,8 @@ static int netvsc_probe(struct hv_device *dev,
24762477
else
24772478
net->max_mtu = ETH_DATA_LEN;
24782479

2480+
nvdev->tx_disable = false;
2481+
24792482
ret = register_netdevice(net);
24802483
if (ret != 0) {
24812484
pr_err("Unable to register netdev.\n");

0 commit comments

Comments
 (0)