From: Nicolai Buchwitz <nb@tipi-net.de>
To: Anandu Padinhare <Anandu.Padinhare@electrifex.com>
Cc: maxime.chevallier@bootlin.com,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, Jisheng Zhang <jszhang@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>
Subject: Re: [PATCH net] net: stmmac: count XDP_PASS frames in rx_packets on the XSK zero-copy path
Date: Sun, 22 Nov 2026 19:04:12 +0100 [thread overview]
Message-ID: <76eb00ac442816ff06e7b9d338d9bf1d@tipi-net.de> (raw)
In-Reply-To: <PNYPR01MB11444552E41C2B17A992492C0FD762@PNYPR01MB11444.INDPRD01.PROD.OUTLOOK.COM>
Hi Anandu
On 6.11.2026 07:12, Anandu Padinhare wrote:
> In the AF_XDP zero-copy RX path, frames that the XDP program passes to
> the stack are handed over by stmmac_dispatch_skb_zc(). That function
> increments rx_pkt_n instead of rx_packets since
> commit 133466c3bbe1 ("net: stmmac: use per-queue 64 bit statistics
> where necessary").
>
> stmmac_rx_zc() already adds every processed frame to rx_pkt_n, so each
> XDP_PASS frame is counted twice there, and rx_packets, which
> ndo_get_stats64() reports, never counts them: on a zero-copy queue
> rx_bytes grows with the passed frames while rx_packets stays still.
>
> Count the frame in rx_packets, as the regular RX path and the code
> before that commit did.
>
> Found while testing AF_XDP zero-copy on an ADSP-SC598 (adi-dwmac,
> 100 Mbit/s link): rx_pkt_n grew almost twice as fast as the frames the
> MAC delivered, while "ip -s link" counted almost none.
>
> Tested on that board with a 6.18-based kernel, whose zero-copy RX
> accounting matches net. An AF_XDP zero-copy socket on queue 0 received
> frames of one EtherType while UDP traffic was passed to the stack. In a
> run with 60 s of traffic before the change, rx_pkt_n was 1.88 times the
> frames that reached the driver (MAC frames minus RX FIFO overflows) and
> "ip -s link" counted 55 RX packets. In the same test with the change,
> rx_pkt_n equals the frames that reached the driver and rx_packets
> equals
> the frames passed to the stack.
>
> Fixes: 133466c3bbe1 ("net: stmmac: use per-queue 64 bit statistics
> where necessary")
> Signed-off-by: Anandu Padinhare <Anandu.Padinhare@electrifex.com>
> [...]
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Thanks,
Nicolai
prev parent reply other threads:[~2026-11-22 18:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 6:12 [PATCH net] net: stmmac: count XDP_PASS frames in rx_packets on the XSK zero-copy path Anandu Padinhare
2026-11-06 8:45 ` Lorenzo Bianconi
2026-11-11 1:10 ` patchwork-bot+netdevbpf
2026-11-22 18:04 ` Nicolai Buchwitz [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=76eb00ac442816ff06e7b9d338d9bf1d@tipi-net.de \
--to=nb@tipi-net.de \
--cc=Anandu.Padinhare@electrifex.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=jszhang@kernel.org \
--cc=kuba@kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.