From patchwork Wed Jun 29 08:34:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 113546 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 25A55A0545; Wed, 29 Jun 2022 10:35:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19F2942B76; Wed, 29 Jun 2022 10:35:30 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 7CED342905 for ; Wed, 29 Jun 2022 10:35:26 +0200 (CEST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LXvqS40PdzhYwH; Wed, 29 Jun 2022 16:33:08 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:18 +0800 Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:18 +0800 From: Huisong Li To: , , , CC: , , , , Subject: [PATCH V6 1/8] app/testpmd: fix supported RSS offload display Date: Wed, 29 Jun 2022 16:34:44 +0800 Message-ID: <20220629083451.21954-2-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220629083451.21954-1-lihuisong@huawei.com> References: <20220429102445.23711-1-lihuisong@huawei.com> <20220629083451.21954-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600004.china.huawei.com (7.193.23.242) 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 The rte_eth_dev_info.flow_type_rss_offloads is populated in terms of RTE_ETH_RSS_* bits. If PMD sets RTE_ETH_RSS_L3_SRC_ONLY to dev_info->flow_type_rss_offloads. testpmd will display "user defined 63" when run 'show port info 0'. Because testpmd use flowtype_to_str() to display the supported RSS offload of PMD. In fact, the function is used to display flow type in FDIR commands for i40e or ixgbe. This patch uses the RTE_ETH_RSS_* bits to display supported RSS offload of PMD. Fixes: b12964f621dc ("ethdev: unification of RSS offload types") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Ferruh Yigit --- app/test-pmd/config.c | 40 ++++++++++++++++++++++++++-------------- app/test-pmd/testpmd.h | 2 ++ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 62833fe97c..a1183ad18e 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -66,8 +66,6 @@ #define NS_PER_SEC 1E9 -static char *flowtype_to_str(uint16_t flow_type); - static const struct { enum tx_pkt_split split; const char *name; @@ -675,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities) } } +const char * +rsstypes_to_str(uint64_t rss_type) +{ + uint16_t i; + + for (i = 0; rss_type_table[i].str != NULL; i++) { + if (rss_type_table[i].rss_type == rss_type) + return rss_type_table[i].str; + } + + return NULL; +} + void port_infos_display(portid_t port_id) { @@ -779,19 +790,20 @@ port_infos_display(portid_t port_id) if (!dev_info.flow_type_rss_offloads) printf("No RSS offload flow type is supported.\n"); else { + uint64_t rss_offload_types = dev_info.flow_type_rss_offloads; uint16_t i; - char *p; printf("Supported RSS offload flow types:\n"); - for (i = RTE_ETH_FLOW_UNKNOWN + 1; - i < sizeof(dev_info.flow_type_rss_offloads) * CHAR_BIT; i++) { - if (!(dev_info.flow_type_rss_offloads & (1ULL << i))) - continue; - p = flowtype_to_str(i); - if (p) - printf(" %s\n", p); - else - printf(" user defined %d\n", i); + for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) { + uint64_t rss_offload = RTE_BIT64(i); + if ((rss_offload_types & rss_offload) != 0) { + const char *p = rsstypes_to_str(rss_offload); + if (p) + printf(" %s\n", p); + else + printf(" user defined %u\n", + i); + } } } @@ -5604,6 +5616,8 @@ set_record_burst_stats(uint8_t on_off) record_burst_stats = on_off; } +#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE) + static char* flowtype_to_str(uint16_t flow_type) { @@ -5647,8 +5661,6 @@ flowtype_to_str(uint16_t flow_type) return NULL; } -#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE) - static inline void print_fdir_mask(struct rte_eth_fdir_masks *mask) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index eeefb5e70f..195488b602 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1199,6 +1199,8 @@ extern int flow_parse(const char *src, void *result, unsigned int size, struct rte_flow_item **pattern, struct rte_flow_action **actions); +const char *rsstypes_to_str(uint64_t rss_type); + /* For registering driver specific testpmd commands. */ struct testpmd_driver_commands { TAILQ_ENTRY(testpmd_driver_commands) next; From patchwork Wed Jun 29 08:34:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 113547 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 72A71A0545; Wed, 29 Jun 2022 10:35:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 06C5142B79; Wed, 29 Jun 2022 10:35:31 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 6807B42836 for ; Wed, 29 Jun 2022 10:35:26 +0200 (CEST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LXvqS4DnYzhYwM; Wed, 29 Jun 2022 16:33:08 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:19 +0800 Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:18 +0800 From: Huisong Li To: , , , CC: , , , , Subject: [PATCH V6 2/8] app/testpmd: unify the name of L2 payload offload Date: Wed, 29 Jun 2022 16:34:45 +0800 Message-ID: <20220629083451.21954-3-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220629083451.21954-1-lihuisong@huawei.com> References: <20220429102445.23711-1-lihuisong@huawei.com> <20220629083451.21954-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600004.china.huawei.com (7.193.23.242) 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 Currently, the "port config all rss xx" command uses 'ether' name to match and to set 'RTE_ETH_RSS_L2_PAYLOAD' offload. However, others RSS command, such as, "port config rss-hash-key" and "show port rss-hash key", use 'l2-payload' to represent this offload. So this patch unifies the name of 'RTE_ETH_RSS_L2_PAYLOAD' offload. Signed-off-by: Huisong Li --- app/test-pmd/cmdline.c | 6 +++--- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index ded7dfe656..0123f4a4e5 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -694,7 +694,7 @@ static void cmd_help_long_parsed(void *parsed_result, "receive buffers available.\n\n" "port config all rss (all|default|ip|tcp|udp|sctp|" - "ether|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|" + "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|" "none|level-default|level-outer|level-inner|)\n" " Set the RSS mode.\n\n" @@ -2080,7 +2080,7 @@ cmd_config_rss_parsed(void *parsed_result, rss_conf.rss_hf = RTE_ETH_RSS_TCP; else if (!strcmp(res->value, "sctp")) rss_conf.rss_hf = RTE_ETH_RSS_SCTP; - else if (!strcmp(res->value, "ether")) + else if (!strcmp(res->value, "l2_payload")) rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD; else if (!strcmp(res->value, "port")) rss_conf.rss_hf = RTE_ETH_RSS_PORT; @@ -2203,7 +2203,7 @@ static cmdline_parse_inst_t cmd_config_rss = { .f = cmd_config_rss_parsed, .data = NULL, .help_str = "port config all rss " - "all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|" + "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|" "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|" "none|level-default|level-outer|level-inner|", .tokens = { diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index f716ea2797..9a79ffd03b 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2144,7 +2144,7 @@ port config - RSS Set the RSS (Receive Side Scaling) mode on or off:: - testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none) + testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none) RSS is on by default. From patchwork Wed Jun 29 08:34:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 113541 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 514B5A0545; Wed, 29 Jun 2022 10:35:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6FCC3400D7; Wed, 29 Jun 2022 10:35:24 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 49A8340042 for ; Wed, 29 Jun 2022 10:35:21 +0200 (CEST) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LXvqr28zWzkWfm; Wed, 29 Jun 2022 16:33:28 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:19 +0800 Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:18 +0800 From: Huisong Li To: , , , CC: , , , , Subject: [PATCH V6 3/8] doc: testpmd rename RSS type ether to L2 payload Date: Wed, 29 Jun 2022 16:34:46 +0800 Message-ID: <20220629083451.21954-4-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220629083451.21954-1-lihuisong@huawei.com> References: <20220429102445.23711-1-lihuisong@huawei.com> <20220629083451.21954-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600004.china.huawei.com (7.193.23.242) 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 Rename RSS type 'ether' to 'l2-payload' for "port config all rss xx" command. Signed-off-by: Huisong Li --- doc/guides/rel_notes/release_22_07.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst index 6365800313..032290f05e 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -261,6 +261,10 @@ New Features Merged l3fwd-acl code into l3fwd as l3fwd-acl contains duplicate and common functions to l3fwd. +* **Testpmd RSS type 'ether' renamed to 'l2-payload'.** + + Rename RSS type 'ether' to 'l2-payload' for "port config all rss xx" + command. Removed Items ------------- From patchwork Wed Jun 29 08:34:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 113542 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 67657A0545; Wed, 29 Jun 2022 10:35:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D8934280E; Wed, 29 Jun 2022 10:35:25 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 7AB84400D7 for ; Wed, 29 Jun 2022 10:35:21 +0200 (CEST) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LXvqM1qlHzhYsl; Wed, 29 Jun 2022 16:33:03 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:19 +0800 Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:19 +0800 From: Huisong Li To: , , , CC: , , , , Subject: [PATCH V6 4/8] app/testpmd: refactor config all RSS command Date: Wed, 29 Jun 2022 16:34:47 +0800 Message-ID: <20220629083451.21954-5-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220629083451.21954-1-lihuisong@huawei.com> References: <20220429102445.23711-1-lihuisong@huawei.com> <20220629083451.21954-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600004.china.huawei.com (7.193.23.242) 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 The "port config rss-hash-key" and "show port rss-hash key" commands both use the 'rss_type_table[]' to get 'rss_types' or the RSS type name. So this patch uses the 'rss_type_table[]' to get the rss types. In this way, this command naturally supports more individual types. Suggested-by: Ferruh Yigit Signed-off-by: Huisong Li --- app/test-pmd/cmdline.c | 122 ++++++-------------- app/test-pmd/config.c | 20 +++- app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +- 4 files changed, 58 insertions(+), 96 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 0123f4a4e5..b4fe9dfb17 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -693,9 +693,14 @@ static void cmd_help_long_parsed(void *parsed_result, " Enable or disable packet drop on all RX queues of all ports when no " "receive buffers available.\n\n" - "port config all rss (all|default|ip|tcp|udp|sctp|" - "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|" - "none|level-default|level-outer|level-inner|)\n" + "port config all rss (all|default|level-default|level-outer|level-inner|" + "ip|tcp|udp|sctp|tunnel|vlan|none|" + "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|" + "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|" + "l2-payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|" + "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|" + "l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|" + "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|)\n" " Set the RSS mode.\n\n" "port config port-id rss reta (hash,queue)[,(hash,queue)]\n" @@ -2062,81 +2067,7 @@ cmd_config_rss_parsed(void *parsed_result, uint16_t i; int ret; - if (!strcmp(res->value, "all")) - rss_conf.rss_hf = 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_L2TPV2; - else if (!strcmp(res->value, "eth")) - rss_conf.rss_hf = RTE_ETH_RSS_ETH; - else if (!strcmp(res->value, "vlan")) - rss_conf.rss_hf = RTE_ETH_RSS_VLAN; - else if (!strcmp(res->value, "ip")) - rss_conf.rss_hf = RTE_ETH_RSS_IP; - else if (!strcmp(res->value, "udp")) - rss_conf.rss_hf = RTE_ETH_RSS_UDP; - else if (!strcmp(res->value, "tcp")) - rss_conf.rss_hf = RTE_ETH_RSS_TCP; - else if (!strcmp(res->value, "sctp")) - rss_conf.rss_hf = RTE_ETH_RSS_SCTP; - else if (!strcmp(res->value, "l2_payload")) - rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD; - else if (!strcmp(res->value, "port")) - rss_conf.rss_hf = RTE_ETH_RSS_PORT; - else if (!strcmp(res->value, "vxlan")) - rss_conf.rss_hf = RTE_ETH_RSS_VXLAN; - else if (!strcmp(res->value, "geneve")) - rss_conf.rss_hf = RTE_ETH_RSS_GENEVE; - else if (!strcmp(res->value, "nvgre")) - rss_conf.rss_hf = RTE_ETH_RSS_NVGRE; - else if (!strcmp(res->value, "l3-pre32")) - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE32; - else if (!strcmp(res->value, "l3-pre40")) - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE40; - else if (!strcmp(res->value, "l3-pre48")) - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE48; - else if (!strcmp(res->value, "l3-pre56")) - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE56; - else if (!strcmp(res->value, "l3-pre64")) - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE64; - else if (!strcmp(res->value, "l3-pre96")) - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE96; - else if (!strcmp(res->value, "l3-src-only")) - rss_conf.rss_hf = RTE_ETH_RSS_L3_SRC_ONLY; - else if (!strcmp(res->value, "l3-dst-only")) - rss_conf.rss_hf = RTE_ETH_RSS_L3_DST_ONLY; - else if (!strcmp(res->value, "l4-src-only")) - rss_conf.rss_hf = RTE_ETH_RSS_L4_SRC_ONLY; - else if (!strcmp(res->value, "l4-dst-only")) - rss_conf.rss_hf = RTE_ETH_RSS_L4_DST_ONLY; - else if (!strcmp(res->value, "l2-src-only")) - rss_conf.rss_hf = RTE_ETH_RSS_L2_SRC_ONLY; - else if (!strcmp(res->value, "l2-dst-only")) - rss_conf.rss_hf = RTE_ETH_RSS_L2_DST_ONLY; - else if (!strcmp(res->value, "l2tpv3")) - rss_conf.rss_hf = RTE_ETH_RSS_L2TPV3; - else if (!strcmp(res->value, "esp")) - rss_conf.rss_hf = RTE_ETH_RSS_ESP; - else if (!strcmp(res->value, "ah")) - rss_conf.rss_hf = RTE_ETH_RSS_AH; - else if (!strcmp(res->value, "pfcp")) - rss_conf.rss_hf = RTE_ETH_RSS_PFCP; - else if (!strcmp(res->value, "pppoe")) - rss_conf.rss_hf = RTE_ETH_RSS_PPPOE; - else if (!strcmp(res->value, "gtpu")) - rss_conf.rss_hf = RTE_ETH_RSS_GTPU; - else if (!strcmp(res->value, "ecpri")) - rss_conf.rss_hf = RTE_ETH_RSS_ECPRI; - else if (!strcmp(res->value, "mpls")) - rss_conf.rss_hf = RTE_ETH_RSS_MPLS; - else if (!strcmp(res->value, "ipv4-chksum")) - rss_conf.rss_hf = RTE_ETH_RSS_IPV4_CHKSUM; - else if (!strcmp(res->value, "l2tpv2")) - rss_conf.rss_hf = RTE_ETH_RSS_L2TPV2; - else if (!strcmp(res->value, "none")) - rss_conf.rss_hf = 0; - else if (!strcmp(res->value, "level-default")) { + if (!strcmp(res->value, "level-default")) { rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK); rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_PMD_DEFAULT); } else if (!strcmp(res->value, "level-outer")) { @@ -2145,14 +2076,24 @@ cmd_config_rss_parsed(void *parsed_result, } else if (!strcmp(res->value, "level-inner")) { rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK); rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_INNERMOST); - } else if (!strcmp(res->value, "default")) + } else if (!strcmp(res->value, "default")) { use_default = 1; - else if (isdigit(res->value[0]) && atoi(res->value) > 0 && - atoi(res->value) < 64) - rss_conf.rss_hf = 1ULL << atoi(res->value); - else { - fprintf(stderr, "Unknown parameter\n"); - return; + } else if (isdigit(res->value[0])) { + int value = atoi(res->value); + if (value > 0 && value < 64) + rss_conf.rss_hf = 1ULL << (uint8_t)value; + else { + fprintf(stderr, "flowtype_id should be greater than 0 and less than 64.\n"); + return; + } + } else if (!strcmp(res->value, "none")) { + rss_conf.rss_hf = 0; + } else { + rss_conf.rss_hf = str_to_rsstypes(res->value); + if (rss_conf.rss_hf == 0) { + fprintf(stderr, "Unknown parameter\n"); + return; + } } rss_conf.rss_key = NULL; /* Update global configuration for RSS types. */ @@ -2203,9 +2144,14 @@ static cmdline_parse_inst_t cmd_config_rss = { .f = cmd_config_rss_parsed, .data = NULL, .help_str = "port config all rss " - "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|" - "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|" - "none|level-default|level-outer|level-inner|", + "all|default|level-default|level-outer|level-inner|" + "ip|tcp|udp|sctp|tunnel|vlan|none|" + "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|" + "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|" + "l2-payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|" + "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|" + "l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|" + "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|", .tokens = { (void *)&cmd_config_rss_port, (void *)&cmd_config_rss_keyword, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index a1183ad18e..a8fd84439d 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -673,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities) } } +uint64_t +str_to_rsstypes(const char *str) +{ + uint16_t i; + + for (i = 0; rss_type_table[i].str != NULL; i++) { + if (strcmp(rss_type_table[i].str, str) == 0) + return rss_type_table[i].rss_type; + } + + return 0; +} + const char * rsstypes_to_str(uint64_t rss_type) { @@ -3856,15 +3869,10 @@ port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key, { struct rte_eth_rss_conf rss_conf; int diag; - unsigned int i; rss_conf.rss_key = NULL; rss_conf.rss_key_len = 0; - rss_conf.rss_hf = 0; - for (i = 0; rss_type_table[i].str; i++) { - if (!strcmp(rss_type_table[i].str, rss_type)) - rss_conf.rss_hf = rss_type_table[i].rss_type; - } + rss_conf.rss_hf = str_to_rsstypes(rss_type); diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf); if (diag == 0) { rss_conf.rss_key = hash_key; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 195488b602..2e2987eb66 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1199,6 +1199,7 @@ extern int flow_parse(const char *src, void *result, unsigned int size, struct rte_flow_item **pattern, struct rte_flow_action **actions); +uint64_t str_to_rsstypes(const char *str); const char *rsstypes_to_str(uint64_t rss_type); /* For registering driver specific testpmd commands. */ diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 9a79ffd03b..b0bb912455 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2143,8 +2143,15 @@ port config - RSS ~~~~~~~~~~~~~~~~~ Set the RSS (Receive Side Scaling) mode on or off:: - - testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none) + testpmd> port config all rss (all|default|level-default|level-outer|level-inner| \ + ip|tcp|udp|sctp|tunnel|vlan|none| \ + ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other| \ + ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \ + ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex| \ + l2-payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan| \ + esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum| \ + l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32| \ + l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|) RSS is on by default. From patchwork Wed Jun 29 08:34:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 113548 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8614FA0545; Wed, 29 Jun 2022 10:36:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D0FC542B80; Wed, 29 Jun 2022 10:35:31 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id E2E5A42B6C for ; Wed, 29 Jun 2022 10:35:26 +0200 (CEST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LXvqS56DkzhYwp; Wed, 29 Jun 2022 16:33:08 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:20 +0800 Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:19 +0800 From: Huisong Li To: , , , CC: , , , , Subject: [PATCH V6 5/8] app/testpmd: unify RSS types display Date: Wed, 29 Jun 2022 16:34:48 +0800 Message-ID: <20220629083451.21954-6-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220629083451.21954-1-lihuisong@huawei.com> References: <20220429102445.23711-1-lihuisong@huawei.com> <20220629083451.21954-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600004.china.huawei.com (7.193.23.242) 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 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; From patchwork Wed Jun 29 08:34:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 113543 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2F15BA0545; Wed, 29 Jun 2022 10:35:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 630954282F; Wed, 29 Jun 2022 10:35:26 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id D250540042 for ; Wed, 29 Jun 2022 10:35:21 +0200 (CEST) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LXvqN0BRyzhYqM; Wed, 29 Jun 2022 16:33:04 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:20 +0800 Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:20 +0800 From: Huisong Li To: , , , CC: , , , , Subject: [PATCH V6 6/8] app/testpmd: compact RSS types output in some commands Date: Wed, 29 Jun 2022 16:34:49 +0800 Message-ID: <20220629083451.21954-7-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220629083451.21954-1-lihuisong@huawei.com> References: <20220429102445.23711-1-lihuisong@huawei.com> <20220629083451.21954-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600004.china.huawei.com (7.193.23.242) 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 From: Ferruh Yigit In port info command output, 'show port info all', supported RSS offload types printed one type per line, and although this information is not most important part of the command it takes big part of the command output. In port RSS hash and flow RSS command output, 'show port 0 rss-hash', and 'flow query 0 0 rss', all enabled RSS types are printed on one line. If there are many types, the print will be very long. Compacting these RSS offloads and types output by fixing the length of the character string printed on each line, instead of one per line or one line. Output becomes as following: Supported RSS offload flow types: ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other l4-dst-only l4-src-only l3-dst-only l3-src-only Signed-off-by: Ferruh Yigit Signed-off-by: Huisong Li --- app/test-pmd/config.c | 68 +++++++++++++++++++++++++++++++----------- app/test-pmd/testpmd.h | 2 ++ 2 files changed, 52 insertions(+), 18 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 823699c72c..ca13d21cdd 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -699,6 +699,38 @@ rsstypes_to_str(uint64_t rss_type) return NULL; } +static void +rss_offload_types_display(uint64_t offload_types, uint16_t char_num_per_line) +{ + uint16_t user_defined_str_len; + uint16_t total_len = 0; + uint16_t str_len = 0; + uint64_t rss_offload; + uint16_t i; + + for (i = 0; i < sizeof(offload_types) * CHAR_BIT; i++) { + rss_offload = RTE_BIT64(i); + if ((offload_types & rss_offload) != 0) { + const char *p = rsstypes_to_str(rss_offload); + + user_defined_str_len = + strlen("user-defined-") + (i / 10 + 1); + str_len = p ? strlen(p) : user_defined_str_len; + str_len += 2; /* add two spaces */ + if (total_len + str_len >= char_num_per_line) { + total_len = 0; + printf("\n"); + } + + if (p) + printf(" %s", p); + else + printf(" user-defined-%u", i); + total_len += str_len; + } + } +} + void port_infos_display(portid_t port_id) { @@ -803,21 +835,10 @@ port_infos_display(portid_t port_id) if (!dev_info.flow_type_rss_offloads) printf("No RSS offload flow type is supported.\n"); else { - uint64_t rss_offload_types = dev_info.flow_type_rss_offloads; - uint16_t i; - printf("Supported RSS offload flow types:\n"); - for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) { - uint64_t rss_offload = RTE_BIT64(i); - if ((rss_offload_types & rss_offload) != 0) { - const char *p = rsstypes_to_str(rss_offload); - if (p) - printf(" %s\n", p); - else - printf(" user defined %u\n", - i); - } - } + rss_offload_types_display(dev_info.flow_type_rss_offloads, + TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE); + printf("\n"); } printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize); @@ -1570,8 +1591,10 @@ port_flow_complain(struct rte_flow_error *error) } static void -rss_types_display(uint64_t rss_types) +rss_types_display(uint64_t rss_types, uint16_t char_num_per_line) { + uint16_t total_len = 0; + uint16_t str_len; uint16_t i; if (rss_types == 0) @@ -1580,9 +1603,18 @@ rss_types_display(uint64_t rss_types) 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) + rss_type_table[i].rss_type) { + /* Contain two spaces */ + str_len = strlen(rss_type_table[i].str) + 2; + if (total_len + str_len > char_num_per_line) { + printf("\n"); + total_len = 0; + } printf(" %s", rss_type_table[i].str); + total_len += str_len; + } } } @@ -1628,7 +1660,7 @@ rss_config_display(struct rte_flow_action_rss *rss_conf) printf(" none\n"); return; } - rss_types_display(rss_conf->types); + rss_types_display(rss_conf->types, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE); } static struct port_indirect_action * @@ -3859,7 +3891,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key) return; } printf("RSS functions:\n"); - rss_types_display(rss_hf); + rss_types_display(rss_hf, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE); printf("\n"); if (!show_rss_key) return; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 2e2987eb66..9cc5752f62 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -113,6 +113,8 @@ struct pkt_burst_stats { unsigned int pkt_burst_spread[MAX_PKT_BURST + 1]; }; + +#define TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE 64 /** Information for a given RSS type. */ struct rss_type_info { const char *str; /**< Type name. */ From patchwork Wed Jun 29 08:34:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 113544 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 69668A0545; Wed, 29 Jun 2022 10:35:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4F8BC42905; Wed, 29 Jun 2022 10:35:27 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 4479541138 for ; Wed, 29 Jun 2022 10:35:22 +0200 (CEST) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LXvrT0t55zkWf9; Wed, 29 Jun 2022 16:34:01 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:20 +0800 Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:20 +0800 From: Huisong Li To: , , , CC: , , , , Subject: [PATCH V6 7/8] app/testpmd: reorder elements in RSS type table array Date: Wed, 29 Jun 2022 16:34:50 +0800 Message-ID: <20220629083451.21954-8-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220629083451.21954-1-lihuisong@huawei.com> References: <20220429102445.23711-1-lihuisong@huawei.com> <20220629083451.21954-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600004.china.huawei.com (7.193.23.242) 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 There are group and individual types in rss_type_table[]. However, group types are very scattered, and individual types are not arranged based on the bit number order in 'RTE_ETH_RSS_xxx'. For a clear distribution of types and better maintenance, this patch reorders this table. Signed-off-by: Huisong Li --- app/test-pmd/config.c | 47 +++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ca13d21cdd..7be9a495d9 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -85,17 +85,20 @@ static const struct { }; 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 }, - { "eth", RTE_ETH_RSS_ETH }, - { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY }, - { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY }, + { "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 }, - { "s-vlan", RTE_ETH_RSS_S_VLAN }, - { "c-vlan", RTE_ETH_RSS_C_VLAN }, + + /* Individual type */ { "ipv4", RTE_ETH_RSS_IPV4 }, { "ipv4-frag", RTE_ETH_RSS_FRAG_IPV4 }, { "ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP }, @@ -116,33 +119,33 @@ const struct rss_type_info rss_type_table[] = { { "vxlan", RTE_ETH_RSS_VXLAN }, { "geneve", RTE_ETH_RSS_GENEVE }, { "nvgre", RTE_ETH_RSS_NVGRE }, - { "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 }, - { "l3-pre32", RTE_ETH_RSS_L3_PRE32 }, - { "l3-pre40", RTE_ETH_RSS_L3_PRE40 }, - { "l3-pre48", RTE_ETH_RSS_L3_PRE48 }, - { "l3-pre56", RTE_ETH_RSS_L3_PRE56 }, - { "l3-pre64", RTE_ETH_RSS_L3_PRE64 }, - { "l3-pre96", RTE_ETH_RSS_L3_PRE96 }, - { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY }, - { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY }, - { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY }, - { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY }, + { "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 }, - { "gtpu", RTE_ETH_RSS_GTPU }, { "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 }, - { NULL, 0 }, + { "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}, }; static const struct { From patchwork Wed Jun 29 08:34:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 113545 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 97DA1A0545; Wed, 29 Jun 2022 10:35:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 31BBD42B71; Wed, 29 Jun 2022 10:35:29 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 9381840042 for ; Wed, 29 Jun 2022 10:35:23 +0200 (CEST) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LXvqN6w7Kz1L8g5; Wed, 29 Jun 2022 16:33:04 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:21 +0800 Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 16:35:20 +0800 From: Huisong Li To: , , , CC: , , , , Subject: [PATCH V6 8/8] app/testpmd: remove duplicated flow type to string table Date: Wed, 29 Jun 2022 16:34:51 +0800 Message-ID: <20220629083451.21954-9-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220629083451.21954-1-lihuisong@huawei.com> References: <20220429102445.23711-1-lihuisong@huawei.com> <20220629083451.21954-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600004.china.huawei.com (7.193.23.242) 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 From: Ferruh Yigit Flow type table has two instance, one is used for flow type to string conversion, and other is used for string to flow type conversion. And tables are diverged by time. Unifying tables to prevent maintaining two different tables. Note: made 'flowtype_to_str()' and 'str_to_flowtype()' non-static to prevent build error for the case PMDs using it disables. Making the two functions generic, not for some PMDs. Signed-off-by: Ferruh Yigit Signed-off-by: Huisong Li --- app/test-pmd/config.c | 86 ++++++++++++++++++++------------- app/test-pmd/testpmd.h | 3 ++ drivers/net/i40e/i40e_testpmd.c | 41 +--------------- 3 files changed, 56 insertions(+), 74 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 7be9a495d9..388466f9ff 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -170,6 +170,35 @@ static const struct { }, }; +const struct { + char str[32]; + uint16_t ftype; +} flowtype_str_table[] = { + {"raw", RTE_ETH_FLOW_RAW}, + {"ipv4", RTE_ETH_FLOW_IPV4}, + {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4}, + {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP}, + {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP}, + {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP}, + {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER}, + {"ipv6", RTE_ETH_FLOW_IPV6}, + {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6}, + {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP}, + {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP}, + {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP}, + {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER}, + {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD}, + {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX}, + {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX}, + {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX}, + {"port", RTE_ETH_FLOW_PORT}, + {"vxlan", RTE_ETH_FLOW_VXLAN}, + {"geneve", RTE_ETH_FLOW_GENEVE}, + {"nvgre", RTE_ETH_FLOW_NVGRE}, + {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE}, + {"gtpu", RTE_ETH_FLOW_GTPU}, +}; + static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { @@ -5665,42 +5694,29 @@ set_record_burst_stats(uint8_t on_off) record_burst_stats = on_off; } -#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE) +uint16_t +str_to_flowtype(const char *string) +{ + uint8_t i; -static char* + for (i = 0; i < RTE_DIM(flowtype_str_table); i++) { + if (!strcmp(flowtype_str_table[i].str, string)) + return flowtype_str_table[i].ftype; + } + + if (isdigit(string[0])) { + int val = atoi(string); + if (val > 0 && val < 64) + return (uint16_t)val; + } + + return RTE_ETH_FLOW_UNKNOWN; +} + +const char* flowtype_to_str(uint16_t flow_type) { - struct flow_type_info { - char str[32]; - uint16_t ftype; - }; - uint8_t i; - static struct flow_type_info flowtype_str_table[] = { - {"raw", RTE_ETH_FLOW_RAW}, - {"ipv4", RTE_ETH_FLOW_IPV4}, - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4}, - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP}, - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP}, - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP}, - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER}, - {"ipv6", RTE_ETH_FLOW_IPV6}, - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6}, - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP}, - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP}, - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP}, - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER}, - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD}, - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX}, - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX}, - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX}, - {"port", RTE_ETH_FLOW_PORT}, - {"vxlan", RTE_ETH_FLOW_VXLAN}, - {"geneve", RTE_ETH_FLOW_GENEVE}, - {"nvgre", RTE_ETH_FLOW_NVGRE}, - {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE}, - {"gtpu", RTE_ETH_FLOW_GTPU}, - }; for (i = 0; i < RTE_DIM(flowtype_str_table); i++) { if (flowtype_str_table[i].ftype == flow_type) @@ -5710,6 +5726,8 @@ flowtype_to_str(uint16_t flow_type) return NULL; } +#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE) + static inline void print_fdir_mask(struct rte_eth_fdir_masks *mask) { @@ -5774,7 +5792,7 @@ print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num) { struct rte_eth_fdir_flex_mask *mask; uint32_t i, j; - char *p; + const char *p; for (i = 0; i < flex_conf->nb_flexmasks; i++) { mask = &flex_conf->flex_mask[i]; @@ -5790,7 +5808,7 @@ static inline void print_fdir_flow_type(uint32_t flow_types_mask) { int i; - char *p; + const char *p; for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) { if (!(flow_types_mask & (1 << i))) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 9cc5752f62..fb2f5195d3 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1204,6 +1204,9 @@ extern int flow_parse(const char *src, void *result, unsigned int size, uint64_t str_to_rsstypes(const char *str); const char *rsstypes_to_str(uint64_t rss_type); +uint16_t str_to_flowtype(const char *string); +const char *flowtype_to_str(uint16_t flow_type); + /* For registering driver specific testpmd commands. */ struct testpmd_driver_commands { TAILQ_ENTRY(testpmd_driver_commands) next; diff --git a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c index 86159e5c1c..45f8da270d 100644 --- a/drivers/net/i40e/i40e_testpmd.c +++ b/drivers/net/i40e/i40e_testpmd.c @@ -461,45 +461,6 @@ static cmdline_parse_inst_t cmd_show_queue_region_info_all = { }, }; -static uint16_t -str2flowtype(char *string) -{ - uint8_t i = 0; - static const struct { - char str[32]; - uint16_t type; - } flowtype_str[] = { - {"raw", RTE_ETH_FLOW_RAW}, - {"ipv4", RTE_ETH_FLOW_IPV4}, - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4}, - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP}, - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP}, - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP}, - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER}, - {"ipv6", RTE_ETH_FLOW_IPV6}, - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6}, - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP}, - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP}, - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP}, - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER}, - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD}, - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX}, - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX}, - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX}, - {"gtpu", RTE_ETH_FLOW_GTPU}, - }; - - for (i = 0; i < RTE_DIM(flowtype_str); i++) { - if (!strcmp(flowtype_str[i].str, string)) - return flowtype_str[i].type; - } - - if (isdigit(string[0]) && atoi(string) > 0 && atoi(string) < 64) - return (uint16_t)atoi(string); - - return RTE_ETH_FLOW_UNKNOWN; -} - /* *** deal with flow director filter *** */ struct cmd_flow_director_result { cmdline_fixed_string_t flow_director_filter; @@ -527,7 +488,7 @@ cmd_flow_director_filter_parsed(void *parsed_result, struct rte_pmd_i40e_flow_type_mapping mapping[RTE_PMD_I40E_FLOW_TYPE_MAX]; struct rte_pmd_i40e_pkt_template_conf conf; - uint16_t flow_type = str2flowtype(res->flow_type); + uint16_t flow_type = str_to_flowtype(res->flow_type); uint16_t i, port = res->port_id; uint8_t add;