net: mscc: ocelot: properly account for VLAN header length when setting MRU
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 10 Mar 2020 01:28:18 +0000 (03:28 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Mar 2020 01:58:17 +0000 (18:58 -0700)
commita8015ded89ad740d21355470d41879c5bd82aab7
tree0a1b1598c37cc919cd29e420eac160a9694c4cc8
parentafe207d80a61e4d6e7cfa0611a4af46d0ba95628
net: mscc: ocelot: properly account for VLAN header length when setting MRU

What the driver writes into MAC_MAXLEN_CFG does not actually represent
VLAN_ETH_FRAME_LEN but instead ETH_FRAME_LEN + ETH_FCS_LEN. Yes they are
numerically equal, but the difference is important, as the switch treats
VLAN-tagged traffic specially and knows to increase the maximum accepted
frame size automatically. So it is always wrong to account for VLAN in
the MAC_MAXLEN_CFG register.

Unconditionally increase the maximum allowed frame size for
double-tagged traffic. Accounting for the additional length does not
mean that the other VLAN membership checks aren't performed, so there's
no harm done.

Also, stop abusing the MTU name for configuring the MRU. There is no
support for configuring the MRU on an interface at the moment.

Fixes: a556c76adc05 ("net: mscc: Add initial Ocelot switch support")
Fixes: fa914e9c4d94 ("net: mscc: ocelot: create a helper for changing the port MTU")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mscc/ocelot.c
include/soc/mscc/ocelot_dev.h