From: <JensEmil.SchulzOstergaard@microchip.com>
To: <sashiko-reviews@lists.linux.dev>
Cc: <robh@kernel.org>, <conor+dt@kernel.org>, <devicetree@vger.kernel.org>
Subject: Re: [PATCH net-next v10 1/9] net: dsa: add tag driver for LAN9645X
Date: Mon, 3 Aug 2026 14:16:58 +0000 [thread overview]
Message-ID: <b3636750a818ae6f4097da69bc0337d923f082d4.camel@microchip.com> (raw)
In-Reply-To: <20260714144344.B5FCD1F000E9@smtp.kernel.org>
On Tue, 2026-07-14 at 14:43 +0000, sashiko-bot@kernel.org wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Adding an out-of-band VLAN tag without checking for and popping an existing payload tag results in double-tagged frames.
> --
>
> --- Patch [1]: [PATCH net-next v10 1/9] net: dsa: add tag driver for LAN9645X ---
> commit 3fca3b09e95a3eeee247c89f8ecdf602074e9506
> Author: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com>
>
> net: dsa: add tag driver for LAN9645X
>
> This commit adds a DSA tag driver for the LAN9645x family of switches. It
> configures an NPI port to use a 16-byte long prefix on extraction and no
> prefix on injection, prepending an internal frame header (IFH) to transmit
> critical data.
>
> > diff --git a/net/dsa/tag_lan9645x.c b/net/dsa/tag_lan9645x.c
> > new file mode 100644
> > index 0000000000000..2692c7ad56cbc
> > --- /dev/null
> > +++ b/net/dsa/tag_lan9645x.c
> [ ... ]
> > +static struct sk_buff *lan9645x_rcv(struct sk_buff *skb,
> > + struct net_device *ndev)
> > +{
> [ ... ]
> > + /* While we have REW_PORT_NO_REWRITE=0 on the NPI port, we still disable
> > + * port VLAN tagging with REW_TAG_CFG. Any classified VID, different
> > + * from a VID in the frame, will not be written to the frame, but is
> > + * only communicated via the IFH. So for VLAN-aware ports we add the IFH
> > + * vlan to the skb.
> > + */
> > + dp = dsa_user_to_port(skb->dev);
> > + vlan_tpid = tag_type ? ETH_P_8021AD : ETH_P_8021Q;
> > +
> > + if (dsa_port_is_vlan_filtering(dp) && vlan_tci) {
> > + u16 port_pvid = 0;
> > +
> > + br_vlan_get_pvid_rcu(skb->dev, &port_pvid);
> > +
> > + if ((vlan_tci & VLAN_VID_MASK) != port_pvid)
>
> [Severity: High]
> Does this code result in double-tagged frames?
>
> If the hardware delivers the frame without stripping the in-band tag because
> port VLAN rewrite is disabled, calling __vlan_hwaccel_put_tag() here adds an
> out-of-band tag while leaving the original in-band tag intact in the payload.
> This would cause the network stack to process a single 802.1Q tagged frame
> from the wire as a Q-in-Q double-tagged frame.
>
> Should lan9645x_rcv() pop the existing payload tag (for example, using
> __skb_vlan_pop()) before adding the out-of-band tag to avoid duplicating it?
>
This is a false positive. On a vlan aware port, the vlan tag is popped and all
vlan info is stored in the IFH. The tag will not egress in the frame data unless
the rewriter pushes it, and we disable this toward the cpu via REW_TAG_CFG.
There is no in-band vlan tag in the frame in this scenario. Only the IFH contains
the classified vlan info, so we add it to the skb. Using __skb_vlan_pop would
corrupt the frame, and we avoid it on purpose. I will update the comment to be
more clear about this.
> > + __vlan_hwaccel_put_tag(skb, htons(vlan_tpid), vlan_tci);
> > + }
> > +
> > + return skb;
> > +}
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260713-dsa_lan9645x_switch_driver_base-v10-0-a4886a08fb15@microchip.com?part=1
next prev parent reply other threads:[~2026-08-03 14:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 14:32 [PATCH net-next v10 0/9] net: dsa: add DSA support for the LAN9645x switch chip family Jens Emil Schulz Østergaard
2026-07-13 14:32 ` [PATCH net-next v10 1/9] net: dsa: add tag driver for LAN9645X Jens Emil Schulz Østergaard
2026-07-14 14:43 ` sashiko-bot
2026-08-03 14:16 ` JensEmil.SchulzOstergaard [this message]
2026-07-13 14:32 ` [PATCH net-next v10 2/9] dt-bindings: net: lan9645x: add LAN9645X switch bindings Jens Emil Schulz Østergaard
2026-07-14 14:43 ` sashiko-bot
2026-08-03 13:33 ` JensEmil.SchulzOstergaard
2026-07-13 14:32 ` [PATCH net-next v10 3/9] net: dsa: lan9645x: add autogenerated register macros Jens Emil Schulz Østergaard
2026-07-13 14:32 ` [PATCH net-next v10 4/9] net: dsa: lan9645x: add basic dsa driver for LAN9645X Jens Emil Schulz Østergaard
2026-07-14 14:43 ` sashiko-bot
2026-08-03 13:28 ` JensEmil.SchulzOstergaard
2026-07-23 13:08 ` Paolo Abeni
2026-08-03 12:32 ` Jens Emil Schulz Ostergaard
2026-07-13 14:32 ` [PATCH net-next v10 5/9] net: dsa: lan9645x: add bridge support Jens Emil Schulz Østergaard
2026-07-13 14:32 ` [PATCH net-next v10 6/9] net: dsa: lan9645x: add vlan support Jens Emil Schulz Østergaard
2026-07-13 14:32 ` [PATCH net-next v10 7/9] net: dsa: lan9645x: add mac table integration Jens Emil Schulz Østergaard
2026-07-13 14:32 ` [PATCH net-next v10 8/9] net: dsa: lan9645x: add mdb management Jens Emil Schulz Østergaard
2026-07-13 14:32 ` [PATCH net-next v10 9/9] net: dsa: lan9645x: add port statistics Jens Emil Schulz Østergaard
2026-07-14 14:43 ` sashiko-bot
2026-08-03 12:55 ` JensEmil.SchulzOstergaard
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=b3636750a818ae6f4097da69bc0337d923f082d4.camel@microchip.com \
--to=jensemil.schulzostergaard@microchip.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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