🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20410

Re: [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018

#20410
From: Chen-Yu Tsai
Date: Sun, 22 Nov 2026 11:39
74 lines
12058 bytes
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
>
>
Technical Details
Message-ID: <CAGb2v65_vY86WqvKr1m=g0N1Qr2UhLC1v3OHKPG3x+oURUKp7Q@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368673-linux-kernel-netdev=dewy.ru
References: <20261122-sun8i-emac-mtu-limit-v2-0-c4081e5b83cf@gmail.com> <20261122-sun8i-emac-mtu-limit-v2-2-c4081e5b83cf@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368673-linux-kernel-netdev=dewy.ru
From: wens@kernel.org (Chen-Yu Tsai)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018
Date: Sun, 22 Nov 2026 19:39:05 +0800
Organization: Usenet Network
Message-ID: <CAGb2v65_vY86WqvKr1m=g0N1Qr2UhLC1v3OHKPG3x+oURUKp7Q@mail.gmail.com>
References: <20261122-sun8i-emac-mtu-limit-v2-0-c4081e5b83cf@gmail.com> <20261122-sun8i-emac-mtu-limit-v2-2-c4081e5b83cf@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="3623609"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:T5IFn73hTnGdsu+EpMpP+jmfKVE= sha256:OUW5yPqoFVmVGwoL+4AlEl7IA+hNEb+zTcJbJCxnBBk=
	sha1:zinxJc+CkRviyyHDpVEcU4wKe/s= sha256:w9KVCg0iDJJcI0SePxp83INQ72WmK4mrprQOQAM7XMo=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id AF710125D75; Sun, 22 Nov 2026 14:39:35 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 04aqXFR87Rde;
	Sun, 22 Nov 2026 14:39:32 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-368673-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id C0797125D6E; Sun, 22 Nov 2026 14:39:23 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id D04702753D; Sun, 22 Nov 2026 11:39:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795347560;
	b=3Qpkh0MsjX87Ibi/7OsBDwotoYiDRCrevDg8j3mmaV6cgn0G6npA+1arsSoyZFML4ltf
	 6AG2nUPrJ4DYf77oLM1QyokiwFV1CPfw53MZO/Qu5MZBKwoLMkvq7Ty85rhIy81ziZaZ2
	 jmd4aaN6SrEf3lyOO2JYOTs7pJGVBC7Zctwtj11hD9fTjifY80cgTz8O007e3jpEJyqti
	 zYBsq0zjj8dxgvznHyeavJUDOn3BfQagduPswqgO5JXbI0QEMBcLasmiIrKnM8FSePH2h
	 nUAgicckNcYNV32yeBIxGbCsY6WNM8As7YqU7MsHrpUS4L7o7zQBeRNUQZE2IdOjtOw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795347560;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:References:In-Reply-To:Reply-To:
	 From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
	 Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=OfjJ0WvNmPf3yRVeCkab8QDdbLg01cA0144pAfNS/ko=;
	b=4DRFjKFyfwFoH6irtKEAmU3ctRZrgBlv/lBM5hhJflWVEOs7EtcJbgMESQ1Zxl9va10p
	 ZlPEYxaQkeGU9BKdJc2qlyX5zxO8gh/CnZKykHwhu6upFeOiX5RU0nNzwKjlwAmV7IcAZ
	 8aOiwcmwrbQ53w6ufKSF77InD42Sf1L7/x/RXQ4+Fb9LyQc2jeQccmoiDI3dlgxZrzVNp
	 DZP2Cwr+5FeDQr95UmUJovxEe1iqmZ/1mTjXqf1lgfTjgOrWn6HoOhMCt3b9E38nbN6gH
	 jfG9LuUgetA7eWlddqAAgFnYOfJ1hB1INumFvIlrNrbO8w1X/+UkoT+ileKTpxHMSjA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kOpbrZVn;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id E65F1606A337;
	Sun, 22 Nov 2026 11:39:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kOpbrZVn
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795347559;
	b=y5wxMWta/ApiOM0YMV08sLU6306TrrkAdq99RuhZXKSlP19ExmwrjF2lSo8K0P5ilKJm
	 MjL90BNhfCdeJfNTKh9yUctfUB3eIOvA6nbyrvCi71EVxdadYi17vPoofTX4h+hhV3cl0
	 Unoa4CcNAVHumNBTYvqkMjGQ3IhvOfC4P3tmQUFmo1oVLxSQTd0YxDgL4HCySFGytb1lC
	 eYIpSfPraLMDL+U4icvA2MwtuI2dsVKKeOPDFIZkcPdp0xmAzAzbmOyQN0NCRBBqCMLZt
	 8NE+j/7p8HwkBxlDOKb8jSBwgzpfbAOPNNKCIscMMENhlbaoY6Y0gTIEUzkCzoovLHQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795347559;
	h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
	 X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
	 Reply-To:From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:
	 Message-ID:Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=OfjJ0WvNmPf3yRVeCkab8QDdbLg01cA0144pAfNS/ko=;
	b=ta51xCn99i3KOpCO9xWHJpSvK6je4J2qLJFXnzKv3EL5b4P9GNfUdG9PrtrQL1xxJ83O
	 kY3TKyQSQjUWdsw8hui8Ggz5IXPI2pqPNFiykPddVrYksoyOJViFiUb/9BhYQ728ORbKZ
	 NLbEGPQAJ/VCORPr1hjcEHsCcNAXMpCexV4jz7AQGh280LFYBPGuNny8hFTge/6be94df
	 APofL1OnMq9bcbmmicaOwnsXAoPbkJlBs+vrMsq85gvon2Oe0TxUtLUEB7WBvo/X/c9fo
	 nxlZKMIfGqy0ksgun7J4LqHCAzRly1x2hg5VNBjIimtwLeHpdOvP5LmUF5yqJ5LqUYg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kOpbrZVn;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E25E606A32A
	for <netdev@vger.kernel.org>; Sun, 22 Nov 2026 11:39:19 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE74D1F000D8
	for <netdev@vger.kernel.org>; Sun, 22 Nov 2026 11:39:18 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795347558;
	bh=OfjJ0WvNmPf3yRVeCkab8QDdbLg01cA0144pAfNS/ko=;
	h=References:In-Reply-To:Reply-To:From:Date:Subject:To:Cc;
	b=kOpbrZVnERYgmaaHoZkURlOzHTL+LmFRPMuRjwwd8z7TPSCj6Lk3JAEbho+16Z0/R
	 apEgAP3EnQ5uxlyI7qAJyaD7CI5muLzZaudrhoiYnUwWOd+c+4H54zZ1ocD0jUedQg
	 jBZ0cStZBZ/mLGr0V8v+gpT9duqIkGufxmUhwvviey5PImNCxB1AE8HsqfVmWAPUFr
	 hrf3oI4Go6+NmSFQkOStXZXLHtl7rdCEDoxstXxHP5PXodvvdaQiSQGK7VlC2eTwvN
	 WTN4tMGmaYk6ghQmHlRPX0UP+KHi8Hj4eJswJez/PSW+9LAMKQUSCUqB5JBW1Q47el
	 lDsbMfWHFEvjA==
X-Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-3ab3b29a1d4so17749311fa.1
        for <netdev@vger.kernel.org>; Sun, 22 Nov 2026 03:39:18 -0800 (PST)
X-Forwarded-Encrypted: i=1; AL+hErE0wF2jjHpt/iaWkJYOFyANY6T01Kej4C5FTNPUkfpiO/cPfKH1SE2a1X5tNdGJLtcJqQMuko0=@vger.kernel.org
X-Gm-Message-State: APuU4Z8RrHjPUzoyA6XJ0VFAvripSWQc+n9Tlb456xkrEJ8VCrmSTJOR
	atzQMrdOpK0Bi/+sIhoaj+g80Y+2bulJYtdZ2W5ZuF5bHC5uvz8Hgfs0A8xSSYwtxCXqY8utwkl
	9823NQFjh8vymMWC9wUrlPo3tk2NSo+0=
X-Received: by 2002:a05:6512:61aa:b0:5c1:57cd:5c3d with SMTP id
 2adb3069b0e04-5c1bc806a59mr2586829e87.23.1795347557053; Sun, 22 Nov 2026
 03:39:17 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261122-sun8i-emac-mtu-limit-v2-2-c4081e5b83cf@gmail.com>
X-Reply-To: wens@kernel.org
X-Gmail-Original-Message-ID: <CAGb2v65_vY86WqvKr1m=g0N1Qr2UhLC1v3OHKPG3x+oURUKp7Q@mail.gmail.com>
X-Gm-Features: Aa3M54rz_NQ7yOvBXle79aW57ZyemtshMgGI-7Gz1C236a3c9B6hMMfTmke5swY
X-Cc: 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>, 
	Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org>, 
	Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, 
	LABBE Corentin <clabbe.montjoie@gmail.com>, netdev@vger.kernel.org, 
	linux-stm32@st-md-mailman.stormreply.com, 
	linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, 
	Russell King <rmk+kernel@armlinux.org.uk>, Nicolai Buchwitz <nb@tipi-net.de>, stable@vger.kernel.org