[dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
Ferruh Yigit
ferruh.yigit at intel.com
Fri Sep 13 18:56:48 CEST 2019
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;
| ^
More information about the dev
mailing list