* [PATCH 0/5] support setting and querying RSS algorithms
@ 2023-03-15 11:00 Dongdong Liu
2023-03-15 11:00 ` [PATCH 1/5] ethdev: support setting and querying rss algorithm Dongdong Liu
` (7 more replies)
0 siblings, 8 replies; 222+ messages in thread
From: Dongdong Liu @ 2023-03-15 11:00 UTC (permalink / raw)
To: dev, ferruh.yigit, thomas, andrew.rybchenko, reshma.pattan
Cc: stable, yisen.zhuang, liudongdong3
This patchset is to support setting and querying RSS algorithms.
Huisong Li (1):
net/hns3: support setting and querying RSS hash function
Jie Hai (4):
ethdev: support setting and querying rss algorithm
app/proc-info: fix never show RSS info
app/proc-info: show RSS types with strings
app/proc-info: support querying RSS hash algorithm
app/proc-info/main.c | 145 ++++++++++++++++++++++++-
doc/guides/rel_notes/release_23_03.rst | 4 +-
drivers/net/hns3/hns3_rss.c | 47 ++++----
lib/ethdev/rte_ethdev.c | 18 +++
lib/ethdev/rte_ethdev.h | 5 +
5 files changed, 191 insertions(+), 28 deletions(-)
--
2.22.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 1/5] ethdev: support setting and querying rss algorithm
2023-03-15 11:00 [PATCH 0/5] support setting and querying RSS algorithms Dongdong Liu
@ 2023-03-15 11:00 ` Dongdong Liu
2023-03-15 11:28 ` Ivan Malov
2023-03-15 13:43 ` Thomas Monjalon
2023-03-15 11:00 ` [PATCH 2/5] net/hns3: support setting and querying RSS hash function Dongdong Liu
` (6 subsequent siblings)
7 siblings, 2 replies; 222+ messages in thread
From: Dongdong Liu @ 2023-03-15 11:00 UTC (permalink / raw)
To: dev, ferruh.yigit, thomas, andrew.rybchenko, reshma.pattan
Cc: stable, yisen.zhuang, liudongdong3, Jie Hai
From: Jie Hai <haijie1@huawei.com>
Currently, rte_eth_rss_conf supports configuring rss hash
functions, rss key and it's length, but not rss hash algorithm.
The structure ``rte_eth_rss_conf`` is extended by adding a new field,
"func". This represents the RSS algorithms to apply. The following
API is affected:
- rte_eth_dev_configure
- rte_eth_dev_rss_hash_update
- rte_eth_dev_rss_hash_conf_get
To prevent configuration failures caused by incorrect func input, check
this parameter in advance. If it's incorrect, a warning is generated
and the default value is set. Do the same for rte_eth_dev_rss_hash_update
and rte_eth_dev_configure.
To check whether the drivers report the func field, it is set to default
value before querying.
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
doc/guides/rel_notes/release_23_03.rst | 4 ++--
lib/ethdev/rte_ethdev.c | 18 ++++++++++++++++++
lib/ethdev/rte_ethdev.h | 5 +++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst
index af6f37389c..7879567427 100644
--- a/doc/guides/rel_notes/release_23_03.rst
+++ b/doc/guides/rel_notes/release_23_03.rst
@@ -284,8 +284,8 @@ ABI Changes
Also, make sure to start the actual text at the margin.
=======================================================
-* No ABI change that would break compatibility with 22.11.
-
+* ethdev: Added "func" 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 4d03255683..db561026bd 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1368,6 +1368,15 @@ 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.func >= RTE_ETH_HASH_FUNCTION_MAX) {
+ RTE_ETHDEV_LOG(WARNING,
+ "Ethdev port_id=%u invalid rss hash function (%u), modified to default value (%u)\n",
+ port_id, dev_conf->rx_adv_conf.rss_conf.func,
+ RTE_ETH_HASH_FUNCTION_DEFAULT);
+ dev->data->dev_conf.rx_adv_conf.rss_conf.func =
+ RTE_ETH_HASH_FUNCTION_DEFAULT;
+ }
+
/* Check if Rx RSS distribution is disabled but RSS hash is enabled. */
if (((dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) == 0) &&
(dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
@@ -4553,6 +4562,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
return -ENOTSUP;
}
+ if (rss_conf->func >= RTE_ETH_HASH_FUNCTION_MAX) {
+ RTE_ETHDEV_LOG(NOTICE,
+ "Ethdev port_id=%u invalid rss hash function (%u), modified to default value (%u)\n",
+ port_id, rss_conf->func, RTE_ETH_HASH_FUNCTION_DEFAULT);
+ rss_conf->func = RTE_ETH_HASH_FUNCTION_DEFAULT;
+ }
+
if (*dev->dev_ops->rss_hash_update == NULL)
return -ENOTSUP;
ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
@@ -4580,6 +4596,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
return -EINVAL;
}
+ rss_conf->func = 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 99fe9e238b..5abe2cb36d 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -174,6 +174,7 @@ extern "C" {
#include "rte_ethdev_trace_fp.h"
#include "rte_dev_info.h"
+#include "rte_flow.h"
extern int rte_eth_dev_logtype;
@@ -461,11 +462,15 @@ struct rte_vlan_filter_conf {
* 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.
+ *
+ * The *func* field of the *rss_conf* structure indicates the different
+ * types of hash algorithms applied by the RSS hashing.
*/
struct rte_eth_rss_conf {
uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
uint8_t rss_key_len; /**< hash key length in bytes. */
uint64_t rss_hf; /**< Hash functions to apply - see below. */
+ enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
};
/*
--
2.22.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 2/5] net/hns3: support setting and querying RSS hash function
2023-03-15 11:00 [PATCH 0/5] support setting and querying RSS algorithms Dongdong Liu
2023-03-15 11:00 ` [PATCH 1/5] ethdev: support setting and querying rss algorithm Dongdong Liu
@ 2023-03-15 11:00 ` Dongdong Liu
2023-03-15 11:00 ` [PATCH 3/5] app/proc-info: fix never show RSS info Dongdong Liu
` (5 subsequent siblings)
7 siblings, 0 replies; 222+ messages in thread
From: Dongdong Liu @ 2023-03-15 11:00 UTC (permalink / raw)
To: dev, ferruh.yigit, thomas, andrew.rybchenko, reshma.pattan
Cc: stable, yisen.zhuang, liudongdong3, Huisong Li
From: Huisong Li <lihuisong@huawei.com>
Support setting and querying RSS hash function by ethdev ops.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
| 47 +++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 20 deletions(-)
--git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c
index 6126512bd7..c8346d43d1 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->func, key, key_len);
+ if (ret != 0)
+ goto set_algo_key_fail;
+
+ if (rss_conf->func != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ hw->rss_info.hash_algo = hns3_hash_func_map[rss_conf->func];
+ 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->func = hash_func_map[hash_algo];
-out:
- rte_spinlock_unlock(&hw->lock);
-
- return ret;
+ return 0;
}
/*
--
2.22.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 3/5] app/proc-info: fix never show RSS info
2023-03-15 11:00 [PATCH 0/5] support setting and querying RSS algorithms Dongdong Liu
2023-03-15 11:00 ` [PATCH 1/5] ethdev: support setting and querying rss algorithm Dongdong Liu
2023-03-15 11:00 ` [PATCH 2/5] net/hns3: support setting and querying RSS hash function Dongdong Liu
@ 2023-03-15 11:00 ` Dongdong Liu
2023-06-02 20:19 ` Ferruh Yigit
2023-06-02 21:19 ` Stephen Hemminger
2023-03-15 11:00 ` [PATCH 4/5] app/proc-info: show RSS types with strings Dongdong Liu
` (4 subsequent siblings)
7 siblings, 2 replies; 222+ messages in thread
From: Dongdong Liu @ 2023-03-15 11:00 UTC (permalink / raw)
To: dev, ferruh.yigit, thomas, andrew.rybchenko, reshma.pattan
Cc: stable, yisen.zhuang, liudongdong3, Jie Hai, Maryam Tahhan,
Vipin Varghese, John McNamara
From: Jie Hai <haijie1@huawei.com>
Command show-port shows rss info only if rss_conf.rss_key
is not null but it will never be true. This patch allocates
memory for rss_conf.rss_key and makes it possible to show
rss info.
Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
Cc: stable@dpdk.org
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
app/proc-info/main.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 53e852a07c..878ce37e8b 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -823,6 +823,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;
/* Skip if port is not in mask */
if ((enabled_port_mask & (1ul << i)) == 0)
@@ -981,19 +982,26 @@ show_port(void)
printf("\n");
}
+ rss_key = rte_malloc(NULL,
+ dev_info.hash_key_size * sizeof(uint8_t), 0);
+ if (rss_key == NULL)
+ return;
+
+ 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);
}
+ rte_free(rss_key);
+
#ifdef RTE_LIB_SECURITY
show_security_context(i, true);
#endif
--
2.22.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 4/5] app/proc-info: show RSS types with strings
2023-03-15 11:00 [PATCH 0/5] support setting and querying RSS algorithms Dongdong Liu
` (2 preceding siblings ...)
2023-03-15 11:00 ` [PATCH 3/5] app/proc-info: fix never show RSS info Dongdong Liu
@ 2023-03-15 11:00 ` Dongdong Liu
2023-06-02 20:22 ` Ferruh Yigit
2023-03-15 11:00 ` [PATCH 5/5] app/proc-info: support querying RSS hash algorithm Dongdong Liu
` (3 subsequent siblings)
7 siblings, 1 reply; 222+ messages in thread
From: Dongdong Liu @ 2023-03-15 11:00 UTC (permalink / raw)
To: dev, ferruh.yigit, thomas, andrew.rybchenko, reshma.pattan
Cc: stable, yisen.zhuang, liudongdong3, Jie Hai, Maryam Tahhan
From: Jie Hai <haijie1@huawei.com>
show RSS types details and adjust RSS info display format as following:
- RSS info
-- hf:
ipv4 ipv4-frag ipv4-other ipv6 ipv6-frag ipv6-other
-- key len: 40
-- key (hex): 6d5a56da255b0ec24167253d43a38fb0d0ca2bcbae7b30b477cb2da38030f20c6a42b73bbeac01fa
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
app/proc-info/main.c | 120 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 113 insertions(+), 7 deletions(-)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 878ce37e8b..7b6f8f1228 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -54,6 +54,9 @@
#define STATS_BDR_STR(w, s) printf("%.*s%s%.*s\n", w, \
STATS_BDR_FMT, s, w, STATS_BDR_FMT)
+/* It is used to print the RSS types. */
+#define RSS_TYPES_CHAR_NUM_PER_LINE 64
+
/* mask of enabled ports */
static unsigned long enabled_port_mask;
/* Enable stats. */
@@ -132,6 +135,76 @@ struct desc_param {
static struct desc_param rx_desc_param;
static struct desc_param tx_desc_param;
+/* Information for a given RSS type. */
+struct rss_type_info {
+ const char *str; /* Type name. */
+ uint64_t rss_type; /* Type value. */
+};
+
+static const struct rss_type_info rss_type_table[] = {
+ /* Group types */
+ { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |
+ RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD |
+ RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP |
+ RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS | RTE_ETH_RSS_L2TPV2},
+ { "none", 0 },
+ { "ip", RTE_ETH_RSS_IP },
+ { "udp", RTE_ETH_RSS_UDP },
+ { "tcp", RTE_ETH_RSS_TCP },
+ { "sctp", RTE_ETH_RSS_SCTP },
+ { "tunnel", RTE_ETH_RSS_TUNNEL },
+ { "vlan", RTE_ETH_RSS_VLAN },
+
+ /* Individual type */
+ { "ipv4", RTE_ETH_RSS_IPV4 },
+ { "ipv4-frag", RTE_ETH_RSS_FRAG_IPV4 },
+ { "ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP },
+ { "ipv4-udp", RTE_ETH_RSS_NONFRAG_IPV4_UDP },
+ { "ipv4-sctp", RTE_ETH_RSS_NONFRAG_IPV4_SCTP },
+ { "ipv4-other", RTE_ETH_RSS_NONFRAG_IPV4_OTHER },
+ { "ipv6", RTE_ETH_RSS_IPV6 },
+ { "ipv6-frag", RTE_ETH_RSS_FRAG_IPV6 },
+ { "ipv6-tcp", RTE_ETH_RSS_NONFRAG_IPV6_TCP },
+ { "ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP },
+ { "ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP },
+ { "ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER },
+ { "l2-payload", RTE_ETH_RSS_L2_PAYLOAD },
+ { "ipv6-ex", RTE_ETH_RSS_IPV6_EX },
+ { "ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX },
+ { "ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX },
+ { "port", RTE_ETH_RSS_PORT },
+ { "vxlan", RTE_ETH_RSS_VXLAN },
+ { "geneve", RTE_ETH_RSS_GENEVE },
+ { "nvgre", RTE_ETH_RSS_NVGRE },
+ { "gtpu", RTE_ETH_RSS_GTPU },
+ { "eth", RTE_ETH_RSS_ETH },
+ { "s-vlan", RTE_ETH_RSS_S_VLAN },
+ { "c-vlan", RTE_ETH_RSS_C_VLAN },
+ { "esp", RTE_ETH_RSS_ESP },
+ { "ah", RTE_ETH_RSS_AH },
+ { "l2tpv3", RTE_ETH_RSS_L2TPV3 },
+ { "pfcp", RTE_ETH_RSS_PFCP },
+ { "pppoe", RTE_ETH_RSS_PPPOE },
+ { "ecpri", RTE_ETH_RSS_ECPRI },
+ { "mpls", RTE_ETH_RSS_MPLS },
+ { "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM },
+ { "l4-chksum", RTE_ETH_RSS_L4_CHKSUM },
+ { "l2tpv2", RTE_ETH_RSS_L2TPV2 },
+ { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
+ { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
+ { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
+ { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
+ { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
+ { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
+ { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
+ { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
+ { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
+ { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
+ { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
+ { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
+ { NULL, 0},
+};
+
/* display usage */
static void
proc_info_usage(const char *prgname)
@@ -806,6 +879,33 @@ show_offloads(uint64_t offloads,
}
}
+static void
+show_rss_types(uint64_t rss_types)
+{
+ uint16_t total_len = 0;
+ uint16_t str_len;
+ uint16_t i;
+
+ printf("\t\t");
+ for (i = 0; rss_type_table[i].str != NULL; i++) {
+ if (rss_type_table[i].rss_type == 0)
+ continue;
+
+ if ((rss_type_table[i].rss_type & rss_types) ==
+ rss_type_table[i].rss_type) {
+ /* Contain two spaces */
+ str_len = strlen(rss_type_table[i].str) + 2;
+ if (total_len + str_len > RSS_TYPES_CHAR_NUM_PER_LINE) {
+ printf("\n\t\t");
+ total_len = 0;
+ }
+ printf("%s ", rss_type_table[i].str);
+ total_len += str_len;
+ }
+ }
+ printf("\n");
+}
+
static void
show_port(void)
{
@@ -991,13 +1091,19 @@ 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):",
- 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 info\n");
+ if (rss_conf.rss_hf == 0) {
+ printf("\tRSS disabled\n");
+ } else {
+ printf("\t -- hf:\n");
+ show_rss_types(rss_conf.rss_hf);
+ 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("%02x", rss_conf.rss_key[k]);
+ printf("\n");
+ }
}
rte_free(rss_key);
--
2.22.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 5/5] app/proc-info: support querying RSS hash algorithm
2023-03-15 11:00 [PATCH 0/5] support setting and querying RSS algorithms Dongdong Liu
` (3 preceding siblings ...)
2023-03-15 11:00 ` [PATCH 4/5] app/proc-info: show RSS types with strings Dongdong Liu
@ 2023-03-15 11:00 ` Dongdong Liu
2023-08-26 7:46 ` [PATCH v2 0/5] support setting and querying RSS algorithms Jie Hai
` (2 subsequent siblings)
7 siblings, 0 replies; 222+ messages in thread
From: Dongdong Liu @ 2023-03-15 11:00 UTC (permalink / raw)
To: dev, ferruh.yigit, thomas, andrew.rybchenko, reshma.pattan
Cc: stable, yisen.zhuang, liudongdong3, Jie Hai, Maryam Tahhan
From: Jie Hai <haijie1@huawei.com>
Display RSS hash algorithm with command show-port as below.
- RSS info
-- hash algorithm: toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
app/proc-info/main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 7b6f8f1228..4c2a113a1a 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -879,6 +879,23 @@ show_offloads(uint64_t offloads,
}
}
+static const char *
+rss_func_to_str(enum rte_eth_hash_function func)
+{
+ switch (func) {
+ case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR:
+ return "simple_xor";
+ case RTE_ETH_HASH_FUNCTION_TOEPLITZ:
+ return "toeplitz";
+ case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ:
+ return "symmetric_toeplitz";
+ case RTE_ETH_HASH_FUNCTION_DEFAULT:
+ return "default";
+ default:
+ return "unknown";
+ }
+}
+
static void
show_rss_types(uint64_t rss_types)
{
@@ -1097,6 +1114,8 @@ show_port(void)
} else {
printf("\t -- hf:\n");
show_rss_types(rss_conf.rss_hf);
+ printf("\t -- hash algorithm: %s\n",
+ rss_func_to_str(rss_conf.func));
printf("\t -- key len: %u\n",
rss_conf.rss_key_len);
printf("\t -- key (hex): ");
--
2.22.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 1/5] ethdev: support setting and querying rss algorithm
2023-03-15 11:00 ` [PATCH 1/5] ethdev: support setting and querying rss algorithm Dongdong Liu
@ 2023-03-15 11:28 ` Ivan Malov
2023-03-16 13:10 ` Dongdong Liu
2023-03-15 13:43 ` Thomas Monjalon
1 sibling, 1 reply; 222+ messages in thread
From: Ivan Malov @ 2023-03-15 11:28 UTC (permalink / raw)
To: Dongdong Liu
Cc: dev, ferruh.yigit, thomas, andrew.rybchenko, reshma.pattan,
stable, yisen.zhuang, Jie Hai
Hi,
On Wed, 15 Mar 2023, Dongdong Liu wrote:
> From: Jie Hai <haijie1@huawei.com>
>
> Currently, rte_eth_rss_conf supports configuring rss hash
> functions, rss key and it's length, but not rss hash algorithm.
>
> The structure ``rte_eth_rss_conf`` is extended by adding a new field,
> "func". This represents the RSS algorithms to apply. The following
> API is affected:
> - rte_eth_dev_configure
> - rte_eth_dev_rss_hash_update
> - rte_eth_dev_rss_hash_conf_get
>
> To prevent configuration failures caused by incorrect func input, check
> this parameter in advance. If it's incorrect, a warning is generated
> and the default value is set. Do the same for rte_eth_dev_rss_hash_update
> and rte_eth_dev_configure.
>
> To check whether the drivers report the func field, it is set to default
> value before querying.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> ---
> doc/guides/rel_notes/release_23_03.rst | 4 ++--
> lib/ethdev/rte_ethdev.c | 18 ++++++++++++++++++
> lib/ethdev/rte_ethdev.h | 5 +++++
> 3 files changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst
> index af6f37389c..7879567427 100644
> --- a/doc/guides/rel_notes/release_23_03.rst
> +++ b/doc/guides/rel_notes/release_23_03.rst
> @@ -284,8 +284,8 @@ ABI Changes
> Also, make sure to start the actual text at the margin.
> =======================================================
>
> -* No ABI change that would break compatibility with 22.11.
> -
> +* ethdev: Added "func" 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 4d03255683..db561026bd 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -1368,6 +1368,15 @@ 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.func >= RTE_ETH_HASH_FUNCTION_MAX) {
> + RTE_ETHDEV_LOG(WARNING,
> + "Ethdev port_id=%u invalid rss hash function (%u), modified to default value (%u)\n",
> + port_id, dev_conf->rx_adv_conf.rss_conf.func,
> + RTE_ETH_HASH_FUNCTION_DEFAULT);
> + dev->data->dev_conf.rx_adv_conf.rss_conf.func =
> + RTE_ETH_HASH_FUNCTION_DEFAULT;
I have no strong opinion, but, to me, this behaviour conceals
programming errors. For example, if an application intends
to enable hash algorithm A but, due to a programming error,
passes a gibberish value here, chances are the error will
end up unnoticed. Especially in case the application
sets the log level to such that warnings are omitted.
Why not just return the error the standard way?
> + }
> +
> /* Check if Rx RSS distribution is disabled but RSS hash is enabled. */
> if (((dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) == 0) &&
> (dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
> @@ -4553,6 +4562,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
> return -ENOTSUP;
> }
>
> + if (rss_conf->func >= RTE_ETH_HASH_FUNCTION_MAX) {
> + RTE_ETHDEV_LOG(NOTICE,
> + "Ethdev port_id=%u invalid rss hash function (%u), modified to default value (%u)\n",
> + port_id, rss_conf->func, RTE_ETH_HASH_FUNCTION_DEFAULT);
> + rss_conf->func = RTE_ETH_HASH_FUNCTION_DEFAULT;
> + }
> +
> if (*dev->dev_ops->rss_hash_update == NULL)
> return -ENOTSUP;
> ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
> @@ -4580,6 +4596,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
> return -EINVAL;
> }
>
> + rss_conf->func = 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 99fe9e238b..5abe2cb36d 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -174,6 +174,7 @@ extern "C" {
>
> #include "rte_ethdev_trace_fp.h"
> #include "rte_dev_info.h"
> +#include "rte_flow.h"
>
> extern int rte_eth_dev_logtype;
>
> @@ -461,11 +462,15 @@ struct rte_vlan_filter_conf {
> * 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.
> + *
> + * The *func* field of the *rss_conf* structure indicates the different
> + * types of hash algorithms applied by the RSS hashing.
Consider:
The *func* field of the *rss_conf* structure indicates the algorithm to
use when computing hash. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
the PMD to use its best-effort algorithm rather than a specific one.
> */
> struct rte_eth_rss_conf {
> uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
> uint8_t rss_key_len; /**< hash key length in bytes. */
> uint64_t rss_hf; /**< Hash functions to apply - see below. */
> + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
> };
>
> /*
> --
> 2.22.0
>
>
Thank you.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 1/5] ethdev: support setting and querying rss algorithm
2023-03-15 11:00 ` [PATCH 1/5] ethdev: support setting and querying rss algorithm Dongdong Liu
2023-03-15 11:28 ` Ivan Malov
@ 2023-03-15 13:43 ` Thomas Monjalon
2023-03-16 13:16 ` Dongdong Liu
1 sibling, 1 reply; 222+ messages in thread
From: Thomas Monjalon @ 2023-03-15 13:43 UTC (permalink / raw)
To: Dongdong Liu, Jie Hai
Cc: dev, ferruh.yigit, andrew.rybchenko, reshma.pattan, stable,
yisen.zhuang, david.marchand
15/03/2023 12:00, Dongdong Liu:
> From: Jie Hai <haijie1@huawei.com>
> --- a/doc/guides/rel_notes/release_23_03.rst
> +++ b/doc/guides/rel_notes/release_23_03.rst
> -* No ABI change that would break compatibility with 22.11.
> -
> +* ethdev: Added "func" field to ``rte_eth_rss_conf`` structure for RSS hash
> + algorithm.
We cannot break ABI compatibility until 23.11.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 1/5] ethdev: support setting and querying rss algorithm
2023-03-15 11:28 ` Ivan Malov
@ 2023-03-16 13:10 ` Dongdong Liu
2023-03-16 14:31 ` Ivan Malov
0 siblings, 1 reply; 222+ messages in thread
From: Dongdong Liu @ 2023-03-16 13:10 UTC (permalink / raw)
To: Ivan Malov
Cc: dev, ferruh.yigit, thomas, andrew.rybchenko, reshma.pattan,
stable, yisen.zhuang, Jie Hai
Hi Ivan
Many thanks for your review.
On 2023/3/15 19:28, Ivan Malov wrote:
> Hi,
>
> On Wed, 15 Mar 2023, Dongdong Liu wrote:
>
>> From: Jie Hai <haijie1@huawei.com>
>>
>> Currently, rte_eth_rss_conf supports configuring rss hash
>> functions, rss key and it's length, but not rss hash algorithm.
>>
>> The structure ``rte_eth_rss_conf`` is extended by adding a new field,
>> "func". This represents the RSS algorithms to apply. The following
>> API is affected:
>> - rte_eth_dev_configure
>> - rte_eth_dev_rss_hash_update
>> - rte_eth_dev_rss_hash_conf_get
>>
>> To prevent configuration failures caused by incorrect func input, check
>> this parameter in advance. If it's incorrect, a warning is generated
>> and the default value is set. Do the same for rte_eth_dev_rss_hash_update
>> and rte_eth_dev_configure.
>>
>> To check whether the drivers report the func field, it is set to default
>> value before querying.
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> ---
>> doc/guides/rel_notes/release_23_03.rst | 4 ++--
>> lib/ethdev/rte_ethdev.c | 18 ++++++++++++++++++
>> lib/ethdev/rte_ethdev.h | 5 +++++
>> 3 files changed, 25 insertions(+), 2 deletions(-)
>>
>> diff --git a/doc/guides/rel_notes/release_23_03.rst
>> b/doc/guides/rel_notes/release_23_03.rst
>> index af6f37389c..7879567427 100644
>> --- a/doc/guides/rel_notes/release_23_03.rst
>> +++ b/doc/guides/rel_notes/release_23_03.rst
>> @@ -284,8 +284,8 @@ ABI Changes
>> Also, make sure to start the actual text at the margin.
>> =======================================================
>>
>> -* No ABI change that would break compatibility with 22.11.
>> -
>> +* ethdev: Added "func" 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 4d03255683..db561026bd 100644
>> --- a/lib/ethdev/rte_ethdev.c
>> +++ b/lib/ethdev/rte_ethdev.c
>> @@ -1368,6 +1368,15 @@ 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.func >=
>> RTE_ETH_HASH_FUNCTION_MAX) {
>> + RTE_ETHDEV_LOG(WARNING,
>> + "Ethdev port_id=%u invalid rss hash function (%u),
>> modified to default value (%u)\n",
>> + port_id, dev_conf->rx_adv_conf.rss_conf.func,
>> + RTE_ETH_HASH_FUNCTION_DEFAULT);
>> + dev->data->dev_conf.rx_adv_conf.rss_conf.func =
>> + RTE_ETH_HASH_FUNCTION_DEFAULT;
>
> I have no strong opinion, but, to me, this behaviour conceals
> programming errors. For example, if an application intends
> to enable hash algorithm A but, due to a programming error,
> passes a gibberish value here, chances are the error will
> end up unnoticed. Especially in case the application
> sets the log level to such that warnings are omitted.
Good point, will fix.
>
> Why not just return the error the standard way?
Aha, The original intention is not to break the ABI,
but I think it could not achieve that.
>
>> + }
>> +
>> /* Check if Rx RSS distribution is disabled but RSS hash is
>> enabled. */
>> if (((dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) == 0) &&
>> (dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
>> @@ -4553,6 +4562,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
>> return -ENOTSUP;
>> }
>>
>> + if (rss_conf->func >= RTE_ETH_HASH_FUNCTION_MAX) {
>> + RTE_ETHDEV_LOG(NOTICE,
>> + "Ethdev port_id=%u invalid rss hash function (%u),
>> modified to default value (%u)\n",
>> + port_id, rss_conf->func, RTE_ETH_HASH_FUNCTION_DEFAULT);
>> + rss_conf->func = RTE_ETH_HASH_FUNCTION_DEFAULT;
>> + }
>> +
>> if (*dev->dev_ops->rss_hash_update == NULL)
>> return -ENOTSUP;
>> ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
>> @@ -4580,6 +4596,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
>> return -EINVAL;
>> }
>>
>> + rss_conf->func = 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 99fe9e238b..5abe2cb36d 100644
>> --- a/lib/ethdev/rte_ethdev.h
>> +++ b/lib/ethdev/rte_ethdev.h
>> @@ -174,6 +174,7 @@ extern "C" {
>>
>> #include "rte_ethdev_trace_fp.h"
>> #include "rte_dev_info.h"
>> +#include "rte_flow.h"
>>
>> extern int rte_eth_dev_logtype;
>>
>> @@ -461,11 +462,15 @@ struct rte_vlan_filter_conf {
>> * 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.
>> + *
>> + * The *func* field of the *rss_conf* structure indicates the different
>> + * types of hash algorithms applied by the RSS hashing.
>
> Consider:
>
> The *func* field of the *rss_conf* structure indicates the algorithm to
> use when computing hash. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
> the PMD to use its best-effort algorithm rather than a specific one.
Look at some PMD drivers(i40e, hns3 etc), it seems the
RTE_ETH_HASH_FUNCTION_DEFAULT consider as no rss algorithm is set.
Thanks,
Dongdong
>
>> */
>> struct rte_eth_rss_conf {
>> uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
>> uint8_t rss_key_len; /**< hash key length in bytes. */
>> uint64_t rss_hf; /**< Hash functions to apply - see below. */
>> + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
>> };
>>
>> /*
>> --
>> 2.22.0
>>
>>
>
> Thank you.
>
> .
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 1/5] ethdev: support setting and querying rss algorithm
2023-03-15 13:43 ` Thomas Monjalon
@ 2023-03-16 13:16 ` Dongdong Liu
2023-06-02 20:19 ` Ferruh Yigit
0 siblings, 1 reply; 222+ messages in thread
From: Dongdong Liu @ 2023-03-16 13:16 UTC (permalink / raw)
To: Thomas Monjalon, Jie Hai
Cc: dev, ferruh.yigit, andrew.rybchenko, reshma.pattan, stable,
yisen.zhuang, david.marchand
Hi Thomas
On 2023/3/15 21:43, Thomas Monjalon wrote:
> 15/03/2023 12:00, Dongdong Liu:
>> From: Jie Hai <haijie1@huawei.com>
>> --- a/doc/guides/rel_notes/release_23_03.rst
>> +++ b/doc/guides/rel_notes/release_23_03.rst
>> -* No ABI change that would break compatibility with 22.11.
>> -
>> +* ethdev: Added "func" field to ``rte_eth_rss_conf`` structure for RSS hash
>> + algorithm.
>
> We cannot break ABI compatibility until 23.11.
Got it. Thank you for reminding.
[PATCH 3/5] and [PATCH 4/5] do not relate with this ABI compatibility.
I will send them separately.
Thanks,
Dongdong
>
>
>
> .
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 1/5] ethdev: support setting and querying rss algorithm
2023-03-16 13:10 ` Dongdong Liu
@ 2023-03-16 14:31 ` Ivan Malov
0 siblings, 0 replies; 222+ messages in thread
From: Ivan Malov @ 2023-03-16 14:31 UTC (permalink / raw)
To: Dongdong Liu
Cc: dev, ferruh.yigit, thomas, andrew.rybchenko, reshma.pattan,
stable, yisen.zhuang, Jie Hai
Hi,
Thanks for responding and PSB.
On Thu, 16 Mar 2023, Dongdong Liu wrote:
> Hi Ivan
>
> Many thanks for your review.
>
> On 2023/3/15 19:28, Ivan Malov wrote:
>> Hi,
>>
>> On Wed, 15 Mar 2023, Dongdong Liu wrote:
>>
>>> From: Jie Hai <haijie1@huawei.com>
>>>
>>> Currently, rte_eth_rss_conf supports configuring rss hash
>>> functions, rss key and it's length, but not rss hash algorithm.
>>>
>>> The structure ``rte_eth_rss_conf`` is extended by adding a new field,
>>> "func". This represents the RSS algorithms to apply. The following
>>> API is affected:
>>> - rte_eth_dev_configure
>>> - rte_eth_dev_rss_hash_update
>>> - rte_eth_dev_rss_hash_conf_get
>>>
>>> To prevent configuration failures caused by incorrect func input, check
>>> this parameter in advance. If it's incorrect, a warning is generated
>>> and the default value is set. Do the same for rte_eth_dev_rss_hash_update
>>> and rte_eth_dev_configure.
>>>
>>> To check whether the drivers report the func field, it is set to default
>>> value before querying.
>>>
>>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>>> ---
>>> doc/guides/rel_notes/release_23_03.rst | 4 ++--
>>> lib/ethdev/rte_ethdev.c | 18 ++++++++++++++++++
>>> lib/ethdev/rte_ethdev.h | 5 +++++
>>> 3 files changed, 25 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/doc/guides/rel_notes/release_23_03.rst
>>> b/doc/guides/rel_notes/release_23_03.rst
>>> index af6f37389c..7879567427 100644
>>> --- a/doc/guides/rel_notes/release_23_03.rst
>>> +++ b/doc/guides/rel_notes/release_23_03.rst
>>> @@ -284,8 +284,8 @@ ABI Changes
>>> Also, make sure to start the actual text at the margin.
>>> =======================================================
>>>
>>> -* No ABI change that would break compatibility with 22.11.
>>> -
>>> +* ethdev: Added "func" 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 4d03255683..db561026bd 100644
>>> --- a/lib/ethdev/rte_ethdev.c
>>> +++ b/lib/ethdev/rte_ethdev.c
>>> @@ -1368,6 +1368,15 @@ 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.func >=
>>> RTE_ETH_HASH_FUNCTION_MAX) {
>>> + RTE_ETHDEV_LOG(WARNING,
>>> + "Ethdev port_id=%u invalid rss hash function (%u),
>>> modified to default value (%u)\n",
>>> + port_id, dev_conf->rx_adv_conf.rss_conf.func,
>>> + RTE_ETH_HASH_FUNCTION_DEFAULT);
>>> + dev->data->dev_conf.rx_adv_conf.rss_conf.func =
>>> + RTE_ETH_HASH_FUNCTION_DEFAULT;
>>
>> I have no strong opinion, but, to me, this behaviour conceals
>> programming errors. For example, if an application intends
>> to enable hash algorithm A but, due to a programming error,
>> passes a gibberish value here, chances are the error will
>> end up unnoticed. Especially in case the application
>> sets the log level to such that warnings are omitted.
> Good point, will fix.
>>
>> Why not just return the error the standard way?
>
> Aha, The original intention is not to break the ABI,
> but I think it could not achieve that.
>>
>>> + }
>>> +
>>> /* Check if Rx RSS distribution is disabled but RSS hash is
>>> enabled. */
>>> if (((dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) == 0) &&
>>> (dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
>>> @@ -4553,6 +4562,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
>>> return -ENOTSUP;
>>> }
>>>
>>> + if (rss_conf->func >= RTE_ETH_HASH_FUNCTION_MAX) {
>>> + RTE_ETHDEV_LOG(NOTICE,
>>> + "Ethdev port_id=%u invalid rss hash function (%u),
>>> modified to default value (%u)\n",
>>> + port_id, rss_conf->func, RTE_ETH_HASH_FUNCTION_DEFAULT);
>>> + rss_conf->func = RTE_ETH_HASH_FUNCTION_DEFAULT;
>>> + }
>>> +
>>> if (*dev->dev_ops->rss_hash_update == NULL)
>>> return -ENOTSUP;
>>> ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
>>> @@ -4580,6 +4596,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
>>> return -EINVAL;
>>> }
>>>
>>> + rss_conf->func = 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 99fe9e238b..5abe2cb36d 100644
>>> --- a/lib/ethdev/rte_ethdev.h
>>> +++ b/lib/ethdev/rte_ethdev.h
>>> @@ -174,6 +174,7 @@ extern "C" {
>>>
>>> #include "rte_ethdev_trace_fp.h"
>>> #include "rte_dev_info.h"
>>> +#include "rte_flow.h"
>>>
>>> extern int rte_eth_dev_logtype;
>>>
>>> @@ -461,11 +462,15 @@ struct rte_vlan_filter_conf {
>>> * 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.
>>> + *
>>> + * The *func* field of the *rss_conf* structure indicates the different
>>> + * types of hash algorithms applied by the RSS hashing.
>>
>> Consider:
>>
>> The *func* field of the *rss_conf* structure indicates the algorithm to
>> use when computing hash. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
>> the PMD to use its best-effort algorithm rather than a specific one.
>
> Look at some PMD drivers(i40e, hns3 etc), it seems the
> RTE_ETH_HASH_FUNCTION_DEFAULT consider as no rss algorithm is set.
This does not seem to contradict the suggested description.
If they, however, treat this as "no RSS at all", then
perhaps it is a mistake, because if the user requests
Rx MQ mode "RSS" and selects algorithm DEFAULT, this
is clearly not the same as "no RSS". Not by a long
shot. Because for "no RSS" the user would have
passed MQ mode choice "NONE", I take it.
>
> Thanks,
> Dongdong
>>
>>> */
>>> struct rte_eth_rss_conf {
>>> uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
>>> uint8_t rss_key_len; /**< hash key length in bytes. */
>>> uint64_t rss_hf; /**< Hash functions to apply - see below. */
>>> + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
>>> };
>>>
>>> /*
>>> --
>>> 2.22.0
>>>
>>>
>>
>> Thank you.
>>
>> .
>>
>
Thank you.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 1/5] ethdev: support setting and querying rss algorithm
2023-03-16 13:16 ` Dongdong Liu
@ 2023-06-02 20:19 ` Ferruh Yigit
2023-06-05 12:34 ` Dongdong Liu
0 siblings, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-06-02 20:19 UTC (permalink / raw)
To: Dongdong Liu, Thomas Monjalon, Jie Hai
Cc: dev, andrew.rybchenko, reshma.pattan, stable, yisen.zhuang,
david.marchand
On 3/16/2023 1:16 PM, Dongdong Liu wrote:
> Hi Thomas
> On 2023/3/15 21:43, Thomas Monjalon wrote:
>> 15/03/2023 12:00, Dongdong Liu:
>>> From: Jie Hai <haijie1@huawei.com>
>>> --- a/doc/guides/rel_notes/release_23_03.rst
>>> +++ b/doc/guides/rel_notes/release_23_03.rst
>>> -* No ABI change that would break compatibility with 22.11.
>>> -
>>> +* ethdev: Added "func" field to ``rte_eth_rss_conf`` structure for
>>> RSS hash
>>> + algorithm.
>>
>> We cannot break ABI compatibility until 23.11.
> Got it. Thank you for reminding.
>
Hi Dongdong,
Please remember to send a deprecation notice for this release.
Deprecation notice should be merged in this release so that it can be
applied in v23.11
> [PATCH 3/5] and [PATCH 4/5] do not relate with this ABI compatibility.
> I will send them separately.
>
> Thanks,
> Dongdong
>>
>>
>>
>> .
>>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 3/5] app/proc-info: fix never show RSS info
2023-03-15 11:00 ` [PATCH 3/5] app/proc-info: fix never show RSS info Dongdong Liu
@ 2023-06-02 20:19 ` Ferruh Yigit
2023-06-05 13:04 ` Dongdong Liu
2023-06-02 21:19 ` Stephen Hemminger
1 sibling, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-06-02 20:19 UTC (permalink / raw)
To: Dongdong Liu, dev, thomas, andrew.rybchenko, reshma.pattan
Cc: stable, yisen.zhuang, Jie Hai, Maryam Tahhan, Vipin Varghese,
John McNamara
On 3/15/2023 11:00 AM, Dongdong Liu wrote:
> From: Jie Hai <haijie1@huawei.com>
>
> Command show-port shows rss info only if rss_conf.rss_key
> is not null but it will never be true. This patch allocates
> memory for rss_conf.rss_key and makes it possible to show
> rss info.
>
Why 'rss_conf.rss_key == NULL' case is never true?
'rss_key' is pointer and 'rte_eth_dev_rss_hash_conf_get()' doesn't
allocate it, so can't it be NULL?
> Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
> Cc: stable@dpdk.org
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> ---
> app/proc-info/main.c | 26 +++++++++++++++++---------
> 1 file changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/app/proc-info/main.c b/app/proc-info/main.c
> index 53e852a07c..878ce37e8b 100644
> --- a/app/proc-info/main.c
> +++ b/app/proc-info/main.c
> @@ -823,6 +823,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;
>
> /* Skip if port is not in mask */
> if ((enabled_port_mask & (1ul << i)) == 0)
> @@ -981,19 +982,26 @@ show_port(void)
> printf("\n");
> }
>
> + rss_key = rte_malloc(NULL,
> + dev_info.hash_key_size * sizeof(uint8_t), 0);
> + if (rss_key == NULL)
> + return;
> +
> + 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);
> }
>
> + rte_free(rss_key);
> +
> #ifdef RTE_LIB_SECURITY
> show_security_context(i, true);
> #endif
> --
> 2.22.0
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 4/5] app/proc-info: show RSS types with strings
2023-03-15 11:00 ` [PATCH 4/5] app/proc-info: show RSS types with strings Dongdong Liu
@ 2023-06-02 20:22 ` Ferruh Yigit
2023-06-05 13:12 ` Dongdong Liu
0 siblings, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-06-02 20:22 UTC (permalink / raw)
To: Dongdong Liu, dev, thomas, andrew.rybchenko, reshma.pattan
Cc: stable, yisen.zhuang, Jie Hai, Maryam Tahhan
On 3/15/2023 11:00 AM, Dongdong Liu wrote:
> From: Jie Hai <haijie1@huawei.com>
>
> show RSS types details and adjust RSS info display format as following:
>
> - RSS info
> -- hf:
> ipv4 ipv4-frag ipv4-other ipv6 ipv6-frag ipv6-other
> -- key len: 40
> -- key (hex): 6d5a56da255b0ec24167253d43a38fb0d0ca2bcbae7b30b477cb2da38030f20c6a42b73bbeac01fa
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> ---
> app/proc-info/main.c | 120 ++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 113 insertions(+), 7 deletions(-)
>
> diff --git a/app/proc-info/main.c b/app/proc-info/main.c
> index 878ce37e8b..7b6f8f1228 100644
> --- a/app/proc-info/main.c
> +++ b/app/proc-info/main.c
> @@ -54,6 +54,9 @@
> #define STATS_BDR_STR(w, s) printf("%.*s%s%.*s\n", w, \
> STATS_BDR_FMT, s, w, STATS_BDR_FMT)
>
> +/* It is used to print the RSS types. */
> +#define RSS_TYPES_CHAR_NUM_PER_LINE 64
> +
> /* mask of enabled ports */
> static unsigned long enabled_port_mask;
> /* Enable stats. */
> @@ -132,6 +135,76 @@ struct desc_param {
> static struct desc_param rx_desc_param;
> static struct desc_param tx_desc_param;
>
> +/* Information for a given RSS type. */
> +struct rss_type_info {
> + const char *str; /* Type name. */
> + uint64_t rss_type; /* Type value. */
> +};
> +
> +static const struct rss_type_info rss_type_table[] = {
> + /* Group types */
> + { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |
> + RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD |
> + RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP |
> + RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS | RTE_ETH_RSS_L2TPV2},
> + { "none", 0 },
> + { "ip", RTE_ETH_RSS_IP },
> + { "udp", RTE_ETH_RSS_UDP },
> + { "tcp", RTE_ETH_RSS_TCP },
> + { "sctp", RTE_ETH_RSS_SCTP },
> + { "tunnel", RTE_ETH_RSS_TUNNEL },
> + { "vlan", RTE_ETH_RSS_VLAN },
> +
> + /* Individual type */
> + { "ipv4", RTE_ETH_RSS_IPV4 },
> + { "ipv4-frag", RTE_ETH_RSS_FRAG_IPV4 },
> + { "ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP },
> + { "ipv4-udp", RTE_ETH_RSS_NONFRAG_IPV4_UDP },
> + { "ipv4-sctp", RTE_ETH_RSS_NONFRAG_IPV4_SCTP },
> + { "ipv4-other", RTE_ETH_RSS_NONFRAG_IPV4_OTHER },
> + { "ipv6", RTE_ETH_RSS_IPV6 },
> + { "ipv6-frag", RTE_ETH_RSS_FRAG_IPV6 },
> + { "ipv6-tcp", RTE_ETH_RSS_NONFRAG_IPV6_TCP },
> + { "ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP },
> + { "ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP },
> + { "ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER },
> + { "l2-payload", RTE_ETH_RSS_L2_PAYLOAD },
> + { "ipv6-ex", RTE_ETH_RSS_IPV6_EX },
> + { "ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX },
> + { "ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX },
> + { "port", RTE_ETH_RSS_PORT },
> + { "vxlan", RTE_ETH_RSS_VXLAN },
> + { "geneve", RTE_ETH_RSS_GENEVE },
> + { "nvgre", RTE_ETH_RSS_NVGRE },
> + { "gtpu", RTE_ETH_RSS_GTPU },
> + { "eth", RTE_ETH_RSS_ETH },
> + { "s-vlan", RTE_ETH_RSS_S_VLAN },
> + { "c-vlan", RTE_ETH_RSS_C_VLAN },
> + { "esp", RTE_ETH_RSS_ESP },
> + { "ah", RTE_ETH_RSS_AH },
> + { "l2tpv3", RTE_ETH_RSS_L2TPV3 },
> + { "pfcp", RTE_ETH_RSS_PFCP },
> + { "pppoe", RTE_ETH_RSS_PPPOE },
> + { "ecpri", RTE_ETH_RSS_ECPRI },
> + { "mpls", RTE_ETH_RSS_MPLS },
> + { "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM },
> + { "l4-chksum", RTE_ETH_RSS_L4_CHKSUM },
> + { "l2tpv2", RTE_ETH_RSS_L2TPV2 },
> + { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
> + { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
> + { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
> + { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
> + { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
> + { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
> + { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
> + { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
> + { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
> + { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
> + { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
> + { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
> + { NULL, 0},
> +};
> +
Agree this makes output more user friendly, but this brings something to
maintain in the application, and I am almost sure that it will become
outdated by time as new RSS types added.
One option is to add this as an API in the library, so it will be easier
to keep up to date, and use API from here. But not sure if it worths to
have new API for this?
> /* display usage */
> static void
> proc_info_usage(const char *prgname)
> @@ -806,6 +879,33 @@ show_offloads(uint64_t offloads,
> }
> }
>
> +static void
> +show_rss_types(uint64_t rss_types)
> +{
> + uint16_t total_len = 0;
> + uint16_t str_len;
> + uint16_t i;
> +
> + printf("\t\t");
> + for (i = 0; rss_type_table[i].str != NULL; i++) {
> + if (rss_type_table[i].rss_type == 0)
> + continue;
> +
> + if ((rss_type_table[i].rss_type & rss_types) ==
> + rss_type_table[i].rss_type) {
> + /* Contain two spaces */
> + str_len = strlen(rss_type_table[i].str) + 2;
> + if (total_len + str_len > RSS_TYPES_CHAR_NUM_PER_LINE) {
> + printf("\n\t\t");
> + total_len = 0;
> + }
> + printf("%s ", rss_type_table[i].str);
> + total_len += str_len;
> + }
> + }
> + printf("\n");
> +}
> +
> static void
> show_port(void)
> {
> @@ -991,13 +1091,19 @@ 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):",
> - 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 info\n");
> + if (rss_conf.rss_hf == 0) {
> + printf("\tRSS disabled\n");
> + } else {
> + printf("\t -- hf:\n");
> + show_rss_types(rss_conf.rss_hf);
> + 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("%02x", rss_conf.rss_key[k]);
> + printf("\n");
> + }
> }
>
> rte_free(rss_key);
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 3/5] app/proc-info: fix never show RSS info
2023-03-15 11:00 ` [PATCH 3/5] app/proc-info: fix never show RSS info Dongdong Liu
2023-06-02 20:19 ` Ferruh Yigit
@ 2023-06-02 21:19 ` Stephen Hemminger
2023-06-05 13:07 ` Dongdong Liu
1 sibling, 1 reply; 222+ messages in thread
From: Stephen Hemminger @ 2023-06-02 21:19 UTC (permalink / raw)
To: Dongdong Liu
Cc: dev, ferruh.yigit, thomas, andrew.rybchenko, reshma.pattan,
stable, yisen.zhuang, Jie Hai, Maryam Tahhan, Vipin Varghese,
John McNamara
On Wed, 15 Mar 2023 19:00:31 +0800
Dongdong Liu <liudongdong3@huawei.com> wrote:
> + rss_key = rte_malloc(NULL,
> + dev_info.hash_key_size * sizeof(uint8_t), 0);
> + if (rss_key == NULL)
> + return;
Don't use rte_malloc() unless this is a structure that needs to be
shared between primary/secondary. In this case it doesn't need to be shared;
so just use calloc().
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 1/5] ethdev: support setting and querying rss algorithm
2023-06-02 20:19 ` Ferruh Yigit
@ 2023-06-05 12:34 ` Dongdong Liu
0 siblings, 0 replies; 222+ messages in thread
From: Dongdong Liu @ 2023-06-05 12:34 UTC (permalink / raw)
To: Ferruh Yigit, Thomas Monjalon, Jie Hai
Cc: dev, andrew.rybchenko, reshma.pattan, stable, yisen.zhuang,
david.marchand
Hi Ferruh
On 2023/6/3 4:19, Ferruh Yigit wrote:
> On 3/16/2023 1:16 PM, Dongdong Liu wrote:
>> Hi Thomas
>> On 2023/3/15 21:43, Thomas Monjalon wrote:
>>> 15/03/2023 12:00, Dongdong Liu:
>>>> From: Jie Hai <haijie1@huawei.com>
>>>> --- a/doc/guides/rel_notes/release_23_03.rst
>>>> +++ b/doc/guides/rel_notes/release_23_03.rst
>>>> -* No ABI change that would break compatibility with 22.11.
>>>> -
>>>> +* ethdev: Added "func" field to ``rte_eth_rss_conf`` structure for
>>>> RSS hash
>>>> + algorithm.
>>>
>>> We cannot break ABI compatibility until 23.11.
>> Got it. Thank you for reminding.
>>
>
> Hi Dongdong,
>
> Please remember to send a deprecation notice for this release.
> Deprecation notice should be merged in this release so that it can be
> applied in v23.11
Thanks for pointing that.
Will do.
Thanks,
Dongdong
>
>
>> [PATCH 3/5] and [PATCH 4/5] do not relate with this ABI compatibility.
>> I will send them separately.
>>
>> Thanks,
>> Dongdong
>>>
>>>
>>>
>>> .
>>>
>
> .
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 3/5] app/proc-info: fix never show RSS info
2023-06-02 20:19 ` Ferruh Yigit
@ 2023-06-05 13:04 ` Dongdong Liu
0 siblings, 0 replies; 222+ messages in thread
From: Dongdong Liu @ 2023-06-05 13:04 UTC (permalink / raw)
To: Ferruh Yigit, dev, thomas, andrew.rybchenko, reshma.pattan
Cc: stable, yisen.zhuang, Jie Hai, Maryam Tahhan, Vipin Varghese,
John McNamara
Hi Ferruh
On 2023/6/3 4:19, Ferruh Yigit wrote:
> On 3/15/2023 11:00 AM, Dongdong Liu wrote:
>
>> From: Jie Hai <haijie1@huawei.com>
>>
>> Command show-port shows rss info only if rss_conf.rss_key
>> is not null but it will never be true. This patch allocates
>> memory for rss_conf.rss_key and makes it possible to show
>> rss info.
>>
>
> Why 'rss_conf.rss_key == NULL' case is never true?
>
> 'rss_key' is pointer and 'rte_eth_dev_rss_hash_conf_get()' doesn't
> allocate it, so can't it be NULL?
The code want to show rss info (rss_key, len and rss_hf),
but it does not allocate memory for rss_conf.rss_key,
so current code rss_conf.rss_key will be always NULL,
This patch fixes that.
Maybe the description of commit message is not correct,
will fix that.
Thanks,
Dongdong
>
>
>> Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> ---
>> app/proc-info/main.c | 26 +++++++++++++++++---------
>> 1 file changed, 17 insertions(+), 9 deletions(-)
>>
>> diff --git a/app/proc-info/main.c b/app/proc-info/main.c
>> index 53e852a07c..878ce37e8b 100644
>> --- a/app/proc-info/main.c
>> +++ b/app/proc-info/main.c
>> @@ -823,6 +823,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;
>>
>> /* Skip if port is not in mask */
>> if ((enabled_port_mask & (1ul << i)) == 0)
>> @@ -981,19 +982,26 @@ show_port(void)
>> printf("\n");
>> }
>>
>> + rss_key = rte_malloc(NULL,
>> + dev_info.hash_key_size * sizeof(uint8_t), 0);
>> + if (rss_key == NULL)
>> + return;
>> +
>> + 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);
>> }
>>
>> + rte_free(rss_key);
>> +
>> #ifdef RTE_LIB_SECURITY
>> show_security_context(i, true);
>> #endif
>> --
>> 2.22.0
>>
>
> .
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 3/5] app/proc-info: fix never show RSS info
2023-06-02 21:19 ` Stephen Hemminger
@ 2023-06-05 13:07 ` Dongdong Liu
0 siblings, 0 replies; 222+ messages in thread
From: Dongdong Liu @ 2023-06-05 13:07 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, ferruh.yigit, thomas, andrew.rybchenko, reshma.pattan,
stable, yisen.zhuang, Jie Hai, Maryam Tahhan, Vipin Varghese,
John McNamara
Hi Stephen
On 2023/6/3 5:19, Stephen Hemminger wrote:
> On Wed, 15 Mar 2023 19:00:31 +0800
> Dongdong Liu <liudongdong3@huawei.com> wrote:
>
>> + rss_key = rte_malloc(NULL,
>> + dev_info.hash_key_size * sizeof(uint8_t), 0);
>> + if (rss_key == NULL)
>> + return;
>
> Don't use rte_malloc() unless this is a structure that needs to be
> shared between primary/secondary. In this case it doesn't need to be shared;
> so just use calloc().
Thanks for pointing that,
Will do.
Thanks,
Dongdong
> .
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 4/5] app/proc-info: show RSS types with strings
2023-06-02 20:22 ` Ferruh Yigit
@ 2023-06-05 13:12 ` Dongdong Liu
0 siblings, 0 replies; 222+ messages in thread
From: Dongdong Liu @ 2023-06-05 13:12 UTC (permalink / raw)
To: Ferruh Yigit, dev, thomas, andrew.rybchenko, reshma.pattan
Cc: stable, yisen.zhuang, Jie Hai, Maryam Tahhan
Hi Ferruh
On 2023/6/3 4:22, Ferruh Yigit wrote:
> On 3/15/2023 11:00 AM, Dongdong Liu wrote:
>> From: Jie Hai <haijie1@huawei.com>
>>
>> show RSS types details and adjust RSS info display format as following:
>>
>> - RSS info
>> -- hf:
>> ipv4 ipv4-frag ipv4-other ipv6 ipv6-frag ipv6-other
>> -- key len: 40
>> -- key (hex): 6d5a56da255b0ec24167253d43a38fb0d0ca2bcbae7b30b477cb2da38030f20c6a42b73bbeac01fa
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> ---
>> app/proc-info/main.c | 120 ++++++++++++++++++++++++++++++++++++++++---
>> 1 file changed, 113 insertions(+), 7 deletions(-)
>>
>> diff --git a/app/proc-info/main.c b/app/proc-info/main.c
>> index 878ce37e8b..7b6f8f1228 100644
>> --- a/app/proc-info/main.c
>> +++ b/app/proc-info/main.c
>> @@ -54,6 +54,9 @@
>> #define STATS_BDR_STR(w, s) printf("%.*s%s%.*s\n", w, \
>> STATS_BDR_FMT, s, w, STATS_BDR_FMT)
>>
>> +/* It is used to print the RSS types. */
>> +#define RSS_TYPES_CHAR_NUM_PER_LINE 64
>> +
>> /* mask of enabled ports */
>> static unsigned long enabled_port_mask;
>> /* Enable stats. */
>> @@ -132,6 +135,76 @@ struct desc_param {
>> static struct desc_param rx_desc_param;
>> static struct desc_param tx_desc_param;
>>
>> +/* Information for a given RSS type. */
>> +struct rss_type_info {
>> + const char *str; /* Type name. */
>> + uint64_t rss_type; /* Type value. */
>> +};
>> +
>> +static const struct rss_type_info rss_type_table[] = {
>> + /* Group types */
>> + { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |
>> + RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD |
>> + RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP |
>> + RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS | RTE_ETH_RSS_L2TPV2},
>> + { "none", 0 },
>> + { "ip", RTE_ETH_RSS_IP },
>> + { "udp", RTE_ETH_RSS_UDP },
>> + { "tcp", RTE_ETH_RSS_TCP },
>> + { "sctp", RTE_ETH_RSS_SCTP },
>> + { "tunnel", RTE_ETH_RSS_TUNNEL },
>> + { "vlan", RTE_ETH_RSS_VLAN },
>> +
>> + /* Individual type */
>> + { "ipv4", RTE_ETH_RSS_IPV4 },
>> + { "ipv4-frag", RTE_ETH_RSS_FRAG_IPV4 },
>> + { "ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP },
>> + { "ipv4-udp", RTE_ETH_RSS_NONFRAG_IPV4_UDP },
>> + { "ipv4-sctp", RTE_ETH_RSS_NONFRAG_IPV4_SCTP },
>> + { "ipv4-other", RTE_ETH_RSS_NONFRAG_IPV4_OTHER },
>> + { "ipv6", RTE_ETH_RSS_IPV6 },
>> + { "ipv6-frag", RTE_ETH_RSS_FRAG_IPV6 },
>> + { "ipv6-tcp", RTE_ETH_RSS_NONFRAG_IPV6_TCP },
>> + { "ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP },
>> + { "ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP },
>> + { "ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER },
>> + { "l2-payload", RTE_ETH_RSS_L2_PAYLOAD },
>> + { "ipv6-ex", RTE_ETH_RSS_IPV6_EX },
>> + { "ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX },
>> + { "ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX },
>> + { "port", RTE_ETH_RSS_PORT },
>> + { "vxlan", RTE_ETH_RSS_VXLAN },
>> + { "geneve", RTE_ETH_RSS_GENEVE },
>> + { "nvgre", RTE_ETH_RSS_NVGRE },
>> + { "gtpu", RTE_ETH_RSS_GTPU },
>> + { "eth", RTE_ETH_RSS_ETH },
>> + { "s-vlan", RTE_ETH_RSS_S_VLAN },
>> + { "c-vlan", RTE_ETH_RSS_C_VLAN },
>> + { "esp", RTE_ETH_RSS_ESP },
>> + { "ah", RTE_ETH_RSS_AH },
>> + { "l2tpv3", RTE_ETH_RSS_L2TPV3 },
>> + { "pfcp", RTE_ETH_RSS_PFCP },
>> + { "pppoe", RTE_ETH_RSS_PPPOE },
>> + { "ecpri", RTE_ETH_RSS_ECPRI },
>> + { "mpls", RTE_ETH_RSS_MPLS },
>> + { "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM },
>> + { "l4-chksum", RTE_ETH_RSS_L4_CHKSUM },
>> + { "l2tpv2", RTE_ETH_RSS_L2TPV2 },
>> + { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
>> + { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
>> + { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
>> + { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
>> + { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
>> + { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
>> + { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
>> + { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
>> + { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
>> + { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
>> + { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
>> + { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
>> + { NULL, 0},
>> +};
>> +
>
> Agree this makes output more user friendly, but this brings something to
> maintain in the application, and I am almost sure that it will become
> outdated by time as new RSS types added.
That's true.
>
> One option is to add this as an API in the library, so it will be easier
> to keep up to date, and use API from here. But not sure if it worths to
> have new API for this?
I will consider that.
Thanks,
Dongdong.
>
>> /* display usage */
>> static void
>> proc_info_usage(const char *prgname)
>> @@ -806,6 +879,33 @@ show_offloads(uint64_t offloads,
>> }
>> }
>>
>> +static void
>> +show_rss_types(uint64_t rss_types)
>> +{
>> + uint16_t total_len = 0;
>> + uint16_t str_len;
>> + uint16_t i;
>> +
>> + printf("\t\t");
>> + for (i = 0; rss_type_table[i].str != NULL; i++) {
>> + if (rss_type_table[i].rss_type == 0)
>> + continue;
>> +
>> + if ((rss_type_table[i].rss_type & rss_types) ==
>> + rss_type_table[i].rss_type) {
>> + /* Contain two spaces */
>> + str_len = strlen(rss_type_table[i].str) + 2;
>> + if (total_len + str_len > RSS_TYPES_CHAR_NUM_PER_LINE) {
>> + printf("\n\t\t");
>> + total_len = 0;
>> + }
>> + printf("%s ", rss_type_table[i].str);
>> + total_len += str_len;
>> + }
>> + }
>> + printf("\n");
>> +}
>> +
>> static void
>> show_port(void)
>> {
>> @@ -991,13 +1091,19 @@ 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):",
>> - 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 info\n");
>> + if (rss_conf.rss_hf == 0) {
>> + printf("\tRSS disabled\n");
>> + } else {
>> + printf("\t -- hf:\n");
>> + show_rss_types(rss_conf.rss_hf);
>> + 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("%02x", rss_conf.rss_key[k]);
>> + printf("\n");
>> + }
>> }
>>
>> rte_free(rss_key);
>
> .
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v2 0/5] support setting and querying RSS algorithms
2023-03-15 11:00 [PATCH 0/5] support setting and querying RSS algorithms Dongdong Liu
` (4 preceding siblings ...)
2023-03-15 11:00 ` [PATCH 5/5] app/proc-info: support querying RSS hash algorithm Dongdong Liu
@ 2023-08-26 7:46 ` Jie Hai
2023-08-26 7:46 ` [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm Jie Hai
` (6 more replies)
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
7 siblings, 7 replies; 222+ messages in thread
From: Jie Hai @ 2023-08-26 7:46 UTC (permalink / raw)
To: dev; +Cc: liudongdong3, haijie1
This patchset is to support setting and querying RSS algorithms.
--
v2:
1. return error if "func" is invalid.
2. modify the comments of the "func" field.
3. modify commit log of patch [3/5].
4. use malloc instead of rte_malloc.
5. adjust display format of RSS info.
6. remove the string display of rss_hf.
--
Huisong Li (1):
net/hns3: support setting and querying RSS hash function
Jie Hai (4):
ethdev: support setting and querying rss algorithm
app/proc-info: fix never show RSS info
app/proc-info: adjust the display format of RSS info
app/proc-info: support querying RSS hash algorithm
app/proc-info/main.c | 45 +++++++++++++++++++-----
doc/guides/rel_notes/release_23_11.rst | 2 ++
drivers/net/hns3/hns3_rss.c | 47 +++++++++++++++-----------
lib/ethdev/rte_ethdev.c | 17 ++++++++++
lib/ethdev/rte_ethdev.h | 6 ++++
5 files changed, 88 insertions(+), 29 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-08-26 7:46 ` [PATCH v2 0/5] support setting and querying RSS algorithms Jie Hai
@ 2023-08-26 7:46 ` Jie Hai
2023-08-30 11:46 ` Thomas Monjalon
2023-09-06 15:10 ` Stephen Hemminger
2023-08-26 7:46 ` [PATCH v2 2/5] net/hns3: support setting and querying RSS hash function Jie Hai
` (5 subsequent siblings)
6 siblings, 2 replies; 222+ messages in thread
From: Jie Hai @ 2023-08-26 7:46 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
Cc: liudongdong3, haijie1
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_rss_conf`` is extended by adding a new
field "func". This represents the RSS algorithms to apply. The
following API is affected:
- rte_eth_dev_configure
- rte_eth_dev_rss_hash_update
- rte_eth_dev_rss_hash_conf_get
If the value of "func" used for configuration is a gibberish
value, report the error and return. Do the same for
rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
To check whether the drivers report the "func" field, it is set
to default value before querying.
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
doc/guides/rel_notes/release_23_11.rst | 2 ++
lib/ethdev/rte_ethdev.c | 17 +++++++++++++++++
lib/ethdev/rte_ethdev.h | 6 ++++++
3 files changed, 25 insertions(+)
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 4411bb32c195..3746436e8bc9 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -123,6 +123,8 @@ ABI Changes
Also, make sure to start the actual text at the margin.
=======================================================
+ * ethdev: Added "func" 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 0840d2b5942a..4cbcdb344cac 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1445,6 +1445,14 @@ 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.func >= RTE_ETH_HASH_FUNCTION_MAX) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ethdev port_id=%u invalid rss hash function (%u)\n",
+ port_id, dev_conf->rx_adv_conf.rss_conf.func);
+ ret = -EINVAL;
+ goto rollback;
+ }
+
/* Check if Rx RSS distribution is disabled but RSS hash is enabled. */
if (((dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) == 0) &&
(dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
@@ -4630,6 +4638,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
return -ENOTSUP;
}
+ if (rss_conf->func >= RTE_ETH_HASH_FUNCTION_MAX) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ethdev port_id=%u invalid rss hash function (%u)\n",
+ port_id, rss_conf->func);
+ return -EINVAL;
+ }
+
if (*dev->dev_ops->rss_hash_update == NULL)
return -ENOTSUP;
ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
@@ -4657,6 +4672,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
return -EINVAL;
}
+ rss_conf->func = 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 04a2564f222a..1bb5f23059ca 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -174,6 +174,7 @@ extern "C" {
#include "rte_ethdev_trace_fp.h"
#include "rte_dev_info.h"
+#include "rte_flow.h"
extern int rte_eth_dev_logtype;
@@ -461,11 +462,16 @@ struct rte_vlan_filter_conf {
* 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.
+ *
+ * The *func* field of the *rss_conf* structure indicates the hash algorithm
+ * applied by the RSS hashing. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
+ * the PMD to use its best-effort algorithm rather than a specific one.
*/
struct rte_eth_rss_conf {
uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
uint8_t rss_key_len; /**< hash key length in bytes. */
uint64_t rss_hf; /**< Hash functions to apply - see below. */
+ enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
};
/*
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v2 2/5] net/hns3: support setting and querying RSS hash function
2023-08-26 7:46 ` [PATCH v2 0/5] support setting and querying RSS algorithms Jie Hai
2023-08-26 7:46 ` [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-08-26 7:46 ` Jie Hai
2023-08-26 7:46 ` [PATCH v2 3/5] app/proc-info: fix never show RSS info Jie Hai
` (4 subsequent siblings)
6 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-08-26 7:46 UTC (permalink / raw)
To: dev, Dongdong Liu, Yisen Zhuang; +Cc: haijie1
From: Huisong Li <lihuisong@huawei.com>
Support setting and querying RSS hash function by ethdev ops.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
| 47 +++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 20 deletions(-)
--git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c
index 6126512bd780..c8346d43d15c 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->func, key, key_len);
+ if (ret != 0)
+ goto set_algo_key_fail;
+
+ if (rss_conf->func != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ hw->rss_info.hash_algo = hns3_hash_func_map[rss_conf->func];
+ 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->func = hash_func_map[hash_algo];
-out:
- rte_spinlock_unlock(&hw->lock);
-
- return ret;
+ return 0;
}
/*
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v2 3/5] app/proc-info: fix never show RSS info
2023-08-26 7:46 ` [PATCH v2 0/5] support setting and querying RSS algorithms Jie Hai
2023-08-26 7:46 ` [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm Jie Hai
2023-08-26 7:46 ` [PATCH v2 2/5] net/hns3: support setting and querying RSS hash function Jie Hai
@ 2023-08-26 7:46 ` Jie Hai
2023-08-26 7:46 ` [PATCH v2 4/5] app/proc-info: adjust the display format of " Jie Hai
` (3 subsequent siblings)
6 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-08-26 7:46 UTC (permalink / raw)
To: dev, Reshma Pattan, Vipin Varghese, John McNamara; +Cc: liudongdong3, haijie1
Command show-port should show rss info (rss_key, len and rss_hf),
However, the information is showned 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
allocates memory for rss_conf.rss_key and makes it possible to show
rss info.
Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
Cc: stable@dpdk.org
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
app/proc-info/main.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 88cee0ca487b..f6b77a705dce 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -1013,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;
/* Skip if port is not in mask */
if ((enabled_port_mask & (1ul << i)) == 0)
@@ -1171,19 +1172,25 @@ show_port(void)
printf("\n");
}
+ rss_key = malloc(dev_info.hash_key_size * sizeof(uint8_t));
+ if (rss_key == NULL)
+ return;
+
+ 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);
}
+ free(rss_key);
+
#ifdef RTE_LIB_SECURITY
show_security_context(i, true);
#endif
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v2 4/5] app/proc-info: adjust the display format of RSS info
2023-08-26 7:46 ` [PATCH v2 0/5] support setting and querying RSS algorithms Jie Hai
` (2 preceding siblings ...)
2023-08-26 7:46 ` [PATCH v2 3/5] app/proc-info: fix never show RSS info Jie Hai
@ 2023-08-26 7:46 ` Jie Hai
2023-08-26 7:46 ` [PATCH v2 5/5] app/proc-info: support querying RSS hash algorithm Jie Hai
` (2 subsequent siblings)
6 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-08-26 7:46 UTC (permalink / raw)
To: dev, Reshma Pattan, John McNamara, Vipin Varghese; +Cc: liudongdong3, haijie1
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
-- RSS key len : 40
-- RSS key (hex) :
6d5a56da255b0ec24167253d43a38fb0d0ca2bcbae7b30b4 \
77cb2da38030f20c6a42b73bbeac01fa
-- RSS hf : 0x0
Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
Cc: stable@dpdk.org
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
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 f6b77a705dce..6d2d77fea6ba 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -1180,12 +1180,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 -- hf : 0x%"PRIx64"\n",
rss_conf.rss_hf);
}
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v2 5/5] app/proc-info: support querying RSS hash algorithm
2023-08-26 7:46 ` [PATCH v2 0/5] support setting and querying RSS algorithms Jie Hai
` (3 preceding siblings ...)
2023-08-26 7:46 ` [PATCH v2 4/5] app/proc-info: adjust the display format of " Jie Hai
@ 2023-08-26 7:46 ` Jie Hai
2023-09-04 6:10 ` [PATCH v3 0/5] support setting and querying RSS algorithms Jie Hai
2023-09-04 7:28 ` [PATCH " Jie Hai
6 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-08-26 7:46 UTC (permalink / raw)
To: dev, Reshma Pattan; +Cc: liudongdong3, haijie1
Display RSS hash algorithm with command show-port as below.
- RSS info
-- hash algorithm : toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
app/proc-info/main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 6d2d77fea6ba..02b418a4c661 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -996,6 +996,23 @@ show_offloads(uint64_t offloads,
}
}
+static const char *
+rss_func_to_str(enum rte_eth_hash_function func)
+{
+ switch (func) {
+ case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR:
+ return "simple_xor";
+ case RTE_ETH_HASH_FUNCTION_TOEPLITZ:
+ return "toeplitz";
+ case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ:
+ return "symmetric_toeplitz";
+ case RTE_ETH_HASH_FUNCTION_DEFAULT:
+ return "default";
+ default:
+ return "unknown";
+ }
+}
+
static void
show_port(void)
{
@@ -1188,6 +1205,8 @@ show_port(void)
printf("%02x", rss_conf.rss_key[k]);
printf("\n\t -- hf : 0x%"PRIx64"\n",
rss_conf.rss_hf);
+ printf("\t -- hash algorithm : %s\n",
+ rss_func_to_str(rss_conf.func));
}
free(rss_key);
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-08-26 7:46 ` [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-08-30 11:46 ` Thomas Monjalon
2023-08-31 0:10 ` Ajit Khaparde
2023-09-04 7:10 ` Jie Hai
2023-09-06 15:10 ` Stephen Hemminger
1 sibling, 2 replies; 222+ messages in thread
From: Thomas Monjalon @ 2023-08-30 11:46 UTC (permalink / raw)
To: Jie Hai
Cc: dev, Ferruh Yigit, Andrew Rybchenko, liudongdong3, haijie1,
orika, jerinj, ajit.khaparde
Hello,
Thanks for bringing a new capability.
26/08/2023 09:46, Jie Hai:
> 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_rss_conf`` is extended by adding a new
> field "func". This represents the RSS algorithms to apply. The
> following API is affected:
> - rte_eth_dev_configure
> - rte_eth_dev_rss_hash_update
> - rte_eth_dev_rss_hash_conf_get
So far, the RSS algorithm was used only in flow RSS API.
> --- a/doc/guides/rel_notes/release_23_11.rst
> +++ b/doc/guides/rel_notes/release_23_11.rst
> @@ -123,6 +123,8 @@ ABI Changes
> Also, make sure to start the actual text at the margin.
> =======================================================
>
> + * ethdev: Added "func" field to ``rte_eth_rss_conf`` structure for RSS hash
> + algorithm.
As written above, it should start at the margin.
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> +#include "rte_flow.h"
It is strange to include rte_flow.h here.
It would be better to move the enum.
> + * The *func* field of the *rss_conf* structure indicates the hash algorithm
> + * applied by the RSS hashing. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
> + * the PMD to use its best-effort algorithm rather than a specific one.
> */
I don't like commenting a field on top of the structure.
By the way, the first sentence does not look helpful.
RTE_ETH_HASH_FUNCTION_DEFAULT may be explained in the enum.
> struct rte_eth_rss_conf {
> uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
> uint8_t rss_key_len; /**< hash key length in bytes. */
> uint64_t rss_hf; /**< Hash functions to apply - see below. */
> + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
You can drop "to apply" words.
How the algorithms support combinations in rss_hf?
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-08-30 11:46 ` Thomas Monjalon
@ 2023-08-31 0:10 ` Ajit Khaparde
2023-08-31 10:59 ` Jie Hai
2023-09-04 6:26 ` Jie Hai
2023-09-04 7:10 ` Jie Hai
1 sibling, 2 replies; 222+ messages in thread
From: Ajit Khaparde @ 2023-08-31 0:10 UTC (permalink / raw)
To: Thomas Monjalon
Cc: Jie Hai, dev, Ferruh Yigit, Andrew Rybchenko, liudongdong3,
orika, jerinj
[-- Attachment #1: Type: text/plain, Size: 2298 bytes --]
On Wed, Aug 30, 2023 at 4:46 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> Hello,
>
> Thanks for bringing a new capability.
>
> 26/08/2023 09:46, Jie Hai:
> > 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_rss_conf`` is extended by adding a new
> > field "func". This represents the RSS algorithms to apply. The
> > following API is affected:
> > - rte_eth_dev_configure
> > - rte_eth_dev_rss_hash_update
> > - rte_eth_dev_rss_hash_conf_get
>
> So far, the RSS algorithm was used only in flow RSS API.
>
> > --- a/doc/guides/rel_notes/release_23_11.rst
> > +++ b/doc/guides/rel_notes/release_23_11.rst
> > @@ -123,6 +123,8 @@ ABI Changes
> > Also, make sure to start the actual text at the margin.
> > =======================================================
> >
> > + * ethdev: Added "func" field to ``rte_eth_rss_conf`` structure for RSS hash
> > + algorithm.
>
> As written above, it should start at the margin.
>
> > --- a/lib/ethdev/rte_ethdev.h
> > +++ b/lib/ethdev/rte_ethdev.h
> > +#include "rte_flow.h"
>
> It is strange to include rte_flow.h here.
> It would be better to move the enum.
>
> > + * The *func* field of the *rss_conf* structure indicates the hash algorithm
> > + * applied by the RSS hashing. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
> > + * the PMD to use its best-effort algorithm rather than a specific one.
> > */
>
> I don't like commenting a field on top of the structure.
> By the way, the first sentence does not look helpful.
> RTE_ETH_HASH_FUNCTION_DEFAULT may be explained in the enum.
>
> > struct rte_eth_rss_conf {
> > uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
> > uint8_t rss_key_len; /**< hash key length in bytes. */
> > uint64_t rss_hf; /**< Hash functions to apply - see below. */
> > + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
>
> You can drop "to apply" words.
>
> How the algorithms support combinations in rss_hf?
I will spend a little more time on this tomorrow.
Can you update testpmd also to display the info as a part of show rss.
>
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-08-31 0:10 ` Ajit Khaparde
@ 2023-08-31 10:59 ` Jie Hai
2023-09-04 6:26 ` Jie Hai
1 sibling, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-08-31 10:59 UTC (permalink / raw)
To: Ajit Khaparde, Thomas Monjalon
Cc: dev, Ferruh Yigit, Andrew Rybchenko, liudongdong3, orika, jerinj
On 2023/8/31 8:10, Ajit Khaparde wrote:
> On Wed, Aug 30, 2023 at 4:46 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>>
>> Hello,
>>
>> Thanks for bringing a new capability.
>>
>> 26/08/2023 09:46, Jie Hai:
>>> 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_rss_conf`` is extended by adding a new
>>> field "func". This represents the RSS algorithms to apply. The
>>> following API is affected:
>>> - rte_eth_dev_configure
>>> - rte_eth_dev_rss_hash_update
>>> - rte_eth_dev_rss_hash_conf_get
>>
>> So far, the RSS algorithm was used only in flow RSS API.
>>
>>> --- a/doc/guides/rel_notes/release_23_11.rst
>>> +++ b/doc/guides/rel_notes/release_23_11.rst
>>> @@ -123,6 +123,8 @@ ABI Changes
>>> Also, make sure to start the actual text at the margin.
>>> =======================================================
>>>
>>> + * ethdev: Added "func" field to ``rte_eth_rss_conf`` structure for RSS hash
>>> + algorithm.
>>
>> As written above, it should start at the margin.
>>
>>> --- a/lib/ethdev/rte_ethdev.h
>>> +++ b/lib/ethdev/rte_ethdev.h
>>> +#include "rte_flow.h"
>>
>> It is strange to include rte_flow.h here.
>> It would be better to move the enum.
>>
>>> + * The *func* field of the *rss_conf* structure indicates the hash algorithm
>>> + * applied by the RSS hashing. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
>>> + * the PMD to use its best-effort algorithm rather than a specific one.
>>> */
>>
>> I don't like commenting a field on top of the structure.
>> By the way, the first sentence does not look helpful.
>> RTE_ETH_HASH_FUNCTION_DEFAULT may be explained in the enum.
>>
>>> struct rte_eth_rss_conf {
>>> uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
>>> uint8_t rss_key_len; /**< hash key length in bytes. */
>>> uint64_t rss_hf; /**< Hash functions to apply - see below. */
>>> + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
>>
>> You can drop "to apply" words.
>>
>> How the algorithms support combinations in rss_hf?
> I will spend a little more time on this tomorrow.
> Can you update testpmd also to display the info as a part of show rss.
>
Hi, Ajit Khaparde,
Thanks for your advice. I will update testpmd in next version.
Thanks, Jie Hai
>>
>>
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v3 0/5] support setting and querying RSS algorithms
2023-08-26 7:46 ` [PATCH v2 0/5] support setting and querying RSS algorithms Jie Hai
` (4 preceding siblings ...)
2023-08-26 7:46 ` [PATCH v2 5/5] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-09-04 6:10 ` Jie Hai
2023-09-04 6:10 ` [PATCH v3 1/5] app/proc-info: fix never show RSS info Jie Hai
` (5 more replies)
2023-09-04 7:28 ` [PATCH " Jie Hai
6 siblings, 6 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-04 6:10 UTC (permalink / raw)
To: dev; +Cc: haijie1, lihuisong
This patchset is to support setting and querying RSS algorithms.
--
v3:
1. fix commit log for PATCH [1/5].
2. make RSS ABI changes description to start the actual text at the margin.
3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
4. fix some comment codes.
v2:
1. return error if "func" is invalid.
2. modify the comments of the "func" field.
3. modify commit log of patch [3/5].
4. use malloc instead of rte_malloc.
5. adjust display format of RSS info.
6. remove the string display of rss_hf.
--
Jie Hai (5):
app/proc-info: fix never show RSS info
app/proc-info: adjust the display format of RSS info
app/proc-info: support querying RSS hash algorithm
app/testpmd: add RSS hash algorithms display
app/testpmd: add RSS hash algorithms setting
app/proc-info/main.c | 45 ++++++++++++---
app/test-pmd/cmdline.c | 128 ++++++++++++++++++++++++++++++++++++++---
app/test-pmd/config.c | 62 +++++++++++---------
app/test-pmd/testpmd.h | 5 +-
4 files changed, 194 insertions(+), 46 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v3 1/5] app/proc-info: fix never show RSS info
2023-09-04 6:10 ` [PATCH v3 0/5] support setting and querying RSS algorithms Jie Hai
@ 2023-09-04 6:10 ` Jie Hai
2023-09-04 6:10 ` [PATCH v3 2/5] app/proc-info: adjust the display format of " Jie Hai
` (4 subsequent siblings)
5 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-04 6:10 UTC (permalink / raw)
To: dev, Reshma Pattan, Vipin Varghese, John McNamara; +Cc: haijie1, lihuisong
Command show-port should show RSS info (rss_key, len and rss_hf),
However, the information is showned 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
allocates memory for rss_conf.rss_key and makes it possible to show
RSS info.
Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
Cc: stable@dpdk.org
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
app/proc-info/main.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 88cee0ca487b..f6b77a705dce 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -1013,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;
/* Skip if port is not in mask */
if ((enabled_port_mask & (1ul << i)) == 0)
@@ -1171,19 +1172,25 @@ show_port(void)
printf("\n");
}
+ rss_key = malloc(dev_info.hash_key_size * sizeof(uint8_t));
+ if (rss_key == NULL)
+ return;
+
+ 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);
}
+ free(rss_key);
+
#ifdef RTE_LIB_SECURITY
show_security_context(i, true);
#endif
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v3 2/5] app/proc-info: adjust the display format of RSS info
2023-09-04 6:10 ` [PATCH v3 0/5] support setting and querying RSS algorithms Jie Hai
2023-09-04 6:10 ` [PATCH v3 1/5] app/proc-info: fix never show RSS info Jie Hai
@ 2023-09-04 6:10 ` Jie Hai
2023-09-04 6:10 ` [PATCH v3 3/5] app/proc-info: support querying RSS hash algorithm Jie Hai
` (3 subsequent siblings)
5 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-04 6:10 UTC (permalink / raw)
To: dev, Reshma Pattan, John McNamara, Vipin Varghese; +Cc: haijie1, lihuisong
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
-- hf : 0x0
Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
Cc: stable@dpdk.org
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
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 f6b77a705dce..6d2d77fea6ba 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -1180,12 +1180,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 -- hf : 0x%"PRIx64"\n",
rss_conf.rss_hf);
}
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v3 3/5] app/proc-info: support querying RSS hash algorithm
2023-09-04 6:10 ` [PATCH v3 0/5] support setting and querying RSS algorithms Jie Hai
2023-09-04 6:10 ` [PATCH v3 1/5] app/proc-info: fix never show RSS info Jie Hai
2023-09-04 6:10 ` [PATCH v3 2/5] app/proc-info: adjust the display format of " Jie Hai
@ 2023-09-04 6:10 ` Jie Hai
2023-09-04 6:10 ` [PATCH v3 4/5] app/testpmd: add RSS hash algorithms display Jie Hai
` (2 subsequent siblings)
5 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-04 6:10 UTC (permalink / raw)
To: dev, Reshma Pattan; +Cc: haijie1, lihuisong
Display RSS hash algorithm with command show-port as below.
- RSS info
-- hash algorithm : toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
app/proc-info/main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 6d2d77fea6ba..02b418a4c661 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -996,6 +996,23 @@ show_offloads(uint64_t offloads,
}
}
+static const char *
+rss_func_to_str(enum rte_eth_hash_function func)
+{
+ switch (func) {
+ case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR:
+ return "simple_xor";
+ case RTE_ETH_HASH_FUNCTION_TOEPLITZ:
+ return "toeplitz";
+ case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ:
+ return "symmetric_toeplitz";
+ case RTE_ETH_HASH_FUNCTION_DEFAULT:
+ return "default";
+ default:
+ return "unknown";
+ }
+}
+
static void
show_port(void)
{
@@ -1188,6 +1205,8 @@ show_port(void)
printf("%02x", rss_conf.rss_key[k]);
printf("\n\t -- hf : 0x%"PRIx64"\n",
rss_conf.rss_hf);
+ printf("\t -- hash algorithm : %s\n",
+ rss_func_to_str(rss_conf.func));
}
free(rss_key);
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v3 4/5] app/testpmd: add RSS hash algorithms display
2023-09-04 6:10 ` [PATCH v3 0/5] support setting and querying RSS algorithms Jie Hai
` (2 preceding siblings ...)
2023-09-04 6:10 ` [PATCH v3 3/5] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-09-04 6:10 ` Jie Hai
2023-09-04 6:10 ` [PATCH v3 5/5] app/testpmd: add RSS hash algorithms setting Jie Hai
2023-09-04 7:37 ` [PATCH v3 0/5] support setting and querying RSS algorithms Jie Hai
5 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-04 6:10 UTC (permalink / raw)
To: dev, Aman Singh, Yuying Zhang; +Cc: haijie1, lihuisong
1. Add the command "show port X rss-hash func" to display the RSS hash
algorithms of port X.
2. Add the command "show port X rss-hash all" to display the RSS hash
configuration of port X, including RSS hash types, key and algorithms.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
app/test-pmd/cmdline.c | 50 +++++++++++++++++++++++++++++++++++++-----
app/test-pmd/config.c | 46 +++++++++++++++++++++++---------------
app/test-pmd/testpmd.h | 2 +-
3 files changed, 74 insertions(+), 24 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0d0723f6596e..e7888be305da 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 | func | all]\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"
@@ -3017,15 +3017,21 @@ 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 func; /* optional argument */
+ cmdline_fixed_string_t all; /* 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);
+ if (!strcmp(res->all, "all"))
+ port_rss_hash_conf_show(res->port_id, true, true);
+ else
+ port_rss_hash_conf_show(res->port_id,
+ !strcmp(res->key, "key"), !strcmp(res->func, "func"));
}
static cmdline_parse_token_string_t cmd_showport_rss_hash_show =
@@ -3040,6 +3046,10 @@ 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_func =
+ TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash, func, "func");
+static cmdline_parse_token_string_t cmd_showport_rss_hash_rss_all =
+ TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash, all, "all");
static cmdline_parse_inst_t cmd_showport_rss_hash = {
.f = cmd_showport_rss_hash_parsed,
@@ -3056,7 +3066,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 <port_id> rss-hash key",
.tokens = {
(void *)&cmd_showport_rss_hash_show,
@@ -3068,6 +3078,34 @@ static cmdline_parse_inst_t cmd_showport_rss_hash_key = {
},
};
+static cmdline_parse_inst_t cmd_showport_rss_hash_func = {
+ .f = cmd_showport_rss_hash_parsed,
+ .data = NULL,
+ .help_str = "show port <port_id> rss-hash func",
+ .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_func,
+ NULL,
+ },
+};
+
+static cmdline_parse_inst_t cmd_showport_rss_hash_all = {
+ .f = cmd_showport_rss_hash_parsed,
+ .data = NULL,
+ .help_str = "show port <port_id> rss-hash all",
+ .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_all,
+ NULL,
+ },
+};
+
/* *** Configure DCB *** */
struct cmd_config_dcb {
cmdline_fixed_string_t port;
@@ -12905,6 +12943,8 @@ 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_func,
+ (cmdline_parse_inst_t *)&cmd_showport_rss_hash_all,
(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 11f3a2204839..65eca8467d61 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1485,6 +1485,27 @@ rss_types_display(uint64_t rss_types, uint16_t char_num_per_line)
printf("\n");
}
+static void rss_algo_display(enum rte_eth_hash_function func)
+{
+ switch (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;
+ }
+}
+
static void
rss_config_display(struct rte_flow_action_rss *rss_conf)
{
@@ -1504,23 +1525,7 @@ rss_config_display(struct rte_flow_action_rss *rss_conf)
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;
- }
+ rss_algo_display(rss_conf->func);
printf(" RSS key:\n");
if (rss_conf->key_len == 0) {
@@ -4406,7 +4411,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_func)
{
struct rte_eth_rss_conf rss_conf = {0};
uint8_t rss_key[RSS_HASH_KEY_LENGTH];
@@ -4458,6 +4463,11 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
}
printf("RSS functions:\n");
rss_types_display(rss_hf, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
+
+ if (show_rss_func) {
+ printf("RSS algorithms:\n ");
+ rss_algo_display(rss_conf.func);
+ }
if (!show_rss_key)
return;
printf("RSS key:\n");
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index f1df6a8fafaa..3dc2f47280ad 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1146,7 +1146,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_func);
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);
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v3 5/5] app/testpmd: add RSS hash algorithms setting
2023-09-04 6:10 ` [PATCH v3 0/5] support setting and querying RSS algorithms Jie Hai
` (3 preceding siblings ...)
2023-09-04 6:10 ` [PATCH v3 4/5] app/testpmd: add RSS hash algorithms display Jie Hai
@ 2023-09-04 6:10 ` Jie Hai
2023-09-04 7:37 ` [PATCH v3 0/5] support setting and querying RSS algorithms Jie Hai
5 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-04 6:10 UTC (permalink / raw)
To: dev, Aman Singh, Yuying Zhang; +Cc: haijie1, lihuisong
Add command "port config <port_id> rss-hash-func <func>" to set RSS
hash algorithms.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
app/test-pmd/cmdline.c | 78 ++++++++++++++++++++++++++++++++++++++++--
app/test-pmd/config.c | 16 ++++-----
app/test-pmd/testpmd.h | 3 +-
3 files changed, 84 insertions(+), 13 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index e7888be305da..375f16fcee14 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -2136,6 +2136,76 @@ static cmdline_parse_inst_t cmd_config_rss = {
},
};
+/* *** configure rss hash algorithms *** */
+struct cmd_config_rss_hash_func {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t config;
+ portid_t port_id;
+ cmdline_fixed_string_t rss_hash_func;
+ cmdline_fixed_string_t func;
+};
+
+static void
+cmd_config_rss_hash_func_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_config_rss_hash_func *res = parsed_result;
+ struct rte_eth_rss_conf rss_conf = {0};
+ struct {
+ const char *name;
+ enum rte_eth_hash_function func;
+ } hash_func_map[] = {
+ {"default", RTE_ETH_HASH_FUNCTION_DEFAULT},
+ {"toeplitz", RTE_ETH_HASH_FUNCTION_TOEPLITZ},
+ {"simple_xor", RTE_ETH_HASH_FUNCTION_SIMPLE_XOR},
+ {"symmetric_toeplitz", RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ},
+ {NULL, RTE_ETH_HASH_FUNCTION_MAX},
+ };
+ int i = 0;
+
+ rss_conf.func = RTE_ETH_HASH_FUNCTION_MAX;
+ while (hash_func_map[i].name != NULL) {
+ if (!strcmp(hash_func_map[i].name, res->func)) {
+ rss_conf.func = hash_func_map[i].func;
+ break;
+ }
+ i++;
+ }
+
+ port_rss_hash_key_update(res->port_id, &rss_conf);
+}
+
+static cmdline_parse_token_string_t cmd_config_rss_hash_func_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_func, port, "port");
+static cmdline_parse_token_string_t cmd_config_rss_hash_func_config =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_func, config,
+ "config");
+static cmdline_parse_token_num_t cmd_config_rss_hash_func_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_config_rss_hash_func, port_id,
+ RTE_UINT16);
+static cmdline_parse_token_string_t cmd_config_rss_hash_func_rss_hash_func =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_func,
+ rss_hash_func, "rss-hash-func");
+static cmdline_parse_token_string_t cmd_config_rss_hash_func_value =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_func, func,
+ "default#toeplitz#simple_xor#symmetric_toeplitz");
+
+static cmdline_parse_inst_t cmd_config_rss_hash_func = {
+ .f = cmd_config_rss_hash_func_parsed,
+ .data = NULL,
+ .help_str = "port config <port_id> rss-hash-func"
+ "default|toeplitz|simple_xor|symmetric_toeplitz",
+ .tokens = {
+ (void *)&cmd_config_rss_hash_func_port,
+ (void *)&cmd_config_rss_hash_func_config,
+ (void *)&cmd_config_rss_hash_func_port_id,
+ (void *)&cmd_config_rss_hash_func_rss_hash_func,
+ (void *)&cmd_config_rss_hash_func_value,
+ NULL,
+ },
+};
+
/* *** configure rss hash key *** */
struct cmd_config_rss_hash_key {
cmdline_fixed_string_t port;
@@ -2182,6 +2252,7 @@ cmd_config_rss_hash_key_parsed(void *parsed_result,
uint8_t xdgt0;
uint8_t xdgt1;
int i;
+ struct rte_eth_rss_conf rss_conf = {0};
struct rte_eth_dev_info dev_info;
uint8_t hash_key_size;
uint32_t key_len;
@@ -2217,8 +2288,10 @@ cmd_config_rss_hash_key_parsed(void *parsed_result,
return;
hash_key[i] = (uint8_t) ((xdgt0 * 16) + xdgt1);
}
- port_rss_hash_key_update(res->port_id, res->rss_type, hash_key,
- hash_key_size);
+ rss_conf.rss_key = hash_key;
+ rss_conf.rss_key_len = hash_key_size;
+ rss_conf.rss_hf = str_to_rsstypes(res->rss_type);
+ port_rss_hash_key_update(res->port_id, &rss_conf);
}
static cmdline_parse_token_string_t cmd_config_rss_hash_key_port =
@@ -12946,6 +13019,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
(cmdline_parse_inst_t *)&cmd_showport_rss_hash_func,
(cmdline_parse_inst_t *)&cmd_showport_rss_hash_all,
(cmdline_parse_inst_t *)&cmd_config_rss_hash_key,
+ (cmdline_parse_inst_t *)&cmd_config_rss_hash_func,
(cmdline_parse_inst_t *)&cmd_cleanup_txq_mbufs,
(cmdline_parse_inst_t *)&cmd_dump,
(cmdline_parse_inst_t *)&cmd_dump_one,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 65eca8467d61..2f27642c31d2 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -4477,21 +4477,19 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key, int show_rss_func)
}
void
-port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key,
- uint8_t hash_key_len)
+port_rss_hash_key_update(portid_t port_id, struct rte_eth_rss_conf *conf)
{
- struct rte_eth_rss_conf rss_conf;
+ struct rte_eth_rss_conf rss_conf = {0};
int diag;
- rss_conf.rss_key = NULL;
- rss_conf.rss_key_len = 0;
- rss_conf.rss_hf = str_to_rsstypes(rss_type);
diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
if (diag == 0) {
- rss_conf.rss_key = hash_key;
- rss_conf.rss_key_len = hash_key_len;
- diag = rte_eth_dev_rss_hash_update(port_id, &rss_conf);
+ conf->rss_key = conf->rss_key == NULL ? rss_conf.rss_key : conf->rss_key;
+ conf->rss_key_len = conf->rss_key_len == 0 ? rss_conf.rss_key_len : conf->rss_key_len;
+ conf->rss_hf = conf->rss_hf == 0 ? rss_conf.rss_hf : conf->rss_hf;
+ diag = rte_eth_dev_rss_hash_update(port_id, conf);
}
+
if (diag == 0)
return;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 3dc2f47280ad..8ec7fd39e586 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1147,8 +1147,7 @@ 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, int show_rss_func);
-void port_rss_hash_key_update(portid_t port_id, char rss_type[],
- uint8_t *hash_key, uint8_t hash_key_len);
+void port_rss_hash_key_update(portid_t port_id, struct rte_eth_rss_conf *rss_conf);
int rx_queue_id_is_invalid(queueid_t rxq_id);
int tx_queue_id_is_invalid(queueid_t txq_id);
#ifdef RTE_LIB_GRO
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-08-31 0:10 ` Ajit Khaparde
2023-08-31 10:59 ` Jie Hai
@ 2023-09-04 6:26 ` Jie Hai
2023-09-05 16:17 ` Ajit Khaparde
1 sibling, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-09-04 6:26 UTC (permalink / raw)
To: Ajit Khaparde, Thomas Monjalon
Cc: dev, Ferruh Yigit, Andrew Rybchenko, liudongdong3, orika, jerinj
On 2023/8/31 8:10, Ajit Khaparde wrote:
> On Wed, Aug 30, 2023 at 4:46 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>>
>> Hello,
>>
>> Thanks for bringing a new capability.
>>
>> 26/08/2023 09:46, Jie Hai:
>>> 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_rss_conf`` is extended by adding a new
>>> field "func". This represents the RSS algorithms to apply. The
>>> following API is affected:
>>> - rte_eth_dev_configure
>>> - rte_eth_dev_rss_hash_update
>>> - rte_eth_dev_rss_hash_conf_get
>>
>> So far, the RSS algorithm was used only in flow RSS API.
>>
>>> --- a/doc/guides/rel_notes/release_23_11.rst
>>> +++ b/doc/guides/rel_notes/release_23_11.rst
>>> @@ -123,6 +123,8 @@ ABI Changes
>>> Also, make sure to start the actual text at the margin.
>>> =======================================================
>>>
>>> + * ethdev: Added "func" field to ``rte_eth_rss_conf`` structure for RSS hash
>>> + algorithm.
>>
>> As written above, it should start at the margin.
>>
>>> --- a/lib/ethdev/rte_ethdev.h
>>> +++ b/lib/ethdev/rte_ethdev.h
>>> +#include "rte_flow.h"
>>
>> It is strange to include rte_flow.h here.
>> It would be better to move the enum.
>>
>>> + * The *func* field of the *rss_conf* structure indicates the hash algorithm
>>> + * applied by the RSS hashing. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
>>> + * the PMD to use its best-effort algorithm rather than a specific one.
>>> */
>>
>> I don't like commenting a field on top of the structure.
>> By the way, the first sentence does not look helpful.
>> RTE_ETH_HASH_FUNCTION_DEFAULT may be explained in the enum.
>>
>>> struct rte_eth_rss_conf {
>>> uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
>>> uint8_t rss_key_len; /**< hash key length in bytes. */
>>> uint64_t rss_hf; /**< Hash functions to apply - see below. */
>>> + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
>>
>> You can drop "to apply" words.
>>
>> How the algorithms support combinations in rss_hf?
> I will spend a little more time on this tomorrow.
> Can you update testpmd also to display the info as a part of show rss.
>
Hi, Ajit Khaparde,
Displaying RSS hash algorithms with testpmd is in progress.
However, there are some opinions on the implementation,
whether to add commands or display them in existing commands.
way 1: show port 0 rss-hash func
RSS algorithms:
symmetric_toeplitz
way 2: show port 0 rss-hash
RSS functions:
ipv4 ipv4-frag ipv4-other ipv6 ipv6-frag ipv6-other
RSS algorithms:
symmetric_toeplitz
I hope you can give some comments or suggestions.
Thanks,
Jie Hai
>>
>>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-08-30 11:46 ` Thomas Monjalon
2023-08-31 0:10 ` Ajit Khaparde
@ 2023-09-04 7:10 ` Jie Hai
2023-09-04 7:45 ` Thomas Monjalon
1 sibling, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-09-04 7:10 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Ferruh Yigit, Andrew Rybchenko, liudongdong3, orika, jerinj,
ajit.khaparde
Hi, Thomas
Thanks for your review.
On 2023/8/30 19:46, Thomas Monjalon wrote:
> Hello,
>
> Thanks for bringing a new capability.
>
> 26/08/2023 09:46, Jie Hai:
>> 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_rss_conf`` is extended by adding a new
>> field "func". This represents the RSS algorithms to apply. The
>> following API is affected:
>> - rte_eth_dev_configure
>> - rte_eth_dev_rss_hash_update
>> - rte_eth_dev_rss_hash_conf_get
>
> So far, the RSS algorithm was used only in flow RSS API.
>
Fixed in V3, these API will be affected.
>> --- a/doc/guides/rel_notes/release_23_11.rst
>> +++ b/doc/guides/rel_notes/release_23_11.rst
>> @@ -123,6 +123,8 @@ ABI Changes
>> Also, make sure to start the actual text at the margin.
>> =======================================================
>>
>> + * ethdev: Added "func" field to ``rte_eth_rss_conf`` structure for RSS hash
>> + algorithm.
>
> As written above, it should start at the margin.
>
Fixed in V3.
>> --- a/lib/ethdev/rte_ethdev.h
>> +++ b/lib/ethdev/rte_ethdev.h
>> +#include "rte_flow.h"
>
> It is strange to include rte_flow.h here.
> It would be better to move the enum.
>
Fixed in V3, the definations are removed to rte_ethdev.h.
>> + * The *func* field of the *rss_conf* structure indicates the hash algorithm
>> + * applied by the RSS hashing. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
>> + * the PMD to use its best-effort algorithm rather than a specific one.
>> */
>
> I don't like commenting a field on top of the structure.
> By the way, the first sentence does not look helpful.
> RTE_ETH_HASH_FUNCTION_DEFAULT may be explained in the enum.
>
Other fields above the structure 'rte_eth_rss_conf' have comments.
If the new fields 'func' do not have comments, it may be misleading.
Unless all the comments above are removed. I'm not sure whether to
delete them or not.
>> struct rte_eth_rss_conf {
>> uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
>> uint8_t rss_key_len; /**< hash key length in bytes. */
>> uint64_t rss_hf; /**< Hash functions to apply - see below. */
>> + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
>
> You can drop "to apply" words.
Fixed in V3.
>
> How the algorithms support combinations in rss_hf?
>
The rss_hf defines the input of the RSS hash algorithms.
For example, rss_hf = RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_IPV4,
these two kinds of packets can be dispatched to different queues
according to their tuple field value.
For ipv4-tcp packets, src-ip, dst-ip, src-port, dst-port are used as
parameters of RSS hash algorithms to compute hash value.
For ipv4 packets src-ip, dst-ip are used.
If rss_hf = RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L4_SRC_ONLY, for
ipv4-tcp packets, src-port is used as parameters of RSS hash algorithms
to compute hash value.
>
> .
Thanks,
Jie Hai
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 0/5] support setting and querying RSS algorithms
2023-08-26 7:46 ` [PATCH v2 0/5] support setting and querying RSS algorithms Jie Hai
` (5 preceding siblings ...)
2023-09-04 6:10 ` [PATCH v3 0/5] support setting and querying RSS algorithms Jie Hai
@ 2023-09-04 7:28 ` Jie Hai
2023-09-04 7:28 ` [PATCH 1/5] ethdev: support setting and querying RSS algorithm Jie Hai
` (5 more replies)
6 siblings, 6 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-04 7:28 UTC (permalink / raw)
To: dev; +Cc: haijie1, lihuisong
This patchset is to support setting and querying RSS algorithms.
--
v3:
1. fix commit log for PATCH [1/5].
2. make RSS ABI changes description to start the actual text at the margin.
3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
4. fix some comment codes.
v2:
1. return error if "func" is invalid.
2. modify the comments of the "func" field.
3. modify commit log of patch [3/5].
4. use malloc instead of rte_malloc.
5. adjust display format of RSS info.
6. remove the string display of rss_hf.
--
Huisong Li (1):
net/hns3: support setting and querying RSS hash function
Jie Hai (4):
ethdev: support setting and querying RSS algorithm
app/proc-info: fix never show RSS info
app/proc-info: adjust the display format of RSS info
app/proc-info: support querying RSS hash algorithm
app/proc-info/main.c | 45 +++++++++++++++++++-----
doc/guides/rel_notes/release_23_11.rst | 2 ++
drivers/net/hns3/hns3_rss.c | 47 +++++++++++++++-----------
lib/ethdev/rte_ethdev.c | 17 ++++++++++
lib/ethdev/rte_ethdev.h | 20 +++++++++++
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 18 ++--------
7 files changed, 104 insertions(+), 46 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 1/5] ethdev: support setting and querying RSS algorithm
2023-09-04 7:28 ` [PATCH " Jie Hai
@ 2023-09-04 7:28 ` Jie Hai
2023-09-04 7:28 ` [PATCH 2/5] net/hns3: support setting and querying RSS hash function Jie Hai
` (4 subsequent siblings)
5 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-04 7:28 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: haijie1, lihuisong
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_rss_conf`` is extended by adding a new
field "func". This represents the RSS algorithms to apply. The
following API will be affected:
- rte_eth_dev_configure
- rte_eth_dev_rss_hash_update
- rte_eth_dev_rss_hash_conf_get
If the value of "func" used for configuration is a gibberish
value, report the error and return. Do the same for
rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
To check whether the drivers report the "func" field, it is set
to default value before querying.
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
doc/guides/rel_notes/release_23_11.rst | 2 ++
lib/ethdev/rte_ethdev.c | 17 +++++++++++++++++
lib/ethdev/rte_ethdev.h | 20 ++++++++++++++++++++
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 18 ++----------------
5 files changed, 41 insertions(+), 17 deletions(-)
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 4411bb32c195..94239170139d 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -123,6 +123,8 @@ ABI Changes
Also, make sure to start the actual text at the margin.
=======================================================
+* ethdev: Added "func" 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 0840d2b5942a..4cbcdb344cac 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1445,6 +1445,14 @@ 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.func >= RTE_ETH_HASH_FUNCTION_MAX) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ethdev port_id=%u invalid rss hash function (%u)\n",
+ port_id, dev_conf->rx_adv_conf.rss_conf.func);
+ ret = -EINVAL;
+ goto rollback;
+ }
+
/* Check if Rx RSS distribution is disabled but RSS hash is enabled. */
if (((dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) == 0) &&
(dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
@@ -4630,6 +4638,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
return -ENOTSUP;
}
+ if (rss_conf->func >= RTE_ETH_HASH_FUNCTION_MAX) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ethdev port_id=%u invalid rss hash function (%u)\n",
+ port_id, rss_conf->func);
+ return -EINVAL;
+ }
+
if (*dev->dev_ops->rss_hash_update == NULL)
return -ENOTSUP;
ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
@@ -4657,6 +4672,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
return -EINVAL;
}
+ rss_conf->func = 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 04a2564f222a..1fe3c0a502ac 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -445,6 +445,22 @@ struct rte_vlan_filter_conf {
uint64_t ids[64];
};
+/**
+ * Hash function types.
+ */
+enum rte_eth_hash_function {
+ 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,
+ RTE_ETH_HASH_FUNCTION_MAX,
+};
+
/**
* A structure used to configure the Receive Side Scaling (RSS) feature
* of an Ethernet port.
@@ -461,11 +477,15 @@ struct rte_vlan_filter_conf {
* 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.
+ *
+ * The *func* field of the *rss_conf* structure indicates the hash algorithm
+ * applied by the RSS hashing.
*/
struct rte_eth_rss_conf {
uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
uint8_t rss_key_len; /**< hash key length in bytes. */
uint64_t rss_hf; /**< Hash functions to apply - see below. */
+ enum rte_eth_hash_function func; /**< Hash algorithm. */
};
/*
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 271d854f7807..d3f2d466d841 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -12,7 +12,6 @@
#include <rte_branch_prediction.h>
#include <rte_string_fns.h>
#include <rte_mbuf_dyn.h>
-#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 2ebb76dbc083..a7578b1d2eff 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -40,6 +40,8 @@
#include <rte_macsec.h>
#include <rte_ib.h>
+#include "rte_ethdev.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -3183,22 +3185,6 @@ struct rte_flow_query_count {
uint64_t bytes; /**< Number of bytes through this rule [out]. */
};
-/**
- * Hash function types.
- */
-enum rte_eth_hash_function {
- 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,
- RTE_ETH_HASH_FUNCTION_MAX,
-};
-
/**
* RTE_FLOW_ACTION_TYPE_RSS
*
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 2/5] net/hns3: support setting and querying RSS hash function
2023-09-04 7:28 ` [PATCH " Jie Hai
2023-09-04 7:28 ` [PATCH 1/5] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-09-04 7:28 ` Jie Hai
2023-09-04 7:28 ` [PATCH 3/5] app/proc-info: fix never show RSS info Jie Hai
` (3 subsequent siblings)
5 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-04 7:28 UTC (permalink / raw)
To: dev, Dongdong Liu, Yisen Zhuang; +Cc: haijie1, lihuisong
From: Huisong Li <lihuisong@huawei.com>
Support setting and querying RSS hash function by ethdev ops.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
| 47 +++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 20 deletions(-)
--git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c
index 6126512bd780..c8346d43d15c 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->func, key, key_len);
+ if (ret != 0)
+ goto set_algo_key_fail;
+
+ if (rss_conf->func != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ hw->rss_info.hash_algo = hns3_hash_func_map[rss_conf->func];
+ 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->func = hash_func_map[hash_algo];
-out:
- rte_spinlock_unlock(&hw->lock);
-
- return ret;
+ return 0;
}
/*
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 3/5] app/proc-info: fix never show RSS info
2023-09-04 7:28 ` [PATCH " Jie Hai
2023-09-04 7:28 ` [PATCH 1/5] ethdev: support setting and querying RSS algorithm Jie Hai
2023-09-04 7:28 ` [PATCH 2/5] net/hns3: support setting and querying RSS hash function Jie Hai
@ 2023-09-04 7:28 ` Jie Hai
2023-09-05 16:29 ` Pattan, Reshma
2023-09-04 7:28 ` [PATCH 4/5] app/proc-info: adjust the display format of " Jie Hai
` (2 subsequent siblings)
5 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-09-04 7:28 UTC (permalink / raw)
To: dev, Reshma Pattan, Vipin Varghese, John McNamara; +Cc: haijie1, lihuisong
Command show-port should show RSS info (rss_key, len and rss_hf),
However, the information is showned 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
allocates memory for rss_conf.rss_key and makes it possible to show
RSS info.
Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
Cc: stable@dpdk.org
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
app/proc-info/main.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 88cee0ca487b..f6b77a705dce 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -1013,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;
/* Skip if port is not in mask */
if ((enabled_port_mask & (1ul << i)) == 0)
@@ -1171,19 +1172,25 @@ show_port(void)
printf("\n");
}
+ rss_key = malloc(dev_info.hash_key_size * sizeof(uint8_t));
+ if (rss_key == NULL)
+ return;
+
+ 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);
}
+ free(rss_key);
+
#ifdef RTE_LIB_SECURITY
show_security_context(i, true);
#endif
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 4/5] app/proc-info: adjust the display format of RSS info
2023-09-04 7:28 ` [PATCH " Jie Hai
` (2 preceding siblings ...)
2023-09-04 7:28 ` [PATCH 3/5] app/proc-info: fix never show RSS info Jie Hai
@ 2023-09-04 7:28 ` Jie Hai
2023-09-04 7:28 ` [PATCH 5/5] app/proc-info: support querying RSS hash algorithm Jie Hai
2023-09-08 8:00 ` [PATCH v4 0/7] support setting and querying RSS algorithms Jie Hai
5 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-04 7:28 UTC (permalink / raw)
To: dev, Reshma Pattan, Vipin Varghese, John McNamara; +Cc: haijie1, lihuisong
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
-- hf : 0x0
Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
Cc: stable@dpdk.org
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
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 f6b77a705dce..6d2d77fea6ba 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -1180,12 +1180,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 -- hf : 0x%"PRIx64"\n",
rss_conf.rss_hf);
}
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 5/5] app/proc-info: support querying RSS hash algorithm
2023-09-04 7:28 ` [PATCH " Jie Hai
` (3 preceding siblings ...)
2023-09-04 7:28 ` [PATCH 4/5] app/proc-info: adjust the display format of " Jie Hai
@ 2023-09-04 7:28 ` Jie Hai
2023-09-05 17:07 ` Pattan, Reshma
2023-09-08 8:00 ` [PATCH v4 0/7] support setting and querying RSS algorithms Jie Hai
5 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-09-04 7:28 UTC (permalink / raw)
To: dev, Reshma Pattan; +Cc: haijie1, lihuisong
Display RSS hash algorithm with command show-port as below.
- RSS info
-- hash algorithm : toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
app/proc-info/main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 6d2d77fea6ba..02b418a4c661 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -996,6 +996,23 @@ show_offloads(uint64_t offloads,
}
}
+static const char *
+rss_func_to_str(enum rte_eth_hash_function func)
+{
+ switch (func) {
+ case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR:
+ return "simple_xor";
+ case RTE_ETH_HASH_FUNCTION_TOEPLITZ:
+ return "toeplitz";
+ case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ:
+ return "symmetric_toeplitz";
+ case RTE_ETH_HASH_FUNCTION_DEFAULT:
+ return "default";
+ default:
+ return "unknown";
+ }
+}
+
static void
show_port(void)
{
@@ -1188,6 +1205,8 @@ show_port(void)
printf("%02x", rss_conf.rss_key[k]);
printf("\n\t -- hf : 0x%"PRIx64"\n",
rss_conf.rss_hf);
+ printf("\t -- hash algorithm : %s\n",
+ rss_func_to_str(rss_conf.func));
}
free(rss_key);
--
2.33.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v3 0/5] support setting and querying RSS algorithms
2023-09-04 6:10 ` [PATCH v3 0/5] support setting and querying RSS algorithms Jie Hai
` (4 preceding siblings ...)
2023-09-04 6:10 ` [PATCH v3 5/5] app/testpmd: add RSS hash algorithms setting Jie Hai
@ 2023-09-04 7:37 ` Jie Hai
5 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-04 7:37 UTC (permalink / raw)
To: dev; +Cc: lihuisong
Hi, ALL
Sorry, please drop this patchset.
Here is V3
https://inbox.dpdk.org/dev/20230904072851.7384-1-haijie1@huawei.com/
Thanks,
Jie Hai
On 2023/9/4 14:10, Jie Hai wrote:
> This patchset is to support setting and querying RSS algorithms.
>
> --
> v3:
> 1. fix commit log for PATCH [1/5].
> 2. make RSS ABI changes description to start the actual text at the margin.
> 3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
> 4. fix some comment codes.
>
> v2:
> 1. return error if "func" is invalid.
> 2. modify the comments of the "func" field.
> 3. modify commit log of patch [3/5].
> 4. use malloc instead of rte_malloc.
> 5. adjust display format of RSS info.
> 6. remove the string display of rss_hf.
> --
>
>
> Jie Hai (5):
> app/proc-info: fix never show RSS info
> app/proc-info: adjust the display format of RSS info
> app/proc-info: support querying RSS hash algorithm
> app/testpmd: add RSS hash algorithms display
> app/testpmd: add RSS hash algorithms setting
>
> app/proc-info/main.c | 45 ++++++++++++---
> app/test-pmd/cmdline.c | 128 ++++++++++++++++++++++++++++++++++++++---
> app/test-pmd/config.c | 62 +++++++++++---------
> app/test-pmd/testpmd.h | 5 +-
> 4 files changed, 194 insertions(+), 46 deletions(-)
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-09-04 7:10 ` Jie Hai
@ 2023-09-04 7:45 ` Thomas Monjalon
2023-09-08 8:44 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: Thomas Monjalon @ 2023-09-04 7:45 UTC (permalink / raw)
To: Jie Hai
Cc: dev, Ferruh Yigit, Andrew Rybchenko, liudongdong3, orika, jerinj,
ajit.khaparde
04/09/2023 09:10, Jie Hai:
> On 2023/8/30 19:46, Thomas Monjalon wrote:
> > 26/08/2023 09:46, Jie Hai:
>> + * The *func* field of the *rss_conf* structure indicates the hash algorithm
> >> + * applied by the RSS hashing. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
> >> + * the PMD to use its best-effort algorithm rather than a specific one.
> >> */
> >
> > I don't like commenting a field on top of the structure.
> > By the way, the first sentence does not look helpful.
> > RTE_ETH_HASH_FUNCTION_DEFAULT may be explained in the enum.
> >
> Other fields above the structure 'rte_eth_rss_conf' have comments.
> If the new fields 'func' do not have comments, it may be misleading.
> Unless all the comments above are removed. I'm not sure whether to
> delete them or not.
You should explain RTE_ETH_HASH_FUNCTION_DEFAULT in its enum.
The rest of the explanation can be on the struct field.
I'm OK to have another patch moving old explanations from the struct
to the fields.
> >> struct rte_eth_rss_conf {
> >> uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
> >> uint8_t rss_key_len; /**< hash key length in bytes. */
> >> uint64_t rss_hf; /**< Hash functions to apply - see below. */
> >> + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
> >
> > You can drop "to apply" words.
> Fixed in V3.
> >
> > How the algorithms support combinations in rss_hf?
> >
> The rss_hf defines the input of the RSS hash algorithms.
> For example, rss_hf = RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_IPV4,
> these two kinds of packets can be dispatched to different queues
> according to their tuple field value.
> For ipv4-tcp packets, src-ip, dst-ip, src-port, dst-port are used as
> parameters of RSS hash algorithms to compute hash value.
> For ipv4 packets src-ip, dst-ip are used.
>
> If rss_hf = RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L4_SRC_ONLY, for
> ipv4-tcp packets, src-port is used as parameters of RSS hash algorithms
> to compute hash value.
I know what is rss_hf.
My question is about the algorithms.
Do they all support any combination in rss_hf?
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-09-04 6:26 ` Jie Hai
@ 2023-09-05 16:17 ` Ajit Khaparde
0 siblings, 0 replies; 222+ messages in thread
From: Ajit Khaparde @ 2023-09-05 16:17 UTC (permalink / raw)
To: Jie Hai
Cc: Thomas Monjalon, dev, Ferruh Yigit, Andrew Rybchenko,
liudongdong3, orika, jerinj
[-- Attachment #1: Type: text/plain, Size: 794 bytes --]
> >> How the algorithms support combinations in rss_hf?
> > I will spend a little more time on this tomorrow.
> > Can you update testpmd also to display the info as a part of show rss.
> >
> Hi, Ajit Khaparde,
>
> Displaying RSS hash algorithms with testpmd is in progress.
> However, there are some opinions on the implementation,
> whether to add commands or display them in existing commands.
>
> way 1: show port 0 rss-hash func
> RSS algorithms:
> symmetric_toeplitz
Option 1 looks good enough. Thanks
>
> way 2: show port 0 rss-hash
> RSS functions:
> ipv4 ipv4-frag ipv4-other ipv6 ipv6-frag ipv6-other
> RSS algorithms:
> symmetric_toeplitz
>
> I hope you can give some comments or suggestions.
>
> Thanks,
> Jie Hai
> >>
> >>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [flat|nested] 222+ messages in thread
* RE: [PATCH 3/5] app/proc-info: fix never show RSS info
2023-09-04 7:28 ` [PATCH 3/5] app/proc-info: fix never show RSS info Jie Hai
@ 2023-09-05 16:29 ` Pattan, Reshma
2023-09-08 8:01 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: Pattan, Reshma @ 2023-09-05 16:29 UTC (permalink / raw)
To: Jie Hai, dev, Vipin Varghese, Mcnamara, John; +Cc: lihuisong
> -----Original Message-----
> + uint8_t *rss_key;
Instead of pointer can you just take key of type below, so u no need to do dynamic memory allocation using malloc and free .
Ex: uint8_t hash_key[RSS_HASH_KEY_LENGTH];
And then do below ?
rss_conf.rss_key = hash_key;
^ permalink raw reply [flat|nested] 222+ messages in thread
* RE: [PATCH 5/5] app/proc-info: support querying RSS hash algorithm
2023-09-04 7:28 ` [PATCH 5/5] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-09-05 17:07 ` Pattan, Reshma
2023-09-08 8:01 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: Pattan, Reshma @ 2023-09-05 17:07 UTC (permalink / raw)
To: Jie Hai, dev; +Cc: lihuisong
> -----Original Message-----
> From: Jie Hai <haijie1@huawei.com>
>
> +static const char *
> +rss_func_to_str(enum rte_eth_hash_function func) {
> + switch (func) {
> + case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR:
> + return "simple_xor";
> + case RTE_ETH_HASH_FUNCTION_TOEPLITZ:
> + return "toeplitz";
> + case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ:
> + return "symmetric_toeplitz";
> + case RTE_ETH_HASH_FUNCTION_DEFAULT:
> + return "default";
> + default:
> + return "unknown";
> + }
> +}
> +
Instead of above function you can declare const array of strings as below to map hash function names.
static const char * const hf_names[] = {
[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_DEFAULT] = "default"
};
> + printf("\t -- hash algorithm : %s\n",
> + rss_func_to_str(rss_conf.func));
> }
>
And then print as below ?
printf("\t -- hash algorithm : %s\n", hf_names [rss_conf.func]);
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-08-26 7:46 ` [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm Jie Hai
2023-08-30 11:46 ` Thomas Monjalon
@ 2023-09-06 15:10 ` Stephen Hemminger
2023-09-08 9:28 ` Jie Hai
1 sibling, 1 reply; 222+ messages in thread
From: Stephen Hemminger @ 2023-09-06 15:10 UTC (permalink / raw)
To: Jie Hai
Cc: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, liudongdong3
On Sat, 26 Aug 2023 15:46:03 +0800
Jie Hai <haijie1@huawei.com> wrote:
> 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_rss_conf`` is extended by adding a new
> field "func". This represents the RSS algorithms to apply. The
> following API is affected:
> - rte_eth_dev_configure
> - rte_eth_dev_rss_hash_update
> - rte_eth_dev_rss_hash_conf_get
>
> If the value of "func" used for configuration is a gibberish
> value, report the error and return. Do the same for
> rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
>
> To check whether the drivers report the "func" field, it is set
> to default value before querying.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
This is unannounced API/ABI change.
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v4 0/7] support setting and querying RSS algorithms
2023-09-04 7:28 ` [PATCH " Jie Hai
` (4 preceding siblings ...)
2023-09-04 7:28 ` [PATCH 5/5] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-09-08 8:00 ` Jie Hai
2023-09-08 8:00 ` [PATCH v4 1/7] ethdev: recomment some definitions related to RSS Jie Hai
` (7 more replies)
5 siblings, 8 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-08 8:00 UTC (permalink / raw)
To: dev; +Cc: haijie1, lihuisong
This patchset is to support setting and querying RSS algorithms.
--
v4:
1. recomment some definitions related to RSS.
2. allocate static memory for rss_key instead of dynamic.
3. use array of strings to get the name of rss algorithm.
4. add display of rss algorithm with testpmd.
v3:
1. fix commit log for PATCH [1/5].
2. make RSS ABI changes description to start the actual text at the margin.
3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
4. fix some comment codes.
v2:
1. return error if "func" is invalid.
2. modify the comments of the "func" field.
3. modify commit log of patch [3/5].
4. use malloc instead of rte_malloc.
5. adjust display format of RSS info.
6. remove the string display of rss_hf.
Huisong Li (1):
net/hns3: support setting and querying RSS hash function
Jie Hai (6):
ethdev: recomment some definitions related to RSS
ethdev: support setting and querying RSS algorithm
app/proc-info: fix never show RSS info
app/proc-info: adjust the display format of RSS info
app/proc-info: support querying RSS hash algorithm
app/testpmd: add RSS hash algorithms display
app/proc-info/main.c | 31 +++++++++++-----
app/test-pmd/cmdline.c | 29 ++++++++++++---
app/test-pmd/config.c | 36 +++++++++----------
app/test-pmd/testpmd.h | 2 +-
doc/guides/rel_notes/release_23_11.rst | 2 ++
drivers/net/hns3/hns3_rss.c | 47 +++++++++++++-----------
lib/ethdev/rte_ethdev.c | 17 +++++++++
lib/ethdev/rte_ethdev.h | 49 ++++++++++++++++++--------
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 18 ++--------
10 files changed, 146 insertions(+), 86 deletions(-)
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v4 1/7] ethdev: recomment some definitions related to RSS
2023-09-08 8:00 ` [PATCH v4 0/7] support setting and querying RSS algorithms Jie Hai
@ 2023-09-08 8:00 ` Jie Hai
2023-09-20 16:39 ` Ferruh Yigit
2023-09-08 8:00 ` [PATCH v4 2/7] ethdev: support setting and querying RSS algorithm Jie Hai
` (6 subsequent siblings)
7 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-09-08 8:00 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: haijie1, lihuisong
1. Recomment fields of 'rte_eth_rss_conf'.
2. Add comments for RTE_ETH_HASH_FUNCTION_DEFAULT.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
lib/ethdev/rte_ethdev.h | 28 +++++++++++++---------------
lib/ethdev/rte_flow.h | 4 ++++
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 04a2564f222a..40cfbb7efddd 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -448,24 +448,22 @@ 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. */
+ /**
+ * If not NULL, 40-byte hash key to use for hashing specific header
+ * fields of received packets. The size of rss_key should be indicated
+ * by *rss_key_len* below.
+ * Otherwise, a default random hash key is used by the device driver.
+ */
+ uint8_t *rss_key;
uint8_t rss_key_len; /**< hash key length in bytes. */
- uint64_t rss_hf; /**< Hash functions to apply - see below. */
+ /**
+ * The different types of packets to which the RSS hashing must be
+ * applied, may be combined with SRC/DST_ONLY, see below.
+ * Supplying an *rss_hf* equal to zero disables the RSS feature.
+ */
+ uint64_t rss_hf;
};
/*
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 2ebb76dbc083..3bd0dc64fbe2 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -3187,6 +3187,10 @@ struct rte_flow_query_count {
* Hash function types.
*/
enum rte_eth_hash_function {
+ /**
+ * DEFAULT means that conformance to a specific hash algorithm is
+ * uncared to the caller. The driver can pick the one it deems optimal.
+ */
RTE_ETH_HASH_FUNCTION_DEFAULT = 0,
RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */
RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v4 2/7] ethdev: support setting and querying RSS algorithm
2023-09-08 8:00 ` [PATCH v4 0/7] support setting and querying RSS algorithms Jie Hai
2023-09-08 8:00 ` [PATCH v4 1/7] ethdev: recomment some definitions related to RSS Jie Hai
@ 2023-09-08 8:00 ` Jie Hai
2023-09-20 16:39 ` Ferruh Yigit
2023-09-08 8:00 ` [PATCH v4 3/7] net/hns3: support setting and querying RSS hash function Jie Hai
` (5 subsequent siblings)
7 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-09-08 8:00 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: haijie1, lihuisong
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_rss_conf`` is extended by adding a new
field "func". This represents the RSS algorithms to apply. The
following API will be affected:
- rte_eth_dev_configure
- rte_eth_dev_rss_hash_update
- rte_eth_dev_rss_hash_conf_get
If the value of "func" used for configuration is a gibberish
value, report the error and return. Do the same for
rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
To check whether the drivers report the "func" field, it is set
to default value before querying.
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
doc/guides/rel_notes/release_23_11.rst | 2 ++
lib/ethdev/rte_ethdev.c | 17 +++++++++++++++++
lib/ethdev/rte_ethdev.h | 21 +++++++++++++++++++++
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 22 ++--------------------
5 files changed, 42 insertions(+), 21 deletions(-)
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 333e1d95a283..deb019fbe4c1 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -129,6 +129,8 @@ ABI Changes
Also, make sure to start the actual text at the margin.
=======================================================
+* ethdev: Added "func" 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 0840d2b5942a..4cbcdb344cac 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1445,6 +1445,14 @@ 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.func >= RTE_ETH_HASH_FUNCTION_MAX) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ethdev port_id=%u invalid rss hash function (%u)\n",
+ port_id, dev_conf->rx_adv_conf.rss_conf.func);
+ ret = -EINVAL;
+ goto rollback;
+ }
+
/* Check if Rx RSS distribution is disabled but RSS hash is enabled. */
if (((dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) == 0) &&
(dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
@@ -4630,6 +4638,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
return -ENOTSUP;
}
+ if (rss_conf->func >= RTE_ETH_HASH_FUNCTION_MAX) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ethdev port_id=%u invalid rss hash function (%u)\n",
+ port_id, rss_conf->func);
+ return -EINVAL;
+ }
+
if (*dev->dev_ops->rss_hash_update == NULL)
return -ENOTSUP;
ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
@@ -4657,6 +4672,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
return -EINVAL;
}
+ rss_conf->func = 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 40cfbb7efddd..33cec3570f85 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -445,6 +445,26 @@ struct rte_vlan_filter_conf {
uint64_t ids[64];
};
+/**
+ * Hash function types.
+ */
+enum rte_eth_hash_function {
+ /**
+ * DEFAULT means that conformance to a specific hash algorithm is
+ * uncared to the caller. The driver can pick the one it deems optimal.
+ */
+ 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,
+ RTE_ETH_HASH_FUNCTION_MAX,
+};
+
/**
* A structure used to configure the Receive Side Scaling (RSS) feature
* of an Ethernet port.
@@ -464,6 +484,7 @@ struct rte_eth_rss_conf {
* Supplying an *rss_hf* equal to zero disables the RSS feature.
*/
uint64_t rss_hf;
+ enum rte_eth_hash_function func; /**< Hash algorithm. */
};
/*
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 271d854f7807..d3f2d466d841 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -12,7 +12,6 @@
#include <rte_branch_prediction.h>
#include <rte_string_fns.h>
#include <rte_mbuf_dyn.h>
-#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 3bd0dc64fbe2..a7578b1d2eff 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -40,6 +40,8 @@
#include <rte_macsec.h>
#include <rte_ib.h>
+#include "rte_ethdev.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -3183,26 +3185,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 that conformance to a specific hash algorithm is
- * uncared to the caller. The driver can pick the one it deems optimal.
- */
- 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,
- RTE_ETH_HASH_FUNCTION_MAX,
-};
-
/**
* RTE_FLOW_ACTION_TYPE_RSS
*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v4 3/7] net/hns3: support setting and querying RSS hash function
2023-09-08 8:00 ` [PATCH v4 0/7] support setting and querying RSS algorithms Jie Hai
2023-09-08 8:00 ` [PATCH v4 1/7] ethdev: recomment some definitions related to RSS Jie Hai
2023-09-08 8:00 ` [PATCH v4 2/7] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-09-08 8:00 ` Jie Hai
2023-09-08 8:00 ` [PATCH v4 4/7] app/proc-info: fix never show RSS info Jie Hai
` (4 subsequent siblings)
7 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-08 8:00 UTC (permalink / raw)
To: dev, Dongdong Liu, Yisen Zhuang; +Cc: haijie1, lihuisong
From: Huisong Li <lihuisong@huawei.com>
Support setting and querying RSS hash function by ethdev ops.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
| 47 +++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 20 deletions(-)
--git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c
index 6126512bd780..c8346d43d15c 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->func, key, key_len);
+ if (ret != 0)
+ goto set_algo_key_fail;
+
+ if (rss_conf->func != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ hw->rss_info.hash_algo = hns3_hash_func_map[rss_conf->func];
+ 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->func = hash_func_map[hash_algo];
-out:
- rte_spinlock_unlock(&hw->lock);
-
- return ret;
+ return 0;
}
/*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v4 4/7] app/proc-info: fix never show RSS info
2023-09-08 8:00 ` [PATCH v4 0/7] support setting and querying RSS algorithms Jie Hai
` (2 preceding siblings ...)
2023-09-08 8:00 ` [PATCH v4 3/7] net/hns3: support setting and querying RSS hash function Jie Hai
@ 2023-09-08 8:00 ` Jie Hai
2023-09-13 11:48 ` Pattan, Reshma
2023-09-08 8:00 ` [PATCH v4 5/7] app/proc-info: adjust the display format of " Jie Hai
` (3 subsequent siblings)
7 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-09-08 8:00 UTC (permalink / raw)
To: dev, Reshma Pattan, Vipin Varghese, John McNamara; +Cc: haijie1, lihuisong
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
allocates memory for rss_conf.rss_key and makes it possible to show
RSS info.
Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
Cc: stable@dpdk.org
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
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 88cee0ca487b..95dd4514b3c9 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -152,6 +152,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)
@@ -1013,6 +1015,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)
@@ -1171,17 +1174,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
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v4 5/7] app/proc-info: adjust the display format of RSS info
2023-09-08 8:00 ` [PATCH v4 0/7] support setting and querying RSS algorithms Jie Hai
` (3 preceding siblings ...)
2023-09-08 8:00 ` [PATCH v4 4/7] app/proc-info: fix never show RSS info Jie Hai
@ 2023-09-08 8:00 ` Jie Hai
2023-09-13 12:22 ` Pattan, Reshma
2023-09-08 8:00 ` [PATCH v4 6/7] app/proc-info: support querying RSS hash algorithm Jie Hai
` (2 subsequent siblings)
7 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-09-08 8:00 UTC (permalink / raw)
To: dev, Reshma Pattan, John McNamara, Vipin Varghese; +Cc: haijie1, lihuisong
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
-- hf : 0x0
Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
Cc: stable@dpdk.org
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
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 95dd4514b3c9..735cfd5249ab 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -1178,12 +1178,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 -- hf : 0x%"PRIx64"\n",
rss_conf.rss_hf);
}
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v4 6/7] app/proc-info: support querying RSS hash algorithm
2023-09-08 8:00 ` [PATCH v4 0/7] support setting and querying RSS algorithms Jie Hai
` (4 preceding siblings ...)
2023-09-08 8:00 ` [PATCH v4 5/7] app/proc-info: adjust the display format of " Jie Hai
@ 2023-09-08 8:00 ` Jie Hai
2023-09-13 11:42 ` Pattan, Reshma
2023-09-13 11:44 ` Pattan, Reshma
2023-09-08 8:00 ` [PATCH v4 7/7] app/testpmd: add RSS hash algorithms display Jie Hai
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
7 siblings, 2 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-08 8:00 UTC (permalink / raw)
To: dev, Reshma Pattan; +Cc: haijie1, lihuisong
Display RSS hash algorithm with command show-port as below.
- RSS info
-- hash algorithm : toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
app/proc-info/main.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 735cfd5249ab..3da63a4821f2 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -153,6 +153,13 @@ static struct desc_param rx_desc_param;
static struct desc_param tx_desc_param;
#define RSS_HASH_KEY_SIZE 64
+static const char * const rss_hash_algos[] = {
+ [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_DEFAULT] = "default",
+ [RTE_ETH_HASH_FUNCTION_MAX] = "unknown"
+};
/* display usage */
static void
@@ -1186,6 +1193,8 @@ show_port(void)
printf("%02x", rss_conf.rss_key[k]);
printf("\n\t -- hf : 0x%"PRIx64"\n",
rss_conf.rss_hf);
+ printf("\t -- hash algorithm : %s\n",
+ rss_hash_algos[rss_conf.func]);
}
#ifdef RTE_LIB_SECURITY
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v4 7/7] app/testpmd: add RSS hash algorithms display
2023-09-08 8:00 ` [PATCH v4 0/7] support setting and querying RSS algorithms Jie Hai
` (5 preceding siblings ...)
2023-09-08 8:00 ` [PATCH v4 6/7] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-09-08 8:00 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
7 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-08 8:00 UTC (permalink / raw)
To: dev, Aman Singh, Yuying Zhang; +Cc: haijie1, lihuisong
Add the command "show port X rss-hash func" to display the RSS hash
algorithms of port X. An example is shown:
testpmd> show port 0 rss-hash func
RSS algorithms:
toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
app/test-pmd/cmdline.c | 29 ++++++++++++++++++++++++-----
app/test-pmd/config.c | 36 +++++++++++++++++-------------------
app/test-pmd/testpmd.h | 2 +-
3 files changed, 42 insertions(+), 25 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0d0723f6596e..91bb5ac3c091 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 | func]\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"
@@ -3017,15 +3017,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 func; /* 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->func, "func"));
}
static cmdline_parse_token_string_t cmd_showport_rss_hash_show =
@@ -3040,6 +3042,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_func =
+ TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash, func, "func");
static cmdline_parse_inst_t cmd_showport_rss_hash = {
.f = cmd_showport_rss_hash_parsed,
@@ -3056,7 +3060,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 <port_id> rss-hash key",
.tokens = {
(void *)&cmd_showport_rss_hash_show,
@@ -3068,6 +3072,20 @@ static cmdline_parse_inst_t cmd_showport_rss_hash_key = {
},
};
+static cmdline_parse_inst_t cmd_showport_rss_hash_func = {
+ .f = cmd_showport_rss_hash_parsed,
+ .data = NULL,
+ .help_str = "show port <port_id> rss-hash func",
+ .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_func,
+ NULL,
+ },
+};
+
/* *** Configure DCB *** */
struct cmd_config_dcb {
cmdline_fixed_string_t port;
@@ -12905,6 +12923,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_func,
(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 11f3a2204839..1af55185d2b2 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1485,6 +1485,14 @@ rss_types_display(uint64_t rss_types, uint16_t char_num_per_line)
printf("\n");
}
+static const char * const rss_hash_algos[] = {
+ [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_DEFAULT] = "default",
+ [RTE_ETH_HASH_FUNCTION_MAX] = "Unknown function"
+};
+
static void
rss_config_display(struct rte_flow_action_rss *rss_conf)
{
@@ -1503,24 +1511,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", rss_hash_algos[rss_conf->func]);
printf(" RSS key:\n");
if (rss_conf->key_len == 0) {
@@ -4406,7 +4397,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_func)
{
struct rte_eth_rss_conf rss_conf = {0};
uint8_t rss_key[RSS_HASH_KEY_LENGTH];
@@ -4456,8 +4447,15 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
printf("RSS disabled\n");
return;
}
+
+ if (show_rss_func) {
+ printf("RSS algorithms:\n %s\n", rss_hash_algos[rss_conf.func]);
+ 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 f1df6a8fafaa..3dc2f47280ad 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1146,7 +1146,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_func);
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);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 3/5] app/proc-info: fix never show RSS info
2023-09-05 16:29 ` Pattan, Reshma
@ 2023-09-08 8:01 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-08 8:01 UTC (permalink / raw)
To: Pattan, Reshma, dev, Vipin Varghese, Mcnamara, John; +Cc: lihuisong
Hi, Pattan, Reshma
On 2023/9/6 0:29, Pattan, Reshma wrote:
>
>
>> -----Original Message-----
>> + uint8_t *rss_key;
>
> Instead of pointer can you just take key of type below, so u no need to do dynamic memory allocation using malloc and free .
>
> Ex: uint8_t hash_key[RSS_HASH_KEY_LENGTH];
>
> And then do below ?
> rss_conf.rss_key = hash_key;
> .
Thanks for your review, will fix it in next version.
Thanks,
Jie Hai
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 5/5] app/proc-info: support querying RSS hash algorithm
2023-09-05 17:07 ` Pattan, Reshma
@ 2023-09-08 8:01 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-08 8:01 UTC (permalink / raw)
To: Pattan, Reshma, dev; +Cc: lihuisong
Hi, Pattan, Reshma
On 2023/9/6 1:07, Pattan, Reshma wrote:
>
> Instead of above function you can declare const array of strings as below to map hash function names.
>
> static const char * const hf_names[] = {
> [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_DEFAULT] = "default"
> };
>
>
>> + printf("\t -- hash algorithm : %s\n",
>> + rss_func_to_str(rss_conf.func));
>> }
>>
> And then print as below ?
> printf("\t -- hash algorithm : %s\n", hf_names [rss_conf.func]);
> .
Thanks for your review, that sounds better, will fix it.
Thanks,
Jie Hai
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-09-04 7:45 ` Thomas Monjalon
@ 2023-09-08 8:44 ` Jie Hai
2023-09-09 0:01 ` Ajit Khaparde
0 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-09-08 8:44 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Ferruh Yigit, Andrew Rybchenko, liudongdong3, orika, jerinj,
ajit.khaparde
Hi, Thomas
Thanks for your review.
On 2023/9/4 15:45, Thomas Monjalon wrote:
> 04/09/2023 09:10, Jie Hai:
>> On 2023/8/30 19:46, Thomas Monjalon wrote:
>>> 26/08/2023 09:46, Jie Hai:
> >> + * The *func* field of the *rss_conf* structure indicates the hash algorithm
>>>> + * applied by the RSS hashing. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
>>>> + * the PMD to use its best-effort algorithm rather than a specific one.
>>>> */
>>>
>>> I don't like commenting a field on top of the structure.
>>> By the way, the first sentence does not look helpful.
>>> RTE_ETH_HASH_FUNCTION_DEFAULT may be explained in the enum.
>>>
>> Other fields above the structure 'rte_eth_rss_conf' have comments.
>> If the new fields 'func' do not have comments, it may be misleading.
>> Unless all the comments above are removed. I'm not sure whether to
>> delete them or not.
>
> You should explain RTE_ETH_HASH_FUNCTION_DEFAULT in its enum.
> The rest of the explanation can be on the struct field.
> I'm OK to have another patch moving old explanations from the struct
> to the fields.
Fixed in V4, please check it.
>
>>>> struct rte_eth_rss_conf {
>>>> uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
>>>> uint8_t rss_key_len; /**< hash key length in bytes. */
>>>> uint64_t rss_hf; /**< Hash functions to apply - see below. */
>>>> + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
>>>
>>> You can drop "to apply" words.
>> Fixed in V3.
>>>
>>> How the algorithms support combinations in rss_hf?
>>>
>> The rss_hf defines the input of the RSS hash algorithms.
>> For example, rss_hf = RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_IPV4,
>> these two kinds of packets can be dispatched to different queues
>> according to their tuple field value.
>> For ipv4-tcp packets, src-ip, dst-ip, src-port, dst-port are used as
>> parameters of RSS hash algorithms to compute hash value.
>> For ipv4 packets src-ip, dst-ip are used.
>>
>> If rss_hf = RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L4_SRC_ONLY, for
>> ipv4-tcp packets, src-port is used as parameters of RSS hash algorithms
>> to compute hash value.
>
> I know what is rss_hf.
> My question is about the algorithms.
> Do they all support any combination in rss_hf?
>
>
I don't know about all vendors' hardware implementations,
so here's just my simple opinion.
Theoretically, I think that all algorithms should support all
combinations in rss_hf, The reasons are as follows.
1. The rss_hf and algorithms are independent. For different algorithms
and the same packets and hash key, the input parameters for different
algorithms should be the same, which depends on implemetation of hardware.
2. As long as hardware and driver support, all packet types defined by
rss_hf could generate the the input parameters for the algorithm to compute.
Thanks,
Jie Hai
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-09-06 15:10 ` Stephen Hemminger
@ 2023-09-08 9:28 ` Jie Hai
2023-09-08 20:58 ` Stephen Hemminger
0 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-09-08 9:28 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, liudongdong3
Hi, Stephen Hemminger
On 2023/9/6 23:10, Stephen Hemminger wrote:
> On Sat, 26 Aug 2023 15:46:03 +0800
> Jie Hai <haijie1@huawei.com> wrote:
>
>> 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_rss_conf`` is extended by adding a new
>> field "func". This represents the RSS algorithms to apply. The
>> following API is affected:
>> - rte_eth_dev_configure
>> - rte_eth_dev_rss_hash_update
>> - rte_eth_dev_rss_hash_conf_get
>>
>> If the value of "func" used for configuration is a gibberish
>> value, report the error and return. Do the same for
>> rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
>>
>> To check whether the drivers report the "func" field, it is set
>> to default value before querying.
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>
> This is unannounced API/ABI change.
Thanks for pointing that. I'm sorry I didn't pay attention to this before.
What should I do with this set of patches?
Is it feasible to send annouce now?
>
> .
Thanks,
Jie Hai
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-09-08 9:28 ` Jie Hai
@ 2023-09-08 20:58 ` Stephen Hemminger
2023-09-12 1:49 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: Stephen Hemminger @ 2023-09-08 20:58 UTC (permalink / raw)
To: Jie Hai
Cc: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, liudongdong3
On Fri, 8 Sep 2023 17:28:08 +0800
Jie Hai <haijie1@huawei.com> wrote:
> Hi, Stephen Hemminger
>
> On 2023/9/6 23:10, Stephen Hemminger wrote:
> > On Sat, 26 Aug 2023 15:46:03 +0800
> > Jie Hai <haijie1@huawei.com> wrote:
> >
> >> 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_rss_conf`` is extended by adding a new
> >> field "func". This represents the RSS algorithms to apply. The
> >> following API is affected:
> >> - rte_eth_dev_configure
> >> - rte_eth_dev_rss_hash_update
> >> - rte_eth_dev_rss_hash_conf_get
> >>
> >> If the value of "func" used for configuration is a gibberish
> >> value, report the error and return. Do the same for
> >> rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
> >>
> >> To check whether the drivers report the "func" field, it is set
> >> to default value before querying.
> >>
> >> Signed-off-by: Jie Hai <haijie1@huawei.com>
> >> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> >
> > This is unannounced API/ABI change.
> Thanks for pointing that. I'm sorry I didn't pay attention to this before.
> What should I do with this set of patches?
> Is it feasible to send annouce now?
Since this API/ABI breaking release, I am ok taking it. But will need a release
note. Also you should treat 0 as "no change" case to allow for code that does hash_update
without setting the value.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-09-08 8:44 ` Jie Hai
@ 2023-09-09 0:01 ` Ajit Khaparde
2023-09-11 10:09 ` Thomas Monjalon
0 siblings, 1 reply; 222+ messages in thread
From: Ajit Khaparde @ 2023-09-09 0:01 UTC (permalink / raw)
To: Jie Hai
Cc: Thomas Monjalon, dev, Ferruh Yigit, Andrew Rybchenko,
liudongdong3, orika, jerinj
[-- Attachment #1: Type: text/plain, Size: 3255 bytes --]
On Fri, Sep 8, 2023 at 1:44 AM Jie Hai <haijie1@huawei.com> wrote:
>
> Hi, Thomas
> Thanks for your review.
>
> On 2023/9/4 15:45, Thomas Monjalon wrote:
> > 04/09/2023 09:10, Jie Hai:
> >> On 2023/8/30 19:46, Thomas Monjalon wrote:
> >>> 26/08/2023 09:46, Jie Hai:
> > >> + * The *func* field of the *rss_conf* structure indicates the hash algorithm
> >>>> + * applied by the RSS hashing. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
> >>>> + * the PMD to use its best-effort algorithm rather than a specific one.
> >>>> */
> >>>
> >>> I don't like commenting a field on top of the structure.
> >>> By the way, the first sentence does not look helpful.
> >>> RTE_ETH_HASH_FUNCTION_DEFAULT may be explained in the enum.
> >>>
> >> Other fields above the structure 'rte_eth_rss_conf' have comments.
> >> If the new fields 'func' do not have comments, it may be misleading.
> >> Unless all the comments above are removed. I'm not sure whether to
> >> delete them or not.
> >
> > You should explain RTE_ETH_HASH_FUNCTION_DEFAULT in its enum.
> > The rest of the explanation can be on the struct field.
> > I'm OK to have another patch moving old explanations from the struct
> > to the fields.
> Fixed in V4, please check it.
> >
> >>>> struct rte_eth_rss_conf {
> >>>> uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
> >>>> uint8_t rss_key_len; /**< hash key length in bytes. */
> >>>> uint64_t rss_hf; /**< Hash functions to apply - see below. */
> >>>> + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
> >>>
> >>> You can drop "to apply" words.
> >> Fixed in V3.
> >>>
> >>> How the algorithms support combinations in rss_hf?
> >>>
> >> The rss_hf defines the input of the RSS hash algorithms.
> >> For example, rss_hf = RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_IPV4,
> >> these two kinds of packets can be dispatched to different queues
> >> according to their tuple field value.
> >> For ipv4-tcp packets, src-ip, dst-ip, src-port, dst-port are used as
> >> parameters of RSS hash algorithms to compute hash value.
> >> For ipv4 packets src-ip, dst-ip are used.
> >>
> >> If rss_hf = RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L4_SRC_ONLY, for
> >> ipv4-tcp packets, src-port is used as parameters of RSS hash algorithms
> >> to compute hash value.
> >
> > I know what is rss_hf.
> > My question is about the algorithms.
> > Do they all support any combination in rss_hf?
> >
> >
> I don't know about all vendors' hardware implementations,
> so here's just my simple opinion.
>
> Theoretically, I think that all algorithms should support all
> combinations in rss_hf, The reasons are as follows.
Leave it to the driver and hardware to decide what combinations can be
supported.
>
> 1. The rss_hf and algorithms are independent. For different algorithms
> and the same packets and hash key, the input parameters for different
> algorithms should be the same, which depends on implemetation of hardware.
>
> 2. As long as hardware and driver support, all packet types defined by
> rss_hf could generate the the input parameters for the algorithm to compute.
>
> Thanks,
> Jie Hai
> > .
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-09-09 0:01 ` Ajit Khaparde
@ 2023-09-11 10:09 ` Thomas Monjalon
2023-09-11 16:11 ` Ajit Khaparde
0 siblings, 1 reply; 222+ messages in thread
From: Thomas Monjalon @ 2023-09-11 10:09 UTC (permalink / raw)
To: Jie Hai, Ajit Khaparde
Cc: dev, Ferruh Yigit, Andrew Rybchenko, liudongdong3, orika, jerinj
09/09/2023 02:01, Ajit Khaparde:
> On Fri, Sep 8, 2023 at 1:44 AM Jie Hai <haijie1@huawei.com> wrote:
> >
> > Hi, Thomas
> > Thanks for your review.
> >
> > On 2023/9/4 15:45, Thomas Monjalon wrote:
> > > 04/09/2023 09:10, Jie Hai:
> > >> On 2023/8/30 19:46, Thomas Monjalon wrote:
> > >>> 26/08/2023 09:46, Jie Hai:
> > > >> + * The *func* field of the *rss_conf* structure indicates the hash algorithm
> > >>>> + * applied by the RSS hashing. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
> > >>>> + * the PMD to use its best-effort algorithm rather than a specific one.
> > >>>> */
> > >>>
> > >>> I don't like commenting a field on top of the structure.
> > >>> By the way, the first sentence does not look helpful.
> > >>> RTE_ETH_HASH_FUNCTION_DEFAULT may be explained in the enum.
> > >>>
> > >> Other fields above the structure 'rte_eth_rss_conf' have comments.
> > >> If the new fields 'func' do not have comments, it may be misleading.
> > >> Unless all the comments above are removed. I'm not sure whether to
> > >> delete them or not.
> > >
> > > You should explain RTE_ETH_HASH_FUNCTION_DEFAULT in its enum.
> > > The rest of the explanation can be on the struct field.
> > > I'm OK to have another patch moving old explanations from the struct
> > > to the fields.
> > Fixed in V4, please check it.
> > >
> > >>>> struct rte_eth_rss_conf {
> > >>>> uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
> > >>>> uint8_t rss_key_len; /**< hash key length in bytes. */
> > >>>> uint64_t rss_hf; /**< Hash functions to apply - see below. */
> > >>>> + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
> > >>>
> > >>> You can drop "to apply" words.
> > >> Fixed in V3.
> > >>>
> > >>> How the algorithms support combinations in rss_hf?
> > >>>
> > >> The rss_hf defines the input of the RSS hash algorithms.
> > >> For example, rss_hf = RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_IPV4,
> > >> these two kinds of packets can be dispatched to different queues
> > >> according to their tuple field value.
> > >> For ipv4-tcp packets, src-ip, dst-ip, src-port, dst-port are used as
> > >> parameters of RSS hash algorithms to compute hash value.
> > >> For ipv4 packets src-ip, dst-ip are used.
> > >>
> > >> If rss_hf = RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L4_SRC_ONLY, for
> > >> ipv4-tcp packets, src-port is used as parameters of RSS hash algorithms
> > >> to compute hash value.
> > >
> > > I know what is rss_hf.
> > > My question is about the algorithms.
> > > Do they all support any combination in rss_hf?
> > >
> > >
> > I don't know about all vendors' hardware implementations,
> > so here's just my simple opinion.
> >
> > Theoretically, I think that all algorithms should support all
> > combinations in rss_hf, The reasons are as follows.
>
> Leave it to the driver and hardware to decide what combinations can be
> supported.
>
> >
> > 1. The rss_hf and algorithms are independent. For different algorithms
> > and the same packets and hash key, the input parameters for different
> > algorithms should be the same, which depends on implemetation of hardware.
> >
> > 2. As long as hardware and driver support, all packet types defined by
> > rss_hf could generate the the input parameters for the algorithm to compute.
How the application can know a hash is not supported with an algo?
I guess this is an error code on configure?
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-09-11 10:09 ` Thomas Monjalon
@ 2023-09-11 16:11 ` Ajit Khaparde
0 siblings, 0 replies; 222+ messages in thread
From: Ajit Khaparde @ 2023-09-11 16:11 UTC (permalink / raw)
To: Thomas Monjalon
Cc: Jie Hai, dev, Ferruh Yigit, Andrew Rybchenko, liudongdong3,
orika, jerinj
[-- Attachment #1: Type: text/plain, Size: 3834 bytes --]
On Mon, Sep 11, 2023 at 3:09 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 09/09/2023 02:01, Ajit Khaparde:
> > On Fri, Sep 8, 2023 at 1:44 AM Jie Hai <haijie1@huawei.com> wrote:
> > >
> > > Hi, Thomas
> > > Thanks for your review.
> > >
> > > On 2023/9/4 15:45, Thomas Monjalon wrote:
> > > > 04/09/2023 09:10, Jie Hai:
> > > >> On 2023/8/30 19:46, Thomas Monjalon wrote:
> > > >>> 26/08/2023 09:46, Jie Hai:
> > > > >> + * The *func* field of the *rss_conf* structure indicates the hash algorithm
> > > >>>> + * applied by the RSS hashing. Passing RTE_ETH_HASH_FUNCTION_DEFAULT allows
> > > >>>> + * the PMD to use its best-effort algorithm rather than a specific one.
> > > >>>> */
> > > >>>
> > > >>> I don't like commenting a field on top of the structure.
> > > >>> By the way, the first sentence does not look helpful.
> > > >>> RTE_ETH_HASH_FUNCTION_DEFAULT may be explained in the enum.
> > > >>>
> > > >> Other fields above the structure 'rte_eth_rss_conf' have comments.
> > > >> If the new fields 'func' do not have comments, it may be misleading.
> > > >> Unless all the comments above are removed. I'm not sure whether to
> > > >> delete them or not.
> > > >
> > > > You should explain RTE_ETH_HASH_FUNCTION_DEFAULT in its enum.
> > > > The rest of the explanation can be on the struct field.
> > > > I'm OK to have another patch moving old explanations from the struct
> > > > to the fields.
> > > Fixed in V4, please check it.
> > > >
> > > >>>> struct rte_eth_rss_conf {
> > > >>>> uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
> > > >>>> uint8_t rss_key_len; /**< hash key length in bytes. */
> > > >>>> uint64_t rss_hf; /**< Hash functions to apply - see below. */
> > > >>>> + enum rte_eth_hash_function func; /**< Hash algorithm to apply. */
> > > >>>
> > > >>> You can drop "to apply" words.
> > > >> Fixed in V3.
> > > >>>
> > > >>> How the algorithms support combinations in rss_hf?
> > > >>>
> > > >> The rss_hf defines the input of the RSS hash algorithms.
> > > >> For example, rss_hf = RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_IPV4,
> > > >> these two kinds of packets can be dispatched to different queues
> > > >> according to their tuple field value.
> > > >> For ipv4-tcp packets, src-ip, dst-ip, src-port, dst-port are used as
> > > >> parameters of RSS hash algorithms to compute hash value.
> > > >> For ipv4 packets src-ip, dst-ip are used.
> > > >>
> > > >> If rss_hf = RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L4_SRC_ONLY, for
> > > >> ipv4-tcp packets, src-port is used as parameters of RSS hash algorithms
> > > >> to compute hash value.
> > > >
> > > > I know what is rss_hf.
> > > > My question is about the algorithms.
> > > > Do they all support any combination in rss_hf?
> > > >
> > > >
> > > I don't know about all vendors' hardware implementations,
> > > so here's just my simple opinion.
> > >
> > > Theoretically, I think that all algorithms should support all
> > > combinations in rss_hf, The reasons are as follows.
> >
> > Leave it to the driver and hardware to decide what combinations can be
> > supported.
> >
> > >
> > > 1. The rss_hf and algorithms are independent. For different algorithms
> > > and the same packets and hash key, the input parameters for different
> > > algorithms should be the same, which depends on implemetation of hardware.
> > >
> > > 2. As long as hardware and driver support, all packet types defined by
> > > rss_hf could generate the the input parameters for the algorithm to compute.
>
> How the application can know a hash is not supported with an algo?
> I guess this is an error code on configure?
Yes. We may need a way to differentiate errors because of RSS vs others.
>
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm
2023-09-08 20:58 ` Stephen Hemminger
@ 2023-09-12 1:49 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-12 1:49 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, liudongdong3
On 2023/9/9 4:58, Stephen Hemminger wrote:
> On Fri, 8 Sep 2023 17:28:08 +0800
> Jie Hai <haijie1@huawei.com> wrote:
>
>> Hi, Stephen Hemminger
>>
>> On 2023/9/6 23:10, Stephen Hemminger wrote:
>>> On Sat, 26 Aug 2023 15:46:03 +0800
>>> Jie Hai <haijie1@huawei.com> wrote:
>>>
>>>> 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_rss_conf`` is extended by adding a new
>>>> field "func". This represents the RSS algorithms to apply. The
>>>> following API is affected:
>>>> - rte_eth_dev_configure
>>>> - rte_eth_dev_rss_hash_update
>>>> - rte_eth_dev_rss_hash_conf_get
>>>>
>>>> If the value of "func" used for configuration is a gibberish
>>>> value, report the error and return. Do the same for
>>>> rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
>>>>
>>>> To check whether the drivers report the "func" field, it is set
>>>> to default value before querying.
>>>>
>>>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>>>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>>>
>>> This is unannounced API/ABI change.
>> Thanks for pointing that. I'm sorry I didn't pay attention to this before.
>> What should I do with this set of patches?
>> Is it feasible to send annouce now?
>
> Since this API/ABI breaking release, I am ok taking it. But will need a release
> note. Also you should treat 0 as "no change" case to allow for code that does hash_update
> without setting the value.
>
The release note 'doc/guides/rel_notes/release_23_11.rst' has been
updated in this patch. Please check it.
Whether or not to treat 0 as no change depends on the implemetation of
the driver.
According to the drivers that support algorithm modification through the
flow API, the 0 is regarded as no change.
It is believed that these drivers have the same behavior when updating
the hash_update with setting algorithm.
For the current drivers that do hash_update without setting the 'func'
value, the implemetation does not involve the modification of the
algorithm.
In either case, 0 is regarded as "no change".
>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* RE: [PATCH v4 6/7] app/proc-info: support querying RSS hash algorithm
2023-09-08 8:00 ` [PATCH v4 6/7] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-09-13 11:42 ` Pattan, Reshma
2023-09-13 11:44 ` Pattan, Reshma
1 sibling, 0 replies; 222+ messages in thread
From: Pattan, Reshma @ 2023-09-13 11:42 UTC (permalink / raw)
To: Jie Hai, dev; +Cc: lihuisong
> -----Original Message-----
> From: Jie Hai <haijie1@huawei.com>
> Subject: [PATCH v4 6/7] app/proc-info: support querying RSS hash algorithm
>
> Display RSS hash algorithm with command show-port as below.
> - RSS info
> -- hash algorithm : toeplitz
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
^ permalink raw reply [flat|nested] 222+ messages in thread
* RE: [PATCH v4 6/7] app/proc-info: support querying RSS hash algorithm
2023-09-08 8:00 ` [PATCH v4 6/7] app/proc-info: support querying RSS hash algorithm Jie Hai
2023-09-13 11:42 ` Pattan, Reshma
@ 2023-09-13 11:44 ` Pattan, Reshma
1 sibling, 0 replies; 222+ messages in thread
From: Pattan, Reshma @ 2023-09-13 11:44 UTC (permalink / raw)
To: Jie Hai, dev; +Cc: lihuisong
> -----Original Message-----
> From: Jie Hai <haijie1@huawei.com>
> Sent: Friday, September 8, 2023 9:00 AM
> To: dev@dpdk.org; Pattan, Reshma <reshma.pattan@intel.com>
> Cc: haijie1@huawei.com; lihuisong@huawei.com
> Subject: [PATCH v4 6/7] app/proc-info: support querying RSS hash algorithm
>
> Display RSS hash algorithm with command show-port as below.
> - RSS info
> -- hash algorithm : toeplitz
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
^ permalink raw reply [flat|nested] 222+ messages in thread
* RE: [PATCH v4 4/7] app/proc-info: fix never show RSS info
2023-09-08 8:00 ` [PATCH v4 4/7] app/proc-info: fix never show RSS info Jie Hai
@ 2023-09-13 11:48 ` Pattan, Reshma
2023-09-25 1:13 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: Pattan, Reshma @ 2023-09-13 11:48 UTC (permalink / raw)
To: Jie Hai, dev, Vipin Varghese, Mcnamara, John; +Cc: lihuisong
> -----Original Message-----
> From: Jie Hai <haijie1@huawei.com>
> Sent: Friday, September 8, 2023 9:00 AM
> To: dev@dpdk.org; Pattan, Reshma <reshma.pattan@intel.com>; Vipin
> Varghese <vipin.varghese@amd.com>; Mcnamara, John
> <john.mcnamara@intel.com>
> Cc: haijie1@huawei.com; lihuisong@huawei.com
> Subject: [PATCH v4 4/7] app/proc-info: fix never show RSS info
>
> 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 allocates memory for rss_conf.rss_key and
> makes it possible to show RSS info.
>
Nitpick:
You have to change the commit message as malloc and free not used now.
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
^ permalink raw reply [flat|nested] 222+ messages in thread
* RE: [PATCH v4 5/7] app/proc-info: adjust the display format of RSS info
2023-09-08 8:00 ` [PATCH v4 5/7] app/proc-info: adjust the display format of " Jie Hai
@ 2023-09-13 12:22 ` Pattan, Reshma
0 siblings, 0 replies; 222+ messages in thread
From: Pattan, Reshma @ 2023-09-13 12:22 UTC (permalink / raw)
To: Jie Hai, dev, Mcnamara, John, Vipin Varghese; +Cc: lihuisong
> -----Original Message-----
> From: Jie Hai <haijie1@huawei.com>
> Subject: [PATCH v4 5/7] app/proc-info: adjust the display format of RSS info
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
Acked-by: Reshma Pattan<reshma.pattan@intel.com>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v4 1/7] ethdev: recomment some definitions related to RSS
2023-09-08 8:00 ` [PATCH v4 1/7] ethdev: recomment some definitions related to RSS Jie Hai
@ 2023-09-20 16:39 ` Ferruh Yigit
2023-09-26 12:08 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-09-20 16:39 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam; +Cc: lihuisong
On 9/8/2023 9:00 AM, Jie Hai wrote:
> 1. Recomment fields of 'rte_eth_rss_conf'.
> 2. Add comments for RTE_ETH_HASH_FUNCTION_DEFAULT.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> lib/ethdev/rte_ethdev.h | 28 +++++++++++++---------------
> lib/ethdev/rte_flow.h | 4 ++++
> 2 files changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index 04a2564f222a..40cfbb7efddd 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -448,24 +448,22 @@ 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. */
> + /**
> + * If not NULL, 40-byte hash key to use for hashing specific header
> + * fields of received packets. The size of rss_key should be indicated
> + * by *rss_key_len* below.
>
It says key length is 40 bytes, also says key length is defined by
'rss_key_len'. I wonder how can we clarify this more, what about like:
If not NULL, hash key to use for hashing.
The size of rss_key should be indicated by *rss_key_len* below. Drivers
are free to ignore the *rss_key_len* and assume key length is 40 bytes.
> + * Otherwise, a default random hash key is used by the device driver.
> + */
> + uint8_t *rss_key;
> uint8_t rss_key_len; /**< hash key length in bytes. */
> - uint64_t rss_hf; /**< Hash functions to apply - see below. */
> + /**
> + * The different types of packets to which the RSS hashing must be
> + * applied, may be combined with SRC/DST_ONLY, see below.
I find this difficult to understand, can we simplify it?
The name 'hf' (hash function) is confusing on its own, but it is too
much burden to update it, at least we can clarify it with the above
documentation.
rte_flow defines it as 'types' (rte_flow_action_rss.type)
(and it has 'func' for "hash algorithm" to increase confusion).
Can we define something like (please don't use as it is, just thinking):
"
Set part of the packet that hashing will be applied for RSS purposes
(see RTE_ETH_RSS_*).
"
> + * Supplying an *rss_hf* equal to zero disables the RSS feature.
> + */
s/Supply/Set/ ?
"Setting *rss_hf* to zero disables the RSS feature."
> + uint64_t rss_hf;
> };
>
> /*
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index 2ebb76dbc083..3bd0dc64fbe2 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -3187,6 +3187,10 @@ struct rte_flow_query_count {
> * Hash function types.
> */
> enum rte_eth_hash_function {
> + /**
> + * DEFAULT means that conformance to a specific hash algorithm is
> + * uncared to the caller. The driver can pick the one it deems optimal.
Not sure about word 'uncared' usage here, what about:
"
DEFAULT means driver decides which hash algorithm to pick.
"
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v4 2/7] ethdev: support setting and querying RSS algorithm
2023-09-08 8:00 ` [PATCH v4 2/7] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-09-20 16:39 ` Ferruh Yigit
2023-09-20 17:15 ` Ajit Khaparde
2023-09-26 13:23 ` Jie Hai
0 siblings, 2 replies; 222+ messages in thread
From: Ferruh Yigit @ 2023-09-20 16:39 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam; +Cc: lihuisong
On 9/8/2023 9:00 AM, Jie Hai wrote:
> 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_rss_conf`` is extended by adding a new
> field "func". This represents the RSS algorithms to apply. The
> following API will be affected:
> - rte_eth_dev_configure
> - rte_eth_dev_rss_hash_update
> - rte_eth_dev_rss_hash_conf_get
>
The problem with adding new configuration fields is, none of the drivers
are using it.
I can see you are updating hns3 driver in next patch, but what about
others, application will set this field and almost all drivers will
ignore it for now.
And in near future, some will be supporting it and some won't, still
frustrating for the application perspective.
In the past I was gathering list of these items and follow
implementation of them with drivers, but as the number of drivers
increased this became very hard to manage.
Another way to manage this is go and update all drivers, and if the
configuration requests anything other than
'RTE_ETH_HASH_FUNCTION_DEFAULT', return error. So that application can
know this is not supported by this driver.
Do you have better solution for this?
> If the value of "func" used for configuration is a gibberish
> value, report the error and return. Do the same for
> rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
>
> To check whether the drivers report the "func" field, it is set
> to default value before querying.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> ---
> doc/guides/rel_notes/release_23_11.rst | 2 ++
> lib/ethdev/rte_ethdev.c | 17 +++++++++++++++++
> lib/ethdev/rte_ethdev.h | 21 +++++++++++++++++++++
> lib/ethdev/rte_flow.c | 1 -
> lib/ethdev/rte_flow.h | 22 ++--------------------
> 5 files changed, 42 insertions(+), 21 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
> index 333e1d95a283..deb019fbe4c1 100644
> --- a/doc/guides/rel_notes/release_23_11.rst
> +++ b/doc/guides/rel_notes/release_23_11.rst
> @@ -129,6 +129,8 @@ ABI Changes
> Also, make sure to start the actual text at the margin.
> =======================================================
>
> +* ethdev: Added "func" 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 0840d2b5942a..4cbcdb344cac 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -1445,6 +1445,14 @@ 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.func >= RTE_ETH_HASH_FUNCTION_MAX) {
> + RTE_ETHDEV_LOG(ERR,
> + "Ethdev port_id=%u invalid rss hash function (%u)\n",
> + port_id, dev_conf->rx_adv_conf.rss_conf.func);
> + ret = -EINVAL;
> + goto rollback;
> + }
> +
> /* Check if Rx RSS distribution is disabled but RSS hash is enabled. */
> if (((dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) == 0) &&
> (dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
> @@ -4630,6 +4638,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
> return -ENOTSUP;
> }
>
> + if (rss_conf->func >= RTE_ETH_HASH_FUNCTION_MAX) {
> + RTE_ETHDEV_LOG(ERR,
> + "Ethdev port_id=%u invalid rss hash function (%u)\n",
> + port_id, rss_conf->func);
> + return -EINVAL;
> + }
> +
> if (*dev->dev_ops->rss_hash_update == NULL)
> return -ENOTSUP;
> ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
> @@ -4657,6 +4672,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
> return -EINVAL;
> }
>
> + rss_conf->func = RTE_ETH_HASH_FUNCTION_DEFAULT;
> +
>
I think setting this in ethdev level is not required if you update all
drivers to not accept anything other than 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 40cfbb7efddd..33cec3570f85 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -445,6 +445,26 @@ struct rte_vlan_filter_conf {
> uint64_t ids[64];
> };
>
> +/**
> + * Hash function types.
> + */
> +enum rte_eth_hash_function {
> + /**
> + * DEFAULT means that conformance to a specific hash algorithm is
> + * uncared to the caller. The driver can pick the one it deems optimal.
> + */
> + 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,
> + RTE_ETH_HASH_FUNCTION_MAX,
As we are moving this to ethdev.h, when we want to add a new algorithm,
it will cause ABI break because of the 'RTE_ETH_HASH_FUNCTION_MAX', and
it will need to wait. Is there a way to eliminate this MAX enum?
> +};
> +
> /**
> * A structure used to configure the Receive Side Scaling (RSS) feature
> * of an Ethernet port.
> @@ -464,6 +484,7 @@ struct rte_eth_rss_conf {
> * Supplying an *rss_hf* equal to zero disables the RSS feature.
> */
> uint64_t rss_hf;
> + enum rte_eth_hash_function func; /**< Hash algorithm. */
Can we use 'algorithm' as the field name?
I know it won't exactly match type name (rte_eth_hash_function) but I
think this will be more accurate also less confusing for "rss_hf (rss
hash function)" and "func (function)"?
> };
>
> /*
> diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
> index 271d854f7807..d3f2d466d841 100644
> --- a/lib/ethdev/rte_flow.c
> +++ b/lib/ethdev/rte_flow.c
> @@ -12,7 +12,6 @@
> #include <rte_branch_prediction.h>
> #include <rte_string_fns.h>
> #include <rte_mbuf_dyn.h>
> -#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 3bd0dc64fbe2..a7578b1d2eff 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -40,6 +40,8 @@
> #include <rte_macsec.h>
> #include <rte_ib.h>
>
> +#include "rte_ethdev.h"
> +
> #ifdef __cplusplus
> extern "C" {
> #endif
> @@ -3183,26 +3185,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 that conformance to a specific hash algorithm is
> - * uncared to the caller. The driver can pick the one it deems optimal.
> - */
> - 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,
> - RTE_ETH_HASH_FUNCTION_MAX,
> -};
> -
> /**
> * RTE_FLOW_ACTION_TYPE_RSS
> *
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v4 2/7] ethdev: support setting and querying RSS algorithm
2023-09-20 16:39 ` Ferruh Yigit
@ 2023-09-20 17:15 ` Ajit Khaparde
2023-09-26 13:23 ` Jie Hai
1 sibling, 0 replies; 222+ messages in thread
From: Ajit Khaparde @ 2023-09-20 17:15 UTC (permalink / raw)
To: Ferruh Yigit
Cc: Jie Hai, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam, lihuisong
[-- Attachment #1: Type: text/plain, Size: 3924 bytes --]
On Wed, Sep 20, 2023 at 9:39 AM Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>
> On 9/8/2023 9:00 AM, Jie Hai wrote:
> > 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_rss_conf`` is extended by adding a new
> > field "func". This represents the RSS algorithms to apply. The
> > following API will be affected:
> > - rte_eth_dev_configure
> > - rte_eth_dev_rss_hash_update
> > - rte_eth_dev_rss_hash_conf_get
> >
>
> The problem with adding new configuration fields is, none of the drivers
> are using it.
>
> I can see you are updating hns3 driver in next patch, but what about
> others, application will set this field and almost all drivers will
> ignore it for now.
> And in near future, some will be supporting it and some won't, still
> frustrating for the application perspective.
>
> In the past I was gathering list of these items and follow
> implementation of them with drivers, but as the number of drivers
> increased this became very hard to manage.
>
> Another way to manage this is go and update all drivers, and if the
> configuration requests anything other than
> 'RTE_ETH_HASH_FUNCTION_DEFAULT', return error. So that application can
> know this is not supported by this driver.
I think it is a good option. And then a driver can modify it when it
adds support for
other algorithms.
> Do you have better solution for this?
>
:::: snip ::::
>
> > +};
> > +
> > /**
> > * A structure used to configure the Receive Side Scaling (RSS) feature
> > * of an Ethernet port.
> > @@ -464,6 +484,7 @@ struct rte_eth_rss_conf {
> > * Supplying an *rss_hf* equal to zero disables the RSS feature.
> > */
> > uint64_t rss_hf;
> > + enum rte_eth_hash_function func; /**< Hash algorithm. */
>
> Can we use 'algorithm' as the field name?
>
> I know it won't exactly match type name (rte_eth_hash_function) but I
> think this will be more accurate also less confusing for "rss_hf (rss
> hash function)" and "func (function)"?
+1
>
> > };
> >
> > /*
> > diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
> > index 271d854f7807..d3f2d466d841 100644
> > --- a/lib/ethdev/rte_flow.c
> > +++ b/lib/ethdev/rte_flow.c
> > @@ -12,7 +12,6 @@
> > #include <rte_branch_prediction.h>
> > #include <rte_string_fns.h>
> > #include <rte_mbuf_dyn.h>
> > -#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 3bd0dc64fbe2..a7578b1d2eff 100644
> > --- a/lib/ethdev/rte_flow.h
> > +++ b/lib/ethdev/rte_flow.h
> > @@ -40,6 +40,8 @@
> > #include <rte_macsec.h>
> > #include <rte_ib.h>
> >
> > +#include "rte_ethdev.h"
> > +
> > #ifdef __cplusplus
> > extern "C" {
> > #endif
> > @@ -3183,26 +3185,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 that conformance to a specific hash algorithm is
> > - * uncared to the caller. The driver can pick the one it deems optimal.
> > - */
> > - 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,
> > - RTE_ETH_HASH_FUNCTION_MAX,
> > -};
> > -
> > /**
> > * RTE_FLOW_ACTION_TYPE_RSS
> > *
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v4 4/7] app/proc-info: fix never show RSS info
2023-09-13 11:48 ` Pattan, Reshma
@ 2023-09-25 1:13 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-25 1:13 UTC (permalink / raw)
To: Pattan, Reshma, dev, Vipin Varghese, Mcnamara, John; +Cc: lihuisong
On 2023/9/13 19:48, Pattan, Reshma wrote:
>
>
>> -----Original Message-----
>> From: Jie Hai <haijie1@huawei.com>
>> Sent: Friday, September 8, 2023 9:00 AM
>> To: dev@dpdk.org; Pattan, Reshma <reshma.pattan@intel.com>; Vipin
>> Varghese <vipin.varghese@amd.com>; Mcnamara, John
>> <john.mcnamara@intel.com>
>> Cc: haijie1@huawei.com; lihuisong@huawei.com
>> Subject: [PATCH v4 4/7] app/proc-info: fix never show RSS info
>>
>> 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 allocates memory for rss_conf.rss_key and
>> makes it possible to show RSS info.
>>
>
Hi, Pattan, Reshma
> Nitpick:
> You have to change the commit message as malloc and free not used now.
>
> Acked-by: Reshma Pattan <reshma.pattan@intel.com>
>
>
Thanks for your comment, will do in next version.
Best regards,
Jie Hai
>
>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v4 1/7] ethdev: recomment some definitions related to RSS
2023-09-20 16:39 ` Ferruh Yigit
@ 2023-09-26 12:08 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-26 12:08 UTC (permalink / raw)
To: Ferruh Yigit, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam; +Cc: lihuisong
On 2023/9/21 0:39, Ferruh Yigit wrote:
> On 9/8/2023 9:00 AM, Jie Hai wrote:
>> 1. Recomment fields of 'rte_eth_rss_conf'.
>> 2. Add comments for RTE_ETH_HASH_FUNCTION_DEFAULT.
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> ---
>> lib/ethdev/rte_ethdev.h | 28 +++++++++++++---------------
>> lib/ethdev/rte_flow.h | 4 ++++
>> 2 files changed, 17 insertions(+), 15 deletions(-)
>>
>> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
>> index 04a2564f222a..40cfbb7efddd 100644
>> --- a/lib/ethdev/rte_ethdev.h
>> +++ b/lib/ethdev/rte_ethdev.h
>> @@ -448,24 +448,22 @@ 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. */
>> + /**
>> + * If not NULL, 40-byte hash key to use for hashing specific header
>> + * fields of received packets. The size of rss_key should be indicated
>> + * by *rss_key_len* below.
>>
>
> It says key length is 40 bytes, also says key length is defined by
> 'rss_key_len'. I wonder how can we clarify this more, what about like:
>
> If not NULL, hash key to use for hashing.
> The size of rss_key should be indicated by *rss_key_len* below. Drivers
> are free to ignore the *rss_key_len* and assume key length is 40 bytes.
>
Not all drivers use 40-bytes hash key,
e.g. the cnxk driver use hash key with length ROC_NIX_RSS_KEY_LEN(48).
I think it's best not to mention '40 bytes' in the comments.
This structure is used for querying and configuring, How about the
following statements:
/**
* If used to query, the'rss_key_len' indicates the sizeof rss key of
* the hardware. And only when rss_key_len is not zero, the 'rss_key'
* is valid.
* If used to configure, rss_key_len indicates the length of the
* 'rss_key' if 'rss_key' is not empty.
*/
>
>> + * Otherwise, a default random hash key is used by the device driver.
>> + */
>> + uint8_t *rss_key;
>> uint8_t rss_key_len; /**< hash key length in bytes. */
>> - uint64_t rss_hf; /**< Hash functions to apply - see below. */
>> + /**
>> + * The different types of packets to which the RSS hashing must be
>> + * applied, may be combined with SRC/DST_ONLY, see below.
>
> I find this difficult to understand, can we simplify it?
>
> The name 'hf' (hash function) is confusing on its own, but it is too
> much burden to update it, at least we can clarify it with the above
> documentation.
>
> rte_flow defines it as 'types' (rte_flow_action_rss.type)
> (and it has 'func' for "hash algorithm" to increase confusion).
>
> Can we define something like (please don't use as it is, just thinking):
> "
> Set part of the packet that hashing will be applied for RSS purposes
> (see RTE_ETH_RSS_*).
How about "Indicating which type of packets and which part of the
packets to be applied for RSS hash, (see RTE_ETH_RSS_*)."
> "
>
>> + * Supplying an *rss_hf* equal to zero disables the RSS feature.
>> + */
>
> s/Supply/Set/ ?
> "Setting *rss_hf* to zero disables the RSS feature."
Will correct.
>
>> + uint64_t rss_hf;
>> };
>>
>> /*
>> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
>> index 2ebb76dbc083..3bd0dc64fbe2 100644
>> --- a/lib/ethdev/rte_flow.h
>> +++ b/lib/ethdev/rte_flow.h
>> @@ -3187,6 +3187,10 @@ struct rte_flow_query_count {
>> * Hash function types.
>> */
>> enum rte_eth_hash_function {
>> + /**
>> + * DEFAULT means that conformance to a specific hash algorithm is
>> + * uncared to the caller. The driver can pick the one it deems optimal.
>
> Not sure about word 'uncared' usage here, what about:
>
> "
> DEFAULT means driver decides which hash algorithm to pick.
> "
>
That's better.
>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v4 2/7] ethdev: support setting and querying RSS algorithm
2023-09-20 16:39 ` Ferruh Yigit
2023-09-20 17:15 ` Ajit Khaparde
@ 2023-09-26 13:23 ` Jie Hai
1 sibling, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-09-26 13:23 UTC (permalink / raw)
To: Ferruh Yigit, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam; +Cc: lihuisong
On 2023/9/21 0:39, Ferruh Yigit wrote:
> On 9/8/2023 9:00 AM, Jie Hai wrote:
>> 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_rss_conf`` is extended by adding a new
>> field "func". This represents the RSS algorithms to apply. The
>> following API will be affected:
>> - rte_eth_dev_configure
>> - rte_eth_dev_rss_hash_update
>> - rte_eth_dev_rss_hash_conf_get
>>
>
> The problem with adding new configuration fields is, none of the drivers
> are using it.
>
> I can see you are updating hns3 driver in next patch, but what about
> others, application will set this field and almost all drivers will
> ignore it for now.
> And in near future, some will be supporting it and some won't, still
> frustrating for the application perspective.
>
> In the past I was gathering list of these items and follow
> implementation of them with drivers, but as the number of drivers
> increased this became very hard to manage.
>
> Another way to manage this is go and update all drivers, and if the
> configuration requests anything other than
> 'RTE_ETH_HASH_FUNCTION_DEFAULT', return error. So that application can
> know this is not supported by this driver.
> Do you have better solution for this?
>
I know this may not be reasonable, how about adding new ops to
the query and configuration of the RSS algorithm?
>
>> If the value of "func" used for configuration is a gibberish
>> value, report the error and return. Do the same for
>> rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
>>
>> To check whether the drivers report the "func" field, it is set
>> to default value before querying.
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> ---
>> doc/guides/rel_notes/release_23_11.rst | 2 ++
>> lib/ethdev/rte_ethdev.c | 17 +++++++++++++++++
>> lib/ethdev/rte_ethdev.h | 21 +++++++++++++++++++++
>> lib/ethdev/rte_flow.c | 1 -
>> lib/ethdev/rte_flow.h | 22 ++--------------------
>> 5 files changed, 42 insertions(+), 21 deletions(-)
>>
>> diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
>> index 333e1d95a283..deb019fbe4c1 100644
>> --- a/doc/guides/rel_notes/release_23_11.rst
>> +++ b/doc/guides/rel_notes/release_23_11.rst
>> @@ -129,6 +129,8 @@ ABI Changes
>> Also, make sure to start the actual text at the margin.
>> =======================================================
>>
>> +* ethdev: Added "func" 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 0840d2b5942a..4cbcdb344cac 100644
>> --- a/lib/ethdev/rte_ethdev.c
>> +++ b/lib/ethdev/rte_ethdev.c
>> @@ -1445,6 +1445,14 @@ 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.func >= RTE_ETH_HASH_FUNCTION_MAX) {
>> + RTE_ETHDEV_LOG(ERR,
>> + "Ethdev port_id=%u invalid rss hash function (%u)\n",
>> + port_id, dev_conf->rx_adv_conf.rss_conf.func);
>> + ret = -EINVAL;
>> + goto rollback;
>> + }
>> +
>> /* Check if Rx RSS distribution is disabled but RSS hash is enabled. */
>> if (((dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) == 0) &&
>> (dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
>> @@ -4630,6 +4638,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
>> return -ENOTSUP;
>> }
>>
>> + if (rss_conf->func >= RTE_ETH_HASH_FUNCTION_MAX) {
>> + RTE_ETHDEV_LOG(ERR,
>> + "Ethdev port_id=%u invalid rss hash function (%u)\n",
>> + port_id, rss_conf->func);
>> + return -EINVAL;
>> + }
>> +
>> if (*dev->dev_ops->rss_hash_update == NULL)
>> return -ENOTSUP;
>> ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
>> @@ -4657,6 +4672,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
>> return -EINVAL;
>> }
>>
>> + rss_conf->func = RTE_ETH_HASH_FUNCTION_DEFAULT;
>> +
>>
>
> I think setting this in ethdev level is not required if you update all
> drivers to not accept anything other than DEFAULT.
>
>
I initialized this field to prevent some drivers from not reporting RSS
algorithms.
If an improper parameter is transferred before an API is invoked, the
query result will be incorrect.
>> 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 40cfbb7efddd..33cec3570f85 100644
>> --- a/lib/ethdev/rte_ethdev.h
>> +++ b/lib/ethdev/rte_ethdev.h
>> @@ -445,6 +445,26 @@ struct rte_vlan_filter_conf {
>> uint64_t ids[64];
>> };
>>
>> +/**
>> + * Hash function types.
>> + */
>> +enum rte_eth_hash_function {
>> + /**
>> + * DEFAULT means that conformance to a specific hash algorithm is
>> + * uncared to the caller. The driver can pick the one it deems optimal.
>> + */
>> + 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,
>> + RTE_ETH_HASH_FUNCTION_MAX,
>
> As we are moving this to ethdev.h, when we want to add a new algorithm,
> it will cause ABI break because of the 'RTE_ETH_HASH_FUNCTION_MAX', and
> it will need to wait. Is there a way to eliminate this MAX enum?
>
How about assigning RTE_ETH_HASH_FUNCTION_MAX a larger value, e.g. 255 ?
>> +};
>> +
>> /**
>> * A structure used to configure the Receive Side Scaling (RSS) feature
>> * of an Ethernet port.
>> @@ -464,6 +484,7 @@ struct rte_eth_rss_conf {
>> * Supplying an *rss_hf* equal to zero disables the RSS feature.
>> */
>> uint64_t rss_hf;
>> + enum rte_eth_hash_function func; /**< Hash algorithm. */
>
> Can we use 'algorithm' as the field name?
>
> I know it won't exactly match type name (rte_eth_hash_function) but I
> think this will be more accurate also less confusing for "rss_hf (rss
> hash function)" and "func (function)"?
>
Considering the comprehensibility, I agree with the proposal.
>> };
>>
>> /*
>> diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
>> index 271d854f7807..d3f2d466d841 100644
>> --- a/lib/ethdev/rte_flow.c
>> +++ b/lib/ethdev/rte_flow.c
>> @@ -12,7 +12,6 @@
>> #include <rte_branch_prediction.h>
>> #include <rte_string_fns.h>
>> #include <rte_mbuf_dyn.h>
>> -#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 3bd0dc64fbe2..a7578b1d2eff 100644
>> --- a/lib/ethdev/rte_flow.h
>> +++ b/lib/ethdev/rte_flow.h
>> @@ -40,6 +40,8 @@
>> #include <rte_macsec.h>
>> #include <rte_ib.h>
>>
>> +#include "rte_ethdev.h"
>> +
>> #ifdef __cplusplus
>> extern "C" {
>> #endif
>> @@ -3183,26 +3185,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 that conformance to a specific hash algorithm is
>> - * uncared to the caller. The driver can pick the one it deems optimal.
>> - */
>> - 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,
>> - RTE_ETH_HASH_FUNCTION_MAX,
>> -};
>> -
>> /**
>> * RTE_FLOW_ACTION_TYPE_RSS
>> *
>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 00/40] support setting and querying RSS algorithms
2023-09-08 8:00 ` [PATCH v4 0/7] support setting and querying RSS algorithms Jie Hai
` (6 preceding siblings ...)
2023-09-08 8:00 ` [PATCH v4 7/7] app/testpmd: add RSS hash algorithms display Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 01/40] ethdev: overwrite some comment related to RSS Jie Hai
` (43 more replies)
7 siblings, 44 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev; +Cc: lihuisong, fengchengwen, liudongdong3
This patchset is to support setting and querying RSS algorithms.
--
v5:
1. rewrite some comments.
2. check RSS algorithm for drivers supporting RSS.
3. change field "func" of rss_conf to "algorithm".
4. fix commit log for [PATCH v4 4/7].
5. add Acked-by Reshma Pattan.
6. add symmetric_toeplitz_sort for showing.
7. change "hf" to "hash function" for showing.
v4:
1. recomment some definitions related to RSS.
2. allocate static memory for rss_key instead of dynamic.
3. use array of strings to get the name of rss algorithm.
4. add display of rss algorithm with testpmd.
v3:
1. fix commit log for PATCH [1/5].
2. make RSS ABI changes description to start the actual text at the margin.
3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
4. fix some comment codes.
v2:
1. return error if "func" is invalid.
2. modify the comments of the "func" field.
3. modify commit log of patch [3/5].
4. use malloc instead of rte_malloc.
5. adjust display format of RSS info.
6. remove the string display of rss_hf.
Huisong Li (1):
net/hns3: support setting and querying RSS hash function
Jie Hai (39):
ethdev: overwrite some comment related to RSS
ethdev: support setting and querying RSS algorithm
net/atlantic: check RSS hash algorithms
net/axgbe: check RSS hash algorithms
net/bnx2x: check RSS hash algorithms
net/bnxt: check RSS hash algorithms
net/bonding: check RSS hash algorithms
net/cnxk: check RSS hash algorithms
net/cpfl: check RSS hash algorithms
net/cxgbe: check RSS hash algorithms
net/dpaa: check RSS hash algorithms
net/dpaa2: check RSS hash algorithms
net/ena: check RSS hash algorithms
net/enic: check RSS hash algorithms
net/fm10k: check RSS hash algorithms
net/hinic: check RSS hash algorithms
net/i40e: check RSS hash algorithms
net/iavf: check RSS hash algorithms
net/ice: check RSS hash algorithms
net/idpf: check RSS hash algorithms
net/igc: check RSS hash algorithms
net/ionic: check RSS hash algorithms
net/ixgbe: check RSS hash algorithms
net/mana: check RSS hash algorithms
net/mlx5: check RSS hash algorithms
net/mvpp2: check RSS hash algorithms
net/netvsc: check RSS hash algorithms
net/ngbe: : check RSS hash algorithms
net/nfp: check RSS hash algorithms
net/null: check RSS hash algorithms
net/qede: check RSS hash algorithms
net/sfc: check RSS hash algorithms
net/tap: check RSS hash algorithms
net/thunderx: check RSS hash algorithms
net/txgbe: check RSS hash algorithms
app/proc-info: fix never show RSS info
app/proc-info: adjust the display format of RSS info
app/proc-info: support querying RSS hash algorithm
app/testpmd: add RSS hash algorithms display
app/proc-info/main.c | 32 ++++++++++-----
app/test-pmd/cmdline.c | 29 ++++++++++---
app/test-pmd/config.c | 38 ++++++++---------
app/test-pmd/testpmd.h | 2 +-
doc/guides/rel_notes/release_23_11.rst | 2 +
drivers/net/atlantic/atl_ethdev.c | 2 +
drivers/net/axgbe/axgbe_ethdev.c | 9 +++++
drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++
drivers/net/bnxt/bnxt_ethdev.c | 6 +++
drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++
drivers/net/cnxk/cnxk_ethdev.c | 5 +++
drivers/net/cnxk/cnxk_ethdev_ops.c | 3 ++
drivers/net/cpfl/cpfl_ethdev.c | 6 +++
drivers/net/cxgbe/cxgbe_ethdev.c | 9 ++++-
drivers/net/dpaa/dpaa_ethdev.c | 7 ++++
drivers/net/dpaa2/dpaa2_ethdev.c | 7 ++++
drivers/net/ena/ena_rss.c | 3 ++
drivers/net/enic/enic_ethdev.c | 1 +
drivers/net/enic/enic_main.c | 3 ++
drivers/net/fm10k/fm10k_ethdev.c | 9 ++++-
drivers/net/hinic/hinic_pmd_ethdev.c | 3 ++
drivers/net/hinic/hinic_pmd_rx.c | 3 ++
drivers/net/hns3/hns3_rss.c | 47 ++++++++++++---------
drivers/net/i40e/i40e_ethdev.c | 7 ++++
drivers/net/iavf/iavf_ethdev.c | 6 +++
drivers/net/ice/ice_dcf.c | 3 ++
drivers/net/ice/ice_dcf_ethdev.c | 3 ++
drivers/net/ice/ice_ethdev.c | 7 ++++
drivers/net/idpf/idpf_ethdev.c | 6 +++
drivers/net/igc/igc_ethdev.c | 4 ++
drivers/net/igc/igc_txrx.c | 5 +++
drivers/net/ionic/ionic_ethdev.c | 6 +++
drivers/net/ixgbe/ixgbe_ethdev.c | 12 +++++-
drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++
drivers/net/mana/mana.c | 11 ++++-
drivers/net/mlx5/mlx5_ethdev.c | 4 ++
drivers/net/mlx5/mlx5_rss.c | 3 +-
drivers/net/mvpp2/mrvl_ethdev.c | 3 ++
drivers/net/netvsc/hn_ethdev.c | 6 +++
drivers/net/nfp/nfp_common.c | 9 ++++-
drivers/net/ngbe/ngbe_ethdev.c | 6 ++-
drivers/net/ngbe/ngbe_rxtx.c | 3 ++
drivers/net/null/rte_eth_null.c | 8 ++++
drivers/net/qede/qede_ethdev.c | 9 ++++-
drivers/net/sfc/sfc_ethdev.c | 3 ++
drivers/net/sfc/sfc_rx.c | 3 ++
drivers/net/tap/rte_eth_tap.c | 8 ++++
drivers/net/thunderx/nicvf_ethdev.c | 10 ++++-
drivers/net/txgbe/txgbe_ethdev.c | 7 +++-
drivers/net/txgbe/txgbe_ethdev_vf.c | 7 +++-
drivers/net/txgbe/txgbe_rxtx.c | 3 ++
lib/ethdev/rte_ethdev.c | 17 ++++++++
lib/ethdev/rte_ethdev.h | 56 +++++++++++++++++++-------
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 25 +-----------
55 files changed, 395 insertions(+), 106 deletions(-)
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 01/40] ethdev: overwrite some comment related to RSS
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 16:31 ` Ferruh Yigit
2023-10-12 2:47 ` fengchengwen
2023-10-11 9:27 ` [PATCH v5 02/40] ethdev: support setting and querying RSS algorithm Jie Hai
` (42 subsequent siblings)
43 siblings, 2 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
---
lib/ethdev/rte_ethdev.h | 29 ++++++++++++++---------------
lib/ethdev/rte_flow.h | 3 +++
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 8542257721c9..b9e4e21189d2 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -448,24 +448,23 @@ 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. */
+ /**
+ * If used to query, the'rss_key_len' indicates the size of rss key of
+ * the hardware. And only when rss_key_len is not zero, the 'rss_key'
+ * is valid.
+ * If used to configure, rss_key_len indicates the length of the
+ * 'rss_key' if 'rss_key' is not empty.
+ */
+ uint8_t *rss_key;
uint8_t rss_key_len; /**< hash key length in bytes. */
- uint64_t rss_hf; /**< Hash functions to apply - see below. */
+ /**
+ * Indicating which type of packets and which part of the packets
+ * to apply for RSS hash, (see RTE_ETH_RSS_*).
+ * Setting *rss_hf* to zero disables the RSS feature.
+ */
+ uint64_t rss_hf;
};
/*
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index b385741fba6d..5d9e3c68af7b 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -3227,6 +3227,9 @@ 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 */
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 02/40] ethdev: support setting and querying RSS algorithm
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
2023-10-11 9:27 ` [PATCH v5 01/40] ethdev: overwrite some comment related to RSS Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 17:39 ` Stephen Hemminger
2023-10-11 9:27 ` [PATCH v5 03/40] net/atlantic: check RSS hash algorithms Jie Hai
` (41 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
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_rss_conf`` is extended by adding a new
field "algorithm". This represents the RSS algorithms to apply.
The following API will be affected:
- rte_eth_dev_configure
- rte_eth_dev_rss_hash_update
- rte_eth_dev_rss_hash_conf_get
If the value of "algorithm" used for configuration is a gibberish
value, report the error and return. Do the same for
rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
To check whether the drivers report valid "algorithm", it is set
to default value before querying.
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
doc/guides/rel_notes/release_23_11.rst | 2 ++
lib/ethdev/rte_ethdev.c | 17 ++++++++++++++++
lib/ethdev/rte_ethdev.h | 27 +++++++++++++++++++++++++
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 28 ++------------------------
5 files changed, 48 insertions(+), 27 deletions(-)
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index e13d57728071..92a445ab2ed3 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -197,6 +197,8 @@ ABI Changes
fields, to move ``rxq`` and ``txq`` fields, to change the size of
``reserved1`` and ``reserved2`` fields.
+* 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 18a4b950b184..2eda1b8072e5 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1464,6 +1464,14 @@ 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.algorithm >= RTE_ETH_HASH_FUNCTION_MAX) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ethdev port_id=%u invalid RSS algorithm: 0x%"PRIx64"\n",
+ port_id, dev_conf->rx_adv_conf.rss_conf.algorithm);
+ ret = -EINVAL;
+ goto rollback;
+ }
+
/* Check if Rx RSS distribution is disabled but RSS hash is enabled. */
if (((dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) == 0) &&
(dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
@@ -4673,6 +4681,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
return -ENOTSUP;
}
+ if (rss_conf->algorithm >= RTE_ETH_HASH_FUNCTION_MAX) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ethdev port_id=%u invalid RSS algorithm: 0x%"PRIx64"\n",
+ port_id, rss_conf->algorithm);
+ return -EINVAL;
+ }
+
if (*dev->dev_ops->rss_hash_update == NULL)
return -ENOTSUP;
ret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
@@ -4700,6 +4715,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 b9e4e21189d2..42c4250bd509 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -445,6 +445,32 @@ 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,
+};
+
/**
* A structure used to configure the Receive Side Scaling (RSS) feature
* of an Ethernet port.
@@ -465,6 +491,7 @@ struct rte_eth_rss_conf {
* Setting *rss_hf* to zero disables the RSS feature.
*/
uint64_t rss_hf;
+ enum rte_eth_hash_function algorithm; /**< Hash algorithm. */
};
/*
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index ba8bf27090fb..deedce08fb0a 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -13,7 +13,6 @@
#include <rte_branch_prediction.h>
#include <rte_string_fns.h>
#include <rte_mbuf_dyn.h>
-#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 5d9e3c68af7b..877a2e1d6ad3 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -40,6 +40,8 @@
#include <rte_macsec.h>
#include <rte_ib.h>
+#include "rte_ethdev.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -3223,32 +3225,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
*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 03/40] net/atlantic: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
2023-10-11 9:27 ` [PATCH v5 01/40] ethdev: overwrite some comment related to RSS Jie Hai
2023-10-11 9:27 ` [PATCH v5 02/40] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 04/40] net/axgbe: " Jie Hai
` (40 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Igor Russkikh; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/atlantic/atl_ethdev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index 3a028f429002..c6e772d47263 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -1857,6 +1857,8 @@ atl_rss_hash_update(struct rte_eth_dev *dev,
};
cfg->is_rss = !!rss_conf->rss_hf;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
if (rss_conf->rss_key) {
memcpy(cfg->aq_rss.hash_secret_key, rss_conf->rss_key,
rss_conf->rss_key_len);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 04/40] net/axgbe: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (2 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 03/40] net/atlantic: check RSS hash algorithms Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 05/40] net/bnx2x: " Jie Hai
` (39 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Selwin Sebastian; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/axgbe/axgbe_ethdev.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index d08ea4893c37..f67faff2d636 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -339,6 +339,12 @@ static int
axgbe_dev_configure(struct rte_eth_dev *dev)
{
struct axgbe_port *pdata = dev->data->dev_private;
+
+ if (dev->data->dev_conf.rxmode.mq_mode == RTE_ETH_MQ_RX_RSS &&
+ dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
/* Checksum offload to hardware */
pdata->rx_csum_enable = dev->data->dev_conf.rxmode.offloads &
RTE_ETH_RX_OFFLOAD_CHECKSUM;
@@ -582,6 +588,9 @@ axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
return -EINVAL;
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (rss_conf->rss_key != NULL &&
rss_conf->rss_key_len == AXGBE_RSS_HASH_KEY_SIZE) {
rte_memcpy(pdata->rss_key, rss_conf->rss_key,
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 05/40] net/bnx2x: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (3 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 04/40] net/axgbe: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 17:02 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 06/40] net/bnxt: " Jie Hai
` (38 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Julien Aube; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 4448cf2de2d7..078d6db75d1b 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -196,6 +196,10 @@ bnx2x_dev_configure(struct rte_eth_dev *dev)
PMD_DRV_LOG(DEBUG, sc, "num_queues=%d, mtu=%d",
sc->num_queues, sc->mtu);
+ if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
/* allocate ilt */
if (bnx2x_alloc_ilt_mem(sc) != 0) {
PMD_DRV_LOG(ERR, sc, "bnx2x_alloc_ilt_mem was failed");
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 06/40] net/bnxt: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (4 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 05/40] net/bnx2x: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 07/40] net/bonding: " Jie Hai
` (37 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Ajit Khaparde, Somnath Kotur; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index ee1552452a11..92ce05b26dc7 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1166,6 +1166,9 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
rx_offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
eth_dev->data->dev_conf.rxmode.offloads = rx_offloads;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
/* application provides the hash key to program */
if (rss_conf->rss_key != NULL) {
if (rss_conf->rss_key_len != HW_HASH_KEY_SIZE)
@@ -2168,6 +2171,9 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
return -EINVAL;
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
/* Update the default RSS VNIC(s) */
vnic = bnxt_get_default_vnic(bp);
vnic->hash_type = bnxt_rte_to_hwrm_hash_types(rss_conf->rss_hf);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 07/40] net/bonding: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (5 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 06/40] net/bnxt: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 08/40] net/cnxk: " Jie Hai
` (36 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Chas Williams, Min Hu (Connor); +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/bonding/rte_eth_bond_pmd.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 122b1187fd9c..75ad0270af03 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -3187,6 +3187,9 @@ bond_ethdev_rss_hash_update(struct rte_eth_dev *dev,
if (bond_rss_conf.rss_hf != 0)
dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf = bond_rss_conf.rss_hf;
+ if (bond_rss_conf.algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (bond_rss_conf.rss_key) {
if (bond_rss_conf.rss_key_len < internals->rss_key_len)
return -EINVAL;
@@ -3915,6 +3918,9 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
struct rte_eth_rss_conf *rss_conf =
&dev->data->dev_conf.rx_adv_conf.rss_conf;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (internals->rss_key_len == 0) {
internals->rss_key_len = sizeof(default_rss_key);
}
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 08/40] net/cnxk: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (6 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 07/40] net/bonding: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 17:04 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 09/40] net/cpfl: " Jie Hai
` (35 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao
Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/cnxk/cnxk_ethdev.c | 5 +++++
drivers/net/cnxk/cnxk_ethdev_ops.c | 3 +++
2 files changed, 8 insertions(+)
diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 01b707b6c4ac..dc150de745df 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -976,6 +976,10 @@ nix_rss_default_setup(struct cnxk_eth_dev *dev)
if (rss_hash_level)
rss_hash_level -= 1;
+ if (eth_dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
flowkey_cfg = cnxk_rss_ethdev_to_nix(dev, rss_hf, rss_hash_level);
return roc_nix_rss_default_setup(&dev->nix, flowkey_cfg);
}
@@ -1373,6 +1377,7 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
}
/* Configure RSS */
+
rc = nix_rss_default_setup(dev);
if (rc) {
plt_err("Failed to configure rss rc=%d", rc);
diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c
index 3ade8eed3626..b6cba99cbb7f 100644
--- a/drivers/net/cnxk/cnxk_ethdev_ops.c
+++ b/drivers/net/cnxk/cnxk_ethdev_ops.c
@@ -1054,6 +1054,9 @@ cnxk_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
int rc = -EINVAL;
uint8_t alg_idx;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ goto fail;
+
if (rss_conf->rss_key && rss_conf->rss_key_len != ROC_NIX_RSS_KEY_LEN) {
plt_err("Hash key size mismatch %d vs %d",
rss_conf->rss_key_len, ROC_NIX_RSS_KEY_LEN);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 09/40] net/cpfl: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (7 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 08/40] net/cnxk: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 17:20 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 10/40] net/cxgbe: " Jie Hai
` (34 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Yuying Zhang, Beilei Xing; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/cpfl/cpfl_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index c4ca9343c3e0..6acb6ce9fd22 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -450,6 +450,9 @@ cpfl_init_rss(struct idpf_vport *vport)
rss_conf = &dev_data->dev_conf.rx_adv_conf.rss_conf;
nb_q = dev_data->nb_rx_queues;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (rss_conf->rss_key == NULL) {
for (i = 0; i < vport->rss_key_size; i++)
vport->rss_key[i] = (uint8_t)rte_rand();
@@ -568,6 +571,9 @@ cpfl_rss_hash_update(struct rte_eth_dev *dev,
return -ENOTSUP;
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (!rss_conf->rss_key || rss_conf->rss_key_len == 0) {
PMD_DRV_LOG(DEBUG, "No key to be configured");
goto skip_rss_key;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 10/40] net/cxgbe: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (8 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 09/40] net/cpfl: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 11/40] net/dpaa: " Jie Hai
` (33 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Rahul Lakkireddy; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/cxgbe/cxgbe_ethdev.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 45bbeaef0ceb..8de57bbfe661 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -440,9 +440,13 @@ int cxgbe_dev_configure(struct rte_eth_dev *eth_dev)
CXGBE_FUNC_TRACE();
- if (eth_dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+ if (eth_dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
eth_dev->data->dev_conf.rxmode.offloads |=
RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ if (eth_dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+ }
if (!(adapter->flags & FW_QUEUE_BOUND)) {
err = cxgbe_setup_sge_fwevtq(adapter);
@@ -1165,6 +1169,9 @@ static int cxgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
struct adapter *adapter = pi->adapter;
int err;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
err = cxgbe_write_rss_conf(pi, rss_conf->rss_hf);
if (err)
return err;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 11/40] net/dpaa: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (9 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 10/40] net/cxgbe: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 12/40] net/dpaa2: " Jie Hai
` (32 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Hemant Agrawal, Sachin Saxena; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/dpaa/dpaa_ethdev.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index a6c86113d125..c4d5de9ba21d 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -258,6 +258,10 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
}
if (!(default_q || fmc_q)) {
+ if (eth_conf->rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (dpaa_fm_config(dev,
eth_conf->rx_adv_conf.rss_conf.rss_hf)) {
dpaa_write_fm_config_to_file();
@@ -1446,6 +1450,9 @@ dpaa_dev_rss_hash_update(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
if (!(default_q || fmc_q)) {
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (dpaa_fm_config(dev, rss_conf->rss_hf)) {
DPAA_PMD_ERR("FM port configuration: Failed\n");
return -1;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 12/40] net/dpaa2: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (10 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 11/40] net/dpaa: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 13/40] net/ena: " Jie Hai
` (31 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Hemant Agrawal, Sachin Saxena; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/dpaa2/dpaa2_ethdev.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 679f33ae1a08..355c94b6112f 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -583,6 +583,10 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
}
if (eth_conf->rxmode.mq_mode == RTE_ETH_MQ_RX_RSS) {
+ if (eth_conf->rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
for (tc_index = 0; tc_index < priv->num_rx_tc; tc_index++) {
ret = dpaa2_setup_flow_dist(dev,
eth_conf->rx_adv_conf.rss_conf.rss_hf,
@@ -2194,6 +2198,9 @@ dpaa2_dev_rss_hash_update(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (rss_conf->rss_hf) {
for (tc_index = 0; tc_index < priv->num_rx_tc; tc_index++) {
ret = dpaa2_setup_flow_dist(dev, rss_conf->rss_hf,
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 13/40] net/ena: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (11 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 12/40] net/dpaa2: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 17:27 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 14/40] net/enic: " Jie Hai
` (30 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Michal Krawczyk, Shai Brandes, Evgeny Schemeilin,
Igor Chauskin, Ron Beider
Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
| 3 +++
1 file changed, 3 insertions(+)
--git a/drivers/net/ena/ena_rss.c b/drivers/net/ena/ena_rss.c
index d0ba9d5c0a14..06aff9f3bd49 100644
--- a/drivers/net/ena/ena_rss.c
+++ b/drivers/net/ena/ena_rss.c
@@ -398,6 +398,9 @@ static int ena_rss_hash_set(struct ena_com_dev *ena_dev,
uint8_t *rss_key;
int rc;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (rss_conf->rss_key != NULL) {
/* Reorder the RSS key bytes for the hardware requirements. */
ena_reorder_rss_hash_key(hw_rss_key, rss_conf->rss_key,
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 14/40] net/enic: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (12 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 13/40] net/ena: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 17:32 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 15/40] net/fm10k: " Jie Hai
` (29 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, John Daley, Hyong Youb Kim; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/enic/enic_ethdev.c | 1 +
drivers/net/enic/enic_main.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index cdf091559196..164f423a85c8 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -834,6 +834,7 @@ static int enicpmd_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
ENICPMD_FUNC_TRACE();
if (rss_conf == NULL)
return -EINVAL;
+
if (rss_conf->rss_key != NULL &&
rss_conf->rss_key_len < ENIC_RSS_HASH_KEY_SIZE) {
dev_err(enic, "rss_hash_conf_get: wrong rss_key_len. given=%u"
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 19a99a82c501..2eafe7637b3a 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1428,6 +1428,9 @@ int enic_set_rss_conf(struct enic *enic, struct rte_eth_rss_conf *rss_conf)
}
}
+ if (rss_enable && rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
ret = enic_set_niccfg(enic, ENIC_RSS_DEFAULT_CPU, rss_hash_type,
ENIC_RSS_HASH_BITS, ENIC_RSS_BASE_CPU,
rss_enable);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 15/40] net/fm10k: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (13 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 14/40] net/enic: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 16/40] net/hinic: " Jie Hai
` (28 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Qi Zhang, Xiao Wang; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/fm10k/fm10k_ethdev.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 4d3c4c10cfa4..d8b27e84d836 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -452,8 +452,12 @@ fm10k_dev_configure(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
- if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+ if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+ }
/* multiple queue mode checking */
ret = fm10k_check_mq_mode(dev);
@@ -2195,6 +2199,9 @@ fm10k_rss_hash_update(struct rte_eth_dev *dev,
FM10K_RSSRK_ENTRIES_PER_REG))
return -EINVAL;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (hf == 0)
return -EINVAL;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 16/40] net/hinic: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (14 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 15/40] net/fm10k: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 17/40] net/i40e: " Jie Hai
` (27 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou
Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/hinic/hinic_pmd_ethdev.c | 3 +++
drivers/net/hinic/hinic_pmd_rx.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 7aa5e7d8e929..e818dc939073 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -1937,6 +1937,9 @@ static int hinic_rss_hash_update(struct rte_eth_dev *dev,
return HINIC_OK;
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return HINIC_ERROR;
+
if (rss_conf->rss_key_len > HINIC_RSS_KEY_SIZE) {
PMD_DRV_LOG(ERR, "Invalid rss key, rss_key_len: %d",
rss_conf->rss_key_len);
diff --git a/drivers/net/hinic/hinic_pmd_rx.c b/drivers/net/hinic/hinic_pmd_rx.c
index 7adb6e365993..7736b61c0b0f 100644
--- a/drivers/net/hinic/hinic_pmd_rx.c
+++ b/drivers/net/hinic/hinic_pmd_rx.c
@@ -670,6 +670,9 @@ int hinic_rx_configure(struct rte_eth_dev *dev)
goto rss_config_err;
}
+ if (rss_conf.algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ goto rss_config_err;
+
err = hinic_rss_init(nic_dev, NULL, &rss_conf);
if (err) {
PMD_DRV_LOG(ERR, "Init rss failed");
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 17/40] net/i40e: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (15 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 16/40] net/hinic: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 18/40] net/iavf: " Jie Hai
` (26 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Yuying Zhang, Beilei Xing; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/i40e/i40e_ethdev.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 50ba9aac9498..fcd6d4eb0495 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -7749,6 +7749,9 @@ i40e_dev_rss_hash_update(struct rte_eth_dev *dev,
if (rss_hf == 0) /* Disable RSS */
return -EINVAL;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
return i40e_hw_rss_hash_set(pf, rss_conf);
}
@@ -8986,6 +8989,10 @@ i40e_pf_config_rss(struct i40e_pf *pf)
!(mq_mode & RTE_ETH_MQ_RX_RSS_FLAG))
return 0;
+ if (pf->dev_data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
hw = I40E_PF_TO_HW(pf);
hena = i40e_config_hena(pf->adapter, rss_hf);
i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), (uint32_t)hena);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 18/40] net/iavf: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (16 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 17/40] net/i40e: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 19/40] net/ice: " Jie Hai
` (25 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Jingjing Wu, Beilei Xing; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/iavf/iavf_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index f2fc5a56216d..9d6950d462a6 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -523,6 +523,9 @@ iavf_init_rss(struct iavf_adapter *adapter)
return -ENOTSUP;
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
/* configure RSS key */
if (!rss_conf->rss_key) {
/* Calculate the default hash key */
@@ -1588,6 +1591,9 @@ iavf_dev_rss_hash_update(struct rte_eth_dev *dev,
if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF))
return -ENOTSUP;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
/* Set hash key. */
ret = iavf_set_rss_key(adapter, rss_conf->rss_key,
rss_conf->rss_key_len);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 19/40] net/ice: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (17 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 18/40] net/iavf: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 20/40] net/idpf: " Jie Hai
` (24 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Qiming Yang, Qi Zhang; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/ice/ice_dcf.c | 3 +++
drivers/net/ice/ice_dcf_ethdev.c | 3 +++
drivers/net/ice/ice_ethdev.c | 7 +++++++
3 files changed, 13 insertions(+)
diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 7f8f5163acef..bff39cf9d145 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -1120,6 +1120,9 @@ ice_dcf_init_rss(struct ice_dcf_hw *hw)
return ice_dcf_configure_rss_lut(hw);
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
/* In IAVF, RSS enablement is set by PF driver. It is not supported
* to set based on rss_conf->rss_hf.
*/
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index 30ad18d8fc20..f0db68c5dee5 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -1405,6 +1405,9 @@ ice_dcf_dev_rss_hash_update(struct rte_eth_dev *dev,
if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF))
return -ENOTSUP;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
/* HENA setting, it is enabled by default, no change */
if (!rss_conf->rss_key || rss_conf->rss_key_len == 0) {
PMD_DRV_LOG(DEBUG, "No key to be configured");
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 4bad39c2c1c9..0cba6f7d7b6a 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -3383,6 +3383,10 @@ static int ice_init_rss(struct ice_pf *pf)
return -ENOMEM;
}
}
+
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
/* configure RSS key */
if (!rss_conf->rss_key)
ice_get_default_rss_key(vsi->rss_key, vsi->rss_key_size);
@@ -5046,6 +5050,9 @@ ice_rss_hash_update(struct rte_eth_dev *dev,
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct ice_vsi *vsi = pf->main_vsi;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
/* set hash key */
status = ice_set_rss_key(vsi, rss_conf->rss_key, rss_conf->rss_key_len);
if (status)
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 20/40] net/idpf: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (18 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 19/40] net/ice: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 21/40] net/igc: " Jie Hai
` (23 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Jingjing Wu, Beilei Xing; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/idpf/idpf_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 3af7cf0bb7e0..013db04ac8fc 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -426,6 +426,9 @@ idpf_init_rss(struct idpf_vport *vport)
rss_conf = &dev_data->dev_conf.rx_adv_conf.rss_conf;
nb_q = dev_data->nb_rx_queues;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (rss_conf->rss_key == NULL) {
for (i = 0; i < vport->rss_key_size; i++)
vport->rss_key[i] = (uint8_t)rte_rand();
@@ -541,6 +544,9 @@ idpf_rss_hash_update(struct rte_eth_dev *dev,
return -ENOTSUP;
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (!rss_conf->rss_key || rss_conf->rss_key_len == 0) {
PMD_DRV_LOG(DEBUG, "No key to be configured");
goto skip_rss_key;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 21/40] net/igc: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (19 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 20/40] net/idpf: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 17:51 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 22/40] net/ionic: " Jie Hai
` (22 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Junfeng Guo, Simei Su; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/igc/igc_ethdev.c | 4 ++++
drivers/net/igc/igc_txrx.c | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 58c4f8092772..11c0f5ff231b 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -2442,6 +2442,10 @@ eth_igc_rss_hash_update(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf)
{
struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
+
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
igc_hw_rss_hash_set(hw, rss_conf);
return 0;
}
diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c
index 5c60e3e99709..5e62e00d2ad9 100644
--- a/drivers/net/igc/igc_txrx.c
+++ b/drivers/net/igc/igc_txrx.c
@@ -818,6 +818,7 @@ igc_rss_configure(struct rte_eth_dev *dev)
rss_conf = dev->data->dev_conf.rx_adv_conf.rss_conf;
if (rss_conf.rss_key == NULL)
rss_conf.rss_key = default_rss_key;
+
igc_hw_rss_hash_set(hw, &rss_conf);
}
@@ -958,6 +959,10 @@ igc_dev_mq_rx_configure(struct rte_eth_dev *dev)
return -EINVAL;
}
+ if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
switch (dev->data->dev_conf.rxmode.mq_mode) {
case RTE_ETH_MQ_RX_RSS:
igc_rss_configure(dev);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 22/40] net/ionic: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (20 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 21/40] net/igc: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 23/40] net/ixgbe: " Jie Hai
` (21 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Andrew Boyer; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/ionic/ionic_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 340fd0cd5923..e2e4d23c069b 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -642,6 +642,9 @@ ionic_dev_rss_hash_update(struct rte_eth_dev *eth_dev,
if (rss_conf->rss_key)
key = rss_conf->rss_key;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if ((rss_conf->rss_hf & IONIC_ETH_RSS_OFFLOAD_ALL) == 0) {
/*
* Can't disable rss through hash flags,
@@ -826,6 +829,9 @@ ionic_dev_configure(struct rte_eth_dev *eth_dev)
IONIC_PRINT_CALL();
+ if (eth_dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
ionic_lif_configure(lif);
return 0;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 23/40] net/ixgbe: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (21 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 22/40] net/ionic: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 24/40] net/mana: " Jie Hai
` (20 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Qiming Yang, Wenjun Wu; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/ixgbe/ixgbe_ethdev.c | 12 ++++++++++--
drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d6cf00317e77..b92cd746a061 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2434,8 +2434,12 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
- if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+ if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+ }
/* multiple queue mode checking */
ret = ixgbe_check_mq_mode(dev);
@@ -5326,8 +5330,12 @@ ixgbevf_dev_configure(struct rte_eth_dev *dev)
PMD_INIT_LOG(DEBUG, "Configured Virtual Function port id: %d",
dev->data->port_id);
- if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+ if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+ }
/*
* VF has no ability to enable/disable HW CRC
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 90b0a7004f50..150f8065ab60 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -3631,6 +3631,10 @@ ixgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
/* RSS enabled */
if (rss_hf == 0) /* Disable RSS */
return -(EINVAL);
+
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
ixgbe_hw_rss_hash_set(hw, rss_conf);
return 0;
}
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 24/40] net/mana: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (22 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 23/40] net/ixgbe: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 25/40] net/mlx5: " Jie Hai
` (19 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Long Li; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/mana/mana.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c
index 41c3cf259584..e3055bb545d9 100644
--- a/drivers/net/mana/mana.c
+++ b/drivers/net/mana/mana.c
@@ -80,8 +80,12 @@ mana_dev_configure(struct rte_eth_dev *dev)
struct mana_priv *priv = dev->data->dev_private;
struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
- if (dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
- dev_conf->rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ if (dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
+ dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+ }
if (dev->data->nb_rx_queues != dev->data->nb_tx_queues) {
DRV_LOG(ERR, "Only support equal number of rx/tx queues");
@@ -413,6 +417,9 @@ mana_rss_hash_update(struct rte_eth_dev *dev,
return -ENODEV;
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (rss_conf->rss_hf & ~MANA_ETH_RSS_SUPPORT) {
DRV_LOG(ERR, "Port %u invalid RSS HF 0x%" PRIx64,
dev->data->port_id, rss_conf->rss_hf);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 25/40] net/mlx5: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (23 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 24/40] net/mana: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 26/40] net/mvpp2: " Jie Hai
` (18 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Matan Azrad, Viacheslav Ovsiienko, Ori Kam, Suanming Mou
Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/mlx5/mlx5_ethdev.c | 4 ++++
| 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 4a85415ff38d..5437fa531738 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -74,6 +74,10 @@ mlx5_dev_configure(struct rte_eth_dev *dev)
!!dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key;
int ret = 0;
+ if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (use_app_rss_key &&
(dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len !=
MLX5_RSS_HASH_KEY_LEN)) {
--git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c
index e2b478b75ce7..25c410e6010a 100644
--- a/drivers/net/mlx5/mlx5_rss.c
+++ b/drivers/net/mlx5/mlx5_rss.c
@@ -37,7 +37,8 @@ mlx5_rss_hash_update(struct rte_eth_dev *dev,
unsigned int i;
unsigned int idx;
- if (rss_conf->rss_hf & MLX5_RSS_HF_MASK) {
+ if (rss_conf->rss_hf & MLX5_RSS_HF_MASK ||
+ rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT) {
rte_errno = EINVAL;
return -rte_errno;
}
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 26/40] net/mvpp2: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (24 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 25/40] net/mlx5: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 18:00 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 27/40] net/netvsc: " Jie Hai
` (17 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Liron Himi; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/mvpp2/mrvl_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 359a5d1df7ab..817153af2ef1 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -440,6 +440,9 @@ mrvl_configure_rss(struct mrvl_priv *priv, struct rte_eth_rss_conf *rss_conf)
if (rss_conf->rss_key)
MRVL_LOG(WARNING, "Changing hash key is not supported");
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (rss_conf->rss_hf == 0) {
priv->ppio_params.inqs_params.hash_type = PP2_PPIO_HASH_T_NONE;
} else if (rss_conf->rss_hf & RTE_ETH_RSS_IPV4) {
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 27/40] net/netvsc: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (25 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 26/40] net/mvpp2: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 28/40] net/ngbe: : " Jie Hai
` (16 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Long Li; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/netvsc/hn_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index d0bbc0a4c0c0..9e4205816a6f 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -395,6 +395,9 @@ static int hn_rss_hash_update(struct rte_eth_dev *dev,
return err;
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
hn_rss_hash_init(hv, rss_conf);
if (rss_conf->rss_hf != 0) {
@@ -756,6 +759,9 @@ static int hn_dev_configure(struct rte_eth_dev *dev)
for (i = 0; i < NDIS_HASH_INDCNT; i++)
hv->rss_ind[i] = i % dev->data->nb_rx_queues;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
hn_rss_hash_init(hv, rss_conf);
subchan = hv->num_queues - 1;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 28/40] net/ngbe: : check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (26 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 27/40] net/netvsc: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 29/40] net/nfp: " Jie Hai
` (15 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Jiawen Wu; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/ngbe/ngbe_ethdev.c | 6 +++++-
drivers/net/ngbe/ngbe_rxtx.c | 3 +++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c
index 478da014b2f8..bb4b8afb0a80 100644
--- a/drivers/net/ngbe/ngbe_ethdev.c
+++ b/drivers/net/ngbe/ngbe_ethdev.c
@@ -921,8 +921,12 @@ ngbe_dev_configure(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
- if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+ if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
+ if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ }
/* set flag to update link status after init */
intr->flags |= NGBE_FLAG_NEED_LINK_UPDATE;
diff --git a/drivers/net/ngbe/ngbe_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c
index f31906cc2fe3..0b22d567fcb6 100644
--- a/drivers/net/ngbe/ngbe_rxtx.c
+++ b/drivers/net/ngbe/ngbe_rxtx.c
@@ -2500,6 +2500,9 @@ ngbe_dev_rss_hash_update(struct rte_eth_dev *dev,
return -ENOTSUP;
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
hash_key = rss_conf->rss_key;
if (hash_key) {
/* Fill in RSS hash key */
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 29/40] net/nfp: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (27 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 28/40] net/ngbe: : " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 30/40] net/null: " Jie Hai
` (14 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Chaoyong He, Niklas Söderlund
Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/nfp/nfp_common.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 5683afc40a31..780316c764df 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -390,8 +390,12 @@ nfp_net_configure(struct rte_eth_dev *dev)
rxmode = &dev_conf->rxmode;
txmode = &dev_conf->txmode;
- if (rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+ if (rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
rxmode->offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ if (dev_conf->rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+ }
/* Checking TX mode */
if (txmode->mq_mode) {
@@ -1805,6 +1809,9 @@ nfp_net_rss_hash_update(struct rte_eth_dev *dev,
return 0; /* Nothing to do */
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (rss_conf->rss_key_len > NFP_NET_CFG_RSS_KEY_SZ) {
PMD_DRV_LOG(ERR, "hash key too long");
return -EINVAL;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 30/40] net/null: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (28 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 29/40] net/nfp: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 18:06 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 31/40] net/qede: " Jie Hai
` (13 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Tetsuya Mukawa; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/null/rte_eth_null.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 31081af79752..8427d7484178 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -186,6 +186,11 @@ eth_null_copy_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
static int
eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
{
+ if ((dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) &&
+ dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
return 0;
}
@@ -444,6 +449,9 @@ eth_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf)
rte_spinlock_lock(&internal->rss_lock);
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if ((rss_conf->rss_hf & internal->flow_type_rss_offloads) != 0)
dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf =
rss_conf->rss_hf & internal->flow_type_rss_offloads;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 31/40] net/qede: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (29 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 30/40] net/null: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 32/40] net/sfc: " Jie Hai
` (12 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Devendra Singh Rawat, Alok Prasad
Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/qede/qede_ethdev.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 22cd4706467a..7db69e8f35e0 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1272,8 +1272,12 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
PMD_INIT_FUNC_TRACE(edev);
- if (rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+ if (rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
+ if (eth_dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
rxmode->offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ }
/* We need to have min 1 RX queue.There is no min check in
* rte_eth_dev_configure(), so we are checking it here.
@@ -2119,6 +2123,9 @@ int qede_rss_hash_update(struct rte_eth_dev *eth_dev,
DP_INFO(edev, "RSS hf = 0x%lx len = %u key = %p\n",
(unsigned long)hf, len, key);
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (hf != 0) {
/* Enabling RSS */
DP_INFO(edev, "Enabling rss\n");
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 32/40] net/sfc: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (30 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 31/40] net/qede: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 33/40] net/tap: " Jie Hai
` (11 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Andrew Rybchenko; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/sfc/sfc_ethdev.c | 3 +++
drivers/net/sfc/sfc_rx.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 1efe64a36a7f..19d7761e2664 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1728,6 +1728,9 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev,
goto fail_scale_mode_set;
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (rss_conf->rss_key != NULL) {
if (sa->state == SFC_ETHDEV_STARTED) {
for (key_i = 0; key_i < n_contexts; key_i++) {
diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index 1dde2c111001..71c151a07162 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -1519,6 +1519,9 @@ sfc_rx_process_adv_conf_rss(struct sfc_adapter *sa,
return rc;
}
+ if (conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (conf->rss_key != NULL) {
if (conf->rss_key_len != sizeof(rss->key)) {
sfc_err(sa, "RSS key size is wrong (should be %zu)",
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 33/40] net/tap: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (31 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 32/40] net/sfc: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 18:13 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 34/40] net/thunderx: " Jie Hai
` (10 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/tap/rte_eth_tap.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index b25a52655fa2..5e4813637f0b 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -1038,6 +1038,10 @@ tap_dev_configure(struct rte_eth_dev *dev)
TAP_LOG(INFO, "%s: %s: RX configured queues number: %u",
dev->device->name, pmd->name, dev->data->nb_rx_queues);
+ if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
return 0;
}
@@ -1894,6 +1898,10 @@ tap_rss_hash_update(struct rte_eth_dev *dev,
rte_errno = EINVAL;
return -rte_errno;
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT) {
+ rte_errno = EINVAL;
+ return -rte_errno;
+ }
if (rss_conf->rss_key && rss_conf->rss_key_len) {
/*
* Currently TAP RSS key is hard coded
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 34/40] net/thunderx: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (32 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 33/40] net/tap: " Jie Hai
@ 2023-10-11 9:27 ` Jie Hai
2023-10-11 9:28 ` [PATCH v5 35/40] net/txgbe: " Jie Hai
` (9 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:27 UTC (permalink / raw)
To: dev, Jerin Jacob, Maciej Czekaj; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/thunderx/nicvf_ethdev.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index ab1e714d9767..2fc54c521c88 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -621,6 +621,9 @@ nicvf_dev_rss_hash_update(struct rte_eth_dev *dev,
struct nicvf *nic = nicvf_pmd_priv(dev);
uint64_t nic_rss;
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
if (rss_conf->rss_key &&
rss_conf->rss_key_len != RSS_HASH_KEY_BYTE_SIZE) {
PMD_DRV_LOG(ERR, "Hash key size mismatch %u",
@@ -1984,8 +1987,13 @@ nicvf_dev_configure(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
- if (rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+ if (rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
+ if (conf->rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
rxmode->offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ }
if (!rte_eal_has_hugepages()) {
PMD_INIT_LOG(INFO, "Huge page is not configured");
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 35/40] net/txgbe: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (33 preceding siblings ...)
2023-10-11 9:27 ` [PATCH v5 34/40] net/thunderx: " Jie Hai
@ 2023-10-11 9:28 ` Jie Hai
2023-10-11 9:28 ` [PATCH v5 36/40] net/hns3: support setting and querying RSS hash function Jie Hai
` (8 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:28 UTC (permalink / raw)
To: dev, Jiawen Wu, Jian Wang; +Cc: lihuisong, fengchengwen, liudongdong3
A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/txgbe/txgbe_ethdev.c | 7 ++++++-
drivers/net/txgbe/txgbe_ethdev_vf.c | 7 ++++++-
drivers/net/txgbe/txgbe_rxtx.c | 3 +++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index 6bc231a13063..b0e6ea6d171b 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -1525,8 +1525,13 @@ txgbe_dev_configure(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
- if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+ if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
+ if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ }
/* multiple queue mode checking */
ret = txgbe_check_mq_mode(dev);
diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c
index f1341fbf7e22..b0bc8441ac12 100644
--- a/drivers/net/txgbe/txgbe_ethdev_vf.c
+++ b/drivers/net/txgbe/txgbe_ethdev_vf.c
@@ -579,8 +579,13 @@ txgbevf_dev_configure(struct rte_eth_dev *dev)
PMD_INIT_LOG(DEBUG, "Configured Virtual Function port id: %d",
dev->data->port_id);
- if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+ if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
+ if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+ RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ }
/*
* VF has no ability to enable/disable HW CRC
diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c
index f7cd2333abee..3ffc2f4a57a3 100644
--- a/drivers/net/txgbe/txgbe_rxtx.c
+++ b/drivers/net/txgbe/txgbe_rxtx.c
@@ -2894,6 +2894,9 @@ txgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
return -ENOTSUP;
}
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+ return -EINVAL;
+
hash_key = rss_conf->rss_key;
if (hash_key) {
/* Fill in RSS hash key */
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 36/40] net/hns3: support setting and querying RSS hash function
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (34 preceding siblings ...)
2023-10-11 9:28 ` [PATCH v5 35/40] net/txgbe: " Jie Hai
@ 2023-10-11 9:28 ` Jie Hai
2023-10-12 2:23 ` fengchengwen
2023-10-11 9:28 ` [PATCH v5 37/40] app/proc-info: fix never show RSS info Jie Hai
` (7 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:28 UTC (permalink / raw)
To: dev, Dongdong Liu, Yisen Zhuang; +Cc: lihuisong, fengchengwen
From: Huisong Li <lihuisong@huawei.com>
Support setting and querying RSS hash function by ethdev ops.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
| 47 +++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 20 deletions(-)
--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;
}
/*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 37/40] app/proc-info: fix never show RSS info
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (35 preceding siblings ...)
2023-10-11 9:28 ` [PATCH v5 36/40] net/hns3: support setting and querying RSS hash function Jie Hai
@ 2023-10-11 9:28 ` Jie Hai
2023-10-12 1:59 ` fengchengwen
2023-10-11 9:28 ` [PATCH v5 38/40] app/proc-info: adjust the display format of " Jie Hai
` (6 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:28 UTC (permalink / raw)
To: dev, Reshma Pattan, Vipin Varghese, John McNamara
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
---
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 af4c1d8bcbd4..4509b3c16e36 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -152,6 +152,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)
@@ -1013,6 +1015,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)
@@ -1171,17 +1174,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
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 38/40] app/proc-info: adjust the display format of RSS info
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (36 preceding siblings ...)
2023-10-11 9:28 ` [PATCH v5 37/40] app/proc-info: fix never show RSS info Jie Hai
@ 2023-10-11 9:28 ` Jie Hai
2023-10-12 2:01 ` fengchengwen
2023-10-11 9:28 ` [PATCH v5 39/40] app/proc-info: support querying RSS hash algorithm Jie Hai
` (5 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:28 UTC (permalink / raw)
To: dev, Reshma Pattan, Vipin Varghese, John McNamara
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan<reshma.pattan@intel.com>
---
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 4509b3c16e36..e98352118db1 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -1178,12 +1178,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);
}
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 39/40] app/proc-info: support querying RSS hash algorithm
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (37 preceding siblings ...)
2023-10-11 9:28 ` [PATCH v5 38/40] app/proc-info: adjust the display format of " Jie Hai
@ 2023-10-11 9:28 ` Jie Hai
2023-10-12 2:05 ` fengchengwen
2023-10-11 9:28 ` [PATCH v5 40/40] app/testpmd: add RSS hash algorithms display Jie Hai
` (4 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:28 UTC (permalink / raw)
To: dev, Reshma Pattan; +Cc: lihuisong, fengchengwen, liudongdong3
Display RSS hash algorithm with command show-port as below.
- RSS info
-- hash algorithm : toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
---
app/proc-info/main.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index e98352118db1..43f264848a6f 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -153,6 +153,14 @@ static struct desc_param rx_desc_param;
static struct desc_param tx_desc_param;
#define RSS_HASH_KEY_SIZE 64
+static const char * const rss_hash_algos[] = {
+ [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",
+ [RTE_ETH_HASH_FUNCTION_DEFAULT] = "default",
+ [RTE_ETH_HASH_FUNCTION_MAX] = "unknown"
+};
/* display usage */
static void
@@ -1186,6 +1194,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",
+ rss_hash_algos[rss_conf.algorithm]);
}
#ifdef RTE_LIB_SECURITY
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v5 40/40] app/testpmd: add RSS hash algorithms display
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (38 preceding siblings ...)
2023-10-11 9:28 ` [PATCH v5 39/40] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-10-11 9:28 ` Jie Hai
2023-10-12 3:04 ` fengchengwen
2023-10-11 18:19 ` [PATCH v5 00/40] support setting and querying RSS algorithms Ferruh Yigit
` (3 subsequent siblings)
43 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-11 9:28 UTC (permalink / raw)
To: dev, Aman Singh, Yuying Zhang; +Cc: lihuisong, fengchengwen, liudongdong3
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 algorithms:
toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
app/test-pmd/cmdline.c | 29 ++++++++++++++++++++++++-----
app/test-pmd/config.c | 38 +++++++++++++++++++-------------------
app/test-pmd/testpmd.h | 2 +-
3 files changed, 44 insertions(+), 25 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 679ca47b9401..d0eafd7f1254 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 <port_id> 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 <port_id> 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;
@@ -12953,6 +12971,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 7034fa125bc0..deb9414191b7 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1485,6 +1485,15 @@ rss_types_display(uint64_t rss_types, uint16_t char_num_per_line)
printf("\n");
}
+static const char * const rss_hash_algos[] = {
+ [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",
+ [RTE_ETH_HASH_FUNCTION_DEFAULT] = "default",
+ [RTE_ETH_HASH_FUNCTION_MAX] = "Unknown function"
+};
+
static void
rss_config_display(struct rte_flow_action_rss *rss_conf)
{
@@ -1503,24 +1512,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", rss_hash_algos[rss_conf->func]);
printf(" RSS key:\n");
if (rss_conf->key_len == 0) {
@@ -4433,7 +4425,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];
@@ -4483,8 +4475,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 algorithms:\n %s\n",
+ rss_hash_algos[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 6457ac4c0a49..19e1c1984399 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1151,7 +1151,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);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 01/40] ethdev: overwrite some comment related to RSS
2023-10-11 9:27 ` [PATCH v5 01/40] ethdev: overwrite some comment related to RSS Jie Hai
@ 2023-10-11 16:31 ` Ferruh Yigit
2023-10-12 2:03 ` Jie Hai
2023-10-12 2:47 ` fengchengwen
1 sibling, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-10-11 16:31 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
On 10/11/2023 10:27 AM, Jie Hai wrote:
> 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 <haijie1@huawei.com>
> ---
> lib/ethdev/rte_ethdev.h | 29 ++++++++++++++---------------
> lib/ethdev/rte_flow.h | 3 +++
> 2 files changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index 8542257721c9..b9e4e21189d2 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -448,24 +448,23 @@ 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. */
> + /**
> + * If used to query, the'rss_key_len' indicates the size of rss key of
> + * the hardware. And only when rss_key_len is not zero, the 'rss_key'
> + * is valid.
> + * If used to configure, rss_key_len indicates the length of the
> + * 'rss_key' if 'rss_key' is not empty.
>
Ahh, different APIs have different expectations :(
Can you please explicitly name the APIs, instead of "to query", "to
configure"?
And there is a note in original comment that *rss_key_len* is only
checked by i40e, rest assume this value as 40 bytes. New comment doesn't
have it.
> + */
> + uint8_t *rss_key;
> uint8_t rss_key_len; /**< hash key length in bytes. */
> - uint64_t rss_hf; /**< Hash functions to apply - see below. */
> + /**
> + * Indicating which type of packets and which part of the packets
> + * to apply for RSS hash, (see RTE_ETH_RSS_*).
>
There is something doesn't sound right from language perspective,
perhaps someone whose native language is English can help, what about:
"Indicates the type of packets or the specific part of packets to which
RSS hashing is to be applied."
> + * Setting *rss_hf* to zero disables the RSS feature.
> + */
> + uint64_t rss_hf;
> };
>
> /*
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index b385741fba6d..5d9e3c68af7b 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -3227,6 +3227,9 @@ 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 */
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 05/40] net/bnx2x: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 05/40] net/bnx2x: " Jie Hai
@ 2023-10-11 17:02 ` Ferruh Yigit
0 siblings, 0 replies; 222+ messages in thread
From: Ferruh Yigit @ 2023-10-11 17:02 UTC (permalink / raw)
To: Jie Hai, dev, Julien Aube; +Cc: lihuisong, fengchengwen, liudongdong3
On 10/11/2023 10:27 AM, Jie Hai wrote:
> A new field 'algorithm' has been added to rss_conf, check it
> in case of ignoring unsupported values.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
> index 4448cf2de2d7..078d6db75d1b 100644
> --- a/drivers/net/bnx2x/bnx2x_ethdev.c
> +++ b/drivers/net/bnx2x/bnx2x_ethdev.c
> @@ -196,6 +196,10 @@ bnx2x_dev_configure(struct rte_eth_dev *dev)
> PMD_DRV_LOG(DEBUG, sc, "num_queues=%d, mtu=%d",
> sc->num_queues, sc->mtu);
>
> + if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
> + RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> /* allocate ilt */
> if (bnx2x_alloc_ilt_mem(sc) != 0) {
> PMD_DRV_LOG(ERR, sc, "bnx2x_alloc_ilt_mem was failed");
bnx2x doesn't claim RSS support (doc/guides/nics/features/bnx2x.ini), so
I think it will be reasonable to drop this patch.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 08/40] net/cnxk: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 08/40] net/cnxk: " Jie Hai
@ 2023-10-11 17:04 ` Ferruh Yigit
2023-10-12 2:25 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-10-11 17:04 UTC (permalink / raw)
To: Jie Hai, dev, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
Satha Rao
Cc: lihuisong, fengchengwen, liudongdong3
On 10/11/2023 10:27 AM, Jie Hai wrote:
> A new field 'algorithm' has been added to rss_conf, check it
> in case of ignoring unsupported values.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> drivers/net/cnxk/cnxk_ethdev.c | 5 +++++
> drivers/net/cnxk/cnxk_ethdev_ops.c | 3 +++
> 2 files changed, 8 insertions(+)
>
> diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
> index 01b707b6c4ac..dc150de745df 100644
> --- a/drivers/net/cnxk/cnxk_ethdev.c
> +++ b/drivers/net/cnxk/cnxk_ethdev.c
> @@ -976,6 +976,10 @@ nix_rss_default_setup(struct cnxk_eth_dev *dev)
> if (rss_hash_level)
> rss_hash_level -= 1;
>
> + if (eth_dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
> + RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> flowkey_cfg = cnxk_rss_ethdev_to_nix(dev, rss_hf, rss_hash_level);
> return roc_nix_rss_default_setup(&dev->nix, flowkey_cfg);
> }
> @@ -1373,6 +1377,7 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
> }
>
> /* Configure RSS */
> +
>
Looks like unintended change.
> rc = nix_rss_default_setup(dev);
> if (rc) {
> plt_err("Failed to configure rss rc=%d", rc);
> diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c
> index 3ade8eed3626..b6cba99cbb7f 100644
> --- a/drivers/net/cnxk/cnxk_ethdev_ops.c
> +++ b/drivers/net/cnxk/cnxk_ethdev_ops.c
> @@ -1054,6 +1054,9 @@ cnxk_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
> int rc = -EINVAL;
> uint8_t alg_idx;
>
> + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> + goto fail;
> +
> if (rss_conf->rss_key && rss_conf->rss_key_len != ROC_NIX_RSS_KEY_LEN) {
> plt_err("Hash key size mismatch %d vs %d",
> rss_conf->rss_key_len, ROC_NIX_RSS_KEY_LEN);
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 09/40] net/cpfl: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 09/40] net/cpfl: " Jie Hai
@ 2023-10-11 17:20 ` Ferruh Yigit
2023-10-12 2:34 ` Xing, Beilei
0 siblings, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-10-11 17:20 UTC (permalink / raw)
To: Jie Hai, dev, Yuying Zhang, Beilei Xing, Qi Z Zhang
Cc: lihuisong, fengchengwen, liudongdong3
On 10/11/2023 10:27 AM, Jie Hai wrote:
> A new field 'algorithm' has been added to rss_conf, check it
> in case of ignoring unsupported values.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> drivers/net/cpfl/cpfl_ethdev.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
> index c4ca9343c3e0..6acb6ce9fd22 100644
> --- a/drivers/net/cpfl/cpfl_ethdev.c
> +++ b/drivers/net/cpfl/cpfl_ethdev.c
> @@ -450,6 +450,9 @@ cpfl_init_rss(struct idpf_vport *vport)
> rss_conf = &dev_data->dev_conf.rx_adv_conf.rss_conf;
> nb_q = dev_data->nb_rx_queues;
>
> + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> if (rss_conf->rss_key == NULL) {
> for (i = 0; i < vport->rss_key_size; i++)
> vport->rss_key[i] = (uint8_t)rte_rand();
> @@ -568,6 +571,9 @@ cpfl_rss_hash_update(struct rte_eth_dev *dev,
> return -ENOTSUP;
> }
>
> + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> if (!rss_conf->rss_key || rss_conf->rss_key_len == 0) {
> PMD_DRV_LOG(DEBUG, "No key to be configured");
> goto skip_rss_key;
cpfl also doesn't report RSS capability
(doc/guides/nics/features/cpfl.ini), but it is clear that driver
supports RSS.
@Yuying, @Beilei, can you please update .ini file in a separate file?
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 13/40] net/ena: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 13/40] net/ena: " Jie Hai
@ 2023-10-11 17:27 ` Ferruh Yigit
2023-10-12 2:35 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-10-11 17:27 UTC (permalink / raw)
To: Jie Hai, dev, Michal Krawczyk, Shai Brandes, Evgeny Schemeilin,
Igor Chauskin, Ron Beider
Cc: lihuisong, fengchengwen, liudongdong3
On 10/11/2023 10:27 AM, Jie Hai wrote:
> A new field 'algorithm' has been added to rss_conf, check it
> in case of ignoring unsupported values.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> drivers/net/ena/ena_rss.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ena/ena_rss.c b/drivers/net/ena/ena_rss.c
> index d0ba9d5c0a14..06aff9f3bd49 100644
> --- a/drivers/net/ena/ena_rss.c
> +++ b/drivers/net/ena/ena_rss.c
> @@ -398,6 +398,9 @@ static int ena_rss_hash_set(struct ena_com_dev *ena_dev,
> uint8_t *rss_key;
> int rc;
>
> + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> if (rss_conf->rss_key != NULL) {
> /* Reorder the RSS key bytes for the hardware requirements. */
> ena_reorder_rss_hash_key(hw_rss_key, rss_conf->rss_key,
I can see in some drivers configure() ops is not updated, I assume these
are the ones don't have any RSS related config in it, it is not clear
still to add check, but I guess what you are doing is reasonable, I am
OK with this approach.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 14/40] net/enic: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 14/40] net/enic: " Jie Hai
@ 2023-10-11 17:32 ` Ferruh Yigit
2023-10-12 18:09 ` John Daley (johndale)
0 siblings, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-10-11 17:32 UTC (permalink / raw)
To: Jie Hai, dev, John Daley, Hyong Youb Kim
Cc: lihuisong, fengchengwen, liudongdong3
On 10/11/2023 10:27 AM, Jie Hai wrote:
> A new field 'algorithm' has been added to rss_conf, check it
> in case of ignoring unsupported values.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> drivers/net/enic/enic_ethdev.c | 1 +
> drivers/net/enic/enic_main.c | 3 +++
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
> index cdf091559196..164f423a85c8 100644
> --- a/drivers/net/enic/enic_ethdev.c
> +++ b/drivers/net/enic/enic_ethdev.c
> @@ -834,6 +834,7 @@ static int enicpmd_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
> ENICPMD_FUNC_TRACE();
> if (rss_conf == NULL)
> return -EINVAL;
> +
>
unintended change.
also 'enicpmd_dev_configure()' looks like can be updated.
> if (rss_conf->rss_key != NULL &&
> rss_conf->rss_key_len < ENIC_RSS_HASH_KEY_SIZE) {
> dev_err(enic, "rss_hash_conf_get: wrong rss_key_len. given=%u"
> diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
> index 19a99a82c501..2eafe7637b3a 100644
> --- a/drivers/net/enic/enic_main.c
> +++ b/drivers/net/enic/enic_main.c
> @@ -1428,6 +1428,9 @@ int enic_set_rss_conf(struct enic *enic, struct rte_eth_rss_conf *rss_conf)
> }
> }
>
> + if (rss_enable && rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> ret = enic_set_niccfg(enic, ENIC_RSS_DEFAULT_CPU, rss_hash_type,
> ENIC_RSS_HASH_BITS, ENIC_RSS_BASE_CPU,
> rss_enable);
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 02/40] ethdev: support setting and querying RSS algorithm
2023-10-11 9:27 ` [PATCH v5 02/40] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-10-11 17:39 ` Stephen Hemminger
2023-10-12 2:21 ` fengchengwen
0 siblings, 1 reply; 222+ messages in thread
From: Stephen Hemminger @ 2023-10-11 17:39 UTC (permalink / raw)
To: Jie Hai
Cc: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam,
lihuisong, fengchengwen, liudongdong3
On Wed, 11 Oct 2023 17:27:27 +0800
Jie Hai <haijie1@huawei.com> wrote:
> 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_rss_conf`` is extended by adding a new
> field "algorithm". This represents the RSS algorithms to apply.
> The following API will be affected:
> - rte_eth_dev_configure
> - rte_eth_dev_rss_hash_update
> - rte_eth_dev_rss_hash_conf_get
>
> If the value of "algorithm" used for configuration is a gibberish
> value, report the error and return. Do the same for
> rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
>
> To check whether the drivers report valid "algorithm", it is set
> to default value before querying.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> ---
> doc/guides/rel_notes/release_23_11.rst | 2 ++
> lib/ethdev/rte_ethdev.c | 17 ++++++++++++++++
> lib/ethdev/rte_ethdev.h | 27 +++++++++++++++++++++++++
> lib/ethdev/rte_flow.c | 1 -
> lib/ethdev/rte_flow.h | 28 ++------------------------
> 5 files changed, 48 insertions(+), 27 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
> index e13d57728071..92a445ab2ed3 100644
> --- a/doc/guides/rel_notes/release_23_11.rst
> +++ b/doc/guides/rel_notes/release_23_11.rst
> @@ -197,6 +197,8 @@ ABI Changes
> fields, to move ``rxq`` and ``txq`` fields, to change the size of
> ``reserved1`` and ``reserved2`` fields.
>
> +* 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 18a4b950b184..2eda1b8072e5 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -1464,6 +1464,14 @@ 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.algorithm >= RTE_ETH_HASH_FUNCTION_MAX) {
> + RTE_ETHDEV_LOG(ERR,
> + "Ethdev port_id=%u invalid RSS algorithm: 0x%"PRIx64"\n",
> + port_id, dev_conf->rx_adv_conf.rss_conf.algorithm);
> + ret = -EINVAL;
> + goto rollback;
> + }
> +
Rather than having every driver check the algorithm, why not handle this like
other features in DPDK (which may mean API/ABI changes).
Add a field rss_algo_capa which is bit field of available RSS functions.
Then the check for algorithm can be done in generic code. There a couple
of reserved fields that could be used.
It would mean updating all the drivers once with the capa field but
would provide way for application to know what fields are possible.
It has proved to be a problem in later ABI changes if a maximum value
is exposed. I.e don't expose RTE_ETH_HASH_FUNCTION_MAX.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 21/40] net/igc: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 21/40] net/igc: " Jie Hai
@ 2023-10-11 17:51 ` Ferruh Yigit
0 siblings, 0 replies; 222+ messages in thread
From: Ferruh Yigit @ 2023-10-11 17:51 UTC (permalink / raw)
To: Jie Hai, dev, Junfeng Guo, Simei Su; +Cc: lihuisong, fengchengwen, liudongdong3
On 10/11/2023 10:27 AM, Jie Hai wrote:
> A new field 'algorithm' has been added to rss_conf, check it
> in case of ignoring unsupported values.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> drivers/net/igc/igc_ethdev.c | 4 ++++
> drivers/net/igc/igc_txrx.c | 5 +++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
> index 58c4f8092772..11c0f5ff231b 100644
> --- a/drivers/net/igc/igc_ethdev.c
> +++ b/drivers/net/igc/igc_ethdev.c
> @@ -2442,6 +2442,10 @@ eth_igc_rss_hash_update(struct rte_eth_dev *dev,
> struct rte_eth_rss_conf *rss_conf)
> {
> struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
> +
> + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> igc_hw_rss_hash_set(hw, rss_conf);
> return 0;
> }
> diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c
> index 5c60e3e99709..5e62e00d2ad9 100644
> --- a/drivers/net/igc/igc_txrx.c
> +++ b/drivers/net/igc/igc_txrx.c
> @@ -818,6 +818,7 @@ igc_rss_configure(struct rte_eth_dev *dev)
> rss_conf = dev->data->dev_conf.rx_adv_conf.rss_conf;
> if (rss_conf.rss_key == NULL)
> rss_conf.rss_key = default_rss_key;
> +
>
unintended change
> igc_hw_rss_hash_set(hw, &rss_conf);
> }
>
> @@ -958,6 +959,10 @@ igc_dev_mq_rx_configure(struct rte_eth_dev *dev)
> return -EINVAL;
> }
>
> + if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
> + RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> switch (dev->data->dev_conf.rxmode.mq_mode) {
> case RTE_ETH_MQ_RX_RSS:
> igc_rss_configure(dev);
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 26/40] net/mvpp2: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 26/40] net/mvpp2: " Jie Hai
@ 2023-10-11 18:00 ` Ferruh Yigit
2023-10-12 2:21 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-10-11 18:00 UTC (permalink / raw)
To: Jie Hai, dev, Liron Himi; +Cc: lihuisong, fengchengwen, liudongdong3
On 10/11/2023 10:27 AM, Jie Hai wrote:
> A new field 'algorithm' has been added to rss_conf, check it
> in case of ignoring unsupported values.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> drivers/net/mvpp2/mrvl_ethdev.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
> index 359a5d1df7ab..817153af2ef1 100644
> --- a/drivers/net/mvpp2/mrvl_ethdev.c
> +++ b/drivers/net/mvpp2/mrvl_ethdev.c
> @@ -440,6 +440,9 @@ mrvl_configure_rss(struct mrvl_priv *priv, struct rte_eth_rss_conf *rss_conf)
> if (rss_conf->rss_key)
> MRVL_LOG(WARNING, "Changing hash key is not supported");
>
> + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> if (rss_conf->rss_hf == 0) {
> priv->ppio_params.inqs_params.hash_type = PP2_PPIO_HASH_T_NONE;
> } else if (rss_conf->rss_hf & RTE_ETH_RSS_IPV4) {
what about updating 'mrvl_dev_configure()' ?
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 30/40] net/null: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 30/40] net/null: " Jie Hai
@ 2023-10-11 18:06 ` Ferruh Yigit
0 siblings, 0 replies; 222+ messages in thread
From: Ferruh Yigit @ 2023-10-11 18:06 UTC (permalink / raw)
To: Jie Hai, dev, Tetsuya Mukawa; +Cc: lihuisong, fengchengwen, liudongdong3
On 10/11/2023 10:27 AM, Jie Hai wrote:
> A new field 'algorithm' has been added to rss_conf, check it
> in case of ignoring unsupported values.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> drivers/net/null/rte_eth_null.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
> index 31081af79752..8427d7484178 100644
> --- a/drivers/net/null/rte_eth_null.c
> +++ b/drivers/net/null/rte_eth_null.c
> @@ -186,6 +186,11 @@ eth_null_copy_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
> static int
> eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
> {
> + if ((dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) &&
> + dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
> + RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> return 0;
> }
>
> @@ -444,6 +449,9 @@ eth_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf)
>
> rte_spinlock_lock(&internal->rss_lock);
>
> + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> if ((rss_conf->rss_hf & internal->flow_type_rss_offloads) != 0)
> dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf =
> rss_conf->rss_hf & internal->flow_type_rss_offloads;
I think 'eth_dev_configure()' can be dropped, as it is not checking any
RSS configuration at all, no need to add this specific one.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 33/40] net/tap: check RSS hash algorithms
2023-10-11 9:27 ` [PATCH v5 33/40] net/tap: " Jie Hai
@ 2023-10-11 18:13 ` Ferruh Yigit
0 siblings, 0 replies; 222+ messages in thread
From: Ferruh Yigit @ 2023-10-11 18:13 UTC (permalink / raw)
To: Jie Hai, dev; +Cc: lihuisong, fengchengwen, liudongdong3
On 10/11/2023 10:27 AM, Jie Hai wrote:
> A new field 'algorithm' has been added to rss_conf, check it
> in case of ignoring unsupported values.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> drivers/net/tap/rte_eth_tap.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index b25a52655fa2..5e4813637f0b 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -1038,6 +1038,10 @@ tap_dev_configure(struct rte_eth_dev *dev)
> TAP_LOG(INFO, "%s: %s: RX configured queues number: %u",
> dev->device->name, pmd->name, dev->data->nb_rx_queues);
>
> + if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
> + RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> return 0;
> }
>
> @@ -1894,6 +1898,10 @@ tap_rss_hash_update(struct rte_eth_dev *dev,
> rte_errno = EINVAL;
> return -rte_errno;
> }
> + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT) {
> + rte_errno = EINVAL;
> + return -rte_errno;
> + }
> if (rss_conf->rss_key && rss_conf->rss_key_len) {
> /*
> * Currently TAP RSS key is hard coded
Similar to null PMD, I think 'tap_dev_configure()' update can be dropped.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 00/40] support setting and querying RSS algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (39 preceding siblings ...)
2023-10-11 9:28 ` [PATCH v5 40/40] app/testpmd: add RSS hash algorithms display Jie Hai
@ 2023-10-11 18:19 ` Ferruh Yigit
2023-10-12 16:49 ` Stephen Hemminger
` (2 subsequent siblings)
43 siblings, 0 replies; 222+ messages in thread
From: Ferruh Yigit @ 2023-10-11 18:19 UTC (permalink / raw)
To: Jie Hai, dev; +Cc: lihuisong, fengchengwen, liudongdong3
On 10/11/2023 10:27 AM, Jie Hai wrote:
> This patchset is to support setting and querying RSS algorithms.
>
> --
> v5:
> 1. rewrite some comments.
> 2. check RSS algorithm for drivers supporting RSS.
> 3. change field "func" of rss_conf to "algorithm".
> 4. fix commit log for [PATCH v4 4/7].
> 5. add Acked-by Reshma Pattan.
> 6. add symmetric_toeplitz_sort for showing.
> 7. change "hf" to "hash function" for showing.
>
> v4:
> 1. recomment some definitions related to RSS.
> 2. allocate static memory for rss_key instead of dynamic.
> 3. use array of strings to get the name of rss algorithm.
> 4. add display of rss algorithm with testpmd.
>
> v3:
> 1. fix commit log for PATCH [1/5].
> 2. make RSS ABI changes description to start the actual text at the margin.
> 3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
> 4. fix some comment codes.
>
> v2:
> 1. return error if "func" is invalid.
> 2. modify the comments of the "func" field.
> 3. modify commit log of patch [3/5].
> 4. use malloc instead of rte_malloc.
> 5. adjust display format of RSS info.
> 6. remove the string display of rss_hf.
>
> Huisong Li (1):
> net/hns3: support setting and querying RSS hash function
>
> Jie Hai (39):
> ethdev: overwrite some comment related to RSS
> ethdev: support setting and querying RSS algorithm
> net/atlantic: check RSS hash algorithms
> net/axgbe: check RSS hash algorithms
> net/bnx2x: check RSS hash algorithms
> net/bnxt: check RSS hash algorithms
> net/bonding: check RSS hash algorithms
> net/cnxk: check RSS hash algorithms
> net/cpfl: check RSS hash algorithms
> net/cxgbe: check RSS hash algorithms
> net/dpaa: check RSS hash algorithms
> net/dpaa2: check RSS hash algorithms
> net/ena: check RSS hash algorithms
> net/enic: check RSS hash algorithms
> net/fm10k: check RSS hash algorithms
> net/hinic: check RSS hash algorithms
> net/i40e: check RSS hash algorithms
> net/iavf: check RSS hash algorithms
> net/ice: check RSS hash algorithms
> net/idpf: check RSS hash algorithms
> net/igc: check RSS hash algorithms
> net/ionic: check RSS hash algorithms
> net/ixgbe: check RSS hash algorithms
> net/mana: check RSS hash algorithms
> net/mlx5: check RSS hash algorithms
> net/mvpp2: check RSS hash algorithms
> net/netvsc: check RSS hash algorithms
> net/ngbe: : check RSS hash algorithms
> net/nfp: check RSS hash algorithms
> net/null: check RSS hash algorithms
> net/qede: check RSS hash algorithms
> net/sfc: check RSS hash algorithms
> net/tap: check RSS hash algorithms
> net/thunderx: check RSS hash algorithms
> net/txgbe: check RSS hash algorithms
> app/proc-info: fix never show RSS info
> app/proc-info: adjust the display format of RSS info
> app/proc-info: support querying RSS hash algorithm
> app/testpmd: add RSS hash algorithms display
>
> app/proc-info/main.c | 32 ++++++++++-----
> app/test-pmd/cmdline.c | 29 ++++++++++---
> app/test-pmd/config.c | 38 ++++++++---------
> app/test-pmd/testpmd.h | 2 +-
> doc/guides/rel_notes/release_23_11.rst | 2 +
> drivers/net/atlantic/atl_ethdev.c | 2 +
> drivers/net/axgbe/axgbe_ethdev.c | 9 +++++
> drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++
> drivers/net/bnxt/bnxt_ethdev.c | 6 +++
> drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++
> drivers/net/cnxk/cnxk_ethdev.c | 5 +++
> drivers/net/cnxk/cnxk_ethdev_ops.c | 3 ++
> drivers/net/cpfl/cpfl_ethdev.c | 6 +++
> drivers/net/cxgbe/cxgbe_ethdev.c | 9 ++++-
> drivers/net/dpaa/dpaa_ethdev.c | 7 ++++
> drivers/net/dpaa2/dpaa2_ethdev.c | 7 ++++
> drivers/net/ena/ena_rss.c | 3 ++
> drivers/net/enic/enic_ethdev.c | 1 +
> drivers/net/enic/enic_main.c | 3 ++
> drivers/net/fm10k/fm10k_ethdev.c | 9 ++++-
> drivers/net/hinic/hinic_pmd_ethdev.c | 3 ++
> drivers/net/hinic/hinic_pmd_rx.c | 3 ++
> drivers/net/hns3/hns3_rss.c | 47 ++++++++++++---------
> drivers/net/i40e/i40e_ethdev.c | 7 ++++
> drivers/net/iavf/iavf_ethdev.c | 6 +++
> drivers/net/ice/ice_dcf.c | 3 ++
> drivers/net/ice/ice_dcf_ethdev.c | 3 ++
> drivers/net/ice/ice_ethdev.c | 7 ++++
> drivers/net/idpf/idpf_ethdev.c | 6 +++
> drivers/net/igc/igc_ethdev.c | 4 ++
> drivers/net/igc/igc_txrx.c | 5 +++
> drivers/net/ionic/ionic_ethdev.c | 6 +++
> drivers/net/ixgbe/ixgbe_ethdev.c | 12 +++++-
> drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++
> drivers/net/mana/mana.c | 11 ++++-
> drivers/net/mlx5/mlx5_ethdev.c | 4 ++
> drivers/net/mlx5/mlx5_rss.c | 3 +-
> drivers/net/mvpp2/mrvl_ethdev.c | 3 ++
> drivers/net/netvsc/hn_ethdev.c | 6 +++
> drivers/net/nfp/nfp_common.c | 9 ++++-
> drivers/net/ngbe/ngbe_ethdev.c | 6 ++-
> drivers/net/ngbe/ngbe_rxtx.c | 3 ++
> drivers/net/null/rte_eth_null.c | 8 ++++
> drivers/net/qede/qede_ethdev.c | 9 ++++-
> drivers/net/sfc/sfc_ethdev.c | 3 ++
> drivers/net/sfc/sfc_rx.c | 3 ++
> drivers/net/tap/rte_eth_tap.c | 8 ++++
> drivers/net/thunderx/nicvf_ethdev.c | 10 ++++-
> drivers/net/txgbe/txgbe_ethdev.c | 7 +++-
> drivers/net/txgbe/txgbe_ethdev_vf.c | 7 +++-
> drivers/net/txgbe/txgbe_rxtx.c | 3 ++
> lib/ethdev/rte_ethdev.c | 17 ++++++++
> lib/ethdev/rte_ethdev.h | 56 +++++++++++++++++++-------
> lib/ethdev/rte_flow.c | 1 -
> lib/ethdev/rte_flow.h | 25 +-----------
> 55 files changed, 395 insertions(+), 106 deletions(-)
>
Can update following drivers too:
- igb (drivers/net/e1000/igb_ethdev.c)
- octeontx, configure(), as it checks RSS mode there
- virtio
- vmxnet3, as it configures RSS
Thanks,
ferruh
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 37/40] app/proc-info: fix never show RSS info
2023-10-11 9:28 ` [PATCH v5 37/40] app/proc-info: fix never show RSS info Jie Hai
@ 2023-10-12 1:59 ` fengchengwen
0 siblings, 0 replies; 222+ messages in thread
From: fengchengwen @ 2023-10-12 1:59 UTC (permalink / raw)
To: Jie Hai, dev, Reshma Pattan, Vipin Varghese, John McNamara
Cc: lihuisong, liudongdong3
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
On 2023/10/11 17:28, Jie Hai wrote:
> 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 <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> Acked-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
...
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 38/40] app/proc-info: adjust the display format of RSS info
2023-10-11 9:28 ` [PATCH v5 38/40] app/proc-info: adjust the display format of " Jie Hai
@ 2023-10-12 2:01 ` fengchengwen
2023-10-12 3:10 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: fengchengwen @ 2023-10-12 2:01 UTC (permalink / raw)
To: Jie Hai, dev, Reshma Pattan, Vipin Varghese, John McNamara
Cc: lihuisong, liudongdong3
Hi HaiJie,
On 2023/10/11 17:28, Jie Hai wrote:
> 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
How about convert to string? e.g. hash function: SIMPLE_XOR
>
> Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
> Cc: stable@dpdk.org
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> Acked-by: Reshma Pattan<reshma.pattan@intel.com>
> ---
> 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 4509b3c16e36..e98352118db1 100644
> --- a/app/proc-info/main.c
> +++ b/app/proc-info/main.c
> @@ -1178,12 +1178,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);
Suggest %d other PRIx64
> }
>
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 01/40] ethdev: overwrite some comment related to RSS
2023-10-11 16:31 ` Ferruh Yigit
@ 2023-10-12 2:03 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-12 2:03 UTC (permalink / raw)
To: Ferruh Yigit, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
On 2023/10/12 0:31, Ferruh Yigit wrote:
> On 10/11/2023 10:27 AM, Jie Hai wrote:
>> 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 <haijie1@huawei.com>
>> ---
>> lib/ethdev/rte_ethdev.h | 29 ++++++++++++++---------------
>> lib/ethdev/rte_flow.h | 3 +++
>> 2 files changed, 17 insertions(+), 15 deletions(-)
>>
>> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
>> index 8542257721c9..b9e4e21189d2 100644
>> --- a/lib/ethdev/rte_ethdev.h
>> +++ b/lib/ethdev/rte_ethdev.h
>> @@ -448,24 +448,23 @@ 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. */
>> + /**
>> + * If used to query, the'rss_key_len' indicates the size of rss key of
>> + * the hardware. And only when rss_key_len is not zero, the 'rss_key'
>> + * is valid.
>> + * If used to configure, rss_key_len indicates the length of the
>> + * 'rss_key' if 'rss_key' is not empty.
>>
>
> Ahh, different APIs have different expectations :(
> Can you please explicitly name the APIs, instead of "to query", "to
> configure"?
>
> And there is a note in original comment that *rss_key_len* is only
> checked by i40e, rest assume this value as 40 bytes. New comment doesn't
> have it.
>
A new version is show below:
* In rte_eth_dev_rss_hash_conf_get(), the *rss_key_len* indicates the
* size of rss key of the hardware. And only when *rss_key_len* is not
* zero, the *rss_key* is valid.
*
* 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*. Drivers are free to ignore the
* *rss_key_len* and assume key length is 40 bytes.
Please check it. Thanks
>
>> + */
>> + uint8_t *rss_key;
>> uint8_t rss_key_len; /**< hash key length in bytes. */
>> - uint64_t rss_hf; /**< Hash functions to apply - see below. */
>> + /**
>> + * Indicating which type of packets and which part of the packets
>> + * to apply for RSS hash, (see RTE_ETH_RSS_*).
>>
>
> There is something doesn't sound right from language perspective,
> perhaps someone whose native language is English can help, what about:
>
> "Indicates the type of packets or the specific part of packets to which
> RSS hashing is to be applied."
>
>
Better, I will change it.
>> + * Setting *rss_hf* to zero disables the RSS feature.
>> + */
>> + uint64_t rss_hf;
>> };
>>
>> /*
>> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
>> index b385741fba6d..5d9e3c68af7b 100644
>> --- a/lib/ethdev/rte_flow.h
>> +++ b/lib/ethdev/rte_flow.h
>> @@ -3227,6 +3227,9 @@ 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 */
>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 39/40] app/proc-info: support querying RSS hash algorithm
2023-10-11 9:28 ` [PATCH v5 39/40] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-10-12 2:05 ` fengchengwen
2023-10-12 3:51 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: fengchengwen @ 2023-10-12 2:05 UTC (permalink / raw)
To: Jie Hai, dev, Reshma Pattan; +Cc: lihuisong, liudongdong3
Suggest add one new API for get hash_algo_name. e.g. rte_eth_get_rss_algo_name()
On 2023/10/11 17:28, Jie Hai wrote:
> Display RSS hash algorithm with command show-port as below.
> - RSS info
> -- hash algorithm : toeplitz
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> Acked-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
> app/proc-info/main.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/app/proc-info/main.c b/app/proc-info/main.c
> index e98352118db1..43f264848a6f 100644
> --- a/app/proc-info/main.c
> +++ b/app/proc-info/main.c
> @@ -153,6 +153,14 @@ static struct desc_param rx_desc_param;
> static struct desc_param tx_desc_param;
>
> #define RSS_HASH_KEY_SIZE 64
> +static const char * const rss_hash_algos[] = {
> + [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",
> + [RTE_ETH_HASH_FUNCTION_DEFAULT] = "default",
> + [RTE_ETH_HASH_FUNCTION_MAX] = "unknown"
> +};
>
> /* display usage */
> static void
> @@ -1186,6 +1194,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",
> + rss_hash_algos[rss_conf.algorithm]);
> }
>
> #ifdef RTE_LIB_SECURITY
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 26/40] net/mvpp2: check RSS hash algorithms
2023-10-11 18:00 ` Ferruh Yigit
@ 2023-10-12 2:21 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-12 2:21 UTC (permalink / raw)
To: Ferruh Yigit, dev, Liron Himi; +Cc: lihuisong, fengchengwen, liudongdong3
On 2023/10/12 2:00, Ferruh Yigit wrote:
> On 10/11/2023 10:27 AM, Jie Hai wrote:
>> A new field 'algorithm' has been added to rss_conf, check it
>> in case of ignoring unsupported values.
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> ---
>> drivers/net/mvpp2/mrvl_ethdev.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
>> index 359a5d1df7ab..817153af2ef1 100644
>> --- a/drivers/net/mvpp2/mrvl_ethdev.c
>> +++ b/drivers/net/mvpp2/mrvl_ethdev.c
>> @@ -440,6 +440,9 @@ mrvl_configure_rss(struct mrvl_priv *priv, struct rte_eth_rss_conf *rss_conf)
>> if (rss_conf->rss_key)
>> MRVL_LOG(WARNING, "Changing hash key is not supported");
>>
>> + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
>> + return -EINVAL;
>> +
>> if (rss_conf->rss_hf == 0) {
>> priv->ppio_params.inqs_params.hash_type = PP2_PPIO_HASH_T_NONE;
>> } else if (rss_conf->rss_hf & RTE_ETH_RSS_IPV4) {
>
> what about updating 'mrvl_dev_configure()' ?
> .
Hi, Ferruh Yigit,
Both mrvl_dev_configure() and mrvl_rss_hash_update() calls
mrvl_configure_rss(), I update this for less code.
It may be clearer to verify the two separately.
Will change.
Thanks,
Jie Hai
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 02/40] ethdev: support setting and querying RSS algorithm
2023-10-11 17:39 ` Stephen Hemminger
@ 2023-10-12 2:21 ` fengchengwen
2023-10-12 15:23 ` Stephen Hemminger
2023-10-24 12:54 ` Jie Hai
0 siblings, 2 replies; 222+ messages in thread
From: fengchengwen @ 2023-10-12 2:21 UTC (permalink / raw)
To: Stephen Hemminger, Jie Hai
Cc: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam,
lihuisong, liudongdong3
On 2023/10/12 1:39, Stephen Hemminger wrote:
> On Wed, 11 Oct 2023 17:27:27 +0800
> Jie Hai <haijie1@huawei.com> wrote:
>
>> 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_rss_conf`` is extended by adding a new
>> field "algorithm". This represents the RSS algorithms to apply.
>> The following API will be affected:
>> - rte_eth_dev_configure
>> - rte_eth_dev_rss_hash_update
>> - rte_eth_dev_rss_hash_conf_get
>>
>> If the value of "algorithm" used for configuration is a gibberish
>> value, report the error and return. Do the same for
>> rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
>>
>> To check whether the drivers report valid "algorithm", it is set
>> to default value before querying.
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> ---
>> doc/guides/rel_notes/release_23_11.rst | 2 ++
>> lib/ethdev/rte_ethdev.c | 17 ++++++++++++++++
>> lib/ethdev/rte_ethdev.h | 27 +++++++++++++++++++++++++
>> lib/ethdev/rte_flow.c | 1 -
>> lib/ethdev/rte_flow.h | 28 ++------------------------
>> 5 files changed, 48 insertions(+), 27 deletions(-)
>>
>> diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
>> index e13d57728071..92a445ab2ed3 100644
>> --- a/doc/guides/rel_notes/release_23_11.rst
>> +++ b/doc/guides/rel_notes/release_23_11.rst
>> @@ -197,6 +197,8 @@ ABI Changes
>> fields, to move ``rxq`` and ``txq`` fields, to change the size of
>> ``reserved1`` and ``reserved2`` fields.
>>
>> +* 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 18a4b950b184..2eda1b8072e5 100644
>> --- a/lib/ethdev/rte_ethdev.c
>> +++ b/lib/ethdev/rte_ethdev.c
>> @@ -1464,6 +1464,14 @@ 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.algorithm >= RTE_ETH_HASH_FUNCTION_MAX) {
>> + RTE_ETHDEV_LOG(ERR,
>> + "Ethdev port_id=%u invalid RSS algorithm: 0x%"PRIx64"\n",
>> + port_id, dev_conf->rx_adv_conf.rss_conf.algorithm);
>> + ret = -EINVAL;
>> + goto rollback;
>> + }
>> +
>
> Rather than having every driver check the algorithm, why not handle this like
> other features in DPDK (which may mean API/ABI changes).
>
> Add a field rss_algo_capa which is bit field of available RSS functions.
> Then the check for algorithm can be done in generic code. There a couple
> of reserved fields that could be used.
+1 for add a field
But there are two ways to config rss: ethdev-ops, ethdev-rteflow-ops, should distinguish them ? or just define for ethdev-ops ?
>
> It would mean updating all the drivers once with the capa field but
> would provide way for application to know what fields are possible.
>
> It has proved to be a problem in later ABI changes if a maximum value
> is exposed. I.e don't expose RTE_ETH_HASH_FUNCTION_MAX.
+1
>
> .
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 36/40] net/hns3: support setting and querying RSS hash function
2023-10-11 9:28 ` [PATCH v5 36/40] net/hns3: support setting and querying RSS hash function Jie Hai
@ 2023-10-12 2:23 ` fengchengwen
2023-10-12 2:56 ` Jie Hai
2023-10-12 3:05 ` Jie Hai
0 siblings, 2 replies; 222+ messages in thread
From: fengchengwen @ 2023-10-12 2:23 UTC (permalink / raw)
To: Jie Hai, dev, Dongdong Liu, Yisen Zhuang; +Cc: lihuisong
The new algorithm (RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT) should treat as Not Support.
With above fix
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
On 2023/10/11 17:28, Jie Hai wrote:
> From: Huisong Li <lihuisong@huawei.com>
>
> Support setting and querying RSS hash function by ethdev ops.
>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> ---
> 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;
> }
>
> /*
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 08/40] net/cnxk: check RSS hash algorithms
2023-10-11 17:04 ` Ferruh Yigit
@ 2023-10-12 2:25 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-12 2:25 UTC (permalink / raw)
To: Ferruh Yigit, dev, Nithin Dabilpuram, Kiran Kumar K,
Sunil Kumar Kori, Satha Rao
Cc: lihuisong, fengchengwen, liudongdong3
On 2023/10/12 1:04, Ferruh Yigit wrote:
> On 10/11/2023 10:27 AM, Jie Hai wrote:
>> A new field 'algorithm' has been added to rss_conf, check it
>> in case of ignoring unsupported values.
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> ---
>> drivers/net/cnxk/cnxk_ethdev.c | 5 +++++
>> drivers/net/cnxk/cnxk_ethdev_ops.c | 3 +++
>> 2 files changed, 8 insertions(+)
>>
>> diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
>> index 01b707b6c4ac..dc150de745df 100644
>> --- a/drivers/net/cnxk/cnxk_ethdev.c
>> +++ b/drivers/net/cnxk/cnxk_ethdev.c
>> @@ -976,6 +976,10 @@ nix_rss_default_setup(struct cnxk_eth_dev *dev)
>> if (rss_hash_level)
>> rss_hash_level -= 1;
>>
>> + if (eth_dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
>> + RTE_ETH_HASH_FUNCTION_DEFAULT)
>> + return -EINVAL;
>> +
>> flowkey_cfg = cnxk_rss_ethdev_to_nix(dev, rss_hf, rss_hash_level);
>> return roc_nix_rss_default_setup(&dev->nix, flowkey_cfg);
>> }
>> @@ -1373,6 +1377,7 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
>> }
>>
>> /* Configure RSS */
>> +
>>
>
> Looks like unintended change.
Will check it before setup in cnxk_nix_configure().
>
>> rc = nix_rss_default_setup(dev);
>> if (rc) {
>> plt_err("Failed to configure rss rc=%d", rc);
>> diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c
>> index 3ade8eed3626..b6cba99cbb7f 100644
>> --- a/drivers/net/cnxk/cnxk_ethdev_ops.c
>> +++ b/drivers/net/cnxk/cnxk_ethdev_ops.c
>> @@ -1054,6 +1054,9 @@ cnxk_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
>> int rc = -EINVAL;
>> uint8_t alg_idx;
>>
>> + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
>> + goto fail;
>> +
>> if (rss_conf->rss_key && rss_conf->rss_key_len != ROC_NIX_RSS_KEY_LEN) {
>> plt_err("Hash key size mismatch %d vs %d",
>> rss_conf->rss_key_len, ROC_NIX_RSS_KEY_LEN);
>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* RE: [PATCH v5 09/40] net/cpfl: check RSS hash algorithms
2023-10-11 17:20 ` Ferruh Yigit
@ 2023-10-12 2:34 ` Xing, Beilei
0 siblings, 0 replies; 222+ messages in thread
From: Xing, Beilei @ 2023-10-12 2:34 UTC (permalink / raw)
To: Ferruh Yigit, Jie Hai, dev, Zhang, Yuying, Zhang, Qi Z
Cc: lihuisong, fengchengwen, liudongdong3
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: Thursday, October 12, 2023 1:21 AM
> To: Jie Hai <haijie1@huawei.com>; dev@dpdk.org; Zhang, Yuying
> <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: lihuisong@huawei.com; fengchengwen@huawei.com;
> liudongdong3@huawei.com
> Subject: Re: [PATCH v5 09/40] net/cpfl: check RSS hash algorithms
>
> On 10/11/2023 10:27 AM, Jie Hai wrote:
> > A new field 'algorithm' has been added to rss_conf, check it in case
> > of ignoring unsupported values.
> >
> > Signed-off-by: Jie Hai <haijie1@huawei.com>
> > ---
> > drivers/net/cpfl/cpfl_ethdev.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/net/cpfl/cpfl_ethdev.c
> > b/drivers/net/cpfl/cpfl_ethdev.c index c4ca9343c3e0..6acb6ce9fd22
> > 100644
> > --- a/drivers/net/cpfl/cpfl_ethdev.c
> > +++ b/drivers/net/cpfl/cpfl_ethdev.c
> > @@ -450,6 +450,9 @@ cpfl_init_rss(struct idpf_vport *vport)
> > rss_conf = &dev_data->dev_conf.rx_adv_conf.rss_conf;
> > nb_q = dev_data->nb_rx_queues;
> >
> > + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> > + return -EINVAL;
> > +
> > if (rss_conf->rss_key == NULL) {
> > for (i = 0; i < vport->rss_key_size; i++)
> > vport->rss_key[i] = (uint8_t)rte_rand(); @@ -568,6
> +571,9 @@
> > cpfl_rss_hash_update(struct rte_eth_dev *dev,
> > return -ENOTSUP;
> > }
> >
> > + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> > + return -EINVAL;
> > +
> > if (!rss_conf->rss_key || rss_conf->rss_key_len == 0) {
> > PMD_DRV_LOG(DEBUG, "No key to be configured");
> > goto skip_rss_key;
>
>
> cpfl also doesn't report RSS capability
> (doc/guides/nics/features/cpfl.ini), but it is clear that driver supports RSS.
>
> @Yuying, @Beilei, can you please update .ini file in a separate file?
Thanks for the reminder, will update .ini file later.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 13/40] net/ena: check RSS hash algorithms
2023-10-11 17:27 ` Ferruh Yigit
@ 2023-10-12 2:35 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-12 2:35 UTC (permalink / raw)
To: Ferruh Yigit, dev, Michal Krawczyk, Shai Brandes,
Evgeny Schemeilin, Igor Chauskin, Ron Beider
Cc: lihuisong, fengchengwen, liudongdong3
On 2023/10/12 1:27, Ferruh Yigit wrote:
> On 10/11/2023 10:27 AM, Jie Hai wrote:
>> A new field 'algorithm' has been added to rss_conf, check it
>> in case of ignoring unsupported values.
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> ---
>> drivers/net/ena/ena_rss.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/net/ena/ena_rss.c b/drivers/net/ena/ena_rss.c
>> index d0ba9d5c0a14..06aff9f3bd49 100644
>> --- a/drivers/net/ena/ena_rss.c
>> +++ b/drivers/net/ena/ena_rss.c
>> @@ -398,6 +398,9 @@ static int ena_rss_hash_set(struct ena_com_dev *ena_dev,
>> uint8_t *rss_key;
>> int rc;
>>
>> + if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
>> + return -EINVAL;
>> +
>> if (rss_conf->rss_key != NULL) {
>> /* Reorder the RSS key bytes for the hardware requirements. */
>> ena_reorder_rss_hash_key(hw_rss_key, rss_conf->rss_key,
>
> I can see in some drivers configure() ops is not updated, I assume these
> are the ones don't have any RSS related config in it, it is not clear
> still to add check, but I guess what you are doing is reasonable, I am
> OK with this approach.
> .
It's true that these drivers support RSS configuration and check it in
their own setup function instead of in dev_configure ops.
Some drivers calls the setup function in dev_configure,
and some in dev_start. It's better to check the configuration in these
setup function for the latter case.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 01/40] ethdev: overwrite some comment related to RSS
2023-10-11 9:27 ` [PATCH v5 01/40] ethdev: overwrite some comment related to RSS Jie Hai
2023-10-11 16:31 ` Ferruh Yigit
@ 2023-10-12 2:47 ` fengchengwen
1 sibling, 0 replies; 222+ messages in thread
From: fengchengwen @ 2023-10-12 2:47 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: lihuisong, liudongdong3
On 2023/10/11 17:27, Jie Hai wrote:
> 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 <haijie1@huawei.com>
> ---
> lib/ethdev/rte_ethdev.h | 29 ++++++++++++++---------------
> lib/ethdev/rte_flow.h | 3 +++
> 2 files changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index 8542257721c9..b9e4e21189d2 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -448,24 +448,23 @@ 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. */
> + /**
> + * If used to query, the'rss_key_len' indicates the size of rss key of
add one space in the'rss_key_len'
> + * the hardware. And only when rss_key_len is not zero, the 'rss_key'
> + * is valid.
Actually, there is another condition. When rss_key_len is greater than or equal to the actual key length,
the 'rss_key' is valid, most driver's return success even when rss_key_len lower than actual key length.
Suggest add there information, could be:
If used to query, the 'rss_key_len' should 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 'rss_key_len' bytes. If not meet these requirements, the query result is unreliable
even the query operation returns success.
> + * If used to configure, rss_key_len indicates the length of the
> + * 'rss_key' if 'rss_key' is not empty.
> + */
> + uint8_t *rss_key;
> uint8_t rss_key_len; /**< hash key length in bytes. */
> - uint64_t rss_hf; /**< Hash functions to apply - see below. */
> + /**
> + * Indicating which type of packets and which part of the packets
> + * to apply for RSS hash, (see RTE_ETH_RSS_*).
> + * Setting *rss_hf* to zero disables the RSS feature.
> + */
> + uint64_t rss_hf;
> };
>
> /*
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index b385741fba6d..5d9e3c68af7b 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -3227,6 +3227,9 @@ struct rte_flow_query_count {
> * Hash function types.
> */
> enum rte_eth_hash_function {
> + /**
> + * DEFAULT means driver decides which hash algorithm to pick.
> + */
Suggest one line
> RTE_ETH_HASH_FUNCTION_DEFAULT = 0,
> RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */
> RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 36/40] net/hns3: support setting and querying RSS hash function
2023-10-12 2:23 ` fengchengwen
@ 2023-10-12 2:56 ` Jie Hai
2023-10-12 3:05 ` Jie Hai
1 sibling, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-12 2:56 UTC (permalink / raw)
To: fengchengwen, dev, Dongdong Liu, Yisen Zhuang; +Cc: lihuisong
On 2023/10/12 10:23, fengchengwen wrote:
> The new algorithm (RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT) should treat as Not Support.
>
> With above fix
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
>
Thanks, will check it.
> On 2023/10/11 17:28, Jie Hai wrote:
>> From: Huisong Li <lihuisong@huawei.com>
>>
>> Support setting and querying RSS hash function by ethdev ops.
>>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> ---
>> 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;
>> }
>>
>> /*
>>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 40/40] app/testpmd: add RSS hash algorithms display
2023-10-11 9:28 ` [PATCH v5 40/40] app/testpmd: add RSS hash algorithms display Jie Hai
@ 2023-10-12 3:04 ` fengchengwen
0 siblings, 0 replies; 222+ messages in thread
From: fengchengwen @ 2023-10-12 3:04 UTC (permalink / raw)
To: Jie Hai, dev, Aman Singh, Yuying Zhang; +Cc: lihuisong, liudongdong3
Hi HaiJie,
On 2023/10/11 17:28, Jie Hai wrote:
> 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 algorithms:
> toeplitz
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> app/test-pmd/cmdline.c | 29 ++++++++++++++++++++++++-----
> app/test-pmd/config.c | 38 +++++++++++++++++++-------------------
> app/test-pmd/testpmd.h | 2 +-
> 3 files changed, 44 insertions(+), 25 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 679ca47b9401..d0eafd7f1254 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"
Please update testpmd doc
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 36/40] net/hns3: support setting and querying RSS hash function
2023-10-12 2:23 ` fengchengwen
2023-10-12 2:56 ` Jie Hai
@ 2023-10-12 3:05 ` Jie Hai
2023-10-12 3:59 ` fengchengwen
1 sibling, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-12 3:05 UTC (permalink / raw)
To: fengchengwen, dev, Dongdong Liu, Yisen Zhuang; +Cc: lihuisong
On 2023/10/12 10:23, fengchengwen wrote:
> The new algorithm (RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT) should treat as Not Support.
>
> With above fix
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
>
Actually, the new algorithm is not supported.
see hns3_update_rss_algo_key().
if (modify_algo && hash_func >= RTE_DIM(hns3_hash_func_map)) {
hns3_err(hw, "hash func (%u) is unsupported.", hash_func);
return -ENOTSUP;
}
> On 2023/10/11 17:28, Jie Hai wrote:
>> From: Huisong Li <lihuisong@huawei.com>
>>
>> Support setting and querying RSS hash function by ethdev ops.
>>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> ---
>> 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;
>> }
>>
>> /*
>>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 38/40] app/proc-info: adjust the display format of RSS info
2023-10-12 2:01 ` fengchengwen
@ 2023-10-12 3:10 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-12 3:10 UTC (permalink / raw)
To: fengchengwen, dev, Reshma Pattan, Vipin Varghese, John McNamara
Cc: lihuisong, liudongdong3
On 2023/10/12 10:01, fengchengwen wrote:
> Hi HaiJie,
>
> On 2023/10/11 17:28, Jie Hai wrote:
>> 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
>
> How about convert to string? e.g. hash function: SIMPLE_XOR
>
Sorry for the misunderstanding.
"hash function" is for rss_hf, not the RSS hash algorithm.
>>
>> Fixes: 8a37f37fc243 ("app/procinfo: add --show-port")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> Acked-by: Reshma Pattan<reshma.pattan@intel.com>
>> ---
>> 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 4509b3c16e36..e98352118db1 100644
>> --- a/app/proc-info/main.c
>> +++ b/app/proc-info/main.c
>> @@ -1178,12 +1178,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);
>
> Suggest %d other PRIx64
"hash function" is for rss_hf, not the RSS hash algorithm.
And each bit of it is meaningful, so hexadecimal is used.
>
>> }
>>
>>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 39/40] app/proc-info: support querying RSS hash algorithm
2023-10-12 2:05 ` fengchengwen
@ 2023-10-12 3:51 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-12 3:51 UTC (permalink / raw)
To: fengchengwen, dev, Reshma Pattan; +Cc: lihuisong, liudongdong3
On 2023/10/12 10:05, fengchengwen wrote:
> Suggest add one new API for get hash_algo_name. e.g. rte_eth_get_rss_algo_name()
>
Thanks, that's better for reuse, will change it in next version.
> On 2023/10/11 17:28, Jie Hai wrote:
>> Display RSS hash algorithm with command show-port as below.
>> - RSS info
>> -- hash algorithm : toeplitz
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> Acked-by: Reshma Pattan <reshma.pattan@intel.com>
>> ---
>> app/proc-info/main.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/app/proc-info/main.c b/app/proc-info/main.c
>> index e98352118db1..43f264848a6f 100644
>> --- a/app/proc-info/main.c
>> +++ b/app/proc-info/main.c
>> @@ -153,6 +153,14 @@ static struct desc_param rx_desc_param;
>> static struct desc_param tx_desc_param;
>>
>> #define RSS_HASH_KEY_SIZE 64
>> +static const char * const rss_hash_algos[] = {
>> + [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",
>> + [RTE_ETH_HASH_FUNCTION_DEFAULT] = "default",
>> + [RTE_ETH_HASH_FUNCTION_MAX] = "unknown"
>> +};
>>
>> /* display usage */
>> static void
>> @@ -1186,6 +1194,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",
>> + rss_hash_algos[rss_conf.algorithm]);
>> }
>>
>> #ifdef RTE_LIB_SECURITY
>>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 36/40] net/hns3: support setting and querying RSS hash function
2023-10-12 3:05 ` Jie Hai
@ 2023-10-12 3:59 ` fengchengwen
0 siblings, 0 replies; 222+ messages in thread
From: fengchengwen @ 2023-10-12 3:59 UTC (permalink / raw)
To: Jie Hai, dev, Dongdong Liu, Yisen Zhuang; +Cc: lihuisong
On 2023/10/12 11:05, Jie Hai wrote:
> On 2023/10/12 10:23, fengchengwen wrote:
>> The new algorithm (RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT) should treat as Not Support.
>>
>> With above fix
>> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
>>
> Actually, the new algorithm is not supported.
> see hns3_update_rss_algo_key().
>
> if (modify_algo && hash_func >= RTE_DIM(hns3_hash_func_map)) {
> hns3_err(hw, "hash func (%u) is unsupported.", hash_func);
> return -ENOTSUP;
> }
Got it, thanks.
>
>> On 2023/10/11 17:28, Jie Hai wrote:
>>> From: Huisong Li <lihuisong@huawei.com>
>>>
>>> Support setting and querying RSS hash function by ethdev ops.
>>>
>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>>> ---
>>> 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;
>>> }
>>> /*
>>>
>> .
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 02/40] ethdev: support setting and querying RSS algorithm
2023-10-12 2:21 ` fengchengwen
@ 2023-10-12 15:23 ` Stephen Hemminger
2023-10-24 12:54 ` Jie Hai
1 sibling, 0 replies; 222+ messages in thread
From: Stephen Hemminger @ 2023-10-12 15:23 UTC (permalink / raw)
To: fengchengwen
Cc: Jie Hai, dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
Ori Kam, lihuisong, liudongdong3
On Thu, 12 Oct 2023 10:21:51 +0800
fengchengwen <fengchengwen@huawei.com> wrote:
> > Rather than having every driver check the algorithm, why not handle this like
> > other features in DPDK (which may mean API/ABI changes).
> >
> > Add a field rss_algo_capa which is bit field of available RSS functions.
> > Then the check for algorithm can be done in generic code. There a couple
> > of reserved fields that could be used.
>
> +1 for add a field
>
> But there are two ways to config rss: ethdev-ops, ethdev-rteflow-ops, should distinguish them ? or just define for ethdev-ops ?
One field is likely to be enough.
I would expect that if driver accepts RSS for rte flow, it would also take same RSS setting for non flow case.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 00/40] support setting and querying RSS algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (40 preceding siblings ...)
2023-10-11 18:19 ` [PATCH v5 00/40] support setting and querying RSS algorithms Ferruh Yigit
@ 2023-10-12 16:49 ` Stephen Hemminger
2023-10-17 14:06 ` Thomas Monjalon
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
43 siblings, 0 replies; 222+ messages in thread
From: Stephen Hemminger @ 2023-10-12 16:49 UTC (permalink / raw)
To: Jie Hai; +Cc: dev, lihuisong, fengchengwen, liudongdong3
On Wed, 11 Oct 2023 17:27:25 +0800
Jie Hai <haijie1@huawei.com> wrote:
> This patchset is to support setting and querying RSS algorithms.
>
> --
> v5:
> 1. rewrite some comments.
> 2. check RSS algorithm for drivers supporting RSS.
> 3. change field "func" of rss_conf to "algorithm".
> 4. fix commit log for [PATCH v4 4/7].
> 5. add Acked-by Reshma Pattan.
> 6. add symmetric_toeplitz_sort for showing.
> 7. change "hf" to "hash function" for showing.
>
> v4:
> 1. recomment some definitions related to RSS.
> 2. allocate static memory for rss_key instead of dynamic.
> 3. use array of strings to get the name of rss algorithm.
> 4. add display of rss algorithm with testpmd.
>
> v3:
> 1. fix commit log for PATCH [1/5].
> 2. make RSS ABI changes description to start the actual text at the margin.
> 3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
> 4. fix some comment codes.
>
> v2:
> 1. return error if "func" is invalid.
> 2. modify the comments of the "func" field.
> 3. modify commit log of patch [3/5].
> 4. use malloc instead of rte_malloc.
> 5. adjust display format of RSS info.
> 6. remove the string display of rss_hf.
>
> Huisong Li (1):
> net/hns3: support setting and querying RSS hash function
>
> Jie Hai (39):
> ethdev: overwrite some comment related to RSS
> ethdev: support setting and querying RSS algorithm
> net/atlantic: check RSS hash algorithms
> net/axgbe: check RSS hash algorithms
> net/bnx2x: check RSS hash algorithms
> net/bnxt: check RSS hash algorithms
> net/bonding: check RSS hash algorithms
> net/cnxk: check RSS hash algorithms
> net/cpfl: check RSS hash algorithms
> net/cxgbe: check RSS hash algorithms
> net/dpaa: check RSS hash algorithms
> net/dpaa2: check RSS hash algorithms
> net/ena: check RSS hash algorithms
> net/enic: check RSS hash algorithms
> net/fm10k: check RSS hash algorithms
> net/hinic: check RSS hash algorithms
> net/i40e: check RSS hash algorithms
> net/iavf: check RSS hash algorithms
> net/ice: check RSS hash algorithms
> net/idpf: check RSS hash algorithms
> net/igc: check RSS hash algorithms
> net/ionic: check RSS hash algorithms
> net/ixgbe: check RSS hash algorithms
> net/mana: check RSS hash algorithms
> net/mlx5: check RSS hash algorithms
> net/mvpp2: check RSS hash algorithms
> net/netvsc: check RSS hash algorithms
> net/ngbe: : check RSS hash algorithms
> net/nfp: check RSS hash algorithms
> net/null: check RSS hash algorithms
> net/qede: check RSS hash algorithms
> net/sfc: check RSS hash algorithms
> net/tap: check RSS hash algorithms
> net/thunderx: check RSS hash algorithms
> net/txgbe: check RSS hash algorithms
> app/proc-info: fix never show RSS info
> app/proc-info: adjust the display format of RSS info
> app/proc-info: support querying RSS hash algorithm
> app/testpmd: add RSS hash algorithms display
>
> app/proc-info/main.c | 32 ++++++++++-----
> app/test-pmd/cmdline.c | 29 ++++++++++---
> app/test-pmd/config.c | 38 ++++++++---------
> app/test-pmd/testpmd.h | 2 +-
> doc/guides/rel_notes/release_23_11.rst | 2 +
> drivers/net/atlantic/atl_ethdev.c | 2 +
> drivers/net/axgbe/axgbe_ethdev.c | 9 +++++
> drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++
> drivers/net/bnxt/bnxt_ethdev.c | 6 +++
> drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++
> drivers/net/cnxk/cnxk_ethdev.c | 5 +++
> drivers/net/cnxk/cnxk_ethdev_ops.c | 3 ++
> drivers/net/cpfl/cpfl_ethdev.c | 6 +++
> drivers/net/cxgbe/cxgbe_ethdev.c | 9 ++++-
> drivers/net/dpaa/dpaa_ethdev.c | 7 ++++
> drivers/net/dpaa2/dpaa2_ethdev.c | 7 ++++
> drivers/net/ena/ena_rss.c | 3 ++
> drivers/net/enic/enic_ethdev.c | 1 +
> drivers/net/enic/enic_main.c | 3 ++
> drivers/net/fm10k/fm10k_ethdev.c | 9 ++++-
> drivers/net/hinic/hinic_pmd_ethdev.c | 3 ++
> drivers/net/hinic/hinic_pmd_rx.c | 3 ++
> drivers/net/hns3/hns3_rss.c | 47 ++++++++++++---------
> drivers/net/i40e/i40e_ethdev.c | 7 ++++
> drivers/net/iavf/iavf_ethdev.c | 6 +++
> drivers/net/ice/ice_dcf.c | 3 ++
> drivers/net/ice/ice_dcf_ethdev.c | 3 ++
> drivers/net/ice/ice_ethdev.c | 7 ++++
> drivers/net/idpf/idpf_ethdev.c | 6 +++
> drivers/net/igc/igc_ethdev.c | 4 ++
> drivers/net/igc/igc_txrx.c | 5 +++
> drivers/net/ionic/ionic_ethdev.c | 6 +++
> drivers/net/ixgbe/ixgbe_ethdev.c | 12 +++++-
> drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++
> drivers/net/mana/mana.c | 11 ++++-
> drivers/net/mlx5/mlx5_ethdev.c | 4 ++
> drivers/net/mlx5/mlx5_rss.c | 3 +-
> drivers/net/mvpp2/mrvl_ethdev.c | 3 ++
> drivers/net/netvsc/hn_ethdev.c | 6 +++
> drivers/net/nfp/nfp_common.c | 9 ++++-
> drivers/net/ngbe/ngbe_ethdev.c | 6 ++-
> drivers/net/ngbe/ngbe_rxtx.c | 3 ++
> drivers/net/null/rte_eth_null.c | 8 ++++
> drivers/net/qede/qede_ethdev.c | 9 ++++-
> drivers/net/sfc/sfc_ethdev.c | 3 ++
> drivers/net/sfc/sfc_rx.c | 3 ++
> drivers/net/tap/rte_eth_tap.c | 8 ++++
> drivers/net/thunderx/nicvf_ethdev.c | 10 ++++-
> drivers/net/txgbe/txgbe_ethdev.c | 7 +++-
> drivers/net/txgbe/txgbe_ethdev_vf.c | 7 +++-
> drivers/net/txgbe/txgbe_rxtx.c | 3 ++
> lib/ethdev/rte_ethdev.c | 17 ++++++++
> lib/ethdev/rte_ethdev.h | 56 +++++++++++++++++++-------
> lib/ethdev/rte_flow.c | 1 -
> lib/ethdev/rte_flow.h | 25 +-----------
> 55 files changed, 395 insertions(+), 106 deletions(-)
>
In future, it would be good to report the hash algorithm in the PCAPNG
output from dumpcap. The current code always reports it as Toeplitz.
One issue is that the PCAPNG standard:
https://www.ietf.org/staging/draft-tuexen-opsawg-pcapng-02.html#name-enhanced-packet-block
Only has values for a few types:
epb_hash:
The epb_hash option contains a hash of the packet. The first octet
specifies the hashing algorithm, while the following octets contain the
actual hash, whose size depends on the hashing algorithm, and hence
from the value in the first octet. The hashing algorithm can be: 2s
complement (algorithm octet = 0, size = XXX), XOR (algorithm octet = 1,
size=XXX), CRC32 (algorithm octet = 2, size = 4), MD-5 (algorithm octet
= 3, size = 16), SHA-1 (algorithm octet = 4, size = 20), Toeplitz
(algorithm octet = 5, size = 4). The hash covers only the packet, not
the header added by the capture driver: this gives the possibility to
calculate it inside the network card. The hash allows easier
comparison/merging of different capture files, and reliable data
transfer between the data acquisition system and the capture library.
I added the Toeplitz one when pcapng was being managed via github.
Now that it is more in IETF/RFC standard process adding new values probably
would take more effort.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 14/40] net/enic: check RSS hash algorithms
2023-10-11 17:32 ` Ferruh Yigit
@ 2023-10-12 18:09 ` John Daley (johndale)
0 siblings, 0 replies; 222+ messages in thread
From: John Daley (johndale) @ 2023-10-12 18:09 UTC (permalink / raw)
To: Ferruh Yigit, Jie Hai, dev, Hyong Youb Kim (hyonkim)
Cc: lihuisong, fengchengwen, liudongdong3
[-- Attachment #1: Type: text/plain, Size: 2321 bytes --]
> also 'enicpmd_dev_configure()' looks like can be updated.
Where would it be updated? With the patch, the check will be done at the bottom of the function in call to enic_init_rss_nic_cfg -> enic_set_niccfg
From: Ferruh Yigit <ferruh.yigit@amd.com>
Date: Wednesday, October 11, 2023 at 10:32 AM
To: Jie Hai <haijie1@huawei.com>, dev@dpdk.org <dev@dpdk.org>, John Daley (johndale) <johndale@cisco.com>, Hyong Youb Kim (hyonkim) <hyonkim@cisco.com>
Cc: lihuisong@huawei.com <lihuisong@huawei.com>, fengchengwen@huawei.com <fengchengwen@huawei.com>, liudongdong3@huawei.com <liudongdong3@huawei.com>
Subject: Re: [PATCH v5 14/40] net/enic: check RSS hash algorithms
On 10/11/2023 10:27 AM, Jie Hai wrote:
> A new field 'algorithm' has been added to rss_conf, check it
> in case of ignoring unsupported values.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> drivers/net/enic/enic_ethdev.c | 1 +
> drivers/net/enic/enic_main.c | 3 +++
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
> index cdf091559196..164f423a85c8 100644
> --- a/drivers/net/enic/enic_ethdev.c
> +++ b/drivers/net/enic/enic_ethdev.c
> @@ -834,6 +834,7 @@ static int enicpmd_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
> ENICPMD_FUNC_TRACE();
> if (rss_conf == NULL)
> return -EINVAL;
> +
>
unintended change.
also 'enicpmd_dev_configure()' looks like can be updated.
> if (rss_conf->rss_key != NULL &&
> rss_conf->rss_key_len < ENIC_RSS_HASH_KEY_SIZE) {
> dev_err(enic, "rss_hash_conf_get: wrong rss_key_len. given=%u"
> diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
> index 19a99a82c501..2eafe7637b3a 100644
> --- a/drivers/net/enic/enic_main.c
> +++ b/drivers/net/enic/enic_main.c
> @@ -1428,6 +1428,9 @@ int enic_set_rss_conf(struct enic *enic, struct rte_eth_rss_conf *rss_conf)
> }
> }
>
> + if (rss_enable && rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> + return -EINVAL;
> +
> ret = enic_set_niccfg(enic, ENIC_RSS_DEFAULT_CPU, rss_hash_type,
> ENIC_RSS_HASH_BITS, ENIC_RSS_BASE_CPU,
> rss_enable);
[-- Attachment #2: Type: text/html, Size: 7742 bytes --]
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 00/40] support setting and querying RSS algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (41 preceding siblings ...)
2023-10-12 16:49 ` Stephen Hemminger
@ 2023-10-17 14:06 ` Thomas Monjalon
2023-10-17 14:26 ` Ferruh Yigit
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
43 siblings, 1 reply; 222+ messages in thread
From: Thomas Monjalon @ 2023-10-17 14:06 UTC (permalink / raw)
To: Jie Hai; +Cc: dev, lihuisong, fengchengwen, liudongdong3, stephen, ferruh.yigit
Hello,
11/10/2023 11:27, Jie Hai:
> app/proc-info/main.c | 32 ++++++++++-----
> app/test-pmd/cmdline.c | 29 ++++++++++---
> app/test-pmd/config.c | 38 ++++++++---------
> app/test-pmd/testpmd.h | 2 +-
> doc/guides/rel_notes/release_23_11.rst | 2 +
> drivers/net/atlantic/atl_ethdev.c | 2 +
> drivers/net/axgbe/axgbe_ethdev.c | 9 +++++
> drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++
> drivers/net/bnxt/bnxt_ethdev.c | 6 +++
> drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++
> drivers/net/cnxk/cnxk_ethdev.c | 5 +++
> drivers/net/cnxk/cnxk_ethdev_ops.c | 3 ++
> drivers/net/cpfl/cpfl_ethdev.c | 6 +++
> drivers/net/cxgbe/cxgbe_ethdev.c | 9 ++++-
> drivers/net/dpaa/dpaa_ethdev.c | 7 ++++
> drivers/net/dpaa2/dpaa2_ethdev.c | 7 ++++
> drivers/net/ena/ena_rss.c | 3 ++
> drivers/net/enic/enic_ethdev.c | 1 +
> drivers/net/enic/enic_main.c | 3 ++
> drivers/net/fm10k/fm10k_ethdev.c | 9 ++++-
> drivers/net/hinic/hinic_pmd_ethdev.c | 3 ++
> drivers/net/hinic/hinic_pmd_rx.c | 3 ++
> drivers/net/hns3/hns3_rss.c | 47 ++++++++++++---------
> drivers/net/i40e/i40e_ethdev.c | 7 ++++
> drivers/net/iavf/iavf_ethdev.c | 6 +++
> drivers/net/ice/ice_dcf.c | 3 ++
> drivers/net/ice/ice_dcf_ethdev.c | 3 ++
> drivers/net/ice/ice_ethdev.c | 7 ++++
> drivers/net/idpf/idpf_ethdev.c | 6 +++
> drivers/net/igc/igc_ethdev.c | 4 ++
> drivers/net/igc/igc_txrx.c | 5 +++
> drivers/net/ionic/ionic_ethdev.c | 6 +++
> drivers/net/ixgbe/ixgbe_ethdev.c | 12 +++++-
> drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++
> drivers/net/mana/mana.c | 11 ++++-
> drivers/net/mlx5/mlx5_ethdev.c | 4 ++
> drivers/net/mlx5/mlx5_rss.c | 3 +-
> drivers/net/mvpp2/mrvl_ethdev.c | 3 ++
> drivers/net/netvsc/hn_ethdev.c | 6 +++
> drivers/net/nfp/nfp_common.c | 9 ++++-
> drivers/net/ngbe/ngbe_ethdev.c | 6 ++-
> drivers/net/ngbe/ngbe_rxtx.c | 3 ++
> drivers/net/null/rte_eth_null.c | 8 ++++
> drivers/net/qede/qede_ethdev.c | 9 ++++-
> drivers/net/sfc/sfc_ethdev.c | 3 ++
> drivers/net/sfc/sfc_rx.c | 3 ++
> drivers/net/tap/rte_eth_tap.c | 8 ++++
> drivers/net/thunderx/nicvf_ethdev.c | 10 ++++-
> drivers/net/txgbe/txgbe_ethdev.c | 7 +++-
> drivers/net/txgbe/txgbe_ethdev_vf.c | 7 +++-
> drivers/net/txgbe/txgbe_rxtx.c | 3 ++
> lib/ethdev/rte_ethdev.c | 17 ++++++++
> lib/ethdev/rte_ethdev.h | 56 +++++++++++++++++++-------
> lib/ethdev/rte_flow.c | 1 -
> lib/ethdev/rte_flow.h | 25 +-----------
> 55 files changed, 395 insertions(+), 106 deletions(-)
Changing all drivers is suspicious.
It shows that something is missing in ethdev.
Please can you add the checks in ethdev only?
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 00/40] support setting and querying RSS algorithms
2023-10-17 14:06 ` Thomas Monjalon
@ 2023-10-17 14:26 ` Ferruh Yigit
2023-10-24 12:57 ` lihuisong (C)
0 siblings, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-10-17 14:26 UTC (permalink / raw)
To: Thomas Monjalon, Jie Hai
Cc: dev, lihuisong, fengchengwen, liudongdong3, stephen
On 10/17/2023 3:06 PM, Thomas Monjalon wrote:
> Hello,
>
> 11/10/2023 11:27, Jie Hai:
>> app/proc-info/main.c | 32 ++++++++++-----
>> app/test-pmd/cmdline.c | 29 ++++++++++---
>> app/test-pmd/config.c | 38 ++++++++---------
>> app/test-pmd/testpmd.h | 2 +-
>> doc/guides/rel_notes/release_23_11.rst | 2 +
>> drivers/net/atlantic/atl_ethdev.c | 2 +
>> drivers/net/axgbe/axgbe_ethdev.c | 9 +++++
>> drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++
>> drivers/net/bnxt/bnxt_ethdev.c | 6 +++
>> drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++
>> drivers/net/cnxk/cnxk_ethdev.c | 5 +++
>> drivers/net/cnxk/cnxk_ethdev_ops.c | 3 ++
>> drivers/net/cpfl/cpfl_ethdev.c | 6 +++
>> drivers/net/cxgbe/cxgbe_ethdev.c | 9 ++++-
>> drivers/net/dpaa/dpaa_ethdev.c | 7 ++++
>> drivers/net/dpaa2/dpaa2_ethdev.c | 7 ++++
>> drivers/net/ena/ena_rss.c | 3 ++
>> drivers/net/enic/enic_ethdev.c | 1 +
>> drivers/net/enic/enic_main.c | 3 ++
>> drivers/net/fm10k/fm10k_ethdev.c | 9 ++++-
>> drivers/net/hinic/hinic_pmd_ethdev.c | 3 ++
>> drivers/net/hinic/hinic_pmd_rx.c | 3 ++
>> drivers/net/hns3/hns3_rss.c | 47 ++++++++++++---------
>> drivers/net/i40e/i40e_ethdev.c | 7 ++++
>> drivers/net/iavf/iavf_ethdev.c | 6 +++
>> drivers/net/ice/ice_dcf.c | 3 ++
>> drivers/net/ice/ice_dcf_ethdev.c | 3 ++
>> drivers/net/ice/ice_ethdev.c | 7 ++++
>> drivers/net/idpf/idpf_ethdev.c | 6 +++
>> drivers/net/igc/igc_ethdev.c | 4 ++
>> drivers/net/igc/igc_txrx.c | 5 +++
>> drivers/net/ionic/ionic_ethdev.c | 6 +++
>> drivers/net/ixgbe/ixgbe_ethdev.c | 12 +++++-
>> drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++
>> drivers/net/mana/mana.c | 11 ++++-
>> drivers/net/mlx5/mlx5_ethdev.c | 4 ++
>> drivers/net/mlx5/mlx5_rss.c | 3 +-
>> drivers/net/mvpp2/mrvl_ethdev.c | 3 ++
>> drivers/net/netvsc/hn_ethdev.c | 6 +++
>> drivers/net/nfp/nfp_common.c | 9 ++++-
>> drivers/net/ngbe/ngbe_ethdev.c | 6 ++-
>> drivers/net/ngbe/ngbe_rxtx.c | 3 ++
>> drivers/net/null/rte_eth_null.c | 8 ++++
>> drivers/net/qede/qede_ethdev.c | 9 ++++-
>> drivers/net/sfc/sfc_ethdev.c | 3 ++
>> drivers/net/sfc/sfc_rx.c | 3 ++
>> drivers/net/tap/rte_eth_tap.c | 8 ++++
>> drivers/net/thunderx/nicvf_ethdev.c | 10 ++++-
>> drivers/net/txgbe/txgbe_ethdev.c | 7 +++-
>> drivers/net/txgbe/txgbe_ethdev_vf.c | 7 +++-
>> drivers/net/txgbe/txgbe_rxtx.c | 3 ++
>> lib/ethdev/rte_ethdev.c | 17 ++++++++
>> lib/ethdev/rte_ethdev.h | 56 +++++++++++++++++++-------
>> lib/ethdev/rte_flow.c | 1 -
>> lib/ethdev/rte_flow.h | 25 +-----------
>> 55 files changed, 395 insertions(+), 106 deletions(-)
>
> Changing all drivers is suspicious.
> It shows that something is missing in ethdev.
> Please can you add the checks in ethdev only?
>
That is kind of request from me, let me try to summarize what is going on,
there is a new config item added to "struct rte_eth_rss_conf" introduced
in this set, which is RSS hashing algorithm to use.
Problem is none of the existing drivers are taking account this new
config item, so application will request it but drivers silently ignore it.
This is a generic problem when adding a new config item to existing
config struct.
So my request was if drivers not supporting it, and it is requested by
the application, driver should return an error to let application know
that it is not supported, that is why bunch of drivers updated.
One option can be adding a new, specific API and dev_ops for this, for
this case new config item is related to the existing RSS API, so I think
it can be part of the existing API.
Other can be to have some kind of capability reporting by drivers, and
application will detect it and won't request this new config item, I
think Stephen already suggested something like this. This capability
flag is again a generic requirement, and `rte_eth_dev_info_get()`
partially used for this purpose. I think it will be odd from application
perspective to have a capability for just one config item of a feature set.
Anyway, I think updating drivers to report they are not supporting new
config item is best option to me, but also I think we should discuss
this capability reporting in ethdev in a wider context.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 02/40] ethdev: support setting and querying RSS algorithm
2023-10-12 2:21 ` fengchengwen
2023-10-12 15:23 ` Stephen Hemminger
@ 2023-10-24 12:54 ` Jie Hai
1 sibling, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-24 12:54 UTC (permalink / raw)
To: fengchengwen, Stephen Hemminger
Cc: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam,
lihuisong, liudongdong3
On 2023/10/12 10:21, fengchengwen wrote:
>
>
> On 2023/10/12 1:39, Stephen Hemminger wrote:
>> On Wed, 11 Oct 2023 17:27:27 +0800
>> Jie Hai <haijie1@huawei.com> wrote:
>>
>>> 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_rss_conf`` is extended by adding a new
>>> field "algorithm". This represents the RSS algorithms to apply.
>>> The following API will be affected:
>>> - rte_eth_dev_configure
>>> - rte_eth_dev_rss_hash_update
>>> - rte_eth_dev_rss_hash_conf_get
>>>
>>> If the value of "algorithm" used for configuration is a gibberish
>>> value, report the error and return. Do the same for
>>> rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
>>>
>>> To check whether the drivers report valid "algorithm", it is set
>>> to default value before querying.
>>>
>>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>>> ---
>>> doc/guides/rel_notes/release_23_11.rst | 2 ++
>>> lib/ethdev/rte_ethdev.c | 17 ++++++++++++++++
>>> lib/ethdev/rte_ethdev.h | 27 +++++++++++++++++++++++++
>>> lib/ethdev/rte_flow.c | 1 -
>>> lib/ethdev/rte_flow.h | 28 ++------------------------
>>> 5 files changed, 48 insertions(+), 27 deletions(-)
>>>
>>> diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
>>> index e13d57728071..92a445ab2ed3 100644
>>> --- a/doc/guides/rel_notes/release_23_11.rst
>>> +++ b/doc/guides/rel_notes/release_23_11.rst
>>> @@ -197,6 +197,8 @@ ABI Changes
>>> fields, to move ``rxq`` and ``txq`` fields, to change the size of
>>> ``reserved1`` and ``reserved2`` fields.
>>>
>>> +* 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 18a4b950b184..2eda1b8072e5 100644
>>> --- a/lib/ethdev/rte_ethdev.c
>>> +++ b/lib/ethdev/rte_ethdev.c
>>> @@ -1464,6 +1464,14 @@ 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.algorithm >= RTE_ETH_HASH_FUNCTION_MAX) {
>>> + RTE_ETHDEV_LOG(ERR,
>>> + "Ethdev port_id=%u invalid RSS algorithm: 0x%"PRIx64"\n",
>>> + port_id, dev_conf->rx_adv_conf.rss_conf.algorithm);
>>> + ret = -EINVAL;
>>> + goto rollback;
>>> + }
>>> +
>>
>> Rather than having every driver check the algorithm, why not handle this like
>> other features in DPDK (which may mean API/ABI changes).
>>
>> Add a field rss_algo_capa which is bit field of available RSS functions.
>> Then the check for algorithm can be done in generic code. There a couple
>> of reserved fields that could be used.
>
> +1 for add a field
>
> But there are two ways to config rss: ethdev-ops, ethdev-rteflow-ops, should distinguish them ? or just define for ethdev-ops ?
>
The rte_flow API does not distinguish RSS rule and FDIR rule,
the actual implementation of rss configuration depends on drivers.
I think if we had this "rss_algo_capa ", it can be just for ethdev-ops
for ethdev API level use.
>>
>> It would mean updating all the drivers once with the capa field but
>> would provide way for application to know what fields are possible.
>>
>> It has proved to be a problem in later ABI changes if a maximum value
>> is exposed. I.e don't expose RTE_ETH_HASH_FUNCTION_MAX.
>
> +1
>
>>
>> .
>>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 00/40] support setting and querying RSS algorithms
2023-10-17 14:26 ` Ferruh Yigit
@ 2023-10-24 12:57 ` lihuisong (C)
2023-10-26 8:53 ` Thomas Monjalon
0 siblings, 1 reply; 222+ messages in thread
From: lihuisong (C) @ 2023-10-24 12:57 UTC (permalink / raw)
To: Ferruh Yigit, Thomas Monjalon, Jie Hai
Cc: dev, fengchengwen, liudongdong3, stephen
在 2023/10/17 22:26, Ferruh Yigit 写道:
> On 10/17/2023 3:06 PM, Thomas Monjalon wrote:
>> Hello,
>>
>> 11/10/2023 11:27, Jie Hai:
>>> app/proc-info/main.c | 32 ++++++++++-----
>>> app/test-pmd/cmdline.c | 29 ++++++++++---
>>> app/test-pmd/config.c | 38 ++++++++---------
>>> app/test-pmd/testpmd.h | 2 +-
>>> doc/guides/rel_notes/release_23_11.rst | 2 +
>>> drivers/net/atlantic/atl_ethdev.c | 2 +
>>> drivers/net/axgbe/axgbe_ethdev.c | 9 +++++
>>> drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++
>>> drivers/net/bnxt/bnxt_ethdev.c | 6 +++
>>> drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++
>>> drivers/net/cnxk/cnxk_ethdev.c | 5 +++
>>> drivers/net/cnxk/cnxk_ethdev_ops.c | 3 ++
>>> drivers/net/cpfl/cpfl_ethdev.c | 6 +++
>>> drivers/net/cxgbe/cxgbe_ethdev.c | 9 ++++-
>>> drivers/net/dpaa/dpaa_ethdev.c | 7 ++++
>>> drivers/net/dpaa2/dpaa2_ethdev.c | 7 ++++
>>> drivers/net/ena/ena_rss.c | 3 ++
>>> drivers/net/enic/enic_ethdev.c | 1 +
>>> drivers/net/enic/enic_main.c | 3 ++
>>> drivers/net/fm10k/fm10k_ethdev.c | 9 ++++-
>>> drivers/net/hinic/hinic_pmd_ethdev.c | 3 ++
>>> drivers/net/hinic/hinic_pmd_rx.c | 3 ++
>>> drivers/net/hns3/hns3_rss.c | 47 ++++++++++++---------
>>> drivers/net/i40e/i40e_ethdev.c | 7 ++++
>>> drivers/net/iavf/iavf_ethdev.c | 6 +++
>>> drivers/net/ice/ice_dcf.c | 3 ++
>>> drivers/net/ice/ice_dcf_ethdev.c | 3 ++
>>> drivers/net/ice/ice_ethdev.c | 7 ++++
>>> drivers/net/idpf/idpf_ethdev.c | 6 +++
>>> drivers/net/igc/igc_ethdev.c | 4 ++
>>> drivers/net/igc/igc_txrx.c | 5 +++
>>> drivers/net/ionic/ionic_ethdev.c | 6 +++
>>> drivers/net/ixgbe/ixgbe_ethdev.c | 12 +++++-
>>> drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++
>>> drivers/net/mana/mana.c | 11 ++++-
>>> drivers/net/mlx5/mlx5_ethdev.c | 4 ++
>>> drivers/net/mlx5/mlx5_rss.c | 3 +-
>>> drivers/net/mvpp2/mrvl_ethdev.c | 3 ++
>>> drivers/net/netvsc/hn_ethdev.c | 6 +++
>>> drivers/net/nfp/nfp_common.c | 9 ++++-
>>> drivers/net/ngbe/ngbe_ethdev.c | 6 ++-
>>> drivers/net/ngbe/ngbe_rxtx.c | 3 ++
>>> drivers/net/null/rte_eth_null.c | 8 ++++
>>> drivers/net/qede/qede_ethdev.c | 9 ++++-
>>> drivers/net/sfc/sfc_ethdev.c | 3 ++
>>> drivers/net/sfc/sfc_rx.c | 3 ++
>>> drivers/net/tap/rte_eth_tap.c | 8 ++++
>>> drivers/net/thunderx/nicvf_ethdev.c | 10 ++++-
>>> drivers/net/txgbe/txgbe_ethdev.c | 7 +++-
>>> drivers/net/txgbe/txgbe_ethdev_vf.c | 7 +++-
>>> drivers/net/txgbe/txgbe_rxtx.c | 3 ++
>>> lib/ethdev/rte_ethdev.c | 17 ++++++++
>>> lib/ethdev/rte_ethdev.h | 56 +++++++++++++++++++-------
>>> lib/ethdev/rte_flow.c | 1 -
>>> lib/ethdev/rte_flow.h | 25 +-----------
>>> 55 files changed, 395 insertions(+), 106 deletions(-)
>> Changing all drivers is suspicious.
>> It shows that something is missing in ethdev.
>> Please can you add the checks in ethdev only?
>>
> That is kind of request from me, let me try to summarize what is going on,
>
> there is a new config item added to "struct rte_eth_rss_conf" introduced
> in this set, which is RSS hashing algorithm to use.
>
> Problem is none of the existing drivers are taking account this new
> config item, so application will request it but drivers silently ignore it.
>
> This is a generic problem when adding a new config item to existing
> config struct.
>
> So my request was if drivers not supporting it, and it is requested by
> the application, driver should return an error to let application know
> that it is not supported, that is why bunch of drivers updated.
>
>
> One option can be adding a new, specific API and dev_ops for this, for
> this case new config item is related to the existing RSS API, so I think
> it can be part of the existing API.
>
> Other can be to have some kind of capability reporting by drivers, and
> application will detect it and won't request this new config item, I
> think Stephen already suggested something like this. This capability
> flag is again a generic requirement, and `rte_eth_dev_info_get()`
> partially used for this purpose. I think it will be odd from application
> perspective to have a capability for just one config item of a feature set.
>
>
> Anyway, I think updating drivers to report they are not supporting new
> config item is best option to me, but also I think we should discuss
> this capability reporting in ethdev in a wider context.
IMO, it is more better to report RSS algorithm capability.
It can avoid the later ABI break successfully as Stephen said.
>
>
>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v5 00/40] support setting and querying RSS algorithms
2023-10-24 12:57 ` lihuisong (C)
@ 2023-10-26 8:53 ` Thomas Monjalon
0 siblings, 0 replies; 222+ messages in thread
From: Thomas Monjalon @ 2023-10-26 8:53 UTC (permalink / raw)
To: Ferruh Yigit, Jie Hai, lihuisong (C)
Cc: dev, fengchengwen, liudongdong3, stephen
24/10/2023 14:57, lihuisong (C):
> 在 2023/10/17 22:26, Ferruh Yigit 写道:
> > On 10/17/2023 3:06 PM, Thomas Monjalon wrote:
> >> 11/10/2023 11:27, Jie Hai:
> >>> 55 files changed, 395 insertions(+), 106 deletions(-)
> >>
> >> Changing all drivers is suspicious.
> >> It shows that something is missing in ethdev.
> >> Please can you add the checks in ethdev only?
> >>
> > That is kind of request from me, let me try to summarize what is going on,
> >
> > there is a new config item added to "struct rte_eth_rss_conf" introduced
> > in this set, which is RSS hashing algorithm to use.
> >
> > Problem is none of the existing drivers are taking account this new
> > config item, so application will request it but drivers silently ignore it.
> >
> > This is a generic problem when adding a new config item to existing
> > config struct.
> >
> > So my request was if drivers not supporting it, and it is requested by
> > the application, driver should return an error to let application know
> > that it is not supported, that is why bunch of drivers updated.
> >
> >
> > One option can be adding a new, specific API and dev_ops for this, for
> > this case new config item is related to the existing RSS API, so I think
> > it can be part of the existing API.
> >
> > Other can be to have some kind of capability reporting by drivers, and
> > application will detect it and won't request this new config item, I
> > think Stephen already suggested something like this. This capability
> > flag is again a generic requirement, and `rte_eth_dev_info_get()`
> > partially used for this purpose. I think it will be odd from application
> > perspective to have a capability for just one config item of a feature set.
> >
> >
> > Anyway, I think updating drivers to report they are not supporting new
> > config item is best option to me, but also I think we should discuss
> > this capability reporting in ethdev in a wider context.
> IMO, it is more better to report RSS algorithm capability.
> It can avoid the later ABI break successfully as Stephen said.
Yes we should add a capability for RSS algorithm.
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 0/9] support setting and querying RSS algorithms
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
` (42 preceding siblings ...)
2023-10-17 14:06 ` Thomas Monjalon
@ 2023-10-27 9:28 ` Jie Hai
2023-10-27 9:28 ` [PATCH 1/9] ethdev: overwrite some comment related to RSS Jie Hai
` (9 more replies)
43 siblings, 10 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-27 9:28 UTC (permalink / raw)
To: dev; +Cc: lihuisong, fengchengwen, liudongdong3
This patchset is to support setting and querying RSS algorithms.
For this purpose, field "rss_algo_capa" is added to ``rte_eth_dev_info``
and field "algorithm" is added to ``rte_eth_rss_conf``.
The drivers should reports their "rss_algo_capa" if they support
updating RSS algorithms. Otherwise, the "rss_algo_capa" is set to
RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT). The app configures RSS algorithms
by field "algorithm" and the related API should verify "algorithm" with
"rss_algo_capa".
--
v6:
1. rewrite some comments.
2. add "rss_algo_capa" for `rte_eth_dev_info``.
3. add new API to get name of RSS algorithms
v5:
1. rewrite some comments.
2. check RSS algorithm for drivers supporting RSS.
3. change field "func" of rss_conf to "algorithm".
4. fix commit log for [PATCH v4 4/7].
5. add Acked-by Reshma Pattan.
6. add symmetric_toeplitz_sort for showing.
7. change "hf" to "hash function" for showing.
v4:
1. recomment some definitions related to RSS.
2. allocate static memory for rss_key instead of dynamic.
3. use array of strings to get the name of rss algorithm.
4. add display of rss algorithm with testpmd.
v3:
1. fix commit log for PATCH [1/5].
2. make RSS ABI changes description to start the actual text at the margin.
3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
4. fix some comment codes.
v2:
1. return error if "func" is invalid.
2. modify the comments of the "func" field.
3. modify commit log of patch [3/5].
4. use malloc instead of rte_malloc.
5. adjust display format of RSS info.
6. remove the string display of rss_hf.
Huisong Li (1):
net/hns3: support setting and querying RSS hash function
Jie Hai (8):
ethdev: overwrite some comment related to RSS
ethdev: support setting and querying RSS algorithm
net/hns3: report RSS hash algorithms capability
app/proc-info: fix never show RSS info
app/proc-info: adjust the display format of RSS info
lib/ethdev: add API to get RSS algorithm names
app/proc-info: support querying RSS hash algorithm
app/testpmd: add RSS hash algorithms display
app/proc-info/main.c | 24 +++++----
app/test-pmd/cmdline.c | 29 +++++++++--
app/test-pmd/config.c | 29 ++++-------
app/test-pmd/testpmd.h | 2 +-
doc/guides/rel_notes/release_23_11.rst | 8 +++
drivers/net/hns3/hns3_common.c | 4 ++
drivers/net/hns3/hns3_rss.c | 47 +++++++++--------
lib/ethdev/rte_ethdev.c | 51 +++++++++++++++++++
lib/ethdev/rte_ethdev.h | 70 ++++++++++++++++++++------
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 25 +--------
11 files changed, 196 insertions(+), 94 deletions(-)
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 1/9] ethdev: overwrite some comment related to RSS
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
@ 2023-10-27 9:28 ` Jie Hai
2023-10-29 7:26 ` Ori Kam
2023-10-27 9:28 ` [PATCH 2/9] ethdev: support setting and querying RSS algorithm Jie Hai
` (8 subsequent siblings)
9 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-27 9:28 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
---
lib/ethdev/rte_ethdev.h | 33 ++++++++++++++++++---------------
lib/ethdev/rte_flow.h | 1 +
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 2fd3cd808dbf..37fd5afef48a 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -448,24 +448,27 @@ 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
+ * *rss_key_len* bytes. If not meet these requirements, the query result
+ * is unreliable even the operation returns success.
+ *
+ * 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*. Drivers are free to ignore the
+ * *rss_key_len* and assume key length is 40 bytes.
+ */
+ 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 edefa34c10da..25f1dffd1f30 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 */
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 2/9] ethdev: support setting and querying RSS algorithm
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
2023-10-27 9:28 ` [PATCH 1/9] ethdev: overwrite some comment related to RSS Jie Hai
@ 2023-10-27 9:28 ` Jie Hai
2023-10-27 9:28 ` [PATCH 3/9] net/hns3: report RSS hash algorithms capability Jie Hai
` (7 subsequent siblings)
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-27 9:28 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
doc/guides/rel_notes/release_23_11.rst | 5 ++++
lib/ethdev/rte_ethdev.c | 26 ++++++++++++++++++++
lib/ethdev/rte_ethdev.h | 33 +++++++++++++++++++++++++-
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 26 ++------------------
5 files changed, 65 insertions(+), 26 deletions(-)
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 0a6fc76a9d02..a35d729d2cc7 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -360,6 +360,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 9dabcb5ae28e..7af163b8a4b3 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;
@@ -1500,6 +1501,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 ((dev_info.rss_algo_capa &
+ RTE_ETH_HASH_ALGO_TO_CAPA(algorithm)) == 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ethdev port_id=%u config unsupported RSS hash algorithm: %u "
+ "with rss_algo_capa: 0x%"PRIx64"\n",
+ algorithm,
+ dev_info.rss_algo_capa);
+ ret = -EINVAL;
+ goto rollback;
+ }
+
/*
* Setup new number of Rx/Tx queues and reconfigure device.
*/
@@ -3757,6 +3770,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;
@@ -4698,6 +4712,16 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
return -ENOTSUP;
}
+ if ((dev_info.rss_algo_capa &
+ RTE_ETH_HASH_ALGO_TO_CAPA(rss_conf->algorithm)) == 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ethdev port_id=%u config unsupported RSS hash algorithm: %u "
+ "with rss_algo_capa: 0x%"PRIx64"\n",
+ 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,
@@ -4725,6 +4749,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 37fd5afef48a..2f639edd8218 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.
@@ -469,6 +496,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. */
};
/*
@@ -1783,7 +1811,10 @@ struct rte_eth_dev_info {
/** Supported error handling mode. */
enum rte_eth_err_handle_mode err_handle_mode;
- uint64_t reserved_64s[2]; /**< Reserved for future fields */
+ /** RSS hash algorithms capabilities */
+ uint32_t rss_algo_capa;
+
+ uint32_t reserved_32s[3]; /**< Reserved for future fields */
void *reserved_ptrs[2]; /**< Reserved for future fields */
};
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 3a67f1aaba9d..c13a2a391c37 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -13,7 +13,6 @@
#include <rte_branch_prediction.h>
#include <rte_string_fns.h>
#include <rte_mbuf_dyn.h>
-#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 25f1dffd1f30..c94f553ae06f 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -40,6 +40,8 @@
#include <rte_macsec.h>
#include <rte_ib.h>
+#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
*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 3/9] net/hns3: report RSS hash algorithms capability
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
2023-10-27 9:28 ` [PATCH 1/9] ethdev: overwrite some comment related to RSS Jie Hai
2023-10-27 9:28 ` [PATCH 2/9] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-10-27 9:28 ` Jie Hai
2023-10-27 9:28 ` [PATCH 4/9] net/hns3: support setting and querying RSS hash function Jie Hai
` (6 subsequent siblings)
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-27 9:28 UTC (permalink / raw)
To: dev, Yisen Zhuang; +Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
---
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;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 4/9] net/hns3: support setting and querying RSS hash function
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
` (2 preceding siblings ...)
2023-10-27 9:28 ` [PATCH 3/9] net/hns3: report RSS hash algorithms capability Jie Hai
@ 2023-10-27 9:28 ` Jie Hai
2023-10-27 9:28 ` [PATCH 5/9] app/proc-info: fix never show RSS info Jie Hai
` (5 subsequent siblings)
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-27 9:28 UTC (permalink / raw)
To: dev, Yisen Zhuang; +Cc: lihuisong, fengchengwen, liudongdong3
From: Huisong Li <lihuisong@huawei.com>
Support setting and querying RSS hash function by ethdev ops.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
| 47 +++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 20 deletions(-)
--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;
}
/*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 5/9] app/proc-info: fix never show RSS info
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
` (3 preceding siblings ...)
2023-10-27 9:28 ` [PATCH 4/9] net/hns3: support setting and querying RSS hash function Jie Hai
@ 2023-10-27 9:28 ` Jie Hai
2023-10-27 9:28 ` [PATCH 6/9] app/proc-info: adjust the display format of " Jie Hai
` (4 subsequent siblings)
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-27 9:28 UTC (permalink / raw)
To: dev, Reshma Pattan, John McNamara, Vipin Varghese
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
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
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 6/9] app/proc-info: adjust the display format of RSS info
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
` (4 preceding siblings ...)
2023-10-27 9:28 ` [PATCH 5/9] app/proc-info: fix never show RSS info Jie Hai
@ 2023-10-27 9:28 ` Jie Hai
2023-10-27 9:28 ` [PATCH 7/9] lib/ethdev: add API to get RSS algorithm names Jie Hai
` (3 subsequent siblings)
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-27 9:28 UTC (permalink / raw)
To: dev, Reshma Pattan, John McNamara, Vipin Varghese
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan<reshma.pattan@intel.com>
---
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);
}
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 7/9] lib/ethdev: add API to get RSS algorithm names
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
` (5 preceding siblings ...)
2023-10-27 9:28 ` [PATCH 6/9] app/proc-info: adjust the display format of " Jie Hai
@ 2023-10-27 9:28 ` Jie Hai
2023-10-27 9:28 ` [PATCH 8/9] app/proc-info: support querying RSS hash algorithm Jie Hai
` (2 subsequent siblings)
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-27 9:28 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
Cc: lihuisong, fengchengwen, liudongdong3
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 7af163b8a4b3..503e1a4cd13d 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
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 8/9] app/proc-info: support querying RSS hash algorithm
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
` (6 preceding siblings ...)
2023-10-27 9:28 ` [PATCH 7/9] lib/ethdev: add API to get RSS algorithm names Jie Hai
@ 2023-10-27 9:28 ` Jie Hai
2023-10-27 9:28 ` [PATCH 9/9] app/testpmd: add RSS hash algorithms display Jie Hai
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-27 9:28 UTC (permalink / raw)
To: dev, Reshma Pattan; +Cc: lihuisong, fengchengwen, liudongdong3
Display RSS hash algorithm with command show-port as below.
- RSS info
-- hash algorithm : toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
---
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
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH 9/9] app/testpmd: add RSS hash algorithms display
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
` (7 preceding siblings ...)
2023-10-27 9:28 ` [PATCH 8/9] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-10-27 9:28 ` Jie Hai
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-27 9:28 UTC (permalink / raw)
To: dev, Aman Singh, Yuying Zhang; +Cc: lihuisong, fengchengwen, liudongdong3
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 algorithms:
toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
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 679ca47b9401..d0eafd7f1254 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 <port_id> 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 <port_id> 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;
@@ -12953,6 +12971,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..c090b77b536c 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 algorithms:\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);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v7 0/9] support setting and querying RSS algorithms
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
` (8 preceding siblings ...)
2023-10-27 9:28 ` [PATCH 9/9] app/testpmd: add RSS hash algorithms display Jie Hai
@ 2023-10-28 1:46 ` Jie Hai
2023-10-28 1:46 ` [PATCH v7 1/9] ethdev: overwrite some comment related to RSS Jie Hai
` (9 more replies)
9 siblings, 10 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-28 1:46 UTC (permalink / raw)
To: dev; +Cc: lihuisong, fengchengwen, liudongdong3, haijie1
This patchset is to support setting and querying RSS algorithms.
For this purpose, field "rss_algo_capa" is added to ``rte_eth_dev_info``
and field "algorithm" is added to ``rte_eth_rss_conf``.
The drivers should reports their "rss_algo_capa" if they support
updating RSS algorithms. Otherwise, the "rss_algo_capa" is set to
RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT). The app configures RSS algorithms
by field "algorithm" and the related API should verify "algorithm" with
"rss_algo_capa".
--
v7:
1. fix compile error.
2. add signed-off-by to patch[4/9].
v6:
1. rewrite some comments.
2. add "rss_algo_capa" for `rte_eth_dev_info``.
3. add new API to get name of RSS algorithms
v5:
1. rewrite some comments.
2. check RSS algorithm for drivers supporting RSS.
3. change field "func" of rss_conf to "algorithm".
4. fix commit log for [PATCH v4 4/7].
5. add Acked-by Reshma Pattan.
6. add symmetric_toeplitz_sort for showing.
7. change "hf" to "hash function" for showing.
v4:
1. recomment some definitions related to RSS.
2. allocate static memory for rss_key instead of dynamic.
3. use array of strings to get the name of rss algorithm.
4. add display of rss algorithm with testpmd.
v3:
1. fix commit log for PATCH [1/5].
2. make RSS ABI changes description to start the actual text at the margin.
3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
4. fix some comment codes.
v2:
1. return error if "func" is invalid.
2. modify the comments of the "func" field.
3. modify commit log of patch [3/5].
4. use malloc instead of rte_malloc.
5. adjust display format of RSS info.
6. remove the string display of rss_hf.
Huisong Li (1):
net/hns3: support setting and querying RSS hash function
Jie Hai (8):
ethdev: overwrite some comment related to RSS
ethdev: support setting and querying RSS algorithm
net/hns3: report RSS hash algorithms capability
app/proc-info: fix never show RSS info
app/proc-info: adjust the display format of RSS info
lib/ethdev: add API to get RSS algorithm names
app/proc-info: support querying RSS hash algorithm
app/testpmd: add RSS hash algorithms display
app/proc-info/main.c | 24 +++++----
app/test-pmd/cmdline.c | 29 +++++++++--
app/test-pmd/config.c | 29 ++++-------
app/test-pmd/testpmd.h | 2 +-
doc/guides/rel_notes/release_23_11.rst | 8 +++
drivers/net/hns3/hns3_common.c | 4 ++
drivers/net/hns3/hns3_rss.c | 47 +++++++++--------
lib/ethdev/rte_ethdev.c | 51 +++++++++++++++++++
lib/ethdev/rte_ethdev.h | 70 ++++++++++++++++++++------
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 25 +--------
11 files changed, 196 insertions(+), 94 deletions(-)
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v7 1/9] ethdev: overwrite some comment related to RSS
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
@ 2023-10-28 1:46 ` Jie Hai
2023-10-28 2:41 ` lihuisong (C)
2023-10-28 1:46 ` [PATCH v7 2/9] ethdev: support setting and querying RSS algorithm Jie Hai
` (8 subsequent siblings)
9 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-28 1:46 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3, haijie1
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 <haijie1@huawei.com>
---
lib/ethdev/rte_ethdev.h | 33 ++++++++++++++++++---------------
lib/ethdev/rte_flow.h | 1 +
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 2fd3cd808dbf..37fd5afef48a 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -448,24 +448,27 @@ 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
+ * *rss_key_len* bytes. If not meet these requirements, the query result
+ * is unreliable even the operation returns success.
+ *
+ * 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*. Drivers are free to ignore the
+ * *rss_key_len* and assume key length is 40 bytes.
+ */
+ 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 edefa34c10da..25f1dffd1f30 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 */
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v7 2/9] ethdev: support setting and querying RSS algorithm
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
2023-10-28 1:46 ` [PATCH v7 1/9] ethdev: overwrite some comment related to RSS Jie Hai
@ 2023-10-28 1:46 ` Jie Hai
2023-10-28 3:01 ` lihuisong (C)
2023-10-28 1:46 ` [PATCH v7 3/9] net/hns3: report RSS hash algorithms capability Jie Hai
` (7 subsequent siblings)
9 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-28 1:46 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3, haijie1
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
doc/guides/rel_notes/release_23_11.rst | 5 ++++
lib/ethdev/rte_ethdev.c | 26 ++++++++++++++++++++
lib/ethdev/rte_ethdev.h | 33 +++++++++++++++++++++++++-
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 26 ++------------------
5 files changed, 65 insertions(+), 26 deletions(-)
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 0a6fc76a9d02..a35d729d2cc7 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -360,6 +360,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 9dabcb5ae28e..90bfbf14d1f7 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;
@@ -1500,6 +1501,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 ((dev_info.rss_algo_capa &
+ RTE_ETH_HASH_ALGO_TO_CAPA(algorithm)) == 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ethdev port_id=%u config unsupported RSS hash algorithm: %u "
+ "with rss_algo_capa: %x\n",
+ port_id, algorithm,
+ dev_info.rss_algo_capa);
+ ret = -EINVAL;
+ goto rollback;
+ }
+
/*
* Setup new number of Rx/Tx queues and reconfigure device.
*/
@@ -3757,6 +3770,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;
@@ -4698,6 +4712,16 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
return -ENOTSUP;
}
+ if ((dev_info.rss_algo_capa &
+ RTE_ETH_HASH_ALGO_TO_CAPA(rss_conf->algorithm)) == 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ethdev port_id=%u config unsupported RSS hash algorithm: %u "
+ "with rss_algo_capa: %x\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,
@@ -4725,6 +4749,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 37fd5afef48a..2f639edd8218 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.
@@ -469,6 +496,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. */
};
/*
@@ -1783,7 +1811,10 @@ struct rte_eth_dev_info {
/** Supported error handling mode. */
enum rte_eth_err_handle_mode err_handle_mode;
- uint64_t reserved_64s[2]; /**< Reserved for future fields */
+ /** RSS hash algorithms capabilities */
+ uint32_t rss_algo_capa;
+
+ uint32_t reserved_32s[3]; /**< Reserved for future fields */
void *reserved_ptrs[2]; /**< Reserved for future fields */
};
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 3a67f1aaba9d..c13a2a391c37 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -13,7 +13,6 @@
#include <rte_branch_prediction.h>
#include <rte_string_fns.h>
#include <rte_mbuf_dyn.h>
-#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 25f1dffd1f30..c94f553ae06f 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -40,6 +40,8 @@
#include <rte_macsec.h>
#include <rte_ib.h>
+#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
*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v7 3/9] net/hns3: report RSS hash algorithms capability
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
2023-10-28 1:46 ` [PATCH v7 1/9] ethdev: overwrite some comment related to RSS Jie Hai
2023-10-28 1:46 ` [PATCH v7 2/9] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-10-28 1:46 ` Jie Hai
2023-10-28 3:02 ` lihuisong (C)
2023-10-28 1:46 ` [PATCH v7 4/9] net/hns3: support setting and querying RSS hash function Jie Hai
` (6 subsequent siblings)
9 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-28 1:46 UTC (permalink / raw)
To: dev, Yisen Zhuang; +Cc: lihuisong, fengchengwen, liudongdong3, haijie1
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 <haijie1@huawei.com>
---
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;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v7 4/9] net/hns3: support setting and querying RSS hash function
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
` (2 preceding siblings ...)
2023-10-28 1:46 ` [PATCH v7 3/9] net/hns3: report RSS hash algorithms capability Jie Hai
@ 2023-10-28 1:46 ` Jie Hai
2023-10-28 1:46 ` [PATCH v7 5/9] app/proc-info: fix never show RSS info Jie Hai
` (5 subsequent siblings)
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-28 1:46 UTC (permalink / raw)
To: dev, Yisen Zhuang; +Cc: lihuisong, fengchengwen, liudongdong3, haijie1
From: Huisong Li <lihuisong@huawei.com>
Support setting and querying RSS hash function by ethdev ops.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Signed-off-by: Jie Hai <haijie1@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
| 47 +++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 20 deletions(-)
--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;
}
/*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v7 5/9] app/proc-info: fix never show RSS info
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
` (3 preceding siblings ...)
2023-10-28 1:46 ` [PATCH v7 4/9] net/hns3: support setting and querying RSS hash function Jie Hai
@ 2023-10-28 1:46 ` Jie Hai
2023-10-28 3:03 ` lihuisong (C)
2023-10-28 1:46 ` [PATCH v7 6/9] app/proc-info: adjust the display format of " Jie Hai
` (4 subsequent siblings)
9 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-28 1:46 UTC (permalink / raw)
To: dev, Reshma Pattan, Vipin Varghese, John McNamara
Cc: lihuisong, fengchengwen, liudongdong3, haijie1
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
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
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v7 6/9] app/proc-info: adjust the display format of RSS info
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
` (4 preceding siblings ...)
2023-10-28 1:46 ` [PATCH v7 5/9] app/proc-info: fix never show RSS info Jie Hai
@ 2023-10-28 1:46 ` Jie Hai
2023-10-28 1:46 ` [PATCH v7 7/9] lib/ethdev: add API to get RSS algorithm names Jie Hai
` (3 subsequent siblings)
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-28 1:46 UTC (permalink / raw)
To: dev, Reshma Pattan, Vipin Varghese, John McNamara
Cc: lihuisong, fengchengwen, liudongdong3, haijie1
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan<reshma.pattan@intel.com>
---
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);
}
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v7 7/9] lib/ethdev: add API to get RSS algorithm names
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
` (5 preceding siblings ...)
2023-10-28 1:46 ` [PATCH v7 6/9] app/proc-info: adjust the display format of " Jie Hai
@ 2023-10-28 1:46 ` Jie Hai
2023-10-28 3:09 ` lihuisong (C)
2023-11-01 2:04 ` Ferruh Yigit
2023-10-28 1:46 ` [PATCH v7 8/9] app/proc-info: support querying RSS hash algorithm Jie Hai
` (2 subsequent siblings)
9 siblings, 2 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-28 1:46 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
Cc: lihuisong, fengchengwen, liudongdong3, haijie1
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);
+
/**
* Add UDP tunneling port for a type of tunnel.
*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v7 8/9] app/proc-info: support querying RSS hash algorithm
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
` (6 preceding siblings ...)
2023-10-28 1:46 ` [PATCH v7 7/9] lib/ethdev: add API to get RSS algorithm names Jie Hai
@ 2023-10-28 1:46 ` Jie Hai
2023-10-28 1:46 ` [PATCH v7 9/9] app/testpmd: add RSS hash algorithms display Jie Hai
2023-11-01 2:04 ` [PATCH v7 0/9] support setting and querying RSS algorithms Ferruh Yigit
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-10-28 1:46 UTC (permalink / raw)
To: dev, Reshma Pattan; +Cc: lihuisong, fengchengwen, liudongdong3, haijie1
Display RSS hash algorithm with command show-port as below.
- RSS info
-- hash algorithm : toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
---
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
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v7 9/9] app/testpmd: add RSS hash algorithms display
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
` (7 preceding siblings ...)
2023-10-28 1:46 ` [PATCH v7 8/9] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-10-28 1:46 ` Jie Hai
2023-10-28 3:14 ` lihuisong (C)
2023-11-01 2:04 ` [PATCH v7 0/9] support setting and querying RSS algorithms Ferruh Yigit
9 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-10-28 1:46 UTC (permalink / raw)
To: dev, Aman Singh, Yuying Zhang
Cc: lihuisong, fengchengwen, liudongdong3, haijie1
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 algorithms:
toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
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 679ca47b9401..d0eafd7f1254 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 <port_id> 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 <port_id> 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;
@@ -12953,6 +12971,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..c090b77b536c 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 algorithms:\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);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v7 1/9] ethdev: overwrite some comment related to RSS
2023-10-28 1:46 ` [PATCH v7 1/9] ethdev: overwrite some comment related to RSS Jie Hai
@ 2023-10-28 2:41 ` lihuisong (C)
2023-11-01 12:55 ` Ferruh Yigit
0 siblings, 1 reply; 222+ messages in thread
From: lihuisong (C) @ 2023-10-28 2:41 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: fengchengwen, liudongdong3
在 2023/10/28 9:46, Jie Hai 写道:
> 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 <haijie1@huawei.com>
> ---
> lib/ethdev/rte_ethdev.h | 33 ++++++++++++++++++---------------
> lib/ethdev/rte_flow.h | 1 +
> 2 files changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index 2fd3cd808dbf..37fd5afef48a 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -448,24 +448,27 @@ 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
Is this added the new comment?
Suggest that the "rss_key_len" field should be equal to the
hash_key_size from dev_info_get().
Because many PMDs, like, hns3, i40e, ice and mlx5, check it in driver
based on the condition that the rss_key_len field must be equal to the
hash_key_size when the rss_key is not NULL.
IMO, it is better that this check should be added in ethdev layer.
> + * rte_eth_dev_info_get() API. And the *rss_key* should contain at least
> + * *rss_key_len* bytes. If not meet these requirements, the query result
here "rss_key_len" should be "hash_key_size", right?
> + * is unreliable even the operation returns success.
s/even/even if
> + *
> + * 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*. Drivers are free to ignore the
> + * *rss_key_len* and assume key length is 40 bytes.
please modify the comment: "Drivers are free to ignore the *rss_key_len*
and assume key length is 40 bytes. "
Actually, most of PMDs, like, hns3, i40e, mlx, do not configure RSS hash
key if rss_key is NULL and treat it as not updating the hash key.
> + */
> + 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 edefa34c10da..25f1dffd1f30 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 */
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v7 2/9] ethdev: support setting and querying RSS algorithm
2023-10-28 1:46 ` [PATCH v7 2/9] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-10-28 3:01 ` lihuisong (C)
2023-11-01 12:55 ` Ferruh Yigit
0 siblings, 1 reply; 222+ messages in thread
From: lihuisong (C) @ 2023-10-28 3:01 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: fengchengwen, liudongdong3
With belows to changes,
Acked-by: Huisong Li <lihuisong@huawei.com>
在 2023/10/28 9:46, Jie Hai 写道:
> 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 <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> ---
> doc/guides/rel_notes/release_23_11.rst | 5 ++++
> lib/ethdev/rte_ethdev.c | 26 ++++++++++++++++++++
> lib/ethdev/rte_ethdev.h | 33 +++++++++++++++++++++++++-
> lib/ethdev/rte_flow.c | 1 -
> lib/ethdev/rte_flow.h | 26 ++------------------
> 5 files changed, 65 insertions(+), 26 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
> index 0a6fc76a9d02..a35d729d2cc7 100644
> --- a/doc/guides/rel_notes/release_23_11.rst
> +++ b/doc/guides/rel_notes/release_23_11.rst
> @@ -360,6 +360,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 9dabcb5ae28e..90bfbf14d1f7 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;
> @@ -1500,6 +1501,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 ((dev_info.rss_algo_capa &
> + RTE_ETH_HASH_ALGO_TO_CAPA(algorithm)) == 0) {
need to check the algorithm.
its value should be in range of 0 to 31.
> + RTE_ETHDEV_LOG(ERR,
> + "Ethdev port_id=%u config unsupported RSS hash algorithm: %u "
> + "with rss_algo_capa: %x\n",
It seems that this log is not friendly to user.
Configured RSS hash algorithm (%u) is not in the algorithm capability ().
Anything ok like that.
%x --> 0x%" PRIx32 "
> + port_id, algorithm,
> + dev_info.rss_algo_capa);
> + ret = -EINVAL;
> + goto rollback;
> + }
> +
> /*
> * Setup new number of Rx/Tx queues and reconfigure device.
> */
> @@ -3757,6 +3770,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;
> @@ -4698,6 +4712,16 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
> return -ENOTSUP;
> }
>
> + if ((dev_info.rss_algo_capa &
> + RTE_ETH_HASH_ALGO_TO_CAPA(rss_conf->algorithm)) == 0) {
> + RTE_ETHDEV_LOG(ERR,
> + "Ethdev port_id=%u config unsupported RSS hash algorithm: %u "
> + "with rss_algo_capa: %x\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,
> @@ -4725,6 +4749,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 37fd5afef48a..2f639edd8218 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.
> @@ -469,6 +496,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. */
> };
>
> /*
> @@ -1783,7 +1811,10 @@ struct rte_eth_dev_info {
> /** Supported error handling mode. */
> enum rte_eth_err_handle_mode err_handle_mode;
>
> - uint64_t reserved_64s[2]; /**< Reserved for future fields */
> + /** RSS hash algorithms capabilities */
> + uint32_t rss_algo_capa;
Please move this new field to "hash_key_size" and
"flow_type_rss_offloads" in this struct.
Because this version allows ABI break.
> +
> + uint32_t reserved_32s[3]; /**< Reserved for future fields */
> void *reserved_ptrs[2]; /**< Reserved for future fields */
> };
>
> diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
> index 3a67f1aaba9d..c13a2a391c37 100644
> --- a/lib/ethdev/rte_flow.c
> +++ b/lib/ethdev/rte_flow.c
> @@ -13,7 +13,6 @@
> #include <rte_branch_prediction.h>
> #include <rte_string_fns.h>
> #include <rte_mbuf_dyn.h>
> -#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 25f1dffd1f30..c94f553ae06f 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -40,6 +40,8 @@
> #include <rte_macsec.h>
> #include <rte_ib.h>
>
> +#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
> *
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v7 3/9] net/hns3: report RSS hash algorithms capability
2023-10-28 1:46 ` [PATCH v7 3/9] net/hns3: report RSS hash algorithms capability Jie Hai
@ 2023-10-28 3:02 ` lihuisong (C)
0 siblings, 0 replies; 222+ messages in thread
From: lihuisong (C) @ 2023-10-28 3:02 UTC (permalink / raw)
To: Jie Hai, dev, Yisen Zhuang; +Cc: fengchengwen, liudongdong3
lgtm,
Acked-by: Huisong Li <lihuisong@huawei.com>
在 2023/10/28 9:46, Jie Hai 写道:
> 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 <haijie1@huawei.com>
> ---
> 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;
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v7 5/9] app/proc-info: fix never show RSS info
2023-10-28 1:46 ` [PATCH v7 5/9] app/proc-info: fix never show RSS info Jie Hai
@ 2023-10-28 3:03 ` lihuisong (C)
0 siblings, 0 replies; 222+ messages in thread
From: lihuisong (C) @ 2023-10-28 3:03 UTC (permalink / raw)
To: Jie Hai, dev, Reshma Pattan, Vipin Varghese, John McNamara
Cc: fengchengwen, liudongdong3
在 2023/10/28 9:46, Jie Hai 写道:
> Signed-off-by: Jie Hai<haijie1@huawei.com>
> Signed-off-by: Dongdong Liu<liudongdong3@huawei.com>
> Acked-by: Reshma Pattan<reshma.pattan@intel.com>
> Acked-by: Chengwen Feng<fengchengwen@huawei.com>
> ---
lgtm,
Acked-by: Huisong Li <lihuisong@huawei.com>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v7 7/9] lib/ethdev: add API to get RSS algorithm names
2023-10-28 1:46 ` [PATCH v7 7/9] lib/ethdev: add API to get RSS algorithm names Jie Hai
@ 2023-10-28 3:09 ` lihuisong (C)
2023-11-01 2:04 ` Ferruh Yigit
1 sibling, 0 replies; 222+ messages in thread
From: lihuisong (C) @ 2023-10-28 3:09 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
Cc: fengchengwen, liudongdong3
在 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.
> *
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v7 9/9] app/testpmd: add RSS hash algorithms display
2023-10-28 1:46 ` [PATCH v7 9/9] app/testpmd: add RSS hash algorithms display Jie Hai
@ 2023-10-28 3:14 ` lihuisong (C)
0 siblings, 0 replies; 222+ messages in thread
From: lihuisong (C) @ 2023-10-28 3:14 UTC (permalink / raw)
To: Jie Hai, dev, Aman Singh, Yuying Zhang; +Cc: fengchengwen, liudongdong3
在 2023/10/28 9:46, Jie Hai 写道:
> 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 algorithms:
> toeplitz
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> 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 679ca47b9401..d0eafd7f1254 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 <port_id> 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 <port_id> 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;
> @@ -12953,6 +12971,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..c090b77b536c 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 algorithms:\n %s\n",
> + rte_eth_dev_rss_algo_name(rss_conf.algorithm));
algorithms --> algorithm, right?
Acked-by: Huisong Li <lihuisong@huawei.com>
> + 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);
^ permalink raw reply [flat|nested] 222+ messages in thread
* RE: [PATCH 1/9] ethdev: overwrite some comment related to RSS
2023-10-27 9:28 ` [PATCH 1/9] ethdev: overwrite some comment related to RSS Jie Hai
@ 2023-10-29 7:26 ` Ori Kam
2023-11-01 6:06 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: Ori Kam @ 2023-10-29 7:26 UTC (permalink / raw)
To: Jie Hai, dev, NBU-Contact-Thomas Monjalon (EXTERNAL),
Ferruh Yigit, Andrew Rybchenko
Cc: lihuisong, fengchengwen, liudongdong3
Hi Jei,
> -----Original Message-----
> From: Jie Hai <haijie1@huawei.com>
> Sent: Friday, October 27, 2023 12:28 PM
>
> 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 <haijie1@huawei.com>
> ---
> lib/ethdev/rte_ethdev.h | 33 ++++++++++++++++++---------------
> lib/ethdev/rte_flow.h | 1 +
> 2 files changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index 2fd3cd808dbf..37fd5afef48a 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -448,24 +448,27 @@ 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
> + * *rss_key_len* bytes. If not meet these requirements, the query
> result
> + * is unreliable even the operation returns success.
> + *
> + * 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*. Drivers are free to ignore the
> + * *rss_key_len* and assume key length is 40 bytes.
In the original comment, it is stated that if no RSS key is given rss_key = NULL , then the PMD selects a random hash key,
Is this behavior changed?
> + */
> + 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 edefa34c10da..25f1dffd1f30 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 */
> --
> 2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v7 0/9] support setting and querying RSS algorithms
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
` (8 preceding siblings ...)
2023-10-28 1:46 ` [PATCH v7 9/9] app/testpmd: add RSS hash algorithms display Jie Hai
@ 2023-11-01 2:04 ` Ferruh Yigit
9 siblings, 0 replies; 222+ messages in thread
From: Ferruh Yigit @ 2023-11-01 2:04 UTC (permalink / raw)
To: Jie Hai, dev; +Cc: lihuisong, fengchengwen, liudongdong3
On 10/28/2023 2:46 AM, Jie Hai wrote:
> This patchset is to support setting and querying RSS algorithms.
> For this purpose, field "rss_algo_capa" is added to ``rte_eth_dev_info``
> and field "algorithm" is added to ``rte_eth_rss_conf``.
> The drivers should reports their "rss_algo_capa" if they support
> updating RSS algorithms. Otherwise, the "rss_algo_capa" is set to
> RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT). The app configures RSS algorithms
> by field "algorithm" and the related API should verify "algorithm" with
> "rss_algo_capa".
>
> --
> v7:
> 1. fix compile error.
> 2. add signed-off-by to patch[4/9].
> v6:
> 1. rewrite some comments.
> 2. add "rss_algo_capa" for `rte_eth_dev_info``.
> 3. add new API to get name of RSS algorithms
>
> v5:
> 1. rewrite some comments.
> 2. check RSS algorithm for drivers supporting RSS.
> 3. change field "func" of rss_conf to "algorithm".
> 4. fix commit log for [PATCH v4 4/7].
> 5. add Acked-by Reshma Pattan.
> 6. add symmetric_toeplitz_sort for showing.
> 7. change "hf" to "hash function" for showing.
>
> v4:
> 1. recomment some definitions related to RSS.
> 2. allocate static memory for rss_key instead of dynamic.
> 3. use array of strings to get the name of rss algorithm.
> 4. add display of rss algorithm with testpmd.
>
> v3:
> 1. fix commit log for PATCH [1/5].
> 2. make RSS ABI changes description to start the actual text at the margin.
> 3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
> 4. fix some comment codes.
>
> v2:
> 1. return error if "func" is invalid.
> 2. modify the comments of the "func" field.
> 3. modify commit log of patch [3/5].
> 4. use malloc instead of rte_malloc.
> 5. adjust display format of RSS info.
> 6. remove the string display of rss_hf.
>
> Huisong Li (1):
> net/hns3: support setting and querying RSS hash function
>
> Jie Hai (8):
> ethdev: overwrite some comment related to RSS
> ethdev: support setting and querying RSS algorithm
> net/hns3: report RSS hash algorithms capability
> app/proc-info: fix never show RSS info
> app/proc-info: adjust the display format of RSS info
> lib/ethdev: add API to get RSS algorithm names
> app/proc-info: support querying RSS hash algorithm
> app/testpmd: add RSS hash algorithms display
>
Hi Jie,
Patchset mostly looks good to me, new capability in dev_info approach is
better, but only I put some comments in the new API patch, can you
please check it, rest looks good but please send new version as whole
patchset.
Thanks,
ferruh
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v7 7/9] lib/ethdev: add API to get RSS algorithm names
2023-10-28 1:46 ` [PATCH v7 7/9] lib/ethdev: add API to get RSS algorithm names Jie Hai
2023-10-28 3:09 ` lihuisong (C)
@ 2023-11-01 2:04 ` Ferruh Yigit
1 sibling, 0 replies; 222+ messages in thread
From: Ferruh Yigit @ 2023-11-01 2:04 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Andrew Rybchenko
Cc: lihuisong, fengchengwen, liudongdong3
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.
> *
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH 1/9] ethdev: overwrite some comment related to RSS
2023-10-29 7:26 ` Ori Kam
@ 2023-11-01 6:06 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-01 6:06 UTC (permalink / raw)
To: Ori Kam, dev, NBU-Contact-Thomas Monjalon (EXTERNAL),
Ferruh Yigit, Andrew Rybchenko
Cc: lihuisong, fengchengwen, liudongdong3
On 2023/10/29 15:26, Ori Kam wrote:
> Hi Jei,
>
>> -----Original Message-----
>> From: Jie Hai <haijie1@huawei.com>
>> Sent: Friday, October 27, 2023 12:28 PM
>>
>> 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 <haijie1@huawei.com>
>> ---
>> lib/ethdev/rte_ethdev.h | 33 ++++++++++++++++++---------------
>> lib/ethdev/rte_flow.h | 1 +
>> 2 files changed, 19 insertions(+), 15 deletions(-)
>>
>> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
>> index 2fd3cd808dbf..37fd5afef48a 100644
>> --- a/lib/ethdev/rte_ethdev.h
>> +++ b/lib/ethdev/rte_ethdev.h
>> @@ -448,24 +448,27 @@ 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
>> + * *rss_key_len* bytes. If not meet these requirements, the query
>> result
>> + * is unreliable even the operation returns success.
>> + *
>> + * 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*. Drivers are free to ignore the
>> + * *rss_key_len* and assume key length is 40 bytes.
>
> In the original comment, it is stated that if no RSS key is given rss_key = NULL , then the PMD selects a random hash key,
> Is this behavior changed?
Thanks for your comment.
Some drivers select a random key, e.g. cpfl_ethdev, bnx2x_vfpf, ena.
Some drivers use their default key, which is fixed, e.g. igb.
And some just ignore this configuration on rss_key, e.g. cxgbe_ethdev.
I will correct that.
>
>> + */
>> + 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 edefa34c10da..25f1dffd1f30 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 */
>> --
>> 2.30.0
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v8 00/10] support setting and querying RSS algorithms
2023-03-15 11:00 [PATCH 0/5] support setting and querying RSS algorithms Dongdong Liu
` (5 preceding siblings ...)
2023-08-26 7:46 ` [PATCH v2 0/5] support setting and querying RSS algorithms Jie Hai
@ 2023-11-01 7:40 ` Jie Hai
2023-11-01 7:40 ` [PATCH v8 01/10] ethdev: overwrite some comment related to RSS Jie Hai
` (10 more replies)
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
7 siblings, 11 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-01 7:40 UTC (permalink / raw)
To: haijie1, dev; +Cc: lihuisong, fengchengwen, liudongdong3
This patchset is to support setting and querying RSS algorithms.
For this purpose, field "rss_algo_capa" is added to ``rte_eth_dev_info``
and field "algorithm" is added to ``rte_eth_rss_conf``.
The drivers should reports their "rss_algo_capa" if they support
updating RSS algorithms. Otherwise, the "rss_algo_capa" is set to
RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT). The app configures RSS algorithms
by field "algorithm" and the related API should verify "algorithm" with
"rss_algo_capa".
--
v8:
1. rewrite some comments.
2. add check for rss_key_len in ethdev level.
3. add Acked-by: Huisong Li <lihuisong@huawei.com>.
4. fix log on RSS hash algorithm.
5. add rte_eth_dev_rss_algo_name to lib/ethdev/version.map.
6. fix RSS algorithm display on testpmd.
v7:
1. fix compile error.
2. add signed-off-by to patch[4/9].
v6:
1. rewrite some comments.
2. add "rss_algo_capa" for `rte_eth_dev_info``.
3. add new API to get name of RSS algorithms
v5:
1. rewrite some comments.
2. check RSS algorithm for drivers supporting RSS.
3. change field "func" of rss_conf to "algorithm".
4. fix commit log for [PATCH v4 4/7].
5. add Acked-by Reshma Pattan.
6. add symmetric_toeplitz_sort for showing.
7. change "hf" to "hash function" for showing.
v4:
1. recomment some definitions related to RSS.
2. allocate static memory for rss_key instead of dynamic.
3. use array of strings to get the name of rss algorithm.
4. add display of rss algorithm with testpmd.
v3:
1. fix commit log for PATCH [1/5].
2. make RSS ABI changes description to start the actual text at the margin.
3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
4. fix some comment codes.
v2:
1. return error if "func" is invalid.
2. modify the comments of the "func" field.
3. modify commit log of patch [3/5].
4. use malloc instead of rte_malloc.
5. adjust display format of RSS info.
6. remove the string display of rss_hf.
Huisong Li (1):
net/hns3: support setting and querying RSS hash function
Jie Hai (9):
ethdev: overwrite some comment related to RSS
lib/ethdev: check RSS key length
ethdev: support setting and querying RSS algorithm
net/hns3: report RSS hash algorithms capability
app/proc-info: fix never show RSS info
app/proc-info: adjust the display format of RSS info
ethdev: add API to get RSS algorithm names
app/proc-info: support querying RSS hash algorithm
app/testpmd: add RSS hash algorithms display
app/proc-info/main.c | 24 +++++---
app/test-pmd/cmdline.c | 29 +++++++--
app/test-pmd/config.c | 29 ++++-----
app/test-pmd/testpmd.h | 2 +-
doc/guides/rel_notes/release_23_11.rst | 9 +++
drivers/net/hns3/hns3_common.c | 4 ++
drivers/net/hns3/hns3_rss.c | 47 ++++++++-------
lib/ethdev/rte_ethdev.c | 82 ++++++++++++++++++++++++++
lib/ethdev/rte_ethdev.h | 79 ++++++++++++++++++++-----
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 25 +-------
lib/ethdev/version.map | 1 +
12 files changed, 239 insertions(+), 93 deletions(-)
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v8 01/10] ethdev: overwrite some comment related to RSS
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
@ 2023-11-01 7:40 ` Jie Hai
2023-11-01 10:09 ` lihuisong (C)
2023-11-01 13:13 ` Ferruh Yigit
2023-11-01 7:40 ` [PATCH v8 02/10] lib/ethdev: check RSS key length Jie Hai
` (9 subsequent siblings)
10 siblings, 2 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-01 7:40 UTC (permalink / raw)
To: haijie1, dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
---
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 */
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v8 02/10] lib/ethdev: check RSS key length
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
2023-11-01 7:40 ` [PATCH v8 01/10] ethdev: overwrite some comment related to RSS Jie Hai
@ 2023-11-01 7:40 ` Jie Hai
2023-11-01 10:07 ` lihuisong (C)
2023-11-01 13:19 ` Ferruh Yigit
2023-11-01 7:40 ` [PATCH v8 03/10] ethdev: support setting and querying RSS algorithm Jie Hai
` (8 subsequent siblings)
10 siblings, 2 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-01 7:40 UTC (permalink / raw)
To: haijie1, dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
---
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,
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v8 03/10] ethdev: support setting and querying RSS algorithm
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
2023-11-01 7:40 ` [PATCH v8 01/10] ethdev: overwrite some comment related to RSS Jie Hai
2023-11-01 7:40 ` [PATCH v8 02/10] lib/ethdev: check RSS key length Jie Hai
@ 2023-11-01 7:40 ` Jie Hai
2023-11-01 13:36 ` Ferruh Yigit
2023-11-01 7:40 ` [PATCH v8 04/10] net/hns3: report RSS hash algorithms capability Jie Hai
` (7 subsequent siblings)
10 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-11-01 7:40 UTC (permalink / raw)
To: haijie1, dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
---
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 <rte_branch_prediction.h>
#include <rte_string_fns.h>
#include <rte_mbuf_dyn.h>
-#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 <rte_macsec.h>
#include <rte_ib.h>
+#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
*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v8 04/10] net/hns3: report RSS hash algorithms capability
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
` (2 preceding siblings ...)
2023-11-01 7:40 ` [PATCH v8 03/10] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-11-01 7:40 ` Jie Hai
2023-11-01 7:40 ` [PATCH v8 05/10] net/hns3: support setting and querying RSS hash function Jie Hai
` (6 subsequent siblings)
10 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-01 7:40 UTC (permalink / raw)
To: haijie1, dev, Yisen Zhuang; +Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
---
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;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v8 05/10] net/hns3: support setting and querying RSS hash function
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
` (3 preceding siblings ...)
2023-11-01 7:40 ` [PATCH v8 04/10] net/hns3: report RSS hash algorithms capability Jie Hai
@ 2023-11-01 7:40 ` Jie Hai
2023-11-01 7:40 ` [PATCH v8 06/10] app/proc-info: fix never show RSS info Jie Hai
` (5 subsequent siblings)
10 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-01 7:40 UTC (permalink / raw)
To: haijie1, dev, Yisen Zhuang; +Cc: lihuisong, fengchengwen, liudongdong3
From: Huisong Li <lihuisong@huawei.com>
Support setting and querying RSS hash function by ethdev ops.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Signed-off-by: Jie Hai <haijie1@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
| 47 +++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 20 deletions(-)
--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;
}
/*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v8 06/10] app/proc-info: fix never show RSS info
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
` (4 preceding siblings ...)
2023-11-01 7:40 ` [PATCH v8 05/10] net/hns3: support setting and querying RSS hash function Jie Hai
@ 2023-11-01 7:40 ` Jie Hai
2023-11-01 7:40 ` [PATCH v8 07/10] app/proc-info: adjust the display format of " Jie Hai
` (4 subsequent siblings)
10 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-01 7:40 UTC (permalink / raw)
To: haijie1, dev, Reshma Pattan, John McNamara, Vipin Varghese
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
---
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
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v8 07/10] app/proc-info: adjust the display format of RSS info
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
` (5 preceding siblings ...)
2023-11-01 7:40 ` [PATCH v8 06/10] app/proc-info: fix never show RSS info Jie Hai
@ 2023-11-01 7:40 ` Jie Hai
2023-11-01 7:40 ` [PATCH v8 08/10] ethdev: add API to get RSS algorithm names Jie Hai
` (3 subsequent siblings)
10 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-01 7:40 UTC (permalink / raw)
To: haijie1, dev, Reshma Pattan, John McNamara, Vipin Varghese
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan<reshma.pattan@intel.com>
---
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);
}
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v8 08/10] ethdev: add API to get RSS algorithm names
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
` (6 preceding siblings ...)
2023-11-01 7:40 ` [PATCH v8 07/10] app/proc-info: adjust the display format of " Jie Hai
@ 2023-11-01 7:40 ` Jie Hai
2023-11-01 7:40 ` [PATCH v8 09/10] app/proc-info: support querying RSS hash algorithm Jie Hai
` (2 subsequent siblings)
10 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-01 7:40 UTC (permalink / raw)
To: haijie1, dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
Cc: lihuisong, fengchengwen, liudongdong3
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>
Acked-by: Huisong Li <lihuisong@huawei.com>
---
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;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v8 09/10] app/proc-info: support querying RSS hash algorithm
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
` (7 preceding siblings ...)
2023-11-01 7:40 ` [PATCH v8 08/10] ethdev: add API to get RSS algorithm names Jie Hai
@ 2023-11-01 7:40 ` Jie Hai
2023-11-01 10:08 ` lihuisong (C)
2023-11-01 7:40 ` [PATCH v8 10/10] app/testpmd: add RSS hash algorithms display Jie Hai
2023-11-01 9:44 ` [PATCH v8 00/10] support setting and querying RSS algorithms fengchengwen
10 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-11-01 7:40 UTC (permalink / raw)
To: haijie1, dev, Reshma Pattan; +Cc: lihuisong, fengchengwen, liudongdong3
Display RSS hash algorithm with command show-port as below.
- RSS info
-- hash algorithm : toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
---
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
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v8 10/10] app/testpmd: add RSS hash algorithms display
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
` (8 preceding siblings ...)
2023-11-01 7:40 ` [PATCH v8 09/10] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-11-01 7:40 ` Jie Hai
2023-11-01 13:42 ` Ferruh Yigit
2023-11-01 9:44 ` [PATCH v8 00/10] support setting and querying RSS algorithms fengchengwen
10 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-11-01 7:40 UTC (permalink / raw)
To: haijie1, dev, Aman Singh, Yuying Zhang
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
---
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 <port_id> 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 <port_id> 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);
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v8 00/10] support setting and querying RSS algorithms
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
` (9 preceding siblings ...)
2023-11-01 7:40 ` [PATCH v8 10/10] app/testpmd: add RSS hash algorithms display Jie Hai
@ 2023-11-01 9:44 ` fengchengwen
10 siblings, 0 replies; 222+ messages in thread
From: fengchengwen @ 2023-11-01 9:44 UTC (permalink / raw)
To: Jie Hai, dev; +Cc: lihuisong, liudongdong3
LGTM
Series-acked-by: Chengwen Feng <fengchengwen@huawei.com>
On 2023/11/1 15:40, Jie Hai wrote:
> This patchset is to support setting and querying RSS algorithms.
> For this purpose, field "rss_algo_capa" is added to ``rte_eth_dev_info``
> and field "algorithm" is added to ``rte_eth_rss_conf``.
> The drivers should reports their "rss_algo_capa" if they support
> updating RSS algorithms. Otherwise, the "rss_algo_capa" is set to
> RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT). The app configures RSS algorithms
> by field "algorithm" and the related API should verify "algorithm" with
> "rss_algo_capa".
>
> --
> v8:
> 1. rewrite some comments.
> 2. add check for rss_key_len in ethdev level.
> 3. add Acked-by: Huisong Li <lihuisong@huawei.com>.
> 4. fix log on RSS hash algorithm.
> 5. add rte_eth_dev_rss_algo_name to lib/ethdev/version.map.
> 6. fix RSS algorithm display on testpmd.
>
> v7:
> 1. fix compile error.
> 2. add signed-off-by to patch[4/9].
> v6:
> 1. rewrite some comments.
> 2. add "rss_algo_capa" for `rte_eth_dev_info``.
> 3. add new API to get name of RSS algorithms
>
> v5:
> 1. rewrite some comments.
> 2. check RSS algorithm for drivers supporting RSS.
> 3. change field "func" of rss_conf to "algorithm".
> 4. fix commit log for [PATCH v4 4/7].
> 5. add Acked-by Reshma Pattan.
> 6. add symmetric_toeplitz_sort for showing.
> 7. change "hf" to "hash function" for showing.
>
> v4:
> 1. recomment some definitions related to RSS.
> 2. allocate static memory for rss_key instead of dynamic.
> 3. use array of strings to get the name of rss algorithm.
> 4. add display of rss algorithm with testpmd.
>
> v3:
> 1. fix commit log for PATCH [1/5].
> 2. make RSS ABI changes description to start the actual text at the margin.
> 3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
> 4. fix some comment codes.
>
> v2:
> 1. return error if "func" is invalid.
> 2. modify the comments of the "func" field.
> 3. modify commit log of patch [3/5].
> 4. use malloc instead of rte_malloc.
> 5. adjust display format of RSS info.
> 6. remove the string display of rss_hf.
>
> Huisong Li (1):
> net/hns3: support setting and querying RSS hash function
>
> Jie Hai (9):
> ethdev: overwrite some comment related to RSS
> lib/ethdev: check RSS key length
> ethdev: support setting and querying RSS algorithm
> net/hns3: report RSS hash algorithms capability
> app/proc-info: fix never show RSS info
> app/proc-info: adjust the display format of RSS info
> ethdev: add API to get RSS algorithm names
> app/proc-info: support querying RSS hash algorithm
> app/testpmd: add RSS hash algorithms display
>
> app/proc-info/main.c | 24 +++++---
> app/test-pmd/cmdline.c | 29 +++++++--
> app/test-pmd/config.c | 29 ++++-----
> app/test-pmd/testpmd.h | 2 +-
> doc/guides/rel_notes/release_23_11.rst | 9 +++
> drivers/net/hns3/hns3_common.c | 4 ++
> drivers/net/hns3/hns3_rss.c | 47 ++++++++-------
> lib/ethdev/rte_ethdev.c | 82 ++++++++++++++++++++++++++
> lib/ethdev/rte_ethdev.h | 79 ++++++++++++++++++++-----
> lib/ethdev/rte_flow.c | 1 -
> lib/ethdev/rte_flow.h | 25 +-------
> lib/ethdev/version.map | 1 +
> 12 files changed, 239 insertions(+), 93 deletions(-)
>
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v8 02/10] lib/ethdev: check RSS key length
2023-11-01 7:40 ` [PATCH v8 02/10] lib/ethdev: check RSS key length Jie Hai
@ 2023-11-01 10:07 ` lihuisong (C)
2023-11-01 13:19 ` Ferruh Yigit
1 sibling, 0 replies; 222+ messages in thread
From: lihuisong (C) @ 2023-11-01 10:07 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
Cc: fengchengwen, liudongdong3
在 2023/11/1 15:40, Jie Hai 写道:
> 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 <haijie1@huawei.com>
> ---
> 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) {
dev_conf->rx_adv_conf.rss_conf.rss_key_len != dev_info.hash_key_size, right?
otherwise, this isn't inconsistent with the comments in patch 1.
> + 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,
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v8 09/10] app/proc-info: support querying RSS hash algorithm
2023-11-01 7:40 ` [PATCH v8 09/10] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-11-01 10:08 ` lihuisong (C)
0 siblings, 0 replies; 222+ messages in thread
From: lihuisong (C) @ 2023-11-01 10:08 UTC (permalink / raw)
To: Jie Hai, dev, Reshma Pattan; +Cc: fengchengwen, liudongdong3
lgtm,
Acked-by: Huisong Li <lihuisong@huawei.com>
在 2023/11/1 15:40, Jie Hai 写道:
> Display RSS hash algorithm with command show-port as below.
> - RSS info
> -- hash algorithm : toeplitz
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> Acked-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
> 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
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v8 01/10] ethdev: overwrite some comment related to RSS
2023-11-01 7:40 ` [PATCH v8 01/10] ethdev: overwrite some comment related to RSS Jie Hai
@ 2023-11-01 10:09 ` lihuisong (C)
2023-11-01 13:13 ` Ferruh Yigit
1 sibling, 0 replies; 222+ messages in thread
From: lihuisong (C) @ 2023-11-01 10:09 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: fengchengwen, liudongdong3
lgtm,
Acked-by: Huisong Li <lihuisong@huawei.com>
在 2023/11/1 15:40, Jie Hai 写道:
> 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 <haijie1@huawei.com>
> ---
> 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 */
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v7 1/9] ethdev: overwrite some comment related to RSS
2023-10-28 2:41 ` lihuisong (C)
@ 2023-11-01 12:55 ` Ferruh Yigit
0 siblings, 0 replies; 222+ messages in thread
From: Ferruh Yigit @ 2023-11-01 12:55 UTC (permalink / raw)
To: lihuisong (C), Jie Hai, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam
Cc: fengchengwen, liudongdong3
On 10/28/2023 3:41 AM, lihuisong (C) wrote:
>
> 在 2023/10/28 9:46, Jie Hai 写道:
>> 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 <haijie1@huawei.com>
>> ---
>> lib/ethdev/rte_ethdev.h | 33 ++++++++++++++++++---------------
>> lib/ethdev/rte_flow.h | 1 +
>> 2 files changed, 19 insertions(+), 15 deletions(-)
>>
>> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
>> index 2fd3cd808dbf..37fd5afef48a 100644
>> --- a/lib/ethdev/rte_ethdev.h
>> +++ b/lib/ethdev/rte_ethdev.h
>> @@ -448,24 +448,27 @@ 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
>>
> Is this added the new comment?
> Suggest that the "rss_key_len" field should be equal to the
> hash_key_size from dev_info_get().
> Because many PMDs, like, hns3, i40e, ice and mlx5, check it in driver
> based on the condition that the rss_key_len field must be equal to the
> hash_key_size when the rss_key is not NULL.
> IMO, it is better that this check should be added in ethdev layer.
>
+1 to add check in ethdev layer
>> + * rte_eth_dev_info_get() API. And the *rss_key* should contain
>> at least
>> + * *rss_key_len* bytes. If not meet these requirements, the query
>> result
>
> here "rss_key_len" should be "hash_key_size", right?
>
>> + * is unreliable even the operation returns success.
> s/even/even if
>> + *
>> + * 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*. Drivers are free to ignore the
>> + * *rss_key_len* and assume key length is 40 bytes.
>>
> please modify the comment: "Drivers are free to ignore the *rss_key_len*
> and assume key length is 40 bytes. "
> Actually, most of PMDs, like, hns3, i40e, mlx, do not configure RSS hash
> key if rss_key is NULL and treat it as not updating the hash key.
>
This is not for the case where rss_key is NULL, most driver use
hardcoded 40 bytes as rss key len, so they don't check the rss_key_len,
only some drivers use not 40 bytes length, that is why above comment is
correct I think.
>> + */
>> + 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 edefa34c10da..25f1dffd1f30 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 */
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v7 2/9] ethdev: support setting and querying RSS algorithm
2023-10-28 3:01 ` lihuisong (C)
@ 2023-11-01 12:55 ` Ferruh Yigit
0 siblings, 0 replies; 222+ messages in thread
From: Ferruh Yigit @ 2023-11-01 12:55 UTC (permalink / raw)
To: lihuisong (C), Jie Hai, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam
Cc: fengchengwen, liudongdong3
On 10/28/2023 4:01 AM, lihuisong (C) wrote:
> With belows to changes,
> Acked-by: Huisong Li <lihuisong@huawei.com>
>
>
> 在 2023/10/28 9:46, Jie Hai 写道:
>> 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 <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> ---
>> doc/guides/rel_notes/release_23_11.rst | 5 ++++
>> lib/ethdev/rte_ethdev.c | 26 ++++++++++++++++++++
>> lib/ethdev/rte_ethdev.h | 33 +++++++++++++++++++++++++-
>> lib/ethdev/rte_flow.c | 1 -
>> lib/ethdev/rte_flow.h | 26 ++------------------
>> 5 files changed, 65 insertions(+), 26 deletions(-)
>>
>> diff --git a/doc/guides/rel_notes/release_23_11.rst
>> b/doc/guides/rel_notes/release_23_11.rst
>> index 0a6fc76a9d02..a35d729d2cc7 100644
>> --- a/doc/guides/rel_notes/release_23_11.rst
>> +++ b/doc/guides/rel_notes/release_23_11.rst
>> @@ -360,6 +360,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 9dabcb5ae28e..90bfbf14d1f7 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;
>> @@ -1500,6 +1501,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 ((dev_info.rss_algo_capa &
>> + RTE_ETH_HASH_ALGO_TO_CAPA(algorithm)) == 0) {
> need to check the algorithm.
> its value should be in range of 0 to 31.
>> + RTE_ETHDEV_LOG(ERR,
>> + "Ethdev port_id=%u config unsupported RSS hash algorithm:
>> %u "
>> + "with rss_algo_capa: %x\n",
> It seems that this log is not friendly to user.
> Configured RSS hash algorithm (%u) is not in the algorithm capability ().
> Anything ok like that.
>
> %x --> 0x%" PRIx32 "
>> + port_id, algorithm,
>> + dev_info.rss_algo_capa);
>> + ret = -EINVAL;
>> + goto rollback;
>> + }
>> +
>> /*
>> * Setup new number of Rx/Tx queues and reconfigure device.
>> */
>> @@ -3757,6 +3770,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;
>> @@ -4698,6 +4712,16 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
>> return -ENOTSUP;
>> }
>> + if ((dev_info.rss_algo_capa &
>> + RTE_ETH_HASH_ALGO_TO_CAPA(rss_conf->algorithm)) == 0) {
>> + RTE_ETHDEV_LOG(ERR,
>> + "Ethdev port_id=%u config unsupported RSS hash algorithm:
>> %u "
>> + "with rss_algo_capa: %x\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,
>> @@ -4725,6 +4749,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 37fd5afef48a..2f639edd8218 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.
>> @@ -469,6 +496,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. */
>> };
>> /*
>> @@ -1783,7 +1811,10 @@ struct rte_eth_dev_info {
>> /** Supported error handling mode. */
>> enum rte_eth_err_handle_mode err_handle_mode;
>> - uint64_t reserved_64s[2]; /**< Reserved for future fields */
>> + /** RSS hash algorithms capabilities */
>> + uint32_t rss_algo_capa;
>>
> Please move this new field to "hash_key_size" and
> "flow_type_rss_offloads" in this struct.
> Because this version allows ABI break.
>
Technically, even LTS release is an ABI break release, an ABI break
should be discussed, approved and documented in the deprecation.rst in
advance.
For this patch, design evolved to update "struct rte_eth_dev_info" as
discussions go on, so I think we can make an exception,
But I would like to clarify that we shouldn't just break the ABI since
it is an LTS release.
A way to prevent exception happening in the patch is conclude design and
document ABI breakage *before* LTS release cycle start.
>> +
>> + uint32_t reserved_32s[3]; /**< Reserved for future fields */
>> void *reserved_ptrs[2]; /**< Reserved for future fields */
>> };
>> diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
>> index 3a67f1aaba9d..c13a2a391c37 100644
>> --- a/lib/ethdev/rte_flow.c
>> +++ b/lib/ethdev/rte_flow.c
>> @@ -13,7 +13,6 @@
>> #include <rte_branch_prediction.h>
>> #include <rte_string_fns.h>
>> #include <rte_mbuf_dyn.h>
>> -#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 25f1dffd1f30..c94f553ae06f 100644
>> --- a/lib/ethdev/rte_flow.h
>> +++ b/lib/ethdev/rte_flow.h
>> @@ -40,6 +40,8 @@
>> #include <rte_macsec.h>
>> #include <rte_ib.h>
>> +#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
>> *
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v8 01/10] ethdev: overwrite some comment related to RSS
2023-11-01 7:40 ` [PATCH v8 01/10] ethdev: overwrite some comment related to RSS Jie Hai
2023-11-01 10:09 ` lihuisong (C)
@ 2023-11-01 13:13 ` Ferruh Yigit
2023-11-02 3:29 ` Jie Hai
1 sibling, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-11-01 13:13 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
On 11/1/2023 7:40 AM, Jie Hai wrote:
> 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 <haijie1@huawei.com>
> ---
> 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*,
>
I think it is sufficient to say "length of the *rss_key* in bytes".
> and it should
> + * be equal to *hash_key_size*.
>
I don't know if we missed something here, first driver reports key size
via 'rte_eth_dev_info_get()::hash_key_size', later other APIs require
'rss_key_len' parameter that should be same as 'hash_key_size', as
driver already know this parameter why we are requesting it back from
the application?
>> Otherwise, drivers are free to use a
> + * random or a default key or to ignore this configuration.
> + */
>
I guess above clause describes when 'rss_key' is null, can you please
clarify it as following, perhaps with a line break:
"If *rss_key* is NULL, drivers are free to use a random or a default key."
For the "Drivers are free to ignore the *rss_key_len* and assume key
length is 40 bytes." part, as checks in ethdev layer now forces
application to provide 'rss_key_len' as 'hash_key_size', I think we can
remove above, as application will provide 40 bytes when it is the case.
My concern is this check now can break some applications, because
'rss_key_len' wasn't mandatory previously, but it became now.
Overall it becomes:
"
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 and it should be equal to *hash_key_size*.
If *rss_key* is NULL, drivers are free to use a random or a default key.
"
> + 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 */
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v8 02/10] lib/ethdev: check RSS key length
2023-11-01 7:40 ` [PATCH v8 02/10] lib/ethdev: check RSS key length Jie Hai
2023-11-01 10:07 ` lihuisong (C)
@ 2023-11-01 13:19 ` Ferruh Yigit
2023-11-02 3:40 ` Jie Hai
1 sibling, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-11-01 13:19 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Andrew Rybchenko
Cc: lihuisong, fengchengwen, liudongdong3
On 11/1/2023 7:40 AM, Jie Hai wrote:
> 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.
>
Can you please squash this patch and previous one, previous one
clarifies the API and this one adds relevant checks, so they con be in
some patch.
Can you also please update release notes, 'API Changes', explaining
'rss_conf.rss_key_len' needs to be provided by user for the case
"conf.rss_key != NULL", it won't be taken as default 40 bytes anymore.
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> 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) {
>
Why check is "rss_key_len < dev_info.hash_key_size", is it allowed to
have "rss_key_len > dev_info.hash_key_size"?
Shouldn't it enforce that "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,
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v8 03/10] ethdev: support setting and querying RSS algorithm
2023-11-01 7:40 ` [PATCH v8 03/10] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-11-01 13:36 ` Ferruh Yigit
2023-11-02 6:58 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-11-01 13:36 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
On 11/1/2023 7:40 AM, Jie Hai wrote:
> 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 <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> Acked-by: Huisong Li <lihuisong@huawei.com>
> ---
> 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.
>
As well as ABI change, can you also update the "New Features", to
document getting hash algorithm capability and setting hash algorithm
support added?
Also please add an empty line here.
> 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 ||
>
"RTE_ETH_HASH_ALGO_TO_CAPA(algorithm)" can't be zero for valid "enum
rte_eth_hash_function" values, I assume above check is for the case
algorith > 31, as it will result zero.
My concern is, this is undefined behaviour (shift left >= 32) and some
compiler can complain about it, instead of relying this can you please
add explicit "0 <= algorithm < 32" check?
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v8 10/10] app/testpmd: add RSS hash algorithms display
2023-11-01 7:40 ` [PATCH v8 10/10] app/testpmd: add RSS hash algorithms display Jie Hai
@ 2023-11-01 13:42 ` Ferruh Yigit
2023-11-02 7:33 ` Jie Hai
0 siblings, 1 reply; 222+ messages in thread
From: Ferruh Yigit @ 2023-11-01 13:42 UTC (permalink / raw)
To: Jie Hai, dev, Aman Singh, Yuying Zhang
Cc: lihuisong, fengchengwen, liudongdong3
On 11/1/2023 7:40 AM, Jie Hai wrote:
> 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 <haijie1@huawei.com>
> Acked-by: Huisong Li <lihuisong@huawei.com>
> ---
> app/test-pmd/cmdline.c | 29 ++++++++++++++++++++++++-----
> app/test-pmd/config.c | 29 ++++++++++-------------------
> app/test-pmd/testpmd.h | 2 +-
>
Can you please update testpmd documentation,
'doc/guides/testpmd_app_ug/testpmd_funcs.rst', too?
<...>
> 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));
>
Above modification can be moved to the patch that adds
'rte_eth_dev_rss_algo_name()'.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v8 01/10] ethdev: overwrite some comment related to RSS
2023-11-01 13:13 ` Ferruh Yigit
@ 2023-11-02 3:29 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-02 3:29 UTC (permalink / raw)
To: Ferruh Yigit, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
On 2023/11/1 21:13, Ferruh Yigit wrote:
> On 11/1/2023 7:40 AM, Jie Hai wrote:
>> 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 <haijie1@huawei.com>
>> ---
>> 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*,
>>
>
> I think it is sufficient to say "length of the *rss_key* in bytes".
>
>
>> and it should
>> + * be equal to *hash_key_size*.
>>
>
> I don't know if we missed something here, first driver reports key size
> via 'rte_eth_dev_info_get()::hash_key_size', later other APIs require
> 'rss_key_len' parameter that should be same as 'hash_key_size', as
> driver already know this parameter why we are requesting it back from
> the application?
>
To unify user behavior and verify user behavior at the ethdev level.
>
>>> Otherwise, drivers are free to use a
>> + * random or a default key or to ignore this configuration.
>> + */
>>
>
>
> I guess above clause describes when 'rss_key' is null, can you please
> clarify it as following, perhaps with a line break:
> "If *rss_key* is NULL, drivers are free to use a random or a default key."
>
>
> For the "Drivers are free to ignore the *rss_key_len* and assume key
> length is 40 bytes." part, as checks in ethdev layer now forces
> application to provide 'rss_key_len' as 'hash_key_size', I think we can
> remove above, as application will provide 40 bytes when it is the case.
>
> My concern is this check now can break some applications, because
> 'rss_key_len' wasn't mandatory previously, but it became now.
>
The testpmd already use 'rte_eth_dev_info_get()::hash_key_size' to
correct the rss_key_len.
If hash_key_size is zero or too big for user's rss_key, it report errors.
Otherwise, it use hash_key_size as rss_key_len.
If all drivers use this app to test rss configuration, the check has no
problem.
The test_link_bonding_rssconf use 40 Bytes rss_key, we know that is
valid for now.
>
> Overall it becomes:
> "
> 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 and it should be equal to *hash_key_size*.
> If *rss_key* is NULL, drivers are free to use a random or a default key.
> "
>
ok, thanks.
>
>
>> + 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 */
>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v8 02/10] lib/ethdev: check RSS key length
2023-11-01 13:19 ` Ferruh Yigit
@ 2023-11-02 3:40 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-02 3:40 UTC (permalink / raw)
To: Ferruh Yigit, dev, Thomas Monjalon, Andrew Rybchenko
Cc: lihuisong, fengchengwen, liudongdong3
On 2023/11/1 21:19, Ferruh Yigit wrote:
> On 11/1/2023 7:40 AM, Jie Hai wrote:
>> 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.
>>
>
> Can you please squash this patch and previous one, previous one
> clarifies the API and this one adds relevant checks, so they con be in
> some patch.
>
> Can you also please update release notes, 'API Changes', explaining
> 'rss_conf.rss_key_len' needs to be provided by user for the case
> "conf.rss_key != NULL", it won't be taken as default 40 bytes anymore.
>
Thanks.
Will update.
>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> ---
>> 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) {
>>
>
> Why check is "rss_key_len < dev_info.hash_key_size", is it allowed to
> have "rss_key_len > dev_info.hash_key_size"?
>
> Shouldn't it enforce that "rss_key_len == dev_info.hash_key_size"?
>
>
Yes, should be equal, will correct.
>> + 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,
>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v8 03/10] ethdev: support setting and querying RSS algorithm
2023-11-01 13:36 ` Ferruh Yigit
@ 2023-11-02 6:58 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-02 6:58 UTC (permalink / raw)
To: Ferruh Yigit, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
On 2023/11/1 21:36, Ferruh Yigit wrote:
> On 11/1/2023 7:40 AM, Jie Hai wrote:
>> 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 <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> Acked-by: Huisong Li <lihuisong@huawei.com>
>> ---
>> 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.
>>
>
> As well as ABI change, can you also update the "New Features", to
> document getting hash algorithm capability and setting hash algorithm
> support added?
>
> Also please add an empty line here.
thanks,will add.
>
>> 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 ||
>>
>
> "RTE_ETH_HASH_ALGO_TO_CAPA(algorithm)" can't be zero for valid "enum
> rte_eth_hash_function" values, I assume above check is for the case
> algorith > 31, as it will result zero.
> My concern is, this is undefined behaviour (shift left >= 32) and some
> compiler can complain about it, instead of relying this can you please
> add explicit "0 <= algorithm < 32" check?
yes, how about associate with "rss_algo_capa"?
+ if (algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||
+ (dev_info.rss_algo_capa &
RTE_ETH_HASH_ALGO_TO_CAPA(algorithm)) == 0) {
>
>
>
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v8 10/10] app/testpmd: add RSS hash algorithms display
2023-11-01 13:42 ` Ferruh Yigit
@ 2023-11-02 7:33 ` Jie Hai
0 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-02 7:33 UTC (permalink / raw)
To: Ferruh Yigit, dev, Aman Singh, Yuying Zhang
Cc: lihuisong, fengchengwen, liudongdong3
On 2023/11/1 21:42, Ferruh Yigit wrote:
> On 11/1/2023 7:40 AM, Jie Hai wrote:
>> 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 <haijie1@huawei.com>
>> Acked-by: Huisong Li <lihuisong@huawei.com>
>> ---
>> app/test-pmd/cmdline.c | 29 ++++++++++++++++++++++++-----
>> app/test-pmd/config.c | 29 ++++++++++-------------------
>> app/test-pmd/testpmd.h | 2 +-
>>
>
> Can you please update testpmd documentation,
> 'doc/guides/testpmd_app_ug/testpmd_funcs.rst', too?
>
> <...>
Thanks, will add.
>
>> 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));
>>
>
>
> Above modification can be moved to the patch that adds
> 'rte_eth_dev_rss_algo_name()'.
>
Thanks, will move.
> .
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v9 0/9] support setting and querying RSS algorithms
2023-03-15 11:00 [PATCH 0/5] support setting and querying RSS algorithms Dongdong Liu
` (6 preceding siblings ...)
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
@ 2023-11-02 8:20 ` Jie Hai
2023-11-02 8:20 ` [PATCH v9 1/9] ethdev: overwrite some comment related to RSS Jie Hai
` (9 more replies)
7 siblings, 10 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-02 8:20 UTC (permalink / raw)
To: dev; +Cc: lihuisong, fengchengwen, liudongdong3
This patchset is to support setting and querying RSS algorithms.
For this purpose, field "rss_algo_capa" is added to ``rte_eth_dev_info``
and field "algorithm" is added to ``rte_eth_rss_conf``.
The drivers should reports their "rss_algo_capa" if they support
updating RSS algorithms. Otherwise, the "rss_algo_capa" is set to
RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT). The app configures RSS algorithms
by field "algorithm" and the related API should verify "algorithm" with
"rss_algo_capa".
--
v9:
1. rewrite some comments.
2. modify check on rss_key_len and move it to patch 1.
3. add API change for rss_key_len.
4. add NEW Feature for RSS.
5. move modification on rss_config_display to patch 7/9.
6. update testpmd documentation.
7. add acked-bys.
v8:
1. rewrite some comments.
2. add check for rss_key_len in ethdev level.
3. add Acked-by: Huisong Li <lihuisong@huawei.com>.
4. fix log on RSS hash algorithm.
5. add rte_eth_dev_rss_algo_name to lib/ethdev/version.map.
6. fix RSS algorithm display on testpmd.
v7:
1. fix compile error.
2. add signed-off-by to patch[4/9].
v6:
1. rewrite some comments.
2. add "rss_algo_capa" for `rte_eth_dev_info``.
3. add new API to get name of RSS algorithms
v5:
1. rewrite some comments.
2. check RSS algorithm for drivers supporting RSS.
3. change field "func" of rss_conf to "algorithm".
4. fix commit log for [PATCH v4 4/7].
5. add Acked-by Reshma Pattan.
6. add symmetric_toeplitz_sort for showing.
7. change "hf" to "hash function" for showing.
v4:
1. recomment some definitions related to RSS.
2. allocate static memory for rss_key instead of dynamic.
3. use array of strings to get the name of rss algorithm.
4. add display of rss algorithm with testpmd.
v3:
1. fix commit log for PATCH [1/5].
2. make RSS ABI changes description to start the actual text at the margin.
3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
4. fix some comment codes.
v2:
1. return error if "func" is invalid.
2. modify the comments of the "func" field.
3. modify commit log of patch [3/5].
4. use malloc instead of rte_malloc.
5. adjust display format of RSS info.
6. remove the string display of rss_hf.
Huisong Li (1):
net/hns3: support setting and querying RSS hash function
Jie Hai (8):
ethdev: overwrite some comment related to RSS
ethdev: support setting and querying RSS algorithm
net/hns3: report RSS hash algorithms capability
app/proc-info: fix never show RSS info
app/proc-info: adjust the display format of RSS info
ethdev: add API to get RSS algorithm names
app/proc-info: support querying RSS hash algorithm
app/testpmd: add RSS hash algorithms display
app/proc-info/main.c | 24 +++---
app/test-pmd/cmdline.c | 29 ++++++--
app/test-pmd/config.c | 29 +++-----
app/test-pmd/testpmd.h | 2 +-
doc/guides/rel_notes/release_23_11.rst | 22 ++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 +-
drivers/net/hns3/hns3_common.c | 4 +
drivers/net/hns3/hns3_rss.c | 47 +++++++-----
lib/ethdev/rte_ethdev.c | 81 +++++++++++++++++++++
lib/ethdev/rte_ethdev.h | 78 ++++++++++++++++----
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 25 +------
lib/ethdev/version.map | 1 +
13 files changed, 252 insertions(+), 95 deletions(-)
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v9 1/9] ethdev: overwrite some comment related to RSS
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
@ 2023-11-02 8:20 ` Jie Hai
2023-11-06 10:57 ` Andrew Rybchenko
2023-11-02 8:20 ` [PATCH v9 2/9] ethdev: support setting and querying RSS algorithm Jie Hai
` (8 subsequent siblings)
9 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-11-02 8:20 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
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 overwrites the comments of fields of "rte_eth_rss_conf"
and "RTE_ETH_HASH_FUNCTION_DEFAULT", checks "rss_key_len" in
ethdev level, and documents these changes.
Signed-off-by: Jie Hai <haijie1@huawei.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
doc/guides/rel_notes/release_23_11.rst | 4 ++++
lib/ethdev/rte_ethdev.c | 31 ++++++++++++++++++++++++
lib/ethdev/rte_ethdev.h | 33 ++++++++++++++------------
lib/ethdev/rte_flow.h | 1 +
4 files changed, 54 insertions(+), 15 deletions(-)
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 95db98d098d8..0b67f31dc385 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -345,6 +345,10 @@ API Changes
Updated ``rte_ml_op``, ``rte_ml_io_quantize`` and ``rte_ml_io_dequantize``
to support an array of ``rte_ml_buff_seg``.
+* ethdev: When ``rte_eth_dev_configure`` or ``rte_eth_dev_rss_hash_update`` are
+ called, the ``rss_key_len`` of structure ``rte_eth_rss_conf`` should be provided
+ by user for the case ``rss_key != NULL``, it won't be taken as default 40
+ bytes anymore.
ABI Changes
-----------
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index af23ac0ad00f..6727aca12dce 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,
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index a53dd5a1efec..fb1a1f89c67f 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -448,24 +448,27 @@ 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 and it should be equal to *hash_key_size*.
+ * If *rss_key* is NULL, drivers are free to use a random or a default key.
+ */
+ 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 */
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v9 2/9] ethdev: support setting and querying RSS algorithm
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
2023-11-02 8:20 ` [PATCH v9 1/9] ethdev: overwrite some comment related to RSS Jie Hai
@ 2023-11-02 8:20 ` Jie Hai
2023-11-03 15:52 ` Ferruh Yigit
2023-11-02 8:20 ` [PATCH v9 3/9] net/hns3: report RSS hash algorithms capability Jie Hai
` (7 subsequent siblings)
9 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-11-02 8:20 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
doc/guides/rel_notes/release_23_11.rst | 13 ++++++++++++
lib/ethdev/rte_ethdev.c | 25 ++++++++++++++++++++++
lib/ethdev/rte_ethdev.h | 29 ++++++++++++++++++++++++++
lib/ethdev/rte_flow.c | 1 -
lib/ethdev/rte_flow.h | 26 ++---------------------
5 files changed, 69 insertions(+), 25 deletions(-)
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 0b67f31dc385..20556b8a17ce 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -122,6 +122,13 @@ 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 support for RSS hash algorithm.**
+
+ * Added new field ``rss_algo_capa`` to ``rte_eth_dev_info`` structure for
+ reporting RSS hash algorithm capability that drivers support.
+ * Added new field ``algorithm`` to ``rte_eth_rss_conf`` structure for RSS
+ hash algorithm querying and configuring.
+
* **Updated Amazon ena (Elastic Network Adapter) net driver.**
* Upgraded ENA HAL to latest version.
@@ -376,6 +383,12 @@ 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 6727aca12dce..36d8deef90c5 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,17 @@ 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 (algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||
+ (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 +3779,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 +4729,16 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
return -EINVAL;
}
+ if (rss_conf->algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||
+ (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 +4779,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 fb1a1f89c67f..37d8ef694523 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.
@@ -469,6 +496,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. */
};
/*
@@ -1749,6 +1777,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 20ee8430eaec..549e3295584c 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -13,7 +13,6 @@
#include <rte_branch_prediction.h>
#include <rte_string_fns.h>
#include <rte_mbuf_dyn.h>
-#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 <rte_macsec.h>
#include <rte_ib.h>
+#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
*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v9 3/9] net/hns3: report RSS hash algorithms capability
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
2023-11-02 8:20 ` [PATCH v9 1/9] ethdev: overwrite some comment related to RSS Jie Hai
2023-11-02 8:20 ` [PATCH v9 2/9] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-11-02 8:20 ` Jie Hai
2023-11-02 8:20 ` [PATCH v9 4/9] net/hns3: support setting and querying RSS hash function Jie Hai
` (6 subsequent siblings)
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-02 8:20 UTC (permalink / raw)
To: dev, Yisen Zhuang; +Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
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 9327adbdc113..ff205426fab8 100644
--- a/drivers/net/hns3/hns3_common.c
+++ b/drivers/net/hns3/hns3_common.c
@@ -133,6 +133,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;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v9 4/9] net/hns3: support setting and querying RSS hash function
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
` (2 preceding siblings ...)
2023-11-02 8:20 ` [PATCH v9 3/9] net/hns3: report RSS hash algorithms capability Jie Hai
@ 2023-11-02 8:20 ` Jie Hai
2023-11-02 8:20 ` [PATCH v9 5/9] app/proc-info: fix never show RSS info Jie Hai
` (5 subsequent siblings)
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-02 8:20 UTC (permalink / raw)
To: dev, Yisen Zhuang; +Cc: lihuisong, fengchengwen, liudongdong3
From: Huisong Li <lihuisong@huawei.com>
Support setting and querying RSS hash function by ethdev ops.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Signed-off-by: Jie Hai <haijie1@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
| 47 +++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 20 deletions(-)
--git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c
index eeeca71a5c1a..15feb26043af 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 = 0;
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;
}
/*
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v9 5/9] app/proc-info: fix never show RSS info
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
` (3 preceding siblings ...)
2023-11-02 8:20 ` [PATCH v9 4/9] net/hns3: support setting and querying RSS hash function Jie Hai
@ 2023-11-02 8:20 ` Jie Hai
2023-11-02 8:20 ` [PATCH v9 6/9] app/proc-info: adjust the display format of " Jie Hai
` (4 subsequent siblings)
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-02 8:20 UTC (permalink / raw)
To: dev, Reshma Pattan, John McNamara, Vipin Varghese
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
---
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
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v9 6/9] app/proc-info: adjust the display format of RSS info
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
` (4 preceding siblings ...)
2023-11-02 8:20 ` [PATCH v9 5/9] app/proc-info: fix never show RSS info Jie Hai
@ 2023-11-02 8:20 ` Jie Hai
2023-11-02 8:20 ` [PATCH v9 7/9] ethdev: add API to get RSS algorithm names Jie Hai
` (3 subsequent siblings)
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-02 8:20 UTC (permalink / raw)
To: dev, Reshma Pattan, John McNamara, Vipin Varghese
Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan<reshma.pattan@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
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);
}
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v9 7/9] ethdev: add API to get RSS algorithm names
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
` (5 preceding siblings ...)
2023-11-02 8:20 ` [PATCH v9 6/9] app/proc-info: adjust the display format of " Jie Hai
@ 2023-11-02 8:20 ` Jie Hai
2023-11-06 10:43 ` Andrew Rybchenko
2023-11-02 8:20 ` [PATCH v9 8/9] app/proc-info: support querying RSS hash algorithm Jie Hai
` (2 subsequent siblings)
9 siblings, 1 reply; 222+ messages in thread
From: Jie Hai @ 2023-11-02 8:20 UTC (permalink / raw)
To: dev, Aman Singh, Yuying Zhang, Thomas Monjalon, Ferruh Yigit,
Andrew Rybchenko
Cc: lihuisong, fengchengwen, liudongdong3
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>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
app/test-pmd/config.c | 19 +------------------
doc/guides/rel_notes/release_23_11.rst | 5 +++++
lib/ethdev/rte_ethdev.c | 25 +++++++++++++++++++++++++
lib/ethdev/rte_ethdev.h | 16 ++++++++++++++++
lib/ethdev/version.map | 1 +
5 files changed, 48 insertions(+), 18 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index b9fdb7e8f162..a3e32aa852d8 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) {
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 20556b8a17ce..e40429a2f853 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -129,6 +129,11 @@ New Features
* Added new field ``algorithm`` to ``rte_eth_rss_conf`` structure for RSS
hash algorithm querying and configuring.
+* **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 36d8deef90c5..33636529eb12 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)
{
@@ -4791,6 +4802,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 37d8ef694523..2042c19bca81 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -4643,6 +4643,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;
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v9 8/9] app/proc-info: support querying RSS hash algorithm
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
` (6 preceding siblings ...)
2023-11-02 8:20 ` [PATCH v9 7/9] ethdev: add API to get RSS algorithm names Jie Hai
@ 2023-11-02 8:20 ` Jie Hai
2023-11-02 8:20 ` [PATCH v9 9/9] app/testpmd: add RSS hash algorithms display Jie Hai
2023-11-02 13:11 ` [PATCH v9 0/9] support setting and querying RSS algorithms Ferruh Yigit
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-02 8:20 UTC (permalink / raw)
To: dev, Reshma Pattan; +Cc: lihuisong, fengchengwen, liudongdong3
Display RSS hash algorithm with command show-port as below.
- RSS info
-- hash algorithm : toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
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
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* [PATCH v9 9/9] app/testpmd: add RSS hash algorithms display
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
` (7 preceding siblings ...)
2023-11-02 8:20 ` [PATCH v9 8/9] app/proc-info: support querying RSS hash algorithm Jie Hai
@ 2023-11-02 8:20 ` Jie Hai
2023-11-02 13:11 ` [PATCH v9 0/9] support setting and querying RSS algorithms Ferruh Yigit
9 siblings, 0 replies; 222+ messages in thread
From: Jie Hai @ 2023-11-02 8:20 UTC (permalink / raw)
To: dev, Aman Singh, Yuying Zhang; +Cc: lihuisong, fengchengwen, liudongdong3
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 <haijie1@huawei.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
app/test-pmd/cmdline.c | 29 +++++++++++++++++----
app/test-pmd/config.c | 10 ++++++-
app/test-pmd/testpmd.h | 2 +-
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 +--
4 files changed, 36 insertions(+), 9 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 <port_id> 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 <port_id> 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 a3e32aa852d8..23fb4f8aa781 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -4469,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];
@@ -4519,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);
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 3d242c85345f..b51e459998b0 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -235,9 +235,9 @@ size is used to indicate the hardware supported reta size
show port rss-hash
~~~~~~~~~~~~~~~~~~
-Display the RSS hash functions and RSS hash key of a port::
+Display the RSS hash functions and RSS hash key or RSS hash algorithm of a port::
- testpmd> show port (port_id) rss-hash [key]
+ testpmd> show port (port_id) rss-hash [key | algorithm]
clear port
~~~~~~~~~~
--
2.30.0
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v9 0/9] support setting and querying RSS algorithms
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
` (8 preceding siblings ...)
2023-11-02 8:20 ` [PATCH v9 9/9] app/testpmd: add RSS hash algorithms display Jie Hai
@ 2023-11-02 13:11 ` Ferruh Yigit
9 siblings, 0 replies; 222+ messages in thread
From: Ferruh Yigit @ 2023-11-02 13:11 UTC (permalink / raw)
To: Jie Hai, dev; +Cc: lihuisong, fengchengwen, liudongdong3
On 11/2/2023 8:20 AM, Jie Hai wrote:
> This patchset is to support setting and querying RSS algorithms.
> For this purpose, field "rss_algo_capa" is added to ``rte_eth_dev_info``
> and field "algorithm" is added to ``rte_eth_rss_conf``.
> The drivers should reports their "rss_algo_capa" if they support
> updating RSS algorithms. Otherwise, the "rss_algo_capa" is set to
> RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT). The app configures RSS algorithms
> by field "algorithm" and the related API should verify "algorithm" with
> "rss_algo_capa".
>
> --
> v9:
> 1. rewrite some comments.
> 2. modify check on rss_key_len and move it to patch 1.
> 3. add API change for rss_key_len.
> 4. add NEW Feature for RSS.
> 5. move modification on rss_config_display to patch 7/9.
> 6. update testpmd documentation.
> 7. add acked-bys.
>
> v8:
> 1. rewrite some comments.
> 2. add check for rss_key_len in ethdev level.
> 3. add Acked-by: Huisong Li <lihuisong@huawei.com>.
> 4. fix log on RSS hash algorithm.
> 5. add rte_eth_dev_rss_algo_name to lib/ethdev/version.map.
> 6. fix RSS algorithm display on testpmd.
>
> v7:
> 1. fix compile error.
> 2. add signed-off-by to patch[4/9].
> v6:
> 1. rewrite some comments.
> 2. add "rss_algo_capa" for `rte_eth_dev_info``.
> 3. add new API to get name of RSS algorithms
>
> v5:
> 1. rewrite some comments.
> 2. check RSS algorithm for drivers supporting RSS.
> 3. change field "func" of rss_conf to "algorithm".
> 4. fix commit log for [PATCH v4 4/7].
> 5. add Acked-by Reshma Pattan.
> 6. add symmetric_toeplitz_sort for showing.
> 7. change "hf" to "hash function" for showing.
>
> v4:
> 1. recomment some definitions related to RSS.
> 2. allocate static memory for rss_key instead of dynamic.
> 3. use array of strings to get the name of rss algorithm.
> 4. add display of rss algorithm with testpmd.
>
> v3:
> 1. fix commit log for PATCH [1/5].
> 2. make RSS ABI changes description to start the actual text at the margin.
> 3. move defnition of enum rte_eth_hash_function to rte_ethdev.h.
> 4. fix some comment codes.
>
> v2:
> 1. return error if "func" is invalid.
> 2. modify the comments of the "func" field.
> 3. modify commit log of patch [3/5].
> 4. use malloc instead of rte_malloc.
> 5. adjust display format of RSS info.
> 6. remove the string display of rss_hf.
>
> Huisong Li (1):
> net/hns3: support setting and querying RSS hash function
>
> Jie Hai (8):
> ethdev: overwrite some comment related to RSS
> ethdev: support setting and querying RSS algorithm
> net/hns3: report RSS hash algorithms capability
> app/proc-info: fix never show RSS info
> app/proc-info: adjust the display format of RSS info
> ethdev: add API to get RSS algorithm names
> app/proc-info: support querying RSS hash algorithm
> app/testpmd: add RSS hash algorithms display
>
>
For series,
Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
Series applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v9 2/9] ethdev: support setting and querying RSS algorithm
2023-11-02 8:20 ` [PATCH v9 2/9] ethdev: support setting and querying RSS algorithm Jie Hai
@ 2023-11-03 15:52 ` Ferruh Yigit
0 siblings, 0 replies; 222+ messages in thread
From: Ferruh Yigit @ 2023-11-03 15:52 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Andrew Rybchenko, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
On 11/2/2023 8:20 AM, Jie Hai wrote:
> 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 <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> Acked-by: Huisong Li <lihuisong@huawei.com>
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
<...>
> --- 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,17 @@ 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 (algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||
>
This cause build error [1] on Windows Server 2019 [2], will fix in
next-net [3].
[1]
../lib/ethdev/rte_ethdev.c:1526:16: error: comparison of integers of
different signs: 'enum rte_eth_hash_function' and 'unsigned long long'
[-Werror,-Wsign-compare]
if (algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||
~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/ethdev/rte_ethdev.c:4743:26: error: comparison of integers of
different signs: 'enum rte_eth_hash_function' and 'unsigned long long'
[-Werror,-Wsign-compare]
if (rss_conf->algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||
~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2]
https://mails.dpdk.org/archives/test-report/2023-November/499757.html
[3]
@@ -1523,7 +1523,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t
nb_rx_q, uint16_t nb_tx_q,
}
algorithm = dev_conf->rx_adv_conf.rss_conf.algorithm;
- if (algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||
+ if ((size_t)algorithm >= CHAR_BIT *
sizeof(dev_info.rss_algo_capa) ||
(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)"
@@ -4748,7 +4748,7 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
return -EINVAL;
}
- if (rss_conf->algorithm >= CHAR_BIT *
sizeof(dev_info.rss_algo_capa) ||
+ if ((size_t)rss_conf->algorithm >= CHAR_BIT *
sizeof(dev_info.rss_algo_capa) ||
(dev_info.rss_algo_capa &
RTE_ETH_HASH_ALGO_TO_CAPA(rss_conf->algorithm)) == 0) {
RTE_ETHDEV_LOG(ERR,
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v9 7/9] ethdev: add API to get RSS algorithm names
2023-11-02 8:20 ` [PATCH v9 7/9] ethdev: add API to get RSS algorithm names Jie Hai
@ 2023-11-06 10:43 ` Andrew Rybchenko
0 siblings, 0 replies; 222+ messages in thread
From: Andrew Rybchenko @ 2023-11-06 10:43 UTC (permalink / raw)
To: Jie Hai, dev, Aman Singh, Yuying Zhang, Thomas Monjalon, Ferruh Yigit
Cc: lihuisong, fengchengwen, liudongdong3
On 11/2/23 11:20, Jie Hai wrote:
> 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>
> Acked-by: Huisong Li <lihuisong@huawei.com>
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
<snip>
> @@ -4791,6 +4802,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;
My 2c:
IMHO, usage of name variable here just complicate reading and forces
reader to find out which value 'name' has here. Just return
"Unknown function".
^ permalink raw reply [flat|nested] 222+ messages in thread
* Re: [PATCH v9 1/9] ethdev: overwrite some comment related to RSS
2023-11-02 8:20 ` [PATCH v9 1/9] ethdev: overwrite some comment related to RSS Jie Hai
@ 2023-11-06 10:57 ` Andrew Rybchenko
0 siblings, 0 replies; 222+ messages in thread
From: Andrew Rybchenko @ 2023-11-06 10:57 UTC (permalink / raw)
To: Jie Hai, dev, Thomas Monjalon, Ferruh Yigit, Ori Kam
Cc: lihuisong, fengchengwen, liudongdong3
On 11/2/23 11:20, Jie Hai wrote:
> 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 overwrites the comments of fields of "rte_eth_rss_conf"
> and "RTE_ETH_HASH_FUNCTION_DEFAULT", checks "rss_key_len" in
> ethdev level, and documents these changes.
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Acked-by: Huisong Li <lihuisong@huawei.com>
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
<snip>
> @@ -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 };
There is no poiint to init dev_info here. Get functoin does it anyway.
^ permalink raw reply [flat|nested] 222+ messages in thread
end of thread, other threads:[~2023-11-06 10:57 UTC | newest]
Thread overview: 222+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 11:00 [PATCH 0/5] support setting and querying RSS algorithms Dongdong Liu
2023-03-15 11:00 ` [PATCH 1/5] ethdev: support setting and querying rss algorithm Dongdong Liu
2023-03-15 11:28 ` Ivan Malov
2023-03-16 13:10 ` Dongdong Liu
2023-03-16 14:31 ` Ivan Malov
2023-03-15 13:43 ` Thomas Monjalon
2023-03-16 13:16 ` Dongdong Liu
2023-06-02 20:19 ` Ferruh Yigit
2023-06-05 12:34 ` Dongdong Liu
2023-03-15 11:00 ` [PATCH 2/5] net/hns3: support setting and querying RSS hash function Dongdong Liu
2023-03-15 11:00 ` [PATCH 3/5] app/proc-info: fix never show RSS info Dongdong Liu
2023-06-02 20:19 ` Ferruh Yigit
2023-06-05 13:04 ` Dongdong Liu
2023-06-02 21:19 ` Stephen Hemminger
2023-06-05 13:07 ` Dongdong Liu
2023-03-15 11:00 ` [PATCH 4/5] app/proc-info: show RSS types with strings Dongdong Liu
2023-06-02 20:22 ` Ferruh Yigit
2023-06-05 13:12 ` Dongdong Liu
2023-03-15 11:00 ` [PATCH 5/5] app/proc-info: support querying RSS hash algorithm Dongdong Liu
2023-08-26 7:46 ` [PATCH v2 0/5] support setting and querying RSS algorithms Jie Hai
2023-08-26 7:46 ` [PATCH v2 1/5] ethdev: support setting and querying RSS algorithm Jie Hai
2023-08-30 11:46 ` Thomas Monjalon
2023-08-31 0:10 ` Ajit Khaparde
2023-08-31 10:59 ` Jie Hai
2023-09-04 6:26 ` Jie Hai
2023-09-05 16:17 ` Ajit Khaparde
2023-09-04 7:10 ` Jie Hai
2023-09-04 7:45 ` Thomas Monjalon
2023-09-08 8:44 ` Jie Hai
2023-09-09 0:01 ` Ajit Khaparde
2023-09-11 10:09 ` Thomas Monjalon
2023-09-11 16:11 ` Ajit Khaparde
2023-09-06 15:10 ` Stephen Hemminger
2023-09-08 9:28 ` Jie Hai
2023-09-08 20:58 ` Stephen Hemminger
2023-09-12 1:49 ` Jie Hai
2023-08-26 7:46 ` [PATCH v2 2/5] net/hns3: support setting and querying RSS hash function Jie Hai
2023-08-26 7:46 ` [PATCH v2 3/5] app/proc-info: fix never show RSS info Jie Hai
2023-08-26 7:46 ` [PATCH v2 4/5] app/proc-info: adjust the display format of " Jie Hai
2023-08-26 7:46 ` [PATCH v2 5/5] app/proc-info: support querying RSS hash algorithm Jie Hai
2023-09-04 6:10 ` [PATCH v3 0/5] support setting and querying RSS algorithms Jie Hai
2023-09-04 6:10 ` [PATCH v3 1/5] app/proc-info: fix never show RSS info Jie Hai
2023-09-04 6:10 ` [PATCH v3 2/5] app/proc-info: adjust the display format of " Jie Hai
2023-09-04 6:10 ` [PATCH v3 3/5] app/proc-info: support querying RSS hash algorithm Jie Hai
2023-09-04 6:10 ` [PATCH v3 4/5] app/testpmd: add RSS hash algorithms display Jie Hai
2023-09-04 6:10 ` [PATCH v3 5/5] app/testpmd: add RSS hash algorithms setting Jie Hai
2023-09-04 7:37 ` [PATCH v3 0/5] support setting and querying RSS algorithms Jie Hai
2023-09-04 7:28 ` [PATCH " Jie Hai
2023-09-04 7:28 ` [PATCH 1/5] ethdev: support setting and querying RSS algorithm Jie Hai
2023-09-04 7:28 ` [PATCH 2/5] net/hns3: support setting and querying RSS hash function Jie Hai
2023-09-04 7:28 ` [PATCH 3/5] app/proc-info: fix never show RSS info Jie Hai
2023-09-05 16:29 ` Pattan, Reshma
2023-09-08 8:01 ` Jie Hai
2023-09-04 7:28 ` [PATCH 4/5] app/proc-info: adjust the display format of " Jie Hai
2023-09-04 7:28 ` [PATCH 5/5] app/proc-info: support querying RSS hash algorithm Jie Hai
2023-09-05 17:07 ` Pattan, Reshma
2023-09-08 8:01 ` Jie Hai
2023-09-08 8:00 ` [PATCH v4 0/7] support setting and querying RSS algorithms Jie Hai
2023-09-08 8:00 ` [PATCH v4 1/7] ethdev: recomment some definitions related to RSS Jie Hai
2023-09-20 16:39 ` Ferruh Yigit
2023-09-26 12:08 ` Jie Hai
2023-09-08 8:00 ` [PATCH v4 2/7] ethdev: support setting and querying RSS algorithm Jie Hai
2023-09-20 16:39 ` Ferruh Yigit
2023-09-20 17:15 ` Ajit Khaparde
2023-09-26 13:23 ` Jie Hai
2023-09-08 8:00 ` [PATCH v4 3/7] net/hns3: support setting and querying RSS hash function Jie Hai
2023-09-08 8:00 ` [PATCH v4 4/7] app/proc-info: fix never show RSS info Jie Hai
2023-09-13 11:48 ` Pattan, Reshma
2023-09-25 1:13 ` Jie Hai
2023-09-08 8:00 ` [PATCH v4 5/7] app/proc-info: adjust the display format of " Jie Hai
2023-09-13 12:22 ` Pattan, Reshma
2023-09-08 8:00 ` [PATCH v4 6/7] app/proc-info: support querying RSS hash algorithm Jie Hai
2023-09-13 11:42 ` Pattan, Reshma
2023-09-13 11:44 ` Pattan, Reshma
2023-09-08 8:00 ` [PATCH v4 7/7] app/testpmd: add RSS hash algorithms display Jie Hai
2023-10-11 9:27 ` [PATCH v5 00/40] support setting and querying RSS algorithms Jie Hai
2023-10-11 9:27 ` [PATCH v5 01/40] ethdev: overwrite some comment related to RSS Jie Hai
2023-10-11 16:31 ` Ferruh Yigit
2023-10-12 2:03 ` Jie Hai
2023-10-12 2:47 ` fengchengwen
2023-10-11 9:27 ` [PATCH v5 02/40] ethdev: support setting and querying RSS algorithm Jie Hai
2023-10-11 17:39 ` Stephen Hemminger
2023-10-12 2:21 ` fengchengwen
2023-10-12 15:23 ` Stephen Hemminger
2023-10-24 12:54 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 03/40] net/atlantic: check RSS hash algorithms Jie Hai
2023-10-11 9:27 ` [PATCH v5 04/40] net/axgbe: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 05/40] net/bnx2x: " Jie Hai
2023-10-11 17:02 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 06/40] net/bnxt: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 07/40] net/bonding: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 08/40] net/cnxk: " Jie Hai
2023-10-11 17:04 ` Ferruh Yigit
2023-10-12 2:25 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 09/40] net/cpfl: " Jie Hai
2023-10-11 17:20 ` Ferruh Yigit
2023-10-12 2:34 ` Xing, Beilei
2023-10-11 9:27 ` [PATCH v5 10/40] net/cxgbe: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 11/40] net/dpaa: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 12/40] net/dpaa2: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 13/40] net/ena: " Jie Hai
2023-10-11 17:27 ` Ferruh Yigit
2023-10-12 2:35 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 14/40] net/enic: " Jie Hai
2023-10-11 17:32 ` Ferruh Yigit
2023-10-12 18:09 ` John Daley (johndale)
2023-10-11 9:27 ` [PATCH v5 15/40] net/fm10k: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 16/40] net/hinic: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 17/40] net/i40e: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 18/40] net/iavf: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 19/40] net/ice: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 20/40] net/idpf: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 21/40] net/igc: " Jie Hai
2023-10-11 17:51 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 22/40] net/ionic: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 23/40] net/ixgbe: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 24/40] net/mana: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 25/40] net/mlx5: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 26/40] net/mvpp2: " Jie Hai
2023-10-11 18:00 ` Ferruh Yigit
2023-10-12 2:21 ` Jie Hai
2023-10-11 9:27 ` [PATCH v5 27/40] net/netvsc: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 28/40] net/ngbe: : " Jie Hai
2023-10-11 9:27 ` [PATCH v5 29/40] net/nfp: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 30/40] net/null: " Jie Hai
2023-10-11 18:06 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 31/40] net/qede: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 32/40] net/sfc: " Jie Hai
2023-10-11 9:27 ` [PATCH v5 33/40] net/tap: " Jie Hai
2023-10-11 18:13 ` Ferruh Yigit
2023-10-11 9:27 ` [PATCH v5 34/40] net/thunderx: " Jie Hai
2023-10-11 9:28 ` [PATCH v5 35/40] net/txgbe: " Jie Hai
2023-10-11 9:28 ` [PATCH v5 36/40] net/hns3: support setting and querying RSS hash function Jie Hai
2023-10-12 2:23 ` fengchengwen
2023-10-12 2:56 ` Jie Hai
2023-10-12 3:05 ` Jie Hai
2023-10-12 3:59 ` fengchengwen
2023-10-11 9:28 ` [PATCH v5 37/40] app/proc-info: fix never show RSS info Jie Hai
2023-10-12 1:59 ` fengchengwen
2023-10-11 9:28 ` [PATCH v5 38/40] app/proc-info: adjust the display format of " Jie Hai
2023-10-12 2:01 ` fengchengwen
2023-10-12 3:10 ` Jie Hai
2023-10-11 9:28 ` [PATCH v5 39/40] app/proc-info: support querying RSS hash algorithm Jie Hai
2023-10-12 2:05 ` fengchengwen
2023-10-12 3:51 ` Jie Hai
2023-10-11 9:28 ` [PATCH v5 40/40] app/testpmd: add RSS hash algorithms display Jie Hai
2023-10-12 3:04 ` fengchengwen
2023-10-11 18:19 ` [PATCH v5 00/40] support setting and querying RSS algorithms Ferruh Yigit
2023-10-12 16:49 ` Stephen Hemminger
2023-10-17 14:06 ` Thomas Monjalon
2023-10-17 14:26 ` Ferruh Yigit
2023-10-24 12:57 ` lihuisong (C)
2023-10-26 8:53 ` Thomas Monjalon
2023-10-27 9:28 ` [PATCH 0/9] " Jie Hai
2023-10-27 9:28 ` [PATCH 1/9] ethdev: overwrite some comment related to RSS Jie Hai
2023-10-29 7:26 ` Ori Kam
2023-11-01 6:06 ` Jie Hai
2023-10-27 9:28 ` [PATCH 2/9] ethdev: support setting and querying RSS algorithm Jie Hai
2023-10-27 9:28 ` [PATCH 3/9] net/hns3: report RSS hash algorithms capability Jie Hai
2023-10-27 9:28 ` [PATCH 4/9] net/hns3: support setting and querying RSS hash function Jie Hai
2023-10-27 9:28 ` [PATCH 5/9] app/proc-info: fix never show RSS info Jie Hai
2023-10-27 9:28 ` [PATCH 6/9] app/proc-info: adjust the display format of " Jie Hai
2023-10-27 9:28 ` [PATCH 7/9] lib/ethdev: add API to get RSS algorithm names Jie Hai
2023-10-27 9:28 ` [PATCH 8/9] app/proc-info: support querying RSS hash algorithm Jie Hai
2023-10-27 9:28 ` [PATCH 9/9] app/testpmd: add RSS hash algorithms display Jie Hai
2023-10-28 1:46 ` [PATCH v7 0/9] support setting and querying RSS algorithms Jie Hai
2023-10-28 1:46 ` [PATCH v7 1/9] ethdev: overwrite some comment related to RSS Jie Hai
2023-10-28 2:41 ` lihuisong (C)
2023-11-01 12:55 ` Ferruh Yigit
2023-10-28 1:46 ` [PATCH v7 2/9] ethdev: support setting and querying RSS algorithm Jie Hai
2023-10-28 3:01 ` lihuisong (C)
2023-11-01 12:55 ` Ferruh Yigit
2023-10-28 1:46 ` [PATCH v7 3/9] net/hns3: report RSS hash algorithms capability Jie Hai
2023-10-28 3:02 ` lihuisong (C)
2023-10-28 1:46 ` [PATCH v7 4/9] net/hns3: support setting and querying RSS hash function Jie Hai
2023-10-28 1:46 ` [PATCH v7 5/9] app/proc-info: fix never show RSS info Jie Hai
2023-10-28 3:03 ` lihuisong (C)
2023-10-28 1:46 ` [PATCH v7 6/9] app/proc-info: adjust the display format of " Jie Hai
2023-10-28 1:46 ` [PATCH v7 7/9] lib/ethdev: add API to get RSS algorithm names Jie Hai
2023-10-28 3:09 ` lihuisong (C)
2023-11-01 2:04 ` Ferruh Yigit
2023-10-28 1:46 ` [PATCH v7 8/9] app/proc-info: support querying RSS hash algorithm Jie Hai
2023-10-28 1:46 ` [PATCH v7 9/9] app/testpmd: add RSS hash algorithms display Jie Hai
2023-10-28 3:14 ` lihuisong (C)
2023-11-01 2:04 ` [PATCH v7 0/9] support setting and querying RSS algorithms Ferruh Yigit
2023-11-01 7:40 ` [PATCH v8 00/10] " Jie Hai
2023-11-01 7:40 ` [PATCH v8 01/10] ethdev: overwrite some comment related to RSS Jie Hai
2023-11-01 10:09 ` lihuisong (C)
2023-11-01 13:13 ` Ferruh Yigit
2023-11-02 3:29 ` Jie Hai
2023-11-01 7:40 ` [PATCH v8 02/10] lib/ethdev: check RSS key length Jie Hai
2023-11-01 10:07 ` lihuisong (C)
2023-11-01 13:19 ` Ferruh Yigit
2023-11-02 3:40 ` Jie Hai
2023-11-01 7:40 ` [PATCH v8 03/10] ethdev: support setting and querying RSS algorithm Jie Hai
2023-11-01 13:36 ` Ferruh Yigit
2023-11-02 6:58 ` Jie Hai
2023-11-01 7:40 ` [PATCH v8 04/10] net/hns3: report RSS hash algorithms capability Jie Hai
2023-11-01 7:40 ` [PATCH v8 05/10] net/hns3: support setting and querying RSS hash function Jie Hai
2023-11-01 7:40 ` [PATCH v8 06/10] app/proc-info: fix never show RSS info Jie Hai
2023-11-01 7:40 ` [PATCH v8 07/10] app/proc-info: adjust the display format of " Jie Hai
2023-11-01 7:40 ` [PATCH v8 08/10] ethdev: add API to get RSS algorithm names Jie Hai
2023-11-01 7:40 ` [PATCH v8 09/10] app/proc-info: support querying RSS hash algorithm Jie Hai
2023-11-01 10:08 ` lihuisong (C)
2023-11-01 7:40 ` [PATCH v8 10/10] app/testpmd: add RSS hash algorithms display Jie Hai
2023-11-01 13:42 ` Ferruh Yigit
2023-11-02 7:33 ` Jie Hai
2023-11-01 9:44 ` [PATCH v8 00/10] support setting and querying RSS algorithms fengchengwen
2023-11-02 8:20 ` [PATCH v9 0/9] " Jie Hai
2023-11-02 8:20 ` [PATCH v9 1/9] ethdev: overwrite some comment related to RSS Jie Hai
2023-11-06 10:57 ` Andrew Rybchenko
2023-11-02 8:20 ` [PATCH v9 2/9] ethdev: support setting and querying RSS algorithm Jie Hai
2023-11-03 15:52 ` Ferruh Yigit
2023-11-02 8:20 ` [PATCH v9 3/9] net/hns3: report RSS hash algorithms capability Jie Hai
2023-11-02 8:20 ` [PATCH v9 4/9] net/hns3: support setting and querying RSS hash function Jie Hai
2023-11-02 8:20 ` [PATCH v9 5/9] app/proc-info: fix never show RSS info Jie Hai
2023-11-02 8:20 ` [PATCH v9 6/9] app/proc-info: adjust the display format of " Jie Hai
2023-11-02 8:20 ` [PATCH v9 7/9] ethdev: add API to get RSS algorithm names Jie Hai
2023-11-06 10:43 ` Andrew Rybchenko
2023-11-02 8:20 ` [PATCH v9 8/9] app/proc-info: support querying RSS hash algorithm Jie Hai
2023-11-02 8:20 ` [PATCH v9 9/9] app/testpmd: add RSS hash algorithms display Jie Hai
2023-11-02 13:11 ` [PATCH v9 0/9] support setting and querying RSS algorithms Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).