From: Stanislaw Pal <kuncy7@gmail.com>
To: Christian Marangi <ansuelsmth@gmail.com>,
Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next v2 0/2] net: dsa: qca8k: report port statistics from the MIB
Date: Mon, 19 Oct 2026 21:11:35 +0200 [thread overview]
Message-ID: <20261019191137.307514-1-kuncy7@gmail.com> (raw)
qca8k has no .get_stats64, so a user port's netdev counts only what
crosses the CPU port; traffic the switch forwards in hardware never
shows up. Patch 2 reports the port counters from the switch MIB through
a delayed work, as ar9331 and rtl8365mb do. Patch 1 makes register
access safe for such a reader outside rtnl first.
Changes in v2:
- patch 1 is new: the regmap was created without locking while it
formats register and value in its shared work_buf, and an autocast
and qca8k_conduit_change() took the MIB and management mutexes in
opposite orders (netdev AI review)
- read the MIB with one autocast request for all ports when the
management path is up, register reads only as the fallback, only for
ports with link (Christian)
- index ar8327_mib[] by an enum instead of a second table of offsets,
share the register reads with qca8k_get_ethtool_stats() (Christian)
- MIB instead of STATS in the names, interval define in qca8k.h, one
spinlock for the cached counters (Christian)
- stop the work on shutdown and suspend, init it in probe; keep the
user port's tstats if the MIB did not come up; read the high word of
a 64-bit counter around the low one and drop a 64-bit sample that
goes backwards; take the FCS off the byte counters (netdev AI review)
On the FCS: on the CPU port of the B3000, with an 802.1Q tag on the
link, the maximum-size frames (1518 bytes without the FCS) land in
RxMaxByte, so the size buckets count the FCS; the CPU port's
RxGoodByte also matches the conduit GMAC's MMC octet counter byte for
byte. Please correct me if the byte counters are documented otherwise.
Tested on a GL-B3000 (QCA8337, CPU port 0), three 15 s uploads over the
WAN port per case: with register reads the wan netdev's TX bytes were
TxByte less 4 bytes per frame within 0.004%; with the qca tagger, where
every read is an autocast, the counters followed TxByte within 0.002%
(measured before the FCS change). With lockdep, a tagger change and
three conduit down/up cycles with the autocast work running and
ethtool -S in a loop gave no report.
v1: https://lore.kernel.org/netdev/20261018153658.209999-1-kuncy7@gmail.com/
Stanislaw Pal (2):
net: dsa: qca8k: serialize register access
net: dsa: qca8k: report port statistics from the MIB
drivers/net/dsa/qca/qca8k-8xxx.c | 194 ++++++++++++++++++++++++++---
drivers/net/dsa/qca/qca8k-common.c | 137 ++++++++++++--------
drivers/net/dsa/qca/qca8k.h | 72 ++++++++++-
3 files changed, 332 insertions(+), 71 deletions(-)
base-commit: d1241cdbbcf7bfac3e53482b2054504628f9f047
--
2.43.0
next reply other threads:[~2026-10-19 19:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 19:11 Stanislaw Pal [this message]
2026-10-19 19:11 ` [PATCH net-next v2 1/2] net: dsa: qca8k: serialize register access Stanislaw Pal
2026-10-19 19:11 ` [PATCH net-next v2 2/2] net: dsa: qca8k: report port statistics from the MIB Stanislaw Pal
2026-10-21 1:50 ` [PATCH net-next v2 0/2] " 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=20261019191137.307514-1-kuncy7@gmail.com \
--to=kuncy7@gmail.com \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.