Skip to contentSkip to conversation

Add RSS action support in the sample sub-actions list

PATCH Superseded Jiawei Wang 3 participants 16 messages Jan 10, 2021 – Jan 19, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

cover Add RSS action support in the sample sub-actions list

Currently the sample flow only supports Queue action in NIC-Rx domain. This patchset adds the RSS action support in the sample sub-actions list.

The examples for the sample flow with RSS action and result as below:
set sample_actions 0 mark id 0x12 / rss queues 0 1 2 3 end / end
flow create 0 ingress group 1 pattern eth / end actions sample ratio 1 index 0 / jump group 2 / end

This flow will result in all the matched ingress packets will be jumped to next table, and the each packet will be marked and sent to rss queues of the control application.

Jiawei Wang (3):
app/testpmd: add RSS support in sample action
net/mlx5: handle the RSS action in the sample
doc: update RSS support in sample action

 app/test-pmd/cmdline_flow.c            |  26 ++++
 doc/guides/nics/mlx5.rst               |   1 +
 doc/guides/rel_notes/release_21_02.rst |   5 +
 drivers/net/mlx5/mlx5_flow.c           |  24 +++-
 drivers/net/mlx5/mlx5_flow_dv.c        | 226 +++++++++++++++++++++++----------
 5 files changed, 207 insertions(+), 75 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/3 app/testpmd: add RSS support in sample action

Support rss action in the sample sub-actions list.

The examples for the sample flow use case and result as below:
set sample_actions 0 mark id 0x12 / rss queues 0 1 2 3 end / end flow create 0 ingress group 1 pattern eth / end actions sample ratio 1 index 0 / jump group 2 / end

This flow will result in all the matched ingress packets will be jumped to next table, and the each packet will be marked and sent to rss queues of the control application.

---
 app/test-pmd/cmdline_flow.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
