[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 16/24] vhost: vhost-user: update vhost_dev_virtqueue_stop()
From: |
Kangjie Xu |
Subject: |
[PATCH v2 16/24] vhost: vhost-user: update vhost_dev_virtqueue_stop() |
Date: |
Tue, 16 Aug 2022 09:06:28 +0800 |
Update vhost_dev_virtqueue_stop() for vhost-user scenario.
Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
---
hw/virtio/vhost.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index fc3f550c76..a0d6824353 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1908,10 +1908,29 @@ int vhost_net_set_backend(struct vhost_dev *hdev,
void vhost_dev_virtqueue_stop(struct vhost_dev *hdev, VirtIODevice *vdev,
int idx)
{
+ const VhostOps *vhost_ops = hdev->vhost_ops;
+ struct vhost_vring_state state;
+ int r;
+
+ assert(vhost_ops);
+
+ if (vhost_ops->vhost_reset_vring) {
+ state.index = hdev->vq_index + idx;
+ r = vhost_ops->vhost_reset_vring(hdev, &state);
+ if (r < 0) {
+ goto err_queue_reset;
+ }
+ }
+
vhost_virtqueue_unmap(hdev,
vdev,
hdev->vqs + idx,
idx);
+
+ return;
+
+err_queue_reset:
+ error_report("Error when stopping the qeuue.");
}
int vhost_dev_virtqueue_restart(struct vhost_dev *hdev, VirtIODevice *vdev,
--
2.32.0
- Re: [PATCH v2 12/24] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_restart(), (continued)
[PATCH v2 23/24] vhost: vhost-kernel: enable vq reset feature, Kangjie Xu, 2022/08/15
[PATCH v2 21/24] virtio-net: support queue reset, Kangjie Xu, 2022/08/15
[PATCH v2 16/24] vhost: vhost-user: update vhost_dev_virtqueue_stop(),
Kangjie Xu <=
[PATCH v2 08/24] vhost: extract the logic of unmapping the vrings and desc, Kangjie Xu, 2022/08/15
[PATCH v2 17/24] vhost: vhost-user: update vhost_dev_virtqueue_restart(), Kangjie Xu, 2022/08/15
[PATCH v2 18/24] vhost-net: vhost-user: update vhost_net_virtqueue_stop(), Kangjie Xu, 2022/08/15