Skip to content

Commit 7e400ff

Browse files
ffainellidavem330
authored andcommitted
net: bcmgenet: Add support for PHY-based Wake-on-LAN
If available, interrogate the PHY to find out whether we can use it for Wake-on-LAN. This can be a more power efficient way of implementing that feature, especially when the MAC is powered off in low power states. Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8baddaa commit 7e400ff

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
4242
struct bcmgenet_priv *priv = netdev_priv(dev);
4343
struct device *kdev = &priv->pdev->dev;
4444

45+
if (dev->phydev) {
46+
phy_ethtool_get_wol(dev->phydev, wol);
47+
if (wol->supported)
48+
return;
49+
}
50+
4551
if (!device_can_wakeup(kdev)) {
4652
wol->supported = 0;
4753
wol->wolopts = 0;
@@ -63,6 +69,14 @@ int bcmgenet_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
6369
{
6470
struct bcmgenet_priv *priv = netdev_priv(dev);
6571
struct device *kdev = &priv->pdev->dev;
72+
int ret;
73+
74+
/* Try Wake-on-LAN from the PHY first */
75+
if (dev->phydev) {
76+
ret = phy_ethtool_set_wol(dev->phydev, wol);
77+
if (ret != -EOPNOTSUPP)
78+
return ret;
79+
}
6680

6781
if (!device_can_wakeup(kdev))
6882
return -ENOTSUPP;

0 commit comments

Comments
 (0)