DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] net/mlx5: fix metadata and meter split shared tag
@ 2021-11-19 13:02 Jiawei Wang
  2021-11-19 13:02 ` [PATCH 2/2] net/mlx5: fix the mismatch metadata flow with meter action Jiawei Wang
  2021-11-21 14:38 ` [PATCH 1/2] net/mlx5: fix metadata and meter split shared tag Raslan Darawsheh
  0 siblings, 2 replies; 3+ messages in thread
From: Jiawei Wang @ 2021-11-19 13:02 UTC (permalink / raw)
  To: viacheslavo, matan, orika, Suanming Mou; +Cc: dev, rasland, stable

In the metadata flow split, PMD created the prefix subflow
with removed Queue or RSS action and appended the set tag and
copy table jump actions. If the flow being split for metadata
was the meter prefix subflow, the driver supposed to share the same
meter split tag action for the metadata split flow. There was the wrong
check for preceding meter split tag action, causing append with metadata
split set tag action and resulting the meter suffix subflow was missed
due to tag value mismatch.

This patch adds the checking before copying into extend action list,
to make sure the correct shared tag is used.

Fixes: 8d72fa668964 ("net/mlx5: share tag between meter and metadata")
Cc: stable@dpdk.org

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 43598f92ee..84e6f3048c 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -5251,6 +5251,8 @@ flow_meter_split_prep(struct rte_eth_dev *dev,
  *   Pointer to the Q/RSS action.
  * @param[in] actions_n
  *   Number of original actions.
+ * @param[in] mtr_sfx
+ *   Check if it is in meter suffix table.
  * @param[out] error
  *   Perform verbose error reporting if not NULL.
  *
@@ -5263,7 +5265,8 @@ flow_mreg_split_qrss_prep(struct rte_eth_dev *dev,
 			  struct rte_flow_action *split_actions,
 			  const struct rte_flow_action *actions,
 			  const struct rte_flow_action *qrss,
-			  int actions_n, struct rte_flow_error *error)
+			  int actions_n, int mtr_sfx,
+			  struct rte_flow_error *error)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	struct mlx5_rte_flow_action_set_tag *set_tag;
@@ -5278,15 +5281,15 @@ flow_mreg_split_qrss_prep(struct rte_eth_dev *dev,
 	 * - Add jump to mreg CP_TBL.
 	 * As a result, there will be one more action.
 	 */
-	++actions_n;
 	memcpy(split_actions, actions, sizeof(*split_actions) * actions_n);
+	/* Count MLX5_RTE_FLOW_ACTION_TYPE_TAG. */
+	++actions_n;
 	set_tag = (void *)(split_actions + actions_n);
 	/*
-	 * If tag action is not set to void(it means we are not the meter
-	 * suffix flow), add the tag action. Since meter suffix flow already
-	 * has the tag added.
+	 * If we are not the meter suffix flow, add the tag action.
+	 * Since meter suffix flow already has the tag added.
 	 */
-	if (split_actions[qrss_idx].type != RTE_FLOW_ACTION_TYPE_VOID) {
+	if (!mtr_sfx) {
 		/*
 		 * Allocate the new subflow ID. This one is unique within
 		 * device and not shared with representors. Otherwise,
@@ -5319,6 +5322,12 @@ flow_mreg_split_qrss_prep(struct rte_eth_dev *dev,
 				MLX5_RTE_FLOW_ACTION_TYPE_TAG,
 			.conf = set_tag,
 		};
+	} else {
+		/*
+		 * If we are the suffix flow of meter, tag already exist.
+		 * Set the QUEUE/RSS action to void.
+		 */
+		split_actions[qrss_idx].type = RTE_FLOW_ACTION_TYPE_VOID;
 	}
 	/* JUMP action to jump to mreg copy table (CP_TBL). */
 	jump = (void *)(set_tag + 1);
@@ -5773,17 +5782,6 @@ flow_create_split_metadata(struct rte_eth_dev *dev,
 						  RTE_FLOW_ERROR_TYPE_ACTION,
 						  NULL, "no memory to split "
 						  "metadata flow");
-		/*
-		 * If we are the suffix flow of meter, tag already exist.
-		 * Set the tag action to void.
-		 */
-		if (mtr_sfx)
-			ext_actions[qrss - actions].type =
-						RTE_FLOW_ACTION_TYPE_VOID;
-		else
-			ext_actions[qrss - actions].type =
-						(enum rte_flow_action_type)
-						MLX5_RTE_FLOW_ACTION_TYPE_TAG;
 		/*
 		 * Create the new actions list with removed Q/RSS action
 		 * and appended set tag and jump to register copy table
@@ -5791,7 +5789,8 @@ flow_create_split_metadata(struct rte_eth_dev *dev,
 		 * in advance, because it is needed for set tag action.
 		 */
 		qrss_id = flow_mreg_split_qrss_prep(dev, ext_actions, actions,
-						    qrss, actions_n, error);
+						    qrss, actions_n,
+						    mtr_sfx, error);
 		if (!mtr_sfx && !qrss_id) {
 			ret = -rte_errno;
 			goto exit;
-- 
2.18.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] net/mlx5: fix the mismatch metadata flow with meter action
  2021-11-19 13:02 [PATCH 1/2] net/mlx5: fix metadata and meter split shared tag Jiawei Wang
@ 2021-11-19 13:02 ` Jiawei Wang
  2021-11-21 14:38 ` [PATCH 1/2] net/mlx5: fix metadata and meter split shared tag Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Jiawei Wang @ 2021-11-19 13:02 UTC (permalink / raw)
  To: viacheslavo, matan, orika, Shun Hao; +Cc: dev, rasland, stable

The mlx5 PMD introduced the table id attribute to allow multiple
flow tables on the same table level for flow metering, there can be
multiple flow table objects with the same table level but different
table ids.

If the extended metadata mode is enabled, all flows containing
destination Queue/RSS actions are split into two subflows - prefix one
jumps to the MLX5_FLOW_MREG_CP_TABLE_GROUP flow table to copy
MARK action data, and suffix one to perform the destination Queue/RSS
action. The table_id for the jump in the metadata split prefix flow
is always 0.

If flow itself was the metering split suffix subflow the table id was
set to 1 in the flow split structure and the metadata split suffix
subflow was created in the table with wrong table id, causing the
metadata suffix flow mismatch.

This patch resets the table id to 0 while creating the metadata
suffix flows.

Fixes: 51ec04dc7bcf ("net/mlx5: connect meter policy to created flows")
Cc: stable@dpdk.org

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 84e6f3048c..a30ce695aa 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -5881,6 +5881,7 @@ flow_create_split_metadata(struct rte_eth_dev *dev,
 		/* Add suffix subflow to execute Q/RSS. */
 		flow_split_info->prefix_layers = layers;
 		flow_split_info->prefix_mark = 0;
+		flow_split_info->table_id = 0;
 		ret = flow_create_split_inner(dev, flow, &dev_flow,
 					      &q_attr, mtr_sfx ? items :
 					      q_items, q_actions,
-- 
2.18.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH 1/2] net/mlx5: fix metadata and meter split shared tag
  2021-11-19 13:02 [PATCH 1/2] net/mlx5: fix metadata and meter split shared tag Jiawei Wang
  2021-11-19 13:02 ` [PATCH 2/2] net/mlx5: fix the mismatch metadata flow with meter action Jiawei Wang
@ 2021-11-21 14:38 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2021-11-21 14:38 UTC (permalink / raw)
  To: Jiawei(Jonny) Wang, Slava Ovsiienko, Matan Azrad, Ori Kam, Suanming Mou
  Cc: dev, stable

Hi,

> -----Original Message-----
> From: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>
> Sent: Friday, November 19, 2021 3:02 PM
> To: Slava Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Ori Kam <orika@nvidia.com>; Suanming Mou
> <suanmingm@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH 1/2] net/mlx5: fix metadata and meter split shared tag
> 
> In the metadata flow split, PMD created the prefix subflow
> with removed Queue or RSS action and appended the set tag and
> copy table jump actions. If the flow being split for metadata
> was the meter prefix subflow, the driver supposed to share the same
> meter split tag action for the metadata split flow. There was the wrong
> check for preceding meter split tag action, causing append with metadata
> split set tag action and resulting the meter suffix subflow was missed
> due to tag value mismatch.
> 
> This patch adds the checking before copying into extend action list,
> to make sure the correct shared tag is used.
> 
> Fixes: 8d72fa668964 ("net/mlx5: share tag between meter and metadata")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-21 14:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 13:02 [PATCH 1/2] net/mlx5: fix metadata and meter split shared tag Jiawei Wang
2021-11-19 13:02 ` [PATCH 2/2] net/mlx5: fix the mismatch metadata flow with meter action Jiawei Wang
2021-11-21 14:38 ` [PATCH 1/2] net/mlx5: fix metadata and meter split shared tag Raslan Darawsheh

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).