qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Eugenio Pérez" <eperezma@redhat.com>
To: qemu-devel@nongnu.org
Cc: Parav Pandit <parav@mellanox.com>,
	"Gonglei (Arei)" <arei.gonglei@huawei.com>,
	longpeng2@huawei.com, Shannon Nelson <snelson@pensando.io>,
	Laurent Vivier <lvivier@redhat.com>,
	si-wei.liu@oracle.com, Cindy Lu <lulu@redhat.com>,
	Lei Yang <leiyang@redhat.com>,
	Harpreet Singh Anand <hanand@xilinx.com>,
	Dragos Tatulea <dtatulea@nvidia.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Gautam Dawar <gdawar@xilinx.com>,
	Jason Wang <jasowang@redhat.com>,
	Liuxiangdong <liuxiangdong5@huawei.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	alvaro.karsz@solid-run.com, Zhu Lingshan <lingshan.zhu@intel.com>
Subject: [PATCH v4 1/2] vdpa: return errno in vhost_vdpa_get_vring_group error
Date: Fri, 26 May 2023 17:31:42 +0200	[thread overview]
Message-ID: <20230526153143.470745-2-eperezma@redhat.com> (raw)
In-Reply-To: <20230526153143.470745-1-eperezma@redhat.com>

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



  reply	other threads:[~2023-05-26 15:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26 15:31 [PATCH v4 0/2] Move ASID test to vhost-vdpa net initialization Eugenio Pérez
2023-05-26 15:31 ` Eugenio Pérez [this message]
2023-05-26 15:31 ` [PATCH v4 2/2] vdpa: move CVQ isolation check to net_init_vhost_vdpa Eugenio Pérez
2023-05-31  1:44   ` Jason Wang
2023-06-02 11:29 ` [PATCH v4 0/2] Move ASID test to vhost-vdpa net initialization Lei Yang
2023-06-23 13:04 ` Peter Maydell
2023-06-25  9:11   ` Eugenio Perez Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230526153143.470745-2-eperezma@redhat.com \
    --to=eperezma@redhat.com \
    --cc=alvaro.karsz@solid-run.com \
    --cc=arei.gonglei@huawei.com \
    --cc=dtatulea@nvidia.com \
    --cc=gdawar@xilinx.com \
    --cc=hanand@xilinx.com \
    --cc=jasowang@redhat.com \
    --cc=leiyang@redhat.com \
    --cc=lingshan.zhu@intel.com \
    --cc=liuxiangdong5@huawei.com \
    --cc=longpeng2@huawei.com \
    --cc=lulu@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=parav@mellanox.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=si-wei.liu@oracle.com \
    --cc=snelson@pensando.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).