[dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status

Andrew Rybchenko arybchenko at solarflare.com
Fri Sep 13 22:38:14 CEST 2019


On 9/13/19 7:56 PM, Ferruh Yigit wrote:
> On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
>> Enabling/disabling of promiscuous mode is not always successful and
>> it should be taken into account to be able to handle it properly.
>>
>> When correct return status is unclear from driver code, -EAGAIN is used.
>>
>> Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
> <...>
>
>> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
>> index aa716f3195..1da22ff866 100644
>> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
>> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
>> @@ -750,37 +750,43 @@ static void
>>   eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
>>   {
>>   	struct ifreq ifr;
>> +	int ret = 0;
>>   	int s;
>>   
>>   	s = socket(PF_INET, SOCK_DGRAM, 0);
>>   	if (s < 0)
>> -		return;
>> +		return -errno;
>>   
>>   	strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
>> -	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
>> +	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
>> +		ret = -errno;
>>   		goto out;
>> +	}
>>   	ifr.ifr_flags &= mask;
>>   	ifr.ifr_flags |= flags;
>> -	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0)
>> +	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0) {
>> +		ret = -errno;
>>   		goto out;
>> +	}
>>   out:
>>   	close(s);
>> +	return ret;
>>   }
> ../drivers/net/af_xdp/rte_eth_af_xdp.c: In function ‘eth_dev_change_flags’:
> ../drivers/net/af_xdp/rte_eth_af_xdp.c:758:10: warning: ‘return’ with a value,
> in function returning void [-Wreturn-type]
>    758 |   return -errno;
>        |          ^

Thanks, but this one is more tricky from build point of view to enable
AF_XDP PMD build. Failed to build even with 5.0.0 kernel and headers
on Ubuntu 18.04. So, I will rely on your and automation build checks.

Will try to fix in the next version.



More information about the dev mailing list