diff mbox series

[RFC,06/12] vdpa: add vhost_vdpa_svq_stop

Message ID 20230720181459.607008-7-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
To split each SVQ stop in its own stop routine let's us to reset a VQ
individually, and to keep future vhost_vdpa_reset_queue symmetrical
with vhost_vdpa_reset_queue.

Signed-off-by: Eugenio PĂ©rez <eperezma@redhat.com>
---
 hw/virtio/vhost-vdpa.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index e7ab69165c..6ae276ccde 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -1263,6 +1263,18 @@  err:
     return false;
 }
 
+static void vhost_vdpa_svq_stop(struct vhost_dev *dev, unsigned idx)
+{
+    struct vhost_vdpa *v = dev->opaque;
+    VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, idx);
+
+    vhost_svq_stop(svq);
+    vhost_vdpa_svq_unmap_rings(dev, svq);
+
+    event_notifier_cleanup(&svq->hdev_kick);
+    event_notifier_cleanup(&svq->hdev_call);
+}
+
 static void vhost_vdpa_svqs_stop(struct vhost_dev *dev)
 {
     struct vhost_vdpa *v = dev->opaque;
@@ -1272,13 +1284,7 @@  static void vhost_vdpa_svqs_stop(struct vhost_dev *dev)
     }
 
     for (unsigned i = 0; i < v->shadow_vqs->len; ++i) {
-        VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, i);
-
-        vhost_svq_stop(svq);
-        vhost_vdpa_svq_unmap_rings(dev, svq);
-
-        event_notifier_cleanup(&svq->hdev_kick);
-        event_notifier_cleanup(&svq->hdev_call);
+        vhost_vdpa_svq_stop(dev, i);
     }
 }