๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26817

Re: [PATCH net-next V5] net: dsa: b53: prefer CPU port 8 when available

#26817
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 07:47
135 lines
12495 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The commit message doesn't mention that existing upstream
  boards will move to a different conduit.
- [Low] The comment in b53_preferred_default_local_cpu_port() was written
  for Northstar but the code covers far more chips.

--

net: dsa: b53: prefer CPU port 8 when available

This adds a preferred_default_local_cpu_port callback to the b53 driver.
On every chip except BCM5325/5365, it returns port 8 when that port is
declared as a CPU port. DSA then uses port 8 as the default CPU port for
user ports instead of the first CPU port in the list.

> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
> index ee2d27732c0c8..da78185fec11d 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
> @@ -758,6 +758,34 @@ void b53_disable_port(struct dsa_switch *ds, int port)
>  }
>  EXPORT_SYMBOL(b53_disable_port);
>  
> +static struct dsa_port *b53_preferred_default_local_cpu_port(struct dsa_switch *ds)
> +{
> +	struct b53_device *dev = ds->priv;
> +	struct dsa_port *cpu_dp;
> +
> +	/* BCM5325/5365 only have CPU port 5 (port 8 is an alias) */
> +	if (is5325(dev) || is5365(dev))
> +		return NULL;
> +
> +	/*
> +	 * Most devices have 3 CPU ports: 5 (IMP1), 7, 8 (IMP0). They are
> +	 * connected to separated Ethernet controllers. This design allows e.g.
> +	 * dual IMP setups where WAN traffic goes to port 5 and LAN traffic goes
> +	 * to port 8.
> +	 *
> +	 * Port 8 (IMP0) is the fully featured CPU port. Ports 5 and 7 support
> +	 * Broadcom header but don't support features that relay on trapping to
> +	 * CPU (e.g. EAP, STP).

[Severity: Low]
Does this comment hold for all the chips the callback now covers? Since
V5 it applies to every chip except BCM5325/5365. However, several entries
in b53_switch_chips[] have no port 5 or port 7, for example:

	.chip_id = BCM53115_DEVICE_ID,
	.dev_name = "BCM53115",
	.vlans = 4096,
	.enabled_ports = 0x11f,

BCM5389/5395/5397/53101/53115 use enabled_ports = 0x11f, and BCM583xx
uses 0x103. BCM53134 (0x12f) and BCM5398 (0x17f) have no port 7. Only
the Northstar/4908/58xx-class chips seem to match "Most devices have 3
CPU ports".

The comment says ports 5 and 7 can't trap to the CPU. Has that been
checked for the non-Northstar families now included, such as the
BCM53125?

There are also a few typos. In the comment, "relay" should be "rely" and
"separated" should be "separate". In the commit message, "as in opposite
to" probably should be "as opposed to".

> +	 *
> +	 * Prefer CPU port 8 if available.
> +	 */
> +	cpu_dp = dsa_to_port(ds, B53_CPU_PORT);
> +	if (cpu_dp && dsa_port_is_cpu(cpu_dp))
> +		return cpu_dp;

[Severity: Medium]
Will existing boards switch to a different conduit after a kernel
upgrade? In dsa_tree_setup_cpu_ports(), every CPU port other than the
preferred one is skipped:

net/dsa/dsa.c:dsa_tree_setup_cpu_ports() {
    ...
		preferred_cpu_dp = dsa_switch_preferred_default_local_cpu_port(cpu_dp->ds);
		if (preferred_cpu_dp && preferred_cpu_dp != cpu_dp)
			continue;
    ...
}

Before this patch, user ports took the first CPU port in dst->ports
order, which is port 5.

Two upstream boards declare port 8 together with port 5 and/or port 7.

bcm47094-asus-rt-ac3100.dtsi marks ports 5, 7 and 8 as "cpu". In
bcm-ns.dtsi these map to gmac0, gmac1 and gmac2, so the default conduit
moves from gmac0 to gmac2.

bcm47189-tenda-ac9.dts uses the BCM53125 switch from bcm53573.dtsi:

	port@5 {
		reg = <5>;
		ethernet = <&gmac1>;
	...
	port@8 {
		reg = <8>;
		ethernet = <&gmac0>;
	};

Here the conduit moves from gmac1 to gmac0. This board is affected only
because V5 extended the callback to all chips except BCM5325/5365.

Anything tied to the old conduit, such as MTU or offload settings, VLANs
on the conduit, network scripts or monitoring, could change without
notice.

Could the commit message say that existing multi-CPU-port setups get a
new default conduit? Could it also explain why non-Northstar chips like
the BCM53125 are included?

> +
> +	return NULL;
> +}

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203074627.15461-1-zajec5%40gmail.com
Technical Details
Message-ID: <179637047136.3146.733165222481715326@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377169-linux-kernel-netdev=dewy.ru
References: <20261203074627.15461-1-zajec5@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377169-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next V5] net: dsa: b53: prefer CPU port 8 when available
Date: Fri, 04 Dec 2026 07:47:51 +0000
Organization: Usenet Network
Message-ID: <179637047136.3146.733165222481715326@kernel.org>
References: <20261203074627.15461-1-zajec5@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2707829"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:DHuLTfC4JoHxb4ZNFii8Sv4wjnY= sha256:i5PheLkNOCT3vxkPlex7YHPL9kiaC1YDFKG60fKH4cQ=
	sha1:EBo0p91mHokpi463oXdPMblKv7o= sha256:pAi0MODWsLwjx9ftqAWbM5FjVqsFJ6BtHxznYFsc684=
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 A6327117B5C; Fri,  4 Dec 2026 10:48:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.24, 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 wmK8Kfil5B4w;
	Fri,  4 Dec 2026 10:48:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377169-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id ECEC1117B58; Fri,  4 Dec 2026 10:48:00 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 5B2AA24A2B; Fri,  4 Dec 2026 07:47:55 +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=1796370473;
	b=SW4FC3zwYNhlYn0tvMk3c2finIAJ0lxXqWBFI4uDHgP7uuU5cw/co2I3CXjVGcZ7pnT8
	 jkiujYVIb7bE7lMC1zcMiZb+LoBMBp+dvaryBxEJ79lgTY1JboYdWcMmHke5puZJ4Qmbz
	 m/9b/9TG7zhcHFfcSwIEauG4P9mdQk4gr34S7+8laWh0mbZfSpLIgZQDb2lpGfXLIurwt
	 6sx+jxfCctHaHIcjjlAswhxlEosu0PQ0Pw5DKZPPIgT6rD4BTn/QPXlUwJzjPBdzGI4Ow
	 iTBRgGNKmEJhMjW/JkXRdk+x8EeUeHJYZAeTxy3GQ1Z84g6mRjsmuUtNQl5rFjyVJgQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796370473;
	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=Qr1nLY0YB6u2BwKKi65IQ65kX1oc/D6LUvyLwesM2nE=;
	b=4IsC8x6TpamSd+EVkzSLhw+8aCCnZde5zsAgPTGmgBt+D3F5rFR08a1oyWJjcK20j+Kx
	 PFVKg+vtvjeIABXKlkeFOOZavOiseFLzKvnFB91Dq1BERB2wowDwE0Ms3W/dbS7OesYj/
	 IQTQEXsvvLWAuIreIFT/LQruBlpYWHbEK/aBhInBrGvUsh5Ly4pK+dXMXoBaEUpZJn6H+
	 esqL6wK7JXshjOmFM1DclEbVJZ9e9/bzOuFze1ffw+k6FwJNM+bcgzkv+FvBIFFMqT/Cd
	 tQ3WmE40DmKWerGQq1dJpA8GzLwpmHIjIsnPoP3BR0U8hPnA+h2QF7lnio/tMwhmiMw==
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=WyAWoUpk;
	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 C86D1606A337;
	Fri,  4 Dec 2026 07:47:53 +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=WyAWoUpk
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=1796370473;
	b=S/9VEWdWa6gyRQKcQGCDVfTlRe7R6SRZb/3VAqxnUVcIS1G7b9mfACACDQLdnBgnJneE
	 5+skKxq67vwq8SOmfNpFeHoZGjpvTg2nhP81DmZxgWuVqH36iSN35JNjVD3rw2zkaqZwA
	 sbujx1S3nTihJr3QY4azW33f3YFvf1aUDkgtZ0IHA7daAtPpiuStTOvDROzn69VBYY7XH
	 2vnFezhl5uqMyN6IdS1W8irRRUj5xU71LqZPSlIE/NhUCarsVJdC2GHLv4sc7nAotCw2q
	 /g9SUH5xs5cCj3Io6/zHiw6uhSJkXK41D91OAFOAtZUHrsjCLqVI17RkgVABqBY1NiA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796370473;
	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=Qr1nLY0YB6u2BwKKi65IQ65kX1oc/D6LUvyLwesM2nE=;
	b=xzI1NDsnXRN740CekPtP/V1H/IIcMAwaw+hc6IdamGOzDtsh0AnMscCp/pIKMorh6x0J
	 DflWs6vkL64aVUvooDCfGtdjs8hyrJNN2L8lIByVfDkcKke6pTpVdotY2/G3Abrdzjkhi
	 TvA9haQ++HDaYS6VGqHnFnFIhqD8ySr4gVhAGuHMp3NfiOH41IB8v9MyLr7XiHfkMLcaO
	 gggDOVgcmaNxDzSBwtmOL++utc5480e6kb6h4kvGQPyBxOkZt0ZT8VpNjVYNMEptfmotk
	 Gm/DSWZxWRpn85ePb7q7yRVkqv3Y8XAlz+RHbENOWIh/qzUgdsk8KNRBmPBGwRhplUg==
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=WyAWoUpk;
	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 E3A26606A32F
	for <netdev@vger.kernel.org>; Fri,  4 Dec 2026 07:47:52 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8E101F00931;
	Fri,  4 Dec 2026 07:47:51 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796370472;
	bh=Qr1nLY0YB6u2BwKKi65IQ65kX1oc/D6LUvyLwesM2nE=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=WyAWoUpkNMVzPpbZd8IWr+enukoDa9IM1es5HBO/H7NOqIpFVH04/zho+7rClLuSh
	 zRRAU3ykYS5KNMSvwqLCxNukcr6v2KnifhdXDm+T+b8Omdp0yJCu9aDcaUil8xYywV
	 W1E6jbNkKm4L+FM7bhApdtk96ARFe8ZK2+K0aft4pWfKnl2axj/lCLvg2mbnwH7lls
	 dgmXRUH6SEibbnaJEzGn74DHifOPT5ryCLsrih8yBonNSaEnWUw0uS7j5Z9lx4aD+H
	 g8j5m1LfCUvxC2ULebHH8BmFOvn8u4o2lL+6Q354VXAcuJwcVtez0PkeL4IU+KsPax
	 a8kmS+hidR0CQ==
X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
 pabeni@redhat.com, andrew@lunn.ch, olteanv@gmail.com,
 florian.fainelli@broadcom.com, jonas.gorski@gmail.com, netdev@vger.kernel.org,
 rosenp@gmail.com, rafal@milecki.pl
X-In-Reply-To: <20261203074627.15461-1-zajec5@gmail.com>
X-sashiko-severity: Medium
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