]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: dsa: mv88e6xxx: Fix clearing of stats counters
authorAndrew Lunn <andrew@lunn.ch>
Sat, 10 Nov 2018 23:41:10 +0000 (00:41 +0100)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 02:00:02 +0000 (20:00 -0600)
BugLink: https://bugs.launchpad.net/bugs/1836968
[ Upstream commit a9049ff9214da68df1179a7d5e36b43479abc9b8 ]

The mv88e6161 would sometime fail to probe with a timeout waiting for
the switch to complete an operation. This operation is supposed to
clear the statistics counters. However, due to a read/modify/write,
without the needed mask, the operation actually carried out was more
random, with invalid parameters, resulting in the switch not
responding. We need to preserve the histogram mode bits, so apply a
mask to keep them.

Reported-by: Chris Healy <Chris.Healy@zii.aero>
Fixes: 40cff8fca9e3 ("net: dsa: mv88e6xxx: Fix stats histogram mode")
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/dsa/mv88e6xxx/global1.c

index b43bd6476632e7ea25d867a1b49c5b32afa815de..d6dbf8dfd474b813e3dafc8ec7ef87070d0c1a31 100644 (file)
@@ -470,6 +470,8 @@ int mv88e6xxx_g1_stats_clear(struct mv88e6xxx_chip *chip)
        if (err)
                return err;
 
+       /* Keep the histogram mode bits */
+       val &= MV88E6XXX_G1_STATS_OP_HIST_RX_TX;
        val |= MV88E6XXX_G1_STATS_OP_BUSY | MV88E6XXX_G1_STATS_OP_FLUSH_ALL;
 
        err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP, val);