diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-02-24 16:38:44 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-24 16:38:44 -0800 |
commit | 4da129421f898147235a3e6b40234d789df208b7 (patch) | |
tree | 228a1ee837ddeff591cd4c420e3a2c850ae7075c /drivers | |
parent | ba599d4f0d2071abc049cb6345eab510a8a3643e (diff) | |
download | linux-3.10-4da129421f898147235a3e6b40234d789df208b7.tar.gz linux-3.10-4da129421f898147235a3e6b40234d789df208b7.tar.bz2 linux-3.10-4da129421f898147235a3e6b40234d789df208b7.zip |
netxen: advertise wake-on-lan support
Add ethtool wake on lan support.
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 49 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hdr.h | 3 |
2 files changed, 52 insertions, 0 deletions
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 0894a7be022..0012b3172f9 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c @@ -810,6 +810,53 @@ static int netxen_nic_set_tso(struct net_device *dev, u32 data) return 0; } +static void +netxen_nic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) +{ + struct netxen_adapter *adapter = netdev_priv(dev); + u32 wol_cfg = 0; + + wol->supported = 0; + wol->wolopts = 0; + + if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) + return; + + wol_cfg = netxen_nic_reg_read(adapter, NETXEN_WOL_CONFIG_NV); + if (wol_cfg & (1UL << adapter->portnum)) + wol->supported |= WAKE_MAGIC; + + wol_cfg = netxen_nic_reg_read(adapter, NETXEN_WOL_CONFIG); + if (wol_cfg & (1UL << adapter->portnum)) + wol->wolopts |= WAKE_MAGIC; +} + +static int +netxen_nic_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) +{ + struct netxen_adapter *adapter = netdev_priv(dev); + u32 wol_cfg = 0; + + if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) + return -EOPNOTSUPP; + + if (wol->wolopts & ~WAKE_MAGIC) + return -EOPNOTSUPP; + + wol_cfg = netxen_nic_reg_read(adapter, NETXEN_WOL_CONFIG_NV); + if (!(wol_cfg & (1 << adapter->portnum))) + return -EOPNOTSUPP; + + wol_cfg = netxen_nic_reg_read(adapter, NETXEN_WOL_CONFIG); + if (wol->wolopts & WAKE_MAGIC) + wol_cfg |= 1UL << adapter->portnum; + else + wol_cfg &= ~(1UL << adapter->portnum); + netxen_nic_reg_write(adapter, NETXEN_WOL_CONFIG, wol_cfg); + + return 0; +} + /* * Set the coalescing parameters. Currently only normal is supported. * If rx_coalesce_usecs == 0 or rx_max_coalesced_frames == 0 then set the @@ -916,6 +963,8 @@ struct ethtool_ops netxen_nic_ethtool_ops = { .set_sg = ethtool_op_set_sg, .get_tso = netxen_nic_get_tso, .set_tso = netxen_nic_set_tso, + .get_wol = netxen_nic_get_wol, + .set_wol = netxen_nic_set_wol, .self_test = netxen_nic_diag_test, .get_strings = netxen_nic_get_strings, .get_ethtool_stats = netxen_nic_get_ethtool_stats, diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index 269a1f70688..4695246072f 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h @@ -858,6 +858,9 @@ enum { #define NETXEN_PORT_MODE_ADDR (NETXEN_CAM_RAM(0x24)) #define NETXEN_WOL_PORT_MODE (NETXEN_CAM_RAM(0x198)) +#define NETXEN_WOL_CONFIG_NV (NETXEN_CAM_RAM(0x184)) +#define NETXEN_WOL_CONFIG (NETXEN_CAM_RAM(0x188)) + #define NX_PEG_TUNE_MN_PRESENT 0x1 #define NX_PEG_TUNE_CAPABILITY (NETXEN_CAM_RAM(0x02c)) |