From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 13800A0A0C for ; Fri, 9 Apr 2021 14:36:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 04EE5140F7E; Fri, 9 Apr 2021 14:36:47 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id 793F4140F6B for ; Fri, 9 Apr 2021 14:36:44 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from jiaweiw@nvidia.com) with SMTP; 9 Apr 2021 15:36:43 +0300 Received: from nvidia.com (gen-l-vrt-281.mtl.labs.mlnx [10.237.44.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 139Cahwl006483; Fri, 9 Apr 2021 15:36:43 +0300 From: Jiawei Wang To: Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , Jiawei Wang Cc: dev@dpdk.org, stable@dpdk.org Date: Fri, 9 Apr 2021 15:36:42 +0300 Message-Id: <1617971803-90141-1-git-send-email-jiaweiw@nvidia.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-stable] [PATCH] net/mlx5: fix VLAN/DECAP actions not work in mirror flow X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 --- drivers/net/mlx5/mlx5_flow.c | 8 ++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+) 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; -- 1.8.3.1