vdpa: return errno in vhost_vdpa_get_vring_group error
We need to tell in the caller, as some errors are expected in a normal workflow. In particular, parent drivers in recent kernels with VHOST_BACKEND_F_IOTLB_ASID may not support vring groups. In that case, -ENOTSUP is returned. This is the case of vp_vdpa in Linux 6.2. Next patches in this series will use that information to know if it must abort or not. Also, next patches return properly an errp instead of printing with error_report. Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Message-Id: <20230526153143.470745-2-eperezma@redhat.com> Tested-by: Lei Yang <leiyang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
25c893037b
commit
0f2bb0bf38
@ -362,6 +362,14 @@ static NetClientInfo net_vhost_vdpa_info = {
|
||||
.check_peer_type = vhost_vdpa_check_peer_type,
|
||||
};
|
||||
|
||||
/**
|
||||
* Get vring virtqueue group
|
||||
*
|
||||
* @device_fd vdpa device fd
|
||||
* @vq_index Virtqueue index
|
||||
*
|
||||
* Return -errno in case of error, or vq group if success.
|
||||
*/
|
||||
static int64_t vhost_vdpa_get_vring_group(int device_fd, unsigned vq_index)
|
||||
{
|
||||
struct vhost_vring_state state = {
|
||||
@ -370,6 +378,7 @@ static int64_t vhost_vdpa_get_vring_group(int device_fd, unsigned vq_index)
|
||||
int r = ioctl(device_fd, VHOST_VDPA_GET_VRING_GROUP, &state);
|
||||
|
||||
if (unlikely(r < 0)) {
|
||||
r = -errno;
|
||||
error_report("Cannot get VQ %u group: %s", vq_index,
|
||||
g_strerror(errno));
|
||||
return r;
|
||||
|
Loading…
Reference in New Issue
Block a user