Netdev List
 help / color / mirror / Atom feed
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 v2 5/5] net: rnpgbe: Add hardware and queue statistics
Date: Thu, 19 Nov 2026 15:09:46 +0000	[thread overview]
Message-ID: <179510098686.3136.4654059971237578202@kernel.org> (raw)
In-Reply-To: <65EB247A8B937B64+20261116031055.1330377-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] 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

      reply	other threads:[~2026-11-19 15:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  3:09 [PATCH net-next v2 0/5] net: rnpgbe: Add basic management and statistics Dong Yibo
2026-11-16  3:10 ` [PATCH net-next v2 1/5] net: rnpgbe: Add basic ethtool support Dong Yibo
2026-11-16  3:10 ` [PATCH net-next v2 2/5] net: rnpgbe: Report link settings through ethtool Dong Yibo
2026-11-16  4:19   ` Andrew Lunn
2026-11-16  4:47     ` Yibo Dong
2026-11-16 13:18       ` Andrew Lunn
2026-11-17  1:49         ` Yibo Dong
2026-11-17  1:54           ` Andrew Lunn
2026-11-17  2:55             ` Yibo Dong
2026-11-17 13:21               ` Andrew Lunn
2026-11-18  1:17                 ` Yibo Dong
2026-11-19 15:09   ` netdev-bot+sashiko
2026-11-16  3:10 ` [PATCH net-next v2 3/5] net: rnpgbe: Support copper link configuration Dong Yibo
2026-11-19 15:09   ` netdev-bot+sashiko
2026-11-16  3:10 ` [PATCH net-next v2 4/5] net: rnpgbe: Allow changing the primary MAC address Dong Yibo
2026-11-16  3:10 ` [PATCH net-next v2 5/5] net: rnpgbe: Add hardware and queue statistics Dong Yibo
2026-11-19 15:09   ` 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=179510098686.3136.4654059971237578202@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