提交 63d4a8f9 编写于 作者: M Matthew Vick 提交者: Jeff Kirsher

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: NMatthew Vick <matthew.vick@intel.com>
Tested-by: NAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 3e961a06
...@@ -370,8 +370,6 @@ struct igb_adapter { ...@@ -370,8 +370,6 @@ struct igb_adapter {
u32 eims_other; u32 eims_other;
/* to not mess up cache alignment, always add to the bottom */ /* to not mess up cache alignment, always add to the bottom */
u32 eeprom_wol;
u16 tx_ring_count; u16 tx_ring_count;
u16 rx_ring_count; u16 rx_ring_count;
unsigned int vfs_allocated_count; unsigned int vfs_allocated_count;
...@@ -401,6 +399,7 @@ struct igb_adapter { ...@@ -401,6 +399,7 @@ struct igb_adapter {
#define IGB_FLAG_PTP (1 << 5) #define IGB_FLAG_PTP (1 << 5)
#define IGB_FLAG_RSS_FIELD_IPV4_UDP (1 << 6) #define IGB_FLAG_RSS_FIELD_IPV4_UDP (1 << 6)
#define IGB_FLAG_RSS_FIELD_IPV6_UDP (1 << 7) #define IGB_FLAG_RSS_FIELD_IPV6_UDP (1 << 7)
#define IGB_FLAG_WOL_SUPPORTED (1 << 8)
/* DMA Coalescing defines */ /* DMA Coalescing defines */
#define IGB_MIN_TXPBSIZE 20408 #define IGB_MIN_TXPBSIZE 20408
......
...@@ -1966,54 +1966,6 @@ static void igb_diag_test(struct net_device *netdev, ...@@ -1966,54 +1966,6 @@ static void igb_diag_test(struct net_device *netdev,
msleep_interruptible(4 * 1000); msleep_interruptible(4 * 1000);
} }
static int igb_wol_exclusion(struct igb_adapter *adapter,
struct ethtool_wolinfo *wol)
{
struct e1000_hw *hw = &adapter->hw;
int retval = 1; /* fail by default */
switch (hw->device_id) {
case E1000_DEV_ID_82575GB_QUAD_COPPER:
/* WoL not supported */
wol->supported = 0;
break;
case E1000_DEV_ID_82575EB_FIBER_SERDES:
case E1000_DEV_ID_82576_FIBER:
case E1000_DEV_ID_82576_SERDES:
/* Wake events not supported on port B */
if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1) {
wol->supported = 0;
break;
}
/* return success for non excluded adapter ports */
retval = 0;
break;
case E1000_DEV_ID_82576_QUAD_COPPER:
case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
/* quad port adapters only support WoL on port A */
if (!(adapter->flags & IGB_FLAG_QUAD_PORT_A)) {
wol->supported = 0;
break;
}
/* return success for non excluded adapter ports */
retval = 0;
break;
default:
/* dual port cards only support WoL on port A from now on
* unless it was enabled in the eeprom for port B
* so exclude FUNC_1 ports from having WoL enabled */
if ((rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) &&
!adapter->eeprom_wol) {
wol->supported = 0;
break;
}
retval = 0;
}
return retval;
}
static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
{ {
struct igb_adapter *adapter = netdev_priv(netdev); 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,10 +1975,7 @@ static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
WAKE_PHY; WAKE_PHY;
wol->wolopts = 0; wol->wolopts = 0;
/* this function will set ->supported = 0 and return 1 if wol is not if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED))
* supported by this hardware */
if (igb_wol_exclusion(adapter, wol) ||
!device_can_wakeup(&adapter->pdev->dev))
return; return;
/* apply any specific unsupported masks here */ /* apply any specific unsupported masks here */
...@@ -2054,8 +2003,7 @@ static int igb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) ...@@ -2054,8 +2003,7 @@ static int igb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE)) if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (igb_wol_exclusion(adapter, wol) || if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED))
!device_can_wakeup(&adapter->pdev->dev))
return wol->wolopts ? -EOPNOTSUPP : 0; return wol->wolopts ? -EOPNOTSUPP : 0;
/* these settings will always override what we currently have */ /* these settings will always override what we currently have */
......
...@@ -1837,7 +1837,6 @@ static int __devinit igb_probe(struct pci_dev *pdev, ...@@ -1837,7 +1837,6 @@ static int __devinit igb_probe(struct pci_dev *pdev,
const struct e1000_info *ei = igb_info_tbl[ent->driver_data]; const struct e1000_info *ei = igb_info_tbl[ent->driver_data];
unsigned long mmio_start, mmio_len; unsigned long mmio_start, mmio_len;
int err, pci_using_dac; int err, pci_using_dac;
u16 eeprom_apme_mask = IGB_EEPROM_APME;
u8 part_str[E1000_PBANUM_LENGTH]; u8 part_str[E1000_PBANUM_LENGTH];
/* Catch broken hardware that put the wrong VF device ID in /* 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,28 +2044,27 @@ static int __devinit igb_probe(struct pci_dev *pdev,
igb_validate_mdi_setting(hw); igb_validate_mdi_setting(hw);
/* Initial Wake on LAN setting If APM wake is enabled in the EEPROM, /* By default, support wake on port A */
* enable the ACPI Magic Packet filter
*/
if (hw->bus.func == 0) if (hw->bus.func == 0)
hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); adapter->flags |= IGB_FLAG_WOL_SUPPORTED;
else if (hw->mac.type >= e1000_82580)
/* Check the NVM for wake support on non-port A ports */
if (hw->mac.type >= e1000_82580)
hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A + hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A +
NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1, NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1,
&eeprom_data); &eeprom_data);
else if (hw->bus.func == 1) else if (hw->bus.func == 1)
hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
if (eeprom_data & eeprom_apme_mask) if (eeprom_data & IGB_EEPROM_APME)
adapter->eeprom_wol |= E1000_WUFC_MAG; adapter->flags |= IGB_FLAG_WOL_SUPPORTED;
/* now that we have the eeprom settings, apply the special cases where /* now that we have the eeprom settings, apply the special cases where
* the eeprom may be wrong or the board simply won't support wake on * the eeprom may be wrong or the board simply won't support wake on
* lan on a particular port */ * lan on a particular port */
switch (pdev->device) { switch (pdev->device) {
case E1000_DEV_ID_82575GB_QUAD_COPPER: case E1000_DEV_ID_82575GB_QUAD_COPPER:
adapter->eeprom_wol = 0; adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
break; break;
case E1000_DEV_ID_82575EB_FIBER_SERDES: case E1000_DEV_ID_82575EB_FIBER_SERDES:
case E1000_DEV_ID_82576_FIBER: case E1000_DEV_ID_82576_FIBER:
...@@ -2074,24 +2072,38 @@ static int __devinit igb_probe(struct pci_dev *pdev, ...@@ -2074,24 +2072,38 @@ static int __devinit igb_probe(struct pci_dev *pdev,
/* Wake events only supported on port A for dual fiber /* Wake events only supported on port A for dual fiber
* regardless of eeprom setting */ * regardless of eeprom setting */
if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1) if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1)
adapter->eeprom_wol = 0; adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
break; break;
case E1000_DEV_ID_82576_QUAD_COPPER: case E1000_DEV_ID_82576_QUAD_COPPER:
case E1000_DEV_ID_82576_QUAD_COPPER_ET2: case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
/* if quad port adapter, disable WoL on all but port A */ /* if quad port adapter, disable WoL on all but port A */
if (global_quad_port_a != 0) if (global_quad_port_a != 0)
adapter->eeprom_wol = 0; adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
else else
adapter->flags |= IGB_FLAG_QUAD_PORT_A; adapter->flags |= IGB_FLAG_QUAD_PORT_A;
/* Reset for multiple quad port adapters */ /* Reset for multiple quad port adapters */
if (++global_quad_port_a == 4) if (++global_quad_port_a == 4)
global_quad_port_a = 0; global_quad_port_a = 0;
break; break;
default:
/* If the device can't wake, don't set software support */
if (!device_can_wakeup(&adapter->pdev->dev))
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
} }
/* initialize the wol settings based on the eeprom settings */ /* initialize the wol settings based on the eeprom settings */
adapter->wol = adapter->eeprom_wol; if (adapter->flags & IGB_FLAG_WOL_SUPPORTED)
device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); adapter->wol |= E1000_WUFC_MAG;
/* Some vendors want WoL disabled by default, but still supported */
if ((hw->mac.type == e1000_i350) &&
(pdev->subsystem_vendor == PCI_VENDOR_ID_HP)) {
adapter->flags |= IGB_FLAG_WOL_SUPPORTED;
adapter->wol = 0;
}
device_set_wakeup_enable(&adapter->pdev->dev,
adapter->flags & IGB_FLAG_WOL_SUPPORTED);
/* reset the hardware with the new settings */ /* reset the hardware with the new settings */
igb_reset(adapter); igb_reset(adapter);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册