app/test-pmd/cmdline_flow.c +26 -0
index 585cab9..28c3a1b 100644
@@ -560,6 +560,7 @@ struct raw_sample_conf {
 struct rte_flow_action_count sample_count[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_port_id sample_port_id[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_raw_encap sample_encap[RAW_SAMPLE_CONFS_MAX_NUM];
+struct action_rss_data sample_rss_data[RAW_SAMPLE_CONFS_MAX_NUM];
 
 /** Maximum number of subsequent tokens and arguments on the stack. */
 #define CTX_STACK_SIZE 16
@@ -1548,6 +1549,7 @@ struct parse_action_priv {
 
 static const enum index next_action_sample[] = {
 	ACTION_QUEUE,
+	ACTION_RSS,
 	ACTION_MARK,
 	ACTION_COUNT,
 	ACTION_PORT_ID,
@@ -7515,6 +7517,7 @@ static int comp_set_sample_index(struct context *, const struct token *,
 	uint32_t i = 0;
 	struct rte_flow_action *action = NULL;
 	struct rte_flow_action *data = NULL;
+	const struct rte_flow_action_rss *rss = NULL;
 	size_t size = 0;
 	uint16_t idx = in->port; /* We borrow port field as index */
 	uint32_t max_size = sizeof(struct rte_flow_action) *
@@ -7546,6 +7549,29 @@ static int comp_set_sample_index(struct context *, const struct token *,
 				(const void *)action->conf, size);
 			action->conf = &sample_queue[idx];
 			break;
+		case RTE_FLOW_ACTION_TYPE_RSS:
+			size = sizeof(struct rte_flow_action_rss);
+			rss = action->conf;
+			rte_memcpy(&sample_rss_data[idx].conf,
+				   (const void *)rss, size);
+			if (rss->key_len) {
+				sample_rss_data[idx].conf.key =
+						sample_rss_data[idx].key;
+				rte_memcpy((void *)((uintptr_t)
+					   sample_rss_data[idx].conf.key),
+					   (const void *)rss->key,
+					   sizeof(uint8_t) * rss->key_len);
+			}
+			if (rss->queue_num) {
+				sample_rss_data[idx].conf.queue =
+						sample_rss_data[idx].queue;
+				rte_memcpy((void *)((uintptr_t)
+					   sample_rss_data[idx].conf.queue),
+					   (const void *)rss->queue,
+					   sizeof(uint16_t) * rss->queue_num);
+			}
+			action->conf = &sample_rss_data[idx].conf;
+			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
 			size = sizeof(struct rte_flow_action_raw_encap);
 			rte_memcpy(&sample_encap[idx],
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/3 net/mlx5: handle the RSS action in the sample

In reply to Jiawei Wang

PMD validates the rss action in the sample sub-actions list, then translate into rdma-core action and it will be used for sample path destination.

If the RSS action both in sample sub-actions list and original flow, the rss level and rss type in the sample sub-actions list should be consistent with the original flow list, since the expanding items for RSS should same in one flow.

---
 drivers/net/mlx5/mlx5_flow.c    |  24 ++++-
 drivers/net/mlx5/mlx5_flow_dv.c | 226 +++++++++++++++++++++++++++-------------
 2 files changed, 175 insertions(+), 75 deletions(-)
drivers/net/mlx5/mlx5_flow.c +19 -5
index 2a4073c..96a7e0d 100644
@@ -3174,16 +3174,28 @@ struct mlx5_flow_tunnel_info {
 static const struct rte_flow_action_rss*
 flow_get_rss_action(const struct rte_flow_action actions[])
 {
+	const struct rte_flow_action_rss *rss = NULL;
+
 	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
 		switch (actions->type) {
 		case RTE_FLOW_ACTION_TYPE_RSS:
-			return (const struct rte_flow_action_rss *)
-			       actions->conf;
+			rss = actions->conf;
+			break;
+		case RTE_FLOW_ACTION_TYPE_SAMPLE:
+		{
+			const struct rte_flow_action_sample *sample =
+								actions->conf;
+			const struct rte_flow_action *act = sample->actions;
+			for (; act->type != RTE_FLOW_ACTION_TYPE_END; act++)
+				if (act->type == RTE_FLOW_ACTION_TYPE_RSS)
+					rss = act->conf;
+			break;
+		}
 		default:
 			break;
 		}
 	}
-	return NULL;
+	return rss;
 }
 
 /**
@@ -5278,7 +5290,7 @@ struct mlx5_hlist_entry *
 	struct mlx5_priv *priv = dev->data->dev_private;
 	struct rte_flow *flow = NULL;
 	struct mlx5_flow *dev_flow;
-	const struct rte_flow_action_rss *rss;
+	const struct rte_flow_action_rss *rss = NULL;
 	struct mlx5_translated_shared_action
 		shared_actions[MLX5_MAX_SHARED_ACTIONS];
 	int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
@@ -5356,7 +5368,9 @@ struct mlx5_hlist_entry *
 	MLX5_ASSERT(flow->drv_type > MLX5_FLOW_TYPE_MIN &&
 		    flow->drv_type < MLX5_FLOW_TYPE_MAX);
 	memset(rss_desc, 0, offsetof(struct mlx5_flow_rss_desc, queue));
-	rss = flow_get_rss_action(p_actions_rx);
+	/* RSS Action only works on NIC RX domain */
+	if (attr->ingress && !attr->transfer)
+		rss = flow_get_rss_action(p_actions_rx);
 	if (rss) {
 		if (flow_rss_workspace_adjust(wks, rss_desc, rss->queue_num))
 			return 0;
drivers/net/mlx5/mlx5_flow_dv.c +156 -70

341 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/3 doc: update RSS support in sample action

In reply to Jiawei Wang

Add descrption about RSS action will be supported in the Sample action in MLX5 PMD.

---
 doc/guides/nics/mlx5.rst               | 1 +
 doc/guides/rel_notes/release_21_02.rst | 5 +++++
 2 files changed, 6 insertions(+)
doc/guides/nics/mlx5.rst +1 -0
index 3bda0f8..c20c0ed 100644
@@ -98,6 +98,7 @@ Features
 - Hardware LRO.
 - Hairpin.
 - Multiple-thread flow insertion.
+- RSS support in sample action.
 
 Limitations
 -----------
doc/guides/rel_notes/release_21_02.rst +5 -0
index 638f981..74ec91f 100644
@@ -55,6 +55,11 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Updated Mellanox mlx5 driver.**
+
+  Updated the Mellanox mlx5 driver with new features and improvements, including:
+
+  * Added support for RSS action in the sample sub-actions list.
 
 Removed Items
 -------------
Signature · 1 line
1.8.3.1
#4 lore raw

v2 cover Add RSS action support in the sample sub-actions list

In reply to Jiawei Wang

Currently the sample flow only supports Queue action in NIC-Rx domain. This patchset adds the RSS action support in the sample sub-actions list.

The examples for the sample flow with RSS action and result as below:
set sample_actions 0 mark id 0x12 / rss queues 0 1 2 3 end / end
flow create 0 ingress group 1 pattern eth / end actions sample ratio 1 index 0 / jump group 2 / end

This flow will result in all the matched ingress packets will be jumped to the next table, and the each packet will be marked with 0x12 and duplicated to rss queues of the control application.

v2:
* Rebase
* Update commit message and document description
* Split the commit into one fix for rss checking and another for sample rss feature

Jiawei Wang (4):
app/testpmd: add RSS support in sample action net/mlx5: fix the unnecessary checking for RSS action net/mlx5: handle the RSS action in the sample
doc: update RSS support in sample action

 app/test-pmd/cmdline_flow.c            |  26 ++++
 doc/guides/nics/mlx5.rst               |   1 +
 doc/guides/rel_notes/release_21_02.rst |   5 +
 drivers/net/mlx5/mlx5_flow.c           |  24 +++-
 drivers/net/mlx5/mlx5_flow_dv.c        | 226 +++++++++++++++++++++++----------
 5 files changed, 207 insertions(+), 75 deletions(-)
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH v2 1/4 app/testpmd: add RSS support in sample action

Support rss action in the sample sub-actions list.

The examples for the sample flow use case and result as below:
set sample_actions 0 mark id 0x12 / rss queues 0 1 2 3 end / end flow create 0 ingress group 1 pattern eth / end actions sample ratio 1 index 0 / jump group 2 / end

This flow will result in all the matched ingress packets will be jumped to next table, and the each packet will be marked with 0x12 and duplicated to rss queues of the control application.

---
 app/test-pmd/cmdline_flow.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
app/test-pmd/cmdline_flow.c +26 -0
index 585cab9..28c3a1b 100644
@@ -560,6 +560,7 @@ struct raw_sample_conf {
 struct rte_flow_action_count sample_count[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_port_id sample_port_id[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_raw_encap sample_encap[RAW_SAMPLE_CONFS_MAX_NUM];
+struct action_rss_data sample_rss_data[RAW_SAMPLE_CONFS_MAX_NUM];
 
 /** Maximum number of subsequent tokens and arguments on the stack. */
 #define CTX_STACK_SIZE 16
@@ -1548,6 +1549,7 @@ struct parse_action_priv {
 
 static const enum index next_action_sample[] = {
 	ACTION_QUEUE,
+	ACTION_RSS,
 	ACTION_MARK,
 	ACTION_COUNT,
 	ACTION_PORT_ID,
@@ -7515,6 +7517,7 @@ static int comp_set_sample_index(struct context *, const struct token *,
 	uint32_t i = 0;
 	struct rte_flow_action *action = NULL;
 	struct rte_flow_action *data = NULL;
+	const struct rte_flow_action_rss *rss = NULL;
 	size_t size = 0;
 	uint16_t idx = in->port; /* We borrow port field as index */
 	uint32_t max_size = sizeof(struct rte_flow_action) *
@@ -7546,6 +7549,29 @@ static int comp_set_sample_index(struct context *, const struct token *,
 				(const void *)action->conf, size);
 			action->conf = &sample_queue[idx];
 			break;
+		case RTE_FLOW_ACTION_TYPE_RSS:
+			size = sizeof(struct rte_flow_action_rss);
+			rss = action->conf;
+			rte_memcpy(&sample_rss_data[idx].conf,
+				   (const void *)rss, size);
+			if (rss->key_len) {
+				sample_rss_data[idx].conf.key =
+						sample_rss_data[idx].key;
+				rte_memcpy((void *)((uintptr_t)
+					   sample_rss_data[idx].conf.key),
+					   (const void *)rss->key,
+					   sizeof(uint8_t) * rss->key_len);
+			}
+			if (rss->queue_num) {
+				sample_rss_data[idx].conf.queue =
+						sample_rss_data[idx].queue;
+				rte_memcpy((void *)((uintptr_t)
+					   sample_rss_data[idx].conf.queue),
+					   (const void *)rss->queue,
+					   sizeof(uint16_t) * rss->queue_num);
+			}
+			action->conf = &sample_rss_data[idx].conf;
+			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
 			size = sizeof(struct rte_flow_action_raw_encap);
 			rte_memcpy(&sample_encap[idx],
Signature · 1 line
1.8.3.1
#6 lore raw

PATCH v2 2/4 net/mlx5: fix the unnecessary checking for RSS action

In reply to Jiawei Wang

RSS action is valid only in NIC-RX domain, this fix bypass the function that getting RSS action from the flow action list under no NIC-RX domain.

Fixes e745f900072e ("net/mlx5: optimize flow RSS struct")
---
 drivers/net/mlx5/mlx5_flow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.c +3 -1
index 2a4073c..29c6e14 100644
@@ -5356,7 +5356,9 @@ struct mlx5_hlist_entry *
 	MLX5_ASSERT(flow->drv_type > MLX5_FLOW_TYPE_MIN &&
 		    flow->drv_type < MLX5_FLOW_TYPE_MAX);
 	memset(rss_desc, 0, offsetof(struct mlx5_flow_rss_desc, queue));
-	rss = flow_get_rss_action(p_actions_rx);
+	/* RSS Action only works on NIC RX domain */
+	if (attr->ingress && !attr->transfer)
+		rss = flow_get_rss_action(p_actions_rx);
 	if (rss) {
 		if (flow_rss_workspace_adjust(wks, rss_desc, rss->queue_num))
 			return 0;
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH v2 3/4 net/mlx5: handle the RSS action in the sample

In reply to Jiawei Wang

PMD validates the rss action in the sample sub-actions list, then translates into rdma-core action and it will be used for sample path destination.

If the RSS action is in both sample sub-actions list and original flow, the rss level and rss type in the sample sub-actions list should be consistent with the original flow list, since the expanding items for RSS should be the same for both actions.

---
 drivers/net/mlx5/mlx5_flow.c    |  20 +++-
 drivers/net/mlx5/mlx5_flow_dv.c | 226 +++++++++++++++++++++++++++-------------
 2 files changed, 172 insertions(+), 74 deletions(-)
drivers/net/mlx5/mlx5_flow.c +16 -4
index 29c6e14..96a7e0d 100644
@@ -3174,16 +3174,28 @@ struct mlx5_flow_tunnel_info {
 static const struct rte_flow_action_rss*
 flow_get_rss_action(const struct rte_flow_action actions[])
 {
+	const struct rte_flow_action_rss *rss = NULL;
+
 	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
 		switch (actions->type) {
 		case RTE_FLOW_ACTION_TYPE_RSS:
-			return (const struct rte_flow_action_rss *)
-			       actions->conf;
+			rss = actions->conf;
+			break;
+		case RTE_FLOW_ACTION_TYPE_SAMPLE:
+		{
+			const struct rte_flow_action_sample *sample =
+								actions->conf;
+			const struct rte_flow_action *act = sample->actions;
+			for (; act->type != RTE_FLOW_ACTION_TYPE_END; act++)
+				if (act->type == RTE_FLOW_ACTION_TYPE_RSS)
+					rss = act->conf;
+			break;
+		}
 		default:
 			break;
 		}
 	}
-	return NULL;
+	return rss;
 }
 
 /**
@@ -5278,7 +5290,7 @@ struct mlx5_hlist_entry *
 	struct mlx5_priv *priv = dev->data->dev_private;
 	struct rte_flow *flow = NULL;
 	struct mlx5_flow *dev_flow;
-	const struct rte_flow_action_rss *rss;
+	const struct rte_flow_action_rss *rss = NULL;
 	struct mlx5_translated_shared_action
 		shared_actions[MLX5_MAX_SHARED_ACTIONS];
 	int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
drivers/net/mlx5/mlx5_flow_dv.c +156 -70

341 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#8 lore raw

PATCH v2 4/4 doc: update RSS support in sample action

In reply to Jiawei Wang

Add description about mlx5 PMD RSS action support for the Sample action.

---
 doc/guides/nics/mlx5.rst               | 1 +
 doc/guides/rel_notes/release_21_02.rst | 5 +++++
 2 files changed, 6 insertions(+)
doc/guides/nics/mlx5.rst +1 -0
index 3bda0f8..c20c0ed 100644
@@ -98,6 +98,7 @@ Features
 - Hardware LRO.
 - Hairpin.
 - Multiple-thread flow insertion.
+- RSS support in sample action.
 
 Limitations
 -----------
doc/guides/rel_notes/release_21_02.rst +5 -0
index 706cbf8..610ddcd 100644
@@ -55,6 +55,11 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Updated Mellanox mlx5 driver.**
+
+  Updated the Mellanox mlx5 driver with new features and improvements, including:
+
+  * Added support for RSS action in the sample sub-actions list.
 
 Removed Items
 -------------
Signature · 1 line
1.8.3.1
#10 lore raw

v3 cover Add RSS action support in the sample sub-actions list

In reply to Jiawei Wang

Currently the sample flow only supports Queue action in NIC-Rx domain. This patchset adds the RSS action support in the sample sub-actions list.

The examples for the sample flow with RSS action and result as below:
set sample_actions 0 mark id 0x12 / rss queues 0 1 2 3 end / end
flow create 0 ingress group 1 pattern eth / end actions sample ratio 1 index 0 / jump group 2 / end

This flow will result in all the matched ingress packets will be jumped to the next table, and the each packet will be marked with 0x12 and duplicated to rss queues of the control application.

v3:
* Fix the 'maybe-uninitialized' build error in commit 'net/mlx5: fix the unnecessary checking for RSS action'

v2:
* Rebase
* Update commit message and document description
* Split the commit into one fix for rss checking and another for sample rss feature

Jiawei Wang (4):
app/testpmd: add RSS support in sample action net/mlx5: fix the unnecessary checking for RSS action net/mlx5: handle the RSS action in the sample
doc: update RSS support in sample action

 app/test-pmd/cmdline_flow.c            |  26 ++++
 doc/guides/nics/mlx5.rst               |   1 +
 doc/guides/rel_notes/release_21_02.rst |   5 +
 drivers/net/mlx5/mlx5_flow.c           |  24 +++-
 drivers/net/mlx5/mlx5_flow_dv.c        | 226 +++++++++++++++++++++++----------
 5 files changed, 207 insertions(+), 75 deletions(-)
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH v3 1/4 app/testpmd: add RSS support in sample action

Support rss action in the sample sub-actions list.

The examples for the sample flow use case and result as below:
set sample_actions 0 mark id 0x12 / rss queues 0 1 2 3 end / end flow create 0 ingress group 1 pattern eth / end actions sample ratio 1 index 0 / jump group 2 / end

This flow will result in all the matched ingress packets will be jumped to next table, and the each packet will be marked with 0x12 and duplicated to rss queues of the control application.

---
 app/test-pmd/cmdline_flow.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
app/test-pmd/cmdline_flow.c +26 -0
index 585cab9..28c3a1b 100644
@@ -560,6 +560,7 @@ struct raw_sample_conf {
 struct rte_flow_action_count sample_count[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_port_id sample_port_id[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_raw_encap sample_encap[RAW_SAMPLE_CONFS_MAX_NUM];
+struct action_rss_data sample_rss_data[RAW_SAMPLE_CONFS_MAX_NUM];
 
 /** Maximum number of subsequent tokens and arguments on the stack. */
 #define CTX_STACK_SIZE 16
@@ -1548,6 +1549,7 @@ struct parse_action_priv {
 
 static const enum index next_action_sample[] = {
 	ACTION_QUEUE,
+	ACTION_RSS,
 	ACTION_MARK,
 	ACTION_COUNT,
 	ACTION_PORT_ID,
@@ -7515,6 +7517,7 @@ static int comp_set_sample_index(struct context *, const struct token *,
 	uint32_t i = 0;
 	struct rte_flow_action *action = NULL;
 	struct rte_flow_action *data = NULL;
+	const struct rte_flow_action_rss *rss = NULL;
 	size_t size = 0;
 	uint16_t idx = in->port; /* We borrow port field as index */
 	uint32_t max_size = sizeof(struct rte_flow_action) *
@@ -7546,6 +7549,29 @@ static int comp_set_sample_index(struct context *, const struct token *,
 				(const void *)action->conf, size);
 			action->conf = &sample_queue[idx];
 			break;
+		case RTE_FLOW_ACTION_TYPE_RSS:
+			size = sizeof(struct rte_flow_action_rss);
+			rss = action->conf;
+			rte_memcpy(&sample_rss_data[idx].conf,
+				   (const void *)rss, size);
+			if (rss->key_len) {
+				sample_rss_data[idx].conf.key =
+						sample_rss_data[idx].key;
+				rte_memcpy((void *)((uintptr_t)
+					   sample_rss_data[idx].conf.key),
+					   (const void *)rss->key,
+					   sizeof(uint8_t) * rss->key_len);
+			}
+			if (rss->queue_num) {
+				sample_rss_data[idx].conf.queue =
+						sample_rss_data[idx].queue;
+				rte_memcpy((void *)((uintptr_t)
+					   sample_rss_data[idx].conf.queue),
+					   (const void *)rss->queue,
+					   sizeof(uint16_t) * rss->queue_num);
+			}
+			action->conf = &sample_rss_data[idx].conf;
+			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
 			size = sizeof(struct rte_flow_action_raw_encap);
 			rte_memcpy(&sample_encap[idx],
Signature · 1 line
1.8.3.1
#12 lore raw

PATCH v3 2/4 net/mlx5: fix the unnecessary checking for RSS action

In reply to Jiawei Wang

RSS action is valid only in NIC-RX domain, this fix bypass the function that getting RSS action from the flow action list under no NIC-RX domain.

Fixes e745f90 ("net/mlx5: optimize flow RSS struct")
---
 drivers/net/mlx5/mlx5_flow.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow.c +4 -2
index 2a4073c..0670447 100644
@@ -5278,7 +5278,7 @@ struct mlx5_hlist_entry *
 	struct mlx5_priv *priv = dev->data->dev_private;
 	struct rte_flow *flow = NULL;
 	struct mlx5_flow *dev_flow;
-	const struct rte_flow_action_rss *rss;
+	const struct rte_flow_action_rss *rss = NULL;
 	struct mlx5_translated_shared_action
 		shared_actions[MLX5_MAX_SHARED_ACTIONS];
 	int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
@@ -5356,7 +5356,9 @@ struct mlx5_hlist_entry *
 	MLX5_ASSERT(flow->drv_type > MLX5_FLOW_TYPE_MIN &&
 		    flow->drv_type < MLX5_FLOW_TYPE_MAX);
 	memset(rss_desc, 0, offsetof(struct mlx5_flow_rss_desc, queue));
-	rss = flow_get_rss_action(p_actions_rx);
+	/* RSS Action only works on NIC RX domain */
+	if (attr->ingress && !attr->transfer)
+		rss = flow_get_rss_action(p_actions_rx);
 	if (rss) {
 		if (flow_rss_workspace_adjust(wks, rss_desc, rss->queue_num))
 			return 0;
Signature · 1 line
1.8.3.1
#13 lore raw

PATCH v3 3/4 net/mlx5: handle the RSS action in the sample

In reply to Jiawei Wang

PMD validates the rss action in the sample sub-actions list, then translates into rdma-core action and it will be used for sample path destination.

If the RSS action is in both sample sub-actions list and original flow, the rss level and rss type in the sample sub-actions list should be consistent with the original flow list, since the expanding items for RSS should be the same for both actions.

---
 drivers/net/mlx5/mlx5_flow.c    |  18 +++-
 drivers/net/mlx5/mlx5_flow_dv.c | 226 +++++++++++++++++++++++++++-------------
 2 files changed, 171 insertions(+), 73 deletions(-)
drivers/net/mlx5/mlx5_flow.c +15 -3
index 0670447..96a7e0d 100644
@@ -3174,16 +3174,28 @@ struct mlx5_flow_tunnel_info {
 static const struct rte_flow_action_rss*
 flow_get_rss_action(const struct rte_flow_action actions[])
 {
+	const struct rte_flow_action_rss *rss = NULL;
+
 	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
 		switch (actions->type) {
 		case RTE_FLOW_ACTION_TYPE_RSS:
-			return (const struct rte_flow_action_rss *)
-			       actions->conf;
+			rss = actions->conf;
+			break;
+		case RTE_FLOW_ACTION_TYPE_SAMPLE:
+		{
+			const struct rte_flow_action_sample *sample =
+								actions->conf;
+			const struct rte_flow_action *act = sample->actions;
+			for (; act->type != RTE_FLOW_ACTION_TYPE_END; act++)
+				if (act->type == RTE_FLOW_ACTION_TYPE_RSS)
+					rss = act->conf;
+			break;
+		}
 		default:
 			break;
 		}
 	}
-	return NULL;
+	return rss;
 }
 
 /**
drivers/net/mlx5/mlx5_flow_dv.c +156 -70

341 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#14 lore raw

PATCH v3 4/4 doc: update RSS support in sample action

In reply to Jiawei Wang

Add description about mlx5 PMD RSS action support for the Sample action.

---
 doc/guides/nics/mlx5.rst               | 1 +
 doc/guides/rel_notes/release_21_02.rst | 5 +++++
 2 files changed, 6 insertions(+)
doc/guides/nics/mlx5.rst +1 -0
index 3bda0f8..c20c0ed 100644
@@ -98,6 +98,7 @@ Features
 - Hardware LRO.
 - Hairpin.
 - Multiple-thread flow insertion.
+- RSS support in sample action.
 
 Limitations
 -----------
doc/guides/rel_notes/release_21_02.rst +5 -0
index 706cbf8..610ddcd 100644
@@ -55,6 +55,11 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Updated Mellanox mlx5 driver.**
+
+  Updated the Mellanox mlx5 driver with new features and improvements, including:
+
+  * Added support for RSS action in the sample sub-actions list.
 
 Removed Items
 -------------
Signature · 1 line
1.8.3.1
#15 lore raw
In reply to Jiawei Wang

Hi,

Quoted 44 lines

-----Original Message-----
From: Jiawei Wang <[email protected]>
Sent: Thursday, January 14, 2021 9:25 AM
To: [email protected]; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>
Subject: [PATCH v3 0/4] Add RSS action support in the sample sub-actions list

Currently the sample flow only supports Queue action in NIC-Rx domain. This patchset adds the RSS action support in the sample sub-actions list.

The examples for the sample flow with RSS action and result as below:
set sample_actions 0 mark id 0x12 / rss queues 0 1 2 3 end / end flow create 0 ingress group 1 pattern eth / end actions sample ratio 1 index
0 / jump group 2 / end

This flow will result in all the matched ingress packets will be jumped to the next table, and the each packet will be marked with 0x12 and duplicated to rss queues of the control application.

v3:
* Fix the 'maybe-uninitialized' build error in commit 'net/mlx5: fix the unnecessary checking for RSS action'

v2:
* Rebase
* Update commit message and document description
* Split the commit into one fix for rss checking and another for sample rss feature

Jiawei Wang (4):
app/testpmd: add RSS support in sample action net/mlx5: fix the unnecessary checking for RSS action net/mlx5: handle the RSS action in the sample
doc: update RSS support in sample action

 app/test-pmd/cmdline_flow.c            |  26 ++++
 doc/guides/nics/mlx5.rst               |   1 +
 doc/guides/rel_notes/release_21_02.rst |   5 +
 drivers/net/mlx5/mlx5_flow.c           |  24 +++-
 drivers/net/mlx5/mlx5_flow_dv.c        | 226 +++++++++++++++++++++++---
-------
 5 files changed, 207 insertions(+), 75 deletions(-)
Quoted 2 lines

--
1.8.3.1

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh