diff options
author | Nikita Danilov <ndanilov@marvell.com> | 2019-11-07 22:41:50 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-07 19:54:42 -0800 |
commit | 837c637869bef28b06653462cd010ccc0c2ce984 (patch) | |
tree | 5e7909b2524c87d9584c9f624dd9209fbb8d7722 /drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c | |
parent | d993e14bd872e1e30e2028cbaa0302acf2661579 (diff) |
net: atlantic: implement wake_phy feature
Wake on PHY allows to configure device to wakeup host
as soon as PHY link status is changed to active.
Signed-off-by: Nikita Danilov <ndanilov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c index 1ae8aabcc41a..3c55cf13cf14 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c @@ -356,11 +356,8 @@ static void aq_ethtool_get_wol(struct net_device *ndev, struct aq_nic_s *aq_nic = netdev_priv(ndev); struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic); - wol->supported = WAKE_MAGIC; - wol->wolopts = 0; - - if (cfg->wol) - wol->wolopts |= WAKE_MAGIC; + wol->supported = AQ_NIC_WOL_MODES; + wol->wolopts = cfg->wol; } static int aq_ethtool_set_wol(struct net_device *ndev, @@ -371,11 +368,12 @@ static int aq_ethtool_set_wol(struct net_device *ndev, struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic); int err = 0; - if (wol->wolopts & WAKE_MAGIC) - cfg->wol |= AQ_NIC_WOL_ENABLED; - else - cfg->wol &= ~AQ_NIC_WOL_ENABLED; - err = device_set_wakeup_enable(&pdev->dev, wol->wolopts); + if (wol->wolopts & ~AQ_NIC_WOL_MODES) + return -EOPNOTSUPP; + + cfg->wol = wol->wolopts; + + err = device_set_wakeup_enable(&pdev->dev, !!cfg->wol); return err; } |