From: Ding Hui <dinghui1111@163.com>
To: Maxime Chevallier <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>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
netdev@vger.kernel.org (open list:STMMAC ETHERNET DRIVER),
linux-stm32@st-md-mailman.stormreply.com (moderated
list:ARM/STM32 ARCHITECTURE),
linux-arm-kernel@lists.infradead.org (moderated list:ARM/STM32
ARCHITECTURE), linux-kernel@vger.kernel.org (open list)
Cc: dinghui@lixiang.com, xiasanbo@lixiang.com,
yangchen11@lixiang.com, liuxuanjun@lixiang.com
Subject: [PATCH net v6 0/4] net: stmmac: fix RX descriptors and XSK TX on resume
Date: Tue, 10 Nov 2026 20:38:51 +0800 [thread overview]
Message-ID: <cover.1794311618.git.dinghui@lixiang.com> (raw)
From: Ding Hui <dinghui@lixiang.com>
This series restores RX descriptor addresses overwritten by hardware
writeback between disabling NAPI and stopping RX DMA during suspend. It
also fixes an AF_XDP TX-only resume stall found while testing the series.
Patch 1 honors RX allocation flags. Patch 2 keeps unfilled XSK slots
CPU-owned and tracks pending refills explicitly, including an empty ring
and short refills. Patch 3 restores RX addresses from retained buffers,
rebuilds chain pointers and initializes descriptor control fields. It
publishes a contiguous XSK prefix and recomputes the tail and pending
region. Patch 4 restores the bound XSK TX pool after TX buffer cleanup;
otherwise zero-copy transmission can stop after resume.
The earlier commit 9c63faaa931e ("net: stmmac: re-init rx buffers when mac
resume back") was reverted by 00423969d806 after a Jetson TX2 suspend/resume
regression. This series retains existing buffers and DMA mappings instead
of recycling and reallocating every buffer. Jetson TX2 has not been tested.
Hardware validation used backports on our XGMAC platform with a vendor
kernel based on Linux 6.12.41, not these upstream commits as-is:
- Receiving iperf traffic from a PC while suspending and resuming caused a
fatal bus error after resume in almost every run without the RX fix.
The same test no longer showed that failure with the fix.
- Native XDP/AF_XDP zero-copy RX continued after two suspend/resume cycles
with the receive socket kept open.
- Zero-copy TX-only, with no RX fill buffers, is tested ok after one suspend/resume
cycle, with no fatal bus error.
- Pausing the receive application with SIGSTOP and resuming it with SIGCONT
recovered RX without recreating the socket.
- xdpsock is used for native XDP testing.
Additional testing would be welcome for RX sockets initially supplied with
0/1/8/15 fill buffers, replenishment in batches below 16, and those states
across suspend/resume. These differ from TX-only with no RX fill buffers.
Legacy descriptor cores, GMAC4, chain mode, timestamp-specific descriptor
paths, multiple XSK queues and long suspend/resume runs remain untested.
Missing page_pool buffers are still allocated during resume. Allocation
failure returns -ENOMEM without restarting DMA and leaves the device
detached. This adds a trigger for existing resume error-recovery problems;
full close/open recovery, including NAPI and platform power handling, is
separate work. The Medium-severity AI review on failure recovery is not
fully resolved by this revision.
Changes in v6:
- Add a separate fix to restore the bound XSK TX pool after resume cleanup,
addressing TX-only stalls found during XGMAC validation.
- Factor resume descriptor work into one TX queue loop and one RX loop,
following Thomas's review, and use common error cleanup.
- Restore addresses and chain pointers before initializing RX control fields,
preserving legacy fields and RIWT/IOC policy without a separate OWN loop.
- Add format-specific RX ownership clearing for unfilled XSK descriptors.
- Track pending XSK refills independently of circular index equality; retry
short refills and prevent consumption of unfilled descriptors.
- Restore a populated XSK prefix and retain later attached buffers for refill;
recompute the allocation count, initial tail and pending region.
- Select XSK buffer size independently of the initial allocation count.
- Discard any partially assembled RX frame before resetting the RX ring after resume.
Link to v5:
https://lore.kernel.org/netdev/20261025100636.613670-1-dinghui1111@163.com/
Changes in v5:
- Target net and add Fixes tags to both patches.
- Split the allocation-flags fix into a separate patch, with a Fixes tag
identifying the page_pool conversion that stopped honoring the flags.
- Share page_pool and XSK buffer preparation with the RX refill paths.
- Allocate missing secondary pages even when the primary page exists,
using the current baseline's buffer2 capability check.
- Condense the reinitialization kernel-doc to two paragraphs.
- Restore descriptor addresses before the final dma_wmb()/OWN pass.
- Clarify that unavailable XSK slots remain CPU-owned and may stop DMA
with RBU, rather than claiming that hardware skips them.
- Power down legacy SerDes if RX descriptor restoration fails.
Link to v4:
https://lore.kernel.org/netdev/20260627122533.1165324-1-dinghui1111@163.com/
Changes in v4:
- Document the return value of stmmac_reinit_rx_descriptors().
Link to v3:
https://lore.kernel.org/netdev/20260604144557.3175399-1-dinghui1111@163.com/
Changes in v3:
- Allocate missing page_pool buffers with GFP_KERNEL and abort resume
on allocation failure.
- Try to allocate missing XSK buffers and clear descriptors when the
fill ring cannot supply a buffer.
- Restore OWN after programming addresses and rebuilding chain pointers.
- Honor the flags argument of stmmac_init_rx_buffers().
- Restore RX descriptors after stmmac_clear_descriptors().
Link to v2:
https://lore.kernel.org/netdev/20260526022620.501229-1-dinghui1111@163.com/
Changes in v2:
- Introduce a helper to restore addresses from existing RX buffers.
- Update the commit message.
Link to v1:
https://lore.kernel.org/netdev/20260515053856.2310369-1-dinghui1111@163.com/
Ding Hui (4):
net: stmmac: honor allocation flags when initializing RX buffers
net: stmmac: track unfilled XSK RX descriptors explicitly
net: stmmac: restore RX descriptor buffer addresses on resume
net: stmmac: restore the XSK TX pool on resume
.../ethernet/stmicro/stmmac/dwmac4_descs.c | 6 +
.../ethernet/stmicro/stmmac/dwxgmac2_descs.c | 6 +
.../net/ethernet/stmicro/stmmac/enh_desc.c | 6 +
drivers/net/ethernet/stmicro/stmmac/hwif.h | 3 +
.../net/ethernet/stmicro/stmmac/norm_desc.c | 6 +
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 277 +++++++++++++-----
7 files changed, 228 insertions(+), 78 deletions(-)
base-commit: 7076f684d5132e6a6145e1da2fa74771ecd052e5
--
2.34.1
next reply other threads:[~2026-11-10 12:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 12:38 Ding Hui [this message]
2026-11-10 12:38 ` [PATCH net v6 1/4] net: stmmac: honor allocation flags when initializing RX buffers Ding Hui
2026-11-10 12:38 ` [PATCH net v6 2/4] net: stmmac: track unfilled XSK RX descriptors explicitly Ding Hui
2026-11-10 12:38 ` [PATCH net v6 3/4] net: stmmac: restore RX descriptor buffer addresses on resume Ding Hui
2026-11-10 12:38 ` [PATCH net v6 4/4] net: stmmac: restore the XSK TX pool " Ding Hui
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=cover.1794311618.git.dinghui@lixiang.com \
--to=dinghui1111@163.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dinghui@lixiang.com \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=liuxuanjun@lixiang.com \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=xiasanbo@lixiang.com \
--cc=yangchen11@lixiang.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
all inboxes | Powered by JetHome®