DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH v1 2/2] vfio: add errno on unsupported platforms
Date: Thu, 16 Sep 2021 10:36:38 +0000	[thread overview]
Message-ID: <67c4e47e511558e2442c73c57c1764df656720e3.1631788595.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <25dd76eca01ec57d64be9c0a78ac2752f602984f.1631788595.git.anatoly.burakov@intel.com>

Currently, when code is running on FreeBSD (or using fallback Linux
implementation), there is no way to distinguish between a geniune error
and a "VFIO is unsupported" error. Fix the dummy implemnetations to also
set the rte_errno flag.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/eal/freebsd/eal.c    | 12 ++++++++++++
 lib/eal/linux/eal_vfio.c | 12 ++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 6cee5ae369..6d249edb11 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -1000,6 +1000,7 @@ int rte_vfio_setup_device(__rte_unused const char *sysfs_base,
 		      __rte_unused int *vfio_dev_fd,
 		      __rte_unused struct vfio_device_info *device_info)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -1007,11 +1008,13 @@ int rte_vfio_release_device(__rte_unused const char *sysfs_base,
 			__rte_unused const char *dev_addr,
 			__rte_unused int fd)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
 int rte_vfio_enable(__rte_unused const char *modname)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -1035,30 +1038,35 @@ rte_vfio_get_group_num(__rte_unused const char *sysfs_base,
 		       __rte_unused const char *dev_addr,
 		       __rte_unused int *iommu_group_num)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
 int
 rte_vfio_get_container_fd(void)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
 int
 rte_vfio_get_group_fd(__rte_unused int iommu_group_num)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
 int
 rte_vfio_container_create(void)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
 int
 rte_vfio_container_destroy(__rte_unused int container_fd)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -1066,6 +1074,7 @@ int
 rte_vfio_container_group_bind(__rte_unused int container_fd,
 		__rte_unused int iommu_group_num)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -1073,6 +1082,7 @@ int
 rte_vfio_container_group_unbind(__rte_unused int container_fd,
 		__rte_unused int iommu_group_num)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -1082,6 +1092,7 @@ rte_vfio_container_dma_map(__rte_unused int container_fd,
 			__rte_unused uint64_t iova,
 			__rte_unused uint64_t len)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -1091,5 +1102,6 @@ rte_vfio_container_dma_unmap(__rte_unused int container_fd,
 			__rte_unused uint64_t iova,
 			__rte_unused uint64_t len)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
index b9e4d3ad3c..bb4c225aed 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -2092,6 +2092,7 @@ rte_vfio_setup_device(__rte_unused const char *sysfs_base,
 		__rte_unused int *vfio_dev_fd,
 		__rte_unused struct vfio_device_info *device_info)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -2099,12 +2100,14 @@ int
 rte_vfio_release_device(__rte_unused const char *sysfs_base,
 		__rte_unused const char *dev_addr, __rte_unused int fd)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
 int
 rte_vfio_enable(__rte_unused const char *modname)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -2131,30 +2134,35 @@ rte_vfio_get_group_num(__rte_unused const char *sysfs_base,
 		__rte_unused const char *dev_addr,
 		__rte_unused int *iommu_group_num)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
 int
 rte_vfio_get_container_fd(void)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
 int
 rte_vfio_get_group_fd(__rte_unused int iommu_group_num)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
 int
 rte_vfio_container_create(void)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
 int
 rte_vfio_container_destroy(__rte_unused int container_fd)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -2162,6 +2170,7 @@ int
 rte_vfio_container_group_bind(__rte_unused int container_fd,
 		__rte_unused int iommu_group_num)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -2169,6 +2178,7 @@ int
 rte_vfio_container_group_unbind(__rte_unused int container_fd,
 		__rte_unused int iommu_group_num)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -2178,6 +2188,7 @@ rte_vfio_container_dma_map(__rte_unused int container_fd,
 		__rte_unused uint64_t iova,
 		__rte_unused uint64_t len)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -2187,6 +2198,7 @@ rte_vfio_container_dma_unmap(__rte_unused int container_fd,
 		__rte_unused uint64_t iova,
 		__rte_unused uint64_t len)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
-- 
2.25.1


  reply	other threads:[~2021-09-16 10:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 10:36 [dpdk-dev] [PATCH v1 1/2] vfio: make API return values consistent Anatoly Burakov
2021-09-16 10:36 ` Anatoly Burakov [this message]
2021-09-16 10:39   ` [dpdk-dev] [PATCH v1 2/2] vfio: add errno on unsupported platforms Bruce Richardson
2021-09-22  3:31   ` Xia, Chenbo
2021-09-22  3:30 ` [dpdk-dev] [PATCH v1 1/2] vfio: make API return values consistent Xia, Chenbo
2021-09-22  9:26   ` Ferruh Yigit
2021-09-22 11:30     ` Xia, Chenbo
2021-10-28  8:21       ` David Marchand
2021-10-28 10:29   ` Burakov, Anatoly
2021-10-28 11:11     ` Xia, Chenbo
2021-10-28 11:32       ` Ferruh Yigit
2021-10-28 13:00         ` Burakov, Anatoly
2021-10-28 14:53         ` Thomas Monjalon
2021-10-28 15:40           ` Burakov, Anatoly
2021-10-28 16:38             ` Stephen Hemminger
2021-10-28 13:49 ` [dpdk-dev] [PATCH v2 1/4] vfio: drop fallback Linux implementation Anatoly Burakov
2021-10-28 13:49   ` [dpdk-dev] [PATCH v2 2/4] vfio: fix wrong return value for FreeBSD Anatoly Burakov
2021-10-28 13:49   ` [dpdk-dev] [PATCH v2 3/4] vfio: fix documentation to match intended behavior Anatoly Burakov
2021-10-28 13:49   ` [dpdk-dev] [PATCH v2 4/4] vfio: add errno on unsupported platforms Anatoly Burakov
2021-10-28 14:13     ` Burakov, Anatoly
2021-10-28 14:15   ` [dpdk-dev] [PATCH v3 1/4] vfio: drop fallback Linux implementation Anatoly Burakov
2021-10-28 14:15     ` [dpdk-dev] [PATCH v3 2/4] vfio: fix wrong return value for FreeBSD Anatoly Burakov
2021-11-05  2:50       ` Xia, Chenbo
2021-10-28 14:15     ` [dpdk-dev] [PATCH v3 3/4] vfio: fix documentation to match intended behavior Anatoly Burakov
2021-11-05  2:57       ` [dpdk-dev] [dpdk-stable] " Xia, Chenbo
2021-10-28 14:15     ` [dpdk-dev] [PATCH v3 4/4] vfio: add errno on unsupported platforms Anatoly Burakov
2021-11-08 15:55       ` [dpdk-dev] [dpdk-stable] " David Marchand
2021-11-01  6:27     ` [dpdk-dev] [PATCH v3 1/4] vfio: drop fallback Linux implementation Xia, Chenbo
2021-11-01 13:57       ` Burakov, Anatoly
2021-11-05  2:48         ` Xia, Chenbo

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=67c4e47e511558e2442c73c57c1764df656720e3.1631788595.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /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).