]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: microchip: count pause packets together will all other packets
authorOleksij Rempel <o.rempel@pengutronix.de>
Tue, 28 Jun 2022 08:51:55 +0000 (10:51 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 30 Jun 2022 03:19:05 +0000 (20:19 -0700)
This switch is calculating tx/rx_bytes for all packets including pause.
So, include rx/tx_pause counter to rx/tx_packets to make tx/rx_bytes fit
to rx/tx_packets.

Link: https://lore.kernel.org/all/20220624220317.ckhx6z7cmzegvoqi@skbuf/
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/microchip/ksz_common.c

index 5e534f7bce0b2d017bf60f84f14ad51537b65b9e..29b42b3b39c9871c880d105acd0c3898301e7651 100644 (file)
@@ -683,8 +683,10 @@ void ksz_r_mib_stats64(struct ksz_device *dev, int port)
 
        spin_lock(&mib->stats64_lock);
 
-       stats->rx_packets = raw->rx_bcast + raw->rx_mcast + raw->rx_ucast;
-       stats->tx_packets = raw->tx_bcast + raw->tx_mcast + raw->tx_ucast;
+       stats->rx_packets = raw->rx_bcast + raw->rx_mcast + raw->rx_ucast +
+               raw->rx_pause;
+       stats->tx_packets = raw->tx_bcast + raw->tx_mcast + raw->tx_ucast +
+               raw->tx_pause;
 
        /* HW counters are counting bytes + FCS which is not acceptable
         * for rtnl_link_stats64 interface