DPDK patches and discussions
 help / color / mirror / Atom feed
From: Suanming Mou <suanmingm@mellanox.com>
To: viacheslavo@mellanox.com, matan@mellanox.com
Cc: dev@dpdk.org, rasland@mellanox.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH 1/2] net/mlx5: fix layer flags missing in metadata
Date: Wed, 19 Feb 2020 16:31:03 +0200	[thread overview]
Message-ID: <1582122664-54731-2-git-send-email-suanmingm@mellanox.com> (raw)
In-Reply-To: <1582122664-54731-1-git-send-email-suanmingm@mellanox.com>

Metadata suffix subflow inherits the RSS needed hash_fields from the
prefix subflow as the suffix subflow only has the tag match item unable
to generate the full original hash_fields for RSS action.

Unfortunately, hash_fields will only be generated if flow has RSS action.
So it means the prefix flow won't generate the hash_fields as the RSS
action has been split to the suffix flow.

Copy the layer flags from prefix subflow to suffix subflow to help the
suffix subflow to generate the correct hash_fields itself.

Fixes: 71e254bc0294 ("net/mlx5: split Rx flows to provide metadata copy")
Cc: viacheslavo@mellanox.com
Cc: stable@dpdk.org

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c    | 27 +++++++++++++++++----------
 drivers/net/mlx5/mlx5_flow_dv.c |  2 +-
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 2548201..2f57759 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3406,6 +3406,8 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
  *   Parent flow structure pointer.
  * @param[in, out] sub_flow
  *   Pointer to return the created subflow, may be NULL.
+ * @param[in] prefix_flow
+ *   Pointer to the created prefix subflow, may be NULL.
  * @param[in] attr
  *   Flow rule attributes.
  * @param[in] items
@@ -3423,6 +3425,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 flow_create_split_inner(struct rte_eth_dev *dev,
 			struct rte_flow *flow,
 			struct mlx5_flow **sub_flow,
+			struct mlx5_flow *prefix_flow,
 			const struct rte_flow_attr *attr,
 			const struct rte_flow_item items[],
 			const struct rte_flow_action actions[],
@@ -3437,6 +3440,8 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 	dev_flow->external = external;
 	/* Subflow object was created, we must include one in the list. */
 	LIST_INSERT_HEAD(&flow->dev_flows, dev_flow, next);
+	if (prefix_flow)
+		dev_flow->layers = prefix_flow->layers;
 	if (sub_flow)
 		*sub_flow = dev_flow;
 	return flow_drv_translate(dev, dev_flow, attr, items, actions, error);
@@ -3768,8 +3773,9 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 	if (!config->dv_flow_en ||
 	    config->dv_xmeta_en == MLX5_XMETA_MODE_LEGACY ||
 	    !mlx5_flow_ext_mreg_supported(dev))
-		return flow_create_split_inner(dev, flow, NULL, attr, items,
-					       actions, external, error);
+		return flow_create_split_inner(dev, flow, NULL, NULL,
+					       attr, items, actions, external,
+					       error);
 	actions_n = flow_parse_qrss_action(actions, &qrss);
 	if (qrss) {
 		/* Exclude hairpin flows from splitting. */
@@ -3850,9 +3856,9 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 			goto exit;
 	}
 	/* Add the unmodified original or prefix subflow. */
-	ret = flow_create_split_inner(dev, flow, &dev_flow, attr, items,
-				      ext_actions ? ext_actions : actions,
-				      external, error);
+	ret = flow_create_split_inner(dev, flow, &dev_flow, NULL, attr,
+				      items, ext_actions ? ext_actions :
+				      actions, external, error);
 	if (ret < 0)
 		goto exit;
 	MLX5_ASSERT(dev_flow);
@@ -3886,7 +3892,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 				.type = RTE_FLOW_ACTION_TYPE_END,
 			},
 		};
-		uint64_t hash_fields = dev_flow->hash_fields;
+		struct mlx5_flow *prefix_flow;
 
 		/*
 		 * Configure the tag item only if there is no meter subflow.
@@ -3911,16 +3917,16 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 				goto exit;
 			q_tag_spec.id = ret;
 		}
+		prefix_flow = dev_flow;
 		dev_flow = NULL;
 		/* Add suffix subflow to execute Q/RSS. */
-		ret = flow_create_split_inner(dev, flow, &dev_flow,
+		ret = flow_create_split_inner(dev, flow, &dev_flow, prefix_flow,
 					      &q_attr, mtr_sfx ? items :
 					      q_items, q_actions,
 					      external, error);
 		if (ret < 0)
 			goto exit;
 		MLX5_ASSERT(dev_flow);
-		dev_flow->hash_fields = hash_fields;
 	}
 
 exit:
@@ -4009,8 +4015,9 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 			goto exit;
 		}
 		/* Add the prefix subflow. */
-		ret = flow_create_split_inner(dev, flow, &dev_flow, attr, items,
-						  pre_actions, external, error);
+		ret = flow_create_split_inner(dev, flow, &dev_flow, NULL, attr,
+					      items, pre_actions, external,
+					      error);
 		if (ret) {
 			ret = -rte_errno;
 			goto exit;
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index d038f7b..c958fca 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7813,7 +7813,7 @@ struct field_modify_info modify_tcp[] = {
 	MLX5_ASSERT(!flow_dv_check_valid_spec(matcher.mask.buf,
 					      dev_flow->dv.value.buf));
 #endif
-	dev_flow->layers = item_flags;
+	dev_flow->layers |= item_flags;
 	if (action_flags & MLX5_FLOW_ACTION_RSS)
 		flow_dv_hashfields_set(dev_flow);
 	/* Register matcher. */
-- 
1.8.3.1


  reply	other threads:[~2020-02-19 14:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 14:31 [dpdk-dev] [PATCH 0/2] net/mlx5: copy the item flags from prefix flow Suanming Mou
2020-02-19 14:31 ` Suanming Mou [this message]
2020-02-19 14:31 ` [dpdk-dev] [PATCH 2/2] net/mlx5: fix lack of match information in meter Suanming Mou
2020-02-19 15:30   ` Matan Azrad
2020-02-20  3:54     ` Suanming Mou
2020-02-20  4:00 ` [dpdk-dev] [PATCH v2 0/2] net/mlx5: copy the item flags from prefix flow Suanming Mou
2020-02-20  4:00   ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: fix layer flags missing in metadata Suanming Mou
2020-02-20  7:40     ` Matan Azrad
2020-02-20  4:00   ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: fix lack of match information in meter Suanming Mou
2020-02-20  7:40     ` Matan Azrad
2020-02-20 12:13 ` [dpdk-dev] [PATCH 0/2] net/mlx5: copy the item flags from prefix flow Raslan Darawsheh
2020-02-20 13:46   ` Raslan Darawsheh
2020-02-20 13:53 ` [dpdk-dev] [PATCH v3 " Suanming Mou
2020-02-20 13:53   ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix layer flags missing in metadata Suanming Mou
2020-02-20 13:53   ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: fix lack of match information in meter Suanming Mou
2020-02-20 15:09   ` [dpdk-dev] [PATCH v3 0/2] net/mlx5: copy the item flags from prefix flow 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=1582122664-54731-2-git-send-email-suanmingm@mellanox.com \
    --to=suanmingm@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=rasland@mellanox.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@mellanox.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).