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 8510A41EA0 for ; Wed, 15 Mar 2023 12:02:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC4E342D20; Wed, 15 Mar 2023 12:02:06 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 7715842D0C; Wed, 15 Mar 2023 12:02:04 +0100 (CET) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Pc6nz4PBfzSky1; Wed, 15 Mar 2023 18:58:47 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) 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.21; Wed, 15 Mar 2023 19:02:02 +0800 From: Dongdong Liu To: , , , , CC: , , , Jie Hai , Maryam Tahhan Subject: [PATCH 4/5] app/proc-info: show RSS types with strings Date: Wed, 15 Mar 2023 19:00:32 +0800 Message-ID: <20230315110033.30143-5-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230315110033.30143-1-liudongdong3@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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}, +}; + /* 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); -- 2.22.0