diff mbox series

[net-next,3/8] net: mscc: ocelot: debugging print for statistics regions

Message ID 20230412124737.2243527-4-vladimir.oltean@nxp.com (mailing list archive)
State Accepted
Commit 07de32655bb4e4518cdb8ce4e2e0d6ed49f2ceb0
Delegated to: Netdev Maintainers
Headers show
Series Ocelot/Felix driver cleanup | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Vladimir Oltean April 12, 2023, 12:47 p.m. UTC
To make it easier to debug future issues with statistics counters not
getting aggregated properly into regions, like what happened in commit
6acc72a43eac ("net: mscc: ocelot: fix stats region batching"), add some
dev_dbg() prints which show the regions that were dynamically
determined.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/ethernet/mscc/ocelot_stats.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Keller, Jacob E April 12, 2023, 9:17 p.m. UTC | #1
On 4/12/2023 5:47 AM, Vladimir Oltean wrote:
> To make it easier to debug future issues with statistics counters not
> getting aggregated properly into regions, like what happened in commit
> 6acc72a43eac ("net: mscc: ocelot: fix stats region batching"), add some
> dev_dbg() prints which show the regions that were dynamically
> determined.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  drivers/net/ethernet/mscc/ocelot_stats.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c
> index d0e6cd8dbe5c..b50d9d9f8023 100644
> --- a/drivers/net/ethernet/mscc/ocelot_stats.c
> +++ b/drivers/net/ethernet/mscc/ocelot_stats.c
> @@ -925,6 +925,15 @@ static int ocelot_prepare_stats_regions(struct ocelot *ocelot)
>  	}
>  
>  	list_for_each_entry(region, &ocelot->stats_regions, node) {
> +		enum ocelot_target target;
> +		u32 addr;
> +
> +		ocelot_reg_to_target_addr(ocelot, region->base, &target,
> +					  &addr);
> +
> +		dev_dbg(ocelot->dev,
> +			"region of %d contiguous counters starting with SYS:STAT:CNT[0x%03x]\n",
> +			region->count, addr / 4);


This will load the target and addr every time even when dev_dbg isn't
activated, but thats not a huge cost.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

>  		region->buf = devm_kcalloc(ocelot->dev, region->count,
>  					   sizeof(*region->buf), GFP_KERNEL);
>  		if (!region->buf)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c
index d0e6cd8dbe5c..b50d9d9f8023 100644
--- a/drivers/net/ethernet/mscc/ocelot_stats.c
+++ b/drivers/net/ethernet/mscc/ocelot_stats.c
@@ -925,6 +925,15 @@  static int ocelot_prepare_stats_regions(struct ocelot *ocelot)
 	}
 
 	list_for_each_entry(region, &ocelot->stats_regions, node) {
+		enum ocelot_target target;
+		u32 addr;
+
+		ocelot_reg_to_target_addr(ocelot, region->base, &target,
+					  &addr);
+
+		dev_dbg(ocelot->dev,
+			"region of %d contiguous counters starting with SYS:STAT:CNT[0x%03x]\n",
+			region->count, addr / 4);
 		region->buf = devm_kcalloc(ocelot->dev, region->count,
 					   sizeof(*region->buf), GFP_KERNEL);
 		if (!region->buf)