Skip to contentSkip to conversation

net/mlx5: fix mirror flow split with L3 encapsulation

PATCH Superseded Jiawei Wang 3 participants 7 messages Jul 23, 2021 – Jul 28, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix mirror flow split with L3 encapsulation

Due to hardware limitations, the decap action can't follow the sample action in the same flow, to keep the original action order of sample and decap actions the flow was internally split by PMD, and decap action was moved into suffix subflow in the new table.

There is a specific combination of raw decap and raw encap actions to specify "L3 encapsulation" packet transformation - raw decap action to remove L2 header and raw encap to add the tunnel header. This specific L3 encapsulation is encoded as a single packet reformat hardware transaction and is supported by hardware after sample action (no hardware limitations for packet reformat).

The patch checks whether the decap action is the part of "L3 encapsulation" and does not move the decap action into suffix subflow for the case.

Fixes cafd87f62a06 ("net/mlx5: fix VLAN push/pop and decap actions with mirror")
---
 drivers/net/mlx5/mlx5_flow.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.c +19 -1
index a3fdce685e..3200a306e9 100644
@@ -5259,6 +5259,7 @@ flow_check_match_action(const struct rte_flow_action actions[],
 			int *modify_after_mirror)
 {
 	const struct rte_flow_action_sample *sample;
+	const struct rte_flow_action_raw_decap *decap;
 	int actions_n = 0;
 	uint32_t ratio = 0;
 	int sub_type = 0;
@@ -5311,12 +5312,29 @@ flow_check_match_action(const struct rte_flow_action actions[],
 		case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP:
 		case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP:
 		case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP:
-		case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
 		case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD:
 		case RTE_FLOW_ACTION_TYPE_METER:
 			if (fdb_mirror)
 				*modify_after_mirror = 1;
 			break;
+		case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
+			decap = actions->conf;
+			while ((++actions)->type == RTE_FLOW_ACTION_TYPE_VOID)
+				;
+			actions_n++;
+			if (actions->type == RTE_FLOW_ACTION_TYPE_RAW_ENCAP) {
+				const struct rte_flow_action_raw_encap *encap =
+								actions->conf;
+				if (decap->size <=
+					MLX5_ENCAPSULATION_DECISION_SIZE &&
+				    encap->size >
+					MLX5_ENCAPSULATION_DECISION_SIZE)
+					/* L3 encap. */
+					break;
+			}
+			if (fdb_mirror)
+				*modify_after_mirror = 1;
+			break;
 		default:
 			break;
 		}
Signature · 1 line
2.18.1
#1 lore raw

23/07/2021 14:43, Jiawei Wang:

Quoted 1 line

Due to hardware limitations, the decap action can't follow the

Which decap action? Pleas be more specific.

Quoted 3 lines

sample action in the same flow, to keep the original action order of sample and decap actions the flow was internally split by PMD, and decap action was moved into suffix subflow in the new table.

"the" new table? which one?

Was there an issue? Above seems to say all is fine.

Quoted 3 lines

There is a specific combination of raw decap and raw encap actions to specify "L3 encapsulation" packet transformation - raw decap action to remove L2 header and raw encap to add the tunnel header.

Is this combination the problem? It was not working before this patch? Please describe what happened.

Quoted 5 lines

This specific L3 encapsulation is encoded as a single packet reformat hardware transaction and is supported by hardware after sample action (no hardware limitations for packet reformat).

The patch checks whether the decap action is the part of "L3 encapsulation"

I think you mean "is part of".

Quoted 7 lines

and does not move the decap action into suffix subflow for the case.

Fixes cafd87f62a06 ("net/mlx5: fix VLAN push/pop and decap actions with mirror")
#2 lore raw

Hello,

Quoted 10 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, July 23, 2021 8:57 PM
To: Slava Ovsiienko <[email protected]>; Jiawei(Jonny) Wang <[email protected]>
Cc: Matan Azrad <[email protected]>; Ori Kam <[email protected]>; Shahaf Shuler <[email protected]>; [email protected]; Raslan Darawsheh <[email protected]>; [email protected]
Subject: Re: [PATCH] net/mlx5: fix mirror flow split with L3 encapsulation

Quoted 4 lines

23/07/2021 14:43, Jiawei Wang:

Quoted 1 line

Due to hardware limitations, the decap action can't follow the

Which decap action? Pleas be more specific.

All of decap, vxlan_decap, nvgre_decap and raw_decap. Will update details.

Quoted 6 lines
Quoted 4 lines

sample action in the same flow, to keep the original action order of sample and decap actions the flow was internally split by PMD, and decap action was moved into suffix subflow in the new table.

"the" new table? which one?

" sample and decap actions the flow was internally split by PMD, " means
that PMD split internally into two flows:prefix subflow with sample action in original table; suffix subflow with decap action in the new table;

Quoted 3 lines

Was there an issue? Above seems to say all is fine.

The issue is mentioned below that 'L3 encapsulation' case (raw_decap+raw_encap), the previous code not consier the combination decap/encap case.
And under this case flow don't need split.

Quoted 7 lines
Quoted 3 lines

There is a specific combination of raw decap and raw encap actions to specify "L3 encapsulation" packet transformation - raw decap action to remove L2 header and raw encap to add the tunnel header.

Is this combination the problem? It was not working before this patch? Please describe what happened.

L3 encap is working without sample action or sample is working without L3 encap;

Quoted 8 lines
Quoted 5 lines

This specific L3 encapsulation is encoded as a single packet reformat hardware transaction and is supported by hardware after sample action (no hardware limitations for packet reformat).

The patch checks whether the decap action is the part of "L3

encapsulation"

I think you mean "is part of".

Thanks, will fix in new version.

Quoted 11 lines
Quoted 9 lines

and does not move the decap action into suffix subflow for the case.

Fixes cafd87f62a06 ("net/mlx5: fix VLAN push/pop and decap actions

with mirror")
Cc: [email protected]

Thanks.

#3 lore raw

23/07/2021 16:01, Jiawei(Jonny) Wang:

Quoted 34 lines

Hello,

From: Thomas Monjalon <[email protected]>

Quoted 4 lines

23/07/2021 14:43, Jiawei Wang:

Quoted 1 line

Due to hardware limitations, the decap action can't follow the

Which decap action? Pleas be more specific.

All of decap, vxlan_decap, nvgre_decap and raw_decap. Will update details.

Quoted 6 lines
Quoted 4 lines

sample action in the same flow, to keep the original action order of sample and decap actions the flow was internally split by PMD, and decap action was moved into suffix subflow in the new table.

"the" new table? which one?

" sample and decap actions the flow was internally split by PMD, " means
that PMD split internally into two flows:prefix subflow with sample action in original table; suffix subflow with decap action in the new table;

Quoted 3 lines

Was there an issue? Above seems to say all is fine.

The issue is mentioned below that 'L3 encapsulation' case (raw_decap+raw_encap), the previous code not consier the combination decap/encap case.
And under this case flow don't need split.

Quoted 4 lines
Quoted 3 lines

There is a specific combination of raw decap and raw encap actions to specify "L3 encapsulation" packet transformation - raw decap action to remove L2 header and raw encap to add the tunnel header.

Quoted 5 lines
Quoted 3 lines

Is this combination the problem? It was not working before this patch? Please describe what happened.

L3 encap is working without sample action or sample is working without L3 encap;

OK please be more explicit in the next version.

Quoted 20 lines
Quoted 8 lines
Quoted 5 lines

This specific L3 encapsulation is encoded as a single packet reformat hardware transaction and is supported by hardware after sample action (no hardware limitations for packet reformat).

The patch checks whether the decap action is the part of "L3

encapsulation"

I think you mean "is part of".

Thanks, will fix in new version.

Quoted 9 lines
Quoted 9 lines

and does not move the decap action into suffix subflow for the case.

Fixes cafd87f62a06 ("net/mlx5: fix VLAN push/pop and decap actions

with mirror")
Cc: [email protected]

#4 lore raw
Quoted 49 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, July 23, 2021 10:10 PM
To: Slava Ovsiienko <[email protected]>; Jiawei(Jonny) Wang <[email protected]>
Cc: Matan Azrad <[email protected]>; Ori Kam <[email protected]>; Shahaf Shuler <[email protected]>; [email protected]; Raslan Darawsheh <[email protected]>; [email protected]
Subject: Re: [PATCH] net/mlx5: fix mirror flow split with L3 encapsulation

23/07/2021 16:01, Jiawei(Jonny) Wang:

Quoted 24 lines

Hello,

From: Thomas Monjalon <[email protected]>

Quoted 4 lines

23/07/2021 14:43, Jiawei Wang:

Quoted 1 line

Due to hardware limitations, the decap action can't follow the

Which decap action? Pleas be more specific.

All of decap, vxlan_decap, nvgre_decap and raw_decap. Will update details.

Quoted 6 lines
Quoted 4 lines

sample action in the same flow, to keep the original action order of sample and decap actions the flow was internally split by PMD, and decap action was moved into suffix subflow in the new table.

"the" new table? which one?

" sample and decap actions the flow was internally split by PMD, " means that PMD split internally into two flows:prefix subflow with sample action in original table; suffix subflow with decap action in the new table;

Quoted 1 line
Quoted 5 lines
Quoted 2 lines

Was there an issue? Above seems to say all is fine.

The issue is mentioned below that 'L3 encapsulation' case (raw_decap+raw_encap), the previous code not consier the combination

decap/encap case.

Quoted 6 lines

And under this case flow don't need split.

Quoted 4 lines
Quoted 3 lines

There is a specific combination of raw decap and raw encap actions to specify "L3 encapsulation" packet transformation - raw decap action to remove L2 header and raw encap to add the tunnel header.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

Is this combination the problem? It was not working before this patch? Please describe what happened.

L3 encap is working without sample action or sample is working without L3 encap;

OK please be more explicit in the next version.

The v2 patch is ready, https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
Please help to review, and Thanks your comments.

Quoted 22 lines
Quoted 20 lines
Quoted 8 lines
Quoted 5 lines

This specific L3 encapsulation is encoded as a single packet reformat hardware transaction and is supported by hardware after sample action (no hardware limitations for packet reformat).

The patch checks whether the decap action is the part of "L3

encapsulation"

I think you mean "is part of".

Thanks, will fix in new version.

Quoted 9 lines
Quoted 9 lines

and does not move the decap action into suffix subflow for the case.

Fixes cafd87f62a06 ("net/mlx5: fix VLAN push/pop and decap

actions with mirror")
Cc: [email protected]

#5 lore raw

PATCH v2 1/1 net/mlx5: fix mirror flow split with L3 encapsulation

In reply to Jiawei Wang

Due to hardware limitations, the decap action (such as VXLAN/NVGRE/RAW decap) can't follow the sample action in the same flow, to keep the original action order of sample and decap actions the flow was internally split into two subflows by PMD, the sample action was moved into prefix subflow in the original table, and decap action was moved into suffix subflow in the new table.

There is a specific combination of raw decap and raw encap actions to specify "L3 encapsulation" packet transformation - raw decap action to remove L2 header and raw encap to add the tunnel header. This specific L3 encapsulation is encoded as a single packet reformat hardware transaction and is supported by hardware after sample action (no hardware limitations for packet reformat).

The "L3 encapsulation" with mirror actions in the same flow was not handled correctly in the previous commit.
The patch checks whether the decap action is part of "L3 encapsulation" and does not move the decap action into suffix subflow for the case.

Fixes cafd87f62a06 ("net/mlx5: fix VLAN push/pop and decap actions with mirror")

---
v2: update commit log

---
 drivers/net/mlx5/mlx5_flow.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.c +19 -1
index a3fdce685e..3200a306e9 100644
@@ -5259,6 +5259,7 @@ flow_check_match_action(const struct rte_flow_action actions[],
 			int *modify_after_mirror)
 {
 	const struct rte_flow_action_sample *sample;
+	const struct rte_flow_action_raw_decap *decap;
 	int actions_n = 0;
 	uint32_t ratio = 0;
 	int sub_type = 0;
@@ -5311,12 +5312,29 @@ flow_check_match_action(const struct rte_flow_action actions[],
 		case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP:
 		case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP:
 		case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP:
-		case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
 		case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD:
 		case RTE_FLOW_ACTION_TYPE_METER:
 			if (fdb_mirror)
 				*modify_after_mirror = 1;
 			break;
+		case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
+			decap = actions->conf;
+			while ((++actions)->type == RTE_FLOW_ACTION_TYPE_VOID)
+				;
+			actions_n++;
+			if (actions->type == RTE_FLOW_ACTION_TYPE_RAW_ENCAP) {
+				const struct rte_flow_action_raw_encap *encap =
+								actions->conf;
+				if (decap->size <=
+					MLX5_ENCAPSULATION_DECISION_SIZE &&
+				    encap->size >
+					MLX5_ENCAPSULATION_DECISION_SIZE)
+					/* L3 encap. */
+					break;
+			}
+			if (fdb_mirror)
+				*modify_after_mirror = 1;
+			break;
 		default:
 			break;
 		}
Signature · 1 line
2.18.1
#6 lore raw

Hi,

Quoted 30 lines

-----Original Message-----
From: Jiawei(Jonny) Wang <[email protected]>
Sent: Monday, July 26, 2021 9:23 AM
To: Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Ori Kam <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Shahaf Shuler <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; [email protected]
Subject: [PATCH v2] net/mlx5: fix mirror flow split with L3 encapsulation

Due to hardware limitations, the decap action (such as VXLAN/NVGRE/RAW decap) can't follow the sample action in the same flow, to keep the original action order of sample and decap actions the flow was internally split into two subflows by PMD, the sample action was moved into prefix subflow in the original table, and decap action was moved into suffix subflow in the new table.

There is a specific combination of raw decap and raw encap actions to specify "L3 encapsulation" packet transformation - raw decap action to remove L2 header and raw encap to add the tunnel header. This specific L3 encapsulation is encoded as a single packet reformat hardware transaction and is supported by hardware after sample action (no hardware limitations for packet reformat).

The "L3 encapsulation" with mirror actions in the same flow was not handled correctly in the previous commit.
The patch checks whether the decap action is part of "L3 encapsulation" and does not move the decap action into suffix subflow for the case.

Fixes cafd87f62a06 ("net/mlx5: fix VLAN push/pop and decap actions with
Quoted 8 lines

mirror")
Cc: [email protected]

---
v2: update commit log
---

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh