The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: willemb@google.com
To: Julius Bairaktaris <julius@bairaktaris.de>,
	Andrew Lunn <andrew@lunn.ch>,
	 Vladimir Oltean <olteanv@gmail.com>,
	netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Willem de Bruijn" <willemb@google.com>,
	"Simon Horman" <horms@kernel.org>,
	"Alvin Šipraga" <alvin.sipraga@analog.com>,
	"Linus Walleij" <linusw@kernel.org>,
	"Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Pawel Dembicki" <paweldembicki@gmail.com>,
	"Tobias Waldekranz" <tobias@waldekranz.com>,
	"Daniel Golle" <daniel@makrotopia.org>,
	"Russell King" <linux@armlinux.org.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 2/6] net: dsa: tag_sja1105, tag_vsc73xx_8021q: read the bridge once in xmit
Date: Sat, 05 Dec 2026 22:54:49 -0500	[thread overview]
Message-ID: <willemb.31d0813aae567@google.com> (raw)
In-Reply-To: <20261128165206.3248835-3-julius@bairaktaris.de>

Julius Bairaktaris wrote:
> A frame received on a port that offloads a bridge carries
> offload_fwd_mark (dsa_default_offload_fwd_mark()). A tc mirred redirect
> or mirror, or an nft netdev fwd or dup, from that port to a standalone
> port of the same switch keeps the mark, and vsc73xx_xmit() and
> sja1105_imprecise_xmit() then look up the bridge of the standalone port:
> dsa_port_bridge_dev_get() returns NULL and br_vlan_enabled() dereferences
> it, in softirq, for every such frame. The same happens when a port leaves
> its bridge while a frame that the bridge marked is still queued for it.
> Both taggers also read dp->bridge twice, once for the device and once
> for the number.

> Read dp->bridge once. When the port is not in a bridge, it is a
> standalone port, so send the frame in its standalone VLAN, to the port
> alone, with the PCP of its TX queue, as for a frame without
> offload_fwd_mark.

> Both drivers are fixed in one commit because they share the mechanism.

> Found by an LLM review (Claude), and reproduced in QEMU with dsa_loop.

> Fixes: b6ad86e6ad6c ("net: dsa: sja1105: add bridge TX data plane offload  
> based on tag_8021q")
> Fixes: 6c87e1a47928 ("net: dsa: vsc73xx: introduce tag 8021q for vsc73xx")
> Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>

- net/dsa/tag_sja1105.c:221-224 (sja1105_imprecise_xmit):
   When skb->offload_fwd_mark is set and !bridge, the new fallback inside
   sja1105_imprecise_xmit() immediately sends the frame through  
dsa_8021q_xmit()
   in the port's standalone tag_8021q VLAN, bypassing  
sja1105_is_link_local(skb)
   in both sja1105_xmit() (lines 289-295, SPI management routes via
   sja1105_defer_xmit()) and sja1110_xmit() (lines 320-351, in-band control
   extension header/trailer). SJA1105/SJA1110 hardware matches  
01:80:C2:xx:xx:xx
   and PTP 01:1B:19:xx:xx:xx (include/linux/dsa/sja1105.h:22-26) in its
   management filters, so link-local or PTP frames carrying offload_fwd_mark
   (e.g., redirected from another switch's bridged port or bridge-forwarded  
with
   group_fwd_mask / PTP multicast right before port leave) must take the  
control
   path, not dsa_8021q_xmit(). Fix cleanly by checking READ_ONCE(dp->bridge)  
in
   sja1105_xmit() and sja1110_xmit() and only calling  
sja1105_imprecise_xmit(skb,
   netdev, bridge) when bridge != NULL, letting !bridge fall through to the  
normal
   standalone path (which also removes the extra pcp parameter).

- tag_vsc73xx_8021q) net/dsa/tag_sja1105.c:282,313,  
net/dsa/tag_vsc73xx_8021q.c:19:
   Same root architectural gap as Patch 3/6: tc mirred and nft netdev  
fwd/dup do
   not clear RX skb->offload_fwd_mark on egress redirect, so redirecting  
from a
   bridged ingress port to a *bridged* sja1105/vsc73xx port (e.g. in another
   bridge) still enters imprecise bridge-wide TX forwarding (or returns an
   untagged/wrong-VLAN frame

  reply	other threads:[~2026-12-06  3:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 16:51 [PATCH net 0/6] net: dsa: offload_fwd_mark on unbridged ports, bridge numbers across switches Julius Bairaktaris
2026-11-28 16:52 ` [PATCH net 1/6] net: dsa: free struct dsa_bridge after an RCU grace period Julius Bairaktaris
2026-11-28 16:52 ` [PATCH net 2/6] net: dsa: tag_sja1105, tag_vsc73xx_8021q: read the bridge once in xmit Julius Bairaktaris
2026-12-06  3:54   ` willemb [this message]
2026-11-28 16:52 ` [PATCH net 3/6] net: dsa: tag_dsa: send a marked frame of an unbridged port from the CPU Julius Bairaktaris
2026-12-06  3:55   ` willemb
2026-11-28 16:52 ` [PATCH net 4/6] net: dsa: do not hand a switch a bridge number above its limit Julius Bairaktaris
2026-12-06  3:55   ` willemb
2026-11-28 16:52 ` [PATCH net 5/6] net: dsa: do not take a bridge number past the end of the bitmap Julius Bairaktaris
2026-11-28 16:52 ` [PATCH net 6/6] net: dsa: keep a bridge number while another tree uses it Julius Bairaktaris
2026-12-06  3:57   ` willemb
2026-12-06  3:54 ` [PATCH net 0/6] net: dsa: offload_fwd_mark on unbridged ports, bridge numbers across switches willemb

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=willemb.31d0813aae567@google.com \
    --to=willemb@google.com \
    --cc=alvin.sipraga@analog.com \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=horms@kernel.org \
    --cc=julius@bairaktaris.de \
    --cc=kuba@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=paweldembicki@gmail.com \
    --cc=tobias@waldekranz.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