From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Pascal Kneuper <PKneuper@dspace.de>, kuba@kernel.org
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com, rmk+kernel@armlinux.org.uk,
0x1207@gmail.com, si.yanteng@linux.dev, larysa.zaremba@intel.com,
aleksander.lobakin@intel.com, netdev@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, DBaldin@dspace.de
Subject: Re: [PATCH net v2] net: stmmac: restore NET_IP_ALIGN in the RX DMA offset
Date: Tue, 8 Sep 2026 10:16:59 +0200 [thread overview]
Message-ID: <09e7cd4b-b79c-47ea-95b6-1c1a96fe7657@bootlin.com> (raw)
In-Reply-To: <20260824125014.47862-1-PKneuper@dspace.de>
Hi,
On 8/24/26 14:50, Pascal Kneuper wrote:
> Since the RX path was converted to zero-copy, the page pool page is handed
> to the stack directly as the skb head, and the offset the DMA engine writes
> at is what determines the alignment of the packet headers.
>
> Before the conversion the payload was copied into an skb obtained from
> napi_alloc_skb(), which reserves NET_SKB_PAD + NET_IP_ALIGN. The
> conversion moved the headroom into stmmac_rx_offset() but did not carry
> over NET_IP_ALIGN, so on architectures where NET_IP_ALIGN is 2 the IP
> header now lands misaligned:
>
> 64 (NET_SKB_PAD) + 14 (ethernet) + 20 (IP) = 98
>
> Same for the XDP branch:
>
> 256 (XDP_PACKET_HEADROOM) + 14 (ethernet) + 20 (IP) = 290
>
> On ARM32 this is fatal, because ldm and ldrd trap on unaligned addresses
> even when CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set.
This patch breaks the stmmac selftests for Jumbo Frames on dwmac1000 :(
Try ethtool -t ethX, before :
27. Jumbo Frame 0
after :
27. Jumbo Frame -110
I _think_ the issue is that we have buffer start that is not 4-bytes aligned,
the controller can handle that no problem but it still performs a 4-byte
aligned transfer and discards the first 2 bytes of the first DMA word xfer,
and last 2 bytes of the last xfer.
The issue is that that last burst may not fit in the buffer size we specify in
the descriptor, so another descriptor is used to store the last 2 bytes of the
frame, and the first one doesn't have the "last" bit set.
We need to account for that when computing the descriptor size field in
stmmac_rx_buf1_len().
I can try to send a followup, if you can give it try that would be appreciated.
(this is the first bug found with my stmmac CI setup, we'rre getting somwhere !)
Maxime
next prev parent reply other threads:[~2026-09-08 8:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 9:29 [PATCH net] net: stmmac: restore NET_IP_ALIGN in the non-XDP RX path Pascal Kneuper
2026-08-18 1:22 ` Jakub Kicinski
2026-08-24 12:13 ` Pascal Kneuper
2026-08-24 12:50 ` [PATCH net v2] net: stmmac: restore NET_IP_ALIGN in the RX DMA offset Pascal Kneuper
2026-08-24 14:23 ` David Laight
2026-08-27 19:40 ` patchwork-bot+netdevbpf
2026-09-08 8:16 ` Maxime Chevallier [this message]
[not found] ` <5aeb6fd1-f1c3-426d-a2c4-1ad45ddc8572@bootlin.com>
2026-09-09 8:57 ` Pascal Kneuper
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=09e7cd4b-b79c-47ea-95b6-1c1a96fe7657@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=0x1207@gmail.com \
--cc=DBaldin@dspace.de \
--cc=PKneuper@dspace.de \
--cc=aleksander.lobakin@intel.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=larysa.zaremba@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=si.yanteng@linux.dev \
/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