]> git.itanic.dy.fi Git - linux-stable/commit
net: dsa: realtek: Rewrite RTL8366RB MTU handling
authorLinus Walleij <linus.walleij@linaro.org>
Sat, 9 Dec 2023 22:37:35 +0000 (23:37 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 12 Dec 2023 13:17:06 +0000 (14:17 +0100)
commitd577ca429af36a3aea38d53d11be56dff015dfc9
tree75116060c7610463140e11cb94df65e0a67f9ced
parent389119c842187e2425d8e0354aabe5c3383c5020
net: dsa: realtek: Rewrite RTL8366RB MTU handling

The MTU callbacks are in layer 1 size, so for example 1500
bytes is a normal setting. Cache this size, and only add
the layer 2 framing right before choosing the setting. On
the CPU port this will however include the DSA tag since
this is transmitted from the parent ethernet interface!

Add the layer 2 overhead such as ethernet and VLAN framing
and FCS before selecting the size in the register.

This will make the code easier to understand.

The rtl8366rb_max_mtu() callback returns a bogus MTU
just subtracting the CPU tag, which is the only thing
we should NOT subtract. Return the correct layer 1
max MTU after removing headers and checksum.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/dsa/realtek/rtl8366rb.c