From: Jakub Kicinski <kuba@kernel.org>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Russell King <linux@armlinux.org.uk>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mips@vger.kernel.org
Subject: Re: [PATCH v5 2/2] net: dsa: qca: ar9331: export stats64
Date: Sat, 12 Dec 2020 10:00:47 -0800 [thread overview]
Message-ID: <20201212100047.1b6afb78@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20201212134852.gwkugi372afazcd5@skbuf>
On Sat, 12 Dec 2020 15:48:52 +0200 Vladimir Oltean wrote:
> > + stats->rx_packets = u64_stats_read(&s->rx64byte) +
> > + u64_stats_read(&s->rx128byte) + u64_stats_read(&s->rx256byte) +
> > + u64_stats_read(&s->rx512byte) + u64_stats_read(&s->rx1024byte) +
> > + u64_stats_read(&s->rx1518byte) + u64_stats_read(&s->rxmaxbyte);
> > + stats->tx_packets = u64_stats_read(&s->tx64byte) +
> > + u64_stats_read(&s->tx128byte) + u64_stats_read(&s->tx256byte) +
> > + u64_stats_read(&s->tx512byte) + u64_stats_read(&s->tx1024byte) +
> > + u64_stats_read(&s->tx1518byte) + u64_stats_read(&s->txmaxbyte);
> > + stats->rx_bytes = u64_stats_read(&s->rxgoodbyte);
> > + stats->tx_bytes = u64_stats_read(&s->txbyte);
> > + stats->rx_errors = u64_stats_read(&s->rxfcserr) +
> > + u64_stats_read(&s->rxalignerr) + u64_stats_read(&s->rxrunt) +
> > + u64_stats_read(&s->rxfragment) + u64_stats_read(&s->rxoverflow);
> > + stats->tx_errors = u64_stats_read(&s->txoversize);
>
> Should tx_errors not also include tx_aborted_errors, tx_fifo_errors,
> tx_window_errors?
Yes.
> > + stats->multicast = u64_stats_read(&s->rxmulti);
> > + stats->collisions = u64_stats_read(&s->txcollision);
> > + stats->rx_length_errors = u64_stats_read(&s->rxrunt) +
> > + u64_stats_read(&s->rxfragment) + u64_stats_read(&s->rxtoolong);
> > + stats->rx_crc_errors = u64_stats_read(&s->rxfcserr) +
> > + u64_stats_read(&s->rxalignerr) + u64_stats_read(&s->rxfragment);
Why would CRC errors include alignment errors and rxfragments?
Besides looks like rxfragment is already counted to length errors.
> > + stats->rx_frame_errors = u64_stats_read(&s->rxalignerr);
> > + stats->rx_missed_errors = u64_stats_read(&s->rxoverflow);
> > + stats->tx_aborted_errors = u64_stats_read(&s->txabortcol);
> > + stats->tx_fifo_errors = u64_stats_read(&s->txunderrun);
> > + stats->tx_window_errors = u64_stats_read(&s->txlatecol);
> > + stats->rx_nohandler = u64_stats_read(&s->filtered);
>
> Should rx_nohandler not be also included in rx_errors?
I don't think drivers should ever touch rx_nohandler, it's a pretty
specific SW stat. But you made me realize that we never specified where
to count frames discarded due to L2 address filtering. It appears that
high speed adapters I was looking at don't have such statistic?
I would go with rx_dropped, if that's what ->filtered is.
We should probably update the doc like this:
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 874cc12a34d9..82708c6db432 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -75,8 +75,9 @@ struct rtnl_link_stats {
*
* @rx_dropped: Number of packets received but not processed,
* e.g. due to lack of resources or unsupported protocol.
- * For hardware interfaces this counter should not include packets
- * dropped by the device which are counted separately in
+ * For hardware interfaces this counter may include packets discarded
+ * due to L2 address filtering but should not include packets dropped
+ * by the device due to buffer exhaustion which are counted separately in
* @rx_missed_errors (since procfs folds those two counters together).
*
* @tx_dropped: Number of packets dropped on their way to transmission,
> You can probably avoid reading a few of these twice by assigning the
> more specific ones first, then the rx_errors and tx_errors at the end.
next prev parent reply other threads:[~2020-12-12 18:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 10:53 [PATCH v5 net-next 0/2] net: dsa: add stats64 support Oleksij Rempel
2020-12-11 10:53 ` [PATCH v5 1/2] net: dsa: add optional " Oleksij Rempel
2020-12-12 13:51 ` Vladimir Oltean
2020-12-12 17:23 ` Jakub Kicinski
2020-12-11 10:53 ` [PATCH v5 2/2] net: dsa: qca: ar9331: export stats64 Oleksij Rempel
2020-12-12 13:48 ` Vladimir Oltean
2020-12-12 18:00 ` Jakub Kicinski [this message]
2020-12-12 17:34 ` Jakub Kicinski
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=20201212100047.1b6afb78@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
--to=kuba@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@gmail.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;
as well as URLs for NNTP newsgroup(s).