From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 19E424321C; Sat, 28 Oct 2023 03:50:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CD3742DD5; Sat, 28 Oct 2023 03:49:53 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id CC61B40291 for ; Sat, 28 Oct 2023 03:49:42 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SHMpF3JgDzrSy5; Sat, 28 Oct 2023 09:46:45 +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; Sat, 28 Oct 2023 09:49:41 +0800 From: Jie Hai To: , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: , , , Subject: [PATCH v7 7/9] lib/ethdev: add API to get RSS algorithm names Date: Sat, 28 Oct 2023 09:46:09 +0800 Message-ID: <20231028014611.4086500-8-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231028014611.4086500-1-haijie1@huawei.com> References: <20231027092836.445224-1-haijie1@huawei.com> <20231028014611.4086500-1-haijie1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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 --- doc/guides/rel_notes/release_23_11.rst | 3 +++ lib/ethdev/rte_ethdev.c | 25 +++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 4 ++++ 3 files changed, 32 insertions(+) diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst index a35d729d2cc7..fe561a6c59b9 100644 --- a/doc/guides/rel_notes/release_23_11.rst +++ b/doc/guides/rel_notes/release_23_11.rst @@ -243,6 +243,9 @@ New Features Added dispatcher library which purpose is to help decouple different parts (modules) of an eventdev-based application. +* **Added new API for RSS hash algorithm** + Added new function ``rte_eth_dev_rss_algo_name`` to get name of RSS hash + algorithm. Removed Items ------------- diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 90bfbf14d1f7..301531ba9628 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) { @@ -4761,6 +4772,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 2f639edd8218..b9d4bfa851b4 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -4645,6 +4645,10 @@ int rte_eth_dev_rss_hash_conf_get(uint16_t port_id, struct rte_eth_rss_conf *rss_conf); + +const char * +rte_eth_dev_rss_algo_name(enum rte_eth_hash_function rss_algo); + /** * Add UDP tunneling port for a type of tunnel. * -- 2.30.0