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>
This commit is contained in:
parent
a27416bbca
commit
8e2813f59e
|
@ -600,6 +600,8 @@ extern void ixgbe_disable_rx_queue(struct ixgbe_adapter *adapter,
|
||||||
struct ixgbe_ring *);
|
struct ixgbe_ring *);
|
||||||
extern void ixgbe_update_stats(struct ixgbe_adapter *adapter);
|
extern void ixgbe_update_stats(struct ixgbe_adapter *adapter);
|
||||||
extern int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter);
|
extern int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter);
|
||||||
|
extern int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id,
|
||||||
|
u16 subdevice_id);
|
||||||
extern void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter);
|
extern void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter);
|
||||||
extern netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *,
|
extern netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *,
|
||||||
struct ixgbe_adapter *,
|
struct ixgbe_adapter *,
|
||||||
|
|
|
@ -1969,53 +1969,12 @@ static int ixgbe_wol_exclusion(struct ixgbe_adapter *adapter,
|
||||||
struct ethtool_wolinfo *wol)
|
struct ethtool_wolinfo *wol)
|
||||||
{
|
{
|
||||||
struct ixgbe_hw *hw = &adapter->hw;
|
struct ixgbe_hw *hw = &adapter->hw;
|
||||||
int retval = 1;
|
int retval = 0;
|
||||||
u16 wol_cap = adapter->eeprom_cap & IXGBE_DEVICE_CAPS_WOL_MASK;
|
|
||||||
|
|
||||||
/* WOL not supported except for the following */
|
/* WOL not supported for all devices */
|
||||||
switch(hw->device_id) {
|
if (!ixgbe_wol_supported(adapter, hw->device_id,
|
||||||
case IXGBE_DEV_ID_82599_SFP:
|
hw->subsystem_device_id)) {
|
||||||
/* Only these subdevices could supports WOL */
|
retval = 1;
|
||||||
switch (hw->subsystem_device_id) {
|
|
||||||
case IXGBE_SUBDEV_ID_82599_560FLR:
|
|
||||||
/* only support first port */
|
|
||||||
if (hw->bus.func != 0) {
|
|
||||||
wol->supported = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IXGBE_SUBDEV_ID_82599_SFP:
|
|
||||||
retval = 0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
wol->supported = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
|
|
||||||
/* All except this subdevice support WOL */
|
|
||||||
if (hw->subsystem_device_id ==
|
|
||||||
IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ) {
|
|
||||||
wol->supported = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
retval = 0;
|
|
||||||
break;
|
|
||||||
case IXGBE_DEV_ID_82599_KX4:
|
|
||||||
retval = 0;
|
|
||||||
break;
|
|
||||||
case IXGBE_DEV_ID_X540T:
|
|
||||||
/* check eeprom to see if enabled wol */
|
|
||||||
if ((wol_cap == IXGBE_DEVICE_CAPS_WOL_PORT0_1) ||
|
|
||||||
((wol_cap == IXGBE_DEVICE_CAPS_WOL_PORT0) &&
|
|
||||||
(hw->bus.func == 0))) {
|
|
||||||
retval = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* All others not supported */
|
|
||||||
wol->supported = 0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
wol->supported = 0;
|
wol->supported = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6785,6 +6785,57 @@ static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter,
|
||||||
#endif /* CONFIG_PCI_IOV */
|
#endif /* CONFIG_PCI_IOV */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ixgbe_wol_supported - Check whether device supports WoL
|
||||||
|
* @hw: hw specific details
|
||||||
|
* @device_id: the device ID
|
||||||
|
* @subdev_id: the subsystem device ID
|
||||||
|
*
|
||||||
|
* This function is used by probe and ethtool to determine
|
||||||
|
* which devices have WoL support
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id,
|
||||||
|
u16 subdevice_id)
|
||||||
|
{
|
||||||
|
struct ixgbe_hw *hw = &adapter->hw;
|
||||||
|
u16 wol_cap = adapter->eeprom_cap & IXGBE_DEVICE_CAPS_WOL_MASK;
|
||||||
|
int is_wol_supported = 0;
|
||||||
|
|
||||||
|
switch (device_id) {
|
||||||
|
case IXGBE_DEV_ID_82599_SFP:
|
||||||
|
/* Only these subdevices could supports WOL */
|
||||||
|
switch (subdevice_id) {
|
||||||
|
case IXGBE_SUBDEV_ID_82599_560FLR:
|
||||||
|
/* only support first port */
|
||||||
|
if (hw->bus.func != 0)
|
||||||
|
break;
|
||||||
|
case IXGBE_SUBDEV_ID_82599_SFP:
|
||||||
|
is_wol_supported = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
|
||||||
|
/* All except this subdevice support WOL */
|
||||||
|
if (subdevice_id != IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ)
|
||||||
|
is_wol_supported = 1;
|
||||||
|
break;
|
||||||
|
case IXGBE_DEV_ID_82599_KX4:
|
||||||
|
is_wol_supported = 1;
|
||||||
|
break;
|
||||||
|
case IXGBE_DEV_ID_X540T:
|
||||||
|
/* check eeprom to see if enabled wol */
|
||||||
|
if ((wol_cap == IXGBE_DEVICE_CAPS_WOL_PORT0_1) ||
|
||||||
|
((wol_cap == IXGBE_DEVICE_CAPS_WOL_PORT0) &&
|
||||||
|
(hw->bus.func == 0))) {
|
||||||
|
is_wol_supported = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return is_wol_supported;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ixgbe_probe - Device Initialization Routine
|
* ixgbe_probe - Device Initialization Routine
|
||||||
* @pdev: PCI device information struct
|
* @pdev: PCI device information struct
|
||||||
|
@ -6811,7 +6862,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
|
||||||
u16 device_caps;
|
u16 device_caps;
|
||||||
#endif
|
#endif
|
||||||
u32 eec;
|
u32 eec;
|
||||||
u16 wol_cap;
|
|
||||||
|
|
||||||
/* Catch broken hardware that put the wrong VF device ID in
|
/* Catch broken hardware that put the wrong VF device ID in
|
||||||
* the PCIe SR-IOV capability.
|
* the PCIe SR-IOV capability.
|
||||||
|
@ -7075,40 +7125,12 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
|
||||||
netdev->features &= ~NETIF_F_RXHASH;
|
netdev->features &= ~NETIF_F_RXHASH;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WOL not supported for all but the following */
|
/* WOL not supported for all devices */
|
||||||
adapter->wol = 0;
|
adapter->wol = 0;
|
||||||
switch (pdev->device) {
|
hw->eeprom.ops.read(hw, 0x2c, &adapter->eeprom_cap);
|
||||||
case IXGBE_DEV_ID_82599_SFP:
|
if (ixgbe_wol_supported(adapter, pdev->device, pdev->subsystem_device))
|
||||||
/* Only these subdevice supports WOL */
|
|
||||||
switch (pdev->subsystem_device) {
|
|
||||||
case IXGBE_SUBDEV_ID_82599_560FLR:
|
|
||||||
/* only support first port */
|
|
||||||
if (hw->bus.func != 0)
|
|
||||||
break;
|
|
||||||
case IXGBE_SUBDEV_ID_82599_SFP:
|
|
||||||
adapter->wol = IXGBE_WUFC_MAG;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
|
|
||||||
/* All except this subdevice support WOL */
|
|
||||||
if (pdev->subsystem_device != IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ)
|
|
||||||
adapter->wol = IXGBE_WUFC_MAG;
|
|
||||||
break;
|
|
||||||
case IXGBE_DEV_ID_82599_KX4:
|
|
||||||
adapter->wol = IXGBE_WUFC_MAG;
|
adapter->wol = IXGBE_WUFC_MAG;
|
||||||
break;
|
|
||||||
case IXGBE_DEV_ID_X540T:
|
|
||||||
/* Check eeprom to see if it is enabled */
|
|
||||||
hw->eeprom.ops.read(hw, 0x2c, &adapter->eeprom_cap);
|
|
||||||
wol_cap = adapter->eeprom_cap & IXGBE_DEVICE_CAPS_WOL_MASK;
|
|
||||||
|
|
||||||
if ((wol_cap == IXGBE_DEVICE_CAPS_WOL_PORT0_1) ||
|
|
||||||
((wol_cap == IXGBE_DEVICE_CAPS_WOL_PORT0) &&
|
|
||||||
(hw->bus.func == 0)))
|
|
||||||
adapter->wol = IXGBE_WUFC_MAG;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
|
device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
|
||||||
|
|
||||||
/* save off EEPROM version number */
|
/* save off EEPROM version number */
|
||||||
|
|
Loading…
Reference in New Issue