* [PATCH RFC net-next] net: stmmac: document (buggy?) maximum MTU setup
@ 2025-11-18 11:11 Russell King (Oracle)
0 siblings, 0 replies; only message in thread
From: Russell King (Oracle) @ 2025-11-18 11:11 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-11-18 11:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-18 11:11 [PATCH RFC net-next] net: stmmac: document (buggy?) maximum MTU setup Russell King (Oracle)
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.