netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: bcm: asp2: fix fallout from phylib EEE changes
@ 2025-01-14 16:50 Russell King (Oracle)
  2025-01-14 16:50 ` [PATCH net-next 1/3] net: bcm: asp2: fix LPI timer handling Russell King (Oracle)
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Russell King (Oracle) @ 2025-01-14 16:50 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Andrew Lunn, bcm-kernel-feedback-list, David S. Miller,
	Eric Dumazet, Florian Fainelli, Jakub Kicinski, Justin Chen,
	netdev, Paolo Abeni

Hi,

This series addresses the fallout from the phylib changes in the
Broadcom ASP2 driver.

The first patch uses phylib's copy of the LPI timer setting, which
means the driver no longer has to track this. It will be set in
hardware each time the adjust_link function is called when the link
is up, and will be read at initialisation time to set the current
value.

The second patch removes the driver's storage of tx_lpi_enabled,
which has become redundant since phylib managed EEE was merged. The
driver does nothing with this flag other than storing it.

The last patch converts the driver to use phylib's enable_tx_lpi
flag rather than trying to maintain its own copy.

 drivers/net/ethernet/broadcom/asp2/bcmasp.h        |  3 --
 .../net/ethernet/broadcom/asp2/bcmasp_ethtool.c    | 39 ----------------------
 drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c   | 22 +++++++-----
 3 files changed, 14 insertions(+), 50 deletions(-)
-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net-next 1/3] net: bcm: asp2: fix LPI timer handling
  2025-01-14 16:50 [PATCH net-next 0/3] net: bcm: asp2: fix fallout from phylib EEE changes Russell King (Oracle)
@ 2025-01-14 16:50 ` Russell King (Oracle)
  2025-01-14 19:57   ` Florian Fainelli
  2025-01-14 16:50 ` [PATCH net-next 2/3] net: bcm: asp2: remove tx_lpi_enabled Russell King (Oracle)
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Russell King (Oracle) @ 2025-01-14 16:50 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Andrew Lunn, bcm-kernel-feedback-list, David S. Miller,
	Eric Dumazet, Florian Fainelli, Jakub Kicinski, Justin Chen,
	netdev, Paolo Abeni

Fix the LPI timer handling in Broadcom ASP2 driver after the phylib
managed EEE patches were merged.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c | 2 --
 drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c    | 5 +++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
index 9da5ae29a105..139058a0dbbb 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
@@ -371,7 +371,6 @@ static int bcmasp_get_eee(struct net_device *dev, struct ethtool_keee *e)
 		return -ENODEV;
 
 	e->tx_lpi_enabled = p->tx_lpi_enabled;
-	e->tx_lpi_timer = umac_rl(intf, UMC_EEE_LPI_TIMER);
 
 	return phy_ethtool_get_eee(dev->phydev, e);
 }
@@ -395,7 +394,6 @@ static int bcmasp_set_eee(struct net_device *dev, struct ethtool_keee *e)
 			return ret;
 		}
 
-		umac_wl(intf, e->tx_lpi_timer, UMC_EEE_LPI_TIMER);
 		intf->eee.tx_lpi_enabled = e->tx_lpi_enabled;
 		bcmasp_eee_enable_set(intf, true);
 	}
diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
index cfd50efbdbc0..62861a454a27 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
@@ -677,6 +677,8 @@ static void bcmasp_adj_link(struct net_device *dev)
 		}
 		umac_wl(intf, reg, UMC_CMD);
 
+		umac_wl(intf, phydev->eee_cfg.tx_lpi_timer, UMC_EEE_LPI_TIMER);
+
 		active = phy_init_eee(phydev, 0) >= 0;
 		bcmasp_eee_enable_set(intf, active);
 	}
@@ -1055,6 +1057,9 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)
 
 		/* Indicate that the MAC is responsible for PHY PM */
 		phydev->mac_managed_pm = true;
