* [PATCH V2] virtio_net: enable napi for all possible queues during open
@ 2013-05-22 6:03 Jason Wang
2013-05-23 3:22 ` Rusty Russell
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jason Wang @ 2013-05-22 6:03 UTC (permalink / raw)
To: rusty, mst, virtualization, linux-kernel; +Cc: netdev, Sasha Levin
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.
Cc: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
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(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 2d6abac..241527d 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -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]);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V2] virtio_net: enable napi for all possible queues during open
2013-05-22 6:03 [PATCH V2] virtio_net: enable napi for all possible queues during open Jason Wang
@ 2013-05-23 3:22 ` Rusty Russell
2013-05-23 5:59 ` Michael S. Tsirkin
2013-05-23 7:11 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2013-05-23 3:22 UTC (permalink / raw)
To: Jason Wang, mst, virtualization, linux-kernel; +Cc: netdev, Sasha Levin
Jason Wang <jasowang@redhat.com> writes:
> 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.
>
> Cc: Sasha Levin <sasha.levin@oracle.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Dave, please send to Linus (fixes master).
Cheers,
Rusty.
> ---
> 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(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 2d6abac..241527d 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -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]);
> }
>
> --
> 1.7.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] virtio_net: enable napi for all possible queues during open
2013-05-22 6:03 [PATCH V2] virtio_net: enable napi for all possible queues during open Jason Wang
2013-05-23 3:22 ` Rusty Russell
@ 2013-05-23 5:59 ` Michael S. Tsirkin
2013-05-23 7:11 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2013-05-23 5:59 UTC (permalink / raw)
To: Jason Wang; +Cc: netdev, linux-kernel, Sasha Levin, virtualization
On Wed, May 22, 2013 at 02:03:58PM +0800, Jason Wang wrote:
> 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.
>
> Cc: Sasha Levin <sasha.levin@oracle.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 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(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 2d6abac..241527d 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -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]);
> }
>
> --
> 1.7.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] virtio_net: enable napi for all possible queues during open
2013-05-22 6:03 [PATCH V2] virtio_net: enable napi for all possible queues during open Jason Wang
2013-05-23 3:22 ` Rusty Russell
2013-05-23 5:59 ` Michael S. Tsirkin
@ 2013-05-23 7:11 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-05-23 7:11 UTC (permalink / raw)
To: jasowang; +Cc: mst, netdev, linux-kernel, virtualization, sasha.levin
From: Jason Wang <jasowang@redhat.com>
Date: Wed, 22 May 2013 14:03:58 +0800
> 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.
>
> Cc: Sasha Levin <sasha.levin@oracle.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-23 7:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22 6:03 [PATCH V2] virtio_net: enable napi for all possible queues during open Jason Wang
2013-05-23 3:22 ` Rusty Russell
2013-05-23 5:59 ` Michael S. Tsirkin
2013-05-23 7:11 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).