DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawei Wang <jiaweiw@nvidia.com>
To: viacheslavo@nvidia.com, matan@nvidia.com, orika@nvidia.com
Cc: dev@dpdk.org, rasland@nvidia.com
Subject: [dpdk-dev] [PATCH 3/5] net/mlx5: extend the skip scale flag
Date: Sun, 10 Jan 2021 13:06:52 +0200	[thread overview]
Message-ID: <1610276814-455612-4-git-send-email-jiaweiw@nvidia.com> (raw)
In-Reply-To: <1610276814-455612-1-git-send-email-jiaweiw@nvidia.com>

The sampling feature introduces the scale flow group with factor,
then the scaled table value can be used for the normal path table
due to this table be created implicitly.

But if the input group value already be scaled, for example the
group value of sampling suffix flow, then use 'skip_scale" flag
to skip the scale twice in the translation action.

Consider the flow with jump action and this jump action could be
created implicitly, PMD may only scale the original flow group
value or scale the jump group value or both, so extend the
'skip_scale' flag to two bits:
If bit0 of 'skip_scale' flag is set to 1, then skip the scale the
original flow group;
If bit1 of 'skip_scale' flag is set to 1, then skip the scale the
jump flow group.

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c    |  2 +-
 drivers/net/mlx5/mlx5_flow.h    | 21 ++++++++++++++++++---
 drivers/net/mlx5/mlx5_flow_dv.c |  9 +++++++--
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 217090a..055474b 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -5133,7 +5133,7 @@ struct mlx5_hlist_entry *
 		/* Suffix group level already be scaled with factor, set
 		 * skip_scale to 1 to avoid scale again in translation.
 		 */
-		flow_split_info->skip_scale = 1;
+		flow_split_info->skip_scale = 1 << MLX5_SCALE_FLOW_GROUP_BIT;
 #endif
 	}
 	/* Add the suffix subflow. */
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 18d5cfc..a054ff3 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -755,6 +755,9 @@ struct mlx5_flow_verbs_workspace {
 };
 #endif /* HAVE_INFINIBAND_VERBS_H */
 
+#define MLX5_SCALE_FLOW_GROUP_BIT 0
+#define MLX5_SCALE_JUMP_FLOW_GROUP_BIT 1
+
 /** Maximal number of device sub-flows supported. */
 #define MLX5_NUM_MAX_DEV_FLOWS 32
 
@@ -768,8 +771,20 @@ struct mlx5_flow {
 	/**< Bit-fields of detected actions, see MLX5_FLOW_ACTION_*. */
 	bool external; /**< true if the flow is created external to PMD. */
 	uint8_t ingress:1; /**< 1 if the flow is ingress. */
-	uint8_t skip_scale:1;
-	/**< 1 if skip the scale the table with factor. */
+	uint8_t skip_scale:2;
+	/**
+	 * Each Bit be set to 1 if Skip the scale the flow group with factor.
+	 * If bit0 be set to 1, then skip the scale the original flow group;
+	 * If bit1 be set to 1, then skip the scale the jump flow group if
+	 * having jump action.
+	 * 00: Enable scale in a flow, default value.
+	 * 01: Skip scale the flow group with factor, enable scale the group
+	 * of jump action.
+	 * 10: Enable scale the group with factor, skip scale the group of
+	 * jump action.
+	 * 11: Skip scale the table with factor both for flow group and jump
+	 * group.
+	 */
 	union {
 #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
 		struct mlx5_flow_dv_workspace dv;
@@ -1238,7 +1253,7 @@ struct flow_grp_info {
 	uint64_t fdb_def_rule:1;
 	/* force standard group translation */
 	uint64_t std_tbl_fix:1;
-	uint64_t skip_scale:1;
+	uint64_t skip_scale:2;
 };
 
 static inline bool
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index d82d22e..63569ad 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -9732,7 +9732,8 @@ struct mlx5_cache_entry *
 		.external = !!dev_flow->external,
 		.transfer = !!attr->transfer,
 		.fdb_def_rule = !!priv->fdb_def_rule,
-		.skip_scale = !!dev_flow->skip_scale,
+		.skip_scale = dev_flow->skip_scale &
+			(1 << MLX5_SCALE_FLOW_GROUP_BIT),
 	};
 
 	if (!wks)
@@ -10090,7 +10091,11 @@ struct mlx5_cache_entry *
 			jump_group = ((const struct rte_flow_action_jump *)
 							action->conf)->group;
 			grp_info.std_tbl_fix = 0;
-			grp_info.skip_scale = 0;
+			if (dev_flow->skip_scale &
+				(1 << MLX5_SCALE_JUMP_FLOW_GROUP_BIT))
+				grp_info.skip_scale = 1;
+			else
+				grp_info.skip_scale = 0;
 			ret = mlx5_flow_group_to_table(dev, tunnel,
 						       jump_group,
 						       &table,
-- 
1.8.3.1


  parent reply	other threads:[~2021-01-10 11:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-10 11:06 [dpdk-dev] [PATCH 0/5] Add the E-Switch mirroring and jump supports Jiawei Wang
2021-01-10 11:06 ` [dpdk-dev] [PATCH 1/5] common/mlx5: query register c preserve capability via DevX Jiawei Wang
2021-01-10 11:06 ` [dpdk-dev] [PATCH 2/5] net/mlx5: support E-Switch mirroring and jump in one flow Jiawei Wang
2021-01-10 11:06 ` Jiawei Wang [this message]
2021-01-10 11:06 ` [dpdk-dev] [PATCH 4/5] net/mlx5: supports modify one port in E-Switch mirroring Jiawei Wang
2021-01-10 11:06 ` [dpdk-dev] [PATCH 5/5] doc: update the advanced E-switch mirroring supports Jiawei Wang
2021-01-12 10:29 ` [dpdk-dev] [PATCH v2 0/5] Add the E-Switch mirroring and jump supports Jiawei Wang
2021-01-12 10:29   ` [dpdk-dev] [PATCH v2 1/5] common/mlx5: query register c preserve capability via DevX Jiawei Wang
2021-01-12 10:29   ` [dpdk-dev] [PATCH v2 2/5] net/mlx5: support E-Switch mirroring and jump in one flow Jiawei Wang
2021-01-12 10:29   ` [dpdk-dev] [PATCH v2 3/5] net/mlx5: extend the skip scale flag Jiawei Wang
2021-01-12 10:29   ` [dpdk-dev] [PATCH v2 4/5] net/mlx5: update modify actions support for E-Switch mirror Jiawei Wang
2021-01-12 10:29   ` [dpdk-dev] [PATCH v2 5/5] doc: update the advanced E-switch mirroring supports Jiawei Wang
2021-01-22 12:37     ` Ferruh Yigit
2021-01-20 15:05   ` [dpdk-dev] [PATCH v2 0/5] Add the E-Switch mirroring and jump supports 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=1610276814-455612-4-git-send-email-jiaweiw@nvidia.com \
    --to=jiaweiw@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --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).