Skip to content

Commit

Permalink
e1000e: add new wakeup cababilities
Browse files Browse the repository at this point in the history
Ethtool supports wake-on-ARP and wake-on-link, and so does the hardware
supported by e1000e.  This patch just introduces the two.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Mitch Williams authored and David S. Miller committed Feb 3, 2008
1 parent 4a51c0d commit efb90e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/net/e1000e/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
#define E1000_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */
#define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */
#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */
#define E1000_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */

/* Extended Device Control */
#define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Defineable Pin 7 */
Expand Down
13 changes: 11 additions & 2 deletions drivers/net/e1000e/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,8 @@ static void e1000_get_wol(struct net_device *netdev,
return;

wol->supported = WAKE_UCAST | WAKE_MCAST |
WAKE_BCAST | WAKE_MAGIC;
WAKE_BCAST | WAKE_MAGIC |
WAKE_PHY | WAKE_ARP;

/* apply any specific unsupported masks here */
if (adapter->flags & FLAG_NO_WAKE_UCAST) {
Expand All @@ -1651,14 +1652,18 @@ static void e1000_get_wol(struct net_device *netdev,
wol->wolopts |= WAKE_BCAST;
if (adapter->wol & E1000_WUFC_MAG)
wol->wolopts |= WAKE_MAGIC;
if (adapter->wol & E1000_WUFC_LNKC)
wol->wolopts |= WAKE_PHY;
if (adapter->wol & E1000_WUFC_ARP)
wol->wolopts |= WAKE_ARP;
}

static int e1000_set_wol(struct net_device *netdev,
struct ethtool_wolinfo *wol)
{
struct e1000_adapter *adapter = netdev_priv(netdev);

if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
if (wol->wolopts & WAKE_MAGICSECURE)
return -EOPNOTSUPP;

if (!(adapter->flags & FLAG_HAS_WOL))
Expand All @@ -1675,6 +1680,10 @@ static int e1000_set_wol(struct net_device *netdev,
adapter->wol |= E1000_WUFC_BC;
if (wol->wolopts & WAKE_MAGIC)
adapter->wol |= E1000_WUFC_MAG;
if (wol->wolopts & WAKE_PHY)
adapter->wol |= E1000_WUFC_LNKC;
if (wol->wolopts & WAKE_ARP)
adapter->wol |= E1000_WUFC_ARP;

return 0;
}
Expand Down

0 comments on commit efb90e4

Please sign in to comment.