Netdev List
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Woojung Huh <woojung.huh@microchip.com>,
	UNGLinuxDriver@microchip.com, Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Ido Schimmel <idosch@nvidia.com>,
	netdev@vger.kernel.org, bridge@lists.linux.dev,
	kernel@pengutronix.de
Subject: Re: [PATCH net-next 1/5] net: dsa: tag_ksz: do not mark trapped link-local frames as forwarded
Date: Mon, 30 Nov 2026 06:54:09 +0100	[thread overview]
Message-ID: <aw0PgQEZy5Q8NVhT@pengutronix.de> (raw)
In-Reply-To: <f2bf2333-8cbe-45d7-ae63-1cb0a15f9eb4@lunn.ch>

On Thu, Nov 26, 2026 at 03:47:30PM +0100, Andrew Lunn wrote:
> > +	/* 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

  reply	other threads:[~2026-11-30  5:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  8:07 [PATCH net-next 0/5] net: dsa: microchip: let the bridge decide about link-local frames Oleksij Rempel
2026-11-26  8:07 ` [PATCH net-next 1/5] net: dsa: tag_ksz: do not mark trapped link-local frames as forwarded Oleksij Rempel
2026-11-26 14:47   ` Andrew Lunn
2026-11-30  5:54     ` Oleksij Rempel [this message]
2026-11-26  8:07 ` [PATCH net-next 2/5] net: dsa: microchip: ksz9477: do not keep the learned port in FDB entries Oleksij Rempel
2026-11-27  8:24   ` netdev-bot+sashiko
2026-11-26  8:07 ` [PATCH net-next 3/5] net: dsa: microchip: ksz9477: do not learn addresses on the CPU port Oleksij Rempel
2026-11-27  8:24   ` netdev-bot+sashiko
2026-11-26  8:07 ` [PATCH net-next 4/5] net: dsa: microchip: ksz9477: refuse FDB/MDB entries for trapped groups Oleksij Rempel
2026-11-27  8:24   ` netdev-bot+sashiko
2026-11-26  8:07 ` [PATCH net-next 5/5] net: dsa: microchip: ksz9477: report the trapped link-local groups Oleksij Rempel
2026-11-27  8:24   ` netdev-bot+sashiko
2026-11-26 10:23 ` [PATCH net-next 0/5] net: dsa: microchip: let the bridge decide about link-local frames Vladimir Oltean
2026-11-27  5:53   ` Oleksij Rempel

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=aw0PgQEZy5Q8NVhT@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=bridge@lists.linux.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=woojung.huh@microchip.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