DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value
@ 2019-07-12  7:40 Július Milan
  2019-07-12 15:09 ` Stephen Hemminger
  0 siblings, 1 reply; 10+ messages in thread
From: Július Milan @ 2019-07-12  7:40 UTC (permalink / raw)
  To: dev, xiaolong.ye, qi.z.zhang, david.marchand

Procedure xdp_get_channels_info was returning error code -1 in case of
unsupported ioctl command SIOCETHTOOL. This patch sets return
value back to 0 as it is valid case.

Fixes: 339b88c6a9 ("net/af_xdp: support multi-queue")

Signed-off-by: Július Milan <jmilan.dev@gmail.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
b/drivers/net/af_xdp/rte_eth_af_xdp.c
index ff8e90589..33352e10a 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
     ifr.ifr_data = (void *)&channels;
     strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
     ret = ioctl(fd, SIOCETHTOOL, &ifr);
-    if (ret && errno != EOPNOTSUPP) {
-        ret = -errno;
-        goto out;
+    if (ret) {
+        if (errno == EOPNOTSUPP) {
+            ret = 0;
+        } else {
+            ret = -errno;
+            goto out;
+        }
     }

     if (channels.max_combined == 0 || errno == EOPNOTSUPP) {
-- 
2.21.0

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

* Re: [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value
  2019-07-12  7:40 [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value Július Milan
@ 2019-07-12 15:09 ` Stephen Hemminger
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2019-07-12 15:09 UTC (permalink / raw)
  To: Július Milan; +Cc: dev, xiaolong.ye, qi.z.zhang, david.marchand

On Fri, 12 Jul 2019 09:40:37 +0200
Július Milan <jmilan.dev@gmail.com> wrote:

> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
> b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index ff8e90589..33352e10a 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
>      ifr.ifr_data = (void *)&channels;
>      strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
>      ret = ioctl(fd, SIOCETHTOOL, &ifr);
> -    if (ret && errno != EOPNOTSUPP) {
> -        ret = -errno;
> -        goto out;
> +    if (ret) {
> +        if (errno == EOPNOTSUPP) {
> +            ret = 0;
> +        } else {
> +            ret = -errno;
> +            goto out;
> +        }
>      }


Why not do close first and avoid the goto?
With your code, max_queues and combined_queues would never get set.


	ret = ioctl(fd, SIOCETHTOOL, &ifr);
	close(fd);
	if (ret < 0 && errno != EOPNOTSUPP)
		return -errno;

	if (errno == EOPNOTSUPP || channels.max_combined == 0) {
...

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

* Re: [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value
  2019-07-12 15:48     ` Stephen Hemminger
@ 2019-07-12 16:07       ` Ferruh Yigit
  0 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2019-07-12 16:07 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Július Milan, dev, xiaolong.ye, qi.z.zhang, david.marchand

On 7/12/2019 4:48 PM, Stephen Hemminger wrote:
> On Fri, 12 Jul 2019 16:35:55 +0100
> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> 
>> On 7/12/2019 4:10 PM, Stephen Hemminger wrote:
>>> On Fri, 12 Jul 2019 09:55:46 +0200
>>> Július Milan <jmilan.dev@gmail.com> wrote:
>>>   
>>>> Procedure xdp_get_channels_info was returning error code -1 in case of
>>>> ioctl command SIOCETHTOOL was not supported. This patch sets return
>>>> value back to 0 as it is valid case.
>>>>
>>>> Fixes: 339b88c6a9 ("net/af_xdp: support multi-queue")
>>>>
>>>> Signed-off-by: Július Milan <jmilan.dev@gmail.com>
>>>> ---
>>>>  drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---
>>>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
>>>> index ff8e90589..33352e10a 100644
>>>> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
>>>> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
>>>> @@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
>>>>  	ifr.ifr_data = (void *)&channels;
>>>>  	strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
>>>>  	ret = ioctl(fd, SIOCETHTOOL, &ifr);
>>>> -	if (ret && errno != EOPNOTSUPP) {
>>>> -		ret = -errno;
>>>> -		goto out;
>>>> +	if (ret) {
>>>> +		if (errno == EOPNOTSUPP) {
>>>> +			ret = 0;
>>>> +		} else {
>>>> +			ret = -errno;
>>>> +			goto out;
>>>> +		}
>>>>  	}
>>>>  
>>>>  	if (channels.max_combined == 0 || errno == EOPNOTSUPP) {  
>>>
>>> Still wrong, it doesn't set max_queues/combined_queues if errno == EOPNOTSUPP
>>>   
>>
>> Looks like code only fixes the return value, which was 'ret' before, now  '0',
>> the remaining logic should be same.
>>
>> as far as I can see, if errno == EOPNOTSUPP, it sets
>>   *max_queues = 1;
>>   *combined_queues = channels.combined_count;
> 
> OK, it does return correctly, just the hard way to do it.
> Keep it for now, I will do a cleanup pass over AF_XDP later.
> Lots  of things could be done simpler
> 

ok

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

* Re: [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value
  2019-07-12 15:35   ` Ferruh Yigit
@ 2019-07-12 15:48     ` Stephen Hemminger
  2019-07-12 16:07       ` Ferruh Yigit
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2019-07-12 15:48 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Július Milan, dev, xiaolong.ye, qi.z.zhang, david.marchand

On Fri, 12 Jul 2019 16:35:55 +0100
Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 7/12/2019 4:10 PM, Stephen Hemminger wrote:
> > On Fri, 12 Jul 2019 09:55:46 +0200
> > Július Milan <jmilan.dev@gmail.com> wrote:
> >   
> >> Procedure xdp_get_channels_info was returning error code -1 in case of
> >> ioctl command SIOCETHTOOL was not supported. This patch sets return
> >> value back to 0 as it is valid case.
> >>
> >> Fixes: 339b88c6a9 ("net/af_xdp: support multi-queue")
> >>
> >> Signed-off-by: Július Milan <jmilan.dev@gmail.com>
> >> ---
> >>  drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---
> >>  1 file changed, 7 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
> >> index ff8e90589..33352e10a 100644
> >> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> >> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> >> @@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
> >>  	ifr.ifr_data = (void *)&channels;
> >>  	strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
> >>  	ret = ioctl(fd, SIOCETHTOOL, &ifr);
> >> -	if (ret && errno != EOPNOTSUPP) {
> >> -		ret = -errno;
> >> -		goto out;
> >> +	if (ret) {
> >> +		if (errno == EOPNOTSUPP) {
> >> +			ret = 0;
> >> +		} else {
> >> +			ret = -errno;
> >> +			goto out;
> >> +		}
> >>  	}
> >>  
> >>  	if (channels.max_combined == 0 || errno == EOPNOTSUPP) {  
> > 
> > Still wrong, it doesn't set max_queues/combined_queues if errno == EOPNOTSUPP
> >   
> 
> Looks like code only fixes the return value, which was 'ret' before, now  '0',
> the remaining logic should be same.
> 
> as far as I can see, if errno == EOPNOTSUPP, it sets
>   *max_queues = 1;
>   *combined_queues = channels.combined_count;

OK, it does return correctly, just the hard way to do it.
Keep it for now, I will do a cleanup pass over AF_XDP later.
Lots  of things could be done simpler

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

* Re: [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value
  2019-07-12  7:55 Július Milan
  2019-07-12 15:10 ` Stephen Hemminger
@ 2019-07-12 15:43 ` Ye Xiaolong
  2019-07-12 15:01   ` Ferruh Yigit
  1 sibling, 1 reply; 10+ messages in thread
From: Ye Xiaolong @ 2019-07-12 15:43 UTC (permalink / raw)
  To: Július Milan; +Cc: dev, qi.z.zhang, david.marchand

Hi, 

Thanks for the patch.

On 07/12, Július Milan wrote:
>Procedure xdp_get_channels_info was returning error code -1 in case of
>ioctl command SIOCETHTOOL was not supported. This patch sets return
>value back to 0 as it is valid case.
>
>Fixes: 339b88c6a9 ("net/af_xdp: support multi-queue")
>
>Signed-off-by: Július Milan <jmilan.dev@gmail.com>
>---
> drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
>index ff8e90589..33352e10a 100644
>--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
>+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
>@@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
> 	ifr.ifr_data = (void *)&channels;
> 	strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
> 	ret = ioctl(fd, SIOCETHTOOL, &ifr);
>-	if (ret && errno != EOPNOTSUPP) {
>-		ret = -errno;
>-		goto out;
>+	if (ret) {
>+		if (errno == EOPNOTSUPP) {
>+			ret = 0;
>+		} else {
>+			ret = -errno;
>+			goto out;
>+		}
> 	}
> 
> 	if (channels.max_combined == 0 || errno == EOPNOTSUPP) {
>-- 
>2.21.0
>

Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>

Thanks,
Xiaolong

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

* Re: [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value
  2019-07-12 15:10 ` Stephen Hemminger
@ 2019-07-12 15:35   ` Ferruh Yigit
  2019-07-12 15:48     ` Stephen Hemminger
  0 siblings, 1 reply; 10+ messages in thread
From: Ferruh Yigit @ 2019-07-12 15:35 UTC (permalink / raw)
  To: Stephen Hemminger, Július Milan
  Cc: dev, xiaolong.ye, qi.z.zhang, david.marchand

On 7/12/2019 4:10 PM, Stephen Hemminger wrote:
> On Fri, 12 Jul 2019 09:55:46 +0200
> Július Milan <jmilan.dev@gmail.com> wrote:
> 
>> Procedure xdp_get_channels_info was returning error code -1 in case of
>> ioctl command SIOCETHTOOL was not supported. This patch sets return
>> value back to 0 as it is valid case.
>>
>> Fixes: 339b88c6a9 ("net/af_xdp: support multi-queue")
>>
>> Signed-off-by: Július Milan <jmilan.dev@gmail.com>
>> ---
>>  drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---
>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
>> index ff8e90589..33352e10a 100644
>> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
>> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
>> @@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
>>  	ifr.ifr_data = (void *)&channels;
>>  	strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
>>  	ret = ioctl(fd, SIOCETHTOOL, &ifr);
>> -	if (ret && errno != EOPNOTSUPP) {
>> -		ret = -errno;
>> -		goto out;
>> +	if (ret) {
>> +		if (errno == EOPNOTSUPP) {
>> +			ret = 0;
>> +		} else {
>> +			ret = -errno;
>> +			goto out;
>> +		}
>>  	}
>>  
>>  	if (channels.max_combined == 0 || errno == EOPNOTSUPP) {
> 
> Still wrong, it doesn't set max_queues/combined_queues if errno == EOPNOTSUPP
> 

Looks like code only fixes the return value, which was 'ret' before, now  '0',
the remaining logic should be same.

as far as I can see, if errno == EOPNOTSUPP, it sets
  *max_queues = 1;
  *combined_queues = channels.combined_count;

Am I missing something?

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

* Re: [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value
  2019-07-12 15:01   ` Ferruh Yigit
@ 2019-07-12 15:21     ` Stephen Hemminger
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2019-07-12 15:21 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Ye Xiaolong, Július Milan, dev, qi.z.zhang, david.marchand

On Fri, 12 Jul 2019 16:01:39 +0100
Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 7/12/2019 4:43 PM, Ye Xiaolong wrote:
> > Hi, 
> > 
> > Thanks for the patch.
> > 
> > On 07/12, Július Milan wrote:  
> >> Procedure xdp_get_channels_info was returning error code -1 in case of
> >> ioctl command SIOCETHTOOL was not supported. This patch sets return
> >> value back to 0 as it is valid case.
> >>
> >> Fixes: 339b88c6a9 ("net/af_xdp: support multi-queue")
> >>
> >> Signed-off-by: Július Milan <jmilan.dev@gmail.com>  
> >
> > 
> > Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>  
> 
> Applied to dpdk-next-net/master, thanks.

The patch was broken. It would not set channel values correctly

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

* Re: [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value
  2019-07-12  7:55 Július Milan
@ 2019-07-12 15:10 ` Stephen Hemminger
  2019-07-12 15:35   ` Ferruh Yigit
  2019-07-12 15:43 ` Ye Xiaolong
  1 sibling, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2019-07-12 15:10 UTC (permalink / raw)
  To: Július Milan; +Cc: dev, xiaolong.ye, qi.z.zhang, david.marchand

On Fri, 12 Jul 2019 09:55:46 +0200
Július Milan <jmilan.dev@gmail.com> wrote:

> Procedure xdp_get_channels_info was returning error code -1 in case of
> ioctl command SIOCETHTOOL was not supported. This patch sets return
> value back to 0 as it is valid case.
> 
> Fixes: 339b88c6a9 ("net/af_xdp: support multi-queue")
> 
> Signed-off-by: Július Milan <jmilan.dev@gmail.com>
> ---
>  drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index ff8e90589..33352e10a 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
>  	ifr.ifr_data = (void *)&channels;
>  	strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
>  	ret = ioctl(fd, SIOCETHTOOL, &ifr);
> -	if (ret && errno != EOPNOTSUPP) {
> -		ret = -errno;
> -		goto out;
> +	if (ret) {
> +		if (errno == EOPNOTSUPP) {
> +			ret = 0;
> +		} else {
> +			ret = -errno;
> +			goto out;
> +		}
>  	}
>  
>  	if (channels.max_combined == 0 || errno == EOPNOTSUPP) {

Still wrong, it doesn't set max_queues/combined_queues if errno == EOPNOTSUPP

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

* Re: [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value
  2019-07-12 15:43 ` Ye Xiaolong
@ 2019-07-12 15:01   ` Ferruh Yigit
  2019-07-12 15:21     ` Stephen Hemminger
  0 siblings, 1 reply; 10+ messages in thread
From: Ferruh Yigit @ 2019-07-12 15:01 UTC (permalink / raw)
  To: Ye Xiaolong, Július Milan; +Cc: dev, qi.z.zhang, david.marchand

On 7/12/2019 4:43 PM, Ye Xiaolong wrote:
> Hi, 
> 
> Thanks for the patch.
> 
> On 07/12, Július Milan wrote:
>> Procedure xdp_get_channels_info was returning error code -1 in case of
>> ioctl command SIOCETHTOOL was not supported. This patch sets return
>> value back to 0 as it is valid case.
>>
>> Fixes: 339b88c6a9 ("net/af_xdp: support multi-queue")
>>
>> Signed-off-by: Július Milan <jmilan.dev@gmail.com>
>
> 
> Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>

Applied to dpdk-next-net/master, thanks.

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

* [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value
@ 2019-07-12  7:55 Július Milan
  2019-07-12 15:10 ` Stephen Hemminger
  2019-07-12 15:43 ` Ye Xiaolong
  0 siblings, 2 replies; 10+ messages in thread
From: Július Milan @ 2019-07-12  7:55 UTC (permalink / raw)
  To: dev, xiaolong.ye, qi.z.zhang, david.marchand

Procedure xdp_get_channels_info was returning error code -1 in case of
ioctl command SIOCETHTOOL was not supported. This patch sets return
value back to 0 as it is valid case.

Fixes: 339b88c6a9 ("net/af_xdp: support multi-queue")

Signed-off-by: Július Milan <jmilan.dev@gmail.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index ff8e90589..33352e10a 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
 	ifr.ifr_data = (void *)&channels;
 	strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
 	ret = ioctl(fd, SIOCETHTOOL, &ifr);
-	if (ret && errno != EOPNOTSUPP) {
-		ret = -errno;
-		goto out;
+	if (ret) {
+		if (errno == EOPNOTSUPP) {
+			ret = 0;
+		} else {
+			ret = -errno;
+			goto out;
+		}
 	}
 
 	if (channels.max_combined == 0 || errno == EOPNOTSUPP) {
-- 
2.21.0


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

end of thread, other threads:[~2019-07-12 16:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12  7:40 [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value Július Milan
2019-07-12 15:09 ` Stephen Hemminger
2019-07-12  7:55 Július Milan
2019-07-12 15:10 ` Stephen Hemminger
2019-07-12 15:35   ` Ferruh Yigit
2019-07-12 15:48     ` Stephen Hemminger
2019-07-12 16:07       ` Ferruh Yigit
2019-07-12 15:43 ` Ye Xiaolong
2019-07-12 15:01   ` Ferruh Yigit
2019-07-12 15:21     ` Stephen Hemminger

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