dsa: mv88x6xxx: Zero statistics counters
authorAndrew Lunn <andrew@lunn.ch>
Sat, 20 Jun 2015 19:31:29 +0000 (21:31 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Jun 2015 13:37:17 +0000 (06:37 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx.c

index c938d7ce5215a93623a67acd634a4dc6d539f814..fd8547c2b79d46786b10807a0c62f338b6a60e27 100644 (file)
@@ -2005,6 +2005,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;
 }