🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24412

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

#24412
From: Oleksij Rempel
Date: Mon, 30 Nov 2026 05:54
55 lines
12856 bytes
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
Technical Details
Message-ID: <aw0PgQEZy5Q8NVhT@pengutronix.de>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373889-linux-kernel-netdev=dewy.ru
References: <20261126-ksz-stp-link-local-v1-0-39aed15f6271@pengutronix.de> <20261126-ksz-stp-link-local-v1-1-39aed15f6271@pengutronix.de> <f2bf2333-8cbe-45d7-ae63-1cb0a15f9eb4@lunn.ch>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373889-linux-kernel-netdev=dewy.ru
From: o.rempel@pengutronix.de (Oleksij Rempel)
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <aw0PgQEZy5Q8NVhT@pengutronix.de>
References: <20261126-ksz-stp-link-local-v1-0-39aed15f6271@pengutronix.de>
 <20261126-ksz-stp-link-local-v1-1-39aed15f6271@pengutronix.de>
 <f2bf2333-8cbe-45d7-ae63-1cb0a15f9eb4@lunn.ch>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
	logging-data="1347547"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:By7Jio0nxMQgEtK0GCZ5936DBtk= sha256:Sezq21TRed4Lxi1heF/C8VNnMUVJ3tCoo9/+UCe6g6Q=
	sha1:pIpNswCfgemAwvrYzptgKF26i4Y= sha256:m8dLFTwCjV1Tm7rGqV7koLUMNgOVLQGN5yx4Io5caLo=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 0F108125FC6; Mon, 30 Nov 2026 08:54:33 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=pengutronix.de
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id vCoHS_87CDCs;
	Mon, 30 Nov 2026 08:54:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373889-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=pengutronix.de
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 758EB125FC5; Mon, 30 Nov 2026 08:54:16 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id E055D27553; Mon, 30 Nov 2026 05:54:13 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796018053;
	b=ZGv2ZrWFYtKsyzULqzdLTtuX5EJCV5q8h6DECG5XfoJTyzMtJcqQmmOq1BQ7/G9ReTXp
	 gBkKPgtuTVMbs6Hmy1ZsyNaQowtbh/VJYSD3IwC4q1sbcwyb82HUjm9NvMu7ku0TRrCPz
	 0pGLhhHvJrdzwCZklUP44Q7SnUqeC14iJEqyMTW3WSJ08U1Wutr/dnnJEdzk/RrZekWAm
	 CYwcklIbclmhfXhc0SFukAqvBfz2Q+jFLgOFoHsLJLRFioQiVPJpeB2ldyF/3p9E+Er4r
	 LXoo2hFvMGOhxrNnadV2nTDjfVOhATr7JNYX3Skn1Gii8xj8gxWHk/lrZD+osELi2OQ==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796018053;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:Received:
	 Date:From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=y0Y88GUow1cGPRL+l+wrKRTNRn0cnfIHtd7fzz6jEgk=;
	b=qiTztPejF05pnUfhyLYI2h96L2rEqWk5RZHH1ngAt+2SLWwQobiWCJcdWcWS4IkvlTGv
	 kAoMbrrokt8QqlBRbxfoD2jfKOLgxtzXbBrnxwWeYQ8/6JpLIF7exNvyquwE2Ol0sHqSq
	 kfK9ldwK6YLtm1Hbibn3brUkwvyOCNZ6Pw606v3NC/A2fg5hxGhs0CBdjJfZ8CZvZVLGu
	 8POHyuVzXHIVX4DkX5fD8W9F72yBIo0BlhXyXI9AisWDIw663VHig/Vi9XZWE8V51HJF0
	 k6ig/nTWORwgJMKYurv9S0MCYTy2vpKI/QpBDKQKiat6lQu3Z3WRlWGfSDFbaZpu7hw==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b="BQe4X/9w";
	dmarc=none header.from=pengutronix.de;
	spf=pass smtp.mailfrom=pengutronix.de;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B22EC606A32F;
	Mon, 30 Nov 2026 05:54:13 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b=BQe4X/9w
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=185.203.200.13
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796018052;
	b=n/WO1r9wbRuCHaN/n5RMFO04YMst3VinhITT2HTM6LZiEMo1byMlOyzbgu2PsqBahBqN
	 VHbPm9aY2V/6klBwrxwgZGAtM/JZ/93Z/MpJHmIk8wd67jG8i04sFgBxoK9cIQUHjXiAK
	 Eu+bqJs5E4ohigpkor+Ja05WBlkFsg28N6hWB4RAG+PBs6O1OzQOOpfDPHk4D26ZLRLmA
	 nOBe5f+IkslYP9ldCp/tP39/Ifn7rPYRg1rE4lzDodajwcWlOIgZFmVWgH6y3Z/63AwJc
	 L+PnlPXPhskXlWUc0NjlkaTd4ib2rsOOZVOSUXKDn91XSFASttZBaz78xBErLGAwF+A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796018052;
	h=DMARC-Filter:Received:DKIM-Signature:Received:Date:From:To:Cc:
	 Subject:Message-ID:References:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To;
	bh=y0Y88GUow1cGPRL+l+wrKRTNRn0cnfIHtd7fzz6jEgk=;
	b=YDEz7465deHvjv776BIhRFG8zmvYbX19tPQu6IYUdaFCcCDpytpyvQ1pyFyHwk2QAXNj
	 ZgMnjteDIvgHzqkG5RjaOkbjO5O1FtLSW/QFVlwVnjT2jRsfDQjBv0IEq9RDhXWQUphkT
	 xV07d6JcmxJbRTic0OUg6Bc9bVv+0Ya0iQhJezqvMH1Ek4LM22XuYqMvicJtR9LP9kxQ3
	 0Gqb9KWkSqVHBr0q472BDpwjVvOreYbc5MhCmLrosz4N1zt3iQAcY9oxivO0ypqcX+FOp
	 X9BRlpJ5e5VmpMQtA+sPSRmZ81MquNldGVtuLncFkW/pgxpj/xDP0cyP4d9tlo6pkrA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=pengutronix.de;
	spf=pass smtp.mailfrom=pengutronix.de;
	dkim=pass header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b="BQe4X/9w";
	arc=pass header.oldest-pass=0 smtp.remote-ip=185.203.200.13
