Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: zajec5@gmail.com
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
Subject: Re: [PATCH net-next V4] net: dsa: b53: prefer CPU port 8 for Northstar devices
Date: Thu, 03 Dec 2026 10:35:50 +0000	[thread overview]
Message-ID: <179629415059.3146.12960693580750692833@kernel.org> (raw)
In-Reply-To: <20261202103450.24657-1-zajec5@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 2

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] This finding is speculative: it depends on how the hardware
  decodes GLOBAL_CONFIG bits [7:6] on BCM5301x.
- [Low] On existing Northstar boards, the new
  b53_preferred_default_local_cpu_port()…
- [Low] The comment added in b53_preferred_default_local_cpu_port()
  (drivers/net/dsa/b53/b53_common.c:771-773) describes a functional…

--

net: dsa: b53: prefer CPU port 8 for Northstar devices

This adds a preferred_default_local_cpu_port callback to the b53 driver.
On BCM5301x (Northstar) switches it returns port 8 when that port is
configured as a CPU port. DSA then assigns all user ports to port 8
instead of the first CPU port listed in the device tree.

> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
> index ee2d27732c0c8..53625090131e9 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
> @@ -758,6 +758,32 @@ 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;
> +
> +	/*
> +	 * Northstar SoCs devices have 3 Ethernet controllers and 3 CPU ports:
> +	 * 5 (IMP1), 7, 8 (IMP0). This design was meant for dual IMP setups when
> +	 * WAN traffic goes to port 5 and LAN traffic goes to port 8.
> +	 *
> +	 * While all 3 ports support Broadcom header, ports 5 and 7 have their
> +	 * limitations. Features that relay on trapping to CPU (e.g. EAP, STP)
> +	 * won't work when using those as CPU ones.

[Severity: Low]
This comment says STP and EAP trapping don't work when port 5 or 7 is the
CPU port. bcm-ns.dtsi lists port@5 first. That means boards such as
rt-ac3100, rt-ac3200, rt-ac5300 and wxr-1750dhp currently get port 5 as
the default CPU port, and rt-ac88u gets port 7.

If the comment is accurate, isn't this patch a fix for a functional
regression rather than a preference change? The commit message only says
"prefer" and has no Fixes: tag. That makes it hard to tell whether the
patch belongs in net with a Fixes: tag or in net-next.

Could the commit message say what is broken and which change made port
5/7 the default? If there is no functional bug, does the comment overstate
the problem?

This patch also doesn't help boards that enable only port 5 as a CPU port
(most Luxul boards, Netgear R6250, Buffalo WZR-1166DHP, Meraki MR26/MR32,
bcm953012er). Going by the comment, trapping would stay broken on them.
Should the commit message mention that?

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

[Severity: Low]
Does this change the conduit for user ports on existing boards?

dsa_tree_setup_cpu_ports() walks the ports in DT order and gives all user
ports to the first local CPU port. In bcm-ns.dtsi that is port@5 (gmac0).
With this callback in place, ports 5 and 7 are skipped:

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

As a result, every user port gets port 8 (gmac2) as its conduit.

These in-tree boards keep more than one CPU port enabled:

  bcm47094-asus-rt-ac3100.dtsi (ports 5, 7 and 8; gmac0 -> gmac2)
  bcm4709-asus-rt-ac3200.dts
  bcm47094-asus-rt-ac5300.dts
  bcm4708-buffalo-wxr-1750dhp.dts
  bcm47094-asus-rt-ac88u.dts (port 7/gmac1 -> port 8/gmac2)

On these boards, user ports would appear as lan1@eth2 instead of
lan1@eth0. Conduit-specific configuration (MTU, ethtool/tc on the
conduit, distro network scripts) would then apply to a different
interface.

b53 doesn't implement .port_change_conduit, so dsa_user_change_conduit()
returns -EOPNOTSUPP. Users can't restore the previous conduit at runtime
through IFLA_DSA_CONDUIT; the only way back is to edit the DT.

Could the commit message document this user-visible change?

[Severity: Medium]
This one is speculative and depends on how BCM5301x decodes bits [7:6] of
B53_GLOBAL_CONFIG. Does the frame management port setting match the new
default CPU port?

b53_setup() calls b53_enable_cpu_port()->b53_brcm_hdr_setup() for each
CPU port in ascending order. b53_brcm_hdr_setup() only ORs bits in:

drivers/net/dsa/b53/b53_common.c:b53_brcm_hdr_setup() {
    ...
	b53_read8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, &hdr_ctl);
	if (port == 8)
		hdr_ctl |= GC_FRM_MGMT_PORT_MII;
	else if (port == 5)
		hdr_ctl |= GC_FRM_MGMT_PORT_M;
	b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, hdr_ctl);
    ...
}

GC_FRM_MGMT_PORT_M is 0xC0 and GC_FRM_MGMT_PORT_MII is 0x80. A switch
with both port 5 and port 8 as CPU ports therefore ends up with 0xC0,
which is the value the driver uses for port 5. No later code clears these
bits.

If 0b11 selects port 5 as the frame management port on BCM5301x, wouldn't
trapped BPDUs and EAP frames still go to port 5/gmac0, while DSA has bound
all user ports to port 8? In that case, should b53_brcm_hdr_setup() clear
GC_FRM_MGMT_PORT_M and then set the IMP0 value for the preferred CPU port?

There is evidence the other way. b53_srab.c names port 5 IMP1 and port 8
IMP0, and the comment above describes a dual IMP design. So 0b11 may mean
dual IMP mode with port 8 still IMP0. Could someone with the BCM5301x
datasheet confirm which encoding applies?

> +
> +	return NULL;
> +}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202103450.24657-1-zajec5%40gmail.com

      parent reply	other threads:[~2026-12-03 10:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 10:34 [PATCH net-next V4] net: dsa: b53: prefer CPU port 8 for Northstar devices Rafał Miłecki
2026-12-02 20:13 ` Florian Fainelli
2026-12-02 20:32   ` Rafał Miłecki
2026-12-02 21:10     ` Florian Fainelli
2026-12-03 10:35 ` netdev-bot+sashiko [this message]

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=179629415059.3146.12960693580750692833@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=jonas.gorski@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=rafal@milecki.pl \
    --cc=rosenp@gmail.com \
    --cc=zajec5@gmail.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