]> git.ipfire.org Git - thirdparty/openwrt.git/commit
ramips: ethernet: ralink: refine DSA tag offload handling 24064/head
authorMieczyslaw Nalewaj <namiltd@yahoo.com>
Fri, 3 Jul 2026 20:11:37 +0000 (22:11 +0200)
committerRobert Marko <robimarko@gmail.com>
Sun, 12 Jul 2026 20:08:37 +0000 (22:08 +0200)
commite5c7612b1664d9e533ed5ddb6a861b4d0a62daa8
treeb7c88bfc3c5ad615321c4d1fa9249fe515338062
parent7b9483b992e720433cce3c8b1edc3e5a3873f888
ramips: ethernet: ralink: refine DSA tag offload handling

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_soc_eth does not use that info.
It 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 go to the network with an incorrect checksum.

Before this change, tag_ops->proto == DSA_TAG_PROTO_MTK was used,
which disabled offload for every non-Mediatek tag, including the
RTL8367S switch's RTL8_4 tag that this fix specifically targets.

Replace the hardcoded whitelist with a blacklist scoped to the
RTL8367S: only disable offload for DSA_TAG_PROTO_RTL8_4. The RTL8_4T
(the trailing-tag variant) is left untouched because its rtl8_4t tagger
already checksums the frame in software before appending the tag.

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

Fixes: 3c0a73b4d202 ("ramips: ethernet: ralink: fix offload with diff dsa tag")
Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/24064
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c