Module Name: src Committed By: msaitoh Date: Wed Dec 28 09:29:35 UTC 2016
Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c Log Message: Fix a bug that hw.ixgN.wol_enable=0 doesn't work correctly. Clear the WUC and WUFC register if wol_enable is 0. ixgbe_setup_low_power_mode() calls ixgbe_stop() and it resets the chip. The reset change WUC and WUFC registers to the default, so clearing WUC and WUFC should be done after ixgbe_stop(). To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/dev/pci/ixgbe/ixgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.57 src/sys/dev/pci/ixgbe/ixgbe.c:1.58 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.57 Wed Dec 28 07:05:11 2016 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Dec 28 09:29:35 2016 @@ -59,7 +59,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ /*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 302384 2016-07-07 03:39:18Z sbruno $*/ -/*$NetBSD: ixgbe.c,v 1.57 2016/12/28 07:05:11 msaitoh Exp $*/ +/*$NetBSD: ixgbe.c,v 1.58 2016/12/28 09:29:35 msaitoh Exp $*/ #include "opt_inet.h" #include "opt_inet6.h" @@ -4157,12 +4157,27 @@ ixgbe_setup_low_power_mode(struct adapte KASSERT(mutex_owned(&adapter->core_mtx)); - if (!hw->wol_enabled) - ixgbe_set_phy_power(hw, FALSE); - /* Limit power management flow to X550EM baseT */ if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T && hw->phy.ops.enter_lplu) { + /* X550EM baseT adapters need a special LPLU flow */ + hw->phy.reset_disable = true; + ixgbe_stop(adapter); + error = hw->phy.ops.enter_lplu(hw); + if (error) + device_printf(dev, + "Error entering LPLU: %d\n", error); + hw->phy.reset_disable = false; + } else { + /* Just stop for other adapters */ + ixgbe_stop(adapter); + } + + if (!hw->wol_enabled) { + ixgbe_set_phy_power(hw, FALSE); + IXGBE_WRITE_REG(hw, IXGBE_WUFC, 0); + IXGBE_WRITE_REG(hw, IXGBE_WUC, 0); + } else { /* Turn off support for APM wakeup. (Using ACPI instead) */ IXGBE_WRITE_REG(hw, IXGBE_GRC, IXGBE_READ_REG(hw, IXGBE_GRC) & ~(u32)2); @@ -4183,17 +4198,6 @@ ixgbe_setup_low_power_mode(struct adapte IXGBE_WRITE_REG(hw, IXGBE_WUC, IXGBE_WUC_WKEN | IXGBE_WUC_PME_EN); - /* X550EM baseT adapters need a special LPLU flow */ - hw->phy.reset_disable = true; - ixgbe_stop(adapter); - error = hw->phy.ops.enter_lplu(hw); - if (error) - device_printf(dev, - "Error entering LPLU: %d\n", error); - hw->phy.reset_disable = false; - } else { - /* Just stop for other adapters */ - ixgbe_stop(adapter); } return error;