diff mbox series

hv_netvsc: Fix a network regression after ifdown/ifup

Message ID KL1P15301MB00068D69392E04C10AB596AABF650@KL1P15301MB0006.APCP153.PROD.OUTLOOK.COM
State Changes Requested, archived
Delegated to: David Miller
Headers show
Series hv_netvsc: Fix a network regression after ifdown/ifup | expand

Commit Message

Dexuan Cui June 6, 2018, 9:01 p.m. UTC
Recently people reported the NIC stops working after
"ifdown eth0; ifup eth0". It turns out in this case the TX queues are not
enabled, after the refactoring of the common detach logic. The patch fixes
the regression.

Fixes: 7b2ee50c0cd5 ("hv_netvsc: common detach logic")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Cc: stable@vger.kernel.org
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
---
 drivers/net/hyperv/netvsc_drv.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Dexuan Cui June 6, 2018, 9:18 p.m. UTC | #1
> From: Stephen Hemminger 
> Sent: Wednesday, June 6, 2018 14:07
> ...
> Ok, just skip the check and big comment.
> wake all queues is harmless if they are already awake.

Ok, I'll post a v2 without the check and the comment shortly.

-- Dexuan
diff mbox series

Patch

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index da07ccd..4461e16 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -126,9 +126,20 @@  static int netvsc_open(struct net_device *net)
 	}
 
 	rdev = nvdev->extension;
-	if (!rdev->link_state)
+	if (!rdev->link_state) {
 		netif_carrier_on(net);
 
+		/* When the NIC has sub-channels, usually we enable all the
+		 * TX queues after all sub-channels are set up: see
+		 * rndis_set_subchannel() -> netif_device_attach(), but in
+		 * the case of "ifdown eth0; ifup eth0" where the number of
+		 * channels doesn't change, we also must make sure the
+		 * TX queues are enabled.
+		 */
+		if (atomic_read(&nvdev->open_chn) == nvdev->num_chn)
+			netif_tx_wake_all_queues(net);
+	}
+
 	if (vf_netdev) {
 		/* Setting synthetic device up transparently sets
 		 * slave as up. If open fails, then slave will be