[PATCH v2 5/6] virtio-net: vhost-user: update queue_reset and queue_enable

Kangjie Xu posted 6 patches 3 years, 4 months ago
[PATCH v2 5/6] virtio-net: vhost-user: update queue_reset and queue_enable
Posted by Kangjie Xu 3 years, 4 months ago
Update virtio_net_queue_reset() and virtio_net_queue_enable()
for vhost-user scenario.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
---
 hw/net/virtio-net.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 6ab796b399..19a2132180 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -550,7 +550,8 @@ static void virtio_net_queue_reset(VirtIODevice *vdev, uint32_t queue_index)
     }
 
     if (get_vhost_net(nc->peer) &&
-        nc->peer->info->type == NET_CLIENT_DRIVER_TAP) {
+        (nc->peer->info->type == NET_CLIENT_DRIVER_TAP ||
+         nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_USER)) {
         vhost_net_virtqueue_reset(vdev, nc, queue_index);
     }
 
@@ -568,7 +569,8 @@ static void virtio_net_queue_enable(VirtIODevice *vdev, uint32_t queue_index)
     }
 
     if (get_vhost_net(nc->peer) &&
-        nc->peer->info->type == NET_CLIENT_DRIVER_TAP) {
+        (nc->peer->info->type == NET_CLIENT_DRIVER_TAP ||
+         nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_USER)) {
         r = vhost_net_virtqueue_restart(vdev, nc, queue_index);
         if (r < 0) {
             error_report("unable to restart vhost net virtqueue: %d, "
-- 
2.32.0
Re: [PATCH v2 5/6] virtio-net: vhost-user: update queue_reset and queue_enable
Posted by Jason Wang 3 years, 4 months ago
在 2022/9/12 11:10, Kangjie Xu 写道:
> Update virtio_net_queue_reset() and virtio_net_queue_enable()
> for vhost-user scenario.
>
> Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
> Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>


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


> ---
>   hw/net/virtio-net.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 6ab796b399..19a2132180 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -550,7 +550,8 @@ static void virtio_net_queue_reset(VirtIODevice *vdev, uint32_t queue_index)
>       }
>   
>       if (get_vhost_net(nc->peer) &&
> -        nc->peer->info->type == NET_CLIENT_DRIVER_TAP) {
> +        (nc->peer->info->type == NET_CLIENT_DRIVER_TAP ||
> +         nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_USER)) {
>           vhost_net_virtqueue_reset(vdev, nc, queue_index);
>       }
>   
> @@ -568,7 +569,8 @@ static void virtio_net_queue_enable(VirtIODevice *vdev, uint32_t queue_index)
>       }
>   
>       if (get_vhost_net(nc->peer) &&
> -        nc->peer->info->type == NET_CLIENT_DRIVER_TAP) {
> +        (nc->peer->info->type == NET_CLIENT_DRIVER_TAP ||
> +         nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_USER)) {
>           r = vhost_net_virtqueue_restart(vdev, nc, queue_index);
>           if (r < 0) {
>               error_report("unable to restart vhost net virtqueue: %d, "