๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8702

Re: [PATCH net v3 1/2] net: ethernet: bgmac: preserve forced 2.5 Gbps link speed

#8702
From: netdev-bot+sashiko
Date: Thu, 29 Oct 2026 20:39
139 lines
13005 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 steady-state 2.5G override also hits non-Northstar
  platform AMACs.
- [Low] On forced-2500 devices, the programmed MAC speed and the reported
  link speed now disagree.

--

net: ethernet: bgmac: preserve forced 2.5 Gbps link speed

This commit makes bgmac_adjust_link() use SPEED_2500 instead of the fixed
PHY's reported speed when BGMAC_FEAT_FORCE_SPEED_2500 is set. The goal is
to keep the AMAC at 2.5 Gbps on Northstar and Northstar Plus. Without it,
the first link change reprograms the MAC to 1 Gbps.

> diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
> index b3a92ae95de30..ec879c203bc59 100644
> --- a/drivers/net/ethernet/broadcom/bgmac.c
> +++ b/drivers/net/ethernet/broadcom/bgmac.c
> @@ -1417,11 +1417,15 @@ void bgmac_adjust_link(struct net_device *net_dev)
>  {
>  	struct bgmac *bgmac = netdev_priv(net_dev);
>  	struct phy_device *phy_dev = net_dev->phydev;
> +	int speed = phy_dev->speed;
>  	bool update = false;
>  
> +	if (bgmac->feature_flags & BGMAC_FEAT_FORCE_SPEED_2500)
> +		speed = SPEED_2500;

[Severity: Medium]
Does this reach more than Northstar and Northstar Plus? bgmac_probe() in
bgmac-platform.c sets the flag for any platform AMAC that has no
phy-handle, whatever the SoC family:

drivers/net/ethernet/broadcom/bgmac-platform.c:bgmac_probe() {
    ...
	} else {
		bgmac->phy_connect = bgmac_phy_connect_direct;
		bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
	}
    ...
}

Before this patch, the 2.5G setting from bgmac_miiconfig() only lasted
until the first bgmac_adjust_link(). That call reprogrammed the MAC to the
fixed PHY's 1000. With this change, 2.5G becomes the permanent MAC speed.

The in-tree Cygnus board bcm911360_entphn.dts enables eth0 ("brcm,amac"
in bcm-cygnus.dtsi) without a phy-handle, so it gets the flag. Its switch
peer is "brcm,bcm11360-srab" (BCM583XX_DEVICE_ID), and CPU port@8 there is
a fixed-link with speed = <1000>.

The companion change "net: dsa: b53: restore the NSP IMP port 2 Gbps mode"
only forces the IMP port to 2000 for is5301x() or BCM58XX_DEVICE_ID:

