]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commite2c28c8da7ff1b70833be21df47dbb881caea74f
tree0a1b1598c37cc919cd29e420eac160a9694c4cc8
parentd177f12b53d6fc24ba36858d4489cc85de2a88bd
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: 99c1e05296dd ("net: mscc: Add initial Ocelot switch support")
Fixes: d83edf652e0a ("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