diff options
Diffstat (limited to 'drivers/net/ethernet/intel/e1000e/netdev.c')
| -rw-r--r-- | drivers/net/ethernet/intel/e1000e/netdev.c | 343 |
1 files changed, 211 insertions, 132 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 6d91933c4cdd..6bd1832e3f3e 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
| @@ -1,30 +1,23 @@ | |||
| 1 | /******************************************************************************* | 1 | /* Intel PRO/1000 Linux driver |
| 2 | 2 | * Copyright(c) 1999 - 2014 Intel Corporation. | |
| 3 | Intel PRO/1000 Linux driver | 3 | * |
| 4 | Copyright(c) 1999 - 2013 Intel Corporation. | 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | 5 | * under the terms and conditions of the GNU General Public License, | |
| 6 | This program is free software; you can redistribute it and/or modify it | 6 | * version 2, as published by the Free Software Foundation. |
| 7 | under the terms and conditions of the GNU General Public License, | 7 | * |
| 8 | version 2, as published by the Free Software Foundation. | 8 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 9 | 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 10 | This program is distributed in the hope it will be useful, but WITHOUT | 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 11 | * more details. |
| 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | 12 | * |
| 13 | more details. | 13 | * The full GNU General Public License is included in this distribution in |
| 14 | 14 | * the file called "COPYING". | |
| 15 | You should have received a copy of the GNU General Public License along with | 15 | * |
| 16 | this program; if not, write to the Free Software Foundation, Inc., | 16 | * Contact Information: |
| 17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | 17 | * Linux NICS <linux.nics@intel.com> |
| 18 | 18 | * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | |
| 19 | The full GNU General Public License is included in this distribution in | 19 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 20 | the file called "COPYING". | 20 | */ |
| 21 | |||
| 22 | Contact Information: | ||
| 23 | Linux NICS <linux.nics@intel.com> | ||
| 24 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||
| 25 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
| 26 | |||
| 27 | *******************************************************************************/ | ||
| 28 | 21 | ||
| 29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 30 | 23 | ||
| @@ -885,7 +878,7 @@ static inline void e1000_rx_hash(struct net_device *netdev, __le32 rss, | |||
| 885 | struct sk_buff *skb) | 878 | struct sk_buff *skb) |
| 886 | { | 879 | { |
| 887 | if (netdev->features & NETIF_F_RXHASH) | 880 | if (netdev->features & NETIF_F_RXHASH) |
| 888 | skb->rxhash = le32_to_cpu(rss); | 881 | skb_set_hash(skb, le32_to_cpu(rss), PKT_HASH_TYPE_L3); |
| 889 | } | 882 | } |
| 890 | 883 | ||
| 891 | /** | 884 | /** |
| @@ -1097,8 +1090,14 @@ static void e1000_print_hw_hang(struct work_struct *work) | |||
| 1097 | adapter->tx_hang_recheck = true; | 1090 | adapter->tx_hang_recheck = true; |
| 1098 | return; | 1091 | return; |
| 1099 | } | 1092 | } |
| 1100 | /* Real hang detected */ | ||
| 1101 | adapter->tx_hang_recheck = false; | 1093 | adapter->tx_hang_recheck = false; |
| 1094 | |||
| 1095 | if (er32(TDH(0)) == er32(TDT(0))) { | ||
| 1096 | e_dbg("false hang detected, ignoring\n"); | ||
| 1097 | return; | ||
| 1098 | } | ||
| 1099 | |||
| 1100 | /* Real hang detected */ | ||
| 1102 | netif_stop_queue(netdev); | 1101 | netif_stop_queue(netdev); |
| 1103 | 1102 | ||
| 1104 | e1e_rphy(hw, MII_BMSR, &phy_status); | 1103 | e1e_rphy(hw, MII_BMSR, &phy_status); |
| @@ -1128,6 +1127,8 @@ static void e1000_print_hw_hang(struct work_struct *work) | |||
| 1128 | eop, jiffies, eop_desc->upper.fields.status, er32(STATUS), | 1127 | eop, jiffies, eop_desc->upper.fields.status, er32(STATUS), |
| 1129 | phy_status, phy_1000t_status, phy_ext_status, pci_status); | 1128 | phy_status, phy_1000t_status, phy_ext_status, pci_status); |
| 1130 | 1129 | ||
| 1130 | e1000e_dump(adapter); | ||
| 1131 | |||
| 1131 | /* Suggest workaround for known h/w issue */ | 1132 | /* Suggest workaround for known h/w issue */ |
| 1132 | if ((hw->mac.type == e1000_pchlan) && (er32(CTRL) & E1000_CTRL_TFCE)) | 1133 | if ((hw->mac.type == e1000_pchlan) && (er32(CTRL) & E1000_CTRL_TFCE)) |
| 1133 | e_err("Try turning off Tx pause (flow control) via ethtool\n"); | 1134 | e_err("Try turning off Tx pause (flow control) via ethtool\n"); |
| @@ -1701,7 +1702,7 @@ static void e1000_clean_rx_ring(struct e1000_ring *rx_ring) | |||
| 1701 | adapter->flags2 &= ~FLAG2_IS_DISCARDING; | 1702 | adapter->flags2 &= ~FLAG2_IS_DISCARDING; |
| 1702 | 1703 | ||
| 1703 | writel(0, rx_ring->head); | 1704 | writel(0, rx_ring->head); |
| 1704 | if (rx_ring->adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA) | 1705 | if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA) |
| 1705 | e1000e_update_rdt_wa(rx_ring, 0); | 1706 | e1000e_update_rdt_wa(rx_ring, 0); |
| 1706 | else | 1707 | else |
| 1707 | writel(0, rx_ring->tail); | 1708 | writel(0, rx_ring->tail); |
| @@ -2038,13 +2039,16 @@ void e1000e_set_interrupt_capability(struct e1000_adapter *adapter) | |||
| 2038 | msix_entry), | 2039 | msix_entry), |
| 2039 | GFP_KERNEL); | 2040 | GFP_KERNEL); |
| 2040 | if (adapter->msix_entries) { | 2041 | if (adapter->msix_entries) { |
| 2042 | struct e1000_adapter *a = adapter; | ||
| 2043 | |||
| 2041 | for (i = 0; i < adapter->num_vectors; i++) | 2044 | for (i = 0; i < adapter->num_vectors; i++) |
| 2042 | adapter->msix_entries[i].entry = i; | 2045 | adapter->msix_entries[i].entry = i; |
| 2043 | 2046 | ||
| 2044 | err = pci_enable_msix(adapter->pdev, | 2047 | err = pci_enable_msix_range(a->pdev, |
| 2045 | adapter->msix_entries, | 2048 | a->msix_entries, |
| 2046 | adapter->num_vectors); | 2049 | a->num_vectors, |
| 2047 | if (err == 0) | 2050 | a->num_vectors); |
| 2051 | if (err > 0) | ||
| 2048 | return; | 2052 | return; |
| 2049 | } | 2053 | } |
| 2050 | /* MSI-X failed, so fall through and try MSI */ | 2054 | /* MSI-X failed, so fall through and try MSI */ |
| @@ -2402,7 +2406,7 @@ static void e1000_clean_tx_ring(struct e1000_ring *tx_ring) | |||
| 2402 | tx_ring->next_to_clean = 0; | 2406 | tx_ring->next_to_clean = 0; |
| 2403 | 2407 | ||
| 2404 | writel(0, tx_ring->head); | 2408 | writel(0, tx_ring->head); |
| 2405 | if (tx_ring->adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA) | 2409 | if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA) |
| 2406 | e1000e_update_tdt_wa(tx_ring, 0); | 2410 | e1000e_update_tdt_wa(tx_ring, 0); |
| 2407 | else | 2411 | else |
| 2408 | writel(0, tx_ring->tail); | 2412 | writel(0, tx_ring->tail); |
| @@ -2894,7 +2898,7 @@ static void e1000_configure_tx(struct e1000_adapter *adapter) | |||
| 2894 | struct e1000_hw *hw = &adapter->hw; | 2898 | struct e1000_hw *hw = &adapter->hw; |
| 2895 | struct e1000_ring *tx_ring = adapter->tx_ring; | 2899 | struct e1000_ring *tx_ring = adapter->tx_ring; |
| 2896 | u64 tdba; | 2900 | u64 tdba; |
| 2897 | u32 tdlen, tarc; | 2901 | u32 tdlen, tctl, tarc; |
| 2898 | 2902 | ||
| 2899 | /* Setup the HW Tx Head and Tail descriptor pointers */ | 2903 | /* Setup the HW Tx Head and Tail descriptor pointers */ |
| 2900 | tdba = tx_ring->dma; | 2904 | tdba = tx_ring->dma; |
| @@ -2931,6 +2935,12 @@ static void e1000_configure_tx(struct e1000_adapter *adapter) | |||
| 2931 | /* erratum work around: set txdctl the same for both queues */ | 2935 | /* erratum work around: set txdctl the same for both queues */ |
| 2932 | ew32(TXDCTL(1), er32(TXDCTL(0))); | 2936 | ew32(TXDCTL(1), er32(TXDCTL(0))); |
| 2933 | 2937 | ||
| 2938 | /* Program the Transmit Control Register */ | ||
| 2939 | tctl = er32(TCTL); | ||
| 2940 | tctl &= ~E1000_TCTL_CT; | ||
| 2941 | tctl |= E1000_TCTL_PSP | E1000_TCTL_RTLC | | ||
| 2942 | (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); | ||
| 2943 | |||
| 2934 | if (adapter->flags & FLAG_TARC_SPEED_MODE_BIT) { | 2944 | if (adapter->flags & FLAG_TARC_SPEED_MODE_BIT) { |
| 2935 | tarc = er32(TARC(0)); | 2945 | tarc = er32(TARC(0)); |
| 2936 | /* set the speed mode bit, we'll clear it if we're not at | 2946 | /* set the speed mode bit, we'll clear it if we're not at |
| @@ -2961,6 +2971,8 @@ static void e1000_configure_tx(struct e1000_adapter *adapter) | |||
| 2961 | /* enable Report Status bit */ | 2971 | /* enable Report Status bit */ |
| 2962 | adapter->txd_cmd |= E1000_TXD_CMD_RS; | 2972 | adapter->txd_cmd |= E1000_TXD_CMD_RS; |
| 2963 | 2973 | ||
| 2974 | ew32(TCTL, tctl); | ||
| 2975 | |||
| 2964 | hw->mac.ops.config_collision_dist(hw); | 2976 | hw->mac.ops.config_collision_dist(hw); |
| 2965 | } | 2977 | } |
| 2966 | 2978 | ||
| @@ -3331,6 +3343,9 @@ static void e1000e_set_rx_mode(struct net_device *netdev) | |||
| 3331 | struct e1000_hw *hw = &adapter->hw; | 3343 | struct e1000_hw *hw = &adapter->hw; |
| 3332 | u32 rctl; | 3344 | u32 rctl; |
| 3333 | 3345 | ||
| 3346 | if (pm_runtime_suspended(netdev->dev.parent)) | ||
| 3347 | return; | ||
| 3348 | |||
| 3334 | /* Check for Promiscuous and All Multicast modes */ | 3349 | /* Check for Promiscuous and All Multicast modes */ |
| 3335 | rctl = er32(RCTL); | 3350 | rctl = er32(RCTL); |
| 3336 | 3351 | ||
| @@ -3691,10 +3706,6 @@ void e1000e_power_up_phy(struct e1000_adapter *adapter) | |||
| 3691 | */ | 3706 | */ |
| 3692 | static void e1000_power_down_phy(struct e1000_adapter *adapter) | 3707 | static void e1000_power_down_phy(struct e1000_adapter *adapter) |
| 3693 | { | 3708 | { |
| 3694 | /* WoL is enabled */ | ||
| 3695 | if (adapter->wol) | ||
| 3696 | return; | ||
| 3697 | |||
| 3698 | if (adapter->hw.phy.ops.power_down) | 3709 | if (adapter->hw.phy.ops.power_down) |
| 3699 | adapter->hw.phy.ops.power_down(&adapter->hw); | 3710 | adapter->hw.phy.ops.power_down(&adapter->hw); |
| 3700 | } | 3711 | } |
| @@ -3911,10 +3922,8 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
| 3911 | } | 3922 | } |
| 3912 | 3923 | ||
| 3913 | if (!netif_running(adapter->netdev) && | 3924 | if (!netif_running(adapter->netdev) && |
| 3914 | !test_bit(__E1000_TESTING, &adapter->state)) { | 3925 | !test_bit(__E1000_TESTING, &adapter->state)) |
| 3915 | e1000_power_down_phy(adapter); | 3926 | e1000_power_down_phy(adapter); |
| 3916 | return; | ||
| 3917 | } | ||
| 3918 | 3927 | ||
| 3919 | e1000_get_phy_info(hw); | 3928 | e1000_get_phy_info(hw); |
| 3920 | 3929 | ||
| @@ -3981,7 +3990,12 @@ static void e1000e_flush_descriptors(struct e1000_adapter *adapter) | |||
| 3981 | 3990 | ||
| 3982 | static void e1000e_update_stats(struct e1000_adapter *adapter); | 3991 | static void e1000e_update_stats(struct e1000_adapter *adapter); |
| 3983 | 3992 | ||
| 3984 | void e1000e_down(struct e1000_adapter *adapter) | 3993 | /** |
| 3994 | * e1000e_down - quiesce the device and optionally reset the hardware | ||
| 3995 | * @adapter: board private structure | ||
| 3996 | * @reset: boolean flag to reset the hardware or not | ||
| 3997 | */ | ||
| 3998 | void e1000e_down(struct e1000_adapter *adapter, bool reset) | ||
| 3985 | { | 3999 | { |
| 3986 | struct net_device *netdev = adapter->netdev; | 4000 | struct net_device *netdev = adapter->netdev; |
| 3987 | struct e1000_hw *hw = &adapter->hw; | 4001 | struct e1000_hw *hw = &adapter->hw; |
| @@ -4035,12 +4049,8 @@ void e1000e_down(struct e1000_adapter *adapter) | |||
| 4035 | e1000_lv_jumbo_workaround_ich8lan(hw, false)) | 4049 | e1000_lv_jumbo_workaround_ich8lan(hw, false)) |
| 4036 | e_dbg("failed to disable jumbo frame workaround mode\n"); | 4050 | e_dbg("failed to disable jumbo frame workaround mode\n"); |
| 4037 | 4051 | ||
| 4038 | if (!pci_channel_offline(adapter->pdev)) | 4052 | if (reset && !pci_channel_offline(adapter->pdev)) |
| 4039 | e1000e_reset(adapter); | 4053 | e1000e_reset(adapter); |
| 4040 | |||
| 4041 | /* TODO: for power management, we could drop the link and | ||
| 4042 | * pci_disable_device here. | ||
| 4043 | */ | ||
| 4044 | } | 4054 | } |
| 4045 | 4055 | ||
| 4046 | void e1000e_reinit_locked(struct e1000_adapter *adapter) | 4056 | void e1000e_reinit_locked(struct e1000_adapter *adapter) |
| @@ -4048,7 +4058,7 @@ void e1000e_reinit_locked(struct e1000_adapter *adapter) | |||
| 4048 | might_sleep(); | 4058 | might_sleep(); |
| 4049 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) | 4059 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
| 4050 | usleep_range(1000, 2000); | 4060 | usleep_range(1000, 2000); |
| 4051 | e1000e_down(adapter); | 4061 | e1000e_down(adapter, true); |
| 4052 | e1000e_up(adapter); | 4062 | e1000e_up(adapter); |
| 4053 | clear_bit(__E1000_RESETTING, &adapter->state); | 4063 | clear_bit(__E1000_RESETTING, &adapter->state); |
| 4054 | } | 4064 | } |
| @@ -4326,7 +4336,6 @@ static int e1000_open(struct net_device *netdev) | |||
| 4326 | adapter->tx_hang_recheck = false; | 4336 | adapter->tx_hang_recheck = false; |
| 4327 | netif_start_queue(netdev); | 4337 | netif_start_queue(netdev); |
| 4328 | 4338 | ||
| 4329 | adapter->idle_check = true; | ||
| 4330 | hw->mac.get_link_status = true; | 4339 | hw->mac.get_link_status = true; |
| 4331 | pm_runtime_put(&pdev->dev); | 4340 | pm_runtime_put(&pdev->dev); |
| 4332 | 4341 | ||
| @@ -4376,14 +4385,15 @@ static int e1000_close(struct net_device *netdev) | |||
| 4376 | pm_runtime_get_sync(&pdev->dev); | 4385 | pm_runtime_get_sync(&pdev->dev); |
| 4377 | 4386 | ||
| 4378 | if (!test_bit(__E1000_DOWN, &adapter->state)) { | 4387 | if (!test_bit(__E1000_DOWN, &adapter->state)) { |
| 4379 | e1000e_down(adapter); | 4388 | e1000e_down(adapter, true); |
| 4380 | e1000_free_irq(adapter); | 4389 | e1000_free_irq(adapter); |
| 4390 | |||
| 4391 | /* Link status message must follow this format */ | ||
| 4392 | pr_info("%s NIC Link is Down\n", adapter->netdev->name); | ||
| 4381 | } | 4393 | } |
| 4382 | 4394 | ||
| 4383 | napi_disable(&adapter->napi); | 4395 | napi_disable(&adapter->napi); |
| 4384 | 4396 | ||
| 4385 | e1000_power_down_phy(adapter); | ||
| 4386 | |||
| 4387 | e1000e_free_tx_resources(adapter->tx_ring); | 4397 | e1000e_free_tx_resources(adapter->tx_ring); |
| 4388 | e1000e_free_rx_resources(adapter->rx_ring); | 4398 | e1000e_free_rx_resources(adapter->rx_ring); |
| 4389 | 4399 | ||
| @@ -4460,11 +4470,16 @@ static void e1000e_update_phy_task(struct work_struct *work) | |||
| 4460 | struct e1000_adapter *adapter = container_of(work, | 4470 | struct e1000_adapter *adapter = container_of(work, |
| 4461 | struct e1000_adapter, | 4471 | struct e1000_adapter, |
| 4462 | update_phy_task); | 4472 | update_phy_task); |
| 4473 | struct e1000_hw *hw = &adapter->hw; | ||
| 4463 | 4474 | ||
| 4464 | if (test_bit(__E1000_DOWN, &adapter->state)) | 4475 | if (test_bit(__E1000_DOWN, &adapter->state)) |
| 4465 | return; | 4476 | return; |
| 4466 | 4477 | ||
| 4467 | e1000_get_phy_info(&adapter->hw); | 4478 | e1000_get_phy_info(hw); |
| 4479 | |||
| 4480 | /* Enable EEE on 82579 after link up */ | ||
| 4481 | if (hw->phy.type == e1000_phy_82579) | ||
| 4482 | e1000_set_eee_pchlan(hw); | ||
| 4468 | } | 4483 | } |
| 4469 | 4484 | ||
| 4470 | /** | 4485 | /** |
| @@ -4799,6 +4814,7 @@ static void e1000e_check_82574_phy_workaround(struct e1000_adapter *adapter) | |||
| 4799 | 4814 | ||
| 4800 | if (adapter->phy_hang_count > 1) { | 4815 | if (adapter->phy_hang_count > 1) { |
| 4801 | adapter->phy_hang_count = 0; | 4816 | adapter->phy_hang_count = 0; |
| 4817 | e_dbg("PHY appears hung - resetting\n"); | ||
| 4802 | schedule_work(&adapter->reset_task); | 4818 | schedule_work(&adapter->reset_task); |
| 4803 | } | 4819 | } |
| 4804 | } | 4820 | } |
| @@ -4957,15 +4973,11 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
| 4957 | mod_timer(&adapter->phy_info_timer, | 4973 | mod_timer(&adapter->phy_info_timer, |
| 4958 | round_jiffies(jiffies + 2 * HZ)); | 4974 | round_jiffies(jiffies + 2 * HZ)); |
| 4959 | 4975 | ||
| 4960 | /* The link is lost so the controller stops DMA. | 4976 | /* 8000ES2LAN requires a Rx packet buffer work-around |
| 4961 | * If there is queued Tx work that cannot be done | 4977 | * on link down event; reset the controller to flush |
| 4962 | * or if on an 8000ES2LAN which requires a Rx packet | 4978 | * the Rx packet buffer. |
| 4963 | * buffer work-around on link down event, reset the | ||
| 4964 | * controller to flush the Tx/Rx packet buffers. | ||
| 4965 | * (Do the reset outside of interrupt context). | ||
| 4966 | */ | 4979 | */ |
| 4967 | if ((adapter->flags & FLAG_RX_NEEDS_RESTART) || | 4980 | if (adapter->flags & FLAG_RX_NEEDS_RESTART) |
| 4968 | (e1000_desc_unused(tx_ring) + 1 < tx_ring->count)) | ||
| 4969 | adapter->flags |= FLAG_RESTART_NOW; | 4981 | adapter->flags |= FLAG_RESTART_NOW; |
| 4970 | else | 4982 | else |
| 4971 | pm_schedule_suspend(netdev->dev.parent, | 4983 | pm_schedule_suspend(netdev->dev.parent, |
| @@ -4988,6 +5000,15 @@ link_up: | |||
| 4988 | adapter->gotc_old = adapter->stats.gotc; | 5000 | adapter->gotc_old = adapter->stats.gotc; |
| 4989 | spin_unlock(&adapter->stats64_lock); | 5001 | spin_unlock(&adapter->stats64_lock); |
| 4990 | 5002 | ||
| 5003 | /* If the link is lost the controller stops DMA, but | ||
| 5004 | * if there is queued Tx work it cannot be done. So | ||
| 5005 | * reset the controller to flush the Tx packet buffers. | ||
| 5006 | */ | ||
| 5007 | if (!netif_carrier_ok(netdev) && | ||
| 5008 | (e1000_desc_unused(tx_ring) + 1 < tx_ring->count)) | ||
| 5009 | adapter->flags |= FLAG_RESTART_NOW; | ||
| 5010 | |||
| 5011 | /* If reset is necessary, do it outside of interrupt context. */ | ||
| 4991 | if (adapter->flags & FLAG_RESTART_NOW) { | 5012 | if (adapter->flags & FLAG_RESTART_NOW) { |
| 4992 | schedule_work(&adapter->reset_task); | 5013 | schedule_work(&adapter->reset_task); |
| 4993 | /* return immediately since reset is imminent */ | 5014 | /* return immediately since reset is imminent */ |
| @@ -5684,8 +5705,11 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
| 5684 | adapter->max_frame_size = max_frame; | 5705 | adapter->max_frame_size = max_frame; |
| 5685 | e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu); | 5706 | e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu); |
| 5686 | netdev->mtu = new_mtu; | 5707 | netdev->mtu = new_mtu; |
| 5708 | |||
| 5709 | pm_runtime_get_sync(netdev->dev.parent); | ||
| 5710 | |||
| 5687 | if (netif_running(netdev)) | 5711 | if (netif_running(netdev)) |
| 5688 | e1000e_down(adapter); | 5712 | e1000e_down(adapter, true); |
| 5689 | 5713 | ||
| 5690 | /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN | 5714 | /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN |
| 5691 | * means we reserve 2 more, this pushes us to allocate from the next | 5715 | * means we reserve 2 more, this pushes us to allocate from the next |
| @@ -5711,6 +5735,8 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
| 5711 | else | 5735 | else |
| 5712 | e1000e_reset(adapter); | 5736 | e1000e_reset(adapter); |
| 5713 | 5737 | ||
| 5738 | pm_runtime_put_sync(netdev->dev.parent); | ||
| 5739 | |||
| 5714 | clear_bit(__E1000_RESETTING, &adapter->state); | 5740 | clear_bit(__E1000_RESETTING, &adapter->state); |
| 5715 | 5741 | ||
| 5716 | return 0; | 5742 | return 0; |
| @@ -5852,7 +5878,7 @@ static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
| 5852 | static int e1000_init_phy_wakeup(struct e1000_adapter *adapter, u32 wufc) | 5878 | static int e1000_init_phy_wakeup(struct e1000_adapter *adapter, u32 wufc) |
| 5853 | { | 5879 | { |
| 5854 | struct e1000_hw *hw = &adapter->hw; | 5880 | struct e1000_hw *hw = &adapter->hw; |
| 5855 | u32 i, mac_reg; | 5881 | u32 i, mac_reg, wuc; |
| 5856 | u16 phy_reg, wuc_enable; | 5882 | u16 phy_reg, wuc_enable; |
| 5857 | int retval; | 5883 | int retval; |
| 5858 | 5884 | ||
| @@ -5899,13 +5925,18 @@ static int e1000_init_phy_wakeup(struct e1000_adapter *adapter, u32 wufc) | |||
| 5899 | phy_reg |= BM_RCTL_RFCE; | 5925 | phy_reg |= BM_RCTL_RFCE; |
| 5900 | hw->phy.ops.write_reg_page(&adapter->hw, BM_RCTL, phy_reg); | 5926 | hw->phy.ops.write_reg_page(&adapter->hw, BM_RCTL, phy_reg); |
| 5901 | 5927 | ||
| 5928 | wuc = E1000_WUC_PME_EN; | ||
| 5929 | if (wufc & (E1000_WUFC_MAG | E1000_WUFC_LNKC)) | ||
| 5930 | wuc |= E1000_WUC_APME; | ||
| 5931 | |||
| 5902 | /* enable PHY wakeup in MAC register */ | 5932 | /* enable PHY wakeup in MAC register */ |
| 5903 | ew32(WUFC, wufc); | 5933 | ew32(WUFC, wufc); |
| 5904 | ew32(WUC, E1000_WUC_PHY_WAKE | E1000_WUC_PME_EN); | 5934 | ew32(WUC, (E1000_WUC_PHY_WAKE | E1000_WUC_APMPME | |
| 5935 | E1000_WUC_PME_STATUS | wuc)); | ||
| 5905 | 5936 | ||
| 5906 | /* configure and enable PHY wakeup in PHY registers */ | 5937 | /* configure and enable PHY wakeup in PHY registers */ |
| 5907 | hw->phy.ops.write_reg_page(&adapter->hw, BM_WUFC, wufc); | 5938 | hw->phy.ops.write_reg_page(&adapter->hw, BM_WUFC, wufc); |
| 5908 | hw->phy.ops.write_reg_page(&adapter->hw, BM_WUC, E1000_WUC_PME_EN); | 5939 | hw->phy.ops.write_reg_page(&adapter->hw, BM_WUC, wuc); |
| 5909 | 5940 | ||
| 5910 | /* activate PHY wakeup */ | 5941 | /* activate PHY wakeup */ |
| 5911 | wuc_enable |= BM_WUC_ENABLE_BIT | BM_WUC_HOST_WU_BIT; | 5942 | wuc_enable |= BM_WUC_ENABLE_BIT | BM_WUC_HOST_WU_BIT; |
| @@ -5918,15 +5949,10 @@ release: | |||
| 5918 | return retval; | 5949 | return retval; |
| 5919 | } | 5950 | } |
| 5920 | 5951 | ||
| 5921 | static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) | 5952 | static int e1000e_pm_freeze(struct device *dev) |
| 5922 | { | 5953 | { |
| 5923 | struct net_device *netdev = pci_get_drvdata(pdev); | 5954 | struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev)); |
| 5924 | struct e1000_adapter *adapter = netdev_priv(netdev); | 5955 | struct e1000_adapter *adapter = netdev_priv(netdev); |
| 5925 | struct e1000_hw *hw = &adapter->hw; | ||
| 5926 | u32 ctrl, ctrl_ext, rctl, status; | ||
| 5927 | /* Runtime suspend should only enable wakeup for link changes */ | ||
| 5928 | u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; | ||
| 5929 | int retval = 0; | ||
| 5930 | 5956 | ||
| 5931 | netif_device_detach(netdev); | 5957 | netif_device_detach(netdev); |
| 5932 | 5958 | ||
| @@ -5937,11 +5963,29 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) | |||
| 5937 | usleep_range(10000, 20000); | 5963 | usleep_range(10000, 20000); |
| 5938 | 5964 | ||
| 5939 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); | 5965 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); |
| 5940 | e1000e_down(adapter); | 5966 | |
| 5967 | /* Quiesce the device without resetting the hardware */ | ||
| 5968 | e1000e_down(adapter, false); | ||
| 5941 | e1000_free_irq(adapter); | 5969 | e1000_free_irq(adapter); |
| 5942 | } | 5970 | } |
| 5943 | e1000e_reset_interrupt_capability(adapter); | 5971 | e1000e_reset_interrupt_capability(adapter); |
| 5944 | 5972 | ||
| 5973 | /* Allow time for pending master requests to run */ | ||
| 5974 | e1000e_disable_pcie_master(&adapter->hw); | ||
| 5975 | |||
| 5976 | return 0; | ||
| 5977 | } | ||
| 5978 | |||
| 5979 | static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) | ||
| 5980 | { | ||
| 5981 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
| 5982 | struct e1000_adapter *adapter = netdev_priv(netdev); | ||
| 5983 | struct e1000_hw *hw = &adapter->hw; | ||
| 5984 | u32 ctrl, ctrl_ext, rctl, status; | ||
| 5985 | /* Runtime suspend should only enable wakeup for link changes */ | ||
| 5986 | u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; | ||
| 5987 | int retval = 0; | ||
| 5988 | |||
| 5945 | status = er32(STATUS); | 5989 | status = er32(STATUS); |
| 5946 | if (status & E1000_STATUS_LU) | 5990 | if (status & E1000_STATUS_LU) |
| 5947 | wufc &= ~E1000_WUFC_LNKC; | 5991 | wufc &= ~E1000_WUFC_LNKC; |
| @@ -5972,12 +6016,12 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) | |||
| 5972 | ew32(CTRL_EXT, ctrl_ext); | 6016 | ew32(CTRL_EXT, ctrl_ext); |
| 5973 | } | 6017 | } |
| 5974 | 6018 | ||
| 6019 | if (!runtime) | ||
| 6020 | e1000e_power_up_phy(adapter); | ||
| 6021 | |||
| 5975 | if (adapter->flags & FLAG_IS_ICH) | 6022 | if (adapter->flags & FLAG_IS_ICH) |
| 5976 | e1000_suspend_workarounds_ich8lan(&adapter->hw); | 6023 | e1000_suspend_workarounds_ich8lan(&adapter->hw); |
| 5977 | 6024 | ||
| 5978 | /* Allow time for pending master requests to run */ | ||
| 5979 | e1000e_disable_pcie_master(&adapter->hw); | ||
| 5980 | |||
| 5981 | if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) { | 6025 | if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) { |
| 5982 | /* enable wakeup by the PHY */ | 6026 | /* enable wakeup by the PHY */ |
| 5983 | retval = e1000_init_phy_wakeup(adapter, wufc); | 6027 | retval = e1000_init_phy_wakeup(adapter, wufc); |
| @@ -5991,10 +6035,23 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) | |||
| 5991 | } else { | 6035 | } else { |
| 5992 | ew32(WUC, 0); | 6036 | ew32(WUC, 0); |
| 5993 | ew32(WUFC, 0); | 6037 | ew32(WUFC, 0); |
| 6038 | |||
| 6039 | e1000_power_down_phy(adapter); | ||
| 5994 | } | 6040 | } |
| 5995 | 6041 | ||
| 5996 | if (adapter->hw.phy.type == e1000_phy_igp_3) | 6042 | if (adapter->hw.phy.type == e1000_phy_igp_3) { |
| 5997 | e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); | 6043 | e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); |
| 6044 | } else if (hw->mac.type == e1000_pch_lpt) { | ||
| 6045 | if (!(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) | ||
| 6046 | /* ULP does not support wake from unicast, multicast | ||
| 6047 | * or broadcast. | ||
| 6048 | */ | ||
| 6049 | retval = e1000_enable_ulp_lpt_lp(hw, !runtime); | ||
| 6050 | |||
| 6051 | if (retval) | ||
| 6052 | return retval; | ||
| 6053 | } | ||
| 6054 | |||
| 5998 | 6055 | ||
| 5999 | /* Release control of h/w to f/w. If f/w is AMT enabled, this | 6056 | /* Release control of h/w to f/w. If f/w is AMT enabled, this |
| 6000 | * would have already happened in close and is redundant. | 6057 | * would have already happened in close and is redundant. |
| @@ -6102,18 +6159,12 @@ static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | |||
| 6102 | } | 6159 | } |
| 6103 | 6160 | ||
| 6104 | #ifdef CONFIG_PM | 6161 | #ifdef CONFIG_PM |
| 6105 | static bool e1000e_pm_ready(struct e1000_adapter *adapter) | ||
| 6106 | { | ||
| 6107 | return !!adapter->tx_ring->buffer_info; | ||
| 6108 | } | ||
| 6109 | |||
| 6110 | static int __e1000_resume(struct pci_dev *pdev) | 6162 | static int __e1000_resume(struct pci_dev *pdev) |
| 6111 | { | 6163 | { |
| 6112 | struct net_device *netdev = pci_get_drvdata(pdev); | 6164 | struct net_device *netdev = pci_get_drvdata(pdev); |
| 6113 | struct e1000_adapter *adapter = netdev_priv(netdev); | 6165 | struct e1000_adapter *adapter = netdev_priv(netdev); |
| 6114 | struct e1000_hw *hw = &adapter->hw; | 6166 | struct e1000_hw *hw = &adapter->hw; |
| 6115 | u16 aspm_disable_flag = 0; | 6167 | u16 aspm_disable_flag = 0; |
| 6116 | u32 err; | ||
| 6117 | 6168 | ||
| 6118 | if (adapter->flags2 & FLAG2_DISABLE_ASPM_L0S) | 6169 | if (adapter->flags2 & FLAG2_DISABLE_ASPM_L0S) |
| 6119 | aspm_disable_flag = PCIE_LINK_STATE_L0S; | 6170 | aspm_disable_flag = PCIE_LINK_STATE_L0S; |
| @@ -6124,13 +6175,6 @@ static int __e1000_resume(struct pci_dev *pdev) | |||
| 6124 | 6175 | ||
| 6125 | pci_set_master(pdev); | 6176 | pci_set_master(pdev); |
| 6126 | 6177 | ||
| 6127 | e1000e_set_interrupt_capability(adapter); | ||
| 6128 | if (netif_running(netdev)) { | ||
| 6129 | err = e1000_request_irq(adapter); | ||
| 6130 | if (err) | ||
| 6131 | return err; | ||
| 6132 | } | ||
| 6133 | |||
| 6134 | if (hw->mac.type >= e1000_pch2lan) | 6178 | if (hw->mac.type >= e1000_pch2lan) |
| 6135 | e1000_resume_workarounds_pchlan(&adapter->hw); | 6179 | e1000_resume_workarounds_pchlan(&adapter->hw); |
| 6136 | 6180 | ||
| @@ -6169,11 +6213,6 @@ static int __e1000_resume(struct pci_dev *pdev) | |||
| 6169 | 6213 | ||
| 6170 | e1000_init_manageability_pt(adapter); | 6214 | e1000_init_manageability_pt(adapter); |
| 6171 | 6215 | ||
| 6172 | if (netif_running(netdev)) | ||
| 6173 | e1000e_up(adapter); | ||
| 6174 | |||
| 6175 | netif_device_attach(netdev); | ||
| 6176 | |||
| 6177 | /* If the controller has AMT, do not set DRV_LOAD until the interface | 6216 | /* If the controller has AMT, do not set DRV_LOAD until the interface |
| 6178 | * is up. For all other cases, let the f/w know that the h/w is now | 6217 | * is up. For all other cases, let the f/w know that the h/w is now |
| 6179 | * under the control of the driver. | 6218 | * under the control of the driver. |
| @@ -6184,75 +6223,111 @@ static int __e1000_resume(struct pci_dev *pdev) | |||
| 6184 | return 0; | 6223 | return 0; |
| 6185 | } | 6224 | } |
| 6186 | 6225 | ||
| 6226 | static int e1000e_pm_thaw(struct device *dev) | ||
| 6227 | { | ||
| 6228 | struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev)); | ||
| 6229 | struct e1000_adapter *adapter = netdev_priv(netdev); | ||
| 6230 | |||
| 6231 | e1000e_set_interrupt_capability(adapter); | ||
| 6232 | if (netif_running(netdev)) { | ||
| 6233 | u32 err = e1000_request_irq(adapter); | ||
| 6234 | |||
| 6235 | if (err) | ||
| 6236 | return err; | ||
| 6237 | |||
| 6238 | e1000e_up(adapter); | ||
| 6239 | } | ||
| 6240 | |||
| 6241 | netif_device_attach(netdev); | ||
| 6242 | |||
| 6243 | return 0; | ||
| 6244 | } | ||
| 6245 | |||
| 6187 | #ifdef CONFIG_PM_SLEEP | 6246 | #ifdef CONFIG_PM_SLEEP |
| 6188 | static int e1000_suspend(struct device *dev) | 6247 | static int e1000e_pm_suspend(struct device *dev) |
| 6189 | { | 6248 | { |
| 6190 | struct pci_dev *pdev = to_pci_dev(dev); | 6249 | struct pci_dev *pdev = to_pci_dev(dev); |
| 6191 | 6250 | ||
| 6251 | e1000e_pm_freeze(dev); | ||
| 6252 | |||
| 6192 | return __e1000_shutdown(pdev, false); | 6253 | return __e1000_shutdown(pdev, false); |
| 6193 | } | 6254 | } |
| 6194 | 6255 | ||
| 6195 | static int e1000_resume(struct device *dev) | 6256 | static int e1000e_pm_resume(struct device *dev) |
| 6196 | { | 6257 | { |
| 6197 | struct pci_dev *pdev = to_pci_dev(dev); | 6258 | struct pci_dev *pdev = to_pci_dev(dev); |
| 6198 | struct net_device *netdev = pci_get_drvdata(pdev); | 6259 | int rc; |
| 6199 | struct e1000_adapter *adapter = netdev_priv(netdev); | ||
| 6200 | 6260 | ||
| 6201 | if (e1000e_pm_ready(adapter)) | 6261 | rc = __e1000_resume(pdev); |
| 6202 | adapter->idle_check = true; | 6262 | if (rc) |
| 6263 | return rc; | ||
| 6203 | 6264 | ||
| 6204 | return __e1000_resume(pdev); | 6265 | return e1000e_pm_thaw(dev); |
| 6205 | } | 6266 | } |
| 6206 | #endif /* CONFIG_PM_SLEEP */ | 6267 | #endif /* CONFIG_PM_SLEEP */ |
| 6207 | 6268 | ||
| 6208 | #ifdef CONFIG_PM_RUNTIME | 6269 | #ifdef CONFIG_PM_RUNTIME |
| 6209 | static int e1000_runtime_suspend(struct device *dev) | 6270 | static int e1000e_pm_runtime_idle(struct device *dev) |
| 6210 | { | 6271 | { |
| 6211 | struct pci_dev *pdev = to_pci_dev(dev); | 6272 | struct pci_dev *pdev = to_pci_dev(dev); |
| 6212 | struct net_device *netdev = pci_get_drvdata(pdev); | 6273 | struct net_device *netdev = pci_get_drvdata(pdev); |
| 6213 | struct e1000_adapter *adapter = netdev_priv(netdev); | 6274 | struct e1000_adapter *adapter = netdev_priv(netdev); |
| 6214 | 6275 | ||
| 6215 | if (!e1000e_pm_ready(adapter)) | 6276 | if (!e1000e_has_link(adapter)) |
| 6216 | return 0; | 6277 | pm_schedule_suspend(dev, 5 * MSEC_PER_SEC); |
| 6217 | 6278 | ||
| 6218 | return __e1000_shutdown(pdev, true); | 6279 | return -EBUSY; |
| 6219 | } | 6280 | } |
| 6220 | 6281 | ||
| 6221 | static int e1000_idle(struct device *dev) | 6282 | static int e1000e_pm_runtime_resume(struct device *dev) |
| 6222 | { | 6283 | { |
| 6223 | struct pci_dev *pdev = to_pci_dev(dev); | 6284 | struct pci_dev *pdev = to_pci_dev(dev); |
| 6224 | struct net_device *netdev = pci_get_drvdata(pdev); | 6285 | struct net_device *netdev = pci_get_drvdata(pdev); |
| 6225 | struct e1000_adapter *adapter = netdev_priv(netdev); | 6286 | struct e1000_adapter *adapter = netdev_priv(netdev); |
| 6287 | int rc; | ||
| 6226 | 6288 | ||
| 6227 | if (!e1000e_pm_ready(adapter)) | 6289 | rc = __e1000_resume(pdev); |
| 6228 | return 0; | 6290 | if (rc) |
| 6291 | return rc; | ||
| 6229 | 6292 | ||
| 6230 | if (adapter->idle_check) { | 6293 | if (netdev->flags & IFF_UP) |
| 6231 | adapter->idle_check = false; | 6294 | rc = e1000e_up(adapter); |
| 6232 | if (!e1000e_has_link(adapter)) | ||
| 6233 | pm_schedule_suspend(dev, MSEC_PER_SEC); | ||
| 6234 | } | ||
| 6235 | 6295 | ||
| 6236 | return -EBUSY; | 6296 | return rc; |
| 6237 | } | 6297 | } |
| 6238 | 6298 | ||
| 6239 | static int e1000_runtime_resume(struct device *dev) | 6299 | static int e1000e_pm_runtime_suspend(struct device *dev) |
| 6240 | { | 6300 | { |
| 6241 | struct pci_dev *pdev = to_pci_dev(dev); | 6301 | struct pci_dev *pdev = to_pci_dev(dev); |
| 6242 | struct net_device *netdev = pci_get_drvdata(pdev); | 6302 | struct net_device *netdev = pci_get_drvdata(pdev); |
| 6243 | struct e1000_adapter *adapter = netdev_priv(netdev); | 6303 | struct e1000_adapter *adapter = netdev_priv(netdev); |
| 6244 | 6304 | ||
| 6245 | if (!e1000e_pm_ready(adapter)) | 6305 | if (netdev->flags & IFF_UP) { |
| 6246 | return 0; | 6306 | int count = E1000_CHECK_RESET_COUNT; |
| 6247 | 6307 | ||
| 6248 | adapter->idle_check = !dev->power.runtime_auto; | 6308 | while (test_bit(__E1000_RESETTING, &adapter->state) && count--) |
| 6249 | return __e1000_resume(pdev); | 6309 | usleep_range(10000, 20000); |
| 6310 | |||
| 6311 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); | ||
| 6312 | |||
| 6313 | /* Down the device without resetting the hardware */ | ||
| 6314 | e1000e_down(adapter, false); | ||
| 6315 | } | ||
| 6316 | |||
| 6317 | if (__e1000_shutdown(pdev, true)) { | ||
| 6318 | e1000e_pm_runtime_resume(dev); | ||
| 6319 | return -EBUSY; | ||
| 6320 | } | ||
| 6321 | |||
| 6322 | return 0; | ||
| 6250 | } | 6323 | } |
| 6251 | #endif /* CONFIG_PM_RUNTIME */ | 6324 | #endif /* CONFIG_PM_RUNTIME */ |
| 6252 | #endif /* CONFIG_PM */ | 6325 | #endif /* CONFIG_PM */ |
| 6253 | 6326 | ||
| 6254 | static void e1000_shutdown(struct pci_dev *pdev) | 6327 | static void e1000_shutdown(struct pci_dev *pdev) |
| 6255 | { | 6328 | { |
| 6329 | e1000e_pm_freeze(&pdev->dev); | ||
| 6330 | |||
| 6256 | __e1000_shutdown(pdev, false); | 6331 | __e1000_shutdown(pdev, false); |
| 6257 | } | 6332 | } |
| 6258 | 6333 | ||
| @@ -6338,7 +6413,7 @@ static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, | |||
| 6338 | return PCI_ERS_RESULT_DISCONNECT; | 6413 | return PCI_ERS_RESULT_DISCONNECT; |
| 6339 | 6414 | ||
| 6340 | if (netif_running(netdev)) | 6415 | if (netif_running(netdev)) |
| 6341 | e1000e_down(adapter); | 6416 | e1000e_down(adapter, true); |
| 6342 | pci_disable_device(pdev); | 6417 | pci_disable_device(pdev); |
| 6343 | 6418 | ||
| 6344 | /* Request a slot slot reset. */ | 6419 | /* Request a slot slot reset. */ |
| @@ -6350,7 +6425,7 @@ static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, | |||
| 6350 | * @pdev: Pointer to PCI device | 6425 | * @pdev: Pointer to PCI device |
| 6351 | * | 6426 | * |
| 6352 | * Restart the card from scratch, as if from a cold-boot. Implementation | 6427 | * Restart the card from scratch, as if from a cold-boot. Implementation |
| 6353 | * resembles the first-half of the e1000_resume routine. | 6428 | * resembles the first-half of the e1000e_pm_resume routine. |
| 6354 | */ | 6429 | */ |
| 6355 | static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev) | 6430 | static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev) |
| 6356 | { | 6431 | { |
| @@ -6397,7 +6472,7 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev) | |||
| 6397 | * | 6472 | * |
| 6398 | * This callback is called when the error recovery driver tells us that | 6473 | * This callback is called when the error recovery driver tells us that |
| 6399 | * its OK to resume normal operation. Implementation resembles the | 6474 | * its OK to resume normal operation. Implementation resembles the |
| 6400 | * second-half of the e1000_resume routine. | 6475 | * second-half of the e1000e_pm_resume routine. |
| 6401 | */ | 6476 | */ |
| 6402 | static void e1000_io_resume(struct pci_dev *pdev) | 6477 | static void e1000_io_resume(struct pci_dev *pdev) |
| 6403 | { | 6478 | { |
| @@ -6902,9 +6977,6 @@ static void e1000_remove(struct pci_dev *pdev) | |||
| 6902 | } | 6977 | } |
| 6903 | } | 6978 | } |
| 6904 | 6979 | ||
| 6905 | if (!(netdev->flags & IFF_UP)) | ||
| 6906 | e1000_power_down_phy(adapter); | ||
| 6907 | |||
| 6908 | /* Don't lie to e1000_close() down the road. */ | 6980 | /* Don't lie to e1000_close() down the road. */ |
| 6909 | if (!down) | 6981 | if (!down) |
| 6910 | clear_bit(__E1000_DOWN, &adapter->state); | 6982 | clear_bit(__E1000_DOWN, &adapter->state); |
| @@ -7026,9 +7098,16 @@ static DEFINE_PCI_DEVICE_TABLE(e1000_pci_tbl) = { | |||
| 7026 | MODULE_DEVICE_TABLE(pci, e1000_pci_tbl); | 7098 | MODULE_DEVICE_TABLE(pci, e1000_pci_tbl); |
| 7027 | 7099 | ||
| 7028 | static const struct dev_pm_ops e1000_pm_ops = { | 7100 | static const struct dev_pm_ops e1000_pm_ops = { |
| 7029 | SET_SYSTEM_SLEEP_PM_OPS(e1000_suspend, e1000_resume) | 7101 | #ifdef CONFIG_PM_SLEEP |
| 7030 | SET_RUNTIME_PM_OPS(e1000_runtime_suspend, e1000_runtime_resume, | 7102 | .suspend = e1000e_pm_suspend, |
| 7031 | e1000_idle) | 7103 | .resume = e1000e_pm_resume, |
| 7104 | .freeze = e1000e_pm_freeze, | ||
| 7105 | .thaw = e1000e_pm_thaw, | ||
| 7106 | .poweroff = e1000e_pm_suspend, | ||
| 7107 | .restore = e1000e_pm_resume, | ||
| 7108 | #endif | ||
| 7109 | SET_RUNTIME_PM_OPS(e1000e_pm_runtime_suspend, e1000e_pm_runtime_resume, | ||
| 7110 | e1000e_pm_runtime_idle) | ||
| 7032 | }; | 7111 | }; |
| 7033 | 7112 | ||
| 7034 | /* PCI Device API Driver */ | 7113 | /* PCI Device API Driver */ |
| @@ -7055,7 +7134,7 @@ static int __init e1000_init_module(void) | |||
| 7055 | int ret; | 7134 | int ret; |
| 7056 | pr_info("Intel(R) PRO/1000 Network Driver - %s\n", | 7135 | pr_info("Intel(R) PRO/1000 Network Driver - %s\n", |
| 7057 | e1000e_driver_version); | 7136 | e1000e_driver_version); |
| 7058 | pr_info("Copyright(c) 1999 - 2013 Intel Corporation.\n"); | 7137 | pr_info("Copyright(c) 1999 - 2014 Intel Corporation.\n"); |
| 7059 | ret = pci_register_driver(&e1000_driver); | 7138 | ret = pci_register_driver(&e1000_driver); |
| 7060 | 7139 | ||
| 7061 | return ret; | 7140 | return ret; |
