[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230628065919.54042-5-lulu@redhat.com>
Date: Wed, 28 Jun 2023 14:59:19 +0800
From: Cindy Lu <lulu@...hat.com>
To: lulu@...hat.com, jasowang@...hat.com, mst@...hat.com,
maxime.coquelin@...hat.com, xieyongji@...edance.com,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org
Subject: [RFC 4/4] vduse: update the vq_info in ioctl
From: Your Name <you@...mple.com>
in VDUSE_VQ_GET_INFO, driver will sync the last_avail_idx
with reconnect info, I have olny test the split mode, so
only use this here, will add more information later
Signed-off-by: Cindy Lu <lulu@...hat.com>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index 3df1256eccb4..b8e453eac0ce 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -141,6 +141,11 @@ static u32 allowed_device_id[] = {
VIRTIO_ID_NET,
};
+struct vhost_reconnect_vring {
+ uint16_t last_avail_idx;
+ bool avail_wrap_counter;
+};
+
static inline struct vduse_dev *vdpa_to_vduse(struct vdpa_device *vdpa)
{
struct vduse_vdpa *vdev = container_of(vdpa, struct vduse_vdpa, vdpa);
@@ -1176,6 +1181,17 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
vq->state.split.avail_index;
vq_info.ready = vq->ready;
+ struct vdpa_reconnect_info *area;
+
+ area = &dev->reconnect_info[index];
+ struct vhost_reconnect_vring *log_reconnect;
+
+ log_reconnect = (struct vhost_reconnect_vring *)area->vaddr;
+ if (log_reconnect->last_avail_idx !=
+ vq_info.split.avail_index) {
+ vq_info.split.avail_index =
+ log_reconnect->last_avail_idx;
+ }
ret = -EFAULT;
if (copy_to_user(argp, &vq_info, sizeof(vq_info)))
--
2.34.3
Powered by blists - more mailing lists