Re: [PATCH] net: dsa: tag_rtl8_4: push VLAN tag into payload before DSA CPU tag
From: Amitesh Singh
Date: Tue Sep 08 2026 - 12:14:52 EST
On Tue, Sep 8, 2026 at 5:20 PM Andrew Lunn <andrew@xxxxxxx> wrote:
>
> On Tue, Sep 08, 2026 at 09:30:41AM +0530, Amitesh Singh wrote:
> > When a socket buffer has a hardware-accelerated VLAN tag (skb->vlan_tci
> > set), the upstream NIC (e.g. imx-dwmac with tx-vlan-offload fixed:on)
> > inserts the 802.1Q header after the DSA CPU tag, producing:
> >
> > [8100 VID][8899 CPU tag]
> >
> > on the wire instead of the correct ordering:
> >
> > [8899 CPU tag][8100 VID]
> >
> > The switch reads 0x8100 as the EtherType, does not recognise a valid
> > CPU tag, and fails to strip it on egress. The raw 0x8899 tag then leaks
> > to the peer port, breaking any protocol (e.g. batman-adv over a VLAN
> > subinterface) that relies on seeing clean 802.1Q frames.
> >
> > Fix this by calling __vlan_hwaccel_push_inside() to move the VLAN tag
> > into the skb payload before prepending the RTL8_4 DSA CPU tag in
> > rtl8_4_tag_xmit(). The helper frees the skb internally on allocation
> > failure, so returning NULL directly is correct and consistent with how
> > tag_sja1105.c handles the same pattern.
>
> Please take a step back. Rather than have two drivers do this, then a
> third, a fourth, ... should the core be doing this?
That's very good advice. I will do the changes in `user.c` and test it
locally, and
send a patch afterwards.
Thank you.
>
> Andrew