[PATCH v4] octeontx2-pf: Add error log forcn10k_map_unmap_rq_policer()

Wentao Liang posted 1 patch 3 weeks, 6 days ago
drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
[PATCH v4] octeontx2-pf: Add error log forcn10k_map_unmap_rq_policer()
Posted by Wentao Liang 3 weeks, 6 days ago
The cn10k_free_matchall_ipolicer() calls the cn10k_map_unmap_rq_policer()
for each queue in a for loop without checking for any errors.

Check the return value of the cn10k_map_unmap_rq_policer() function during
each loop, and report a warning if the function fails.

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
v4: Add brackets for loop
v3: Add failed queue number and error code to log.
v2: Fix error code

 drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
index a15cc86635d6..ff5bb71d67fd 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
@@ -352,9 +352,12 @@ int cn10k_free_matchall_ipolicer(struct otx2_nic *pfvf)
 	mutex_lock(&pfvf->mbox.lock);
 
 	/* Remove RQ's policer mapping */
-	for (qidx = 0; qidx < hw->rx_queues; qidx++)
-		cn10k_map_unmap_rq_policer(pfvf, qidx,
-					   hw->matchall_ipolicer, false);
+	for (qidx = 0; qidx < hw->rx_queues; qidx++) {
+		rc = cn10k_map_unmap_rq_policer(pfvf, qidx, hw->matchall_ipolicer, false);
+		if (rc)
+			dev_warn(pfvf->dev, "Failed to unmap RQ %d's policer (error %d).",
+				 qidx, rc);
+	}
 
 	rc = cn10k_free_leaf_profile(pfvf, hw->matchall_ipolicer);
 
-- 
2.42.0.windows.2
Re: [PATCH v4] octeontx2-pf: Add error log forcn10k_map_unmap_rq_policer()
Posted by Simon Horman 3 weeks, 4 days ago
On Tue, Apr 08, 2025 at 11:26:02AM +0800, Wentao Liang wrote:
> The cn10k_free_matchall_ipolicer() calls the cn10k_map_unmap_rq_policer()
> for each queue in a for loop without checking for any errors.
> 
> Check the return value of the cn10k_map_unmap_rq_policer() function during
> each loop, and report a warning if the function fails.
> 
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> v4: Add brackets for loop
> v3: Add failed queue number and error code to log.
> v2: Fix error code

Thanks for the updates.

Reviewed-by: Simon Horman <horms@kernel.org>