diff options
author | Jisheng Zhang <jszhang@marvell.com> | 2016-01-20 09:36:25 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-01-21 21:03:30 +0100 |
commit | 2c832293e09be2f998ea916650927c8ccd5b4b3b (patch) | |
tree | ab27da1fd2af6acf27a3cf8ba7e855f5073e9ea6 /drivers/net/ethernet/marvell | |
parent | net: hns: enet specifies a reference to dsaf (diff) | |
download | linux-2c832293e09be2f998ea916650927c8ccd5b4b3b.tar.xz linux-2c832293e09be2f998ea916650927c8ccd5b4b3b.zip |
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: Jisheng Zhang <jszhang@marvell.com>
Fixes: 9b0cdefa4cd5 ("net: mvneta: add ethtool statistics")
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell')
-rw-r--r-- | drivers/net/ethernet/marvell/mvneta.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index fabc8df40392..4a8ed5bc3140 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -3242,26 +3242,25 @@ static void mvneta_ethtool_update_stats(struct mvneta_port *pp) const struct mvneta_statistic *s; void __iomem *base = pp->base; u32 high, low, val; + u64 val64; int i; for (i = 0, s = mvneta_statistics; s < mvneta_statistics + ARRAY_SIZE(mvneta_statistics); s++, i++) { - val = 0; - switch (s->type) { case T_REG_32: val = readl_relaxed(base + s->offset); + pp->ethtool_stats[i] += val; break; case T_REG_64: /* Docs say to read low 32-bit then high */ low = readl_relaxed(base + s->offset); high = readl_relaxed(base + s->offset + 4); - val = (u64)high << 32 | low; + val64 = (u64)high << 32 | low; + pp->ethtool_stats[i] += val64; break; } - - pp->ethtool_stats[i] += val; } } |