[v7,7/9] lib/ethdev: add API to get RSS algorithm names
Checks
Commit Message
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 <haijie1@huawei.com>
---
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(+)
Comments
在 2023/10/28 9:46, Jie Hai 写道:
> 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 <haijie1@huawei.com>
> ---
> 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);
Please add the document for this API.
Need to mark the experimental tag for this API and add it to
lib/ethdev/version.map.
With those to changes,
Acked-by: Huisong Li <lihuisong@huawei.com>
> +
> /**
> * Add UDP tunneling port for a type of tunnel.
> *
On 10/28/2023 2:46 AM, Jie Hai wrote:
> This patch adds new API rte_eth_dev_rss_algo_name() to get
> name of a RSS algorithm and document it.
>
In patch title s,/lib/ethdev:,ethdev:,
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> 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.
>
Can you please move this above net driver updates, in the ethdev related
update group?
> 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);
> +
Need to mark new API as experimental via '__rte_experimental'.
Also need to update lib/ethdev/version.map with new API, please place it
under 'EXPERIMENTAL' block, under "# added in 23.11" comment, as
alphabetically sorted.
> /**
> * Add UDP tunneling port for a type of tunnel.
> *
@@ -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
-------------
@@ -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)
@@ -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.
*