[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/8] vhost-net: vhost-user: update vhost_net_virtqueue_restart()
From: |
Kangjie Xu |
Subject: |
[PATCH 6/8] vhost-net: vhost-user: update vhost_net_virtqueue_restart() |
Date: |
Fri, 26 Aug 2022 18:56:18 +0800 |
Update vhost_net_virtqueue_restart() for vhost-user scenario.
In order to reuse some functions, we process the idx for
vhost-user case. It is because vhost_get_vq_index behave
differently in vhost-user.
Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
---
hw/net/vhost_net.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 8ad5743f7c..13b9c11e68 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -563,6 +563,9 @@ int vhost_net_virtqueue_restart(VirtIODevice *vdev,
NetClientState *nc,
assert(vhost_ops);
idx = vhost_ops->vhost_get_vq_index(&net->dev, vq_index);
+ if (net->nc->info->type == NET_CLIENT_DRIVER_VHOST_USER) {
+ idx -= net->dev.vq_index;
+ }
r = vhost_virtqueue_start(&net->dev,
vdev,
@@ -572,6 +575,15 @@ int vhost_net_virtqueue_restart(VirtIODevice *vdev,
NetClientState *nc,
goto err_start;
}
+ if (vhost_ops->vhost_set_vring_enable) {
+ r = vhost_ops->vhost_set_vring_enable(&net->dev,
+ net->dev.vq_index + idx,
+ 1);
+ if (r < 0) {
+ goto err_start;
+ }
+ }
+
if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) {
file.index = idx;
file.fd = net->backend;
--
2.32.0
- [PATCH 0/8] Support VIRTIO_F_RING_RESET for vhost-user in virtio pci-modern, Kangjie Xu, 2022/08/26
- [PATCH 2/8] net: virtio: rename vhost_set_vring_enable to vhost_set_dev_enable, Kangjie Xu, 2022/08/26
- [PATCH 7/8] virtio-net: vhost-user: update queue_reset and queue_enable, Kangjie Xu, 2022/08/26
- [PATCH 4/8] vhost-user: introduce vhost_reset_vring() interface, Kangjie Xu, 2022/08/26
- [PATCH 3/8] vhost-user: add op to enable or disable a single vring, Kangjie Xu, 2022/08/26
- [PATCH 1/8] docs: vhost-user: add VHOST_USER_RESET_VRING message, Kangjie Xu, 2022/08/26
- [PATCH 8/8] vhost: vhost-user: enable vq reset feature, Kangjie Xu, 2022/08/26
- [PATCH 5/8] vhost-net: vhost-user: update vhost_net_virtqueue_reset(), Kangjie Xu, 2022/08/26
- [PATCH 6/8] vhost-net: vhost-user: update vhost_net_virtqueue_restart(),
Kangjie Xu <=