Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1312999 > unrolled thread

[PATCH] net: mvneta: fix trivial cut-off issue in mvneta_ethtool_update_stats

Started byJisheng Zhang <jszhang@marvell.com>
First post2016-01-20 09:50 +0100
Last post2016-01-21 21:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] net: mvneta: fix trivial cut-off issue in mvneta_ethtool_update_stats Jisheng Zhang <jszhang@marvell.com> - 2016-01-20 09:50 +0100
    Re: [PATCH] net: mvneta: fix trivial cut-off issue in  mvneta_ethtool_update_stats David Miller <davem@davemloft.net> - 2016-01-21 21:10 +0100

#1312999 — [PATCH] net: mvneta: fix trivial cut-off issue in mvneta_ethtool_update_stats

FromJisheng Zhang <jszhang@marvell.com>
Date2016-01-20 09:50 +0100
Subject[PATCH] net: mvneta: fix trivial cut-off issue in mvneta_ethtool_update_stats
Message-ID<qSWCJ-3V7-17@gated-at.bofh.it>
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")
---
 drivers/net/ethernet/marvell/mvneta.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 6bb709a..ea3b034 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -3244,26 +3244,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;
 	}
 }
 
-- 
2.7.0.rc3

[toc] | [next] | [standalone]


#1314483 — Re: [PATCH] net: mvneta: fix trivial cut-off issue in mvneta_ethtool_update_stats

FromDavid Miller <davem@davemloft.net>
Date2016-01-21 21:10 +0100
SubjectRe: [PATCH] net: mvneta: fix trivial cut-off issue in mvneta_ethtool_update_stats
Message-ID<qTtIn-1Np-27@gated-at.bofh.it>
In reply to#1312999
From: Jisheng Zhang <jszhang@marvell.com>
Date: Wed, 20 Jan 2016 16:36:25 +0800

> 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")

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web