linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] enetc: ethtool: add wake-on-lan callbacks
@ 2019-11-07  8:40 Michael Walle
  2019-11-07 15:26 ` Andrew Lunn
  2019-11-07 23:25 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Walle @ 2019-11-07  8:40 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: Claudiu Manoil, David S . Miller, Michael Walle

If there is an external PHY, pass the wake-on-lan request to the PHY.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 .../ethernet/freescale/enetc/enetc_ethtool.c  | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
index fcb52efec075..880a8ed8bb47 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
@@ -584,6 +584,31 @@ static int enetc_get_ts_info(struct net_device *ndev,
 	return 0;
 }
 
+static void enetc_get_wol(struct net_device *dev,
+			  struct ethtool_wolinfo *wol)
+{
+	wol->supported = 0;
+	wol->wolopts = 0;
+
+	if (dev->phydev)
+		phy_ethtool_get_wol(dev->phydev, wol);
+}
+
+static int enetc_set_wol(struct net_device *dev,
+			 struct ethtool_wolinfo *wol)
+{
+	int ret;
+
+	if (!dev->phydev)
+		return -EOPNOTSUPP;
+
+	ret = phy_ethtool_set_wol(dev->phydev, wol);
+	if (!ret)
+		device_set_wakeup_enable(&dev->dev, wol->wolopts);
+
+	return ret;
+}
+
 static const struct ethtool_ops enetc_pf_ethtool_ops = {
 	.get_regs_len = enetc_get_reglen,
 	.get_regs = enetc_get_regs,
@@ -601,6 +626,8 @@ static const struct ethtool_ops enetc_pf_ethtool_ops = {
 	.set_link_ksettings = phy_ethtool_set_link_ksettings,
 	.get_link = ethtool_op_get_link,
 	.get_ts_info = enetc_get_ts_info,
+	.get_wol = enetc_get_wol,
+	.set_wol = enetc_set_wol,
 };
 
 static const struct ethtool_ops enetc_vf_ethtool_ops = {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] enetc: ethtool: add wake-on-lan callbacks
  2019-11-07  8:40 [PATCH] enetc: ethtool: add wake-on-lan callbacks Michael Walle
@ 2019-11-07 15:26 ` Andrew Lunn
  2019-11-07 23:25 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2019-11-07 15:26 UTC (permalink / raw)
  To: Michael Walle; +Cc: linux-kernel, netdev, Claudiu Manoil, David S . Miller

On Thu, Nov 07, 2019 at 09:40:00AM +0100, Michael Walle wrote:
> If there is an external PHY, pass the wake-on-lan request to the PHY.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] enetc: ethtool: add wake-on-lan callbacks
  2019-11-07  8:40 [PATCH] enetc: ethtool: add wake-on-lan callbacks Michael Walle
  2019-11-07 15:26 ` Andrew Lunn
@ 2019-11-07 23:25 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-11-07 23:25 UTC (permalink / raw)
  To: michael; +Cc: linux-kernel, netdev, claudiu.manoil

From: Michael Walle <michael@walle.cc>
Date: Thu,  7 Nov 2019 09:40:00 +0100

> If there is an external PHY, pass the wake-on-lan request to the PHY.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-07 23:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07  8:40 [PATCH] enetc: ethtool: add wake-on-lan callbacks Michael Walle
2019-11-07 15:26 ` Andrew Lunn
2019-11-07 23:25 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).