Skip to contentSkip to conversation

virtio_net: enable napi for all possible queues during open

PATCH Applied Jason Wang 4 participants 4 messages May 22, 2013 – May 23, 2013

Subsystems (4)
lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH v2 1/1 virtio_net: enable napi for all possible queues during open

Commit 55257d72bd1c51f25106350f4983ec19f62ed1fa (virtio-net: fill only rx queues which are being used) only does the napi enabling during open for curr_queue_pairs. This will break multiqueue receiving since napi of new queues were still disabled after changing the number of queues.

This patch fixes this by enabling napi for all possible queues during open.

---
Changes from V1:
- enable napi in open instead of virtnet_set_queues() to avoid kernel BUG() when trying to do napi_enable() for a already enabled queue

---
 drivers/net/virtio_net.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/virtio_net.c +5 -4
index 2d6abac..241527d 100644
@@ -636,10 +636,11 @@ static int virtnet_open(struct net_device *dev)
 	struct virtnet_info *vi = netdev_priv(dev);
 	int i;
 
-	for (i = 0; i < vi->curr_queue_pairs; i++) {
-		/* Make sure we have some buffers: if oom use wq. */
-		if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
-			schedule_delayed_work(&vi->refill, 0);
+	for (i = 0; i < vi->max_queue_pairs; i++) {
+		if (i < vi->curr_queue_pairs)
+			/* Make sure we have some buffers: if oom use wq. */
+			if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
+				schedule_delayed_work(&vi->refill, 0);
 		virtnet_napi_enable(&vi->rq[i]);
 	}
 
Signature · 1 line
1.7.1
Acked-by on v2 1/1
#1 lore raw
Quoted 9 lines · Jason Wang

Commit 55257d72bd1c51f25106350f4983ec19f62ed1fa (virtio-net: fill only rx queues which are being used) only does the napi enabling during open for curr_queue_pairs. This will break multiqueue receiving since napi of new queues were still disabled after changing the number of queues.

This patch fixes this by enabling napi for all possible queues during open.

Dave, please send to Linus (fixes master).

Cheers,
Rusty.

Quoted 30 lines

---
Changes from V1:
- enable napi in open instead of virtnet_set_queues() to avoid kernel BUG() when trying to do napi_enable() for a already enabled queue

---
 drivers/net/virtio_net.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/virtio_net.c +5 -4
index 2d6abac..241527d 100644
@@ -636,10 +636,11 @@ static int virtnet_open(struct net_device *dev)
 	struct virtnet_info *vi = netdev_priv(dev);
 	int i;
 
-	for (i = 0; i < vi->curr_queue_pairs; i++) {
-		/* Make sure we have some buffers: if oom use wq. */
-		if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
-			schedule_delayed_work(&vi->refill, 0);
+	for (i = 0; i < vi->max_queue_pairs; i++) {
+		if (i < vi->curr_queue_pairs)
+			/* Make sure we have some buffers: if oom use wq. */
+			if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
+				schedule_delayed_work(&vi->refill, 0);
 		virtnet_napi_enable(&vi->rq[i]);
 	}
 
Signature · 1 line
1.7.1
maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Jason Wang
Quoted 9 lines · Jason Wang

Commit 55257d72bd1c51f25106350f4983ec19f62ed1fa (virtio-net: fill only rx queues which are being used) only does the napi enabling during open for curr_queue_pairs. This will break multiqueue receiving since napi of new queues were still disabled after changing the number of queues.

This patch fixes this by enabling napi for all possible queues during open.

Quoted 30 lines

---
Changes from V1:
- enable napi in open instead of virtnet_set_queues() to avoid kernel BUG() when trying to do napi_enable() for a already enabled queue

---
 drivers/net/virtio_net.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/virtio_net.c +5 -4
index 2d6abac..241527d 100644
@@ -636,10 +636,11 @@ static int virtnet_open(struct net_device *dev)
 	struct virtnet_info *vi = netdev_priv(dev);
 	int i;
 
-	for (i = 0; i < vi->curr_queue_pairs; i++) {
-		/* Make sure we have some buffers: if oom use wq. */
-		if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
-			schedule_delayed_work(&vi->refill, 0);
+	for (i = 0; i < vi->max_queue_pairs; i++) {
+		if (i < vi->curr_queue_pairs)
+			/* Make sure we have some buffers: if oom use wq. */
+			if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
+				schedule_delayed_work(&vi->refill, 0);
 		virtnet_napi_enable(&vi->rq[i]);
 	}
 
Signature · 1 line
1.7.1
maintainer Applied
#3 lore raw
In reply to Jason Wang

From: Jason Wang <[email protected]>
Date: Wed, 22 May 2013 14:03:58 +0800

Quoted 9 lines

Commit 55257d72bd1c51f25106350f4983ec19f62ed1fa (virtio-net: fill only rx queues which are being used) only does the napi enabling during open for curr_queue_pairs. This will break multiqueue receiving since napi of new queues were still disabled after changing the number of queues.

This patch fixes this by enabling napi for all possible queues during open.

Applied, thanks.