From patchwork Mon Sep 4 07:28:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131143 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 96402424EC; Mon, 4 Sep 2023 09:32:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AAAAB40647; Mon, 4 Sep 2023 09:32:25 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 4FA87402C7 for ; Mon, 4 Sep 2023 09:32:19 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RfKzp2s6Hz1M90H; Mon, 4 Sep 2023 15:30:30 +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; Mon, 4 Sep 2023 15:32:14 +0800 From: Jie Hai To: , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Ori Kam CC: , Subject: [PATCH 1/5] ethdev: support setting and querying RSS algorithm Date: Mon, 4 Sep 2023 15:28:47 +0800 Message-ID: <20230904072851.7384-2-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230904072851.7384-1-haijie1@huawei.com> References: <20230826074607.16771-1-haijie1@huawei.com> <20230904072851.7384-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 will be 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 | 20 ++++++++++++++++++++ lib/ethdev/rte_flow.c | 1 - lib/ethdev/rte_flow.h | 18 ++---------------- 5 files changed, 41 insertions(+), 17 deletions(-) diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst index 4411bb32c195..94239170139d 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..1fe3c0a502ac 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -445,6 +445,22 @@ struct rte_vlan_filter_conf { uint64_t ids[64]; }; +/** + * Hash function types. + */ +enum rte_eth_hash_function { + RTE_ETH_HASH_FUNCTION_DEFAULT = 0, + RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */ + RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */ + /** + * Symmetric Toeplitz: src, dst will be replaced by + * xor(src, dst). For the case with src/dst only, + * src or dst address will xor with zero pair. + */ + RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ, + RTE_ETH_HASH_FUNCTION_MAX, +}; + /** * A structure used to configure the Receive Side Scaling (RSS) feature * of an Ethernet port. @@ -461,11 +477,15 @@ 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. */ 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. */ }; /* diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 271d854f7807..d3f2d466d841 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -12,7 +12,6 @@ #include #include #include -#include "rte_ethdev.h" #include "rte_flow_driver.h" #include "rte_flow.h" diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 2ebb76dbc083..a7578b1d2eff 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -40,6 +40,8 @@ #include #include +#include "rte_ethdev.h" + #ifdef __cplusplus extern "C" { #endif @@ -3183,22 +3185,6 @@ struct rte_flow_query_count { uint64_t bytes; /**< Number of bytes through this rule [out]. */ }; -/** - * Hash function types. - */ -enum rte_eth_hash_function { - RTE_ETH_HASH_FUNCTION_DEFAULT = 0, - RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */ - RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */ - /** - * Symmetric Toeplitz: src, dst will be replaced by - * xor(src, dst). For the case with src/dst only, - * src or dst address will xor with zero pair. - */ - RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ, - RTE_ETH_HASH_FUNCTION_MAX, -}; - /** * RTE_FLOW_ACTION_TYPE_RSS * From patchwork Mon Sep 4 07:28:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131141 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 63A75424EC; Mon, 4 Sep 2023 09:32:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AC5E2402DB; Mon, 4 Sep 2023 09:32:21 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 39F43402BC for ; Mon, 4 Sep 2023 09:32:18 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RfKys6DRmzTjvV for ; Mon, 4 Sep 2023 15:29:41 +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; Mon, 4 Sep 2023 15:32:15 +0800 From: Jie Hai To: , Dongdong Liu , Yisen Zhuang CC: , Subject: [PATCH 2/5] net/hns3: support setting and querying RSS hash function Date: Mon, 4 Sep 2023 15:28:48 +0800 Message-ID: <20230904072851.7384-3-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230904072851.7384-1-haijie1@huawei.com> References: <20230826074607.16771-1-haijie1@huawei.com> <20230904072851.7384-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 Mon Sep 4 07:28:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131139 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 66CA2424EC; Mon, 4 Sep 2023 09:32:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E41E402AF; Mon, 4 Sep 2023 09:32:19 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 2BA1C402A9 for ; Mon, 4 Sep 2023 09:32:17 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RfKzp4c0tzrSSg; Mon, 4 Sep 2023 15:30:30 +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; Mon, 4 Sep 2023 15:32:15 +0800 From: Jie Hai To: , Reshma Pattan , Vipin Varghese , John McNamara CC: , Subject: [PATCH 3/5] app/proc-info: fix never show RSS info Date: Mon, 4 Sep 2023 15:28:49 +0800 Message-ID: <20230904072851.7384-4-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230904072851.7384-1-haijie1@huawei.com> References: <20230826074607.16771-1-haijie1@huawei.com> <20230904072851.7384-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 Mon Sep 4 07:28:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131142 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 93E24424EC; Mon, 4 Sep 2023 09:32:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 51246402EE; Mon, 4 Sep 2023 09:32:23 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 981D2402CC for ; Mon, 4 Sep 2023 09:32:18 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RfKxH5MMNztSKy; Mon, 4 Sep 2023 15:28:19 +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; Mon, 4 Sep 2023 15:32:16 +0800 From: Jie Hai To: , Reshma Pattan , Vipin Varghese , John McNamara CC: , Subject: [PATCH 4/5] app/proc-info: adjust the display format of RSS info Date: Mon, 4 Sep 2023 15:28:50 +0800 Message-ID: <20230904072851.7384-5-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230904072851.7384-1-haijie1@huawei.com> References: <20230826074607.16771-1-haijie1@huawei.com> <20230904072851.7384-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 -- key len : 40 -- key (hex) : 6d5a56da255b0ec24167253d43a38fb0d0c \ a2bcbae7b30b477cb2da38030f20c6a42b73bbeac01fa -- 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 Mon Sep 4 07:28:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131140 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 82301424EC; Mon, 4 Sep 2023 09:32:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 66CB7402D0; Mon, 4 Sep 2023 09:32:20 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 67659402C7 for ; Mon, 4 Sep 2023 09:32:18 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RfKxd4g34zNmpP for ; Mon, 4 Sep 2023 15:28:37 +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; Mon, 4 Sep 2023 15:32:16 +0800 From: Jie Hai To: , Reshma Pattan CC: , Subject: [PATCH 5/5] app/proc-info: support querying RSS hash algorithm Date: Mon, 4 Sep 2023 15:28:51 +0800 Message-ID: <20230904072851.7384-6-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230904072851.7384-1-haijie1@huawei.com> References: <20230826074607.16771-1-haijie1@huawei.com> <20230904072851.7384-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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);