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 <haij...@huawei.com>
Acked-by: Huisong Li <lihuis...@huawei.com>
Acked-by: Chengwen Feng <fengcheng...@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".