Re: [PATCH net-next 1/5] net: dsa: tag_ksz: do not mark trapped link-local frames as forwarded

From
Oleksij Rempel <o.rempel@pengutronix.de>
Date
2026-11-30 05:54:11
Also in
bridge
Reply to
Andrew Lunn, 2026-11-26
On Thu, Nov 26, 2026 at 03:47:30PM +0100, Andrew Lunn wrote:
quoted
+	/* The switch driver reports which link-local groups the switch sends
+	 * to the CPU only. The switch did not forward frames to these groups,
+	 * so do not mark them, and let the bridge apply its own rules
+	 * (group_fwd_mask, STP state).
+	 */
+	if (!ksz_link_local_trapped(skb->dev, eth_hdr(skb)->h_dest))
+		dsa_default_offload_fwd_mark(skb);
There is a bit of a common pattern in tag drivers:

        if (likely(!is_link_local_ether_addr(eth_hdr(skb)->h_dest)))
                dsa_default_offload_fwd_mark(skb);

Your variant is more specific, but does it need to be?
Yes. The KSZ8873 and the KSZ9893 use the same tag protocol, but they handle the
link-local groups differently. I measured it on both, with this series applied,
by dropping the bridge's software copies at the egress port and counting what
still left the switch:

  group                 KSZ9893 (traps)     KSZ8873
  01:80:C2:00:00:00     CPU only            CPU only
  01:80:C2:00:00:02-0F  CPU only            forwarded by the switch,
                                            and a copy to the CPU

With is_link_local_ether_addr() alone, the KSZ8873 frames to :02..:0F
would be forwarded twice whenever group_fwd_mask lets the bridge
forward them: once by the switch, once by the bridge. On the KSZ9893
the generic check would work, because the driver traps all these
groups.

I left the KSZ8 switches out of this series on purpose: their bitmap
stays empty, so their frames are marked as before. The KSZ8873 cannot
easily be changed to trap the other groups: each trapped group needs
an entry in the static MAC table, which has only 8 entries, and one of
them is already used for the STP trap. Leaving :00 unmarked on the
KSZ8873 would open other problems: the CPU port would then have to
stop learning, and every address behind it would need one of the same
8 static entries.
Should we consider adding a variant of dsa_default_offload_fwd_mark()
which combines this into one? And then change the tag drivers to use
it?
Yes, something like this?

void dsa_link_local_offload_fwd_mark(struct sk_buff *skb, u16 trapped);

It marks the frame unless it goes to a link-local group whose bit is
set in trapped. tag_brcm.c and tag_mxl862xx.c would pass 0xffff,
tag_ksz.c the bitmap from the switch driver. Should I add it?

Oleksij
Thread (14 messages) 14 messages, 4 authors, last reply 5d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help