aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Vick <matthew.vick@intel.com>2012-11-09 00:49:54 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-11-22 05:00:58 -0500
commit63d4a8f963fce8fe5d8ba3d5eba34d7d7ca6f82b (patch)
tree34d71b51d5abcfa21be055245b6e8292b1aedb83
parent3e961a06a0d509d9f7cddc8240431d25f6dcd51f (diff)
igb: No longer rely on APME to determine WoL settings
Historically, we've been using the APME bit to determine whether a device supports wake on a given port or not. However, this bit specifies the default wake setting, rather than the wake support. Change the behavior so that we use a flag to keep the capabilities separate from the enablement while meeting customer requirements. Signed-off-by: Matthew Vick <matthew.vick@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/igb/igb.h3
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ethtool.c56
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c40
3 files changed, 29 insertions, 70 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index d8fd5b63af9a..c15a4811b476 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -370,8 +370,6 @@ struct igb_adapter {
370 u32 eims_other; 370 u32 eims_other;
371 371
372 /* to not mess up cache alignment, always add to the bottom */ 372 /* to not mess up cache alignment, always add to the bottom */
373 u32 eeprom_wol;
374
375 u16 tx_ring_count; 373 u16 tx_ring_count;
376 u16 rx_ring_count; 374 u16 rx_ring_count;
377 unsigned int vfs_allocated_count; 375 unsigned int vfs_allocated_count;
@@ -401,6 +399,7 @@ struct igb_adapter {
401#define IGB_FLAG_PTP (1 << 5) 399#define IGB_FLAG_PTP (1 << 5)
402#define IGB_FLAG_RSS_FIELD_IPV4_UDP (1 << 6) 400#define IGB_FLAG_RSS_FIELD_IPV4_UDP (1 << 6)
403#define IGB_FLAG_RSS_FIELD_IPV6_UDP (1 << 7) 401#define IGB_FLAG_RSS_FIELD_IPV6_UDP (1 << 7)
402#define IGB_FLAG_WOL_SUPPORTED (1 << 8)
404 403
405/* DMA Coalescing defines */ 404/* DMA Coalescing defines */
406#define IGB_MIN_TXPBSIZE 20408 405#define IGB_MIN_TXPBSIZE 20408
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 0acf590d4a83..e2288b5a9caa 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -1966,54 +1966,6 @@ static void igb_diag_test(struct net_device *netdev,
1966 msleep_interruptible(4 * 1000); 1966 msleep_interruptible(4 * 1000);
1967} 1967}
1968 1968
1969static int igb_wol_exclusion(struct igb_adapter *adapter,
1970 struct ethtool_wolinfo *wol)
1971{
1972 struct e1000_hw *hw = &adapter->hw;
1973 int retval = 1; /* fail by default */
1974
1975 switch (hw->device_id) {
1976 case E1000_DEV_ID_82575GB_QUAD_COPPER:
1977 /* WoL not supported */
1978 wol->supported = 0;
1979 break;
1980 case E1000_DEV_ID_82575EB_FIBER_SERDES:
1981 case E1000_DEV_ID_82576_FIBER:
1982 case E1000_DEV_ID_82576_SERDES:
1983 /* Wake events not supported on port B */
1984 if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1) {
1985 wol->supported = 0;
1986 break;
1987 }
1988 /* return success for non excluded adapter ports */
1989 retval = 0;
1990 break;
1991 case E1000_DEV_ID_82576_QUAD_COPPER:
1992 case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
1993 /* quad port adapters only support WoL on port A */
1994 if (!(adapter->flags & IGB_FLAG_QUAD_PORT_A)) {
1995 wol->supported = 0;
1996 break;
1997 }
1998 /* return success for non excluded adapter ports */
1999 retval = 0;
2000 break;
2001 default:
2002 /* dual port cards only support WoL on port A from now on
2003 * unless it was enabled in the eeprom for port B
2004 * so exclude FUNC_1 ports from having WoL enabled */
2005 if ((rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) &&
2006 !adapter->eeprom_wol) {
2007 wol->supported = 0;
2008 break;
2009 }
2010
2011 retval = 0;
2012 }
2013
2014 return retval;
2015}
2016
2017static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) 1969static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
2018{ 1970{
2019 struct igb_adapter *adapter = netdev_priv(netdev); 1971 struct igb_adapter *adapter = netdev_priv(netdev);
@@ -2023,10 +1975,7 @@ static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
2023 WAKE_PHY; 1975 WAKE_PHY;
2024 wol->wolopts = 0; 1976 wol->wolopts = 0;
2025 1977
2026 /* this function will set ->supported = 0 and return 1 if wol is not 1978 if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED))
2027 * supported by this hardware */
2028 if (igb_wol_exclusion(adapter, wol) ||
2029 !device_can_wakeup(&adapter->pdev->dev))
2030 return; 1979 return;
2031 1980
2032 /* apply any specific unsupported masks here */ 1981 /* apply any specific unsupported masks here */
@@ -2054,8 +2003,7 @@ static int igb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
2054 if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE)) 2003 if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE))
2055 return -EOPNOTSUPP; 2004 return -EOPNOTSUPP;
2056 2005
2057 if (igb_wol_exclusion(adapter, wol) || 2006 if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED))
2058 !device_can_wakeup(&adapter->pdev->dev))
2059 return wol->wolopts ? -EOPNOTSUPP : 0; 2007 return wol->wolopts ? -EOPNOTSUPP : 0;
2060 2008
2061 /* these settings will always override what we currently have */ 2009 /* these settings will always override what we currently have */
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 7044aaadeca1..0fe25210629b 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1837,7 +1837,6 @@ static int __devinit igb_probe(struct pci_dev *pdev,
1837 const struct e1000_info *ei = igb_info_tbl[ent->driver_data]; 1837 const struct e1000_info *ei = igb_info_tbl[ent->driver_data];
1838 unsigned long mmio_start, mmio_len; 1838 unsigned long mmio_start, mmio_len;
1839 int err, pci_using_dac; 1839 int err, pci_using_dac;
1840 u16 eeprom_apme_mask = IGB_EEPROM_APME;
1841 u8 part_str[E1000_PBANUM_LENGTH]; 1840 u8 part_str[E1000_PBANUM_LENGTH];
1842 1841
1843 /* Catch broken hardware that put the wrong VF device ID in 1842 /* Catch broken hardware that put the wrong VF device ID in
@@ -2045,28 +2044,27 @@ static int __devinit igb_probe(struct pci_dev *pdev,
2045 2044
2046 igb_validate_mdi_setting(hw); 2045 igb_validate_mdi_setting(hw);
2047 2046
2048 /* Initial Wake on LAN setting If APM wake is enabled in the EEPROM, 2047 /* By default, support wake on port A */
2049 * enable the ACPI Magic Packet filter
2050 */
2051
2052 if (hw->bus.func == 0) 2048 if (hw->bus.func == 0)
2053 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); 2049 adapter->flags |= IGB_FLAG_WOL_SUPPORTED;
2054 else if (hw->mac.type >= e1000_82580) 2050
2051 /* Check the NVM for wake support on non-port A ports */
2052 if (hw->mac.type >= e1000_82580)
2055 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A + 2053 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A +
2056 NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1, 2054 NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1,
2057 &eeprom_data); 2055 &eeprom_data);
2058 else if (hw->bus.func == 1) 2056 else if (hw->bus.func == 1)
2059 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); 2057 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
2060 2058
2061 if (eeprom_data & eeprom_apme_mask) 2059 if (eeprom_data & IGB_EEPROM_APME)
2062 adapter->eeprom_wol |= E1000_WUFC_MAG; 2060 adapter->flags |= IGB_FLAG_WOL_SUPPORTED;
2063 2061
2064 /* now that we have the eeprom settings, apply the special cases where 2062 /* now that we have the eeprom settings, apply the special cases where
2065 * the eeprom may be wrong or the board simply won't support wake on 2063 * the eeprom may be wrong or the board simply won't support wake on
2066 * lan on a particular port */ 2064 * lan on a particular port */
2067 switch (pdev->device) { 2065 switch (pdev->device) {
2068 case E1000_DEV_ID_82575GB_QUAD_COPPER: 2066 case E1000_DEV_ID_82575GB_QUAD_COPPER:
2069 adapter->eeprom_wol = 0; 2067 adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
2070 break; 2068 break;
2071 case E1000_DEV_ID_82575EB_FIBER_SERDES: 2069 case E1000_DEV_ID_82575EB_FIBER_SERDES:
2072 case E1000_DEV_ID_82576_FIBER: 2070 case E1000_DEV_ID_82576_FIBER:
@@ -2074,24 +2072,38 @@ static int __devinit igb_probe(struct pci_dev *pdev,
2074 /* Wake events only supported on port A for dual fiber 2072 /* Wake events only supported on port A for dual fiber
2075 * regardless of eeprom setting */ 2073 * regardless of eeprom setting */
2076 if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1) 2074 if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1)
2077 adapter->eeprom_wol = 0; 2075 adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
2078 break; 2076 break;
2079 case E1000_DEV_ID_82576_QUAD_COPPER: 2077 case E1000_DEV_ID_82576_QUAD_COPPER:
2080 case E1000_DEV_ID_82576_QUAD_COPPER_ET2: 2078 case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
2081 /* if quad port adapter, disable WoL on all but port A */ 2079 /* if quad port adapter, disable WoL on all but port A */
2082 if (global_quad_port_a != 0) 2080 if (global_quad_port_a != 0)
2083 adapter->eeprom_wol = 0; 2081 adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
2084 else 2082 else
2085 adapter->flags |= IGB_FLAG_QUAD_PORT_A; 2083 adapter->flags |= IGB_FLAG_QUAD_PORT_A;
2086 /* Reset for multiple quad port adapters */ 2084 /* Reset for multiple quad port adapters */
2087 if (++global_quad_port_a == 4) 2085 if (++global_quad_port_a == 4)
2088 global_quad_port_a = 0; 2086 global_quad_port_a = 0;
2089 break; 2087 break;
2088 default:
2089 /* If the device can't wake, don't set software support */
2090 if (!device_can_wakeup(&adapter->pdev->dev))
2091 adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
2090 } 2092 }
2091 2093
2092 /* initialize the wol settings based on the eeprom settings */ 2094 /* initialize the wol settings based on the eeprom settings */
2093 adapter->wol = adapter->eeprom_wol; 2095 if (adapter->flags & IGB_FLAG_WOL_SUPPORTED)
2094 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); 2096 adapter->wol |= E1000_WUFC_MAG;
2097
2098 /* Some vendors want WoL disabled by default, but still supported */
2099 if ((hw->mac.type == e1000_i350) &&
2100 (pdev->subsystem_vendor == PCI_VENDOR_ID_HP)) {
2101 adapter->flags |= IGB_FLAG_WOL_SUPPORTED;
2102 adapter->wol = 0;
2103 }
2104
2105 device_set_wakeup_enable(&adapter->pdev->dev,
2106 adapter->flags & IGB_FLAG_WOL_SUPPORTED);
2095 2107
2096 /* reset the hardware with the new settings */ 2108 /* reset the hardware with the new settings */
2097 igb_reset(adapter); 2109 igb_reset(adapter);