diff options
author | Oleksij Rempel <o.rempel@pengutronix.de> | 2022-06-17 09:16:07 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-06-17 11:42:35 +0100 |
commit | 46e31db55da8e9661894e76086159ca28c348c5c (patch) | |
tree | 08a8d1e361fd44ddca7fed4f545898483644e61d /drivers | |
parent | 2c0ab32b73cfe39a609192f338464e948fc39117 (diff) | |
download | linux-stable-46e31db55da8e9661894e76086159ca28c348c5c.tar.gz linux-stable-46e31db55da8e9661894e76086159ca28c348c5c.tar.bz2 linux-stable-46e31db55da8e9661894e76086159ca28c348c5c.zip |
net: macb: fix negative max_mtu size for sama5d3
JML register on probe will return zero . This register is configured
later on macb_init_hw() which is called on open.
Since we have zero, after header and FCS length subtraction we will get
negative max_mtu size. This issue was affecting DSA drivers with MTU support
(for example KSZ9477).
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/cadence/macb_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index d89098f4ede8..d0ea8dbfa213 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4913,8 +4913,8 @@ static int macb_probe(struct platform_device *pdev) /* MTU range: 68 - 1500 or 10240 */ dev->min_mtu = GEM_MTU_MIN_SIZE; - if (bp->caps & MACB_CAPS_JUMBO) - dev->max_mtu = gem_readl(bp, JML) - ETH_HLEN - ETH_FCS_LEN; + if ((bp->caps & MACB_CAPS_JUMBO) && bp->jumbo_max_len) + dev->max_mtu = bp->jumbo_max_len - ETH_HLEN - ETH_FCS_LEN; else dev->max_mtu = ETH_DATA_LEN; |