Skip to contentSkip to conversation

net/mlx5: fix meter profile delete fail

PATCH In review Shun Hao 2 participants 2 messages Sep 18, 2022 – Sep 21, 2022 Network drivers

lore
Share & tools
lore

Shun Hao

author
#0 lore raw

PATCH 1/1 net/mlx5: fix meter profile delete fail

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")
---
 drivers/net/mlx5/mlx5_flow_meter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow_meter.c +2 -1
index 7c0d84907a..d4aafe4eea 100644
@@ -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;
Signature · 1 line
2.20.0
#1 lore raw

Hi,

Quoted 13 lines

-----Original Message-----
From: Shun Hao <[email protected]>
Sent: Sunday, September 18, 2022 3:58 AM
To: Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; [email protected]; Matan Azrad <[email protected]>
Subject: [PATCH v1] net/mlx5: fix meter profile delete fail

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

Quoted 8 lines

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")

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh