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 645E5A0557; Thu, 26 May 2022 05:52:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 15B0140150; Thu, 26 May 2022 05:52:44 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id F030340146; Thu, 26 May 2022 05:52:41 +0200 (CEST) Received: from kwepemi100024.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4L7v822F9xzQkQc; Thu, 26 May 2022 11:49:38 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by kwepemi100024.china.huawei.com (7.221.188.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 26 May 2022 11:52:39 +0800 Received: from [10.67.103.231] (10.67.103.231) 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; Thu, 26 May 2022 11:52:38 +0800 Message-ID: <9a0b27e3-510d-6948-cf3e-a213c7929c85@huawei.com> Date: Thu, 26 May 2022 11:52:38 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH 1/3] app/testpmd: fix displaying RSS info To: Ferruh Yigit , Xiaoyun Li , Aman Singh , Yuying Zhang , Helin Zhang , Jingjing Wu , Thomas Monjalon CC: , Thomas Monjalon , Andrew Rybchenko , References: <20220525173736.3394787-1-ferruh.yigit@xilinx.com> From: "lihuisong (C)" In-Reply-To: <20220525173736.3394787-1-ferruh.yigit@xilinx.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.231] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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 Hi, Ferruh This patch is the same as the following patch: http://patches.dpdk.org/project/dpdk/patch/20220429102445.23711-2-lihuisong@huawei.com/ It was delegated to you.😂 在 2022/5/26 1:37, Ferruh Yigit 写道: > When supported RSS offload flow types are printed via 'show port info #' > command, flow names are get from flow type array which is wrong and > causing some RSS flow types not being displayed. > > Instead RSS flow type array should be used. Also helper functions added > and existing code updated to use helpers. > > Fixes: b12964f621dc ("ethdev: unification of RSS offload types") > Cc: stable@dpdk.org > > Signed-off-by: Ferruh Yigit > --- > Cc: helin.zhang@intel.com > > Note: > In ethdev, flow type macros 'RTE_ETH_FLOW_*' and RSS type macros > 'RTE_ETH_RSS_*' are related, buy they seems diverged a little, may need > to check that too. > --- > app/test-pmd/config.c | 92 ++++++++++++++++++++++++++++++------------- > 1 file changed, 64 insertions(+), 28 deletions(-) > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 72d2606d19d5..c353d224ef06 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -147,6 +147,32 @@ const struct rss_type_info rss_type_table[] = { > { NULL, 0 }, > }; > > +static const char * > +rsstype_to_str(uint64_t rss_type) > +{ > + int 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; > +} > + > +static uint64_t > +str_to_rsstype(const char *str) > +{ > + int i; > + > + for (i = 0; rss_type_table[i].str != NULL; i++) { > + if (!strcmp(rss_type_table[i].str, str)) > + return rss_type_table[i].rss_type; > + } > + > + return 0; > +} > + > static const struct { > enum rte_eth_fec_mode mode; > const char *name; > @@ -779,19 +805,21 @@ 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_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; rss_types != 0; i++) { > + if (rss_types & 1) { > + uint64_t rss_type = 1ULL << i; > + const char *p = rsstype_to_str(rss_type); > + > + if (p) > + printf(" %s\n", p); > + else > + printf(" user defined 0x%"PRIx64"\n", rss_type); > + } > + rss_types >>= 1; > } > } > > @@ -1547,6 +1575,7 @@ port_flow_complain(struct rte_flow_error *error) > static void > rss_config_display(struct rte_flow_action_rss *rss_conf) > { > + uint64_t rss_types; > uint8_t i; > > if (rss_conf == NULL) { > @@ -1582,16 +1611,23 @@ rss_config_display(struct rte_flow_action_rss *rss_conf) > } > > printf(" types:\n"); > - if (rss_conf->types == 0) { > + rss_types = rss_conf->types; > + if (rss_types == 0) { > 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); > + > + for (i = 0; rss_types != 0; i++) { > + if (rss_types & 1) { > + uint64_t rss_type = 1ULL << i; > + const char *p = rsstype_to_str(rss_type); > + > + if (p) > + printf(" %s\n", p); > + else > + printf(" user defined 0x%"PRIx64"\n", rss_type); > + } > + rss_types >>= 1; > } > } > > @@ -3823,11 +3859,16 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key) > 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); > + for (i = 0; rss_hf != 0; i++) { > + if (rss_hf & 1) { > + uint64_t rss_type = 1ULL << i; > + const char *p = rsstype_to_str(rss_type); > + if (p) > + printf("%s ", p); > + else > + printf("0x%"PRIx64" ", rss_type); > + } > + rss_hf >>= 1; > } > printf("\n"); > if (!show_rss_key) > @@ -3844,15 +3885,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_rsstype(rss_type); > diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf); > if (diag == 0) { > rss_conf.rss_key = hash_key;