🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19219

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

#19219
From: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 15:09
116 lines
12133 bytes
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
Technical Details
Message-ID: <179510098686.3136.4654059971237578202@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367105-linux-kernel-netdev=dewy.ru
References: <65EB247A8B937B64+20261116031055.1330377-1-dong100@mucse.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367105-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 5/5] net: rnpgbe: Add hardware and queue statistics
Date: Thu, 19 Nov 2026 15:09:46 +0000
Organization: Usenet Network
Message-ID: <179510098686.3136.4654059971237578202@kernel.org>
References: <65EB247A8B937B64+20261116031055.1330377-1-dong100@mucse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2908611"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BQGCkuKXSaYnhPysRVtEi6/cIr4= sha256:sOX042OQQFo5a+lj6SAWMriWg/HB8VAiUozteGPAqt8=
	sha1:FMmTYfB3rgy3ztkEUW7D/l09+yI= sha256:0nxCi4YFc9lhpestDscKND8K5gI/hWpOxGAGF6adY/8=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 520A91156B4; Thu, 19 Nov 2026 18:11:20 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id FWjWu1M2F2vD;
	Thu, 19 Nov 2026 18:11:16 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-367105-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 565A3115683; Thu, 19 Nov 2026 18:11:08 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 9B3CD308A95; Thu, 19 Nov 2026 15:09:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795100988;
	b=JX1SdD3obhL4h05lTWgDp6jNTlBF46zUqe4k40bpd7Zqys1z5fGzeSy27AY7UHFTqV0w
	 1ol1PbdfSgsAPzYAICtZxje84XDlKZU0mPsD2Wxme4NpIXiMLCwaa/r0sKP7alEDoPGG+
	 vUmTtgFsk/jf9C2rA4DZl5buIvGn5zcE6X9YGay3/yzdS/XALg8xjTntkwn2VZDmgZgAd
	 cB4QuQdlfBC/XFS1fT8uaV4dTdyc0Y248UWrDEV4zHT+zlnpKKeBSCWQ6Wg0UdHlnzu8Y
	 AjPJkVkUcHIvcTFa9bs/VYfMKhfsQgEZ6z7EP04pMnrThRt9pMULcNbtia6GXnTcOWA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795100988;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=M9653napI0p8zNI7iq+j4iPWK2c0oBZ02qhHfwFDJ2w=;
	b=oFv3xTgflPaiq0D9VrQ6fn2Xlm/BvZ0ZuD04dRDgNT/f1HUGpAWDD2Q3ijUtMDOGLssq
	 erQI+p20Mgv8WqLiq5OJMSV6imBHGHBxPiIt74nXQXoZ9EaNU5nX/dFXJ/3XxjRqUsx4n
	 kFBEHVxCS5yqrOcZyj52gnY8qVv4jDjRURNTH0wMN6YJ0SD1CfLEf9m1BIOzoOuuVl64J
	 t5vL9Tl/VxWjo2zgRjAHHmxolnkvNJm9ktCc0LFtNlaMgqtItXJ+ceLEtBVLCjRtkGCB5
	 fFqMAlmGhYYyk9ZebmYHnzZ/j75L5XFD/JMSTCZNnCAigOXm4MLx/UUGAFjHhL+wgjQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NTHpn8kQ;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id D20A360A2615;
	Thu, 19 Nov 2026 15:09:48 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NTHpn8kQ
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795100988;
	b=LxVoUkAOfOX1YgqIerRQA2cQwr8R0zCk/IR6OYAeWkx9QwEIca5vnFygsBCCms4KoNzp
	 WAGEac3z5hjkXj5lMVp8zL1s9Kqz26y/QUgW5UqYc9szryI7jPWdpEptFkLnVkpV3Np0m
	 3fwP3QUOXl4oC5hqrpBhsFz8OHd3bYmcNaCAIVVdm719chA59Cg6Qj7+tIyOrlvJH840c
	 TXzj3KvHHECwzMHcIS+7x3C60hanhg5voUgmkWYyM59J6WG+InSzu9cjS4ku9mepU2yqO
	 1s+i1Pxyu75Zx8aSnxikmCpyIBKrjrTTPZgJTB/y4zK9ItzlCABdS8Ax2AEIwou/Img==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795100988;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=M9653napI0p8zNI7iq+j4iPWK2c0oBZ02qhHfwFDJ2w=;
	b=FZi3zvgroWJnWQ9xGqsUjWC+mjRmm5QQHq6gZHwjmswSC/T5zf1FZw/hPqbWEpESkMs9
	 AliKKEn20Jd2tIsgJ52qqAv4JtXwNAu9x+JHDLcBTjDEorTHYoOprIH4RtDMXVRVT7z3N
	 SIOO/REylgUUt0Ce6HbU9QYQDPYIb7Hn6p8HQfmHwS7I9zC4s3AqlIhSJ05J7bBTMHFAS
	 HR1xnlSLjd5zjcku18GOnC0kw8n7aS0B4YIRfwbU0pMpZTPqkztB4g8NjsTf6KIVZpg/n
	 gCI56neQxoqKXsMtCZ57gVyqBAj7xjTrv8AplDCw/06mLHO4FUCJThDR3UsMSAd4OWg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NTHpn8kQ;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id F32DD60A2606;
	Thu, 19 Nov 2026 15:09:47 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BA981F000C4;
	Thu, 19 Nov 2026 15:09:47 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795100987;
	bh=M9653napI0p8zNI7iq+j4iPWK2c0oBZ02qhHfwFDJ2w=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=NTHpn8kQlcFJyY2BgBPKmZbi5AsQKNb6TzQfcQKhC4UMU3rDjYSaeWOzx7E5VAMH8
	 ywFYCwSsQdtasr3dNSOCE4M1YOCe4Pm0Ziv7lBm1s1dHOgKJQp6e+WiRPoc8phMI9C
	 lsIb2J0gSBxgmcLLO56WL48ak64FCgdHDdiZjTBAWvns7R2KOtXjXiPuK2rCjlSJYB
	 U8bRHrr8UmDoF18xq6a+tjMFdKYp301O1P91bWjSaLSX9bAyzRH2J8MyYUcq7Yn8jr
	 rts0d1PcA59GOkGDsnZFFpEt6pBgCvJ7k49NdvUjCdBtgLKfIyjRm8MUWWwDq1ikA4
	 QJaeYYraBTUZg==
X-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
X-In-Reply-To: <65EB247A8B937B64+20261116031055.1330377-1-dong100@mucse.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list