Skip to content

Commit 9ee09ed

Browse files
ffainellikuba-moo
authored andcommitted
net: bcmgenet: Properly overlay PHY and MAC Wake-on-LAN capabilities
Some Wake-on-LAN modes such as WAKE_FILTER may only be supported by the MAC, while others might be only supported by the PHY. Make sure that the .get_wol() returns the union of both rather than only that of the PHY if the PHY supports Wake-on-LAN. Fixes: 7e400ff ("net: bcmgenet: Add support for PHY-based Wake-on-LAN") Signed-off-by: Florian Fainelli <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 86a41ea commit 9ee09ed

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,15 @@ 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) {
45+
if (dev->phydev)
4646
phy_ethtool_get_wol(dev->phydev, wol);
47-
if (wol->supported)
48-
return;
49-
}
5047

51-
if (!device_can_wakeup(kdev)) {
52-
wol->supported = 0;
53-
wol->wolopts = 0;
48+
/* MAC is not wake-up capable, return what the PHY does */
49+
if (!device_can_wakeup(kdev))
5450
return;
55-
}
5651

57-
wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER;
52+
/* Overlay MAC capabilities with that of the PHY queried before */
53+
wol->supported |= WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER;
5854
wol->wolopts = priv->wolopts;
5955
memset(wol->sopass, 0, sizeof(wol->sopass));
6056

0 commit comments

Comments
 (0)