linux/drivers/net
Luiz Angelo Daros de Luca c36a77c33d net: dsa: realtek: rtl8365mb: add change_mtu
The rtl8365mb was using a fixed MTU size of 1536, which was probably
inspired by the rtl8366rb's initial frame size. However, unlike that
family, the rtl8365mb family can specify the max frame size in bytes,
rather than in fixed steps.

DSA calls change_mtu for the CPU port once the max MTU value among the
ports changes. As the max frame size is defined globally, the switch
is configured only when the call affects the CPU port.

The available specifications do not directly define the max supported
frame size, but it mentions a 16k limit. This driver will use the 0x3FFF
limit as it is used in the vendor API code. However, the switch sets the
max frame size to 16368 bytes (0x3FF0) after it resets.

change_mtu uses MTU size, or ethernet payload size, while the switch
works with frame size. The frame size is calculated considering the
ethernet header (14 bytes), a possible 802.1Q tag (4 bytes), the payload
size (MTU), and the Ethernet FCS (4 bytes). The CPU tag (8 bytes) is
consumed before the switch enforces the limit.

During setup, the driver will use the default 1500-byte MTU of DSA to
set the maximum frame size. The current sum will be
VLAN_ETH_HLEN+1500+ETH_FCS_LEN, which results in 1522 bytes.  Although
it is lower than the previous initial value of 1536 bytes, the driver
will increase the frame size for a larger MTU. However, if something
requires more space without increasing the MTU, such as QinQ, we would
need to add the extra length to the rtl8365mb_port_change_mtu() formula.

MTU was tested up to 2018 (with 802.1Q) as that is as far as mt7620
(where rtl8367s is stacked) can go. The register was manually
manipulated byte-by-byte to ensure the MTU to frame size conversion was
correct. For frames without 802.1Q tag, the frame size limit will be 4
bytes over the required size.

There is a jumbo register, enabled by default at 6k frame size.
However, the jumbo settings do not seem to limit nor expand the maximum
tested MTU (2018), even when jumbo is disabled. More tests are needed
with a device that can handle larger frames.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-03-17 07:45:06 +00:00
..
appletalk
arcnet
bonding
caif
can can: esd_usb: Improve readability on decoding ESD_EV_CAN_ERROR_EXT messages 2023-02-16 20:59:48 +01:00
dsa net: dsa: realtek: rtl8365mb: add change_mtu 2023-03-17 07:45:06 +00:00
ethernet net: macb: Add PTP support to EMAC for sama7g5 2023-03-16 17:21:51 -07:00
fddi
fjes
hamradio
hippi
hyperv Networking changes for 6.3. 2023-02-21 18:24:12 -08:00
ieee802154 net: ieee802154: ca8210: drop owner from driver 2023-03-15 08:11:03 +00:00
ipa ARM: SoC drivers for 6.3 2023-02-27 10:04:49 -08:00
ipvlan
mctp
mdio net: Use of_property_present() for testing DT property presence 2023-03-13 17:07:52 -07:00
netdevsim
pcs
phy net: phy: mxl-gpy: enhance delay time required by loopback disable function 2023-03-16 17:30:45 +00:00
plip
ppp
pse-pd
slip
team
thunderbolt
usb net: usb: qmi_wwan: add Telit 0x1080 composition 2023-03-07 15:27:29 +01:00
vmxnet3
vxlan neighbour: annotate lockless accesses to n->nud_state 2023-03-15 00:37:32 -07:00
wan
wireguard cpumask: fix incorrect cpumask scanning result checks 2023-03-06 12:15:13 -08:00
wireless net: Use of_property_present() for testing DT property presence 2023-03-13 17:07:52 -07:00
wwan
xen-netback Including fixes from wireless and netfilter. 2023-02-27 14:05:08 -08:00
amt.c
bareudp.c
dummy.c
eql.c
geneve.c net: geneve: set IFF_POINTOPOINT with IFLA_GENEVE_INNER_PROTO_INHERIT 2023-03-15 08:12:04 +00:00
gtp.c
ifb.c
Kconfig Networking changes for 6.3. 2023-02-21 18:24:12 -08:00
LICENSE.SRC
loopback.c
macsec.c Networking changes for 6.3. 2023-02-21 18:24:12 -08:00
macvlan.c
macvtap.c
Makefile
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c tap: add support for IOCB_NOWAIT 2023-03-10 16:48:32 -08:00
tun.c tun: flag the device as supporting FMODE_NOWAIT 2023-03-10 16:47:22 -08:00
veth.c
virtio_net.c net: virtio_net: implement exact header length guest feature 2023-03-13 16:32:16 -07:00
vrf.c
vsockmon.c
xen-netfront.c