patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v2 2/4] vfio: fix wrong return value for FreeBSD
       [not found] ` <b2382197250fe4a359a7eb2e7e4c1d12cd959500.1635428963.git.anatoly.burakov@intel.com>
@ 2021-10-28 13:49   ` Anatoly Burakov
  2021-10-28 13:49   ` [dpdk-stable] [PATCH v2 3/4] vfio: fix documentation to match intended behavior Anatoly Burakov
       [not found]   ` <b2382197250fe4a359a7eb2e7e4c1d12cd959500.1635430513.git.anatoly.burakov@intel.com>
  2 siblings, 0 replies; 8+ messages in thread
From: Anatoly Burakov @ 2021-10-28 13:49 UTC (permalink / raw)
  To: dev, Bruce Richardson; +Cc: stable

On FreeBSD, `rte_vfio_clear_group()` was returning 0 even though this
function is not valid for FreeBSD, and is called out to return error in
doxygen comments. Fix the return value to match documentation.

Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/eal/freebsd/eal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 9935356ed4..dada210b19 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -1032,7 +1032,7 @@ int rte_vfio_noiommu_is_enabled(void)
 
 int rte_vfio_clear_group(__rte_unused int vfio_group_fd)
 {
-	return 0;
+	return -1;
 }
 
 int
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-stable] [PATCH v2 3/4] vfio: fix documentation to match intended behavior
       [not found] ` <b2382197250fe4a359a7eb2e7e4c1d12cd959500.1635428963.git.anatoly.burakov@intel.com>
  2021-10-28 13:49   ` [dpdk-stable] [PATCH v2 2/4] vfio: fix wrong return value for FreeBSD Anatoly Burakov
@ 2021-10-28 13:49   ` Anatoly Burakov
       [not found]   ` <b2382197250fe4a359a7eb2e7e4c1d12cd959500.1635430513.git.anatoly.burakov@intel.com>
  2 siblings, 0 replies; 8+ messages in thread
From: Anatoly Burakov @ 2021-10-28 13:49 UTC (permalink / raw)
  To: dev; +Cc: stable

On FreeBSD, `rte_vfio_is_enabled()` and `rte_vfio_noiommu_is_enabled()`
API calls will not return error, and will instead return 0. This is
intentional, because the caller of this API does not care whether VFIO
is supported at all, and will instead be interested in whether VFIO is
enabled or not. However, the doxygen comments for these functions state
that they will return an error on FreeBSD, which is incorrect.

Fix the doxygen comment to call out the fact that these
functions are only relevant on Linux, but remove the reference to
returning errors.

Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

Notes:
    Current minimum support Linux kernel is 4.4, and Meson build file sets the
    RTE_EAL_VFIO config option to `true` simply because we are compiling for Linux.
    So, it looks like VFIO support is pretty much assumed on Linux, so i think we
    can safely drop the fallback dummy implementation from Linux altogether?

 lib/eal/include/rte_vfio.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/eal/include/rte_vfio.h b/lib/eal/include/rte_vfio.h
