Skip to content

Commit f9a966a

Browse files
KanjiMonstergregkh
authored andcommitted
net: dsa: b53: fix jumbo frame mtu check
[ Upstream commit 42fb3ac ] JMS_MIN_SIZE is the full ethernet frame length, while mtu is just the data payload size. Comparing these two meant that mtus between 1500 and 1518 did not trigger enabling jumbo frames. So instead compare the set mtu ETH_DATA_LEN, which is equal to JMS_MIN_SIZE - ETH_HLEN - ETH_FCS_LEN; Also do a check that the requested mtu is actually greater than the minimum length, else we do not need to enable jumbo frames. In practice this only introduced a very small range of mtus that did not work properly. Newer chips allow 2000 byte large frames by default, and older chips allow 1536 bytes long, which is equivalent to an mtu of 1514. So effectivly only mtus of 1515~1517 were broken. Fixes: 6ae5834 ("net: dsa: b53: add MTU configuration support") Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 1d068c9 commit f9a966a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2268,7 +2268,7 @@ static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu)
22682268
if (!dsa_is_cpu_port(ds, port))
22692269
return 0;
22702270

2271-
enable_jumbo = (mtu >= JMS_MIN_SIZE);
2271+
enable_jumbo = (mtu > ETH_DATA_LEN);
22722272
allow_10_100 = (dev->chip_id == BCM583XX_DEVICE_ID);
22732273

22742274
return b53_set_jumbo(dev, enable_jumbo, allow_10_100);

0 commit comments

Comments
 (0)