Commit 2c832293 authored by Jisheng Zhang's avatar Jisheng Zhang Committed by David S. Miller

net: mvneta: fix trivial cut-off issue in mvneta_ethtool_update_stats

When s->type is T_REG_64, the high 32bits are lost in val. This patch
fixes this trivial issue.
Signed-off-by: default avatarJisheng Zhang <jszhang@marvell.com>
Fixes: 9b0cdefa ("net: mvneta: add ethtool statistics")
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 48189d6a
...@@ -3242,26 +3242,25 @@ static void mvneta_ethtool_update_stats(struct mvneta_port *pp) ...@@ -3242,26 +3242,25 @@ static void mvneta_ethtool_update_stats(struct mvneta_port *pp)
const struct mvneta_statistic *s; const struct mvneta_statistic *s;
void __iomem *base = pp->base; void __iomem *base = pp->base;
u32 high, low, val; u32 high, low, val;
u64 val64;
int i; int i;
for (i = 0, s = mvneta_statistics; for (i = 0, s = mvneta_statistics;
s < mvneta_statistics + ARRAY_SIZE(mvneta_statistics); s < mvneta_statistics + ARRAY_SIZE(mvneta_statistics);
s++, i++) { s++, i++) {
val = 0;
switch (s->type) { switch (s->type) {
case T_REG_32: case T_REG_32:
val = readl_relaxed(base + s->offset); val = readl_relaxed(base + s->offset);
pp->ethtool_stats[i] += val;
break; break;
case T_REG_64: case T_REG_64:
/* Docs say to read low 32-bit then high */ /* Docs say to read low 32-bit then high */
low = readl_relaxed(base + s->offset); low = readl_relaxed(base + s->offset);
high = readl_relaxed(base + s->offset + 4); high = readl_relaxed(base + s->offset + 4);
val = (u64)high << 32 | low; val64 = (u64)high << 32 | low;
pp->ethtool_stats[i] += val64;
break; break;
} }
pp->ethtool_stats[i] += val;
} }
} }
......
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