Skip to content

Commit

Permalink
net: dsa: microchip: count pause packets together will all other packets
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oleksij Rempel authored and Jakub Kicinski committed Jun 30, 2022
1 parent c4748ff commit 961d6c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/dsa/microchip/ksz_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 961d6c7

Please sign in to comment.