index 2d90b36480..7bdb8932b2 100644
--- a/lib/eal/include/rte_vfio.h
+++ b/lib/eal/include/rte_vfio.h
@@ -150,8 +150,7 @@ int rte_vfio_enable(const char *modname);
 /**
  * Check whether a VFIO-related kmod is enabled.
  *
- * This function is only relevant to linux and will return
- * an error on BSD.
+ * This function is only relevant to Linux.
  *
  * @param modname
  *   kernel module name.
@@ -165,8 +164,7 @@ int rte_vfio_is_enabled(const char *modname);
 /**
  * Whether VFIO NOIOMMU mode is enabled.
  *
- * This function is only relevant to linux and will return
- * an error on BSD.
+ * This function is only relevant to Linux.
  *
  * @return
  *   1 if true.
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-stable] [PATCH v3 2/4] vfio: fix wrong return value for FreeBSD
       [not found]   ` <b2382197250fe4a359a7eb2e7e4c1d12cd959500.1635430513.git.anatoly.burakov@intel.com>
@ 2021-10-28 14:15     ` Anatoly Burakov
  2021-11-05  2:50       ` [dpdk-stable] [dpdk-dev] " Xia, Chenbo
  2021-10-28 14:15     ` [dpdk-stable] [PATCH v3 3/4] vfio: fix documentation to match intended behavior Anatoly Burakov
  2021-10-28 14:15     ` [dpdk-stable] [PATCH v3 4/4] vfio: add errno on unsupported platforms Anatoly Burakov
  2 siblings, 1 reply; 8+ messages in thread
From: Anatoly Burakov @ 2021-10-28 14:15 UTC (permalink / raw)
  To: dev, Bruce Richardson; +Cc: stable

On FreeBSD, `rte_vfio_clear_group()` was returning 0 even though this
function is not valid for FreeBSD, and is called out to return error in
doxygen comments. Fix the return value to match documentation.

Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/eal/freebsd/eal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 9935356ed4..dada210b19 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -1032,7 +1032,7 @@ int rte_vfio_noiommu_is_enabled(void)
 
 int rte_vfio_clear_group(__rte_unused int vfio_group_fd)
 {
-	return 0;
+	return -1;
 }
 
 int
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-stable] [PATCH v3 3/4] vfio: fix documentation to match intended behavior
       [not found]   ` <b2382197250fe4a359a7eb2e7e4c1d12cd959500.1635430513.git.anatoly.burakov@intel.com>
  2021-10-28 14:15     ` [dpdk-stable] [PATCH v3 2/4] vfio: fix wrong return value for FreeBSD Anatoly Burakov
@ 2021-10-28 14:15     ` Anatoly Burakov
  2021-11-05  2:57       ` Xia, Chenbo
  2021-10-28 14:15     ` [dpdk-stable] [PATCH v3 4/4] vfio: add errno on unsupported platforms Anatoly Burakov
  2 siblings, 1 reply; 8+ messages in thread
From: Anatoly Burakov @ 2021-10-28 14:15 UTC (permalink / raw)
  To: dev; +Cc: stable

On FreeBSD, `rte_vfio_is_enabled()` and `rte_vfio_noiommu_is_enabled()`
API calls will not return error, and will instead return 0. This is
intentional, because the caller of this API does not care whether VFIO
is supported at all, and will instead be interested in whether VFIO is
enabled or not. However, the doxygen comments for these functions state
that they will return an error on FreeBSD, which is incorrect.

Fix the doxygen comment to call out the fact that these
functions are only relevant on Linux, but remove the reference to
returning errors.

Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/eal/include/rte_vfio.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/eal/include/rte_vfio.h b/lib/eal/include/rte_vfio.h
index 2d90b36480..7bdb8932b2 100644
--- a/lib/eal/include/rte_vfio.h
+++ b/lib/eal/include/rte_vfio.h
@@ -150,8 +150,7 @@ int rte_vfio_enable(const char *modname);
 /**
  * Check whether a VFIO-related kmod is enabled.
  *
- * This function is only relevant to linux and will return
- * an error on BSD.
+ * This function is only relevant to Linux.
  *
  * @param modname
  *   kernel module name.
@@ -165,8 +164,7 @@ int rte_vfio_is_enabled(const char *modname);
 /**
  * Whether VFIO NOIOMMU mode is enabled.
  *
- * This function is only relevant to linux and will return
- * an error on BSD.
+ * This function is only relevant to Linux.
  *
  * @return
  *   1 if true.
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-stable] [PATCH v3 4/4] vfio: add errno on unsupported platforms
       [not found]   ` <b2382197250fe4a359a7eb2e7e4c1d12cd959500.1635430513.git.anatoly.burakov@intel.com>
  2021-10-28 14:15     ` [dpdk-stable] [PATCH v3 2/4] vfio: fix wrong return value for FreeBSD Anatoly Burakov
  2021-10-28 14:15     ` [dpdk-stable] [PATCH v3 3/4] vfio: fix documentation to match intended behavior Anatoly Burakov
@ 2021-10-28 14:15     ` Anatoly Burakov
  2021-11-08 15:55       ` David Marchand
  2 siblings, 1 reply; 8+ messages in thread
From: Anatoly Burakov @ 2021-10-28 14:15 UTC (permalink / raw)
  To: dev, Bruce Richardson, Dmitry Kozlyuk, Narcisa Ana Maria Vasile,
	Dmitry Malloy, Pallavi Kadam
  Cc: stable, Chenbo Xia

Currently, when code is running on FreeBSD or Windows,, there is no way
to distinguish between a geniune error and a "VFIO is unsupported"
error. Fix the dummy implementations to also set the rte_errno flag.

Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Chenbo Xia <chenbo.xia@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/eal/freebsd/eal.c | 13 +++++++++++++
 lib/eal/windows/eal.c |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index dada210b19..fce13accc8 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -1005,6 +1005,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;
 }
 
@@ -1012,11 +1013,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;
 }
 
@@ -1032,6 +1035,7 @@ int rte_vfio_noiommu_is_enabled(void)
 
 int rte_vfio_clear_group(__rte_unused int vfio_group_fd)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -1040,30 +1044,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;
 }
 
@@ -1071,6 +1080,7 @@ int
 rte_vfio_container_group_bind(__rte_unused int container_fd,
 		__rte_unused int iommu_group_num)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -1078,6 +1088,7 @@ int
 rte_vfio_container_group_unbind(__rte_unused int container_fd,
 		__rte_unused int iommu_group_num)
 {
+	rte_errno = ENOTSUP;
 	return -1;
 }
 
@@ -1087,6 +1098,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;
 }
 
@@ -1096,5 +1108,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/windows/eal.c b/lib/eal/windows/eal.c
index f7ce1b6671..67db7f099a 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -481,6 +481,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;
 }
 
@@ -490,6 +491,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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v3 2/4] vfio: fix wrong return value for FreeBSD
  2021-10-28 14:15     ` [dpdk-stable] [PATCH v3 2/4] vfio: fix wrong return value for FreeBSD Anatoly Burakov
@ 2021-11-05  2:50       ` Xia, Chenbo
  0 siblings, 0 replies; 8+ messages in thread
From: Xia, Chenbo @ 2021-11-05  2:50 UTC (permalink / raw)
  To: Burakov, Anatoly, dev, Richardson, Bruce; +Cc: stable

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Anatoly Burakov
> Sent: Thursday, October 28, 2021 10:15 PM
> To: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>
> Cc: stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v3 2/4] vfio: fix wrong return value for FreeBSD
> 
> On FreeBSD, `rte_vfio_clear_group()` was returning 0 even though this
> function is not valid for FreeBSD, and is called out to return error in
> doxygen comments. Fix the return value to match documentation.
> 

Fix tag?

/Chenbo

> Cc: stable@dpdk.org
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  lib/eal/freebsd/eal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
> index 9935356ed4..dada210b19 100644
> --- a/lib/eal/freebsd/eal.c
> +++ b/lib/eal/freebsd/eal.c
> @@ -1032,7 +1032,7 @@ int rte_vfio_noiommu_is_enabled(void)
> 
>  int rte_vfio_clear_group(__rte_unused int vfio_group_fd)
>  {
> -	return 0;
> +	return -1;
>  }
> 
>  int
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-stable] [PATCH v3 3/4] vfio: fix documentation to match intended behavior
  2021-10-28 14:15     ` [dpdk-stable] [PATCH v3 3/4] vfio: fix documentation to match intended behavior Anatoly Burakov
@ 2021-11-05  2:57       ` Xia, Chenbo
  0 siblings, 0 replies; 8+ messages in thread
From: Xia, Chenbo @ 2021-11-05  2:57 UTC (permalink / raw)
  To: Burakov, Anatoly, dev; +Cc: stable

> -----Original Message-----
> From: stable <stable-bounces@dpdk.org> On Behalf Of Anatoly Burakov
> Sent: Thursday, October 28, 2021 10:15 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: [dpdk-stable] [PATCH v3 3/4] vfio: fix documentation to match
> intended behavior
> 
> On FreeBSD, `rte_vfio_is_enabled()` and `rte_vfio_noiommu_is_enabled()`
> API calls will not return error, and will instead return 0. This is
> intentional, because the caller of this API does not care whether VFIO
> is supported at all, and will instead be interested in whether VFIO is
> enabled or not. However, the doxygen comments for these functions state
> that they will return an error on FreeBSD, which is incorrect.
> 
> Fix the doxygen comment to call out the fact that these
> functions are only relevant on Linux, but remove the reference to
> returning errors.
> 

Fix tag?

With above fixed:

Acked-by: Chenbo Xia <chenbo.xia@intel.com>

> Cc: stable@dpdk.org
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  lib/eal/include/rte_vfio.h | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/eal/include/rte_vfio.h b/lib/eal/include/rte_vfio.h
> index 2d90b36480..7bdb8932b2 100644
> --- a/lib/eal/include/rte_vfio.h
> +++ b/lib/eal/include/rte_vfio.h
> @@ -150,8 +150,7 @@ int rte_vfio_enable(const char *modname);
>  /**
>   * Check whether a VFIO-related kmod is enabled.
>   *
> - * This function is only relevant to linux and will return
> - * an error on BSD.
> + * This function is only relevant to Linux.
>   *
>   * @param modname
>   *   kernel module name.
> @@ -165,8 +164,7 @@ int rte_vfio_is_enabled(const char *modname);
>  /**
>   * Whether VFIO NOIOMMU mode is enabled.
>   *
> - * This function is only relevant to linux and will return
> - * an error on BSD.
> + * This function is only relevant to Linux.
>   *
>   * @return
>   *   1 if true.
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-stable] [PATCH v3 4/4] vfio: add errno on unsupported platforms
  2021-10-28 14:15     ` [dpdk-stable] [PATCH v3 4/4] vfio: add errno on unsupported platforms Anatoly Burakov
@ 2021-11-08 15:55       ` David Marchand
  0 siblings, 0 replies; 8+ messages in thread
From: David Marchand @ 2021-11-08 15:55 UTC (permalink / raw)
  To: Anatoly Burakov
  Cc: dev, Bruce Richardson, Dmitry Kozlyuk, Narcisa Ana Maria Vasile,
	Dmitry Malloy, Pallavi Kadam, dpdk stable, Chenbo Xia

On Thu, Oct 28, 2021 at 4:15 PM Anatoly Burakov
<anatoly.burakov@intel.com> wrote:
>
> Currently, when code is running on FreeBSD or Windows,, there is no way
> to distinguish between a geniune error and a "VFIO is unsupported"
> error. Fix the dummy implementations to also set the rte_errno flag.
>
> Cc: stable@dpdk.org

> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Acked-by: Chenbo Xia <chenbo.xia@intel.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Added (what I hope are correct) Fixes: line in patches 2, 3 and 4.
Series applied, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-08 15:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <25dd76eca01ec57d64be9c0a78ac2752f602984f.1631788595.git.anatoly.burakov@intel.com>
     [not found] ` <b2382197250fe4a359a7eb2e7e4c1d12cd959500.1635428963.git.anatoly.burakov@intel.com>
2021-10-28 13:49   ` [dpdk-stable] [PATCH v2 2/4] vfio: fix wrong return value for FreeBSD Anatoly Burakov
2021-10-28 13:49   ` [dpdk-stable] [PATCH v2 3/4] vfio: fix documentation to match intended behavior Anatoly Burakov
     [not found]   ` <b2382197250fe4a359a7eb2e7e4c1d12cd959500.1635430513.git.anatoly.burakov@intel.com>
2021-10-28 14:15     ` [dpdk-stable] [PATCH v3 2/4] vfio: fix wrong return value for FreeBSD Anatoly Burakov
2021-11-05  2:50       ` [dpdk-stable] [dpdk-dev] " Xia, Chenbo
2021-10-28 14:15     ` [dpdk-stable] [PATCH v3 3/4] vfio: fix documentation to match intended behavior Anatoly Burakov
2021-11-05  2:57       ` Xia, Chenbo
2021-10-28 14:15     ` [dpdk-stable] [PATCH v3 4/4] vfio: add errno on unsupported platforms Anatoly Burakov
2021-11-08 15:55       ` David Marchand

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).