[dpdk-dev] [PATCH 02/51] app/testpmd: check status of getting ethdev info

Ferruh Yigit ferruh.yigit at intel.com
Mon Sep 2 14:40:11 CEST 2019


On 8/27/2019 3:25 PM, Andrew Rybchenko wrote:
> From: Ivan Ilchenko <Ivan.Ilchenko at oktetlabs.ru>
> 
> Add eth_dev_info_get_print_err() which is a wrapper for
> rte_eth_dev_info_get() printing error if rte_eth_dev_info_get()
> fails and returning its status code.
> 
> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko at oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>

<...>

> @@ -2410,9 +2414,13 @@ struct cmd_config_rss_hash_key {
>  	struct rte_eth_dev_info dev_info;
>  	uint8_t hash_key_size;
>  	uint32_t key_len;
> +	int ret;
>  
>  	memset(&dev_info, 0, sizeof(dev_info));

It should be in different most probably, but the 'memset' before
'rte_eth_dev_info_get()' looks redundant, since API does the same.

<...>

> @@ -4746,7 +4780,8 @@ struct cmd_tunnel_tso_set_result {
>  {
>  	struct rte_eth_dev_info dev_info;
>  
> -	rte_eth_dev_info_get(port_id, &dev_info);
> +	eth_dev_info_get_print_err(port_id, &dev_info);

Should we check the return value here too? And return 'dev_info' immediately on
error instead of going on.

<...>

> @@ -1136,7 +1139,10 @@ struct extmem_param {
>  		/* Apply default TxRx configuration for all ports */
>  		port->dev_conf.txmode = tx_mode;
>  		port->dev_conf.rxmode = rx_mode;
> -		rte_eth_dev_info_get(pid, &port->dev_info);
> +
> +		ret = eth_dev_info_get_print_err(pid, &port->dev_info);
> +		if (ret != 0)
> +			return;

What do you think 'rte_exit()' here instead of 'return', 'init_config()' doesn't
return error, and returning from init will assume everyting setup, 0 number of
queues for any port eventually will cause an exit in the app, better to fail
where error occurs.


More information about the dev mailing list