+
+		/* Set phylib's copy of the LPI timer */
+		phydev->eee_cfg.tx_lpi_timer = umac_rl(intf, UMC_EEE_LPI_TIMER);
 	}
 
 	umac_reset(intf);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net-next 2/3] net: bcm: asp2: remove tx_lpi_enabled
  2025-01-14 16:50 [PATCH net-next 0/3] net: bcm: asp2: fix fallout from phylib EEE changes Russell King (Oracle)
  2025-01-14 16:50 ` [PATCH net-next 1/3] net: bcm: asp2: fix LPI timer handling Russell King (Oracle)
@ 2025-01-14 16:50 ` Russell King (Oracle)
  2025-01-14 19:57   ` Florian Fainelli
  2025-01-14 16:50 ` [PATCH net-next 3/3] net: bcm: asp2: convert to phylib managed EEE Russell King (Oracle)
  2025-01-15 21:30 ` [PATCH net-next 0/3] net: bcm: asp2: fix fallout from phylib EEE changes patchwork-bot+netdevbpf
  3 siblings, 1 reply; 8+ messages in thread
From: Russell King (Oracle) @ 2025-01-14 16:50 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Andrew Lunn, bcm-kernel-feedback-list, David S. Miller,
	Eric Dumazet, Florian Fainelli, Jakub Kicinski, Justin Chen,
	netdev, Paolo Abeni

Phylib maintains a copy of tx_lpi_enabled, which will be used to
populate the member when phy_ethtool_get_eee(). Therefore, writing to
this member before phy_ethtool_get_eee() will have no effect. Remove
it. Also remove setting our copy of info->eee.tx_lpi_enabled which
becomes write-only.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
index 139058a0dbbb..5e04cd1839c0 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
@@ -364,14 +364,9 @@ void bcmasp_eee_enable_set(struct bcmasp_intf *intf, bool enable)
 
 static int bcmasp_get_eee(struct net_device *dev, struct ethtool_keee *e)
 {
-	struct bcmasp_intf *intf = netdev_priv(dev);
-	struct ethtool_keee *p = &intf->eee;
-
 	if (!dev->phydev)
 		return -ENODEV;
 
-	e->tx_lpi_enabled = p->tx_lpi_enabled;
-
 	return phy_ethtool_get_eee(dev->phydev, e);
 }
 
@@ -394,7 +389,6 @@ static int bcmasp_set_eee(struct net_device *dev, struct ethtool_keee *e)
 			return ret;
 		}
 
-		intf->eee.tx_lpi_enabled = e->tx_lpi_enabled;
 		bcmasp_eee_enable_set(intf, true);
 	}
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net-next 3/3] net: bcm: asp2: convert to phylib managed EEE
  2025-01-14 16:50 [PATCH net-next 0/3] net: bcm: asp2: fix fallout from phylib EEE changes Russell King (Oracle)
  2025-01-14 16:50 ` [PATCH net-next 1/3] net: bcm: asp2: fix LPI timer handling Russell King (Oracle)
  2025-01-14 16:50 ` [PATCH net-next 2/3] net: bcm: asp2: remove tx_lpi_enabled Russell King (Oracle)
@ 2025-01-14 16:50 ` Russell King (Oracle)
  2025-01-14 19:57   ` Florian Fainelli
  2025-01-15 21:30 ` [PATCH net-next 0/3] net: bcm: asp2: fix fallout from phylib EEE changes patchwork-bot+netdevbpf
  3 siblings, 1 reply; 8+ messages in thread
From: Russell King (Oracle) @ 2025-01-14 16:50 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Andrew Lunn, bcm-kernel-feedback-list, David S. Miller,
	Eric Dumazet, Florian Fainelli, Jakub Kicinski, Justin Chen,
	netdev, Paolo Abeni

Convert the Broadcom ASP2 driver to use phylib managed EEE support.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/broadcom/asp2/bcmasp.h   |  3 --
 .../ethernet/broadcom/asp2/bcmasp_ethtool.c   | 31 -------------------
 .../net/ethernet/broadcom/asp2/bcmasp_intf.c  | 19 ++++++------
 3 files changed, 10 insertions(+), 43 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.h b/drivers/net/ethernet/broadcom/asp2/bcmasp.h
index f93cb3da44b0..8fc75bcedb70 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.h
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.h
@@ -348,8 +348,6 @@ struct bcmasp_intf {
 	/* Used if per intf wol irq */
 	int				wol_irq;
 	unsigned int			wol_irq_enabled:1;
-
-	struct ethtool_keee		eee;
 };
 
 #define NUM_NET_FILTERS				32
@@ -601,5 +599,4 @@ int bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs,
 
 void bcmasp_netfilt_suspend(struct bcmasp_intf *intf);
 
-void bcmasp_eee_enable_set(struct bcmasp_intf *intf, bool enable);
 #endif
diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
index 5e04cd1839c0..a537c121d3e2 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
@@ -348,20 +348,6 @@ static int bcmasp_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
 	return err;
 }
 
