On Wed, Jun 28, 2023 at 4:13 PM Jason Wang <jasowang@xxxxxxxxxx> wrote: > > On Wed, Jun 28, 2023 at 3:00 PM Cindy Lu <lulu@xxxxxxxxxx> wrote: > > > > From: Your Name <you@xxxxxxxxxxx> > > > > in VDUSE_VQ_GET_INFO, driver will sync the last_avail_idx > > with reconnect info, I have olny test the split mode, so > > Typo, should be "only". > sure will change this > > only use this here, will add more information later > > > > Signed-off-by: Cindy Lu <lulu@xxxxxxxxxx> > > --- > > 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; > > +}; > > Should this belong to uAPI? > will change this > > + > > 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; > > What if userspace doesn't do mmap()? > > Thanks > sure will add the check for this Thanks Cindy > > + 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 > > >