diff mbox series

[RFC,04/12] vhost_net: Use ops->vhost_reset_queue in vhost_net_virtqueue_reset

Message ID 20230720181459.607008-5-eperezma@redhat.com (mailing list archive)
State New, archived
Headers show
Series Prefer to use SVQ to stall dataplane at NIC state restore through CVQ | expand

Commit Message

Eugenio Perez Martin July 20, 2023, 6:14 p.m. UTC
Actually use vhost_reset_queue operation at queue reset.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
 hw/net/vhost_net.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jason Wang July 25, 2023, 7:08 a.m. UTC | #1
在 2023/7/21 02:14, Eugenio Pérez 写道:
> Actually use vhost_reset_queue operation at queue reset.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
>   hw/net/vhost_net.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 416b7d8132..5516b7a5aa 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -571,7 +571,9 @@ void vhost_net_virtqueue_reset(VirtIODevice *vdev, NetClientState *nc,
>   
>       idx = vhost_ops->vhost_get_vq_index(&net->dev, vq_index);
>   
> -    if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) {
> +    if (vhost_ops->vhost_reset_queue) {
> +        vhost_ops->vhost_reset_queue(&net->dev, idx);
> +    } else if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) {
>           file.index = idx;
>           int r = vhost_net_set_backend(&net->dev, &file);
>           assert(r >= 0);


Let's move the TAP specific logic to vhost-net specific reset_queue 
function.

Thanks
diff mbox series

Patch

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 416b7d8132..5516b7a5aa 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -571,7 +571,9 @@  void vhost_net_virtqueue_reset(VirtIODevice *vdev, NetClientState *nc,
 
     idx = vhost_ops->vhost_get_vq_index(&net->dev, vq_index);
 
-    if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) {
+    if (vhost_ops->vhost_reset_queue) {
+        vhost_ops->vhost_reset_queue(&net->dev, idx);
+    } else if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) {
         file.index = idx;
         int r = vhost_net_set_backend(&net->dev, &file);
         assert(r >= 0);