Skip to content

Commit 5e73e07

Browse files
pelwellpopcornmix
authored andcommitted
net: phy: lan87xx: Decrease phy polling rate
Polling at 100Hz for 1.5s consumes quite a bit of kworker time with no obvious benefit. Reduce that polling rate to ~6Hz. To further save CPU and power, defer the next poll if no energy is detected. See: #4780 Signed-off-by: Phil Elwell <[email protected]>
1 parent 342f54d commit 5e73e07

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/net/phy/smsc.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ static int lan87xx_read_status(struct phy_device *phydev)
218218
int err = genphy_read_status(phydev);
219219

220220
if (!phydev->link && priv->energy_enable) {
221+
int energy_detected;
222+
221223
/* Disable EDPD to wake up PHY */
222224
int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
223225
if (rc < 0)
@@ -233,7 +235,7 @@ static int lan87xx_read_status(struct phy_device *phydev)
233235
*/
234236
read_poll_timeout(phy_read, rc,
235237
rc & MII_LAN83C185_ENERGYON || rc < 0,
236-
10000, 1500000, true, phydev,
238+
150000, 1500000, true, phydev,
237239
MII_LAN83C185_CTRL_STATUS);
238240
if (rc < 0)
239241
return rc;
@@ -243,10 +245,16 @@ static int lan87xx_read_status(struct phy_device *phydev)
243245
if (rc < 0)
244246
return rc;
245247

248+
energy_detected = !!(rc & MII_LAN83C185_ENERGYON);
249+
246250
rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS,
247251
rc | MII_LAN83C185_EDPWRDOWN);
248252
if (rc < 0)
249253
return rc;
254+
255+
/* Save CPU and power by deferring the next poll */
256+
if (!energy_detected)
257+
msleep(2000);
250258
}
251259

252260
return err;

0 commit comments

Comments
 (0)