qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 10/24] vhost: introduce vhost_dev_virtqueue_restart()


From: Jason Wang
Subject: Re: [PATCH v2 10/24] vhost: introduce vhost_dev_virtqueue_restart()
Date: Wed, 24 Aug 2022 10:37:45 +0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.12.0


在 2022/8/16 09:06, Kangjie Xu 写道:
Introduce vhost_dev_virtqueue_restart(), which can restart the
virtqueue when the vhost has already started running.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
---
  hw/virtio/vhost.c         | 13 +++++++++++++
  include/hw/virtio/vhost.h |  2 ++
  2 files changed, 15 insertions(+)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 1bca9ff48d..fc3f550c76 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1913,3 +1913,16 @@ void vhost_dev_virtqueue_stop(struct vhost_dev *hdev, 
VirtIODevice *vdev,
                            hdev->vqs + idx,
                            idx);
  }
+
+int vhost_dev_virtqueue_restart(struct vhost_dev *hdev, VirtIODevice *vdev,
+                                int idx)
+{
+    const VhostOps *vhost_ops = hdev->vhost_ops;
+
+    assert(vhost_ops);


So we had the comment like:

    /* should only be called after backend is connected */

in vhost_virtqueue_mask().

If this assert has the same reason, let's add a comment here.


+
+    return vhost_virtqueue_start(hdev,
+                                 vdev,
+                                 hdev->vqs + idx,
+                                 hdev->vq_index + idx);


So it just a wrapper of vhost_virtqueue_start(), any value to have a re-start wrapper?

Thanks


+}
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 574888440c..b3394b6348 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -291,4 +291,6 @@ int vhost_dev_get_inflight(struct vhost_dev *dev, uint16_t 
queue_size,
void vhost_dev_virtqueue_stop(struct vhost_dev *hdev, VirtIODevice *vdev,
                                int idx);
+int vhost_dev_virtqueue_restart(struct vhost_dev *hdev, VirtIODevice *vdev,
+                                int idx);
  #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]