drivers/net/dsa/b53/b53_common.c:b53_phylink_mac_link_up() {
    ...
		if ((is5301x(dev) || dev->chip_id == BCM58XX_DEVICE_ID) &&
		    dsa_is_cpu_port(ds, port)) {
    ...
}

Would that leave the Cygnus AMAC at 2.5G and its IMP port at 1G? That is
the same mismatch the series describes as the cause of the output queue
discards.

Hurricane2 ("brcm,nsp-amac") and Stingray ("brcm,amac") would be treated
the same way if their DT had no phy-handle. In-tree Stingray boards do set
phy-handle, and no in-tree HR2 board enables amac0.

On parts without idm_base, bgmac_miiconfig() skips the 2.5G IOCTL clock
select. The MAC speed field would still stay at CMD_SPEED_2500:

drivers/net/ethernet/broadcom/bgmac.c:bgmac_miiconfig() {
	if (bgmac->feature_flags & BGMAC_FEAT_FORCE_SPEED_2500) {
		if (!(bgmac->feature_flags & BGMAC_FEAT_IDM_MASK)) {
			bgmac_idm_write(bgmac, BCMA_IOCTL,
					bgmac_idm_read(bgmac, BCMA_IOCTL) |
					0x40 | BGMAC_BCMA_IOCTL_SW_CLKEN);
		}
    ...
}

Should the override be limited to the SoCs that really run this link at
2.5G?

>  	if (phy_dev->link) {
> -		if (phy_dev->speed != bgmac->mac_speed) {
> -			bgmac->mac_speed = phy_dev->speed;
> +		if (speed != bgmac->mac_speed) {
> +			bgmac->mac_speed = speed;
>  			update = true;
>  		}

[Severity: Low]
After this change, can update ever become true on forced 2.5G devices?

bgmac_chip_reset()->bgmac_miiconfig() caches these values before the PHY
state machine runs:

		bgmac->mac_speed = SPEED_2500;
		bgmac->mac_duplex = DUPLEX_FULL;
		bgmac_mac_speed(bgmac);

The fixed PHY reports DUPLEX_FULL, so both comparisons in
bgmac_adjust_link() come out false and this block is skipped:

	if (update) {
		bgmac_mac_speed(bgmac);
		phy_print_status(phy_dev);
	}

Before the patch, the first link-up saw 1000 != 2500, reprogrammed the MAC
and printed the "Link is Up" message. That message seems to be gone on
these boards now.

Also, phy_dev->speed stays at 1000. bgmac_phy_connect_direct() registers
the synthetic fixed PHY with .speed = SPEED_1000, the DT fixed-link uses
speed = <1000>, and swphy can't represent 2500 either way.

bgmac_ethtool_ops uses phy_ethtool_get_link_ksettings(). Would ethtool and
/sys/class/net/<if>/speed then report 1000 Mb/s while the MAC is
programmed for 2.5G?

Should the commit message mention these user-visible changes?

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

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353475-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3 1/2] net: ethernet: bgmac: preserve forced 2.5 Gbps
 link speed
Date: Thu, 29 Oct 2026 20:39:51 +0000
Organization: Usenet Network
Message-ID: <179330639152.3134.1743045089447832212@kernel.org>
References: <20261026203742.3198673-2-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="2095320"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Ln59xUY9kRspgThkHR5TJSFObqw= sha256:7IYTq9ef/QIx/seojgLzcCUeh2j6pmh5bgesF3lSeUM=
	sha1:8BMF1VLZycKDV/mbhJ+YPtQsw+U= sha256:C2y/J3iADdpl42BNDuIg5hlHS8TZ3uVOos+m4Sdi3Cc=
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 5C522125C75; Thu, 29 Oct 2026 23:44:15 +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 MmpjLrD3q2rX;
	Thu, 29 Oct 2026 23:44:12 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-353475-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 A93BB125C6E; Thu, 29 Oct 2026 23:44:03 +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 3BEA43096D; Thu, 29 Oct 2026 20:40:08 +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=1793306404;
	b=T35RZ+79CoV6XJWzo11LSk/krOQgiTXqKDny0s/B+rPpg4dvB1q6zehZL7njxgO/7OE/
	 /VG7FKxEuyn+YXbq/dK1XyKaNz5updN/0tLJwBx2DUMniaUbQIOyiNEG9R3mbTxhNu3y5
	 najyqsUayVokkN+eh5EdhxjeEJatLcvphXwQiy0n2hrWn0bA4/CLALcMnlWuRS66VxpTY
	 ocro5u+yfBhgLHY/ccCwv2pI53alR4zTxk3kfdSYomMPJaGSOxJ46Ed8JmKpPKkdeqK+U
	 fs1Ja5LEuVsXvH8kJ6Vgxs1eDW5MiMT0MUMW/lKVW5C97yQZV+woMOuSii8pvx9w+Vw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793306404;
	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=Km0yqTQxYGForZ+cy0urvWCzslLgA0FkwENmG253UiU=;
	b=RMuABkAYPu26LM8TVqvLZVYz/GjqFCxUU4zagliviT4ndCqhvWb+PNKGyEQxT3jg7BO7
	 e93u5uELu5zREiDRHqC4RYxIlB9yc2ustjmM/4fjfNCy6A09as22X3a5uolpxWmivk3FN
	 y+KTMhFR+lQQ0mrdP+E7pcNW+UNim9DMUB1vGNIIk8YXSkH33JaQjl4ScN1n6IkzW9n2X
	 EHFGkOOXyG+pz7dA4IekjWo7vcaUasDTBwHAj+2XiyjX02gHVvH7oYY5ZeoZ7W1UjDsBc
	 2yne3Gp5uHHjLk53r4xZDB6kfMKKNY0N+cCZNNC9HmBiaG4q5OOjb8xd4Ii+QrVE6+w==
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=Z47TJXE0;
	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 2D6B2606A33B;
	Thu, 29 Oct 2026 20:40:04 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z47TJXE0
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=1793306393;
	b=KW39G2RGN644YXAciVAi4TjsA6AtIC487sxyQmQJ+vf4BeNpgRtkSlBIM3xcb5EcfqEK
	 YkDcSV1qxvbneEV+osF9kB50gL1GZH3rcWUWmGevj5vNjX7BHBLziUeqZtpQ2ndXVOq67
	 8K4G8qikMTeZ9bfjg4Lz1vI7eY38crD2JlQMDYvvsxv3W4LzdWIpBI5Y/ykmQLdUgwV8H
	 JIYnIA5g/oqV4WXipSX4DwnejRYh4QSXlD/xqTj0e83CpfOMJEb8r239YP5FRvtxIJCEK
	 0uYpC2EVT0h5d8C+uUu5gHxiEM+LEF3N/zJHD80LmWHtk9p/f3jKNY9LadPmVlVRENQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793306393;
	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=Km0yqTQxYGForZ+cy0urvWCzslLgA0FkwENmG253UiU=;
	b=FywwJW8dikRwgwe95E9/aM4J+9Ymm7vl7uq+9NFfaQVJhyWM1lJIsl6ldOYKiJVd/XHA
	 sIE2cZVWIOthtxVLIlkKr9B+kJo41zEs16XltPT9tg+q6s3X3JbShn36FpKkenCHYn+pQ
	 QG1CAjWd79yF/6G0Zerwe5EXmgKOnnzF1Y+ZtEGsGP483ZzKw5H9qYkO6zAVFvYfooZZm
	 wQk+IAxUZFe2FyevZ7BEhMVWDsEOx+K8oNvy5S21XoG6nveVnn98XHcZb7UtS3U0wtIxe
	 kra2u925xSNff/pImpunn7VK2Z2wBSKV3sx12IQUIJsL4YEUCWC6mu2EVCXlHUzK76g==
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=Z47TJXE0;
	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 08CB4606A326;
	Thu, 29 Oct 2026 20:39:52 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDF371F01816;
	Thu, 29 Oct 2026 20:39:51 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793306392;
	bh=Km0yqTQxYGForZ+cy0urvWCzslLgA0FkwENmG253UiU=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Z47TJXE0l6fe1vovOHQ3FpK1iOCvEzErSXBZCqfYcFmCe1OR4tizVqjNtq8YptI8F
	 E1FxARPrarpNaQs8d2re/6lqZYh7B9tob9kySkkPSimf5/t8u6+/O+Q6tm7+5dVymq
	 Z4jRfOfaB6GeRWvjszdBBgH8+2LRQZvumLdv4sfVFU++tNEy+dmdk6pyCWkznrI2xr
	 pI9kSd+7lc44NFOdscpI6wxLRg67IXR0ZzzfBxhHeeXzGJL6+005JluRIpA5FTCSaW
	 WwB7fba2nbeIL794lJiM16afnh9A5EhYshChrvMKsf107deOSjhJX9joXxfSP9N8f+
	 aKLCjZWW9IIdg==
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, rafal@milecki.pl, bcm-kernel-feedback-list@broadcom.com,
 jon.mason@broadcom.com, arnd@arndb.de, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261026203742.3198673-2-florian.fainelli@broadcom.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