* [PATCH net v2 1/2] net: stmmac: Limit the MTU of normal descriptors to one buffer
2026-11-22 9:13 [PATCH net v2 0/2] net: stmmac: Limit the MTU of normal descriptors to one buffer Arun Iyengar via B4 Relay
@ 2026-11-22 9:13 ` Arun Iyengar via B4 Relay
2026-11-22 16:27 ` Nicolai Buchwitz
2026-11-23 9:13 ` sashiko-bot
2026-11-22 9:13 ` [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018 Arun Iyengar via B4 Relay
2026-11-22 10:48 ` [PATCH net v2 0/2] net: stmmac: Limit the MTU of normal descriptors to one buffer Chen-Yu Tsai
2 siblings, 2 replies; 13+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-22 9:13 UTC (permalink / raw)
To: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Maxime Coquelin, Alexandre Torgue, LABBE Corentin
Cc: netdev, linux-stm32, linux-arm-kernel, linux-sunxi, Russell King,
Nicolai Buchwitz, Arun Iyengar, stable
From: Arun Iyengar <aiyengar1990@gmail.com>
Russell King noted in [1] that max_mtu for normal descriptors,
SKB_MAX_HEAD() (3712 on arm64), does not match the hardware. Their
buffer sizes are 11 bits, and stmmac neither splits TX frames nor joins
RX descriptors for them, so a frame must fit one 2047-byte buffer.
Limit max_mtu so that a frame with two VLAN tags and the FCS fits.
Link: https://lore.kernel.org/r/E1vLJcL-0000000ExBL-0GFe@rmk-PC.armlinux.org.uk [1]
Fixes: 48febf7e6476 ("stmmac: allow mtu bigger than 1500 in case of normal desc (V4)")
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a685ce4638f6..2a27e1e7f9b9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -8247,6 +8247,9 @@ static int __stmmac_dvr_probe(struct device *device,
ndev->max_mtu = XGMAC_JUMBO_LEN;
else if (priv->plat->enh_desc || priv->synopsys_id >= DWMAC_CORE_4_00)
ndev->max_mtu = JUMBO_LEN;
+ else if (priv->hw->desc == &ndesc_ops)
+ ndev->max_mtu = BUF_SIZE_2KiB - 1 - ETH_HLEN - 2 * VLAN_HLEN -
+ ETH_FCS_LEN;
else
ndev->max_mtu = SKB_MAX_HEAD(NET_SKB_PAD + NET_IP_ALIGN);
--
2.55.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH net v2 1/2] net: stmmac: Limit the MTU of normal descriptors to one buffer
2026-11-22 9:13 ` [PATCH net v2 1/2] " Arun Iyengar via B4 Relay
@ 2026-11-22 16:27 ` Nicolai Buchwitz
2026-11-22 16:56 ` Chen-Yu Tsai
2026-11-23 9:13 ` sashiko-bot
1 sibling, 1 reply; 13+ messages in thread
From: Nicolai Buchwitz @ 2026-11-22 16:27 UTC (permalink / raw)
To: aiyengar1990
Cc: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Maxime Coquelin, Alexandre Torgue, LABBE Corentin,
netdev, linux-stm32, linux-arm-kernel, linux-sunxi, Russell King,
stable
On 22.11.2026 10:13, Arun Iyengar via B4 Relay wrote:
> From: Arun Iyengar <aiyengar1990@gmail.com>
>
> Russell King noted in [1] that max_mtu for normal descriptors,
> SKB_MAX_HEAD() (3712 on arm64), does not match the hardware. Their
> buffer sizes are 11 bits, and stmmac neither splits TX frames nor joins
> RX descriptors for them, so a frame must fit one 2047-byte buffer.
AFAIU TX does split (jumbo_frm() in chain_mode.c).
This makes RX the real limit as ndesc_get_rx_status() drops a frame that
spans more than one descriptor. Please say that instead, it should also
answer Chen-Yu's question about hardware vs driver?
>
> Limit max_mtu so that a frame with two VLAN tags and the FCS fits.
>
> Link:
> https://lore.kernel.org/r/E1vLJcL-0000000ExBL-0GFe@rmk-PC.armlinux.org.uk
> [1]
> Fixes: 48febf7e6476 ("stmmac: allow mtu bigger than 1500 in case of
> normal desc (V4)")
> Cc: Russell King <rmk+kernel@armlinux.org.uk>
> Cc: stable@vger.kernel.org
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
> [...]
Thanks,
Nicolai
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH net v2 1/2] net: stmmac: Limit the MTU of normal descriptors to one buffer
2026-11-22 16:27 ` Nicolai Buchwitz
@ 2026-11-22 16:56 ` Chen-Yu Tsai
0 siblings, 0 replies; 13+ messages in thread
From: Chen-Yu Tsai @ 2026-11-22 16:56 UTC (permalink / raw)
To: Nicolai Buchwitz
Cc: aiyengar1990, Maxime Chevallier, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jernej Skrabec,
Samuel Holland, Maxime Coquelin, Alexandre Torgue, LABBE Corentin,
netdev, linux-stm32, linux-arm-kernel, linux-sunxi, Russell King,
stable
On Mon, Nov 23, 2026 at 12:27 AM Nicolai Buchwitz <nb@tipi-net.de> wrote:
>
> On 22.11.2026 10:13, Arun Iyengar via B4 Relay wrote:
> > From: Arun Iyengar <aiyengar1990@gmail.com>
> >
> > Russell King noted in [1] that max_mtu for normal descriptors,
> > SKB_MAX_HEAD() (3712 on arm64), does not match the hardware. Their
> > buffer sizes are 11 bits, and stmmac neither splits TX frames nor joins
> > RX descriptors for them, so a frame must fit one 2047-byte buffer.
>
> AFAIU TX does split (jumbo_frm() in chain_mode.c).
Yes. But it also assumes each buffer is 2KB or 8KB, which this series
already says is not correct. (I do wonder why the size field is not
size - 1.)
And also, if I'm reading this correctly, the jumbo frame conditional
is only ever true if enhanced descriptors are available:
/* To program the descriptors according to the size of the frame */
if (enh_desc)
is_jumbo = stmmac_is_jumbo_frm(priv, skb->len, enh_desc);
csum_insertion = skb->ip_summed == CHECKSUM_PARTIAL;
if (unlikely(is_jumbo)) {
entry = stmmac_jumbo_frm(priv, tx_q, skb, csum_insertion);
if (unlikely(entry < 0) && (entry != -EINVAL))
I might have pointed this out in a reply to Arun's other patch, but here
it is again. This seems to have been broke since 2014 by
29896a674c8e stmmac: fix chained mode
> This makes RX the real limit as ndesc_get_rx_status() drops a frame that
> spans more than one descriptor. Please say that instead, it should also
> answer Chen-Yu's question about hardware vs driver?
It's great that we have interest in getting this working again, and tools
to help us get there.
FWIW the the new "GMAC200" cores in the latest Allwinner SoCs, and the GMAC
in Rockchip SoCs would also benefit. As far as I can tell they don't support
enhanced descriptors, based on DMA cap values reported in debugfs.
ChenYu
> >
> > Limit max_mtu so that a frame with two VLAN tags and the FCS fits.
> >
> > Link:
> > https://lore.kernel.org/r/E1vLJcL-0000000ExBL-0GFe@rmk-PC.armlinux.org.uk
> > [1]
> > Fixes: 48febf7e6476 ("stmmac: allow mtu bigger than 1500 in case of
> > normal desc (V4)")
> > Cc: Russell King <rmk+kernel@armlinux.org.uk>
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
>
> > [...]
>
> Thanks,
> Nicolai
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net v2 1/2] net: stmmac: Limit the MTU of normal descriptors to one buffer
2026-11-22 9:13 ` [PATCH net v2 1/2] " Arun Iyengar via B4 Relay
2026-11-22 16:27 ` Nicolai Buchwitz
@ 2026-11-23 9:13 ` sashiko-bot
1 sibling, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-11-23 9:13 UTC (permalink / raw)
To: Arun Iyengar; +Cc: linux-sunxi
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: stmmac: unaligned 2047-byte RX buffer limit in
__stmmac_dvr_probe()
--
commit 1afb1c292cbb61be8075f08aa85d66c725abdea3
Author: Arun Iyengar <aiyengar1990@gmail.com>
net: stmmac: Limit the MTU of normal descriptors to one buffer
This commit limits ndev->max_mtu for normal descriptors (ndesc_ops) so
that an Ethernet frame with two VLAN tags and the FCS fits within a
single 2047-byte buffer.
Link: https://lore.kernel.org/r/E1vLJcL-0000000ExBL-0GFe@rmk-PC.armlinux.org.uk [1]
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index a685ce4638f61..2a27e1e7f9b9f 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -8247,6 +8247,9 @@ static int __stmmac_dvr_probe(struct device *device,
> ndev->max_mtu = XGMAC_JUMBO_LEN;
> else if (priv->plat->enh_desc || priv->synopsys_id >= DWMAC_CORE_4_00)
> ndev->max_mtu = JUMBO_LEN;
> + else if (priv->hw->desc == &ndesc_ops)
> + ndev->max_mtu = BUF_SIZE_2KiB - 1 - ETH_HLEN - 2 * VLAN_HLEN -
> + ETH_FCS_LEN;
> else
> ndev->max_mtu = SKB_MAX_HEAD(NET_SKB_PAD + NET_IP_ALIGN);
[Severity: Medium]
Can RX DMA fill all 2047 bytes (BUF_SIZE_2KiB - 1) of a normal descriptor
buffer when ndev->max_mtu is set to 2021?
As noted in common.h ("RX Buffer size must be multiple of 4/8/16 bytes"),
DWMAC RX DMA transfers bus-width words, so a buffer programmed to
BUF_SIZE_2KiB - 1 in ndesc_init_rx_desc() can hold at most 2044, 2040, or
2032 bytes depending on the 32/64/128-bit DMA bus width. When a frame of
2045..2047 bytes arrives, Buffer 1 fills without setting
RDES0_LAST_DESCRIPTOR, causing the frame to be dropped in chain mode or
to spill into Buffer 2 in ring mode (where ndesc_rx_set_on_ring() sets
RBS2 to 1 while p->des3 is 0).
Also, allowing an MTU in 2001..2021 causes dwmac1000_core_init() to set
GMAC_CONTROL_JE (mtu > 2000), enabling reception of 9018-byte jumbo
frames that cannot fit in a single normal descriptor buffer.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261122-sun8i-emac-mtu-limit-v2-0-c4081e5b83cf@gmail.com?part=1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018
2026-11-22 9:13 [PATCH net v2 0/2] net: stmmac: Limit the MTU of normal descriptors to one buffer Arun Iyengar via B4 Relay
2026-11-22 9:13 ` [PATCH net v2 1/2] " Arun Iyengar via B4 Relay
@ 2026-11-22 9:13 ` Arun Iyengar via B4 Relay
2026-11-22 11:39 ` Chen-Yu Tsai
2026-11-22 16:33 ` Nicolai Buchwitz
2026-11-22 10:48 ` [PATCH net v2 0/2] net: stmmac: Limit the MTU of normal descriptors to one buffer Chen-Yu Tsai
2 siblings, 2 replies; 13+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-22 9:13 UTC (permalink / raw)
To: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Maxime Coquelin, Alexandre Torgue, LABBE Corentin
Cc: netdev, linux-stm32, linux-arm-kernel, linux-sunxi, Russell King,
Nicolai Buchwitz, Arun Iyengar, stable
From: Arun Iyengar <aiyengar1990@gmail.com>
The H616 RX DMA fills only 2044 bytes of a buffer, so frames of 2045 to
2047 bytes, allowed by the previous patch, are dropped. Limit the MTU
so that a frame with two VLAN tags and the FCS fits 2044 bytes.
Fixes: 9f93ac8d4085 ("net-next: stmmac: Add dwmac-sun8i")
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 2ece7ba9dd73..ec401cae8187 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -1208,6 +1208,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
plat_dat->mac_setup = sun8i_dwmac_setup;
plat_dat->tx_fifo_size = 4096;
plat_dat->rx_fifo_size = 16384;
+ plat_dat->maxmtu = 2044 - ETH_HLEN - 2 * VLAN_HLEN - ETH_FCS_LEN;
ret = sun8i_dwmac_set_syscon(&pdev->dev, plat_dat);
if (ret)
--
2.55.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018
2026-11-22 9:13 ` [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018 Arun Iyengar via B4 Relay
@ 2026-11-22 11:39 ` Chen-Yu Tsai
2026-11-22 16:31 ` Nicolai Buchwitz
2026-11-22 18:56 ` Andrew Lunn
2026-11-22 16:33 ` Nicolai Buchwitz
1 sibling, 2 replies; 13+ messages in thread
From: Chen-Yu Tsai @ 2026-11-22 11:39 UTC (permalink / raw)
To: aiyengar1990, Maxime Chevallier
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Jernej Skrabec, Samuel Holland, Maxime Coquelin,
Alexandre Torgue, LABBE Corentin, netdev, linux-stm32,
linux-arm-kernel, linux-sunxi, Russell King, Nicolai Buchwitz,
stable
On Sun, Nov 22, 2026 at 5:13 PM Arun Iyengar via B4 Relay
<devnull+aiyengar1990.gmail.com@kernel.org> wrote:
>
> From: Arun Iyengar <aiyengar1990@gmail.com>
>
> The H616 RX DMA fills only 2044 bytes of a buffer, so frames of 2045 to
> 2047 bytes, allowed by the previous patch, are dropped. Limit the MTU
> so that a frame with two VLAN tags and the FCS fits 2044 bytes.
FWIW I think this applies to all DWMAC cores.
So I tried to do some research of my own. Google AI search pointed me to
STM32F4 or STM32F7, and some Altera FPGAs (I used the Intel® Arria® 10 Hard
Processor System Technical Reference Manual"), that had some variant or
version of the DWMAC core, and had proper programming guides.
The STM32F4 reference manuals has this note:
Even when the start address of a receive buffer is not aligned to the
system databus width
the system should allocate a receive buffer of a size aligned to the
system bus width. For
example, if the system allocates a 1024 byte (1 KB) receive buffer
starting from address
0x1000, the software can program the buffer start address in the
receive descriptor to have
a 0x1002 offset. The receive DMA writes the frame to this buffer with
dummy data in the first
two locations (0x1000 and 0x1001). The actual frame is written from
location 0x1002. Thus,
the actual useful space in this buffer is 1022 bytes, even though the
buffer size is
programmed as 1024 bytes, due to the start address offset.
The Intel one had the same note. It looks pretty much the same, but I didn't
compare it word-for-word.
So for normal descriptors the buffer size is bound to (2KB - bus width).
Not tested, but I think there is more evidence supporting a cross-platform
limit.
ChenYu
> Fixes: 9f93ac8d4085 ("net-next: stmmac: Add dwmac-sun8i")
> Cc: stable@vger.kernel.org
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> index 2ece7ba9dd73..ec401cae8187 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> @@ -1208,6 +1208,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
> plat_dat->mac_setup = sun8i_dwmac_setup;
> plat_dat->tx_fifo_size = 4096;
> plat_dat->rx_fifo_size = 16384;
> + plat_dat->maxmtu = 2044 - ETH_HLEN - 2 * VLAN_HLEN - ETH_FCS_LEN;
>
> ret = sun8i_dwmac_set_syscon(&pdev->dev, plat_dat);
> if (ret)
>
> --
> 2.55.0
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018
2026-11-22 11:39 ` Chen-Yu Tsai
@ 2026-11-22 16:31 ` Nicolai Buchwitz
2026-11-22 16:36 ` Maxime Chevallier
2026-11-22 18:56 ` Andrew Lunn
1 sibling, 1 reply; 13+ messages in thread
From: Nicolai Buchwitz @ 2026-11-22 16:31 UTC (permalink / raw)
To: wens, Maxime Chevallier
Cc: aiyengar1990, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Jernej Skrabec, Samuel Holland,
Maxime Coquelin, Alexandre Torgue, LABBE Corentin, netdev,
linux-stm32, linux-arm-kernel, linux-sunxi, Russell King, stable
On 22.11.2026 12:39, Chen-Yu Tsai wrote:
> [...]
> FWIW I think this applies to all DWMAC cores.
> [...]
> So for normal descriptors the buffer size is bound to (2KB - bus
> width).
> Not tested, but I think there is more evidence supporting a
> cross-platform
> limit.
The sun8i EMAC isn't a Synopsys core, so this needs a test on one.
Maxime, could you try MTU 2019-2021 on your boards?
> [...]
Regards,
Nicolai
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018
2026-11-22 16:31 ` Nicolai Buchwitz
@ 2026-11-22 16:36 ` Maxime Chevallier
2026-11-22 16:40 ` Nicolai Buchwitz
0 siblings, 1 reply; 13+ messages in thread
From: Maxime Chevallier @ 2026-11-22 16:36 UTC (permalink / raw)
To: Nicolai Buchwitz, wens
Cc: aiyengar1990, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Jernej Skrabec, Samuel Holland,
Maxime Coquelin, Alexandre Torgue, LABBE Corentin, netdev,
linux-stm32, linux-arm-kernel, linux-sunxi, Russell King, stable
Hi,
On 11/22/26 17:31, Nicolai Buchwitz wrote:
> On 22.11.2026 12:39, Chen-Yu Tsai wrote:
>> [...]
>
>> FWIW I think this applies to all DWMAC cores.
>
>> [...]
>
>> So for normal descriptors the buffer size is bound to (2KB - bus width).
>> Not tested, but I think there is more evidence supporting a cross-platform
>> limit.
>
> The sun8i EMAC isn't a Synopsys core, so this needs a test on one.
It's likely a synopsys core, but with some wrapper around the register accesses,
hard to tell how much of the actual dwmac is in there ._.
> Maxime, could you try MTU 2019-2021 on your boards?
It'll be tested in the nightly runs, I've setup some local MTU sweep tests
following the previous version of that patch :)
wonder what else will come out of it, I'll report in the morning.
Maxime
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018
2026-11-22 16:36 ` Maxime Chevallier
@ 2026-11-22 16:40 ` Nicolai Buchwitz
0 siblings, 0 replies; 13+ messages in thread
From: Nicolai Buchwitz @ 2026-11-22 16:40 UTC (permalink / raw)
To: Maxime Chevallier
Cc: wens, aiyengar1990, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Jernej Skrabec, Samuel Holland,
Maxime Coquelin, Alexandre Torgue, LABBE Corentin, netdev,
linux-stm32, linux-arm-kernel, linux-sunxi, Russell King, stable
On 22.11.2026 17:36, Maxime Chevallier wrote:
> [...]
>> The sun8i EMAC isn't a Synopsys core, so this needs a test on one.
>
> It's likely a synopsys core, but with some wrapper around the register
> accesses,
> hard to tell how much of the actual dwmac is in there ._.
Someone really needs to draw fancy cheat sheet with a stmmac family
tree - lots of weird uncles and stepmothers :-)
>
>> Maxime, could you try MTU 2019-2021 on your boards?
>
> It'll be tested in the nightly runs, I've setup some local MTU sweep
> tests
> following the previous version of that patch :)
Thanks!
>
> wonder what else will come out of it, I'll report in the morning.
>
> Maxime
Nicolai
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018
2026-11-22 11:39 ` Chen-Yu Tsai
2026-11-22 16:31 ` Nicolai Buchwitz
@ 2026-11-22 18:56 ` Andrew Lunn
1 sibling, 0 replies; 13+ messages in thread
From: Andrew Lunn @ 2026-11-22 18:56 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: aiyengar1990, Maxime Chevallier, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jernej Skrabec,
Samuel Holland, Maxime Coquelin, Alexandre Torgue, LABBE Corentin,
netdev, linux-stm32, linux-arm-kernel, linux-sunxi, Russell King,
Nicolai Buchwitz, stable
> The STM32F4 reference manuals has this note:
>
> Even when the start address of a receive buffer is not aligned to the
> system databus width
> the system should allocate a receive buffer of a size aligned to the
> system bus width. For
> example, if the system allocates a 1024 byte (1 KB) receive buffer
> starting from address
> 0x1000, the software can program the buffer start address in the
> receive descriptor to have
> a 0x1002 offset. The receive DMA writes the frame to this buffer with
> dummy data in the first
> two locations (0x1000 and 0x1001). The actual frame is written from
> location 0x1002.
> So for normal descriptors the buffer size is bound to (2KB - bus width).
There is a second use for this, unrelated to bus width. The ethernet
header is 14 bytes in size, 2x 6 octet MAC address plus a 2 octet
ethertype header. By offsetting the start address by two, it means the
data after the ethernet header is then 4 byte aligned, making it more
efficient to access fields in the IP, TCP UDP headers etc.
Andrew
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018
2026-11-22 9:13 ` [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018 Arun Iyengar via B4 Relay
2026-11-22 11:39 ` Chen-Yu Tsai
@ 2026-11-22 16:33 ` Nicolai Buchwitz
1 sibling, 0 replies; 13+ messages in thread
From: Nicolai Buchwitz @ 2026-11-22 16:33 UTC (permalink / raw)
To: aiyengar1990
Cc: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Maxime Coquelin, Alexandre Torgue, LABBE Corentin,
netdev, linux-stm32, linux-arm-kernel, linux-sunxi, Russell King,
stable
On 22.11.2026 10:13, Arun Iyengar via B4 Relay wrote:
> From: Arun Iyengar <aiyengar1990@gmail.com>
>
> The H616 RX DMA fills only 2044 bytes of a buffer, so frames of 2045 to
> 2047 bytes, allowed by the previous patch, are dropped. Limit the MTU
> so that a frame with two VLAN tags and the FCS fits 2044 bytes.
>
> Fixes: 9f93ac8d4085 ("net-next: stmmac: Add dwmac-sun8i")
> Cc: stable@vger.kernel.org
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
> [...]
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Thanks,
Nicolai
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net v2 0/2] net: stmmac: Limit the MTU of normal descriptors to one buffer
2026-11-22 9:13 [PATCH net v2 0/2] net: stmmac: Limit the MTU of normal descriptors to one buffer Arun Iyengar via B4 Relay
2026-11-22 9:13 ` [PATCH net v2 1/2] " Arun Iyengar via B4 Relay
2026-11-22 9:13 ` [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018 Arun Iyengar via B4 Relay
@ 2026-11-22 10:48 ` Chen-Yu Tsai
2 siblings, 0 replies; 13+ messages in thread
From: Chen-Yu Tsai @ 2026-11-22 10:48 UTC (permalink / raw)
To: aiyengar1990
Cc: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Jernej Skrabec, Samuel Holland,
Maxime Coquelin, Alexandre Torgue, LABBE Corentin, netdev,
linux-stm32, linux-arm-kernel, linux-sunxi, Russell King,
Nicolai Buchwitz, stable
On Sun, Nov 22, 2026 at 5:13 PM Arun Iyengar via B4 Relay
<devnull+aiyengar1990.gmail.com@kernel.org> wrote:
>
> Normal descriptors take frames of at most one 2047-byte buffer, but
> max_mtu allows 3712 on arm64. Patch 1 limits it in the core, patch 2
> limits dwmac-sun8i further to the 2044 bytes its RX DMA fills.
I think you should clearly state that *one normal descriptor* can have
a buffer of up to 2047 bytes. And the driver is currently limited to
using one descriptor per-frame.
The way you write it makes it unclear whether it's a hardware or driver
limitation. I believe it is the latter.
> Tested on an Orange Pi Zero2 (H616) on net/main. Without the patches,
> MTU 2029 to 2100 is accepted and ping gets no reply. With patch 1 the
> maximum is 2021, with both 2018. UDP and ping are lossless up to the
> maximum, and larger MTUs are refused. Ring mode and other cores are
> untested.
>
> Claude (AI) helped write these patches; I reviewed and tested them.
>
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
> ---
> Changes in v2:
> - Limit normal descriptors in the core (patch 1, Andrew Lunn, Maxime
> Chevallier), keep the lower sun8i limit as patch 2
> - Link to v1: https://patch.msgid.link/20261121-sun8i-emac-mtu-limit-v1-1-22492842d318@gmail.com
>
> ---
> Arun Iyengar (2):
> net: stmmac: Limit the MTU of normal descriptors to one buffer
> net: stmmac: dwmac-sun8i: Limit the MTU to 2018
>
> drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 1 +
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
> 2 files changed, 4 insertions(+)
> ---
> base-commit: 890f23ba87a7ca1aba97c8320770a686e3b689fb
> change-id: 20261121-sun8i-emac-mtu-limit-66a936064965
>
> Best regards,
> --
> Arun Iyengar <aiyengar1990@gmail.com>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread