Commit 253fe094 authored by Nicolas Ferre's avatar Nicolas Ferre Committed by David S. Miller

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: 7897b071 ("net: macb: convert to phylink")
Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
Cc: Harini Katakam <harini.katakam@xilinx.com>
Cc: Antoine Tenart <antoine.tenart@bootlin.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ced4799d
...@@ -2821,11 +2821,13 @@ static void macb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) ...@@ -2821,11 +2821,13 @@ static void macb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
{ {
struct macb *bp = netdev_priv(netdev); struct macb *bp = netdev_priv(netdev);
wol->supported = 0; if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) {
wol->wolopts = 0;
if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET)
phylink_ethtool_get_wol(bp->phylink, wol); phylink_ethtool_get_wol(bp->phylink, wol);
wol->supported |= WAKE_MAGIC;
if (bp->wol & MACB_WOL_ENABLED)
wol->wolopts |= WAKE_MAGIC;
}
} }
static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
...@@ -2833,9 +2835,13 @@ static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) ...@@ -2833,9 +2835,13 @@ static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
struct macb *bp = netdev_priv(netdev); struct macb *bp = netdev_priv(netdev);
int ret; int ret;
/* Pass the order to phylink layer */
ret = phylink_ethtool_set_wol(bp->phylink, wol); ret = phylink_ethtool_set_wol(bp->phylink, wol);
if (!ret) /* Don't manage WoL on MAC if handled by the PHY
return 0; * or if there's a failure in talking to the PHY
*/
if (!ret || ret != -EOPNOTSUPP)
return ret;
if (!(bp->wol & MACB_WOL_HAS_MAGIC_PACKET) || if (!(bp->wol & MACB_WOL_HAS_MAGIC_PACKET) ||
(wol->wolopts & ~WAKE_MAGIC)) (wol->wolopts & ~WAKE_MAGIC))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment