From patchwork Sat Aug 26 07:46:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 130777 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 CC0D94310A; Sat, 26 Aug 2023 09:50:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4DEF8410DC; Sat, 26 Aug 2023 09:50:29 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id F1E0D40E6E for ; Sat, 26 Aug 2023 09:50:26 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RXpn96VyxzJrrF; Sat, 26 Aug 2023 15:47:09 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 26 Aug 2023 15:50:17 +0800 From: Jie Hai To: , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: , Subject: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm Date: Sat, 26 Aug 2023 15:46:03 +0800 Message-ID: <20230826074607.16771-2-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230826074607.16771-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20230826074607.16771-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500020.china.huawei.com (7.221.188.8) 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, rte_eth_rss_conf supports configuring and querying rss hash functions, rss key and it's length, but not rss hash algorithm. The structure ``rte_eth_rss_conf`` is extended by adding a new field "func". This represents the RSS algorithms to apply. The following API is affected: - rte_eth_dev_configure - rte_eth_dev_rss_hash_update - rte_eth_dev_rss_hash_conf_get If the value of "func" used for configuration is a gibberish value, report the error and return. Do the same for rte_eth_dev_rss_hash_update and rte_eth_dev_configure. To check whether the drivers report the "func" field, it is set to default value before querying. Signed-off-by: Jie Hai Signed-off-by: Dongdong Liu --- doc/guides/rel_notes/release_23_11.rst | 2 ++ lib/ethdev/rte_ethdev.c | 17 +++++++++++++++++ lib/ethdev/rte_ethdev.h | 6 ++++++ 3 files changed, 25 insertions(+) diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst index 4411bb32c195..3746436e8bc9 100644 --- a/doc/guides/rel_notes/release_23_11.rst +++ b/doc/guides/rel_notes/release_23_11.rst @@ -123,6 +123,8 @@ ABI Changes Also, make sure to start the actual text at the margin. ======================================================= + * ethdev: Added "func" field to ``rte_eth_rss_conf`` structure for RSS hash + algorithm. Known Issues ------------ diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 0840d2b5942a..4cbcdb344cac 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -1445,6 +1445,14 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, goto rollback; } + if (dev_conf->rx_adv_conf.rss_conf.func >= RTE_ETH_HASH_FUNCTION_MAX) { + RTE_ETHDEV_LOG(ERR, + "Ethdev port_id=%u invalid rss hash function (%u)\n", + port_id, dev_conf->rx_adv_conf.rss_conf.func); + ret = -EINVAL; + goto rollback; + } + /* Check if Rx RSS distribution is disabled but RSS hash is enabled. */ if (((dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) == 0) && (dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH)) { @@ -4630,6 +4638,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id, return -ENOTSUP; } + if (rss_conf->func >= RTE_ETH_HASH_FUNCTION_MAX) { + RTE_ETHDEV_LOG(ERR, + "Ethdev port_id=%u invalid rss hash function (%u)\n", + port_id, rss_conf->func); + return -EINVAL; + } + if (*dev->dev_ops->rss_hash_update == NULL) return -ENOTSUP; ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev, @@ -4657,6 +4672,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id, return -EINVAL; } + rss_conf->func = RTE_ETH_HASH_FUNCTION_DEFAULT; + if (*dev->dev_ops->rss_hash_conf_get == NULL) return -ENOTSUP; ret = eth_err(port_id, (*dev->dev_ops->rss_hash_conf_get)(dev, diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 04a2564f222a..1bb5f23059ca 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -174,6 +174,7 @@ extern "C" { #include "rte_ethdev_trace_fp.h" #include "rte_dev_info.h" +#include "rte_flow.h" extern int rte_eth_dev_logtype; @@ -461,11 +462,16 @@ struct rte_vlan_filter_conf { * The *rss_hf* field of the *rss_conf* structure indicates the different * types of IPv4/IPv6 packets to which the RSS hashing must be applied. * Supplying an *rss_hf* equal to zero disables the RSS feature. + * + * The *func* field of the *rss_conf* structure indicates the hash algorithm + * applied by the RSS hashing. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows + * the PMD to use its best-effort algorithm rather than a specific one. */ struct rte_eth_rss_conf { uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */ uint8_t rss_key_len; /**< hash key length in bytes. */ uint64_t rss_hf; /**< Hash functions to apply - see below. */ + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */ }; /* From patchwork Sat Aug 26 07:46:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 130781 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 7B7524310A; Sat, 26 Aug 2023 09:50:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A4ABF43262; Sat, 26 Aug 2023 09:50:34 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 2BAFE40E6E for ; Sat, 26 Aug 2023 09:50:29 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RXpmR14W7ztRfD for ; Sat, 26 Aug 2023 15:46:31 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 26 Aug 2023 15:50:18 +0800 From: Jie Hai To: , Dongdong Liu , Yisen Zhuang CC: Subject: [PATCH v2 2/5] net/hns3: support setting and querying RSS hash function Date: Sat, 26 Aug 2023 15:46:04 +0800 Message-ID: <20230826074607.16771-3-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230826074607.16771-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20230826074607.16771-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500020.china.huawei.com (7.221.188.8) 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: Huisong Li Support setting and querying RSS hash function by ethdev ops. Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_rss.c | 47 +++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index 6126512bd780..c8346d43d15c 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -646,14 +646,14 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, if (ret) goto set_tuple_fail; - if (key) { - ret = hns3_rss_set_algo_key(hw, hw->rss_info.hash_algo, - key, hw->rss_key_size); - if (ret) - goto set_algo_key_fail; - /* Update the shadow RSS key with user specified */ + ret = hns3_update_rss_algo_key(hw, rss_conf->func, key, key_len); + if (ret != 0) + goto set_algo_key_fail; + + if (rss_conf->func != RTE_ETH_HASH_FUNCTION_DEFAULT) + hw->rss_info.hash_algo = hns3_hash_func_map[rss_conf->func]; + if (key != NULL) memcpy(hw->rss_info.key, key, hw->rss_key_size); - } hw->rss_info.rss_hf = rss_hf; rte_spinlock_unlock(&hw->lock); @@ -769,7 +769,13 @@ int hns3_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) { + const uint8_t hash_func_map[] = { + [HNS3_RSS_HASH_ALGO_TOEPLITZ] = RTE_ETH_HASH_FUNCTION_TOEPLITZ, + [HNS3_RSS_HASH_ALGO_SIMPLE] = RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, + [HNS3_RSS_HASH_ALGO_SYMMETRIC_TOEP] = RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ, + }; struct hns3_adapter *hns = dev->data->dev_private; + uint8_t rss_key[HNS3_RSS_KEY_SIZE_MAX] = {0}; struct hns3_hw *hw = &hns->hw; uint8_t hash_algo; int ret; @@ -777,26 +783,27 @@ hns3_dev_rss_hash_conf_get(struct rte_eth_dev *dev, rte_spinlock_lock(&hw->lock); ret = hns3_rss_hash_get_rss_hf(hw, &rss_conf->rss_hf); if (ret != 0) { + rte_spinlock_unlock(&hw->lock); hns3_err(hw, "obtain hash tuples failed, ret = %d", ret); - goto out; + return ret; + } + + ret = hns3_rss_get_algo_key(hw, &hash_algo, rss_key, hw->rss_key_size); + if (ret != 0) { + rte_spinlock_unlock(&hw->lock); + hns3_err(hw, "obtain hash algo and key failed, ret = %d", ret); + return ret; } + rte_spinlock_unlock(&hw->lock); - /* Get the RSS Key required by the user */ + /* Get the RSS Key if user required. */ if (rss_conf->rss_key && rss_conf->rss_key_len >= hw->rss_key_size) { - ret = hns3_rss_get_algo_key(hw, &hash_algo, rss_conf->rss_key, - hw->rss_key_size); - if (ret != 0) { - hns3_err(hw, "obtain hash algo and key failed, ret = %d", - ret); - goto out; - } + memcpy(rss_conf->rss_key, rss_key, hw->rss_key_size); rss_conf->rss_key_len = hw->rss_key_size; } + rss_conf->func = hash_func_map[hash_algo]; -out: - rte_spinlock_unlock(&hw->lock); - - return ret; + return 0; } /* From patchwork Sat Aug 26 07:46:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 130778 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 0F6C34310A; Sat, 26 Aug 2023 09:50:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 673444323A; Sat, 26 Aug 2023 09:50:31 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id B21C04068E for ; Sat, 26 Aug 2023 09:50:25 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RXpp64ScRzVjN2; Sat, 26 Aug 2023 15:47:58 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 26 Aug 2023 15:50:18 +0800 From: Jie Hai To: , Reshma Pattan , Vipin Varghese , John McNamara CC: , Subject: [PATCH v2 3/5] app/proc-info: fix never show RSS info Date: Sat, 26 Aug 2023 15:46:05 +0800 Message-ID: <20230826074607.16771-4-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230826074607.16771-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20230826074607.16771-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500020.china.huawei.com (7.221.188.8) 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 Command show-port should show rss info (rss_key, len and rss_hf), However, the information is showned only when rss_conf.rss_key is not NULL. Since no memory is allocated for rss_conf.rss_key, rss_key will always be NULL and the rss_info will never show. This patch allocates memory for rss_conf.rss_key and makes it possible to show rss info. Fixes: 8a37f37fc243 ("app/procinfo: add --show-port") Cc: stable@dpdk.org Signed-off-by: Jie Hai Signed-off-by: Dongdong Liu --- app/proc-info/main.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 88cee0ca487b..f6b77a705dce 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -1013,6 +1013,7 @@ show_port(void) struct rte_eth_fc_conf fc_conf; struct rte_ether_addr mac; struct rte_eth_dev_owner owner; + uint8_t *rss_key; /* Skip if port is not in mask */ if ((enabled_port_mask & (1ul << i)) == 0) @@ -1171,19 +1172,25 @@ show_port(void) printf("\n"); } + rss_key = malloc(dev_info.hash_key_size * sizeof(uint8_t)); + if (rss_key == NULL) + return; + + rss_conf.rss_key = rss_key; + rss_conf.rss_key_len = dev_info.hash_key_size; ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf); if (ret == 0) { - if (rss_conf.rss_key) { - 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\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); } + free(rss_key); + #ifdef RTE_LIB_SECURITY show_security_context(i, true); #endif From patchwork Sat Aug 26 07:46:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 130780 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 721264310A; Sat, 26 Aug 2023 09:50:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91C174325D; Sat, 26 Aug 2023 09:50:33 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 72E774282D for ; Sat, 26 Aug 2023 09:50:29 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RXpq22cGXz1L9Vw; Sat, 26 Aug 2023 15:48:46 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 26 Aug 2023 15:50:19 +0800 From: Jie Hai To: , Reshma Pattan , John McNamara , Vipin Varghese CC: , Subject: [PATCH v2 4/5] app/proc-info: adjust the display format of RSS info Date: Sat, 26 Aug 2023 15:46:06 +0800 Message-ID: <20230826074607.16771-5-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230826074607.16771-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20230826074607.16771-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500020.china.huawei.com (7.221.188.8) 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 This patch splits the length and value of RSS key into two parts, removes spaces between RSS keys, and adds line breaks between RSS key and RSS hf. Before the adjustment, RSS info is shown as: - RSS -- RSS len 40 key (hex): 6d 5a 56 da 25 5b e c2 41 67 \ 25 3d 43 a3 8f b0 d0 ca 2b cb ae 7b 30 b4 77 cb 2d \ a3 80 30 f2 c 6a 42 b7 3b be ac 1 fa -- hf 0x0 and after: - RSS info -- RSS key len : 40 -- RSS key (hex) : 6d5a56da255b0ec24167253d43a38fb0d0ca2bcbae7b30b4 \ 77cb2da38030f20c6a42b73bbeac01fa -- RSS hf : 0x0 Fixes: 8a37f37fc243 ("app/procinfo: add --show-port") Cc: stable@dpdk.org Signed-off-by: Jie Hai --- app/proc-info/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index f6b77a705dce..6d2d77fea6ba 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -1180,12 +1180,13 @@ 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):", + printf(" - RSS info\n"); + 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(" %x", rss_conf.rss_key[k]); - printf("\t -- hf 0x%"PRIx64"\n", + printf("%02x", rss_conf.rss_key[k]); + printf("\n\t -- hf : 0x%"PRIx64"\n", rss_conf.rss_hf); } From patchwork Sat Aug 26 07:46:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 130779 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 5B8924310A; Sat, 26 Aug 2023 09:50:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 81D0143253; Sat, 26 Aug 2023 09:50:32 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 6A91C427E9 for ; Sat, 26 Aug 2023 09:50:29 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RXpq20bdlzfbxR for ; Sat, 26 Aug 2023 15:48:46 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 26 Aug 2023 15:50:19 +0800 From: Jie Hai To: , Reshma Pattan CC: , Subject: [PATCH v2 5/5] app/proc-info: support querying RSS hash algorithm Date: Sat, 26 Aug 2023 15:46:07 +0800 Message-ID: <20230826074607.16771-6-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230826074607.16771-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20230826074607.16771-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500020.china.huawei.com (7.221.188.8) 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 Display RSS hash algorithm with command show-port as below. - RSS info -- hash algorithm : toeplitz Signed-off-by: Jie Hai Signed-off-by: Dongdong Liu --- app/proc-info/main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 6d2d77fea6ba..02b418a4c661 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -996,6 +996,23 @@ show_offloads(uint64_t offloads, } } +static const char * +rss_func_to_str(enum rte_eth_hash_function func) +{ + switch (func) { + case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR: + return "simple_xor"; + case RTE_ETH_HASH_FUNCTION_TOEPLITZ: + return "toeplitz"; + case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ: + return "symmetric_toeplitz"; + case RTE_ETH_HASH_FUNCTION_DEFAULT: + return "default"; + default: + return "unknown"; + } +} + static void show_port(void) { @@ -1188,6 +1205,8 @@ show_port(void) printf("%02x", rss_conf.rss_key[k]); printf("\n\t -- hf : 0x%"PRIx64"\n", rss_conf.rss_hf); + printf("\t -- hash algorithm : %s\n", + rss_func_to_str(rss_conf.func)); } free(rss_key);