From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0A73A42BF1; Mon, 5 Jun 2023 15:12:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C63084021F; Mon, 5 Jun 2023 15:12:51 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 912784003C; Mon, 5 Jun 2023 15:12:49 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QZYqC4jbKzLqVn; Mon, 5 Jun 2023 21:09:43 +0800 (CST) Received: from [10.67.103.235] (10.67.103.235) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 5 Jun 2023 21:12:44 +0800 Subject: Re: [PATCH 4/5] app/proc-info: show RSS types with strings To: Ferruh Yigit , , , , References: <20230315110033.30143-1-liudongdong3@huawei.com> <20230315110033.30143-5-liudongdong3@huawei.com> <915a41a6-936c-9e5c-67d7-f9864ba01863@amd.com> CC: , , Jie Hai , Maryam Tahhan From: Dongdong Liu Message-ID: Date: Mon, 5 Jun 2023 21:12:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <915a41a6-936c-9e5c-67d7-f9864ba01863@amd.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.103.235] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Ferruh On 2023/6/3 4:22, Ferruh Yigit wrote: > On 3/15/2023 11:00 AM, Dongdong Liu wrote: >> From: Jie Hai >> >> show RSS types details and adjust RSS info display format as following: >> >> - RSS info >> -- hf: >> ipv4 ipv4-frag ipv4-other ipv6 ipv6-frag ipv6-other >> -- key len: 40 >> -- key (hex): 6d5a56da255b0ec24167253d43a38fb0d0ca2bcbae7b30b477cb2da38030f20c6a42b73bbeac01fa >> >> Signed-off-by: Jie Hai >> Signed-off-by: Dongdong Liu >> --- >> app/proc-info/main.c | 120 ++++++++++++++++++++++++++++++++++++++++--- >> 1 file changed, 113 insertions(+), 7 deletions(-) >> >> diff --git a/app/proc-info/main.c b/app/proc-info/main.c >> index 878ce37e8b..7b6f8f1228 100644 >> --- a/app/proc-info/main.c >> +++ b/app/proc-info/main.c >> @@ -54,6 +54,9 @@ >> #define STATS_BDR_STR(w, s) printf("%.*s%s%.*s\n", w, \ >> STATS_BDR_FMT, s, w, STATS_BDR_FMT) >> >> +/* It is used to print the RSS types. */ >> +#define RSS_TYPES_CHAR_NUM_PER_LINE 64 >> + >> /* mask of enabled ports */ >> static unsigned long enabled_port_mask; >> /* Enable stats. */ >> @@ -132,6 +135,76 @@ struct desc_param { >> static struct desc_param rx_desc_param; >> static struct desc_param tx_desc_param; >> >> +/* Information for a given RSS type. */ >> +struct rss_type_info { >> + const char *str; /* Type name. */ >> + uint64_t rss_type; /* Type value. */ >> +}; >> + >> +static const struct rss_type_info rss_type_table[] = { >> + /* Group types */ >> + { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP | >> + RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD | >> + RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP | >> + RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS | RTE_ETH_RSS_L2TPV2}, >> + { "none", 0 }, >> + { "ip", RTE_ETH_RSS_IP }, >> + { "udp", RTE_ETH_RSS_UDP }, >> + { "tcp", RTE_ETH_RSS_TCP }, >> + { "sctp", RTE_ETH_RSS_SCTP }, >> + { "tunnel", RTE_ETH_RSS_TUNNEL }, >> + { "vlan", RTE_ETH_RSS_VLAN }, >> + >> + /* Individual type */ >> + { "ipv4", RTE_ETH_RSS_IPV4 }, >> + { "ipv4-frag", RTE_ETH_RSS_FRAG_IPV4 }, >> + { "ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP }, >> + { "ipv4-udp", RTE_ETH_RSS_NONFRAG_IPV4_UDP }, >> + { "ipv4-sctp", RTE_ETH_RSS_NONFRAG_IPV4_SCTP }, >> + { "ipv4-other", RTE_ETH_RSS_NONFRAG_IPV4_OTHER }, >> + { "ipv6", RTE_ETH_RSS_IPV6 }, >> + { "ipv6-frag", RTE_ETH_RSS_FRAG_IPV6 }, >> + { "ipv6-tcp", RTE_ETH_RSS_NONFRAG_IPV6_TCP }, >> + { "ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP }, >> + { "ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP }, >> + { "ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER }, >> + { "l2-payload", RTE_ETH_RSS_L2_PAYLOAD }, >> + { "ipv6-ex", RTE_ETH_RSS_IPV6_EX }, >> + { "ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX }, >> + { "ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX }, >> + { "port", RTE_ETH_RSS_PORT }, >> + { "vxlan", RTE_ETH_RSS_VXLAN }, >> + { "geneve", RTE_ETH_RSS_GENEVE }, >> + { "nvgre", RTE_ETH_RSS_NVGRE }, >> + { "gtpu", RTE_ETH_RSS_GTPU }, >> + { "eth", RTE_ETH_RSS_ETH }, >> + { "s-vlan", RTE_ETH_RSS_S_VLAN }, >> + { "c-vlan", RTE_ETH_RSS_C_VLAN }, >> + { "esp", RTE_ETH_RSS_ESP }, >> + { "ah", RTE_ETH_RSS_AH }, >> + { "l2tpv3", RTE_ETH_RSS_L2TPV3 }, >> + { "pfcp", RTE_ETH_RSS_PFCP }, >> + { "pppoe", RTE_ETH_RSS_PPPOE }, >> + { "ecpri", RTE_ETH_RSS_ECPRI }, >> + { "mpls", RTE_ETH_RSS_MPLS }, >> + { "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM }, >> + { "l4-chksum", RTE_ETH_RSS_L4_CHKSUM }, >> + { "l2tpv2", RTE_ETH_RSS_L2TPV2 }, >> + { "l3-pre96", RTE_ETH_RSS_L3_PRE96 }, >> + { "l3-pre64", RTE_ETH_RSS_L3_PRE64 }, >> + { "l3-pre56", RTE_ETH_RSS_L3_PRE56 }, >> + { "l3-pre48", RTE_ETH_RSS_L3_PRE48 }, >> + { "l3-pre40", RTE_ETH_RSS_L3_PRE40 }, >> + { "l3-pre32", RTE_ETH_RSS_L3_PRE32 }, >> + { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY }, >> + { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY }, >> + { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY }, >> + { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY }, >> + { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY }, >> + { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY }, >> + { NULL, 0}, >> +}; >> + > > Agree this makes output more user friendly, but this brings something to > maintain in the application, and I am almost sure that it will become > outdated by time as new RSS types added. That's true. > > One option is to add this as an API in the library, so it will be easier > to keep up to date, and use API from here. But not sure if it worths to > have new API for this? I will consider that. Thanks, Dongdong. > >> /* display usage */ >> static void >> proc_info_usage(const char *prgname) >> @@ -806,6 +879,33 @@ show_offloads(uint64_t offloads, >> } >> } >> >> +static void >> +show_rss_types(uint64_t rss_types) >> +{ >> + uint16_t total_len = 0; >> + uint16_t str_len; >> + uint16_t i; >> + >> + printf("\t\t"); >> + for (i = 0; rss_type_table[i].str != NULL; i++) { >> + if (rss_type_table[i].rss_type == 0) >> + continue; >> + >> + if ((rss_type_table[i].rss_type & rss_types) == >> + rss_type_table[i].rss_type) { >> + /* Contain two spaces */ >> + str_len = strlen(rss_type_table[i].str) + 2; >> + if (total_len + str_len > RSS_TYPES_CHAR_NUM_PER_LINE) { >> + printf("\n\t\t"); >> + total_len = 0; >> + } >> + printf("%s ", rss_type_table[i].str); >> + total_len += str_len; >> + } >> + } >> + printf("\n"); >> +} >> + >> static void >> show_port(void) >> { >> @@ -991,13 +1091,19 @@ show_port(void) >> rss_conf.rss_key_len = dev_info.hash_key_size; >> ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf); >> if (ret == 0) { >> - printf(" - RSS\n"); >> - printf("\t -- RSS len %u key (hex):", >> - rss_conf.rss_key_len); >> - for (k = 0; k < rss_conf.rss_key_len; k++) >> - printf(" %x", rss_conf.rss_key[k]); >> - printf("\t -- hf 0x%"PRIx64"\n", >> - rss_conf.rss_hf); >> + printf(" - RSS info\n"); >> + if (rss_conf.rss_hf == 0) { >> + printf("\tRSS disabled\n"); >> + } else { >> + printf("\t -- hf:\n"); >> + show_rss_types(rss_conf.rss_hf); >> + printf("\t -- key len: %u\n", >> + rss_conf.rss_key_len); >> + printf("\t -- key (hex): "); >> + for (k = 0; k < rss_conf.rss_key_len; k++) >> + printf("%02x", rss_conf.rss_key[k]); >> + printf("\n"); >> + } >> } >> >> rte_free(rss_key); > > . >