net/mlx5: fix meter profile delete after disable

If a meter's profile is changed after meter disabled, there's an issue
that will fail when deleting the old profile.

This patch fixes this by adding the correct process to decrease the old
profile's reference count when changing profile.

Fixes: 63ffeb2ff2 ("net/mlx5: support meter profile update")
Cc: stable@dpdk.org

Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
This commit is contained in:
Shun Hao 2022-09-18 03:58:02 +03:00 committed by Raslan Darawsheh
parent 530dc58073
commit 9b7fcf395c

View File

@ -1656,7 +1656,7 @@ mlx5_flow_meter_profile_update(struct rte_eth_dev *dev,
fm->profile = fmp;
/* Update meter params in HW (if not disabled). */
if (fm->active_state == MLX5_FLOW_METER_DISABLE)
return 0;
goto dec_ref_cnt;
ret = mlx5_flow_meter_action_modify(priv, fm, &fm->profile->srtcm_prm,
modify_bits, fm->active_state, 1);
if (ret) {
@ -1666,6 +1666,7 @@ mlx5_flow_meter_profile_update(struct rte_eth_dev *dev,
NULL, "Failed to update meter"
" parameters in hardware.");
}
dec_ref_cnt:
old_fmp->ref_cnt--;
fmp->ref_cnt++;
return 0;