From: Vladimir Oltean Date: Thu, 8 Sep 2022 16:48:12 +0000 (+0300) Subject: net: mscc: ocelot: exclude stats from bulk regions based on reg, not name X-Git-Tag: v6.1-rc5~319^2~229^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3e75f1665f37cd7294355dd01bbc72f057a841d;p=platform%2Fkernel%2Flinux-starfive.git net: mscc: ocelot: exclude stats from bulk regions based on reg, not name We want to introduce elements kept in ocelot->stats that aren't exposed to the unstructured ethtool -S (so they won't have their name populated), but are otherwise checked for 32-bit wraparounds by ocelot_port_update_stats(). This isn't possible today because ocelot_prepare_stats_regions() skips over ocelot_stat_layout elements with no name. Now that we've changed struct ocelot_stat_layout to keep the absolute register address rather than the offset relative to SYS_CNT, we can make use of the unpopulated "reg" value of 0 to mean that the counter isn't present on the current switch revision, and skip it from the preparation of bulk regions. Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c index 6435661..2926d266 100644 --- a/drivers/net/ethernet/mscc/ocelot_stats.c +++ b/drivers/net/ethernet/mscc/ocelot_stats.c @@ -222,7 +222,7 @@ static int ocelot_prepare_stats_regions(struct ocelot *ocelot) INIT_LIST_HEAD(&ocelot->stats_regions); for (i = 0; i < OCELOT_NUM_STATS; i++) { - if (ocelot->stats_layout[i].name[0] == '\0') + if (!ocelot->stats_layout[i].reg) continue; if (region && ocelot->stats_layout[i].reg == last + 4) {