Commit 3cf62c81 authored by Pawel Dembicki's avatar Pawel Dembicki Committed by Jakub Kicinski

net: dsa: vsc73xx: fix MTU configuration

Switch in MAXLEN register stores the maximum size of a data frame.
The MTU size is 18 bytes smaller than the frame size.

The current settings are causing problems with packet forwarding.
This patch fixes the MTU settings to proper values.

Fixes: fb77ffc6 ("net: dsa: vsc73xx: make the MTU configurable")
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarPawel Dembicki <paweldembicki@gmail.com>
Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
Link: https://lore.kernel.org/r/20230628194327.1765644-1-paweldembicki@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 48538ccb
...@@ -1025,17 +1025,17 @@ static int vsc73xx_change_mtu(struct dsa_switch *ds, int port, int new_mtu) ...@@ -1025,17 +1025,17 @@ static int vsc73xx_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
struct vsc73xx *vsc = ds->priv; struct vsc73xx *vsc = ds->priv;
return vsc73xx_write(vsc, VSC73XX_BLOCK_MAC, port, return vsc73xx_write(vsc, VSC73XX_BLOCK_MAC, port,
VSC73XX_MAXLEN, new_mtu); VSC73XX_MAXLEN, new_mtu + ETH_HLEN + ETH_FCS_LEN);
} }
/* According to application not "VSC7398 Jumbo Frames" setting /* According to application not "VSC7398 Jumbo Frames" setting
* up the MTU to 9.6 KB does not affect the performance on standard * up the frame size to 9.6 KB does not affect the performance on standard
* frames. It is clear from the application note that * frames. It is clear from the application note that
* "9.6 kilobytes" == 9600 bytes. * "9.6 kilobytes" == 9600 bytes.
*/ */
static int vsc73xx_get_max_mtu(struct dsa_switch *ds, int port) static int vsc73xx_get_max_mtu(struct dsa_switch *ds, int port)
{ {
return 9600; return 9600 - ETH_HLEN - ETH_FCS_LEN;
} }
static const struct dsa_switch_ops vsc73xx_ds_ops = { static const struct dsa_switch_ops vsc73xx_ds_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment