[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 4/5] vdpa: return errno in vhost_vdpa_get_vring_group error
|
From: |
Eugenio Pérez |
|
Subject: |
[PATCH v3 4/5] vdpa: return errno in vhost_vdpa_get_vring_group error |
|
Date: |
Tue, 9 May 2023 17:44:34 +0200 |
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>
---
net/vhost-vdpa.c | 9 +++++++++
1 file changed, 9 insertions(+)
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;
--
2.31.1
- [PATCH v3 0/5] Move ASID test to vhost-vdpa net initialization, Eugenio Pérez, 2023/05/09
- [PATCH v3 3/5] vdpa: add vhost_vdpa_set_dev_features_fd, Eugenio Pérez, 2023/05/09
- [PATCH v3 4/5] vdpa: return errno in vhost_vdpa_get_vring_group error,
Eugenio Pérez <=
- [PATCH v3 5/5] vdpa: move CVQ isolation check to net_init_vhost_vdpa, Eugenio Pérez, 2023/05/09
- Re: [PATCH v3 5/5] vdpa: move CVQ isolation check to net_init_vhost_vdpa, Jason Wang, 2023/05/16
- Re: [PATCH v3 5/5] vdpa: move CVQ isolation check to net_init_vhost_vdpa, Eugenio Perez Martin, 2023/05/17
- Re: [PATCH v3 5/5] vdpa: move CVQ isolation check to net_init_vhost_vdpa, Jason Wang, 2023/05/18
- Re: [PATCH v3 5/5] vdpa: move CVQ isolation check to net_init_vhost_vdpa, Eugenio Perez Martin, 2023/05/18
- Re: [PATCH v3 5/5] vdpa: move CVQ isolation check to net_init_vhost_vdpa, Jason Wang, 2023/05/18
- Re: [PATCH v3 5/5] vdpa: move CVQ isolation check to net_init_vhost_vdpa, Michael S. Tsirkin, 2023/05/18
- Re: [PATCH v3 5/5] vdpa: move CVQ isolation check to net_init_vhost_vdpa, Eugenio Perez Martin, 2023/05/19
Re: [PATCH v3 0/5] Move ASID test to vhost-vdpa net initialization, Lei Yang, 2023/05/17