[PATCH net v5 0/5] net: stmmac: Fix double VLAN 802.1ad tag handling
From: Ovidiu Panait
Date: Sun Sep 20 2026 - 11:36:20 EST
Currently, hardware VLAN stripping is broken for 802.1ad tags. vlan_rx_hw()
hardcodes ETH_P_8021Q when putting the hardware tag into the skb, rather
than using the actual protocol from the packet. Because of this, packets
that contain an 802.1ad outer tag are incorrectly passed up the stack as
having an 802.1Q tag.
This issue was observed on the Renesas RZ/V2H platform (which has a dwmac4
IP), when testing QinQ ping:
# DUT
ip link add link end0 name end0.100 type vlan proto 802.1ad id 100
ip link add link end0.100 name end0.100.200 type vlan proto 802.1q id 200
ip addr add 172.16.3.2/24 dev end0.100.200
ip link set end0 up
ip link set end0.100 up
ip link set end0.100.200 up
# Peer
ip link add link eth0 name eth0.100 type vlan proto 802.1ad id 100
ip link add link eth0.100 name eth0.100.200 type vlan proto 802.1q id 200
ip addr add 172.16.3.1/24 dev eth0.100.200
ip link set eth0 up
ip link set eth0.100 up
ip link set eth0.100.200 up
ping 172.16.3.2
-- FAIL --
Note that this series only fixes the issue on dwmac4. dwxgmac2 has the same
issue but I do not have access to hw to test on.
Since dwmac4 does not expose the tag type in the RDES3 descriptor, it
cannot support hardware S-Tag stripping correctly. This series
disables S-tag stripping for it, so the 802.1ad tags are left in
place and are handled by the software VLAN path.
v5:
- Split out the selftest part and sent it separately for net-next:
https://lore.kernel.org/all/20260918112529.96039-1-ovidiu.panait.rb@xxxxxxxxxxx/
- Dropped the S-VLAN rework patch and replaced it with a plain
double -> svlan rename. Rebased the patches that depended on it.
- Added Reviewed-by tag from Maxime on patch 5/5.
v4: https://lore.kernel.org/all/20260908164309.59282-1-ovidiu.panait.rb@xxxxxxxxxxx/
- Reworked the S-VLAN patches based on Joseph's feedback: EDVLP is no
longer toggled, the "double VLAN" naming was dropped from everywhere
along with the is_double implementation, and ESVL/DOVLTC now
follow the advertised NETIF_F_HW_VLAN_STAG_* features.
- Added a patch to stop advertising S-VLAN stripping when
rx-vlan-offload is disabled.
- The VLAN selftest now also toggles rx-vlan-stag-hw-parse for the
802.1ad variants.
Ovidiu Panait (5):
net: stmmac: Remove VLAN perfect matching dead code
net: stmmac: Stop toggling the EDVLP bit
net: stmmac: Rename double VLAN references to svlan
net: stmmac: Do not advertise S-VLAN stripping when it is disabled
net: stmmac: Disable S-Tag processing on dwmac4
drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +-
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 60 ++++++++---------
.../stmicro/stmmac/stmmac_selftests.c | 30 ++++-----
.../net/ethernet/stmicro/stmmac/stmmac_vlan.c | 65 +++++--------------
5 files changed, 63 insertions(+), 96 deletions(-)
--
2.34.1