patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Shun Hao <shunh@nvidia.com>
To: <orika@nvidia.com>, <viacheslavo@nvidia.com>, <matan@nvidia.com>,
	"Shahaf Shuler" <shahafs@nvidia.com>
Cc: <dev@dpdk.org>, <thomas@monjalon.net>, <rasland@nvidia.com>,
	<stable@dpdk.org>
Subject: [dpdk-stable] [PATCH v1 2/2] net/mlx5: fix domains detection in meter hierarchy
Date: Wed, 4 Aug 2021 10:26:47 +0300	[thread overview]
Message-ID: <20210804072647.2077832-3-shunh@nvidia.com> (raw)
In-Reply-To: <20210804072647.2077832-1-shunh@nvidia.com>

Meters in one hierarchy might support different domains. For
example, one meter may support ingress only, but the root meter
can support all the domains.

If the later meter in the meter hierarchy wrongly doesn't inherit
the first meter's domains, it will lead to invalid domain table
access.

Fix is when creating meter hierarchy, try to inherit the first meter
domains in the meter hierarchy.

Fixes: a3b7af90baba ("net/mlx5: validate meter action in policy")
Cc: stable@dpdk.org

Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index f54440c6f5..31d857030f 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -17527,6 +17527,7 @@ flow_dv_validate_policy_mtr_hierarchy(struct rte_eth_dev *dev,
 					RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
 					NULL,
 					"Multiple fate actions not supported.");
+	*hierarchy_domain = 0;
 	while (true) {
 		fm = mlx5_flow_meter_find(priv, meter_id, NULL);
 		if (!fm)
@@ -17539,7 +17540,12 @@ flow_dv_validate_policy_mtr_hierarchy(struct rte_eth_dev *dev,
 			"Non termination meter not supported in hierarchy.");
 		policy = mlx5_flow_meter_policy_find(dev, fm->policy_id, NULL);
 		MLX5_ASSERT(policy);
-		if (!policy->is_hierarchy) {
+		/**
+		 * Only inherit the supported domains of the first meter in
+		 * hierarchy.
+		 * One meter supports at least one domain.
+		 */
+		if (!*hierarchy_domain) {
 			if (policy->transfer)
 				*hierarchy_domain |=
 						MLX5_MTR_DOMAIN_TRANSFER_BIT;
@@ -17548,6 +17554,8 @@ flow_dv_validate_policy_mtr_hierarchy(struct rte_eth_dev *dev,
 						MLX5_MTR_DOMAIN_INGRESS_BIT;
 			if (policy->egress)
 				*hierarchy_domain |= MLX5_MTR_DOMAIN_EGRESS_BIT;
+		}
+		if (!policy->is_hierarchy) {
 			*is_rss = policy->is_rss;
 			break;
 		}
@@ -17825,11 +17833,11 @@ flow_dv_validate_mtr_policy_acts(struct rte_eth_dev *dev,
 			 * so MARK action is only in ingress domain.
 			 */
 			domain_color[i] = MLX5_MTR_DOMAIN_INGRESS_BIT;
-		else if (action_flags[i] &
-			 MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY)
-			domain_color[i] = hierarchy_domain;
 		else
 			domain_color[i] = def_domain;
+		if (action_flags[i] &
+		    MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY)
+			domain_color[i] &= hierarchy_domain;
 		/*
 		 * Non-termination actions only support NIC Tx domain.
 		 * The adjustion should be skipped when there is no
-- 
2.20.0


      parent reply	other threads:[~2021-08-04  7:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210804072647.2077832-1-shunh@nvidia.com>
2021-08-04  7:26 ` [dpdk-stable] [PATCH v1 1/2] net/mlx5: fix meter flow counter traslation Shun Hao
2021-08-04  7:26 ` Shun Hao [this message]

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=20210804072647.2077832-3-shunh@nvidia.com \
    --to=shunh@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --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).