diff mbox series

net/mlx5: fix VLAN/DECAP actions not work in mirror flow

Message ID 1617971803-90141-1-git-send-email-jiaweiw@nvidia.com (mailing list archive)
State Accepted
Delegated to: Raslan Darawsheh
Headers show
Series net/mlx5: fix VLAN/DECAP actions not work in mirror flow | expand

Checks

Context Check Description
ci/intel-Testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot success travis build: passed
ci/checkpatch success coding style OK

Commit Message

Jiawei Wang April 9, 2021, 12:36 p.m. UTC
Due to hardware limitations the VLAN push/pop and Decap actions following
the sample action are supported in the FDB Tx steering domain only, the
flows with incorrect action order for other domains are rejected by
rdma-core.

To provide the action order requested in RTE flow this patch checks for
the VLAN or Decap precedence to the sample action and moves the VLAN or
Decap actions into the next flow in the new table and adds the jump
action in the prefix sample flow.

This patch also adds the validation for these combination actions.

Fixes: 255b8f86eb6e ("net/mlx5: fix E-Switch egress mirror flow validation")
Cc: stable@dpdk.org

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c    |  8 ++++++++
 drivers/net/mlx5/mlx5_flow_dv.c | 15 +++++++++++++++
 2 files changed, 23 insertions(+)

Comments

Slava Ovsiienko April 12, 2021, 6:37 a.m. UTC | #1
> -----Original Message-----
> From: Jiawei Wang <jiaweiw@nvidia.com>
> Sent: Friday, April 9, 2021 15:37
> To: Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> Jiawei(Jonny) Wang <jiaweiw@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix VLAN/DECAP actions not work in mirror flow
> 
> Due to hardware limitations the VLAN push/pop and Decap actions following
> the sample action are supported in the FDB Tx steering domain only, the
> flows with incorrect action order for other domains are rejected by rdma-
> core.
> 
> To provide the action order requested in RTE flow this patch checks for the
> VLAN or Decap precedence to the sample action and moves the VLAN or
> Decap actions into the next flow in the new table and adds the jump action in
> the prefix sample flow.
> 
> This patch also adds the validation for these combination actions.
> 
> Fixes: 255b8f86eb6e ("net/mlx5: fix E-Switch egress mirror flow validation")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Raslan Darawsheh April 19, 2021, 12:26 p.m. UTC | #2
Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Jiawei Wang
> Sent: Friday, April 9, 2021 3:37 PM
> To: Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> Jiawei(Jonny) Wang <jiaweiw@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix VLAN/DECAP actions not work in
> mirror flow
> 
> Due to hardware limitations the VLAN push/pop and Decap actions following
> the sample action are supported in the FDB Tx steering domain only, the
> flows with incorrect action order for other domains are rejected by
> rdma-core.
> 
> To provide the action order requested in RTE flow this patch checks for
> the VLAN or Decap precedence to the sample action and moves the VLAN or
> Decap actions into the next flow in the new table and adds the jump
> action in the prefix sample flow.
> 
> This patch also adds the validation for these combination actions.
> 
> Fixes: 255b8f86eb6e ("net/mlx5: fix E-Switch egress mirror flow validation")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> ---
Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
diff mbox series

Patch

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index c347f81..2140ee3 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -4759,6 +4759,14 @@  struct mlx5_hlist_entry *
 		case RTE_FLOW_ACTION_TYPE_MARK:
 		case RTE_FLOW_ACTION_TYPE_SET_META:
 		case RTE_FLOW_ACTION_TYPE_SET_TAG:
+		case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN:
+		case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
+		case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID:
+		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:
 			if (fdb_mirror)
 				*modify_after_mirror = 1;
 			break;
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 1818895..989fdde 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -6589,6 +6589,8 @@  struct mlx5_hlist_entry *
 							     item_flags, attr,
 							     error))
 				return -rte_errno;
+			if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
+				modify_after_mirror = 1;
 			action_flags |= MLX5_FLOW_ACTION_OF_POP_VLAN;
 			++actions_n;
 			break;
@@ -6600,6 +6602,8 @@  struct mlx5_hlist_entry *
 								error);
 			if (ret < 0)
 				return ret;
+			if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
+				modify_after_mirror = 1;
 			action_flags |= MLX5_FLOW_ACTION_OF_PUSH_VLAN;
 			++actions_n;
 			break;
@@ -6608,6 +6612,8 @@  struct mlx5_hlist_entry *
 						(action_flags, actions, error);
 			if (ret < 0)
 				return ret;
+			if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
+				modify_after_mirror = 1;
 			/* Count PCP with push_vlan command. */
 			action_flags |= MLX5_FLOW_ACTION_OF_SET_VLAN_PCP;
 			break;
@@ -6617,6 +6623,8 @@  struct mlx5_hlist_entry *
 						 actions, error);
 			if (ret < 0)
 				return ret;
+			if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
+				modify_after_mirror = 1;
 			/* Count VID with push_vlan command. */
 			action_flags |= MLX5_FLOW_ACTION_OF_SET_VLAN_VID;
 			rw_act_num += MLX5_ACT_NUM_MDF_VID;
@@ -6639,6 +6647,8 @@  struct mlx5_hlist_entry *
 							    attr, error);
 			if (ret < 0)
 				return ret;
+			if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
+				modify_after_mirror = 1;
 			action_flags |= MLX5_FLOW_ACTION_DECAP;
 			++actions_n;
 			break;
@@ -6666,6 +6676,9 @@  struct mlx5_hlist_entry *
 					    actions, item_flags, error);
 			if (ret < 0)
 				return ret;
+			if ((action_flags & MLX5_FLOW_ACTION_SAMPLE) &&
+			    (action_flags & MLX5_FLOW_ACTION_DECAP))
+				modify_after_mirror = 1;
 			break;
 		case RTE_FLOW_ACTION_TYPE_SET_MAC_SRC:
 		case RTE_FLOW_ACTION_TYPE_SET_MAC_DST:
@@ -6949,6 +6962,8 @@  struct mlx5_hlist_entry *
 								   error);
 			if (ret < 0)
 				return ret;
+			if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
+				modify_after_mirror = 1;
 			/* Count all modify-header actions as one action. */
 			if (!(action_flags & MLX5_FLOW_ACTION_MODIFY_FIELD))
 				++actions_n;