Article View: linux.kernel.netdev
Article #22355Re: [PATCH net-next v3 5/5] net: rnpgbe: Add hardware and queue statistics
From: Yibo Dong
Date: Wed, 25 Nov 2026 07:36
Date: Wed, 25 Nov 2026 07:36
135 lines
14673 bytes
14673 bytes
On Wed, Nov 25, 2026 at 06:36:06AM +0000, netdev-bot+sashiko@kernel.org wrote:
> 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.
>
After checking the documented semantics, I think these counters can
legitimately differ when the driver drops a good received packet.
include/uapi/linux/if_link.h defines rx_packets as including good packets
received by the host but subsequently dropped, even within the driver.
In contrast, Documentation/netlink/specs/netdev.yaml defines qstats
rx-packets as packets successfully received and passed to the stack.
The corresponding byte counters follow the same distinction.
The pkt_byte_sum selftest can consequently fail after such a drop.
Changing either set of counters solely to satisfy that equality would
conflict with its documented semantics.
> > + 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
>
Technical Details
Message-ID:
<F283E54B74613F72+20261125073614.GC752553@nic-Precision-5820-Tower>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371100-linux-kernel-netdev=dewy.ruReferences:
<DB48C65C5764A9FD+20261124060623.411536-1-dong100@mucse.com> <179558856602.3135.7505371780005583025@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371100-linux-kernel-netdev=dewy.ru From: dong100@mucse.com (Yibo Dong) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v3 5/5] net: rnpgbe: Add hardware and queue statistics Date: Wed, 25 Nov 2026 15:36:14 +0800 Organization: Usenet Network Message-ID: <F283E54B74613F72+20261125073614.GC752553@nic-Precision-5820-Tower> References: <DB48C65C5764A9FD+20261124060623.411536-1-dong100@mucse.com> <179558856602.3135.7505371780005583025@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="145978"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:JmMYxoCs8B1oQRhxJXjo3BSCcK0= sha256:N7InKfeYBvMDlwa6+orolX0SsH/7E8rLR3PTW8Fw/e4= sha1:bX9yXfxWdSc6qbo8AASM6M0s3MA= sha256:dlo3RFHDJQK3iiXBQaHrV44WroX4nwPvrxrLfRuNse0= Content-Disposition: inline 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 AB82E125E41; Wed, 25 Nov 2026 10:38:15 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.95 X-Spam-Status: No, score=-2.95 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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-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 FwLM4kEJFWJZ; Wed, 25 Nov 2026 10:38:11 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-371100-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mucse.com X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 8BB66125E40; Wed, 25 Nov 2026 10:38:06 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id C83EF35379; Wed, 25 Nov 2026 07:38:04 +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=1795592283; b=rr8S6a7LaAvVMMJ2xod3b2IRVMm9cAj3K/fVinMbDmduIRjp5snUn74Wjzlj7FOO4S2Z yH+sk8cNePRDq7tdIAAVp26uGM54Jv5G9O1P1QiOodedf+3oiqIsWtvyD+N5K+PSDVDKT H8aUMKVb1KugGUtwDy6V/YjzPuD26lBR2XUizVboI+/dsNVPIEHRRFb5XdeMMelzgjHpy WRlUAwxHz6tpMVEF1EI2aoph0Wm/PHx99m5sOuenafc4yKJ+Fg1Vy7Qz2HA2aPIEgf5pU Buj4N3cwGqS3eRde0lgm84nIhD583v3d7aoZydyodm5dNKmzFCHIXxaXtI4gLaTRGXw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795592283; h=X-Original-To:Received:DMARC-Filter:X-QQ-mid:X-QQ-Originating-IP: Received:X-QQ-SSF:X-QQ-GoodBg:X-BIZMAIL-ID:EX-QQ-RecipientCnt:Date: From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To:X-QQ-SENDSIZE:Feedback-ID: X-QQ-XMAILINFO:X-QQ-XMRINFO:X-QQ-RECHKSPAM; bh=ZOjLaYx4Dr5j2yndCCgY4NG6T+IceZsHeZCSmK+kO8U=; b=UBmO/pgcYGSINXmeuI7P8wdwdoAtBph1Vetlbp6e3kXzVajhVCOmZvLqALM7mjFGn16U ebpJMmIKoxUEK1xakAjOS3Rz1T9b4m85nLChpXzFV3D/9GDqrObh8IFGRIENWQzHuqTq5 NA4P0zqjAaI1NhhCDV2PFkYnKQwjHG3A6+eJ542Bw7zI+MDu/viBML6HjfFvolxhex2Dr 7K3XSnhH1sMhIDEqdLQ16MbecVynESByehFoD+z0r1NBDImWFwd2nrqW1YC4P8pD+qlVF +DrIrMEqn+8Ecq8+Imx0FHQYikXQsBOvBaAKqO8g8RsNVIvLjl93XuCpo2ao/htOKow== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none header.from=mucse.com; spf=pass smtp.mailfrom=mucse.com; 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 54766606A696; Wed, 25 Nov 2026 07:38:03 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=54.206.16.166 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795592272; b=huk+hZ+Ar8b6i3ZI0sc8pLuKfdF/Wfrd9PWjL2b7CV2eSCnQTJh0IWNyyxznqqVU6RA2 IrnaAVIsxaVJ/63GkNTMXJub55jYJGJP4uaEyVL/b+WSfsHXlwltcZARLd07yQV1svKr1 Awj3HwDKcxzlsqLRQbNdR5L5Qn2cgfIirihv+PFfpOBh7CaapjVUItfKHkLLsUdaawmmp ggdvXFbmknArElTvIEGdYajP3miDcfE9CTx979Z3rE0zrWbpZ37ouA59rt1G//7tSkf2p WEfz+YPKoZgCwBLuoTdoSfSQmvmOFqdxeBQUiUFCaeaZADRDdZ3YHEmKXQ+WUUUU3Jg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795592272; h=DMARC-Filter:X-QQ-mid:X-QQ-Originating-IP:Received:X-QQ-SSF: X-QQ-GoodBg:X-BIZMAIL-ID:EX-QQ-RecipientCnt:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To:X-QQ-SENDSIZE:Feedback-ID: X-QQ-XMAILINFO:X-QQ-XMRINFO:X-QQ-RECHKSPAM; bh=ZOjLaYx4Dr5j2yndCCgY4NG6T+IceZsHeZCSmK+kO8U=; b=FVZl9VII9ARxrlUrYwDhg7tPWjvuIqWlNXdpev34SZ2tyx+/x2plvZi6aKZZEkv5apbC 8CxnzqWFrg4c3xSlgpG0/X81oyyMh+OX7ReUI1np5XKg2qa5K4+lTB1KB3JAvBviKwLac Z2UxtxaER4ezkMCKtvXd2Xb0QcveHbsvBhZ4R02vvnGOJEafwfY3QQprMLCf3kifnihPD GnmU12PsvmwNTwlNCkSo9yLfHsQVR6ERi9CL897WHEfOmExr1+q7Kt5sWV0xoTQAXumCq NEahpVcyjWxBNjBk//SxH56veH5dNQYukIknSo28ZvBKTqDFuKVVQLQsAWx147dDi7Q== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=mucse.com; spf=pass smtp.mailfrom=mucse.com; arc=none smtp.remote-ip=54.206.16.166 X-Received: from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF412606A68E; Wed, 25 Nov 2026 07:37:49 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BF412606A68E X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mucse.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mucse.com X-QQ-mid: zesmtpsz6t1795592177tce07a167 X-QQ-Originating-IP: LdFUREjIl4gGNQIB0sNLmdnlMtTCXCJW8v+3qq6sx10= X-Received: from localhost ( [203.174.112.180]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 25 Nov 2026 15:36:14 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 10164209693582915750 X-EX-QQ-RecipientCnt: 10 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-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 X-In-Reply-To: <179558856602.3135.7505371780005583025@kernel.org> X-QQ-SENDSIZE: 520 X-Feedback-ID: zesmtpsz:mucse.com:qybglogicsvrgz:qybglogicsvrgz3a-1 X-QQ-XMAILINFO: NAl3ryHMp563Ees00LuXbJ7t7Sx3IZJL8l78K7f1rpQIF8+w34YbrItw y8miC+IrmeoN6657dvGUv3a4GngVeAfYKZpfbOwcMo/O4oBt00ec2MJwNfXTfjusvXOqHea hUt3aWwbKrI2fQFtMzoswtqPcT9HK+dBtS/IexFyyW9sc5Jg/OupHYIFgP1+4eEoBPs6QyY S0hLdnz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