Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Woojung Huh <woojung.huh@microchip.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	kernel@pengutronix.de, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, Lukas Wunner <lukas@wunner.de>,
	UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next v1 2/3] net: dsa: ar9331: add support for pause stats
Date: Sat, 25 Jun 2022 01:03:17 +0300	[thread overview]
Message-ID: <20220624220317.ckhx6z7cmzegvoqi@skbuf> (raw)
In-Reply-To: <20220624125902.4068436-2-o.rempel@pengutronix.de>

On Fri, Jun 24, 2022 at 02:59:01PM +0200, Oleksij Rempel wrote:
> Add support for pause stats and fix rx_packets/tx_packets calculation.
> 
> Pause packets are counted by raw.rx64byte/raw.tx64byte counters, so
> subtract it from main rx_packets/tx_packets counters.
> 
> tx_/rx_bytes are not affected.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  drivers/net/dsa/qca/ar9331.c | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/dsa/qca/ar9331.c b/drivers/net/dsa/qca/ar9331.c
> index fb3fe74abfe6..82412f54c432 100644
> --- a/drivers/net/dsa/qca/ar9331.c
> +++ b/drivers/net/dsa/qca/ar9331.c
> @@ -606,6 +607,7 @@ static void ar9331_sw_phylink_mac_link_up(struct dsa_switch *ds, int port,
>  static void ar9331_read_stats(struct ar9331_sw_port *port)
>  {
>  	struct ar9331_sw_priv *priv = ar9331_sw_port_to_priv(port);
> +	struct ethtool_pause_stats *pstats = &port->pause_stats;
>  	struct rtnl_link_stats64 *stats = &port->stats;
>  	struct ar9331_sw_stats_raw raw;
>  	int ret;
> @@ -625,9 +627,11 @@ static void ar9331_read_stats(struct ar9331_sw_port *port)
>  	stats->tx_bytes += raw.txbyte;
>  
>  	stats->rx_packets += raw.rx64byte + raw.rx128byte + raw.rx256byte +
> -		raw.rx512byte + raw.rx1024byte + raw.rx1518byte + raw.rxmaxbyte;
> +		raw.rx512byte + raw.rx1024byte + raw.rx1518byte +
> +		raw.rxmaxbyte - raw.rxpause;
>  	stats->tx_packets += raw.tx64byte + raw.tx128byte + raw.tx256byte +
> -		raw.tx512byte + raw.tx1024byte + raw.tx1518byte + raw.txmaxbyte;
> +		raw.tx512byte + raw.tx1024byte + raw.tx1518byte +
> +		raw.txmaxbyte - raw.txpause;

Is there an authoritative source who is able to tell whether rtnl_link_stats64 ::
rx_packets and tx_packets should count PAUSE frames or not?

>  
>  	stats->rx_length_errors += raw.rxrunt + raw.rxfragment + raw.rxtoolong;
>  	stats->rx_crc_errors += raw.rxfcserr;
> @@ -646,6 +650,9 @@ static void ar9331_read_stats(struct ar9331_sw_port *port)
>  	stats->multicast += raw.rxmulti;
>  	stats->collisions += raw.txcollision;
>  
> +	pstats->tx_pause_frames += raw.txpause;
> +	pstats->rx_pause_frames += raw.rxpause;
> +
>  	spin_unlock(&port->stats_lock);
>  }

  reply	other threads:[~2022-06-24 22:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24 12:59 [PATCH net-next v1 1/3] net: dsa: add get_pause_stats support Oleksij Rempel
2022-06-24 12:59 ` [PATCH net-next v1 2/3] net: dsa: ar9331: add support for pause stats Oleksij Rempel
2022-06-24 22:03   ` Vladimir Oltean [this message]
2022-06-26 17:10     ` Oleksij Rempel
2022-06-27 16:15       ` Jakub Kicinski
2022-06-27 20:02         ` Vladimir Oltean
2022-06-28  3:09           ` Jakub Kicinski
2022-06-28  7:22             ` Andrew Lunn
2022-06-28  8:45               ` Oleksij Rempel
2022-06-28 16:10                 ` Jakub Kicinski
2022-06-29  7:07                   ` Oleksij Rempel
2022-06-24 12:59 ` [PATCH net-next v1 3/3] net: dsa: microchip: add pause stats support Oleksij Rempel
2022-06-24 21:52   ` Vladimir Oltean
2022-06-24 22:03 ` [PATCH net-next v1 1/3] net: dsa: add get_pause_stats support Vladimir Oltean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220624220317.ckhx6z7cmzegvoqi@skbuf \
    --to=olteanv@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=vivien.didelot@gmail.com \
    --cc=woojung.huh@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox