diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-02-24 19:38:44 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-24 19:38:44 -0500 |
commit | 4da129421f898147235a3e6b40234d789df208b7 (patch) | |
tree | 228a1ee837ddeff591cd4c420e3a2c850ae7075c /drivers/net/netxen/netxen_nic_ethtool.c | |
parent | ba599d4f0d2071abc049cb6345eab510a8a3643e (diff) |
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/net/netxen/netxen_nic_ethtool.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 0894a7be0225..0012b3172f90 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) | |||
810 | return 0; | 810 | return 0; |
811 | } | 811 | } |
812 | 812 | ||
813 | static void | ||
814 | netxen_nic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
815 | { | ||
816 | struct netxen_adapter *adapter = netdev_priv(dev); | ||
817 | u32 wol_cfg = 0; | ||
818 | |||
819 | wol->supported = 0; | ||
820 | wol->wolopts = 0; | ||
821 | |||
822 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) | ||
823 | return; | ||
824 | |||
825 | wol_cfg = netxen_nic_reg_read(adapter, NETXEN_WOL_CONFIG_NV); | ||
826 | if (wol_cfg & (1UL << adapter->portnum)) | ||
827 | wol->supported |= WAKE_MAGIC; | ||
828 | |||
829 | wol_cfg = netxen_nic_reg_read(adapter, NETXEN_WOL_CONFIG); | ||
830 | if (wol_cfg & (1UL << adapter->portnum)) | ||
831 | wol->wolopts |= WAKE_MAGIC; | ||
832 | } | ||
833 | |||
834 | static int | ||
835 | netxen_nic_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
836 | { | ||
837 | struct netxen_adapter *adapter = netdev_priv(dev); | ||
838 | u32 wol_cfg = 0; | ||
839 | |||
840 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) | ||
841 | return -EOPNOTSUPP; | ||
842 | |||
843 | if (wol->wolopts & ~WAKE_MAGIC) | ||
844 | return -EOPNOTSUPP; | ||
845 | |||
846 | wol_cfg = netxen_nic_reg_read(adapter, NETXEN_WOL_CONFIG_NV); | ||
847 | if (!(wol_cfg & (1 << adapter->portnum))) | ||
848 | return -EOPNOTSUPP; | ||
849 | |||
850 | wol_cfg = netxen_nic_reg_read(adapter, NETXEN_WOL_CONFIG); | ||
851 | if (wol->wolopts & WAKE_MAGIC) | ||
852 | wol_cfg |= 1UL << adapter->portnum; | ||
853 | else | ||
854 | wol_cfg &= ~(1UL << adapter->portnum); | ||
855 | netxen_nic_reg_write(adapter, NETXEN_WOL_CONFIG, wol_cfg); | ||
856 | |||
857 | return 0; | ||
858 | } | ||
859 | |||
813 | /* | 860 | /* |
814 | * Set the coalescing parameters. Currently only normal is supported. | 861 | * Set the coalescing parameters. Currently only normal is supported. |
815 | * If rx_coalesce_usecs == 0 or rx_max_coalesced_frames == 0 then set the | 862 | * 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 = { | |||
916 | .set_sg = ethtool_op_set_sg, | 963 | .set_sg = ethtool_op_set_sg, |
917 | .get_tso = netxen_nic_get_tso, | 964 | .get_tso = netxen_nic_get_tso, |
918 | .set_tso = netxen_nic_set_tso, | 965 | .set_tso = netxen_nic_set_tso, |
966 | .get_wol = netxen_nic_get_wol, | ||
967 | .set_wol = netxen_nic_set_wol, | ||
919 | .self_test = netxen_nic_diag_test, | 968 | .self_test = netxen_nic_diag_test, |
920 | .get_strings = netxen_nic_get_strings, | 969 | .get_strings = netxen_nic_get_strings, |
921 | .get_ethtool_stats = netxen_nic_get_ethtool_stats, | 970 | .get_ethtool_stats = netxen_nic_get_ethtool_stats, |