diff mbox

dsa: mv88x6xxx: Zero statistics counters

Message ID 1434828689-11804-1-git-send-email-andrew@lunn.ch
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Andrew Lunn June 20, 2015, 7:31 p.m. UTC
Zero the statistics counters when setting up the global
registers. Otherwise the counters will remain from the last boot if
the power has not been removed.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---

This patch will only cleanly apply after the debug series.  There is
no actual dependency, so applying the patch with some fuzz will allow
it to be applied without the debug series.

 drivers/net/dsa/mv88e6xxx.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

David Miller June 23, 2015, 1:37 p.m. UTC | #1
From: Andrew Lunn <andrew@lunn.ch>
Date: Sat, 20 Jun 2015 21:31:29 +0200

> Zero the statistics counters when setting up the global
> registers. Otherwise the counters will remain from the last boot if
> the power has not been removed.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index cb6c2711d6ea..fc73d809c292 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -2061,6 +2061,12 @@  int mv88e6xxx_setup_global(struct dsa_switch *ds)
 				  0x9000 | (i << 8));
 	}
 
+	/* Clear the statistics counters for all ports */
+	REG_WRITE(REG_GLOBAL, GLOBAL_STATS_OP, GLOBAL_STATS_OP_FLUSH_ALL);
+
+	/* Wait for the flush to complete. */
+	_mv88e6xxx_stats_wait(ds);
+
 	return 0;
 }