Skip to content

Commit 253fe09

Browse files
noglitchdavem330
authored andcommitted
net: macb: fix macb_get/set_wol() when moving to phylink
Keep previous function goals and integrate phylink actions to them. phylink_ethtool_get_wol() is not enough to figure out if Ethernet driver supports Wake-on-Lan. Initialization of "supported" and "wolopts" members is done in phylink function, no need to keep them in calling function. phylink_ethtool_set_wol() return value is considered and determines if the MAC has to handle WoL or not. The case where the PHY doesn't implement WoL leads to the MAC configuring it to provide this feature. Fixes: 7897b07 ("net: macb: convert to phylink") Cc: Claudiu Beznea <[email protected]> Cc: Harini Katakam <[email protected]> Cc: Antoine Tenart <[email protected]> Cc: Florian Fainelli <[email protected]> Signed-off-by: Nicolas Ferre <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ced4799 commit 253fe09

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2821,21 +2821,27 @@ static void macb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
28212821
{
28222822
struct macb *bp = netdev_priv(netdev);
28232823

2824-
wol->supported = 0;
2825-
wol->wolopts = 0;
2826-
2827-
if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET)
2824+
if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) {
28282825
phylink_ethtool_get_wol(bp->phylink, wol);
2826+
wol->supported |= WAKE_MAGIC;
2827+
2828+
if (bp->wol & MACB_WOL_ENABLED)
2829+
wol->wolopts |= WAKE_MAGIC;
2830+
}
28292831
}
28302832

28312833
static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
28322834
{
28332835
struct macb *bp = netdev_priv(netdev);
28342836
int ret;
28352837

2838+
/* Pass the order to phylink layer */
28362839
ret = phylink_ethtool_set_wol(bp->phylink, wol);
2837-
if (!ret)
2838-
return 0;
2840+
/* Don't manage WoL on MAC if handled by the PHY
2841+
* or if there's a failure in talking to the PHY
2842+
*/
2843+
if (!ret || ret != -EOPNOTSUPP)
2844+
return ret;
28392845

28402846
if (!(bp->wol & MACB_WOL_HAS_MAGIC_PACKET) ||
28412847
(wol->wolopts & ~WAKE_MAGIC))

0 commit comments

Comments
 (0)