X-Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7221606A31C
	for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 05:54:11 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A7221606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de
X-Received: from ptx.office.stw.pengutronix.de (ptx.office.stw.pengutronix.de [IPv6:2a0a:edc0:0:900:1d::109])
	(Authenticated sender: relay-from-ptx.office.stw.pengutronix.de)
	by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id 5BDA1200FED;
	Mon, 30 Nov 2026 06:54:09 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de;
	s=20260414; t=1796018049;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=y0Y88GUow1cGPRL+l+wrKRTNRn0cnfIHtd7fzz6jEgk=;
	b=BQe4X/9wrJ+iXB/xGhEOe/odS5qgoGxV0Rlm73CeeMqJe26dmGucnPl4CPQ7NiqDfJKki4
	M9acg4SBN3FXc8jjzTMgG2xQiYYPV6KxihXb8ErUMYT89ckYzGiL4mlX2U6ndRM9APEwei
	KzbScJwzdYXIfjWOuuGfESgZbV6M403z7kZ0wYINB58rvpm/MTwVcbP9M6hAO+KSS581YY
	H0dDdh8tGLh6xFdlLG9MaWnms1NPWahyGA6KvrdPcyzzGTKLPgdFk1jX4bVuSM3LGlkMYP
	tfYpbCxCsevNg9NiXdUNKOlUlK/C6ZlGAPibKpgboLdzsODSZa0vQt+gqdmhzA==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de;
	s=20260414; t=1796018049;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=y0Y88GUow1cGPRL+l+wrKRTNRn0cnfIHtd7fzz6jEgk=;
	b=Xg7P5zmAZlLNwLC/P5md0E0udHDlOQVzC4mMDwu8BHBjjvoHqJluJosznCQ5qXcqeqh3e3
	7goivt9N56qbfS7lfLXETNy/rGqeSSLLm3V5k2MRa7x0TONVSaBMdiHp4YxBM2RAgj66iI
	azzE5AYdl9be9AiUrtlT3YagQWbkoiFBUJBnOVrLD3d9BRdWEwidDTYuZw3BYn3T7TNsmk
	keZLoCQo/w3O8UK0rBz9m/VGGQcFr9MjyJyCxDvKAoWYNjBOZmjHuslWR5rlMNO6UXAXuJ
	OlBPA2XL1+6m1nPYoiGT/LtuKr7GiJnOrvbxF07GUw+5RvszU6NjOUNkvYiQag==
X-ARC-Authentication-Results: i=1;
	ORIGINATING;
	auth=pass smtp.auth=relay-from-ptx.office.stw.pengutronix.de smtp.mailfrom=ore@pengutronix.de
X-ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1796018049; a=rsa-sha256;
	cv=none;
	b=PVh2cDiFC4WgDXdiVIe6JidEaABpGfeAPUBN6yNPFPiwdMZoZR9egeTrux7aYcI+Rf9Bbd
	lI0r1TsuCWFCJstyOlDCngeJQjNNEjeK5E64lvcs3OWLyv29SeL6JouXvxWAHv8z4+BtJC
	5iCIdRorQhuMAVgEw9AH12kOt0/aKii1gtVepGYhArvMIYdXwYd6NWbvGfMJT5maGkSg1i
	nwHqkpdO1pampv1VsPtoZEs5fl8uD1O0Ij4VoEh3fyni+CmgfwfzmSbosgPjunFhasS6uV
	ZcpVSXef+EId4F3jyF38ta+OMmH5nKohOa5XbWkfuxxXdakqE3J41sGfGWFzMw==
X-Received: by ptx.office.stw.pengutronix.de (Postfix, from userid 1058)
	id 349AC1BF65C; Mon, 30 Nov 2026 06:54:09 +0100 (CET)
X-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
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <f2bf2333-8cbe-45d7-ae63-1cb0a15f9eb4@lunn.ch>