| Message ID | 20261122-sun8i-emac-mtu-limit-v2-2-c4081e5b83cf@gmail.com (mailing list archive) |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-sunxi+bounces-27993-sunxi=pue.re@lists.linux.dev> X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mxe881.netcup.net (Postfix) with ESMTPS id C860B1C7B07 for <noreply@patchwork.local>; Sun, 22 Nov 2026 10:13:52 +0100 (CET) Authentication-Results: mxe881; dkim=pass header.d=kernel.org; spf=pass (sender IP is 172.234.253.10) smtp.mailfrom=linux-sunxi+bounces-27993-noreply=patchwork.local@lists.linux.dev smtp.helo=sea.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.234.253.10 as permitted sender) client-ip=172.234.253.10; envelope-from=linux-sunxi+bounces-27993-noreply=patchwork.local@lists.linux.dev; helo=sea.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 9A41633E24 for <noreply@patchwork.local>; Sun, 22 Nov 2026 09:13:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795338829; b=R+xhdatP/JSxFhEQdNxjUxiOZCuw3znP2DD6fq2hosQ0snMMQfte/WpEyfMQW/aLwkC8 NZiXFPW+CfEbAVdU1OGkKCsHyIJt/FU2xzpZy4Lp3Skn2hqp3BmR0ssP9uaOuC9gBU9kx duMOYPWkYhrRcqgtgUVEBb3+XU2FjwYAZWvLRFmR92Ud3rWJYnXSlnS5KzJLA3gWt47WU EQL3XLII74rdp0t0JFWqfV2y2AhyfFNOUS9cZwOBfSaTs/b6RSsL+oVDuRGmgtxsIMb6n yUXzjE+qNAiEgCKmmvBVrIlJbVG5sXzuAmuJLMk+wLj2XjTt73/u9CjUZfZQcjBagjw== ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795338829; h=X-Original-To:Received:Received:DKIM-Signature:Received:From:Date: Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=03lpGLn/bddD577LSC4qtqKsNtreiXE/VEdiR+KAR38=; b=4ac1uc+3TFemiKnA9FFdaASAR8wShDr0VGuX+MjY4abtqJtqLFH49Ie0TBPdK8LG0KvV Mb47/+nbcYY+ouW4lNgzg8Yl5gI6ELfcRor2ZfZIMJ4zX1LRL2A5D5CMmeyFS67lS2Yfn 5zje+vHt9ga22hFI1cs8PgYo6x+qFmKiD+6nnYurwCZ3si1qt1Cz++6tNWrDibN5+nt6F O/rcKffGC4MiUoCK0VQvquObwPpiY0tJaPk3244zkCGrhWHpOuKc/UL1GuaMn12u8jnmZ OQ94i6qR3jYuy+yKcjM+nQs4+a1QPTrY+hi8swlcNrXjBtUesaj0KzWHvUoT8WHacmg== ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="SXiOCo/d"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6CD94606A33A; Sun, 22 Nov 2026 09:13:49 +0000 (UTC) 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=SXiOCo/d X-Original-To: linux-sunxi@lists.linux.dev Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795338829; b=lV1fwBLm3rSDvsuR9pnZN8ssNoLHymLWV61zMId/10lbZN0hy3UhuwpWPiP9HZVcoXHY zPz09jd/Ht9uzR7Uc17bqjFivKxVJVZF7382IEtX00OLX5gDrZdUV78QyRdFv8cOY7HtR pbaRYEOSWNuPVCyw17YkDOKnUygJsIc6BmN+dNRVbAAhX4v8aMS94IC402A4A5aRujay0 q1m7TehGTh+2imlmyIiOtnVUcn0JSfrOk5O9IPZ8ER3DRINQLc9rb5jL557c21NvYqlEV Iv3sYGWNQjvnTIgoiK5h8Vw89cOzXtxtU6/ptn1vs3P18s53LrkcsydtnmoO860yenw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795338829; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=03lpGLn/bddD577LSC4qtqKsNtreiXE/VEdiR+KAR38=; b=bporuLPPzl4nvbi8g9VO/5j857LuPDBu2o/HVfGZ5kr5Vi9IEWTBecio31MPuqzadI60 NjCc5IrgcFLcmYTxqoHkZSkDRWpAThHRDcujsRAHpfGJct8K/xRoCRaBDsJLlKacrFzN8 lhueis+oHWnPONpWHj0M8cR2gcFwKO5nVEtxyCqsiGR3LjAMPg4wgkiQXsf4kEA2xLETF SUvuct1zsp2mAb5nJviwPZ0PeznKgvNY6d6w15eBAI96UjnCLXONQ3yEm1UO/ssNBNsvm /T5+LymkhZz80V7qfn/HW217DTcGkJfUNwcmGurJYhVm5YDApAK683f5jaXbD8nDQFQ== 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="SXiOCo/d"; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 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 4B517606A338; Sun, 22 Nov 2026 09:13:49 +0000 (UTC) Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1795338828; b=JUx5MZUTrkdGqMiR91i9Qqek1GbCdzNIUm6aiYULjvUS2trcw/Mdkt0YGGJmcoOL+ZIO uGR/fRqoBeXxQ32YPsUJVFyZpMAIUBLN0izl+u13bQZyQnbFdLdKH/dBFyEtxP9zwy4zT EjaTnRZgxNzRfP08t4BtU0JZeLc/VicpkcFAPEAi++TI7sWprZlGloMuvnYox+fnn1jOV WvDoYm1pzNBIuSqqsAfIliy82f0OyB0Y0nc7KbrJyVtdKyUhuavui0VTVqsw/kQ/H7BOF UNKL92Ufr11FM9xkxHay/14DgVcQkIPGZMWF9hKkkonKiLqAOgr05Bam63th1COC1Mg== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795338828; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=03lpGLn/bddD577LSC4qtqKsNtreiXE/VEdiR+KAR38=; b=e3eCDFHTqOZEfI+Ah7SZ/4PJ9rP+BydaVI5HO5RuZ0p0ZxyY5uW3uL+AhqvXr0EWdcXe Dkla9VKW9vg+UnGtw7vsVjfjLr6MbU+97Qaep+ZhFeppxTxHEtfWLfjZVrGK6mlh8tpl7 zbLN0KK079X5bYSVdCL/8nA8xcauATOfBLruXbGBsLZT01n+HGgyKscfMOq+UcjFfWEjn KtQb2BWlLrSeu0gowvU3jbKG7BA1A1OmAfb1xBc9bwm33H58MWn4cvScD3r85bR18XZEF ROAnMUSCXgQ2isL5FqZfaIPVqfEGgOihwIAm90SLQOoGpKpWZeztF0BoAws8lp+kkxg== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id BFA891F000CF; Sun, 22 Nov 2026 09:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795338828; bh=03lpGLn/bddD577LSC4qtqKsNtreiXE/VEdiR+KAR38=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=SXiOCo/dV6Mpv/ALd/f5WJLrpYUV5rSMonz7x9bSN5rrzUezVn22LW7S6MXLzb0FI lYRJFE/za5KXtdj1rgoPVsfI6JPZDVpuAv2vyhXeNy+Inx/GxCcNkc/cEQ41dL6UsV bL/onpK9xL+jW5W891QcllFHdHT5Gnp/EZzufrZEHDCiNVV5nHjEUrYx+I+jEaR/uj 74RQlobRcgJnt7AJK/1kwjSh/NO+o9Xl0vr+CLFUlYKlbZJSIPNJxJrQRVDGm9FXx/ HmjDlOW+0OElzqQHWGo5XtuWXwpwxFU5UOkXhTJE/YDw9W4bq4YshQhMctknPHMvl6 UPZQMWDSXFO1A== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 4DF194BFCD; Sun, 22 Nov 2026 09:13:47 +0000 (UTC) From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org> Date: Sun, 22 Nov 2026 09:13:48 +0000 Subject: [PATCH net v2 2/2] net: stmmac: dwmac-sun8i: Limit the MTU to 2018 X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: <linux-sunxi.lists.linux.dev> List-Post: <mailto:linux-sunxi@lists.linux.dev> List-Help: <mailto:linux-sunxi+help@lists.linux.dev> List-Subscribe: <mailto:linux-sunxi+subscribe@lists.linux.dev> List-Unsubscribe: <mailto:linux-sunxi+unsubscribe@lists.linux.dev> List-Owner: <mailto:linux-sunxi+owner@lists.linux.dev> Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20261122-sun8i-emac-mtu-limit-v2-2-c4081e5b83cf@gmail.com> References: <20261122-sun8i-emac-mtu-limit-v2-0-c4081e5b83cf@gmail.com> In-Reply-To: <20261122-sun8i-emac-mtu-limit-v2-0-c4081e5b83cf@gmail.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>, Chen-Yu Tsai <wens@kernel.org>, 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> Cc: 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>, Arun Iyengar <aiyengar1990@gmail.com>, stable@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795338826; l=1070; i=aiyengar1990@gmail.com; s=20261110; h=from:subject:message-id; bh=hoWHCAAprzrO2D+coALtPpyIBw9Qkx95wvyejnjliCM=; b=so3ZK26Uz/bNPFobSNeO22ZQm5P4aH7euK1OUEWe1ZVZE0wm4pIfqRAkW6IWpaCz3BSNnqcoH 8J38CexopsuDI097y8ytNlosmfgYlB7QO7/ZFWQ1GLxpzn+Ltn+ToJd X-Developer-Key: i=aiyengar1990@gmail.com; a=ed25519; pk=zXpRgUTrhaFe6jLyPqbBy3ccfkj04w0g2690Wv3mg+0= X-Endpoint-Received: by B4 Relay for aiyengar1990@gmail.com/20261110 with auth_id=1480 X-Original-From: Arun Iyengar <aiyengar1990@gmail.com> Reply-To: aiyengar1990@gmail.com Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [3.31 / 15.00]; RBL_SENDERSCORE(2.00)[172.234.253.10:from]; SUSPICIOUS_RECIPS(1.50)[]; MAILLIST(-0.18)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; TAGGED_RCPT(0.00)[netdev,kernel]; RCPT_COUNT_TWELVE(0.00)[20]; FORGED_SENDER_MAILLIST(0.00)[]; FROM_HAS_DN(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[sea.lore.kernel.org:helo,sea.lore.kernel.org:rdns]; FREEMAIL_REPLYTO(0.00)[gmail.com]; R_DKIM_ALLOW(0.00)[kernel.org:s=k20260515]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; FREEMAIL_CC(0.00)[vger.kernel.org,st-md-mailman.stormreply.com,lists.infradead.org,lists.linux.dev,armlinux.org.uk,tipi-net.de,gmail.com]; HAS_REPLYTO(0.00)[aiyengar1990@gmail.com]; RCVD_COUNT_FIVE(0.00)[6]; ARC_ALLOW(0.00)[kernel.org:s=arc20260519:i=3]; DKIM_TRACE(0.00)[kernel.org:+]; DMARC_POLICY_ALLOW(0.00)[kernel.org,quarantine]; R_SPF_ALLOW(0.00)[+ip4:172.234.253.10]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[100.103.45.18:received,100.77.114.92:received]; TO_DN_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[devnull@kernel.org,linux-sunxi@lists.linux.dev]; FREEMAIL_TO(0.00)[bootlin.com,lunn.ch,davemloft.net,kernel.org,redhat.com,gmail.com,sholland.org,foss.st.com]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-27993-noreply=patchwork.local,aiyengar1990.gmail.com]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; ASN(0.00)[asn:63949, ipnet:172.234.224.0/19, country:SG]; RCVD_TLS_LAST(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[172.234.253.10:from] X-Rspamd-Queue-Id: C860B1C7B07 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: INBOX |
| Series |
net: stmmac: Limit the MTU of normal descriptors to one buffer
|
|
Commit Message
Arun Iyengar via B4 Relay
Nov. 22, 2026, 9:13 a.m. UTC
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(+)
Comments
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 > >
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
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
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
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
> 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
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)