🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
6 messages
6 total messages Started by Arun Iyengar via B4 Relay Sat, 21 Nov 2026 04:43
[PATCH net] net: stmmac: dwmac-sun8i: Limit the MTU to one descriptor buffer
#20082
Author: Arun Iyengar via B4 Relay
Date: Sat, 21 Nov 2026 04:43
60 lines
12941 bytes
From: Arun Iyengar <aiyengar1990@gmail.com>

Russell King pointed out in [1] that max_mtu ignores the 11-bit buffer
size of normal descriptors. dwmac-sun8i always uses them in chain mode,
so a frame must fit one buffer, but max_mtu is SKB_MAX_HEAD() (3712 on
arm64). Sashiko asked in [2] for this to go in as a fix.

On an H616 the RX DMA fills 2044 bytes of a buffer and
ndesc_get_rx_status() drops a frame that spans two. On TX the MAC cuts
a frame after 2048 bytes (TX_FRM_LEN_CTL is clear). At MTU 2033 no UDP
datagram gets through in either direction.

Limit the MTU so that a frame with two VLAN tags and the FCS fits 2044
bytes (MTU 2018). MTU 2019-2026, which worked without VLAN tags, is now
refused.

Link: https://lore.kernel.org/r/E1vLJcL-0000000ExBL-0GFe@rmk-PC.armlinux.org.uk [1]
Link: https://lore.kernel.org/r/20261112-sun8i-emac-jumbo-v2-2-aca0cf23cf17@gmail.com [2]
Fixes: 9f93ac8d4085 ("net-next: stmmac: Add dwmac-sun8i")
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Nicolai Buchwitz <nb@tipi-net.de>
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Tested on an Orange Pi Zero2 (H616) on net/main with and without this
patch (RX fill measured on v7.3.5). Claude (AI) helped write this patch;
I reviewed and tested it.
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 2ece7ba9dd73..1f4fa722529f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -6,6 +6,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/if_vlan.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/mdio-mux.h>
@@ -1208,6 +1209,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)

---
base-commit: d5b89d55a322b632e2b465b392a4c1d9d338db9c
change-id: 20261121-sun8i-emac-mtu-limit-66a936064965

Best regards,
--  
Arun Iyengar <aiyengar1990@gmail.com>
Re: [PATCH net] net: stmmac: dwmac-sun8i: Limit the MTU to one descriptor buffer
#20170
Author: Andrew Lunn
Date: Sat, 21 Nov 2026 18:02
21 lines
9562 bytes
On Sat, Nov 21, 2026 at 04:43:41AM +0000, Arun Iyengar via B4 Relay wrote:
> From: Arun Iyengar <aiyengar1990@gmail.com>
> 
> Russell King pointed out in [1] that max_mtu ignores the 11-bit buffer
> size of normal descriptors. dwmac-sun8i always uses them in chain mode,
> so a frame must fit one buffer, but max_mtu is SKB_MAX_HEAD() (3712 on
> arm64). Sashiko asked in [2] for this to go in as a fix.
> 
> On an H616 the RX DMA fills 2044 bytes of a buffer and
> ndesc_get_rx_status() drops a frame that spans two. On TX the MAC cuts
> a frame after 2048 bytes (TX_FRM_LEN_CTL is clear). At MTU 2033 no UDP
> datagram gets through in either direction.
> 
> Limit the MTU so that a frame with two VLAN tags and the FCS fits 2044
> bytes (MTU 2018). MTU 2019-2026, which worked without VLAN tags, is now
> refused.

Is this problem specific to the dwmac-sun8i?

   Andrew
Re: [PATCH net] net: stmmac: dwmac-sun8i: Limit the MTU to one descriptor buffer
#20350
Author: Chen-Yu Tsai
Date: Sun, 22 Nov 2026 07:26
74 lines
12138 bytes
On Sat, Nov 21, 2026 at 12:43 PM Arun Iyengar via B4 Relay
<devnull+aiyengar1990.gmail.com@kernel.org> wrote:
>
> From: Arun Iyengar <aiyengar1990@gmail.com>
>
> Russell King pointed out in [1] that max_mtu ignores the 11-bit buffer
> size of normal descriptors. dwmac-sun8i always uses them in chain mode,
> so a frame must fit one buffer, but max_mtu is SKB_MAX_HEAD() (3712 on
> arm64). Sashiko asked in [2] for this to go in as a fix.
>
> On an H616 the RX DMA fills 2044 bytes of a buffer and
> ndesc_get_rx_status() drops a frame that spans two. On TX the MAC cuts
> a frame after 2048 bytes (TX_FRM_LEN_CTL is clear). At MTU 2033 no UDP
> datagram gets through in either direction.
>
> Limit the MTU so that a frame with two VLAN tags and the FCS fits 2044
> bytes (MTU 2018). MTU 2019-2026, which worked without VLAN tags, is now
> refused.