-void bcmasp_eee_enable_set(struct bcmasp_intf *intf, bool enable)
-{
-	u32 reg;
-
-	reg = umac_rl(intf, UMC_EEE_CTRL);
-	if (enable)
-		reg |= EEE_EN;
-	else
-		reg &= ~EEE_EN;
-	umac_wl(intf, reg, UMC_EEE_CTRL);
-
-	intf->eee.eee_enabled = enable;
-}
-
 static int bcmasp_get_eee(struct net_device *dev, struct ethtool_keee *e)
 {
 	if (!dev->phydev)
@@ -372,26 +358,9 @@ static int bcmasp_get_eee(struct net_device *dev, struct ethtool_keee *e)
 
 static int bcmasp_set_eee(struct net_device *dev, struct ethtool_keee *e)
 {
-	struct bcmasp_intf *intf = netdev_priv(dev);
-	struct ethtool_keee *p = &intf->eee;
-	int ret;
-
 	if (!dev->phydev)
 		return -ENODEV;
 
-	if (!p->eee_enabled) {
-		bcmasp_eee_enable_set(intf, false);
-	} else {
-		ret = phy_init_eee(dev->phydev, 0);
-		if (ret) {
-			netif_err(intf, hw, dev,
-				  "EEE initialization failed: %d\n", ret);
-			return ret;
-		}
-
-		bcmasp_eee_enable_set(intf, true);
-	}
-
 	return phy_ethtool_set_eee(dev->phydev, e);
 }
 
diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
index 62861a454a27..45ec1a9214a2 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
@@ -619,7 +619,6 @@ static void bcmasp_adj_link(struct net_device *dev)
 	struct phy_device *phydev = dev->phydev;
 	u32 cmd_bits = 0, reg;
 	int changed = 0;
-	bool active;
 
 	if (intf->old_link != phydev->link) {
 		changed = 1;
@@ -678,9 +677,12 @@ static void bcmasp_adj_link(struct net_device *dev)
 		umac_wl(intf, reg, UMC_CMD);
 
 		umac_wl(intf, phydev->eee_cfg.tx_lpi_timer, UMC_EEE_LPI_TIMER);
-
-		active = phy_init_eee(phydev, 0) >= 0;
-		bcmasp_eee_enable_set(intf, active);
+		reg = umac_rl(intf, UMC_EEE_CTRL);
+		if (phydev->enable_tx_lpi)
+			reg |= EEE_EN;
+		else
+			reg &= ~EEE_EN;
+		umac_wl(intf, reg, UMC_EEE_CTRL);
 	}
 
 	reg = rgmii_rl(intf, RGMII_OOB_CNTRL);
@@ -1336,7 +1338,8 @@ static void bcmasp_suspend_to_wol(struct bcmasp_intf *intf)
 				     ASP_WAKEUP_INTR2_MASK_CLEAR);
 	}
 
-	if (intf->eee.eee_enabled && intf->parent->eee_fixup)
+	if (ndev->phydev && ndev->phydev->eee_cfg.eee_enabled &&
+	    intf->parent->eee_fixup)
 		intf->parent->eee_fixup(intf, true);
 
 	netif_dbg(intf, wol, ndev, "entered WOL mode\n");
@@ -1378,7 +1381,8 @@ static void bcmasp_resume_from_wol(struct bcmasp_intf *intf)
 {
 	u32 reg;
 
-	if (intf->eee.eee_enabled && intf->parent->eee_fixup)
+	if (intf->ndev->phydev && intf->ndev->phydev->eee_cfg.eee_enabled &&
+	    intf->parent->eee_fixup)
 		intf->parent->eee_fixup(intf, false);
 
 	reg = umac_rl(intf, UMC_MPD_CTRL);
@@ -1409,9 +1413,6 @@ int bcmasp_interface_resume(struct bcmasp_intf *intf)
 
 	bcmasp_resume_from_wol(intf);
 
-	if (intf->eee.eee_enabled)
-		bcmasp_eee_enable_set(intf, true);
-
 	netif_device_attach(dev);
 
 	return 0;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next 3/3] net: bcm: asp2: convert to phylib managed EEE
  2025-01-14 16:50 ` [PATCH net-next 3/3] net: bcm: asp2: convert to phylib managed EEE Russell King (Oracle)
@ 2025-01-14 19:57   ` Florian Fainelli
  0 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2025-01-14 19:57 UTC (permalink / raw)
  To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
  Cc: Andrew Lunn, bcm-kernel-feedback-list, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Justin Chen, netdev, Paolo Abeni

