From patchwork Fri Sep 8 08:00:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131254 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 3A92A42544; Fri, 8 Sep 2023 10:03:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ABB1840274; Fri, 8 Sep 2023 10:03:43 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 5904D402C6 for ; Fri, 8 Sep 2023 10:03:41 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RhpT76jDtzVkT0; Fri, 8 Sep 2023 16:00:59 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) 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; Fri, 8 Sep 2023 16:03:39 +0800 From: Jie Hai To: , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Ori Kam CC: , Subject: [PATCH v4 1/7] ethdev: recomment some definitions related to RSS Date: Fri, 8 Sep 2023 16:00:23 +0800 Message-ID: <20230908080030.3837515-2-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230908080030.3837515-1-haijie1@huawei.com> References: <20230904072851.7384-1-haijie1@huawei.com> <20230908080030.3837515-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 1. Recomment fields of 'rte_eth_rss_conf'. 2. Add comments for RTE_ETH_HASH_FUNCTION_DEFAULT. Signed-off-by: Jie Hai --- lib/ethdev/rte_ethdev.h | 28 +++++++++++++--------------- lib/ethdev/rte_flow.h | 4 ++++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 04a2564f222a..40cfbb7efddd 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -448,24 +448,22 @@ struct rte_vlan_filter_conf { /** * A structure used to configure the Receive Side Scaling (RSS) feature * of an Ethernet port. - * If not NULL, the *rss_key* pointer of the *rss_conf* structure points - * to an array holding the RSS key to use for hashing specific header - * fields of received packets. The length of this array should be indicated - * by *rss_key_len* below. Otherwise, a default random hash key is used by - * the device driver. - * - * The *rss_key_len* field of the *rss_conf* structure indicates the length - * in bytes of the array pointed by *rss_key*. To be compatible, this length - * will be checked in i40e only. Others assume 40 bytes to be used as before. - * - * 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. */ struct rte_eth_rss_conf { - uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */ + /** + * If not NULL, 40-byte hash key to use for hashing specific header + * fields of received packets. The size of rss_key should be indicated + * by *rss_key_len* below. + * Otherwise, a default random hash key is used by the device driver. + */ + uint8_t *rss_key; uint8_t rss_key_len; /**< hash key length in bytes. */ - uint64_t rss_hf; /**< Hash functions to apply - see below. */ + /** + * The different types of packets to which the RSS hashing must be + * applied, may be combined with SRC/DST_ONLY, see below. + * Supplying an *rss_hf* equal to zero disables the RSS feature. + */ + uint64_t rss_hf; }; /* diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 2ebb76dbc083..3bd0dc64fbe2 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -3187,6 +3187,10 @@ struct rte_flow_query_count { * Hash function types. */ enum rte_eth_hash_function { + /** + * DEFAULT means that conformance to a specific hash algorithm is + * uncared to the caller. The driver can pick the one it deems optimal. + */ RTE_ETH_HASH_FUNCTION_DEFAULT = 0, RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */ RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */ From patchwork Fri Sep 8 08:00:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131255 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 87A4442544; Fri, 8 Sep 2023 10:03:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11E3C402EC; Fri, 8 Sep 2023 10:03:45 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 92B00402D9 for ; Fri, 8 Sep 2023 10:03:41 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RhpT83yRjzVkDp; Fri, 8 Sep 2023 16:01:00 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) 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; Fri, 8 Sep 2023 16:03:39 +0800 From: Jie Hai To: , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Ori Kam CC: , Subject: [PATCH v4 2/7] ethdev: support setting and querying RSS algorithm Date: Fri, 8 Sep 2023 16:00:24 +0800 Message-ID: <20230908080030.3837515-3-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230908080030.3837515-1-haijie1@huawei.com> References: <20230904072851.7384-1-haijie1@huawei.com> <20230908080030.3837515-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 | 21 +++++++++++++++++++++ lib/ethdev/rte_flow.c | 1 - lib/ethdev/rte_flow.h | 22 ++-------------------- 5 files changed, 42 insertions(+), 21 deletions(-) diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst index 333e1d95a283..deb019fbe4c1 100644 --- a/doc/guides/rel_notes/release_23_11.rst +++ b/doc/guides/rel_notes/release_23_11.rst @@ -129,6 +129,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 40cfbb7efddd..33cec3570f85 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -445,6 +445,26 @@ struct rte_vlan_filter_conf { uint64_t ids[64]; }; +/** + * Hash function types. + */ +enum rte_eth_hash_function { + /** + * DEFAULT means that conformance to a specific hash algorithm is + * uncared to the caller. The driver can pick the one it deems optimal. + */ + 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. @@ -464,6 +484,7 @@ struct rte_eth_rss_conf { * Supplying an *rss_hf* equal to zero disables the RSS feature. */ uint64_t rss_hf; + 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 3bd0dc64fbe2..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,26 +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 { - /** - * DEFAULT means that conformance to a specific hash algorithm is - * uncared to the caller. The driver can pick the one it deems optimal. - */ - 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 Fri Sep 8 08:00:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131256 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 2C7C442544; Fri, 8 Sep 2023 10:04:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3348B40608; Fri, 8 Sep 2023 10:03:46 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 3CE0440274 for ; Fri, 8 Sep 2023 10:03:42 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RhpSL5y1hzMlFP for ; Fri, 8 Sep 2023 16:00:18 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) 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; Fri, 8 Sep 2023 16:03:40 +0800 From: Jie Hai To: , Dongdong Liu , Yisen Zhuang CC: , Subject: [PATCH v4 3/7] net/hns3: support setting and querying RSS hash function Date: Fri, 8 Sep 2023 16:00:25 +0800 Message-ID: <20230908080030.3837515-4-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230908080030.3837515-1-haijie1@huawei.com> References: <20230904072851.7384-1-haijie1@huawei.com> <20230908080030.3837515-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 Fri Sep 8 08:00:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131257 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 2021842544; Fri, 8 Sep 2023 10:04:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5DD0140689; Fri, 8 Sep 2023 10:03:47 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id B72C6402DD for ; Fri, 8 Sep 2023 10:03:42 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RhpRc0s9jztRvZ; Fri, 8 Sep 2023 15:59:40 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) 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; Fri, 8 Sep 2023 16:03:40 +0800 From: Jie Hai To: , Reshma Pattan , Vipin Varghese , John McNamara CC: , Subject: [PATCH v4 4/7] app/proc-info: fix never show RSS info Date: Fri, 8 Sep 2023 16:00:26 +0800 Message-ID: <20230908080030.3837515-5-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230908080030.3837515-1-haijie1@huawei.com> References: <20230904072851.7384-1-haijie1@huawei.com> <20230908080030.3837515-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 shown 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 Acked-by: Reshma Pattan --- app/proc-info/main.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 88cee0ca487b..95dd4514b3c9 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -152,6 +152,8 @@ struct desc_param { static struct desc_param rx_desc_param; static struct desc_param tx_desc_param; +#define RSS_HASH_KEY_SIZE 64 + /* display usage */ static void proc_info_usage(const char *prgname) @@ -1013,6 +1015,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[RSS_HASH_KEY_SIZE]; /* Skip if port is not in mask */ if ((enabled_port_mask & (1ul << i)) == 0) @@ -1171,17 +1174,17 @@ show_port(void) printf("\n"); } + 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); } #ifdef RTE_LIB_SECURITY From patchwork Fri Sep 8 08:00:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131258 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 DE78D42544; Fri, 8 Sep 2023 10:04:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 84D06406B4; Fri, 8 Sep 2023 10:03:48 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id F3FCD40274 for ; Fri, 8 Sep 2023 10:03:42 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RhpRc4KmNztSGJ; Fri, 8 Sep 2023 15:59:40 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) 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; Fri, 8 Sep 2023 16:03:41 +0800 From: Jie Hai To: , Reshma Pattan , John McNamara , Vipin Varghese CC: , Subject: [PATCH v4 5/7] app/proc-info: adjust the display format of RSS info Date: Fri, 8 Sep 2023 16:00:27 +0800 Message-ID: <20230908080030.3837515-6-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230908080030.3837515-1-haijie1@huawei.com> References: <20230904072851.7384-1-haijie1@huawei.com> <20230908080030.3837515-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 Acked-by: Reshma Pattan --- 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 95dd4514b3c9..735cfd5249ab 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -1178,12 +1178,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 Fri Sep 8 08:00:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131260 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 E026042544; Fri, 8 Sep 2023 10:04:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4EF0440A77; Fri, 8 Sep 2023 10:03:51 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 9193E402F1 for ; Fri, 8 Sep 2023 10:03:45 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RhpRd0h9sztRqL for ; Fri, 8 Sep 2023 15:59:41 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) 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; Fri, 8 Sep 2023 16:03:42 +0800 From: Jie Hai To: , Reshma Pattan CC: , Subject: [PATCH v4 6/7] app/proc-info: support querying RSS hash algorithm Date: Fri, 8 Sep 2023 16:00:28 +0800 Message-ID: <20230908080030.3837515-7-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230908080030.3837515-1-haijie1@huawei.com> References: <20230904072851.7384-1-haijie1@huawei.com> <20230908080030.3837515-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 Acked-by: Reshma Pattan Acked-by: Reshma Pattan --- app/proc-info/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 735cfd5249ab..3da63a4821f2 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -153,6 +153,13 @@ static struct desc_param rx_desc_param; static struct desc_param tx_desc_param; #define RSS_HASH_KEY_SIZE 64 +static const char * const rss_hash_algos[] = { + [RTE_ETH_HASH_FUNCTION_SIMPLE_XOR] = "simple_xor", + [RTE_ETH_HASH_FUNCTION_TOEPLITZ] = "toeplitz", + [RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ] = "symmetric_toeplitz", + [RTE_ETH_HASH_FUNCTION_DEFAULT] = "default", + [RTE_ETH_HASH_FUNCTION_MAX] = "unknown" +}; /* display usage */ static void @@ -1186,6 +1193,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_hash_algos[rss_conf.func]); } #ifdef RTE_LIB_SECURITY From patchwork Fri Sep 8 08:00:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131259 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 3FC3B42544; Fri, 8 Sep 2023 10:04:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D37C406FF; Fri, 8 Sep 2023 10:03:49 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 0ACB0402E8 for ; Fri, 8 Sep 2023 10:03:44 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RhpV8103nzrSX5 for ; Fri, 8 Sep 2023 16:01:52 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) 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; Fri, 8 Sep 2023 16:03:42 +0800 From: Jie Hai To: , Aman Singh , Yuying Zhang CC: , Subject: [PATCH v4 7/7] app/testpmd: add RSS hash algorithms display Date: Fri, 8 Sep 2023 16:00:29 +0800 Message-ID: <20230908080030.3837515-8-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230908080030.3837515-1-haijie1@huawei.com> References: <20230904072851.7384-1-haijie1@huawei.com> <20230908080030.3837515-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 Add the command "show port X rss-hash func" to display the RSS hash algorithms of port X. An example is shown: testpmd> show port 0 rss-hash func RSS algorithms: toeplitz Signed-off-by: Jie Hai --- app/test-pmd/cmdline.c | 29 ++++++++++++++++++++++++----- app/test-pmd/config.c | 36 +++++++++++++++++------------------- app/test-pmd/testpmd.h | 2 +- 3 files changed, 42 insertions(+), 25 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 0d0723f6596e..91bb5ac3c091 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -174,8 +174,8 @@ static void cmd_help_long_parsed(void *parsed_result, " by masks on port X. size is used to indicate the" " hardware supported reta size\n\n" - "show port (port_id) rss-hash [key]\n" - " Display the RSS hash functions and RSS hash key of port\n\n" + "show port (port_id) rss-hash [key | func]\n" + " Display the RSS hash functions, RSS hash key and RSS hash algorithms of port\n\n" "clear port (info|stats|xstats|fdir) (port_id|all)\n" " Clear information for port_id, or all.\n\n" @@ -3017,15 +3017,17 @@ struct cmd_showport_rss_hash { cmdline_fixed_string_t rss_hash; cmdline_fixed_string_t rss_type; cmdline_fixed_string_t key; /* optional argument */ + cmdline_fixed_string_t func; /* optional argument */ }; static void cmd_showport_rss_hash_parsed(void *parsed_result, __rte_unused struct cmdline *cl, - void *show_rss_key) + __rte_unused void *data) { struct cmd_showport_rss_hash *res = parsed_result; - port_rss_hash_conf_show(res->port_id, show_rss_key != NULL); + port_rss_hash_conf_show(res->port_id, + !strcmp(res->key, "key"), !strcmp(res->func, "func")); } static cmdline_parse_token_string_t cmd_showport_rss_hash_show = @@ -3040,6 +3042,8 @@ static cmdline_parse_token_string_t cmd_showport_rss_hash_rss_hash = "rss-hash"); static cmdline_parse_token_string_t cmd_showport_rss_hash_rss_key = TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash, key, "key"); +static cmdline_parse_token_string_t cmd_showport_rss_hash_rss_func = + TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash, func, "func"); static cmdline_parse_inst_t cmd_showport_rss_hash = { .f = cmd_showport_rss_hash_parsed, @@ -3056,7 +3060,7 @@ static cmdline_parse_inst_t cmd_showport_rss_hash = { static cmdline_parse_inst_t cmd_showport_rss_hash_key = { .f = cmd_showport_rss_hash_parsed, - .data = (void *)1, + .data = NULL, .help_str = "show port rss-hash key", .tokens = { (void *)&cmd_showport_rss_hash_show, @@ -3068,6 +3072,20 @@ static cmdline_parse_inst_t cmd_showport_rss_hash_key = { }, }; +static cmdline_parse_inst_t cmd_showport_rss_hash_func = { + .f = cmd_showport_rss_hash_parsed, + .data = NULL, + .help_str = "show port rss-hash func", + .tokens = { + (void *)&cmd_showport_rss_hash_show, + (void *)&cmd_showport_rss_hash_port, + (void *)&cmd_showport_rss_hash_port_id, + (void *)&cmd_showport_rss_hash_rss_hash, + (void *)&cmd_showport_rss_hash_rss_func, + NULL, + }, +}; + /* *** Configure DCB *** */ struct cmd_config_dcb { cmdline_fixed_string_t port; @@ -12905,6 +12923,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = { (cmdline_parse_inst_t *)&cmd_tunnel_udp_config, (cmdline_parse_inst_t *)&cmd_showport_rss_hash, (cmdline_parse_inst_t *)&cmd_showport_rss_hash_key, + (cmdline_parse_inst_t *)&cmd_showport_rss_hash_func, (cmdline_parse_inst_t *)&cmd_config_rss_hash_key, (cmdline_parse_inst_t *)&cmd_cleanup_txq_mbufs, (cmdline_parse_inst_t *)&cmd_dump, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 11f3a2204839..1af55185d2b2 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1485,6 +1485,14 @@ rss_types_display(uint64_t rss_types, uint16_t char_num_per_line) printf("\n"); } +static const char * const rss_hash_algos[] = { + [RTE_ETH_HASH_FUNCTION_SIMPLE_XOR] = "simple_xor", + [RTE_ETH_HASH_FUNCTION_TOEPLITZ] = "toeplitz", + [RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ] = "symmetric_toeplitz", + [RTE_ETH_HASH_FUNCTION_DEFAULT] = "default", + [RTE_ETH_HASH_FUNCTION_MAX] = "Unknown function" +}; + static void rss_config_display(struct rte_flow_action_rss *rss_conf) { @@ -1503,24 +1511,7 @@ rss_config_display(struct rte_flow_action_rss *rss_conf) printf(" %d", rss_conf->queue[i]); printf("\n"); - printf(" function: "); - switch (rss_conf->func) { - case RTE_ETH_HASH_FUNCTION_DEFAULT: - printf("default\n"); - break; - case RTE_ETH_HASH_FUNCTION_TOEPLITZ: - printf("toeplitz\n"); - break; - case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR: - printf("simple_xor\n"); - break; - case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ: - printf("symmetric_toeplitz\n"); - break; - default: - printf("Unknown function\n"); - return; - } + printf(" function: %s\n", rss_hash_algos[rss_conf->func]); printf(" RSS key:\n"); if (rss_conf->key_len == 0) { @@ -4406,7 +4397,7 @@ port_rss_reta_info(portid_t port_id, * key of the port. */ void -port_rss_hash_conf_show(portid_t port_id, int show_rss_key) +port_rss_hash_conf_show(portid_t port_id, int show_rss_key, int show_rss_func) { struct rte_eth_rss_conf rss_conf = {0}; uint8_t rss_key[RSS_HASH_KEY_LENGTH]; @@ -4456,8 +4447,15 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key) printf("RSS disabled\n"); return; } + + if (show_rss_func) { + printf("RSS algorithms:\n %s\n", rss_hash_algos[rss_conf.func]); + return; + } + printf("RSS functions:\n"); rss_types_display(rss_hf, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE); + if (!show_rss_key) return; printf("RSS key:\n"); diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index f1df6a8fafaa..3dc2f47280ad 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1146,7 +1146,7 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint32_t rate, int set_rxq_avail_thresh(portid_t port_id, uint16_t queue_id, uint8_t avail_thresh); -void port_rss_hash_conf_show(portid_t port_id, int show_rss_key); +void port_rss_hash_conf_show(portid_t port_id, int show_rss_key, int show_rss_func); void port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key, uint8_t hash_key_len); int rx_queue_id_is_invalid(queueid_t rxq_id);