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 lihuisong@huawei.com Signed-off-by: Ferruh Yigit ferruh.yigit@xilinx.com --- 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 b08face76d..7b725fc7a1 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1554,6 +1554,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) { @@ -1596,13 +1613,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 * @@ -3054,13 +3065,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;