Re: [PATCH net-next v2 5/5] net: rnpgbe: Add hardware and queue statistics

From: netdev-bot+sashiko

Date: Thu Nov 19 2026 - 10:10:01 EST


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] The patch makes the device-level RX packet and byte counts in
netdev qstats disagree with the rtnl stats64 counts, so the in-tree…

--

net: rnpgbe: Add hardware and queue statistics

This commit adds the hardware RX CRC-error and multicast counters to
ndo_get_stats64. It also reports per-queue RX and TX packet and byte
counters through netdev queue statistics, 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);

[ ... ]

> 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]

Will the qstat rx-packets and rx-bytes reported here ever match the
rx_packets and rx_bytes that rnpgbe_get_stats64() reports?

rnpgbe_get_stats64() reads queue_stats->packets and queue_stats->bytes.
rnpgbe_clean_rx_irq() also increments those for good packets that the
driver drops. One example is the skb build failure path:

if (!skb) {
atomic64_inc(&rx_ring->stats->skb_alloc_failures);
...
if (rnpgbe_test_staterr(rx_desc, M_RXD_STAT_EOP)) {
total_rx_bytes += size;
total_rx_packets++;
total_rx_dropped++;

The same thing happens when a MUCSE_RX_DROP_RESOURCE frame reaches EOP,
and when rnpgbe_cleanup_headers() fails with size >= ETH_HLEN. None of
these paths update delivered_packets or delivered_bytes.

rnpgbe_get_stats64() covers all RNPGBE_MAX_QUEUES. So do the qstat device
totals, which pick up inactive queues through rnpgbe_get_base_stats().
That means after the first such drop, the rtnl RX counts stay above the
qstat RX counts for good.

tools/testing/selftests/drivers/net/stats.py pkt_byte_sum() expects the
two to match:

# Compare stats, rtnl stats and qstats must match,
...
if stat_cmp(rtstat, qstat) > 0:
raise KsftFailEx("Qstats are lower, fetched later")

Once any RX drop has happened, wouldn't this test fail on rnpgbe? The
commit message describes the split: "RX queue counters cover packets
delivered to the networking stack, while interface RX totals also include
good packets dropped by the driver".

Could both interfaces report the same packets and bytes? Alternatively,
could driver drops be counted only in rx_dropped, and not in the rtnl
rx_packets and rx_bytes?

> + 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/BD205A7832D36E7D%2B20261116030917.1329989-1-dong100%40mucse.com