lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240229105256.2903095-3-john.ernberg@actia.se>
Date: Thu, 29 Feb 2024 10:53:15 +0000
From: John Ernberg <john.ernberg@...ia.se>
To: Wei Fang <wei.fang@....com>
CC: Shenwei Wang <shenwei.wang@....com>, Clark Wang <xiaoning.wang@....com>,
	NXP Linux Team <linux-imx@....com>, "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, "Paolo
 Abeni" <pabeni@...hat.com>, Heiner Kallweit <hkallweit1@...il.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, John Ernberg
	<john.ernberg@...ia.se>
Subject: [PATCH net v2 2/2] net: fec: Suspend and resume the PHY

PHYs that are always-on will not enter their low power modes otherwise as
they have no regulator to be powered off with.

Since the PHY is picked up via {of_,}phy_connect() and dropped with
phy_disconnect() when the link is brought up and down respectively the only
cases were pm is needed is when the netif is running or or when the link
has never been up.

To deal with the latter case the PHY is suspended on discovery in probe,
since it won't be needed until link up.

Fixes: 557d5dc83f68 ("net: fec: use mac-managed PHY PM")
Signed-off-by: John Ernberg <john.ernberg@...ia.se>
---

v2: New patch
---
 drivers/net/ethernet/freescale/fec_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 8decb1b072c5..c5394a4d8491 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2539,8 +2539,10 @@ static int fec_enet_mii_init(struct platform_device *pdev)
 	/* find all the PHY devices on the bus and set mac_managed_pm to true */
 	for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
 		phydev = mdiobus_get_phy(fep->mii_bus, addr);
-		if (phydev)
+		if (phydev) {
 			phydev->mac_managed_pm = true;
+			phy_suspend(phydev);
+		}
 	}
 
 	mii_cnt++;
@@ -4631,6 +4633,7 @@ static int __maybe_unused fec_suspend(struct device *dev)
 		if (fep->wol_flag & FEC_WOL_FLAG_ENABLE)
 			fep->wol_flag |= FEC_WOL_FLAG_SLEEP_ON;
 		phy_stop(ndev->phydev);
+		phy_suspend(ndev->phydev);
 		napi_disable(&fep->napi);
 		netif_tx_lock_bh(ndev);
 		netif_device_detach(ndev);
@@ -4716,6 +4719,7 @@ static int __maybe_unused fec_resume(struct device *dev)
 		netif_tx_unlock_bh(ndev);
 		napi_enable(&fep->napi);
 		phy_init_hw(ndev->phydev);
+		phy_resume(ndev->phydev);
 		phy_start(ndev->phydev);
 	}
 	rtnl_unlock();
-- 
2.43.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