net: ftmac100: report the correct maximum MTU of 1500
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 28 Oct 2022 18:32:19 +0000 (21:32 +0300)
committerJakub Kicinski <kuba@kernel.org>
Tue, 1 Nov 2022 03:02:57 +0000 (20:02 -0700)
commit30f837b7b92394599ddc366ff4cf8b77d070d4f4
treeab470ac8eeba51f9e3227599ca00857313a12111
parent55f6f3dbcf4ccc4ed154a7f89ec5315d967bd2c6
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 <vladimir.oltean@nxp.com>
Signed-off-by: Sergei Antonov <saproj@gmail.com>
Link: https://lore.kernel.org/r/20221028183220.155948-2-saproj@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/faraday/ftmac100.c