Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,19 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
if (!drv || !phydrv->suspend)
return false;

/* 1.Ethernet and phy device wol state may not same, netdev->wol_enabled
* disabled,and phydev set wol_enabled enabled, so netdev->wol_enabled
* is not enough, so check phydev->wol_enabled.
* 2.Phy may not attached to netdev, but enabled wol.
*/
struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };

phy_ethtool_get_wol(phydev, &wol);
if (wol.wolopts) {
phydev_warn(phydev, "Phy and mac wol are not compatible.\n");
return false;
}

/* PHY not attached? May suspend if the PHY has not already been
* suspended as part of a prior call to phy_disconnect() ->
* phy_detach() -> phy_suspend() because the parent netdev might be the
Expand All @@ -288,18 +301,6 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
if (netdev->wol_enabled)
return false;

/* Ethernet and phy device wol state may not same, netdev->wol_enabled
* disabled,and phydev set wol_enabled enabled, so netdev->wol_enabled
* is not enough, so check phydev->wol_enabled.
*/
struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };

phy_ethtool_get_wol(phydev, &wol);
if (wol.wolopts) {
phydev_warn(phydev, "Phy and mac wol are not compatible\n");
return false;
}

/* As long as not all affected network drivers support the
* wol_enabled flag, let's check for hints that WoL is enabled.
* Don't suspend PHY if the attached netdev parent may wake up.
Expand Down