Skip to content

Commit 30f837b

Browse files
vladimirolteankuba-moo
authored andcommitted
net: ftmac100: report the correct maximum MTU of 1500
The driver uses the MAX_PKT_SIZE (1518) for both MTU reporting and for TX. However, the 2 places do not measure the same thing. On TX, skb->len measures the entire L2 packet length (without FCS, which software does not possess). So the comparison against 1518 there is correct. What is not correct is the reporting of dev->max_mtu as 1518. Since MTU measures L2 *payload* length (excluding L2 overhead) and not total L2 packet length, it means that the correct max_mtu supported by this device is the standard 1500. Anything higher than that will be dropped on RX currently. To fix this, subtract VLAN_ETH_HLEN from MAX_PKT_SIZE when reporting the max_mtu, since that is the difference between L2 payload length and total L2 length as seen by software. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: Sergei Antonov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 55f6f3d commit 30f837b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/faraday/ftmac100.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/dma-mapping.h>
1212
#include <linux/etherdevice.h>
1313
#include <linux/ethtool.h>
14+
#include <linux/if_vlan.h>
1415
#include <linux/init.h>
1516
#include <linux/interrupt.h>
1617
#include <linux/io.h>
@@ -1070,7 +1071,7 @@ static int ftmac100_probe(struct platform_device *pdev)
10701071
SET_NETDEV_DEV(netdev, &pdev->dev);
10711072
netdev->ethtool_ops = &ftmac100_ethtool_ops;
10721073
netdev->netdev_ops = &ftmac100_netdev_ops;
1073-
netdev->max_mtu = MAX_PKT_SIZE;
1074+
netdev->max_mtu = MAX_PKT_SIZE - VLAN_ETH_HLEN;
10741075

10751076
err = platform_get_ethdev_address(&pdev->dev, netdev);
10761077
if (err == -EPROBE_DEFER)

0 commit comments

Comments
 (0)