qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 02/40] vdpa: add vhost_vdpa_get_vring_desc_group


From: Jason Wang
Subject: Re: [PATCH 02/40] vdpa: add vhost_vdpa_get_vring_desc_group
Date: Thu, 11 Jan 2024 11:51:07 +0800

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
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]