From patchwork Wed Nov 1 07:40:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 133721 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 BC04A4325D; Wed, 1 Nov 2023 08:45:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0B6D042DB4; Wed, 1 Nov 2023 08:44:34 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id CD909402DC for ; Wed, 1 Nov 2023 08:44:24 +0100 (CET) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SKzRy1FZxzMmMj; Wed, 1 Nov 2023 15:39:58 +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; Wed, 1 Nov 2023 15:44:18 +0800 From: Jie Hai To: , , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Ori Kam CC: , , Subject: [PATCH v8 01/10] ethdev: overwrite some comment related to RSS Date: Wed, 1 Nov 2023 15:40:30 +0800 Message-ID: <20231101074039.3088716-2-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231101074039.3088716-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20231101074039.3088716-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] 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 1. overwrite the comments of fields of 'rte_eth_rss_conf'. 2. Add comments for RTE_ETH_HASH_FUNCTION_DEFAULT. Signed-off-by: Jie Hai Acked-by: Huisong Li --- lib/ethdev/rte_ethdev.h | 34 +++++++++++++++++++--------------- lib/ethdev/rte_flow.h | 1 + 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index a53dd5a1efec..343a134fdd12 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -448,24 +448,28 @@ 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. */ + /** + * In rte_eth_dev_rss_hash_conf_get(), the *rss_key_len* should be + * greater than or equal to the *hash_key_size* which get from + * rte_eth_dev_info_get() API. And the *rss_key* should contain at least + * *hash_key_size* bytes. If not meet these requirements, the query + * result is unreliable even if the operation returns success. + * + * In rte_eth_dev_rss_hash_update() or rte_eth_dev_configure(), if + * *rss_key* is not NULL, the *rss_key_len* indicates the length of the + * *rss_key* in bytes of the array pointed by *rss_key*, and it should + * be equal to *hash_key_size*. Otherwise, drivers are free to use a + * random or a default key or to ignore this configuration. + */ + uint8_t *rss_key; uint8_t rss_key_len; /**< hash key length in bytes. */ - uint64_t rss_hf; /**< Hash functions to apply - see below. */ + /** + * Indicates the type of packets or the specific part of packets to + * which RSS hashing is to be applied. + */ + uint64_t rss_hf; }; /* diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index c16fe8c21f2f..751c29a0f3f3 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -3226,6 +3226,7 @@ struct rte_flow_query_count { * Hash function types. */ enum rte_eth_hash_function { + /** DEFAULT means driver decides which hash algorithm to pick. */ RTE_ETH_HASH_FUNCTION_DEFAULT = 0, RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */ RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */ From patchwork Wed Nov 1 07:40:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 133715 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 7FCFE4325D; Wed, 1 Nov 2023 08:44:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D73ED410FA; Wed, 1 Nov 2023 08:44:26 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 85C18402ED for ; Wed, 1 Nov 2023 08:44:21 +0100 (CET) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SKzRy66m2zMmNG; Wed, 1 Nov 2023 15:39:58 +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; Wed, 1 Nov 2023 15:44:18 +0800 From: Jie Hai To: , , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: , , Subject: [PATCH v8 02/10] lib/ethdev: check RSS key length Date: Wed, 1 Nov 2023 15:40:31 +0800 Message-ID: <20231101074039.3088716-3-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231101074039.3088716-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20231101074039.3088716-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] 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 In rte_eth_dev_rss_hash_conf_get(), the "rss_key_len" should be greater than or equal to the "hash_key_size" which get from rte_eth_dev_info_get() API. And the "rss_key" should contain at least "hash_key_size" bytes. If these requirements are not met, the query unreliable. In rte_eth_dev_rss_hash_update() or rte_eth_dev_configure(), the "rss_key_len" indicates the length of the "rss_key" in bytes of the array pointed by "rss_key", it should be equal to the "hash_key_size" if "rss_key" is not NULL. This patch checks "rss_key_len" in ethdev level. Signed-off-by: Jie Hai --- lib/ethdev/rte_ethdev.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index af23ac0ad00f..07bb35833ba6 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -1500,6 +1500,16 @@ 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.rss_key != NULL && + dev_conf->rx_adv_conf.rss_conf.rss_key_len < dev_info.hash_key_size) { + RTE_ETHDEV_LOG(ERR, + "Ethdev port_id=%u invalid RSS key len: %u, valid value: %u\n", + port_id, dev_conf->rx_adv_conf.rss_conf.rss_key_len, + dev_info.hash_key_size); + ret = -EINVAL; + goto rollback; + } + /* * Setup new number of Rx/Tx queues and reconfigure device. */ @@ -4698,6 +4708,14 @@ rte_eth_dev_rss_hash_update(uint16_t port_id, return -ENOTSUP; } + if (rss_conf->rss_key != NULL && + rss_conf->rss_key_len != dev_info.hash_key_size) { + RTE_ETHDEV_LOG(ERR, + "Ethdev port_id=%u invalid RSS key len: %u, valid value: %u\n", + port_id, rss_conf->rss_key_len, dev_info.hash_key_size); + return -EINVAL; + } + if (*dev->dev_ops->rss_hash_update == NULL) return -ENOTSUP; ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev, @@ -4712,6 +4730,7 @@ int rte_eth_dev_rss_hash_conf_get(uint16_t port_id, struct rte_eth_rss_conf *rss_conf) { + struct rte_eth_dev_info dev_info = { 0 }; struct rte_eth_dev *dev; int ret; @@ -4725,6 +4744,18 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id, return -EINVAL; } + ret = rte_eth_dev_info_get(port_id, &dev_info); + if (ret != 0) + return ret; + + if (rss_conf->rss_key != NULL && + rss_conf->rss_key_len < dev_info.hash_key_size) { + RTE_ETHDEV_LOG(ERR, + "Ethdev port_id=%u invalid RSS key len: %u, should not be less than: %u\n", + port_id, rss_conf->rss_key_len, dev_info.hash_key_size); + return -EINVAL; + } + if (*dev->dev_ops->rss_hash_conf_get == NULL) return -ENOTSUP; ret = eth_err(port_id, (*dev->dev_ops->rss_hash_conf_get)(dev, From patchwork Wed Nov 1 07:40:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 133713 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 C4AC04325D; Wed, 1 Nov 2023 08:44:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D445402ED; Wed, 1 Nov 2023 08:44:23 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 2A2D94026F for ; Wed, 1 Nov 2023 08:44:21 +0100 (CET) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SKzRD0x0tzvQ8j; Wed, 1 Nov 2023 15:39:20 +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; Wed, 1 Nov 2023 15:44:19 +0800 From: Jie Hai To: , , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Ori Kam CC: , , Subject: [PATCH v8 03/10] ethdev: support setting and querying RSS algorithm Date: Wed, 1 Nov 2023 15:40:32 +0800 Message-ID: <20231101074039.3088716-4-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231101074039.3088716-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20231101074039.3088716-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] 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_dev_info`` is extended by adding a new field "rss_algo_capa". Drivers are responsible for reporting this capa and configurations of RSS hash algorithm can be verified based on the capability. The default value of "rss_algo_capa" is RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT) if drivers do not report it. The structure ``rte_eth_rss_conf`` is extended by adding a new field "algorithm". This represents the RSS algorithms to apply. If the value of "algorithm" used for configuration is a gibberish value, drivers should report the error. To check whether the drivers report valid "algorithm", it is set to default value before querying in rte_eth_dev_rss_hash_conf_get(). Signed-off-by: Jie Hai Signed-off-by: Dongdong Liu Acked-by: Huisong Li --- doc/guides/rel_notes/release_23_11.rst | 5 +++++ lib/ethdev/rte_ethdev.c | 26 +++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 29 ++++++++++++++++++++++++++ lib/ethdev/rte_flow.c | 1 - lib/ethdev/rte_flow.h | 26 ++--------------------- 5 files changed, 62 insertions(+), 25 deletions(-) diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst index 95db98d098d8..e207786044f9 100644 --- a/doc/guides/rel_notes/release_23_11.rst +++ b/doc/guides/rel_notes/release_23_11.rst @@ -372,6 +372,11 @@ ABI Changes * security: struct ``rte_security_ipsec_sa_options`` was updated due to inline out-of-place feature addition. +* ethdev: Added "rss_algo_capa" field to ``rte_eth_dev_info`` structure for +* reporting RSS hash algorithm capability. + +* ethdev: Added "algorithm" 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 07bb35833ba6..f9bd99d07eb1 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -1269,6 +1269,7 @@ int rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, const struct rte_eth_conf *dev_conf) { + enum rte_eth_hash_function algorithm; struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; struct rte_eth_conf orig_conf; @@ -1510,6 +1511,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, goto rollback; } + algorithm = dev_conf->rx_adv_conf.rss_conf.algorithm; + if (RTE_ETH_HASH_ALGO_TO_CAPA(algorithm) == 0 || + (dev_info.rss_algo_capa & + RTE_ETH_HASH_ALGO_TO_CAPA(algorithm)) == 0) { + RTE_ETHDEV_LOG(ERR, + "Ethdev port_id=%u configured RSS hash algorithm (%u)" + "is not in the algorithm capability (0x%" PRIx32 ")\n", + port_id, algorithm, dev_info.rss_algo_capa); + ret = -EINVAL; + goto rollback; + } + /* * Setup new number of Rx/Tx queues and reconfigure device. */ @@ -3767,6 +3780,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) dev_info->min_mtu = RTE_ETHER_MIN_LEN - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN; dev_info->max_mtu = UINT16_MAX; + dev_info->rss_algo_capa = RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT); if (*dev->dev_ops->dev_infos_get == NULL) return -ENOTSUP; @@ -4716,6 +4730,16 @@ rte_eth_dev_rss_hash_update(uint16_t port_id, return -EINVAL; } + if (RTE_ETH_HASH_ALGO_TO_CAPA(rss_conf->algorithm) == 0 || + (dev_info.rss_algo_capa & + RTE_ETH_HASH_ALGO_TO_CAPA(rss_conf->algorithm)) == 0) { + RTE_ETHDEV_LOG(ERR, + "Ethdev port_id=%u configured RSS hash algorithm (%u)" + "is not in the algorithm capability (0x%" PRIx32 ")\n", + port_id, rss_conf->algorithm, dev_info.rss_algo_capa); + return -EINVAL; + } + if (*dev->dev_ops->rss_hash_update == NULL) return -ENOTSUP; ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev, @@ -4756,6 +4780,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id, return -EINVAL; } + rss_conf->algorithm = 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 343a134fdd12..76c45bd759e4 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -445,6 +445,33 @@ struct rte_vlan_filter_conf { uint64_t ids[64]; }; +/** + * Hash function types. + */ +enum rte_eth_hash_function { + /** DEFAULT means driver decides which hash algorithm to pick. */ + 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, + /** + * Symmetric Toeplitz: L3 and L4 fields are sorted prior to + * the hash function. + * If src_ip > dst_ip, swap src_ip and dst_ip. + * If src_port > dst_port, swap src_port and dst_port. + */ + RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT, + RTE_ETH_HASH_FUNCTION_MAX, +}; + +#define RTE_ETH_HASH_ALGO_TO_CAPA(x) RTE_BIT32(x) +#define RTE_ETH_HASH_ALGO_CAPA_MASK(x) RTE_BIT32(RTE_ETH_HASH_FUNCTION_ ## x) + /** * A structure used to configure the Receive Side Scaling (RSS) feature * of an Ethernet port. @@ -470,6 +497,7 @@ struct rte_eth_rss_conf { * which RSS hashing is to be applied. */ uint64_t rss_hf; + enum rte_eth_hash_function algorithm; /**< Hash algorithm. */ }; /* @@ -1750,6 +1778,7 @@ struct rte_eth_dev_info { /** Device redirection table size, the total number of entries. */ uint16_t reta_size; uint8_t hash_key_size; /**< Hash key size in bytes */ + uint32_t rss_algo_capa; /** RSS hash algorithms capabilities */ /** Bit mask of RSS offloads, the bit offset also means flow type */ uint64_t flow_type_rss_offloads; struct rte_eth_rxconf default_rxconf; /**< Default Rx configuration */ diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 4d6c28ee0eb2..e2468cd351ab 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -13,7 +13,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 751c29a0f3f3..affdc8121b57 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 @@ -3222,30 +3224,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 driver decides which hash algorithm to pick. */ - 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, - /** - * Symmetric Toeplitz: L3 and L4 fields are sorted prior to - * the hash function. - * If src_ip > dst_ip, swap src_ip and dst_ip. - * If src_port > dst_port, swap src_port and dst_port. - */ - RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT, - RTE_ETH_HASH_FUNCTION_MAX, -}; - /** * RTE_FLOW_ACTION_TYPE_RSS * From patchwork Wed Nov 1 07:40:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 133714 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 601E94325D; Wed, 1 Nov 2023 08:44:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A612240E5E; Wed, 1 Nov 2023 08:44:25 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id D9F1640633 for ; Wed, 1 Nov 2023 08:44:21 +0100 (CET) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SKzRD51YkzvQGv for ; Wed, 1 Nov 2023 15:39:20 +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; Wed, 1 Nov 2023 15:44:20 +0800 From: Jie Hai To: , , Yisen Zhuang CC: , , Subject: [PATCH v8 04/10] net/hns3: report RSS hash algorithms capability Date: Wed, 1 Nov 2023 15:40:33 +0800 Message-ID: <20231101074039.3088716-5-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231101074039.3088716-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20231101074039.3088716-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] 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 The hns3 driver should reports RSS hash algorithm capability to support updating RSS hash algorithm by rte_eth_dev_rss_hash_update() or rte_eth_dev_configure(). Signed-off-by: Jie Hai Acked-by: Huisong Li --- drivers/net/hns3/hns3_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c index c4d47f43fe44..7f5067ea2fa2 100644 --- a/drivers/net/hns3/hns3_common.c +++ b/drivers/net/hns3/hns3_common.c @@ -132,6 +132,10 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) info->reta_size = hw->rss_ind_tbl_size; info->hash_key_size = hw->rss_key_size; info->flow_type_rss_offloads = HNS3_ETH_RSS_SUPPORT; + info->rss_algo_capa = RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT) | + RTE_ETH_HASH_ALGO_CAPA_MASK(TOEPLITZ) | + RTE_ETH_HASH_ALGO_CAPA_MASK(SIMPLE_XOR) | + RTE_ETH_HASH_ALGO_CAPA_MASK(SYMMETRIC_TOEPLITZ); info->default_rxportconf.burst_size = HNS3_DEFAULT_PORT_CONF_BURST_SIZE; info->default_txportconf.burst_size = HNS3_DEFAULT_PORT_CONF_BURST_SIZE; From patchwork Wed Nov 1 07:40:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 133716 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 09E414325D; Wed, 1 Nov 2023 08:44:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 29D0A427E1; Wed, 1 Nov 2023 08:44:28 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 7B9454026F for ; Wed, 1 Nov 2023 08:44:22 +0100 (CET) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SKzTW0Wv2zkX12 for ; Wed, 1 Nov 2023 15:41:19 +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; Wed, 1 Nov 2023 15:44:20 +0800 From: Jie Hai To: , , Yisen Zhuang CC: , , Subject: [PATCH v8 05/10] net/hns3: support setting and querying RSS hash function Date: Wed, 1 Nov 2023 15:40:34 +0800 Message-ID: <20231101074039.3088716-6-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231101074039.3088716-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20231101074039.3088716-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] 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 Signed-off-by: Jie Hai Acked-by: Chengwen Feng --- 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..010a759f23d9 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->algorithm, key, key_len); + if (ret != 0) + goto set_algo_key_fail; + + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT) + hw->rss_info.hash_algo = hns3_hash_func_map[rss_conf->algorithm]; + 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->algorithm = hash_func_map[hash_algo]; -out: - rte_spinlock_unlock(&hw->lock); - - return ret; + return 0; } /* From patchwork Wed Nov 1 07:40:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 133718 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 C83DC4325D; Wed, 1 Nov 2023 08:45:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7BE7642D45; Wed, 1 Nov 2023 08:44:30 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 5858740647 for ; Wed, 1 Nov 2023 08:44:23 +0100 (CET) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SKzTX2bLNz1P7pm; Wed, 1 Nov 2023 15:41:20 +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; Wed, 1 Nov 2023 15:44:21 +0800 From: Jie Hai To: , , Reshma Pattan , John McNamara , Vipin Varghese CC: , , Subject: [PATCH v8 06/10] app/proc-info: fix never show RSS info Date: Wed, 1 Nov 2023 15:40:35 +0800 Message-ID: <20231101074039.3088716-7-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231101074039.3088716-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20231101074039.3088716-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] 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 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 fixes it. 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 Acked-by: Chengwen Feng Acked-by: Huisong Li --- 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 ce53bc30dfec..3a441ba07586 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -151,6 +151,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) @@ -1011,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[RSS_HASH_KEY_SIZE]; /* Skip if port is not in mask */ if ((enabled_port_mask & (1ul << i)) == 0) @@ -1169,17 +1172,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 Wed Nov 1 07:40:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 133717 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 E0B0D4325D; Wed, 1 Nov 2023 08:44:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 51AD342C24; Wed, 1 Nov 2023 08:44:29 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 1F118402DC for ; Wed, 1 Nov 2023 08:44:23 +0100 (CET) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SKzY01Rj3zVjdd; Wed, 1 Nov 2023 15:44:20 +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; Wed, 1 Nov 2023 15:44:21 +0800 From: Jie Hai To: , , Reshma Pattan , John McNamara , Vipin Varghese CC: , , Subject: [PATCH v8 07/10] app/proc-info: adjust the display format of RSS info Date: Wed, 1 Nov 2023 15:40:36 +0800 Message-ID: <20231101074039.3088716-8-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231101074039.3088716-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20231101074039.3088716-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] 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 -- hash function : 0x0 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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 3a441ba07586..4c577fa417fd 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -1176,12 +1176,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 -- hash function : 0x%"PRIx64"\n", rss_conf.rss_hf); } From patchwork Wed Nov 1 07:40:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 133719 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 125E84325D; Wed, 1 Nov 2023 08:45:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB26B42D92; Wed, 1 Nov 2023 08:44:31 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id C5CEC402DC for ; Wed, 1 Nov 2023 08:44:23 +0100 (CET) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SKzS16YMyzMmMF; Wed, 1 Nov 2023 15:40:01 +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; Wed, 1 Nov 2023 15:44:22 +0800 From: Jie Hai To: , , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: , , Subject: [PATCH v8 08/10] ethdev: add API to get RSS algorithm names Date: Wed, 1 Nov 2023 15:40:37 +0800 Message-ID: <20231101074039.3088716-9-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231101074039.3088716-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20231101074039.3088716-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] 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 adds new API rte_eth_dev_rss_algo_name() to get name of a RSS algorithm and document it. Signed-off-by: Jie Hai Acked-by: Huisong Li --- doc/guides/rel_notes/release_23_11.rst | 4 ++++ lib/ethdev/rte_ethdev.c | 25 +++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 16 ++++++++++++++++ lib/ethdev/version.map | 1 + 4 files changed, 46 insertions(+) diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst index e207786044f9..5276d302c40b 100644 --- a/doc/guides/rel_notes/release_23_11.rst +++ b/doc/guides/rel_notes/release_23_11.rst @@ -122,6 +122,10 @@ New Features a group's miss actions, which are the actions to be performed on packets that didn't match any of the flow rules in the group. +* **Added new API for RSS hash algorithm** + Added new function ``rte_eth_dev_rss_algo_name`` to get name of RSS hash + algorithm. + * **Updated Amazon ena (Elastic Network Adapter) net driver.** * Upgraded ENA HAL to latest version. diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index f9bd99d07eb1..cd19ea89e1f9 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -160,6 +160,17 @@ enum { STAT_QMAP_RX }; +static const struct { + enum rte_eth_hash_function algo; + const char *name; +} rte_eth_dev_rss_algo_names[] = { + {RTE_ETH_HASH_FUNCTION_DEFAULT, "default"}, + {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_SYMMETRIC_TOEPLITZ_SORT, "symmetric_toeplitz_sort"}, +}; + int rte_eth_iterator_init(struct rte_dev_iterator *iter, const char *devargs_str) { @@ -4792,6 +4803,20 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id, return ret; } +const char * +rte_eth_dev_rss_algo_name(enum rte_eth_hash_function rss_algo) +{ + const char *name = "Unknown function"; + unsigned int i; + + for (i = 0; i < RTE_DIM(rte_eth_dev_rss_algo_names); i++) { + if (rss_algo == rte_eth_dev_rss_algo_names[i].algo) + return rte_eth_dev_rss_algo_names[i].name; + } + + return name; +} + int rte_eth_dev_udp_tunnel_port_add(uint16_t port_id, struct rte_eth_udp_tunnel *udp_tunnel) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 76c45bd759e4..f7339fd5adce 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -4644,6 +4644,22 @@ int rte_eth_dev_rss_hash_conf_get(uint16_t port_id, struct rte_eth_rss_conf *rss_conf); +/** + * @warning + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice + * + * Get the name of RSS hash algorithm. + * + * @param rss_algo + * Hash algorithm. + * + * @return + * Hash algorithm name or 'UNKNOWN' if the rss_algo cannot be recognized. + */ +__rte_experimental +const char * +rte_eth_dev_rss_algo_name(enum rte_eth_hash_function rss_algo); + /** * Add UDP tunneling port for a type of tunnel. * diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index 919ba5b8e65b..9336522b713c 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -314,6 +314,7 @@ EXPERIMENTAL { rte_flow_restore_info_dynflag; # added in 23.11 + rte_eth_dev_rss_algo_name; rte_eth_recycle_rx_queue_info_get; rte_flow_group_set_miss_actions; rte_flow_calc_table_hash; From patchwork Wed Nov 1 07:40:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 133720 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 9A6814325D; Wed, 1 Nov 2023 08:45:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0BADA42D9F; Wed, 1 Nov 2023 08:44:33 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 110F640647 for ; Wed, 1 Nov 2023 08:44:24 +0100 (CET) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SKzY12DY9zVk3Y for ; Wed, 1 Nov 2023 15:44:21 +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; Wed, 1 Nov 2023 15:44:22 +0800 From: Jie Hai To: , , Reshma Pattan CC: , , Subject: [PATCH v8 09/10] app/proc-info: support querying RSS hash algorithm Date: Wed, 1 Nov 2023 15:40:38 +0800 Message-ID: <20231101074039.3088716-10-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231101074039.3088716-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20231101074039.3088716-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] 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 Acked-by: Reshma Pattan Acked-by: Huisong Li --- app/proc-info/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 4c577fa417fd..b672aaefbe99 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -1184,6 +1184,8 @@ show_port(void) printf("%02x", rss_conf.rss_key[k]); printf("\n\t -- hash function : 0x%"PRIx64"\n", rss_conf.rss_hf); + printf("\t -- hash algorithm : %s\n", + rte_eth_dev_rss_algo_name(rss_conf.algorithm)); } #ifdef RTE_LIB_SECURITY From patchwork Wed Nov 1 07:40:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 133722 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 A098E4325D; Wed, 1 Nov 2023 08:45:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 37F3642DC5; Wed, 1 Nov 2023 08:44:35 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id E77F540647 for ; Wed, 1 Nov 2023 08:44:24 +0100 (CET) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SKzY16QqzzVk6H for ; Wed, 1 Nov 2023 15:44:21 +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; Wed, 1 Nov 2023 15:44:23 +0800 From: Jie Hai To: , , Aman Singh , Yuying Zhang CC: , , Subject: [PATCH v8 10/10] app/testpmd: add RSS hash algorithms display Date: Wed, 1 Nov 2023 15:40:39 +0800 Message-ID: <20231101074039.3088716-11-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231101074039.3088716-1-haijie1@huawei.com> References: <20230315110033.30143-1-liudongdong3@huawei.com> <20231101074039.3088716-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] 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 Add the command "show port X rss-hash algorithm" to display the RSS hash algorithms of port X. An example is shown: testpmd> show port 0 rss-hash algorithm RSS algorithm: toeplitz Signed-off-by: Jie Hai Acked-by: Huisong Li --- app/test-pmd/cmdline.c | 29 ++++++++++++++++++++++++----- app/test-pmd/config.c | 29 ++++++++++------------------- app/test-pmd/testpmd.h | 2 +- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 35f5e4bbc002..912bf3355c10 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 | algorithm]\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" @@ -3026,15 +3026,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 algorithm; /* 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->algorithm, "algorithm")); } static cmdline_parse_token_string_t cmd_showport_rss_hash_show = @@ -3049,6 +3051,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_algo = + TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash, algorithm, "algorithm"); static cmdline_parse_inst_t cmd_showport_rss_hash = { .f = cmd_showport_rss_hash_parsed, @@ -3065,7 +3069,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, @@ -3077,6 +3081,20 @@ static cmdline_parse_inst_t cmd_showport_rss_hash_key = { }, }; +static cmdline_parse_inst_t cmd_showport_rss_hash_algo = { + .f = cmd_showport_rss_hash_parsed, + .data = NULL, + .help_str = "show port rss-hash algorithm", + .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_algo, + NULL, + }, +}; + /* *** Configure DCB *** */ struct cmd_config_dcb { cmdline_fixed_string_t port; @@ -12969,6 +12987,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_algo, (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 b9fdb7e8f162..23fb4f8aa781 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1504,24 +1504,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", rte_eth_dev_rss_algo_name(rss_conf->func)); printf(" RSS key:\n"); if (rss_conf->key_len == 0) { @@ -4486,7 +4469,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_algo) { struct rte_eth_rss_conf rss_conf = {0}; uint8_t rss_key[RSS_HASH_KEY_LENGTH]; @@ -4536,8 +4519,16 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key) printf("RSS disabled\n"); return; } + + if (show_rss_algo) { + printf("RSS algorithm:\n %s\n", + rte_eth_dev_rss_algo_name(rss_conf.algorithm)); + 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 09a36b90b806..9b10a9ea1cf2 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1153,7 +1153,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_algo); 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);