DPDK patches and discussions
 help / color / mirror / Atom feed
From: Li Zhang <lizh@nvidia.com>
To: <orika@nvidia.com>, <viacheslavo@nvidia.com>, <matan@nvidia.com>,
	<thomas@monjalon.net>
Cc: <dev@dpdk.org>, <rasland@nvidia.com>, <asafp@nvidia.com>,
	<stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] net/mlx5: fix meter policy creation error flow
Date: Wed, 9 Jun 2021 05:07:11 +0300	[thread overview]
Message-ID: <20210609020711.7339-1-lizh@nvidia.com> (raw)

When an error appears in the policy creation,
the IDs mapping between the user policy ID to
the driver policy ID is skipped.

Wrongly, the driver tried to clean the mapping in
this case what caused an error.

Skip the clearance in this case.

Fixes: afb4aa4f122 ("net/mlx5: support meter policy operations")
Cc: stable@dpdk.org

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_meter.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c
index 16991748dc..d7ce5cd2f6 100644
--- a/drivers/net/mlx5/mlx5_flow_meter.c
+++ b/drivers/net/mlx5/mlx5_flow_meter.c
@@ -559,7 +559,8 @@ static int
 __mlx5_flow_meter_policy_delete(struct rte_eth_dev *dev,
 			uint32_t policy_id,
 			struct mlx5_flow_meter_policy *mtr_policy,
-			struct rte_mtr_error *error)
+			struct rte_mtr_error *error,
+			bool clear_l3t)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	struct mlx5_flow_meter_sub_policy *sub_policy;
@@ -590,7 +591,7 @@ __mlx5_flow_meter_policy_delete(struct rte_eth_dev *dev,
 			}
 		}
 	}
-	if (priv->sh->mtrmng->policy_idx_tbl) {
+	if (priv->sh->mtrmng->policy_idx_tbl && clear_l3t) {
 		if (mlx5_l3t_clear_entry(priv->sh->mtrmng->policy_idx_tbl,
 					policy_id)) {
 			rte_spinlock_unlock(&mtr_policy->sl);
@@ -768,7 +769,7 @@ mlx5_flow_meter_policy_add(struct rte_eth_dev *dev,
 policy_add_err:
 	if (mtr_policy) {
 		ret = __mlx5_flow_meter_policy_delete(dev, policy_id,
-			mtr_policy, error);
+			mtr_policy, error, false);
 		mlx5_free(mtr_policy);
 		if (ret)
 			return ret;
@@ -815,7 +816,7 @@ mlx5_flow_meter_policy_delete(struct rte_eth_dev *dev,
 			RTE_MTR_ERROR_TYPE_METER_POLICY_ID, NULL,
 			"Meter policy id is invalid. ");
 	ret = __mlx5_flow_meter_policy_delete(dev, policy_id, mtr_policy,
-						error);
+						error, true);
 	if (ret)
 		return ret;
 	mlx5_free(mtr_policy);
@@ -1909,7 +1910,7 @@ mlx5_flow_meter_flush(struct rte_eth_dev *dev, struct rte_mtr_error *error)
 						"meter policy invalid.");
 			if (__mlx5_flow_meter_policy_delete(dev, i,
 						sub_policy->main_policy,
-						error))
+						error, true))
 				return -rte_mtr_error_set(error,
 						EINVAL,
 					RTE_MTR_ERROR_TYPE_METER_POLICY_ID,
-- 
2.27.0


             reply	other threads:[~2021-06-09  2:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09  2:07 Li Zhang [this message]
2021-06-09 13:08 ` 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=20210609020711.7339-1-lizh@nvidia.com \
    --to=lizh@nvidia.com \
    --cc=asafp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@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).