Skip to content

Commit 61b5cc2

Browse files
danitooldavem330
authored andcommitted
net: mvneta: speed down the PHY, if WoL used, to save energy
Some PHYs connected to this ethernet hardware support the WoL feature. But when WoL is enabled and the machine is powered off, the PHY remains waiting for a magic packet at max speed (i.e. 1Gbps), which is a waste of energy. Slow down the PHY speed before stopping the ethernet if WoL is enabled, and save some energy while the machine is powered off or sleeping. Tested using an Armada 370 based board (LS421DE) equipped with a Marvell 88E1518 PHY. Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b0f46a9 commit 61b5cc2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/net/ethernet/marvell/mvneta.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3611,6 +3611,10 @@ static void mvneta_start_dev(struct mvneta_port *pp)
36113611
MVNETA_CAUSE_LINK_CHANGE);
36123612

36133613
phylink_start(pp->phylink);
3614+
3615+
/* We may have called phy_speed_down before */
3616+
phylink_speed_up(pp->phylink);
3617+
36143618
netif_tx_start_all_queues(pp->dev);
36153619

36163620
clear_bit(__MVNETA_DOWN, &pp->state);
@@ -3622,6 +3626,9 @@ static void mvneta_stop_dev(struct mvneta_port *pp)
36223626

36233627
set_bit(__MVNETA_DOWN, &pp->state);
36243628

3629+
if (device_may_wakeup(&pp->dev->dev))
3630+
phylink_speed_down(pp->phylink, false);
3631+
36253632
phylink_stop(pp->phylink);
36263633

36273634
if (!pp->neta_armada3700) {
@@ -4090,6 +4097,10 @@ static int mvneta_mdio_probe(struct mvneta_port *pp)
40904097
phylink_ethtool_get_wol(pp->phylink, &wol);
40914098
device_set_wakeup_capable(&pp->dev->dev, !!wol.supported);
40924099

4100+
/* PHY WoL may be enabled but device wakeup disabled */
4101+
if (wol.supported)
4102+
device_set_wakeup_enable(&pp->dev->dev, !!wol.wolopts);
4103+
40934104
return err;
40944105
}
40954106

0 commit comments

Comments
 (0)