From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-stm32@st-md-mailman.stormreply.com,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH RFC net-next] net: stmmac: document (buggy?) maximum MTU setup
Date: Tue, 18 Nov 2025 11:11:25 +0000 [thread overview]
Message-ID: <E1vLJcL-0000000ExBL-0GFe@rmk-PC.armlinux.org.uk> (raw)
Add documentation for the ndev->max_mtu determination. I'm not sure
this is currect - specifically, having the "everything else" case
depend on the kernel's page size, which is a build-time choice for
some architectures and could be e.g. 4KiB, 16KiB or 64KiB.
E.g. when standard descriptors are used (enh_desc is false) and the
core is younger than v4.00, the buffer length is limited to 11 bits by
the format of the buffer size fields in the descriptors (TBS1/TBS2 in
TDES1 and RBS1/RBS2 in RDES1). So, when page size is greater than 4KiB,
a packet of max_mtu will not fit.
Also, dwmac4 cores (indicated with core_type == DWMAC_CORE_GMAC4) use
the descriptor format in dwmac4_descs.c, even when priv->synopsys_id
is less than DWMAC_CORE_4_00 (see the first DWMAC_CORE_GMAC4 entry in
the stmmac_hw table in hwif.c.)
So, I think this max_mtu is buggy.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 15b0c08ebd87..644dccb29f75 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7813,6 +7813,12 @@ int stmmac_dvr_probe(struct device *device,
/* MTU range: 46 - hw-specific max */
ndev->min_mtu = ETH_ZLEN - ETH_HLEN;
+ /* Set the maximum MTU.
+ * For XGMAC cores, 16KiB.
+ * For cores using enhanced descriptors or GMAC cores >= v4.00, 9kB.
+ * For everything else, PAGE_SIZE - NET_SKB_PAD - NET_IP_ALIGN -
+ * aligned skb_shared_info.
+ */
if (priv->plat->core_type == DWMAC_CORE_XGMAC)
ndev->max_mtu = XGMAC_JUMBO_LEN;
else if (priv->plat->enh_desc || priv->synopsys_id >= DWMAC_CORE_4_00)
--
2.47.3
reply other threads:[~2025-11-18 11:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=E1vLJcL-0000000ExBL-0GFe@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.