dpdk/0019-ethdev-get-RSS-hash-algorithm-by-name.patch
Dengdui Huang 1f34bd76e4 sync some patchs from upstreaming
Sync some patches for hns3 about refactor mailbox, add new API for RSS,
support power monitor and some bugfix, modifies are as follow:
 - app/testpmd: fix crash in multi -process forwarding
 - net/hns3: support power monitor
 - net/hns3: remove QinQ insert support for VF
 - net/hns3: fix reset level comparison
 - net/hns3: fix disable command with firmware
 - net/hns3: fix VF multiple count on one reset
 - net/hns3: refactor handle mailbox function
 - net/hns3: refactor send mailbox function
 - net/hns3: refactor PF mailbox message struct
 - net/hns3: refactor VF mailbox message struct
 - app/testpmd: set RSS hash algorithm
 - ethdev: get RSS hash algorithm by name
 - ring: add telemetry command for ring info
 - ring: add telemetry command to list rings
 - eal: introduce more macros for bit definition
 - dmadev: add tracepoints in data path API
 - dmadev: add telemetry capability for m2d auto free
 - maintainers: update for DMA device performance tool

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
2024-03-05 16:15:56 +08:00

94 lines
2.4 KiB
Diff

From 6b7a19a619a47d85cb21edce610d9b7a2313b19d Mon Sep 17 00:00:00 2001
From: Jie Hai <haijie1@huawei.com>
Date: Fri, 1 Dec 2023 16:52:53 +0800
Subject: [PATCH 19/30] ethdev: get RSS hash algorithm by name
[ upstream commit c9884dfb4a35ec00c1aaa2ece2033da679233003 ]
This patch supports conversion from names to hash algorithm
(see RTE_ETH_HASH_FUNCTION_XXX).
Signed-off-by: Jie Hai <haijie1@huawei.com>
Reviewed-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
lib/ethdev/rte_ethdev.c | 15 +++++++++++++++
lib/ethdev/rte_ethdev.h | 20 ++++++++++++++++++++
lib/ethdev/version.map | 3 +++
3 files changed, 38 insertions(+)
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 3858983..c0398d9 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -4826,6 +4826,21 @@ rte_eth_dev_rss_algo_name(enum rte_eth_hash_function rss_algo)
return name;
}
+int
+rte_eth_find_rss_algo(const char *name, uint32_t *algo)
+{
+ unsigned int i;
+
+ for (i = 0; i < RTE_DIM(rte_eth_dev_rss_algo_names); i++) {
+ if (strcmp(name, rte_eth_dev_rss_algo_names[i].name) == 0) {
+ *algo = rte_eth_dev_rss_algo_names[i].algo;
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
+
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 77331ce..57a9a55 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -4667,6 +4667,26 @@ __rte_experimental
const char *
rte_eth_dev_rss_algo_name(enum rte_eth_hash_function rss_algo);
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
+ *
+ * Get RSS hash algorithm by its name.
+ *
+ * @param name
+ * RSS hash algorithm.
+ *
+ * @param algo
+ * Return the RSS hash algorithm found, @see rte_eth_hash_function.
+ *
+ * @return
+ * - (0) if successful.
+ * - (-EINVAL) if not found.
+ */
+__rte_experimental
+int
+rte_eth_find_rss_algo(const char *name, uint32_t *algo);
+
/**
* Add UDP tunneling port for a type of tunnel.
*
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 5c4917c..a050baa 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -316,6 +316,9 @@ EXPERIMENTAL {
rte_eth_recycle_rx_queue_info_get;
rte_flow_group_set_miss_actions;
rte_flow_calc_table_hash;
+
+ # added in 24.03
+ rte_eth_find_rss_algo;
};
INTERNAL {
--
2.33.0