qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] virtio-net: Unlimit tx queue size if peer is vdpa
@ 2022-02-17 17:50 Eugenio Pérez
  2022-02-21  4:20 ` Jason Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Eugenio Pérez @ 2022-02-17 17:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Jason Wang, Michael S. Tsirkin

The code used to limit the maximum size of tx queue for others backends
than vhost_user since the introduction of configurable tx queue size in
9b02e1618cf2 ("virtio-net: enable configurable tx queue size").

As vhost_user, vhost_vdpa devices should deal with memory region
crosses already, so let's use the full tx size.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
 hw/net/virtio-net.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 49cd13314a..b1769bfee0 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -629,17 +629,20 @@ static int virtio_net_max_tx_queue_size(VirtIONet *n)
     NetClientState *peer = n->nic_conf.peers.ncs[0];
 
     /*
-     * Backends other than vhost-user don't support max queue size.
+     * Backends other than vhost-user or vhost-vdpa don't support max queue
+     * size.
      */
     if (!peer) {
         return VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE;
     }
 
-    if (peer->info->type != NET_CLIENT_DRIVER_VHOST_USER) {
+    switch(peer->info->type) {
+    case NET_CLIENT_DRIVER_VHOST_USER:
+    case NET_CLIENT_DRIVER_VHOST_VDPA:
+        return VIRTQUEUE_MAX_SIZE;
+    default:
         return VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE;
-    }
-
-    return VIRTQUEUE_MAX_SIZE;
+    };
 }
 
 static int peer_attach(VirtIONet *n, int index)
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH] virtio-net: Unlimit tx queue size if peer is vdpa
  2022-02-17 17:50 [RFC PATCH] virtio-net: Unlimit tx queue size if peer is vdpa Eugenio Pérez
@ 2022-02-21  4:20 ` Jason Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Wang @ 2022-02-21  4:20 UTC (permalink / raw)
  To: Eugenio Pérez, qemu-devel; +Cc: qemu-trivial, Michael S. Tsirkin


在 2022/2/18 上午1:50, Eugenio Pérez 写道:
> The code used to limit the maximum size of tx queue for others backends
> than vhost_user since the introduction of configurable tx queue size in
> 9b02e1618cf2 ("virtio-net: enable configurable tx queue size").
>
> As vhost_user, vhost_vdpa devices should deal with memory region
> crosses already, so let's use the full tx size.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>


Acked-by: Jason Wang <jasowang@redhat.com>


> ---
>   hw/net/virtio-net.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 49cd13314a..b1769bfee0 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -629,17 +629,20 @@ static int virtio_net_max_tx_queue_size(VirtIONet *n)
>       NetClientState *peer = n->nic_conf.peers.ncs[0];
>   
>       /*
> -     * Backends other than vhost-user don't support max queue size.
> +     * Backends other than vhost-user or vhost-vdpa don't support max queue
> +     * size.
>        */
>       if (!peer) {
>           return VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE;
>       }
>   
> -    if (peer->info->type != NET_CLIENT_DRIVER_VHOST_USER) {
> +    switch(peer->info->type) {
> +    case NET_CLIENT_DRIVER_VHOST_USER:
> +    case NET_CLIENT_DRIVER_VHOST_VDPA:
> +        return VIRTQUEUE_MAX_SIZE;
> +    default:
>           return VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE;
> -    }
> -
> -    return VIRTQUEUE_MAX_SIZE;
> +    };
>   }
>   
>   static int peer_attach(VirtIONet *n, int index)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-21  4:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-17 17:50 [RFC PATCH] virtio-net: Unlimit tx queue size if peer is vdpa Eugenio Pérez
2022-02-21  4:20 ` Jason Wang

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).