[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 17/24] vhost: vhost-user: update vhost_dev_virtqueue_restart()
From: |
Kangjie Xu |
Subject: |
[PATCH v2 17/24] vhost: vhost-user: update vhost_dev_virtqueue_restart() |
Date: |
Tue, 16 Aug 2022 09:06:29 +0800 |
Update vhost_dev_virtqueue_restart() 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 | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index a0d6824353..bd90cfe13a 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1937,11 +1937,29 @@ int vhost_dev_virtqueue_restart(struct vhost_dev *hdev,
VirtIODevice *vdev,
int idx)
{
const VhostOps *vhost_ops = hdev->vhost_ops;
+ int r;
assert(vhost_ops);
- return vhost_virtqueue_start(hdev,
- vdev,
- hdev->vqs + idx,
- hdev->vq_index + idx);
+ r = vhost_virtqueue_start(hdev,
+ vdev,
+ hdev->vqs + idx,
+ hdev->vq_index + idx);
+ if (r < 0) {
+ goto err_start;
+ }
+
+ if (vhost_ops->vhost_set_single_vring_enable) {
+ r = vhost_ops->vhost_set_single_vring_enable(hdev,
+ hdev->vq_index + idx,
+ 1);
+ if (r < 0) {
+ goto err_start;
+ }
+ }
+
+ return 0;
+
+err_start:
+ return r;
}
--
2.32.0
- Re: [PATCH v2 15/24] vhost-user: add op to enable or disable a single vring, (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, 2022/08/15
[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 <=
[PATCH v2 18/24] vhost-net: vhost-user: update vhost_net_virtqueue_stop(), Kangjie Xu, 2022/08/15
[PATCH v2 20/24] virtio-net: introduce flush_or_purge_queued_packets(), Kangjie Xu, 2022/08/15
[PATCH v2 22/24] virtio-net: support queue_enable, Kangjie Xu, 2022/08/15
[PATCH v2 24/24] vhost: vhost-user: enable vq reset feature, Kangjie Xu, 2022/08/15