From 534988c490f1d50c935602e0ef83cc17a055feef Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Wed, 29 Jun 2022 16:34:48 +0800 Subject: [PATCH] app/testpmd: unify RSS types display The 'rss_type_table[]' maintains the name and value of RSS types. This patch unifies a common interface to display RSS types. Signed-off-by: Huisong Li Signed-off-by: Ferruh Yigit --- app/test-pmd/config.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index a8fd84439d..823699c72c 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1569,6 +1569,23 @@ port_flow_complain(struct rte_flow_error *error) return -err; } +static void +rss_types_display(uint64_t rss_types) +{ + uint16_t i; + + if (rss_types == 0) + return; + + for (i = 0; rss_type_table[i].str; i++) { + if (rss_type_table[i].rss_type == 0) + continue; + if ((rss_types & rss_type_table[i].rss_type) == + rss_type_table[i].rss_type) + printf(" %s", rss_type_table[i].str); + } +} + static void rss_config_display(struct rte_flow_action_rss *rss_conf) { @@ -1611,13 +1628,7 @@ rss_config_display(struct rte_flow_action_rss *rss_conf) printf(" none\n"); return; } - for (i = 0; rss_type_table[i].str; i++) { - if ((rss_conf->types & - rss_type_table[i].rss_type) == - rss_type_table[i].rss_type && - rss_type_table[i].rss_type != 0) - printf(" %s\n", rss_type_table[i].str); - } + rss_types_display(rss_conf->types); } static struct port_indirect_action * @@ -3847,13 +3858,8 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key) printf("RSS disabled\n"); return; } - printf("RSS functions:\n "); - for (i = 0; rss_type_table[i].str; i++) { - if (rss_type_table[i].rss_type == 0) - continue; - if ((rss_hf & rss_type_table[i].rss_type) == rss_type_table[i].rss_type) - printf("%s ", rss_type_table[i].str); - } + printf("RSS functions:\n"); + rss_types_display(rss_hf); printf("\n"); if (!show_rss_key) return; -- 2.39.5