[PATCH v9 7/9] ethdev: add API to get RSS algorithm names

Andrew Rybchenko andrew.rybchenko at oktetlabs.ru
Mon Nov 6 11:43:20 CET 2023


On 11/2/23 11:20, Jie Hai wrote:
> This patch adds new API rte_eth_dev_rss_algo_name() to get
> name of a RSS algorithm and document it.
> 
> Signed-off-by: Jie Hai <haijie1 at huawei.com>
> Acked-by: Huisong Li <lihuisong at huawei.com>
> Acked-by: Chengwen Feng <fengchengwen at huawei.com>

<snip>

> @@ -4791,6 +4802,20 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
>   	return ret;
>   }
>   
> +const char *
> +rte_eth_dev_rss_algo_name(enum rte_eth_hash_function rss_algo)
> +{
> +	const char *name = "Unknown function";
> +	unsigned int i;
> +
> +	for (i = 0; i < RTE_DIM(rte_eth_dev_rss_algo_names); i++) {
> +		if (rss_algo == rte_eth_dev_rss_algo_names[i].algo)
> +			return rte_eth_dev_rss_algo_names[i].name;
> +	}
> +
> +	return name;

My 2c:

IMHO, usage of name variable here just complicate reading and forces
reader to find out which value 'name' has here. Just return
"Unknown function".



More information about the dev mailing list