Skip to content

Commit

Permalink
net/mlx5: fix meter profile delete after disable
Browse files Browse the repository at this point in the history
[ upstream commit 9b7fcf3 ]

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: 63ffeb2 ("net/mlx5: support meter profile update")

Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
  • Loading branch information
Shun-Hao authored and kevintraynor committed Oct 11, 2022
1 parent 9412d61 commit 6a68e9a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/mlx5/mlx5_flow_meter.c
Expand Up @@ -1624,7 +1624,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) {
Expand All @@ -1634,6 +1634,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;
Expand Down

0 comments on commit 6a68e9a

Please sign in to comment.