Skip to content

Commit

Permalink
ethdev: add new API to get RSS hash algorithm by name
Browse files Browse the repository at this point in the history
This patch supports conversion from names to hash algorithm
(see RTE_ETH_HASH_FUNCTION_XXX).

Signed-off-by: Jie Hai <[email protected]>
Reviewed-by: Huisong Li <[email protected]>
Reviewed-by: Ferruh Yigit <[email protected]>
  • Loading branch information
Jie Hai authored and ferruhy committed Dec 4, 2023
1 parent c4ee720 commit c4b01b7
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc/guides/rel_notes/release_24_03.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ New Features
Also, make sure to start the actual text at the margin.
=======================================================
* **Improved support of RSS hash algorithm.**

* Added new function ``rte_eth_find_rss_algo`` to get RSS hash
algorithm by its name.


Removed Items
-------------
Expand Down
15 changes: 15 additions & 0 deletions lib/ethdev/rte_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 20 additions & 0 deletions lib/ethdev/rte_ethdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
3 changes: 3 additions & 0 deletions lib/ethdev/version.map
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c4b01b7

Please sign in to comment.