net/mlx5: fix meter policy creation error flow
PATCH 1/1 net/mlx5: fix meter policy creation error flow
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.
--- drivers/net/mlx5/mlx5_flow_meter.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/mlx5/mlx5_flow_meter.c +6 -5
@@ -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,
Signature · 1 line
2.27.0
Hi,
Quoted 16 lines
-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Wednesday, June 9, 2021 5:07 AM
To: Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Asaf Penso <[email protected]>; [email protected]
Subject: [PATCH] net/mlx5: fix meter policy creation error flowWhen 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.
Quoted 7 lines
Skip the clearance in this case.
Fixes afb4aa4f122 ("net/mlx5: support meter policy operations")Signed-off-by Li Zhang <[email protected]>Acked-by Matan Azrad <[email protected]>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh