[dpdk-dev] [PATCH 14/18] examples/flow_filtering: check status of getting link info

Ori Kam orika at mellanox.com
Thu Sep 12 07:16:33 CEST 2019



> -----Original Message-----
> From: Andrew Rybchenko <arybchenko at solarflare.com>
> Sent: Tuesday, September 10, 2019 11:26 AM
> To: Marko Kovacevic <marko.kovacevic at intel.com>; Ori Kam
> <orika at mellanox.com>; Bruce Richardson <bruce.richardson at intel.com>;
> Pablo de Lara <pablo.de.lara.guarch at intel.com>; Radu Nicolau
> <radu.nicolau at intel.com>; Akhil Goyal <akhil.goyal at nxp.com>; Tomasz
> Kantecki <tomasz.kantecki at intel.com>
> Cc: dev at dpdk.org; Igor Romanov <igor.romanov at oktetlabs.ru>
> Subject: [PATCH 14/18] examples/flow_filtering: check status of getting link
> info
> 
> From: Igor Romanov <igor.romanov at oktetlabs.ru>
> 
> The return value of rte_eth_link_get() and rte_eth_link_get_nowait()
> was changed from void to int. Update the usage of the functions
> according to the new return type.
> 
> Signed-off-by: Igor Romanov <igor.romanov at oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
> ---
>  examples/flow_filtering/main.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c
> index c40cfd098..cc9e7e780 100644
> --- a/examples/flow_filtering/main.c
> +++ b/examples/flow_filtering/main.c
> @@ -100,15 +100,19 @@ assert_link_status(void)
>  {
>  	struct rte_eth_link link;
>  	uint8_t rep_cnt = MAX_REPEAT_TIMES;
> +	int link_get_err = -EINVAL;
> 
>  	memset(&link, 0, sizeof(link));
>  	do {
> -		rte_eth_link_get(port_id, &link);
> -		if (link.link_status == ETH_LINK_UP)
> +		link_get_err = rte_eth_link_get(port_id, &link);
> +		if (link_get_err == 0 && link.link_status == ETH_LINK_UP)
>  			break;
>  		rte_delay_ms(CHECK_INTERVAL);
>  	} while (--rep_cnt);
> 
> +	if (link_get_err < 0)
> +		rte_exit(EXIT_FAILURE, ":: error: link get is failing: %s\n",
> +			 rte_strerror(-link_get_err));
>  	if (link.link_status == ETH_LINK_DOWN)
>  		rte_exit(EXIT_FAILURE, ":: error: link is still down\n");
>  }
> --
> 2.17.1

Acked-by: Ori Kam <orika at mellanox.com>
Thanks,
Ori Kam




More information about the dev mailing list