diff mbox series

[v1,1/2] vfio: make API return values consistent

Message ID 25dd76eca01ec57d64be9c0a78ac2752f602984f.1631788595.git.anatoly.burakov@intel.com (mailing list archive)
State Changes Requested
Delegated to: David Marchand
Headers show
Series [v1,1/2] vfio: make API return values consistent | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Burakov, Anatoly Sept. 16, 2021, 10:36 a.m. UTC
Currently, when VFIO support is not compiled, FreeBSD and Linux have
different return values. Fix Linux implementation to follow FreeBSD one.

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/linux/eal_vfio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Xia, Chenbo Sept. 22, 2021, 3:30 a.m. UTC | #1
Hi Anatoly,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Anatoly Burakov
> Sent: Thursday, September 16, 2021 6:37 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v1 1/2] vfio: make API return values consistent
> 
> Currently, when VFIO support is not compiled, FreeBSD and Linux have
> different return values. Fix Linux implementation to follow FreeBSD one.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
> 
> Notes:
>     Current minimum support Linux kernel is 4.4, and Meson build file sets the

Do you mean currently DPDK support linux >= 4.4? I am not aware of this, could you
show me where it is defined?

And do we need backport? As 'return -1' does not align with the API doxygen.

Thanks,
Chenbo

>     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/linux/eal_vfio.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
> index 25add2fa5d..b9e4d3ad3c 100644
> --- a/lib/eal/linux/eal_vfio.c
> +++ b/lib/eal/linux/eal_vfio.c
> @@ -2111,19 +2111,19 @@ rte_vfio_enable(__rte_unused const char *modname)
>  int
>  rte_vfio_is_enabled(__rte_unused const char *modname)
>  {
> -	return -1;
> +	return 0;
>  }
> 
>  int
>  rte_vfio_noiommu_is_enabled(void)
>  {
> -	return -1;
> +	return 0;
>  }
> 
>  int
>  rte_vfio_clear_group(__rte_unused int vfio_group_fd)
>  {
> -	return -1;
> +	return 0;
>  }
> 
>  int
> --
> 2.25.1
Ferruh Yigit Sept. 22, 2021, 9:26 a.m. UTC | #2
On 9/22/2021 4:30 AM, Xia, Chenbo wrote:
> Hi Anatoly,
> 
>> -----Original Message-----
>> From: dev <dev-bounces@dpdk.org> On Behalf Of Anatoly Burakov
>> Sent: Thursday, September 16, 2021 6:37 PM
>> To: dev@dpdk.org
>> Subject: [dpdk-dev] [PATCH v1 1/2] vfio: make API return values consistent
>>
>> Currently, when VFIO support is not compiled, FreeBSD and Linux have
>> different return values. Fix Linux implementation to follow FreeBSD one.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>> ---
>>
>> Notes:
>>     Current minimum support Linux kernel is 4.4, and Meson build file sets the
> 
> Do you mean currently DPDK support linux >= 4.4? I am not aware of this, could you
> show me where it is defined?
> 

https://git.dpdk.org/dpdk/tree/doc/guides/linux_gsg/sys_reqs.rst?h=v21.08#n124

Commit d2feae68bf30 ("doc: update minimum supported Linux kernel")

> And do we need backport? As 'return -1' does not align with the API doxygen.
> 
> Thanks,
> Chenbo
> 
>>     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/linux/eal_vfio.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
>> index 25add2fa5d..b9e4d3ad3c 100644
>> --- a/lib/eal/linux/eal_vfio.c
>> +++ b/lib/eal/linux/eal_vfio.c
>> @@ -2111,19 +2111,19 @@ rte_vfio_enable(__rte_unused const char *modname)
>>  int
>>  rte_vfio_is_enabled(__rte_unused const char *modname)
>>  {
>> -	return -1;
>> +	return 0;
>>  }
>>
>>  int
>>  rte_vfio_noiommu_is_enabled(void)
>>  {
>> -	return -1;
>> +	return 0;
>>  }
>>
>>  int
>>  rte_vfio_clear_group(__rte_unused int vfio_group_fd)
>>  {
>> -	return -1;
>> +	return 0;
>>  }
>>
>>  int
>> --
>> 2.25.1
>
Xia, Chenbo Sept. 22, 2021, 11:30 a.m. UTC | #3
> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Wednesday, September 22, 2021 5:27 PM
> To: Xia, Chenbo <chenbo.xia@intel.com>; Burakov, Anatoly
> <anatoly.burakov@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v1 1/2] vfio: make API return values consistent
> 
> On 9/22/2021 4:30 AM, Xia, Chenbo wrote:
> > Hi Anatoly,
> >
> >> -----Original Message-----
> >> From: dev <dev-bounces@dpdk.org> On Behalf Of Anatoly Burakov
> >> Sent: Thursday, September 16, 2021 6:37 PM
> >> To: dev@dpdk.org
> >> Subject: [dpdk-dev] [PATCH v1 1/2] vfio: make API return values consistent
> >>
> >> Currently, when VFIO support is not compiled, FreeBSD and Linux have
> >> different return values. Fix Linux implementation to follow FreeBSD one.
> >>
> >> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> >> ---
> >>
> >> Notes:
> >>     Current minimum support Linux kernel is 4.4, and Meson build file sets
> the
> >
> > Do you mean currently DPDK support linux >= 4.4? I am not aware of this,
> could you
> > show me where it is defined?
> >
> 
> https://git.dpdk.org/dpdk/tree/doc/guides/linux_gsg/sys_reqs.rst?h=v21.08#n124
> 
> Commit d2feae68bf30 ("doc: update minimum supported Linux kernel")

Thanks Ferruh!

About removing the fallback or not, if we decide to remove, maybe for other files
that check linux kernel version, we also need to change some check because we are
assuming kernel version >= 4.4 here. If that's a strong requirement, I'll vote for
yes...

/Chenbo

> 
> > And do we need backport? As 'return -1' does not align with the API doxygen.
> >
> > Thanks,
> > Chenbo
> >
> >>     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/linux/eal_vfio.c | 6 +++---
> >>  1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
> >> index 25add2fa5d..b9e4d3ad3c 100644
> >> --- a/lib/eal/linux/eal_vfio.c
> >> +++ b/lib/eal/linux/eal_vfio.c
> >> @@ -2111,19 +2111,19 @@ rte_vfio_enable(__rte_unused const char *modname)
> >>  int
> >>  rte_vfio_is_enabled(__rte_unused const char *modname)
> >>  {
> >> -	return -1;
> >> +	return 0;
> >>  }
> >>
> >>  int
> >>  rte_vfio_noiommu_is_enabled(void)
> >>  {
> >> -	return -1;
> >> +	return 0;
> >>  }
> >>
> >>  int
> >>  rte_vfio_clear_group(__rte_unused int vfio_group_fd)
> >>  {
> >> -	return -1;
> >> +	return 0;
> >>  }
> >>
> >>  int
> >> --
> >> 2.25.1
> >
diff mbox series

Patch

diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
index 25add2fa5d..b9e4d3ad3c 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -2111,19 +2111,19 @@  rte_vfio_enable(__rte_unused const char *modname)
 int
 rte_vfio_is_enabled(__rte_unused const char *modname)
 {
-	return -1;
+	return 0;
 }
 
 int
 rte_vfio_noiommu_is_enabled(void)
 {
-	return -1;
+	return 0;
 }
 
 int
 rte_vfio_clear_group(__rte_unused int vfio_group_fd)
 {
-	return -1;
+	return 0;
 }
 
 int