[PATCH net v2 1/2] net: stmmac: Limit the MTU of normal descriptors to one buffer
Arun Iyengar via B4 Relay
devnull+aiyengar1990.gmail.com at kernel.org
Sun Nov 22 01:13:47 PST 2026
From: Arun Iyengar <aiyengar1990 at gmail.com>
Russell King noted in [1] that max_mtu for normal descriptors,
SKB_MAX_HEAD() (3712 on arm64), does not match the hardware. Their
buffer sizes are 11 bits, and stmmac neither splits TX frames nor joins
RX descriptors for them, so a frame must fit one 2047-byte buffer.
Limit max_mtu so that a frame with two VLAN tags and the FCS fits.
Link: https://lore.kernel.org/r/E1vLJcL-0000000ExBL-0GFe@rmk-PC.armlinux.org.uk [1]
Fixes: 48febf7e6476 ("stmmac: allow mtu bigger than 1500 in case of normal desc (V4)")
Cc: Russell King <rmk+kernel at armlinux.org.uk>
Cc: stable at vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990 at gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a685ce4638f6..2a27e1e7f9b9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -8247,6 +8247,9 @@ static int __stmmac_dvr_probe(struct device *device,
ndev->max_mtu = XGMAC_JUMBO_LEN;
else if (priv->plat->enh_desc || priv->synopsys_id >= DWMAC_CORE_4_00)
ndev->max_mtu = JUMBO_LEN;
+ else if (priv->hw->desc == &ndesc_ops)
+ ndev->max_mtu = BUF_SIZE_2KiB - 1 - ETH_HLEN - 2 * VLAN_HLEN -
+ ETH_FCS_LEN;
else
ndev->max_mtu = SKB_MAX_HEAD(NET_SKB_PAD + NET_IP_ALIGN);
--
2.55.0
More information about the linux-arm-kernel
mailing list