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) --- 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