]> git.itanic.dy.fi Git - linux-stable/commitdiff
net: mscc: ocelot: fix eMAC TX RMON stats for bucket 256-511 and above
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 14 Dec 2023 00:09:01 +0000 (02:09 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 15 Dec 2023 01:58:09 +0000 (17:58 -0800)
There is a typo in the driver due to which we report incorrect TX RMON
counters for the 256-511 octet bucket and all the other buckets larger
than that.

Bug found with the selftest at
https://patchwork.kernel.org/project/netdevbpf/patch/20231211223346.2497157-9-tobias@waldekranz.com/

Fixes: e32036e1ae7b ("net: mscc: ocelot: add support for all sorts of standardized counters present in DSA")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20231214000902.545625-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mscc/ocelot_stats.c

index 5c55197c7327dfc65795099248f7cdc6206786e9..f29fa37263dae57ee6efde918ff9518f7979edec 100644 (file)
@@ -582,10 +582,10 @@ static void ocelot_port_rmon_stats_cb(struct ocelot *ocelot, int port, void *pri
        rmon_stats->hist_tx[0] = s[OCELOT_STAT_TX_64];
        rmon_stats->hist_tx[1] = s[OCELOT_STAT_TX_65_127];
        rmon_stats->hist_tx[2] = s[OCELOT_STAT_TX_128_255];
-       rmon_stats->hist_tx[3] = s[OCELOT_STAT_TX_128_255];
-       rmon_stats->hist_tx[4] = s[OCELOT_STAT_TX_256_511];
-       rmon_stats->hist_tx[5] = s[OCELOT_STAT_TX_512_1023];
-       rmon_stats->hist_tx[6] = s[OCELOT_STAT_TX_1024_1526];
+       rmon_stats->hist_tx[3] = s[OCELOT_STAT_TX_256_511];
+       rmon_stats->hist_tx[4] = s[OCELOT_STAT_TX_512_1023];
+       rmon_stats->hist_tx[5] = s[OCELOT_STAT_TX_1024_1526];
+       rmon_stats->hist_tx[6] = s[OCELOT_STAT_TX_1527_MAX];
 }
 
 static void ocelot_port_pmac_rmon_stats_cb(struct ocelot *ocelot, int port,