From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=185.203.200.13 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== 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== 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 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 ; Mon, 30 Nov 2026 05:54:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A7221606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 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) 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== 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== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=relay-from-ptx.office.stw.pengutronix.de smtp.mailfrom=ore@pengutronix.de 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== Received: by ptx.office.stw.pengutronix.de (Postfix, from userid 1058) id 349AC1BF65C; Mon, 30 Nov 2026 06:54:09 +0100 (CET) Date: Mon, 30 Nov 2026 06:54:09 +0100 From: Oleksij Rempel To: Andrew Lunn Cc: Woojung Huh , UNGLinuxDriver@microchip.com, Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Florian Fainelli , Nikolay Aleksandrov , Ido Schimmel , 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 Message-ID: References: <20261126-ksz-stp-link-local-v1-0-39aed15f6271@pengutronix.de> <20261126-ksz-stp-link-local-v1-1-39aed15f6271@pengutronix.de> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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