On 1/14/25 08:50, Russell King (Oracle) wrote:
> Convert the Broadcom ASP2 driver to use phylib managed EEE support.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next 2/3] net: bcm: asp2: remove tx_lpi_enabled
  2025-01-14 16:50 ` [PATCH net-next 2/3] net: bcm: asp2: remove tx_lpi_enabled Russell King (Oracle)
@ 2025-01-14 19:57   ` Florian Fainelli
  0 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2025-01-14 19:57 UTC (permalink / raw)
  To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
  Cc: Andrew Lunn, bcm-kernel-feedback-list, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Justin Chen, netdev, Paolo Abeni

On 1/14/25 08:50, Russell King (Oracle) wrote:
> Phylib maintains a copy of tx_lpi_enabled, which will be used to
> populate the member when phy_ethtool_get_eee(). Therefore, writing to
> this member before phy_ethtool_get_eee() will have no effect. Remove
> it. Also remove setting our copy of info->eee.tx_lpi_enabled which
> becomes write-only.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next 1/3] net: bcm: asp2: fix LPI timer handling
  2025-01-14 16:50 ` [PATCH net-next 1/3] net: bcm: asp2: fix LPI timer handling Russell King (Oracle)
@ 2025-01-14 19:57   ` Florian Fainelli
  0 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2025-01-14 19:57 UTC (permalink / raw)
  To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
  Cc: Andrew Lunn, bcm-kernel-feedback-list, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Justin Chen, netdev, Paolo Abeni

On 1/14/25 08:50, Russell King (Oracle) wrote:
> Fix the LPI timer handling in Broadcom ASP2 driver after the phylib
> managed EEE patches were merged.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next 0/3] net: bcm: asp2: fix fallout from phylib EEE changes
  2025-01-14 16:50 [PATCH net-next 0/3] net: bcm: asp2: fix fallout from phylib EEE changes Russell King (Oracle)
                   ` (2 preceding siblings ...)
  2025-01-14 16:50 ` [PATCH net-next 3/3] net: bcm: asp2: convert to phylib managed EEE Russell King (Oracle)
@ 2025-01-15 21:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-01-15 21:30 UTC (permalink / raw)
  To: Russell King
  Cc: andrew, hkallweit1, andrew+netdev, bcm-kernel-feedback-list,
	davem, edumazet, florian.fainelli, kuba, justin.chen, netdev,
	pabeni

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 14 Jan 2025 16:50:37 +0000 you wrote:
> Hi,
> 
> This series addresses the fallout from the phylib changes in the
> Broadcom ASP2 driver.
> 
> The first patch uses phylib's copy of the LPI timer setting, which
> means the driver no longer has to track this. It will be set in
> hardware each time the adjust_link function is called when the link
> is up, and will be read at initialisation time to set the current
> value.
> 
> [...]

Here is the summary with links:
  - [net-next,1/3] net: bcm: asp2: fix LPI timer handling
    https://git.kernel.org/netdev/net-next/c/54033f551219
  - [net-next,2/3] net: bcm: asp2: remove tx_lpi_enabled
    https://git.kernel.org/netdev/net-next/c/df8017e8a19d
  - [net-next,3/3] net: bcm: asp2: convert to phylib managed EEE
    https://git.kernel.org/netdev/net-next/c/21f56ad1b211

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-01-15 21:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14 16:50 [PATCH net-next 0/3] net: bcm: asp2: fix fallout from phylib EEE changes Russell King (Oracle)
2025-01-14 16:50 ` [PATCH net-next 1/3] net: bcm: asp2: fix LPI timer handling Russell King (Oracle)
2025-01-14 19:57   ` Florian Fainelli
2025-01-14 16:50 ` [PATCH net-next 2/3] net: bcm: asp2: remove tx_lpi_enabled Russell King (Oracle)
2025-01-14 19:57   ` Florian Fainelli
2025-01-14 16:50 ` [PATCH net-next 3/3] net: bcm: asp2: convert to phylib managed EEE Russell King (Oracle)
2025-01-14 19:57   ` Florian Fainelli
2025-01-15 21:30 ` [PATCH net-next 0/3] net: bcm: asp2: fix fallout from phylib EEE changes patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).