Commit 51dca8a1 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: dsa: b53: Fix statistics readings

Due to a typo we would always be using the MIB counter width of the
first element of the counter array instead of the current element, and
we would always be accessing the register statistics with a 64-bits
read, while some could be 32-bits. This got unnoticed in testing with
MDIO and SRAB which tolerate doing this, but testing with the SPI bus
revealed bogus values being returned. Fix this by using the proper
iterator here.

Fixes: 967dd82f ("net: dsa: b53: Add support for Broadcom RoboSwitch")
Reported-by: default avatarJonas Gorski <jogo@openwrt.org>
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d1bd330a
...@@ -679,7 +679,7 @@ static void b53_get_ethtool_stats(struct dsa_switch *ds, int port, ...@@ -679,7 +679,7 @@ static void b53_get_ethtool_stats(struct dsa_switch *ds, int port,
for (i = 0; i < mib_size; i++) { for (i = 0; i < mib_size; i++) {
s = &mibs[i]; s = &mibs[i];
if (mibs->size == 8) { if (s->size == 8) {
b53_read64(dev, B53_MIB_PAGE(port), s->offset, &val); b53_read64(dev, B53_MIB_PAGE(port), s->offset, &val);
} else { } else {
u32 val32; u32 val32;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment