2022-06-28 08:55:01

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH net-next v2 4/4] net: dsa: microchip: count pause packets together will all other packets

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.

Signed-off-by: Oleksij Rempel <[email protected]>
---
drivers/net/dsa/microchip/ksz_common.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 7c221ec331ee..f5ad9cd8eff5 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -598,8 +598,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
--
2.30.2


2022-06-28 10:31:52

by Vladimir Oltean

[permalink] [raw]
Subject: Re: [PATCH net-next v2 4/4] net: dsa: microchip: count pause packets together will all other packets

On Tue, Jun 28, 2022 at 10:51:55AM +0200, Oleksij Rempel wrote:
> 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.
>
> Signed-off-by: Oleksij Rempel <[email protected]>
> ---

I think this is a reasonable thing to do.

Reviewed-by: Vladimir Oltean <[email protected]>

2022-06-28 14:57:10

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH net-next v2 4/4] net: dsa: microchip: count pause packets together will all other packets



On 6/28/2022 1:51 AM, Oleksij Rempel wrote:
> 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.
>
> Signed-off-by: Oleksij Rempel <[email protected]>

Reviewed-by: Florian Fainelli <[email protected]>

Might have been worth a comment above to explain why the pause frame
counting is appropriate, or we can always go back to git log. Thanks!
--
Florian