aboutsummaryrefslogtreecommitdiff
path: root/net/vhost-vdpa.c
diff options
context:
space:
mode:
authorEugenio Pérez <eperezma@redhat.com>2023-05-26 17:31:42 +0200
committerMichael S. Tsirkin <mst@redhat.com>2023-06-23 02:54:44 -0400
commit0f2bb0bf38b04e9dfdc32ce5c762dd317f5a4c5a (patch)
tree900e216f82d616109e1c515c0be8807ae04a639f /net/vhost-vdpa.c
parent25c893037b89ddd4e42927a2a9b524dbbc0c34a3 (diff)
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>
Diffstat (limited to 'net/vhost-vdpa.c')
-rw-r--r--net/vhost-vdpa.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 37cdc84562..3fb833fe76 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -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;