Message ID | 1701970793-6865-3-git-send-email-si-wei.liu@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | vdpa-net: improve migration downtime through descriptor ASID and persistent IOTLB | expand |
On Fri, Dec 8, 2023 at 2:50 AM Si-Wei Liu <si-wei.liu@oracle.com> wrote: > > Internal API to get the descriptor group index for a specific virtqueue > through the VHOST_VDPA_GET_VRING_DESC_GROUP ioctl. > > Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> Acked-by: Jason Wang <jasowang@redhat.com> Thanks > --- > net/vhost-vdpa.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c > index 90f4128..887c329 100644 > --- a/net/vhost-vdpa.c > +++ b/net/vhost-vdpa.c > @@ -471,6 +471,25 @@ static int64_t vhost_vdpa_get_vring_group(int device_fd, unsigned vq_index, > return state.num; > } > > +static int64_t vhost_vdpa_get_vring_desc_group(int device_fd, > + unsigned vq_index, > + Error **errp) > +{ > + struct vhost_vring_state state = { > + .index = vq_index, > + }; > + int r = ioctl(device_fd, VHOST_VDPA_GET_VRING_DESC_GROUP, &state); > + > + if (unlikely(r < 0)) { > + r = -errno; > + error_setg_errno(errp, errno, "Cannot get VQ %u descriptor group", > + vq_index); > + return r; > + } > + > + return state.num; > +} > + > static int vhost_vdpa_set_address_space_id(struct vhost_vdpa *v, > unsigned vq_group, > unsigned asid_num) > -- > 1.8.3.1 >
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 90f4128..887c329 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -471,6 +471,25 @@ static int64_t vhost_vdpa_get_vring_group(int device_fd, unsigned vq_index, return state.num; } +static int64_t vhost_vdpa_get_vring_desc_group(int device_fd, + unsigned vq_index, + Error **errp) +{ + struct vhost_vring_state state = { + .index = vq_index, + }; + int r = ioctl(device_fd, VHOST_VDPA_GET_VRING_DESC_GROUP, &state); + + if (unlikely(r < 0)) { + r = -errno; + error_setg_errno(errp, errno, "Cannot get VQ %u descriptor group", + vq_index); + return r; + } + + return state.num; +} + static int vhost_vdpa_set_address_space_id(struct vhost_vdpa *v, unsigned vq_group, unsigned asid_num)
Internal API to get the descriptor group index for a specific virtqueue through the VHOST_VDPA_GET_VRING_DESC_GROUP ioctl. Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> --- net/vhost-vdpa.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)