DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawei Wang <jiaweiw@nvidia.com>
To: Matan Azrad <matan@nvidia.com>,
	Shahaf Shuler <shahafs@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Jiawei 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
Date: Fri,  9 Apr 2021 15:36:42 +0300	[thread overview]
Message-ID: <1617971803-90141-1-git-send-email-jiaweiw@nvidia.com> (raw)

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(+)

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


             reply	other threads:[~2021-04-09 12:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 12:36 Jiawei Wang [this message]
2021-04-12  6:37 ` Slava Ovsiienko
2021-04-19 12:26 ` Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1617971803-90141-1-git-send-email-jiaweiw@nvidia.com \
    --to=jiaweiw@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).