From d4f3d2c04624854d27aa948cd7bfc9d946faaac5 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Thu, 29 Oct 2026 14:15:39 -0700 Subject: [PATCH] net: ethernet: bgmac: preserve forced 2.5 Gbps link speed Northstar and Northstar Plus use a 2.5 Gbps internal link between the AMAC and the switch. BGMAC_FEAT_FORCE_SPEED_2500 makes bgmac_miiconfig() configure that speed, but bgmac_adjust_link() subsequently replaces it with the synthetic fixed PHY's 1 Gbps speed. Use the forced speed when processing link changes so the MAC remains at 2.5 Gbps. Together with configuring the switch IMP port for its 2 Gbps mode, this eliminates the output queue discards that caused approximately 1000 TCP retransmissions per second during an iperf3 transmit test. Restrict the platform forced-speed flag to Northstar Plus using the SoC compatible, since Hurricane2 shares the AMAC compatible. Other platform AMACs without a phy-handle must continue following the fixed PHY speed. The BCMA path already selects the flag only for the Northstar family. Fixes: f6a95a24957a ("net: ethernet: bgmac: Add platform device support") Signed-off-by: Florian Fainelli Reviewed-by: Simon Horman Link: https://patch.msgid.link/20261029211540.4123250-2-florian.fainelli@broadcom.com Signed-off-by: Paolo Abeni --- drivers/net/ethernet/broadcom/bgmac-platform.c | 3 ++- drivers/net/ethernet/broadcom/bgmac.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bgmac-platform.c b/drivers/net/ethernet/broadcom/bgmac-platform.c index 4e266ce41180..4880b1890481 100644 --- a/drivers/net/ethernet/broadcom/bgmac-platform.c +++ b/drivers/net/ethernet/broadcom/bgmac-platform.c @@ -243,7 +243,8 @@ static int bgmac_probe(struct platform_device *pdev) bgmac->phy_connect = platform_phy_connect; } else { bgmac->phy_connect = bgmac_phy_connect_direct; - bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500; + if (of_machine_is_compatible("brcm,nsp")) + bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500; } return bgmac_enet_probe(bgmac); diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index 669eb7ce7d40..9ef7307edd41 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c @@ -1430,11 +1430,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; + 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; }