So what's the overall plan? Limit it first to make things work, get the
fix backported, and then fix jumbo frame (>2K) handling so it works
for any MTU value?

> Link: https://lore.kernel.org/r/E1vLJcL-0000000ExBL-0GFe@rmk-PC.armlinux.org.uk [1]
> Link: https://lore.kernel.org/r/20261112-sun8i-emac-jumbo-v2-2-aca0cf23cf17@gmail.com [2]
> Fixes: 9f93ac8d4085 ("net-next: stmmac: Add dwmac-sun8i")
> Cc: Russell King <rmk+kernel@armlinux.org.uk>
> Cc: Nicolai Buchwitz <nb@tipi-net.de>
> Cc: stable@vger.kernel.org
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
> ---
> Tested on an Orange Pi Zero2 (H616) on net/main with and without this
> patch (RX fill measured on v7.3.5). Claude (AI) helped write this patch;
> I reviewed and tested it.
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> index 2ece7ba9dd73..1f4fa722529f 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> @@ -6,6 +6,7 @@
>   */
>
>  #include <linux/clk.h>
> +#include <linux/if_vlan.h>
>  #include <linux/io.h>
>  #include <linux/iopoll.h>
>  #include <linux/mdio-mux.h>
> @@ -1208,6 +1209,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)
>
> ---
> base-commit: d5b89d55a322b632e2b465b392a4c1d9d338db9c
> change-id: 20261121-sun8i-emac-mtu-limit-66a936064965
>
> Best regards,
> --
> Arun Iyengar <aiyengar1990@gmail.com>
>
>
Re: [PATCH net] net: stmmac: dwmac-sun8i: Limit the MTU to one descriptor buffer
#20374
Author: Arun Iyengar
Date: Sun, 22 Nov 2026 09:11
10 lines
12943 bytes
On Sun, Nov 22, 2026 at 3:26 PM Chen-Yu Tsai <wens@kernel.org> wrote:
> So what's the overall plan? Limit it first to make things work, get the
> fix backported, and then fix jumbo frame (>2K) handling so it works
> for any MTU value?

Yes. v2 for net limits normal descriptors to one buffer in the stmmac
core, with the lower sun8i limit on top, for stable. The jumbo series
then goes to net-next on top of it and lifts the limit for sun8i:
https://lore.kernel.org/r/20261112-sun8i-emac-jumbo-v2-2-aca0cf23cf17@gmail.com
Re: [PATCH net] net: stmmac: dwmac-sun8i: Limit the MTU to one descriptor buffer
#20375
Author: Arun Iyengar
Date: Sun, 22 Nov 2026 09:12
8 lines
12618 bytes
On 11/22/26 08:56, Maxime Chevallier wrote:
> The problem is real indeed, but not specific to this glue. Rather, the max_mtu
> computation should be fixed for normal descriptors altogether. Can you work
> on such a fix ?

Yes, v2 does that in stmmac_main.c, with the lower sun8i limit as a
separate patch on top.
Re: [PATCH net] net: stmmac: dwmac-sun8i: Limit the MTU to one descriptor buffer
#20376
Author: Arun Iyengar
Date: Sun, 22 Nov 2026 09:12
11 lines
12883 bytes
On Sat, Nov 21, 2026 at 07:02:38PM +0100, Andrew Lunn wrote:
> Is this problem specific to the dwmac-sun8i?

No. As Russell wrote in his RFC, every core with normal descriptors
gets max_mtu = SKB_MAX_HEAD() while a descriptor buffer holds 2047
bytes. dwmac-sun8i is the only glue always in chain mode and the only
such hardware I have, so that is where I measured it.

I will send a v2 that limits normal descriptors to one buffer in the
core, with the lower sun8i limit on top, tested on the H616 only.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads