diff mbox series

[RFC,10/12] vdpa: enable all vqs if the device support RING_RESET feature

Message ID 20230720181459.607008-11-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
Prefer the ring reset approach against the late enable, as it is more
aligned with the standard.

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

Patch

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 52415d7e0c..af83de92f8 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -840,8 +840,14 @@  static const VhostShadowVirtqueueOps vhost_vdpa_net_svq_ops = {
  */
 static bool vhost_vdpa_should_enable(const struct vhost_vdpa *v)
 {
+    VhostVDPAState *s = container_of(v, VhostVDPAState, vhost_vdpa);
     struct vhost_dev *dev = v->dev;
 
+    if (dev->features & VIRTIO_F_RING_RESET && !s->always_svq) {
+        /* Preventing dataplane processing exposing fake SVQ vring */
+        return true;
+    }
+
     if (!dev->vq_index_end % 2) {
         /* vDPA device does not have CVQ */
         return true;