From: Andrew Lunn <andrew@lunn.ch>
To: Amitesh Singh <singh.amitesh@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
olteanv@gmail.com, kuba@kernel.org, davem@davemloft.net
Subject: Re: [PATCH] net: dsa: tag_rtl8_4: push VLAN tag into payload before DSA CPU tag
Date: Tue, 8 Sep 2026 13:50:37 +0200 [thread overview]
Message-ID: <6ec8d359-727a-4fbb-9ef1-3b96d05c2942@lunn.ch> (raw)
In-Reply-To: <20260908040041.124640-1-singh.amitesh@gmail.com>
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?
Andrew
next prev parent reply other threads:[~2026-09-08 11:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 4:00 [PATCH] net: dsa: tag_rtl8_4: push VLAN tag into payload before DSA CPU tag Amitesh Singh
2026-09-08 11:50 ` Andrew Lunn [this message]
2026-09-08 14:26 ` Amitesh Singh
2026-09-10 22:01 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6ec8d359-727a-4fbb-9ef1-3b96d05c2942@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=singh.amitesh@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox