openwrt-pf/target/linux/mediatek
Mieczyslaw Nalewaj 7b9483b992 mediatek: ethernet: fix offload with incompatible dsa tag
DSA copies the driver features to slave device, including offload
capabilities. Once a packet is sent through a DSA slave interface,
according to its features, the kernel does not calculate checksums,
expecting that the HW will fill the gaps. DSA adds the defined DSA
tag and sends the tagged packet through the master device.

Ethertype DSA tags expect the driver to calculate checksum based on the
csum_start/csum_offset. However, mtk_eth_soc does not use that info.
mtk_eth_soc checks the network header and decides if the HW can manage
that packet, unaware that MAC layer now contains an extra DSA tag. When
that tag is the Mediatek CPU tag, offload will work as expected.
When it is an incompatible DSA tag or if DSA is stacking two incompatible
DSA tags, the driver will still count on the HW offload. In this case,
packets are sent to the network with an incorrect checksum.

This patch adds an extra check that disables offloading only for the
RTL8367S switch's RTL8_4 tag, which is known to break MTK checksum
offload. The RTL8_4T (the trailing-tag variant) is not affected because
its rtl8_4t tagger already checksums the frame in software before appending
the tag, so ip_summed is no longer CHECKSUM_PARTIAL by the time this driver
sees it.

This approach avoids an overly conservative whitelist which would
disable offload for every non-Mediatek tag, regardless of whether
that tag is actually incompatible with MTK checksum offload.

Tags for other DSA-capable switches are left untouched by this fix
and are not claimed to be offload-safe.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Signed-off-by: Schneider Azima <Schneider-Azima12@protonmail.com>
Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/23996
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-07-12 21:29:45 +02:00
..
base-files mediatek: filogic: add support for Cudy M3000 w/ YT8821 PHY 2026-03-14 01:40:32 +01:00
dts mediatek: add support for Hiveton H5000M 2026-07-09 09:41:47 +02:00
files/drivers treewide: remove fwnode_for_each_available_child_node 2026-07-09 09:33:41 +02:00
files-6.18 mediatek: filogic: replace mtd-eeprom with nvmem 2026-06-14 23:42:52 +02:00
filogic mediatek: add support for Hiveton H5000M 2026-07-09 09:41:47 +02:00
image mediatek: add support for Hiveton H5000M 2026-07-09 09:41:47 +02:00
mt7622 mediatek: mt7622: enable CONFIG_MTD_VIRT_CONCAT 2026-06-01 00:32:38 +02:00
mt7623 mediatek: drop v6.12 and default to v6.18 2026-04-24 15:52:51 +01:00
mt7629 mediatek: drop v6.12 and default to v6.18 2026-04-24 15:52:51 +01:00
patches-6.18 mediatek: ethernet: fix offload with incompatible dsa tag 2026-07-12 21:29:45 +02:00
Makefile mediatek: drop v6.12 and default to v6.18 2026-04-24 15:52:51 +01:00
modules.mk mediatek: 6.18: add missing module dependency 2026-04-20 01:10:32 +01:00