netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] octeontx2-pf: Add error log forcn10k_map_unmap_rq_policer()
@ 2025-04-07  8:11 Wentao Liang
  2025-04-07 10:53 ` Subbaraya Sundeep
  2025-04-07 16:42 ` Simon Horman
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2025-04-07  8:11 UTC (permalink / raw)
  To: sbhatta, sgoutham, gakula, hkelam, andrew+netdev, davem, edumazet,
	kuba, pabeni
  Cc: netdev, linux-kernel, Wentao Liang

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>
---
v3: Add failed queue number and error code to log.
v2: Fix error code

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

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
index a15cc86635d6..9113a9b90002 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
@@ -353,8 +353,10 @@ int cn10k_free_matchall_ipolicer(struct otx2_nic *pfvf)
 
 	/* Remove RQ's policer mapping */
 	for (qidx = 0; qidx < hw->rx_queues; qidx++)
-		cn10k_map_unmap_rq_policer(pfvf, qidx,
-					   hw->matchall_ipolicer, false);
+		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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] octeontx2-pf: Add error log forcn10k_map_unmap_rq_policer()
  2025-04-07  8:11 [PATCH v3] octeontx2-pf: Add error log forcn10k_map_unmap_rq_policer() Wentao Liang
@ 2025-04-07 10:53 ` Subbaraya Sundeep
  2025-04-07 16:42 ` Simon Horman
  1 sibling, 0 replies; 3+ messages in thread
From: Subbaraya Sundeep @ 2025-04-07 10:53 UTC (permalink / raw)
  To: Wentao Liang
  Cc: sgoutham, gakula, hkelam, andrew+netdev, davem, edumazet, kuba,
	pabeni, netdev, linux-kernel

On 2025-04-07 at 08:11:17, Wentao Liang (vulab@iscas.ac.cn) 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>

Reviewed-by: Subbaraya Sundeep <sbhatta@marvell.com>

Thanks,
Sundeep

> ---
> v3: Add failed queue number and error code to log.
> v2: Fix error code
> 
>  drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
> index a15cc86635d6..9113a9b90002 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
> @@ -353,8 +353,10 @@ int cn10k_free_matchall_ipolicer(struct otx2_nic *pfvf)
>  
>  	/* Remove RQ's policer mapping */
>  	for (qidx = 0; qidx < hw->rx_queues; qidx++)
> -		cn10k_map_unmap_rq_policer(pfvf, qidx,
> -					   hw->matchall_ipolicer, false);
> +		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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] octeontx2-pf: Add error log forcn10k_map_unmap_rq_policer()
  2025-04-07  8:11 [PATCH v3] octeontx2-pf: Add error log forcn10k_map_unmap_rq_policer() Wentao Liang
  2025-04-07 10:53 ` Subbaraya Sundeep
@ 2025-04-07 16:42 ` Simon Horman
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-04-07 16:42 UTC (permalink / raw)
  To: Wentao Liang
  Cc: sbhatta, sgoutham, gakula, hkelam, andrew+netdev, davem, edumazet,
	kuba, pabeni, netdev, linux-kernel

On Mon, Apr 07, 2025 at 04:11:17PM +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>
> ---
> v3: Add failed queue number and error code to log.
> v2: Fix error code
> 
>  drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
> index a15cc86635d6..9113a9b90002 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
> @@ -353,8 +353,10 @@ int cn10k_free_matchall_ipolicer(struct otx2_nic *pfvf)
>  
>  	/* Remove RQ's policer mapping */
>  	for (qidx = 0; qidx < hw->rx_queues; qidx++)
> -		cn10k_map_unmap_rq_policer(pfvf, qidx,
> -					   hw->matchall_ipolicer, false);
> +		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);

I think that you need brackets for the for loop now
that it covers more than one statement. Like this:

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
index c3b6e0f60a79..7f6a435ac680 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c
@@ -357,9 +357,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);
 

Flagged by allmodconfig W=1 builds.

-- 
pw-bot: changes-requested

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-07 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07  8:11 [PATCH v3] octeontx2-pf: Add error log forcn10k_map_unmap_rq_policer() Wentao Liang
2025-04-07 10:53 ` Subbaraya Sundeep
2025-04-07 16:42 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).