aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 3a99781794d1..18ecba7f6ecb 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -909,12 +909,50 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
909static void ixgbe_get_wol(struct net_device *netdev, 909static void ixgbe_get_wol(struct net_device *netdev,
910 struct ethtool_wolinfo *wol) 910 struct ethtool_wolinfo *wol)
911{ 911{
912 wol->supported = 0; 912 struct ixgbe_adapter *adapter = netdev_priv(netdev);
913
914 wol->supported = WAKE_UCAST | WAKE_MCAST |
915 WAKE_BCAST | WAKE_MAGIC;
913 wol->wolopts = 0; 916 wol->wolopts = 0;
914 917
918 if (!device_can_wakeup(&adapter->pdev->dev))
919 return;
920
921 if (adapter->wol & IXGBE_WUFC_EX)
922 wol->wolopts |= WAKE_UCAST;
923 if (adapter->wol & IXGBE_WUFC_MC)
924 wol->wolopts |= WAKE_MCAST;
925 if (adapter->wol & IXGBE_WUFC_BC)
926 wol->wolopts |= WAKE_BCAST;
927 if (adapter->wol & IXGBE_WUFC_MAG)
928 wol->wolopts |= WAKE_MAGIC;
929
915 return; 930 return;
916} 931}
917 932
933static int ixgbe_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
934{
935 struct ixgbe_adapter *adapter = netdev_priv(netdev);
936
937 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
938 return -EOPNOTSUPP;
939
940 adapter->wol = 0;
941
942 if (wol->wolopts & WAKE_UCAST)
943 adapter->wol |= IXGBE_WUFC_EX;
944 if (wol->wolopts & WAKE_MCAST)
945 adapter->wol |= IXGBE_WUFC_MC;
946 if (wol->wolopts & WAKE_BCAST)
947 adapter->wol |= IXGBE_WUFC_BC;
948 if (wol->wolopts & WAKE_MAGIC)
949 adapter->wol |= IXGBE_WUFC_MAG;
950
951 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
952
953 return 0;
954}
955
918static int ixgbe_nway_reset(struct net_device *netdev) 956static int ixgbe_nway_reset(struct net_device *netdev)
919{ 957{
920 struct ixgbe_adapter *adapter = netdev_priv(netdev); 958 struct ixgbe_adapter *adapter = netdev_priv(netdev);
@@ -1031,6 +1069,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
1031 .get_regs_len = ixgbe_get_regs_len, 1069 .get_regs_len = ixgbe_get_regs_len,
1032 .get_regs = ixgbe_get_regs, 1070 .get_regs = ixgbe_get_regs,
1033 .get_wol = ixgbe_get_wol, 1071 .get_wol = ixgbe_get_wol,
1072 .set_wol = ixgbe_set_wol,
1034 .nway_reset = ixgbe_nway_reset, 1073 .nway_reset = ixgbe_nway_reset,
1035 .get_link = ethtool_op_get_link, 1074 .get_link = ethtool_op_get_link,
1036 .get_eeprom_len = ixgbe_get_eeprom_len, 1075 .get_eeprom_len = ixgbe_get_eeprom_len,