๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17413

Re: [PATCH net v5 4/8] net: dsa: b53: reject conflicting mirror destinations

#17413
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 19:02
62 lines
10265 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message describes the b53_mirror_del() capture-port
  change as a separate bug fix ("This also fixes b53_mirror_del() ... aโ€ฆ

--

net: dsa: b53: reject conflicting mirror destinations

This patch makes b53_mirror_add() read B53_MIR_CAP_CTL before it changes
any source mask. While mirroring is enabled, it rejects a rule for a
different capture port and returns an extack message. It also changes
b53_mirror_del() so that the whole CAP_PORT_MASK field is cleared along
with MIRROR_EN when the last source is removed.

> Clear the capture-port field when the final source is removed so a later
> rule can select a new destination. This also fixes b53_mirror_del(),
> which tried to clear the destination with ~mirror->to_local_port. That
> only cleared the bits set in the port number, so a stale capture port
> could remain after the last source was removed.

[Severity: Low]
Is this paragraph accurate? A later rule doesn't seem to need
b53_mirror_del() to clear CAP_PORT_MASK in order to select a new
destination.

In drivers/net/dsa/b53/b53_common.c, the new conflict check in
b53_mirror_add() only applies while MIRROR_EN is set:

	if ((cap_ctl & MIRROR_EN) &&
	    (cap_ctl & CAP_PORT_MASK) != mirror->to_local_port) {

The add path also always rewrites the field:

	cap_ctl &= ~CAP_PORT_MASK;
	cap_ctl |= mirror->to_local_port;
	cap_ctl |= MIRROR_EN;

b53_mirror_del() clears MIRROR_EN in the same statement. Once that bit
is clear, leftover bits in CAP_PORT_MASK affect neither the hardware nor
the check.

Before this patch, the old reg &= ~mirror->to_local_port could leave a
stale value in only one case: after one rule had overwritten another
rule's destination. This patch now rejects that case. Even then,
MIRROR_EN was cleared at the same time, and the next add overwrote the
field.

A later patch in this series, "net: dsa: b53: harden mirror register
programming", describes the same change this way: "Clearing the inactive
capture-port field is cleanup."

Could the commit message call the b53_mirror_del() change a cleanup
instead of a separate fix?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112180202.324504-1-florian.fainelli%40broadcom.com
Technical Details
Message-ID: <179485573878.3136.15805681245029216909@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364654-linux-kernel-netdev=dewy.ru
References: <20261112180202.324504-5-florian.fainelli@broadcom.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364654-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v5 4/8] net: dsa: b53: reject conflicting mirror destinations
Date: Mon, 16 Nov 2026 19:02:18 +0000
Organization: Usenet Network
Message-ID: <179485573878.3136.15805681245029216909@kernel.org>
References: <20261112180202.324504-5-florian.fainelli@broadcom.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2144468"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ic+DUd3Z8UPpcR9XfvL8eD0svDY= sha256:YRa5Bu/8eS7wt3ROKmKI8rFxzhuJV7A5XirXxP4Xi8c=
	sha1:3AsGdwH5ob+rn2gIIC/c3EVGa9I= sha256:zU9/qip6yCEo/CxBMkzecFpOHpNxqEOkKw4EyH4G594=
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 A8108114D46; Mon, 16 Nov 2026 22:03:40 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
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 aHJ0uuWNEm8e;
	Mon, 16 Nov 2026 22:03:37 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364654-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id A224C114D1C; Mon, 16 Nov 2026 22:03:28 +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 65BB633DEB; Mon, 16 Nov 2026 19:02:24 +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=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794855741;
	b=CEah0MZvfxZ27UbdMotnCtrxInxU41nv52nnvqVFxchnwTnq4U9Yx7hh7G9159kmK28H
	 4GyBJphT3RF+hEWoWd26bUtWRqe4roRagQfuiCg2UJDgnGHUEe3HSC8jeOzJrGtsi1ilE
	 mqs8ugc1qS6W/UWmZ8ZeEpLqR/5OlwjxpDXMoD4QNd6+iRlESfeaSeab3wFx6sBaVjjiK
	 mtRf9i6Hc6VFNKte+5mXYNTgwYvx0H3yKvvpASfcX2jhOyR4d3QO4g2gniiBs0BCwl+A2
	 uc9ZfCa5xb/Pxwhpb4iwJrhJGa38zbjIrclSGiEKt51hYOlks0Hzng81vmKXGbxuyXw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794855741;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=zMLuVcyc/btk9EDIX75mPjRNY7fZ8fZIl5DflFQedpw=;
	b=138Wmz8iVVjNRwjxRFfctIPp/R1QFdpXxXL3rWHsiSzgkUgBbvW4j+ge7wVgDKyb7aM5
	 xECkAdRhbqKHA0U+I/iUEUPqX7E8TCdUDnp01Hfvvj9OCwi9x8y/GOFp/hbuj2oy4BXGe
	 Ps1Aaw6Uno7LF32cORWGoDOQzcDnpONSiJ5i5h4btIbyX8mGzCLPAH3nxXgJOYVUXZnm1
	 S4RWIaEyqzbEFc8wJwV5tOcpGlcvc+hMaNNHj1KeK/mITnSsn+XwPVDQELSr4auFDPOuE
	 t3YDP/JMIk43f5WJW/D7O4oTQZx3H+Qp4MsfW3TKE0k90xMTIdRDXrikmjhPgQyn4sA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eyoVH1yO;
	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 3481D606A89E;
	Mon, 16 Nov 2026 19:02:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eyoVH1yO
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794855740;
	b=RYrKLmTRo9NzTlO4BcfKD/N7BwyzB4cWnRFVOVWvL3pwNfofFYnw1YfJRlGo14w5826C
	 R/elKLlJu3+B1HibY9g3ho31WlibM/OqGWtvbIYP1z5No6cxDaUz1rwxf4Ycqo3A5Ns88
	 eSuKUkh4dnRSfAGfIOmeFoMjMn3yyFjW1RnOAto0atTEl5/zcGSMqtROkWVFVgykriFwy
	 uLrRNcItxMWM/bP/hThBuX9NbAVKCtwJeCmSenYmCBNWoN9C/InwQ/OH2LFDEhOTeztt4
	 Til5sUibU2Pv4wSMlIB1rdrEHjuIGU6dxvwSxr7PQpSPDd9XpEj3BhmELfW9uIsTRAQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794855740;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=zMLuVcyc/btk9EDIX75mPjRNY7fZ8fZIl5DflFQedpw=;
	b=ZFKM7jn9vJTZm/MyOXvWiN/dcdFvGRvZM29u00KVcygmkjKzrCCpIagQ4Bdr0wt2H/Cp
	 OATCtHTyQOKmPkIDpMQ7gmH3dEkIO1f0lrHKbEkUF0UrnxWOdNoba33ckXqN96HFmiIxp
	 QHxz3+RIVJjLlxADz8eNflFDj+xyovRYmifE4JwvVp7Si/fj4kgtbxIPINUXI7TUK/ZIv
	 H4F4Dct/E4WPQOyqcCJLJ+2xaG+NWsf4rskL9euHd0/rTr6mQYpUOe3iPOMJD8INWusAS
	 /eFUriOyS5lc5uRwyYzQ0Xf0Es8BH4jUbBbwCphLSLDKoVuY1QHjln4V2L1u/41zccg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eyoVH1yO;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56292606A889;
	Mon, 16 Nov 2026 19:02:20 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E3961F000CD;
	Mon, 16 Nov 2026 19:02:19 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794855739;
	bh=zMLuVcyc/btk9EDIX75mPjRNY7fZ8fZIl5DflFQedpw=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=eyoVH1yO1/G4ObJJM8CVkwjdc+HbrYZITXtVjUVWUlKCtn18E4Eztc/dkC84wYmJj
	 a5CqmXm1MKB9OEpp/OkLz/oicrA/SIGC9mmJGLt3/V3UshwlpqdBn+Q/TFZTs41HVC
	 vroX7l2/QLFSWEoqb8H1SgBLUAVzbGp6d/pFBMnE4zFYlpHg8BqiOOPH466Bbc/tlf
	 dbqug0/m6P1x87n83oYtXWTG/0+mgNhnpGAWG312TQXGA7Ie6P3xknzO84Vxvwm2lc
	 WNzE/excfqKjncQupehNUYyfyl510l3E3LX++3KxA+R4nS7BAL/mwY1ubp1eDfDV0Y
	 fc/I1evE/1J9g==
X-Cc: netdev@vger.kernel.org, jonas.gorski@gmail.com, andrew@lunn.ch,
 olteanv@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
 pabeni@redhat.com, vivien.didelot@gmail.com, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261112180202.324504-5-florian.fainelli@broadcom.com>
X-sashiko-severity: Low
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