From: netdev-bot+sashiko@kernel.org
To: dong100@mucse.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
yaojun@mucse.com
Subject: Re: [PATCH net-next v3 5/5] net: rnpgbe: Add hardware and queue statistics
Date: Wed, 25 Nov 2026 06:36:06 +0000 [thread overview]
Message-ID: <179558856602.3135.7505371780005583025@kernel.org> (raw)
In-Reply-To: <DB48C65C5764A9FD+20261124060623.411536-1-dong100@mucse.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] After this patch the driver reports two RX totals that
disagree.
--
net: rnpgbe: Add hardware and queue statistics
This commit adds hardware RX CRC-error and multicast counters to
ndo_get_stats64, accumulated from the service task. It also reports
per-queue RX/TX packet and byte counters through netdev queue stats, and
exposes per-queue TX DMA mapping failures through ethtool statistics.
> diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_lib.c b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_lib.c
> index b7b0c45a0f664..fe320c4f389ba 100644
> --- a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_lib.c
> +++ b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_lib.c
[ ... ]
> @@ -615,6 +620,8 @@ static int rnpgbe_clean_rx_irq(struct mucse_q_vector *q_vector,
>
> /* probably a little skewed due to removing CRC */
> total_rx_bytes += skb->len;
> + delivered_bytes += skb->len;
> + delivered_packets++;
> rnpgbe_process_skb_fields(rx_ring, skb);
> rx_desc->wb.cmd = 0;
> napi_gro_receive(&q_vector->napi, skb);
> @@ -626,6 +633,8 @@ static int rnpgbe_clean_rx_irq(struct mucse_q_vector *q_vector,
> u64_stats_update_begin(&rx_ring->stats->syncp);
> rx_ring->stats->packets += total_rx_packets;
> rx_ring->stats->bytes += total_rx_bytes;
> + rx_ring->stats->delivered_packets += delivered_packets;
> + rx_ring->stats->delivered_bytes += delivered_bytes;
> rx_ring->stats->length_errors += total_rx_length_errors;
> atomic64_add(total_rx_dropped, &rx_ring->stats->dropped);
> u64_stats_update_end(&rx_ring->stats->syncp);
[ ... ]
> diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_stats.c b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_stats.c
> new file mode 100644
> index 0000000000000..efd2284fd93af
> --- /dev/null
> +++ b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_stats.c
[ ... ]
> +static void rnpgbe_get_queue_stats_rx(struct net_device *netdev, int idx,
> + struct netdev_queue_stats_rx *stats)
> +{
> + struct mucse *mucse = netdev_priv(netdev);
> + const struct mucse_queue_stats *queue;
> + unsigned int start;
> +
> + queue = &mucse->rx_stats[idx];
> + do {
> + start = u64_stats_fetch_begin(&queue->syncp);
> + stats->packets = queue->delivered_packets;
> + stats->bytes = queue->delivered_bytes;
> + } while (u64_stats_fetch_retry(&queue->syncp, start));
[Severity: Medium]
Can this leave the qstat RX totals permanently out of step with the rtnl
RX totals?
rnpgbe_get_stats64() adds rx_stats[i].packets and rx_stats[i].bytes into
rx_packets and rx_bytes. In rnpgbe_clean_rx_irq(), the driver-drop paths
increase those counters but leave delivered_packets and delivered_bytes
alone. One example is the skb == NULL path at EOP:
if (!skb) {
atomic64_inc(&rx_ring->stats->skb_alloc_failures);
...
total_rx_bytes += size;
total_rx_packets++;
total_rx_dropped++;
The MUCSE_RX_DROP_RESOURCE EOP path and the rnpgbe_cleanup_headers()
failure path with size >= ETH_HLEN behave the same way.
This callback reports only delivered_* as qstat rx-packets and rx-bytes.
rnpgbe_get_base_stats() uses the same callback through
netdev_stat_queue_sum() for the inactive queues. So after the first
driver RX drop, the rtnl totals stay higher than the qstat totals. An
skb allocation failure under memory pressure is enough to cause that
drop. Nothing resets these counters, so the gap never closes.
The generic selftest expects the two sets of totals to match:
tools/testing/selftests/drivers/net/stats.py:pkt_byte_sum()
# Compare stats, rtnl stats and qstats must match,
...
if stat_cmp(rtstat, qstat) > 0:
raise KsftFailEx("Qstats are lower, fetched later")
The commit message says the split is intentional. Even so, could both
interfaces report the same packet and byte counters? One option is to
use packets and bytes here. Another is to keep driver drops out of the
rtnl rx_packets and rx_bytes totals.
> + stats->alloc_fail = atomic64_read(&queue->page_alloc_failures) +
> + atomic64_read(&queue->skb_alloc_failures);
> +}
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/6C54E9FB2E95869E%2B20261124060436.410989-1-dong100%40mucse.com
prev parent reply other threads:[~2026-11-25 6:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 6:04 [PATCH net-next v3 0/5] net: rnpgbe: Add basic management and statistics Dong Yibo
2026-11-24 6:05 ` [PATCH net-next v3 1/5] net: rnpgbe: Add basic ethtool support Dong Yibo
2026-11-24 6:05 ` [PATCH net-next v3 2/5] net: rnpgbe: Report link settings through ethtool Dong Yibo
2026-11-25 6:36 ` netdev-bot+sashiko
2026-11-24 6:06 ` [PATCH net-next v3 3/5] net: rnpgbe: Support copper link configuration Dong Yibo
2026-11-25 6:36 ` netdev-bot+sashiko
2026-11-24 6:06 ` [PATCH net-next v3 4/5] net: rnpgbe: Allow changing the primary MAC address Dong Yibo
2026-11-25 6:36 ` netdev-bot+sashiko
2026-11-24 6:06 ` [PATCH net-next v3 5/5] net: rnpgbe: Add hardware and queue statistics Dong Yibo
2026-11-25 6:36 ` netdev-bot+sashiko [this message]
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=179558856602.3135.7505371780005583025@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dong100@mucse.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yaojun@mucse.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