diff options
author | Jacob Keller <jacob.e.keller@intel.com> | 2012-04-21 02:05:40 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2012-04-27 05:31:26 -0400 |
commit | 8e2813f59e2036aac12fe7b23eda95406b14a83f (patch) | |
tree | 757d7b07cef51575031f2629a0b4e522e41ee928 /drivers | |
parent | a27416bbcada50173c2cf8c71d195380b9f06be2 (diff) |
ixgbe: check for WoL support in single function
This patch consolidates the case logic for checking whether a device supports
WoL into a single place. Previously ethtool and probe used similar logic that
was copied and maintained separately. This patch encapsulates the core logic
into a function so that a user only has to update one place.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 51 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 88 |
3 files changed, 62 insertions, 79 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 74e192107f9a..8e082f257efb 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -600,6 +600,8 @@ extern void ixgbe_disable_rx_queue(struct ixgbe_adapter *adapter, | |||
600 | struct ixgbe_ring *); | 600 | struct ixgbe_ring *); |
601 | extern void ixgbe_update_stats(struct ixgbe_adapter *adapter); | 601 | extern void ixgbe_update_stats(struct ixgbe_adapter *adapter); |
602 | extern int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter); | 602 | extern int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter); |
603 | extern int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id, | ||
604 | u16 subdevice_id); | ||
603 | extern void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter); | 605 | extern void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter); |
604 | extern netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *, | 606 | extern netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *, |
605 | struct ixgbe_adapter *, | 607 | struct ixgbe_adapter *, |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 31a2bf76a346..27225ff44e2f 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
@@ -1969,53 +1969,12 @@ static int ixgbe_wol_exclusion(struct ixgbe_adapter *adapter, | |||
1969 | struct ethtool_wolinfo *wol) | 1969 | struct ethtool_wolinfo *wol) |
1970 | { | 1970 | { |
1971 | struct ixgbe_hw *hw = &adapter->hw; | 1971 | struct ixgbe_hw *hw = &adapter->hw; |
1972 | int retval = 1; | 1972 | int retval = 0; |
1973 | u16 wol_cap = adapter->eeprom_cap & IXGBE_DEVICE_CAPS_WOL_MASK; | ||
1974 | |||
1975 | /* WOL not supported except for the following */ | ||
1976 | switch(hw->device_id) { | ||
1977 | case IXGBE_DEV_ID_82599_SFP: | ||
1978 | /* Only these subdevices could supports WOL */ | ||
1979 | switch (hw->subsystem_device_id) { | ||
1980 | case IXGBE_SUBDEV_ID_82599_560FLR: | ||
1981 | /* only support first port */ | ||
1982 | if (hw->bus.func != 0) { | ||
1983 | wol->supported = 0; | ||
1984 | break; | ||
1985 | } | ||
1986 | case IXGBE_SUBDEV_ID_82599_SFP: | ||
1987 | retval = 0; | ||
1988 | break; | ||
1989 | default: | ||
1990 | wol->supported = 0; | ||
1991 | break; | ||
1992 | } | ||
1993 | break; | ||
1994 | case IXGBE_DEV_ID_82599_COMBO_BACKPLANE: | ||
1995 | /* All except this subdevice support WOL */ | ||
1996 | if (hw->subsystem_device_id == | ||
1997 | IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ) { | ||
1998 | wol->supported = 0; | ||
1999 | break; | ||
2000 | } | ||
2001 | retval = 0; | ||
2002 | break; | ||
2003 | case IXGBE_DEV_ID_82599_KX4: | ||
2004 | retval = 0; | ||
2005 | break; | ||
2006 | case IXGBE_DEV_ID_X540T: | ||
2007 | /* check eeprom to see if enabled wol */ | ||
2008 | if ((wol_cap == IXGBE_DEVICE_CAPS_WOL_PORT0_1) || | ||
2009 | ((wol_cap == IXGBE_DEVICE_CAPS_WOL_PORT0) && | ||
2010 | (hw->bus.func == 0))) { | ||
2011 | retval = 0; | ||
2012 | break; | ||
2013 | } | ||
2014 | 1973 | ||
2015 | /* All others not supported */ | 1974 | /* WOL not supported for all devices */ |
2016 | wol->supported = 0; | 1975 | if (!ixgbe_wol_supported(adapter, hw->device_id, |
2017 | break; | 1976 | hw->subsystem_device_id)) { |
2018 | default: | 1977 | retval = 1; |
2019 | wol->supported = 0; | 1978 | wol->supported = 0; |
2020 | } | 1979 | } |
2021 | 1980 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 7c4325ec22c2..aa29edb950f2 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -6598,7 +6598,7 @@ static netdev_features_t ixgbe_fix_features(struct net_device *netdev, | |||
6598 | /* Turn off LRO if not RSC capable */ | 6598 | /* Turn off LRO if not RSC capable */ |
6599 | if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) | 6599 | if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) |
6600 | features &= ~NETIF_F_LRO; | 6600 | features &= ~NETIF_F_LRO; |
6601 | 6601 | ||
6602 | 6602 | ||
6603 | return features; | 6603 | return features; |
6604 | } | 6604 | } |
@@ -6786,6 +6786,57 @@ static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter, | |||
6786 | } | 6786 | } |
6787 | 6787 | ||
6788 | /** | 6788 | /** |
6789 | * ixgbe_wol_supported - Check whether device supports WoL | ||
6790 | * @hw: hw specific details | ||
6791 | * @device_id: the device ID | ||
6792 | * @subdev_id: the subsystem device ID | ||
6793 | * | ||
6794 | * This function is used by probe and ethtool to determine | ||
6795 | * which devices have WoL support | ||
6796 | * | ||
6797 | **/ | ||
6798 | int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id, | ||
6799 | u16 subdevice_id) | ||
6800 | { | ||
6801 | struct ixgbe_hw *hw = &adapter->hw; | ||
6802 | u16 wol_cap = adapter->eeprom_cap & IXGBE_DEVICE_CAPS_WOL_MASK; | ||
6803 | int is_wol_supported = 0; | ||
6804 | |||
6805 | switch (device_id) { | ||
6806 | case IXGBE_DEV_ID_82599_SFP: | ||
6807 | /* Only these subdevices could supports WOL */ | ||
6808 | switch (subdevice_id) { | ||
6809 | case IXGBE_SUBDEV_ID_82599_560FLR: | ||
6810 | /* only support first port */ | ||
6811 | if (hw->bus.func != 0) | ||
6812 | break; | ||
6813 | case IXGBE_SUBDEV_ID_82599_SFP: | ||
6814 | is_wol_supported = 1; | ||
6815 | break; | ||
6816 | } | ||
6817 | break; | ||
6818 | case IXGBE_DEV_ID_82599_COMBO_BACKPLANE: | ||
6819 | /* All except this subdevice support WOL */ | ||
6820 | if (subdevice_id != IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ) | ||
6821 | is_wol_supported = 1; | ||
6822 | break; | ||
6823 | case IXGBE_DEV_ID_82599_KX4: | ||
6824 | is_wol_supported = 1; | ||
6825 | break; | ||
6826 | case IXGBE_DEV_ID_X540T: | ||
6827 | /* check eeprom to see if enabled wol */ | ||
6828 | if ((wol_cap == IXGBE_DEVICE_CAPS_WOL_PORT0_1) || | ||
6829 | ((wol_cap == IXGBE_DEVICE_CAPS_WOL_PORT0) && | ||
6830 | (hw->bus.func == 0))) { | ||
6831 | is_wol_supported = 1; | ||
6832 | } | ||
6833 | break; | ||
6834 | } | ||
6835 | |||
6836 | return is_wol_supported; | ||
6837 | } | ||
6838 | |||
6839 | /** | ||
6789 | * ixgbe_probe - Device Initialization Routine | 6840 | * ixgbe_probe - Device Initialization Routine |
6790 | * @pdev: PCI device information struct | 6841 | * @pdev: PCI device information struct |
6791 | * @ent: entry in ixgbe_pci_tbl | 6842 | * @ent: entry in ixgbe_pci_tbl |
@@ -6811,7 +6862,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
6811 | u16 device_caps; | 6862 | u16 device_caps; |
6812 | #endif | 6863 | #endif |
6813 | u32 eec; | 6864 | u32 eec; |
6814 | u16 wol_cap; | ||
6815 | 6865 | ||
6816 | /* Catch broken hardware that put the wrong VF device ID in | 6866 | /* Catch broken hardware that put the wrong VF device ID in |
6817 | * the PCIe SR-IOV capability. | 6867 | * the PCIe SR-IOV capability. |
@@ -7075,40 +7125,12 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
7075 | netdev->features &= ~NETIF_F_RXHASH; | 7125 | netdev->features &= ~NETIF_F_RXHASH; |
7076 | } | 7126 | } |
7077 | 7127 | ||
7078 | /* WOL not supported for all but the following */ | 7128 | /* WOL not supported for all devices */ |
7079 | adapter->wol = 0; | 7129 | adapter->wol = 0; |
7080 | switch (pdev->device) { | 7130 | hw->eeprom.ops.read(hw, 0x2c, &adapter->eeprom_cap); |
7081 | case IXGBE_DEV_ID_82599_SFP: | 7131 | if (ixgbe_wol_supported(adapter, pdev->device, pdev->subsystem_device)) |
7082 | /* Only these subdevice supports WOL */ | ||
7083 | switch (pdev->subsystem_device) { | ||
7084 | case IXGBE_SUBDEV_ID_82599_560FLR: | ||
7085 | /* only support first port */ | ||
7086 | if (hw->bus.func != 0) | ||
7087 | break; | ||
7088 | case IXGBE_SUBDEV_ID_82599_SFP: | ||
7089 | adapter->wol = IXGBE_WUFC_MAG; | ||
7090 | break; | ||
7091 | } | ||
7092 | break; | ||
7093 | case IXGBE_DEV_ID_82599_COMBO_BACKPLANE: | ||
7094 | /* All except this subdevice support WOL */ | ||
7095 | if (pdev->subsystem_device != IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ) | ||
7096 | adapter->wol = IXGBE_WUFC_MAG; | ||
7097 | break; | ||
7098 | case IXGBE_DEV_ID_82599_KX4: | ||
7099 | adapter->wol = IXGBE_WUFC_MAG; | 7132 | adapter->wol = IXGBE_WUFC_MAG; |
7100 | break; | ||
7101 | case IXGBE_DEV_ID_X540T: | ||
7102 | /* Check eeprom to see if it is enabled */ | ||
7103 | hw->eeprom.ops.read(hw, 0x2c, &adapter->eeprom_cap); | ||
7104 | wol_cap = adapter->eeprom_cap & IXGBE_DEVICE_CAPS_WOL_MASK; | ||
7105 | 7133 | ||
7106 | if ((wol_cap == IXGBE_DEVICE_CAPS_WOL_PORT0_1) || | ||
7107 | ((wol_cap == IXGBE_DEVICE_CAPS_WOL_PORT0) && | ||
7108 | (hw->bus.func == 0))) | ||
7109 | adapter->wol = IXGBE_WUFC_MAG; | ||
7110 | break; | ||
7111 | } | ||
7112 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); | 7134 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); |
7113 | 7135 | ||
7114 | /* save off EEPROM version number */ | 7136 | /* save off EEPROM version number */ |