diff options
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 385 |
1 files changed, 229 insertions, 156 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 97e71a4fe8eb..a373ccb308d8 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | 3 | ||
4 | Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. | 4 | Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms of the GNU General Public License as published by the Free | 7 | under the terms of the GNU General Public License as published by the Free |
@@ -22,51 +22,13 @@ | |||
22 | 22 | ||
23 | Contact Information: | 23 | Contact Information: |
24 | Linux NICS <linux.nics@intel.com> | 24 | Linux NICS <linux.nics@intel.com> |
25 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||
25 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
26 | 27 | ||
27 | *******************************************************************************/ | 28 | *******************************************************************************/ |
28 | 29 | ||
29 | #include "e1000.h" | 30 | #include "e1000.h" |
30 | 31 | ||
31 | /* Change Log | ||
32 | * 7.0.33 3-Feb-2006 | ||
33 | * o Added another fix for the pass false carrier bit | ||
34 | * 7.0.32 24-Jan-2006 | ||
35 | * o Need to rebuild with noew version number for the pass false carrier | ||
36 | * fix in e1000_hw.c | ||
37 | * 7.0.30 18-Jan-2006 | ||
38 | * o fixup for tso workaround to disable it for pci-x | ||
39 | * o fix mem leak on 82542 | ||
40 | * o fixes for 10 Mb/s connections and incorrect stats | ||
41 | * 7.0.28 01/06/2006 | ||
42 | * o hardware workaround to only set "speed mode" bit for 1G link. | ||
43 | * 7.0.26 12/23/2005 | ||
44 | * o wake on lan support modified for device ID 10B5 | ||
45 | * o fix dhcp + vlan issue not making it to the iAMT firmware | ||
46 | * 7.0.24 12/9/2005 | ||
47 | * o New hardware support for the Gigabit NIC embedded in the south bridge | ||
48 | * o Fixes to the recycling logic (skb->tail) from IBM LTC | ||
49 | * 6.3.9 12/16/2005 | ||
50 | * o incorporate fix for recycled skbs from IBM LTC | ||
51 | * 6.3.7 11/18/2005 | ||
52 | * o Honor eeprom setting for enabling/disabling Wake On Lan | ||
53 | * 6.3.5 11/17/2005 | ||
54 | * o Fix memory leak in rx ring handling for PCI Express adapters | ||
55 | * 6.3.4 11/8/05 | ||
56 | * o Patch from Jesper Juhl to remove redundant NULL checks for kfree | ||
57 | * 6.3.2 9/20/05 | ||
58 | * o Render logic that sets/resets DRV_LOAD as inline functions to | ||
59 | * avoid code replication. If f/w is AMT then set DRV_LOAD only when | ||
60 | * network interface is open. | ||
61 | * o Handle DRV_LOAD set/reset in cases where AMT uses VLANs. | ||
62 | * o Adjust PBA partioning for Jumbo frames using MTU size and not | ||
63 | * rx_buffer_len | ||
64 | * 6.3.1 9/19/05 | ||
65 | * o Use adapter->tx_timeout_factor in Tx Hung Detect logic | ||
66 | * (e1000_clean_tx_irq) | ||
67 | * o Support for 8086:10B5 device (Quad Port) | ||
68 | */ | ||
69 | |||
70 | char e1000_driver_name[] = "e1000"; | 32 | char e1000_driver_name[] = "e1000"; |
71 | static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | 33 | static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; |
72 | #ifndef CONFIG_E1000_NAPI | 34 | #ifndef CONFIG_E1000_NAPI |
@@ -74,9 +36,9 @@ static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | |||
74 | #else | 36 | #else |
75 | #define DRIVERNAPI "-NAPI" | 37 | #define DRIVERNAPI "-NAPI" |
76 | #endif | 38 | #endif |
77 | #define DRV_VERSION "7.0.33-k2"DRIVERNAPI | 39 | #define DRV_VERSION "7.0.38-k4"DRIVERNAPI |
78 | char e1000_driver_version[] = DRV_VERSION; | 40 | char e1000_driver_version[] = DRV_VERSION; |
79 | static char e1000_copyright[] = "Copyright (c) 1999-2005 Intel Corporation."; | 41 | static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; |
80 | 42 | ||
81 | /* e1000_pci_tbl - PCI Device ID Table | 43 | /* e1000_pci_tbl - PCI Device ID Table |
82 | * | 44 | * |
@@ -208,8 +170,8 @@ static void e1000_leave_82542_rst(struct e1000_adapter *adapter); | |||
208 | static void e1000_tx_timeout(struct net_device *dev); | 170 | static void e1000_tx_timeout(struct net_device *dev); |
209 | static void e1000_reset_task(struct net_device *dev); | 171 | static void e1000_reset_task(struct net_device *dev); |
210 | static void e1000_smartspeed(struct e1000_adapter *adapter); | 172 | static void e1000_smartspeed(struct e1000_adapter *adapter); |
211 | static inline int e1000_82547_fifo_workaround(struct e1000_adapter *adapter, | 173 | static int e1000_82547_fifo_workaround(struct e1000_adapter *adapter, |
212 | struct sk_buff *skb); | 174 | struct sk_buff *skb); |
213 | 175 | ||
214 | static void e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp); | 176 | static void e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp); |
215 | static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid); | 177 | static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid); |
@@ -227,6 +189,16 @@ static void e1000_shutdown(struct pci_dev *pdev); | |||
227 | static void e1000_netpoll (struct net_device *netdev); | 189 | static void e1000_netpoll (struct net_device *netdev); |
228 | #endif | 190 | #endif |
229 | 191 | ||
192 | static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, | ||
193 | pci_channel_state_t state); | ||
194 | static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev); | ||
195 | static void e1000_io_resume(struct pci_dev *pdev); | ||
196 | |||
197 | static struct pci_error_handlers e1000_err_handler = { | ||
198 | .error_detected = e1000_io_error_detected, | ||
199 | .slot_reset = e1000_io_slot_reset, | ||
200 | .resume = e1000_io_resume, | ||
201 | }; | ||
230 | 202 | ||
231 | static struct pci_driver e1000_driver = { | 203 | static struct pci_driver e1000_driver = { |
232 | .name = e1000_driver_name, | 204 | .name = e1000_driver_name, |
@@ -238,7 +210,8 @@ static struct pci_driver e1000_driver = { | |||
238 | .suspend = e1000_suspend, | 210 | .suspend = e1000_suspend, |
239 | .resume = e1000_resume, | 211 | .resume = e1000_resume, |
240 | #endif | 212 | #endif |
241 | .shutdown = e1000_shutdown | 213 | .shutdown = e1000_shutdown, |
214 | .err_handler = &e1000_err_handler | ||
242 | }; | 215 | }; |
243 | 216 | ||
244 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); | 217 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); |
@@ -293,7 +266,7 @@ module_exit(e1000_exit_module); | |||
293 | * @adapter: board private structure | 266 | * @adapter: board private structure |
294 | **/ | 267 | **/ |
295 | 268 | ||
296 | static inline void | 269 | static void |
297 | e1000_irq_disable(struct e1000_adapter *adapter) | 270 | e1000_irq_disable(struct e1000_adapter *adapter) |
298 | { | 271 | { |
299 | atomic_inc(&adapter->irq_sem); | 272 | atomic_inc(&adapter->irq_sem); |
@@ -307,7 +280,7 @@ e1000_irq_disable(struct e1000_adapter *adapter) | |||
307 | * @adapter: board private structure | 280 | * @adapter: board private structure |
308 | **/ | 281 | **/ |
309 | 282 | ||
310 | static inline void | 283 | static void |
311 | e1000_irq_enable(struct e1000_adapter *adapter) | 284 | e1000_irq_enable(struct e1000_adapter *adapter) |
312 | { | 285 | { |
313 | if (likely(atomic_dec_and_test(&adapter->irq_sem))) { | 286 | if (likely(atomic_dec_and_test(&adapter->irq_sem))) { |
@@ -348,10 +321,10 @@ e1000_update_mng_vlan(struct e1000_adapter *adapter) | |||
348 | * For ASF and Pass Through versions of f/w this means that the | 321 | * For ASF and Pass Through versions of f/w this means that the |
349 | * driver is no longer loaded. For AMT version (only with 82573) i | 322 | * driver is no longer loaded. For AMT version (only with 82573) i |
350 | * of the f/w this means that the netowrk i/f is closed. | 323 | * of the f/w this means that the netowrk i/f is closed. |
351 | * | 324 | * |
352 | **/ | 325 | **/ |
353 | 326 | ||
354 | static inline void | 327 | static void |
355 | e1000_release_hw_control(struct e1000_adapter *adapter) | 328 | e1000_release_hw_control(struct e1000_adapter *adapter) |
356 | { | 329 | { |
357 | uint32_t ctrl_ext; | 330 | uint32_t ctrl_ext; |
@@ -361,6 +334,7 @@ e1000_release_hw_control(struct e1000_adapter *adapter) | |||
361 | switch (adapter->hw.mac_type) { | 334 | switch (adapter->hw.mac_type) { |
362 | case e1000_82571: | 335 | case e1000_82571: |
363 | case e1000_82572: | 336 | case e1000_82572: |
337 | case e1000_80003es2lan: | ||
364 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); | 338 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); |
365 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | 339 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, |
366 | ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); | 340 | ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); |
@@ -379,13 +353,13 @@ e1000_release_hw_control(struct e1000_adapter *adapter) | |||
379 | * @adapter: address of board private structure | 353 | * @adapter: address of board private structure |
380 | * | 354 | * |
381 | * e1000_get_hw_control sets {CTRL_EXT|FWSM}:DRV_LOAD bit. | 355 | * e1000_get_hw_control sets {CTRL_EXT|FWSM}:DRV_LOAD bit. |
382 | * For ASF and Pass Through versions of f/w this means that | 356 | * For ASF and Pass Through versions of f/w this means that |
383 | * the driver is loaded. For AMT version (only with 82573) | 357 | * the driver is loaded. For AMT version (only with 82573) |
384 | * of the f/w this means that the netowrk i/f is open. | 358 | * of the f/w this means that the netowrk i/f is open. |
385 | * | 359 | * |
386 | **/ | 360 | **/ |
387 | 361 | ||
388 | static inline void | 362 | static void |
389 | e1000_get_hw_control(struct e1000_adapter *adapter) | 363 | e1000_get_hw_control(struct e1000_adapter *adapter) |
390 | { | 364 | { |
391 | uint32_t ctrl_ext; | 365 | uint32_t ctrl_ext; |
@@ -394,6 +368,7 @@ e1000_get_hw_control(struct e1000_adapter *adapter) | |||
394 | switch (adapter->hw.mac_type) { | 368 | switch (adapter->hw.mac_type) { |
395 | case e1000_82571: | 369 | case e1000_82571: |
396 | case e1000_82572: | 370 | case e1000_82572: |
371 | case e1000_80003es2lan: | ||
397 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); | 372 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); |
398 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | 373 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, |
399 | ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); | 374 | ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); |
@@ -421,7 +396,7 @@ e1000_up(struct e1000_adapter *adapter) | |||
421 | uint16_t mii_reg; | 396 | uint16_t mii_reg; |
422 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); | 397 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); |
423 | if (mii_reg & MII_CR_POWER_DOWN) | 398 | if (mii_reg & MII_CR_POWER_DOWN) |
424 | e1000_phy_reset(&adapter->hw); | 399 | e1000_phy_hw_reset(&adapter->hw); |
425 | } | 400 | } |
426 | 401 | ||
427 | e1000_set_multi(netdev); | 402 | e1000_set_multi(netdev); |
@@ -711,8 +686,8 @@ e1000_probe(struct pci_dev *pdev, | |||
711 | DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n"); | 686 | DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n"); |
712 | 687 | ||
713 | /* if ksp3, indicate if it's port a being setup */ | 688 | /* if ksp3, indicate if it's port a being setup */ |
714 | if (pdev->device == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 && | 689 | if (pdev->device == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 && |
715 | e1000_ksp3_port_a == 0) | 690 | e1000_ksp3_port_a == 0) |
716 | adapter->ksp3_port_a = 1; | 691 | adapter->ksp3_port_a = 1; |
717 | e1000_ksp3_port_a++; | 692 | e1000_ksp3_port_a++; |
718 | /* Reset for multiple KP3 adapters */ | 693 | /* Reset for multiple KP3 adapters */ |
@@ -740,9 +715,9 @@ e1000_probe(struct pci_dev *pdev, | |||
740 | if (pci_using_dac) | 715 | if (pci_using_dac) |
741 | netdev->features |= NETIF_F_HIGHDMA; | 716 | netdev->features |= NETIF_F_HIGHDMA; |
742 | 717 | ||
743 | /* hard_start_xmit is safe against parallel locking */ | 718 | /* hard_start_xmit is safe against parallel locking */ |
744 | netdev->features |= NETIF_F_LLTX; | 719 | netdev->features |= NETIF_F_LLTX; |
745 | 720 | ||
746 | adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw); | 721 | adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw); |
747 | 722 | ||
748 | /* before reading the EEPROM, reset the controller to | 723 | /* before reading the EEPROM, reset the controller to |
@@ -972,8 +947,8 @@ e1000_sw_init(struct e1000_adapter *adapter) | |||
972 | 947 | ||
973 | pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word); | 948 | pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word); |
974 | 949 | ||
975 | adapter->rx_buffer_len = E1000_RXBUFFER_2048; | 950 | adapter->rx_buffer_len = MAXIMUM_ETHERNET_FRAME_SIZE; |
976 | adapter->rx_ps_bsize0 = E1000_RXBUFFER_256; | 951 | adapter->rx_ps_bsize0 = E1000_RXBUFFER_128; |
977 | hw->max_frame_size = netdev->mtu + | 952 | hw->max_frame_size = netdev->mtu + |
978 | ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; | 953 | ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; |
979 | hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE; | 954 | hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE; |
@@ -1181,7 +1156,7 @@ e1000_close(struct net_device *netdev) | |||
1181 | * @start: address of beginning of memory | 1156 | * @start: address of beginning of memory |
1182 | * @len: length of memory | 1157 | * @len: length of memory |
1183 | **/ | 1158 | **/ |
1184 | static inline boolean_t | 1159 | static boolean_t |
1185 | e1000_check_64k_bound(struct e1000_adapter *adapter, | 1160 | e1000_check_64k_bound(struct e1000_adapter *adapter, |
1186 | void *start, unsigned long len) | 1161 | void *start, unsigned long len) |
1187 | { | 1162 | { |
@@ -1599,14 +1574,21 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1599 | rctl |= E1000_RCTL_LPE; | 1574 | rctl |= E1000_RCTL_LPE; |
1600 | 1575 | ||
1601 | /* Setup buffer sizes */ | 1576 | /* Setup buffer sizes */ |
1602 | if (adapter->hw.mac_type >= e1000_82571) { | 1577 | rctl &= ~E1000_RCTL_SZ_4096; |
1603 | /* We can now specify buffers in 1K increments. | 1578 | rctl |= E1000_RCTL_BSEX; |
1604 | * BSIZE and BSEX are ignored in this case. */ | 1579 | switch (adapter->rx_buffer_len) { |
1605 | rctl |= adapter->rx_buffer_len << 0x11; | 1580 | case E1000_RXBUFFER_256: |
1606 | } else { | 1581 | rctl |= E1000_RCTL_SZ_256; |
1607 | rctl &= ~E1000_RCTL_SZ_4096; | 1582 | rctl &= ~E1000_RCTL_BSEX; |
1608 | rctl |= E1000_RCTL_BSEX; | 1583 | break; |
1609 | switch (adapter->rx_buffer_len) { | 1584 | case E1000_RXBUFFER_512: |
1585 | rctl |= E1000_RCTL_SZ_512; | ||
1586 | rctl &= ~E1000_RCTL_BSEX; | ||
1587 | break; | ||
1588 | case E1000_RXBUFFER_1024: | ||
1589 | rctl |= E1000_RCTL_SZ_1024; | ||
1590 | rctl &= ~E1000_RCTL_BSEX; | ||
1591 | break; | ||
1610 | case E1000_RXBUFFER_2048: | 1592 | case E1000_RXBUFFER_2048: |
1611 | default: | 1593 | default: |
1612 | rctl |= E1000_RCTL_SZ_2048; | 1594 | rctl |= E1000_RCTL_SZ_2048; |
@@ -1621,7 +1603,6 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1621 | case E1000_RXBUFFER_16384: | 1603 | case E1000_RXBUFFER_16384: |
1622 | rctl |= E1000_RCTL_SZ_16384; | 1604 | rctl |= E1000_RCTL_SZ_16384; |
1623 | break; | 1605 | break; |
1624 | } | ||
1625 | } | 1606 | } |
1626 | 1607 | ||
1627 | #ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT | 1608 | #ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT |
@@ -1715,7 +1696,7 @@ e1000_configure_rx(struct e1000_adapter *adapter) | |||
1715 | if (hw->mac_type >= e1000_82571) { | 1696 | if (hw->mac_type >= e1000_82571) { |
1716 | ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); | 1697 | ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
1717 | /* Reset delay timers after every interrupt */ | 1698 | /* Reset delay timers after every interrupt */ |
1718 | ctrl_ext |= E1000_CTRL_EXT_CANC; | 1699 | ctrl_ext |= E1000_CTRL_EXT_INT_TIMER_CLR; |
1719 | #ifdef CONFIG_E1000_NAPI | 1700 | #ifdef CONFIG_E1000_NAPI |
1720 | /* Auto-Mask interrupts upon ICR read. */ | 1701 | /* Auto-Mask interrupts upon ICR read. */ |
1721 | ctrl_ext |= E1000_CTRL_EXT_IAME; | 1702 | ctrl_ext |= E1000_CTRL_EXT_IAME; |
@@ -1807,7 +1788,7 @@ e1000_free_all_tx_resources(struct e1000_adapter *adapter) | |||
1807 | e1000_free_tx_resources(adapter, &adapter->tx_ring[i]); | 1788 | e1000_free_tx_resources(adapter, &adapter->tx_ring[i]); |
1808 | } | 1789 | } |
1809 | 1790 | ||
1810 | static inline void | 1791 | static void |
1811 | e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter, | 1792 | e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter, |
1812 | struct e1000_buffer *buffer_info) | 1793 | struct e1000_buffer *buffer_info) |
1813 | { | 1794 | { |
@@ -2247,6 +2228,7 @@ e1000_watchdog_task(struct e1000_adapter *adapter) | |||
2247 | 2228 | ||
2248 | if (link) { | 2229 | if (link) { |
2249 | if (!netif_carrier_ok(netdev)) { | 2230 | if (!netif_carrier_ok(netdev)) { |
2231 | boolean_t txb2b = 1; | ||
2250 | e1000_get_speed_and_duplex(&adapter->hw, | 2232 | e1000_get_speed_and_duplex(&adapter->hw, |
2251 | &adapter->link_speed, | 2233 | &adapter->link_speed, |
2252 | &adapter->link_duplex); | 2234 | &adapter->link_duplex); |
@@ -2260,23 +2242,22 @@ e1000_watchdog_task(struct e1000_adapter *adapter) | |||
2260 | * and adjust the timeout factor */ | 2242 | * and adjust the timeout factor */ |
2261 | netdev->tx_queue_len = adapter->tx_queue_len; | 2243 | netdev->tx_queue_len = adapter->tx_queue_len; |
2262 | adapter->tx_timeout_factor = 1; | 2244 | adapter->tx_timeout_factor = 1; |
2263 | adapter->txb2b = 1; | ||
2264 | switch (adapter->link_speed) { | 2245 | switch (adapter->link_speed) { |
2265 | case SPEED_10: | 2246 | case SPEED_10: |
2266 | adapter->txb2b = 0; | 2247 | txb2b = 0; |
2267 | netdev->tx_queue_len = 10; | 2248 | netdev->tx_queue_len = 10; |
2268 | adapter->tx_timeout_factor = 8; | 2249 | adapter->tx_timeout_factor = 8; |
2269 | break; | 2250 | break; |
2270 | case SPEED_100: | 2251 | case SPEED_100: |
2271 | adapter->txb2b = 0; | 2252 | txb2b = 0; |
2272 | netdev->tx_queue_len = 100; | 2253 | netdev->tx_queue_len = 100; |
2273 | /* maybe add some timeout factor ? */ | 2254 | /* maybe add some timeout factor ? */ |
2274 | break; | 2255 | break; |
2275 | } | 2256 | } |
2276 | 2257 | ||
2277 | if ((adapter->hw.mac_type == e1000_82571 || | 2258 | if ((adapter->hw.mac_type == e1000_82571 || |
2278 | adapter->hw.mac_type == e1000_82572) && | 2259 | adapter->hw.mac_type == e1000_82572) && |
2279 | adapter->txb2b == 0) { | 2260 | txb2b == 0) { |
2280 | #define SPEED_MODE_BIT (1 << 21) | 2261 | #define SPEED_MODE_BIT (1 << 21) |
2281 | uint32_t tarc0; | 2262 | uint32_t tarc0; |
2282 | tarc0 = E1000_READ_REG(&adapter->hw, TARC0); | 2263 | tarc0 = E1000_READ_REG(&adapter->hw, TARC0); |
@@ -2400,7 +2381,7 @@ e1000_watchdog_task(struct e1000_adapter *adapter) | |||
2400 | #define E1000_TX_FLAGS_VLAN_MASK 0xffff0000 | 2381 | #define E1000_TX_FLAGS_VLAN_MASK 0xffff0000 |
2401 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 | 2382 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 |
2402 | 2383 | ||
2403 | static inline int | 2384 | static int |
2404 | e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | 2385 | e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, |
2405 | struct sk_buff *skb) | 2386 | struct sk_buff *skb) |
2406 | { | 2387 | { |
@@ -2422,7 +2403,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2422 | 2403 | ||
2423 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | 2404 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); |
2424 | mss = skb_shinfo(skb)->tso_size; | 2405 | mss = skb_shinfo(skb)->tso_size; |
2425 | if (skb->protocol == ntohs(ETH_P_IP)) { | 2406 | if (skb->protocol == htons(ETH_P_IP)) { |
2426 | skb->nh.iph->tot_len = 0; | 2407 | skb->nh.iph->tot_len = 0; |
2427 | skb->nh.iph->check = 0; | 2408 | skb->nh.iph->check = 0; |
2428 | skb->h.th->check = | 2409 | skb->h.th->check = |
@@ -2480,7 +2461,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2480 | return FALSE; | 2461 | return FALSE; |
2481 | } | 2462 | } |
2482 | 2463 | ||
2483 | static inline boolean_t | 2464 | static boolean_t |
2484 | e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | 2465 | e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, |
2485 | struct sk_buff *skb) | 2466 | struct sk_buff *skb) |
2486 | { | 2467 | { |
@@ -2516,7 +2497,7 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2516 | #define E1000_MAX_TXD_PWR 12 | 2497 | #define E1000_MAX_TXD_PWR 12 |
2517 | #define E1000_MAX_DATA_PER_TXD (1<<E1000_MAX_TXD_PWR) | 2498 | #define E1000_MAX_DATA_PER_TXD (1<<E1000_MAX_TXD_PWR) |
2518 | 2499 | ||
2519 | static inline int | 2500 | static int |
2520 | e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | 2501 | e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, |
2521 | struct sk_buff *skb, unsigned int first, unsigned int max_per_txd, | 2502 | struct sk_buff *skb, unsigned int first, unsigned int max_per_txd, |
2522 | unsigned int nr_frags, unsigned int mss) | 2503 | unsigned int nr_frags, unsigned int mss) |
@@ -2625,7 +2606,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2625 | return count; | 2606 | return count; |
2626 | } | 2607 | } |
2627 | 2608 | ||
2628 | static inline void | 2609 | static void |
2629 | e1000_tx_queue(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | 2610 | e1000_tx_queue(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, |
2630 | int tx_flags, int count) | 2611 | int tx_flags, int count) |
2631 | { | 2612 | { |
@@ -2689,7 +2670,7 @@ e1000_tx_queue(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2689 | #define E1000_FIFO_HDR 0x10 | 2670 | #define E1000_FIFO_HDR 0x10 |
2690 | #define E1000_82547_PAD_LEN 0x3E0 | 2671 | #define E1000_82547_PAD_LEN 0x3E0 |
2691 | 2672 | ||
2692 | static inline int | 2673 | static int |
2693 | e1000_82547_fifo_workaround(struct e1000_adapter *adapter, struct sk_buff *skb) | 2674 | e1000_82547_fifo_workaround(struct e1000_adapter *adapter, struct sk_buff *skb) |
2694 | { | 2675 | { |
2695 | uint32_t fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head; | 2676 | uint32_t fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head; |
@@ -2716,7 +2697,7 @@ no_fifo_stall_required: | |||
2716 | } | 2697 | } |
2717 | 2698 | ||
2718 | #define MINIMUM_DHCP_PACKET_SIZE 282 | 2699 | #define MINIMUM_DHCP_PACKET_SIZE 282 |
2719 | static inline int | 2700 | static int |
2720 | e1000_transfer_dhcp_info(struct e1000_adapter *adapter, struct sk_buff *skb) | 2701 | e1000_transfer_dhcp_info(struct e1000_adapter *adapter, struct sk_buff *skb) |
2721 | { | 2702 | { |
2722 | struct e1000_hw *hw = &adapter->hw; | 2703 | struct e1000_hw *hw = &adapter->hw; |
@@ -2764,7 +2745,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2764 | unsigned int nr_frags = 0; | 2745 | unsigned int nr_frags = 0; |
2765 | unsigned int mss = 0; | 2746 | unsigned int mss = 0; |
2766 | int count = 0; | 2747 | int count = 0; |
2767 | int tso; | 2748 | int tso; |
2768 | unsigned int f; | 2749 | unsigned int f; |
2769 | len -= skb->data_len; | 2750 | len -= skb->data_len; |
2770 | 2751 | ||
@@ -2777,7 +2758,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2777 | 2758 | ||
2778 | #ifdef NETIF_F_TSO | 2759 | #ifdef NETIF_F_TSO |
2779 | mss = skb_shinfo(skb)->tso_size; | 2760 | mss = skb_shinfo(skb)->tso_size; |
2780 | /* The controller does a simple calculation to | 2761 | /* The controller does a simple calculation to |
2781 | * make sure there is enough room in the FIFO before | 2762 | * make sure there is enough room in the FIFO before |
2782 | * initiating the DMA for each buffer. The calc is: | 2763 | * initiating the DMA for each buffer. The calc is: |
2783 | * 4 = ceil(buffer len/mss). To make sure we don't | 2764 | * 4 = ceil(buffer len/mss). To make sure we don't |
@@ -2800,7 +2781,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2800 | case e1000_82573: | 2781 | case e1000_82573: |
2801 | pull_size = min((unsigned int)4, skb->data_len); | 2782 | pull_size = min((unsigned int)4, skb->data_len); |
2802 | if (!__pskb_pull_tail(skb, pull_size)) { | 2783 | if (!__pskb_pull_tail(skb, pull_size)) { |
2803 | printk(KERN_ERR | 2784 | printk(KERN_ERR |
2804 | "__pskb_pull_tail failed.\n"); | 2785 | "__pskb_pull_tail failed.\n"); |
2805 | dev_kfree_skb_any(skb); | 2786 | dev_kfree_skb_any(skb); |
2806 | return NETDEV_TX_OK; | 2787 | return NETDEV_TX_OK; |
@@ -2901,7 +2882,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2901 | /* Old method was to assume IPv4 packet by default if TSO was enabled. | 2882 | /* Old method was to assume IPv4 packet by default if TSO was enabled. |
2902 | * 82571 hardware supports TSO capabilities for IPv6 as well... | 2883 | * 82571 hardware supports TSO capabilities for IPv6 as well... |
2903 | * no longer assume, we must. */ | 2884 | * no longer assume, we must. */ |
2904 | if (likely(skb->protocol == ntohs(ETH_P_IP))) | 2885 | if (likely(skb->protocol == htons(ETH_P_IP))) |
2905 | tx_flags |= E1000_TX_FLAGS_IPV4; | 2886 | tx_flags |= E1000_TX_FLAGS_IPV4; |
2906 | 2887 | ||
2907 | e1000_tx_queue(adapter, tx_ring, tx_flags, | 2888 | e1000_tx_queue(adapter, tx_ring, tx_flags, |
@@ -2982,8 +2963,7 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
2982 | 2963 | ||
2983 | /* Adapter-specific max frame size limits. */ | 2964 | /* Adapter-specific max frame size limits. */ |
2984 | switch (adapter->hw.mac_type) { | 2965 | switch (adapter->hw.mac_type) { |
2985 | case e1000_82542_rev2_0: | 2966 | case e1000_undefined ... e1000_82542_rev2_1: |
2986 | case e1000_82542_rev2_1: | ||
2987 | if (max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { | 2967 | if (max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { |
2988 | DPRINTK(PROBE, ERR, "Jumbo Frames not supported.\n"); | 2968 | DPRINTK(PROBE, ERR, "Jumbo Frames not supported.\n"); |
2989 | return -EINVAL; | 2969 | return -EINVAL; |
@@ -3017,27 +2997,32 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
3017 | break; | 2997 | break; |
3018 | } | 2998 | } |
3019 | 2999 | ||
3020 | 3000 | /* NOTE: dev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN | |
3021 | if (adapter->hw.mac_type > e1000_82547_rev_2) { | 3001 | * means we reserve 2 more, this pushes us to allocate from the next |
3022 | adapter->rx_buffer_len = max_frame; | 3002 | * larger slab size |
3023 | E1000_ROUNDUP(adapter->rx_buffer_len, 1024); | 3003 | * i.e. RXBUFFER_2048 --> size-4096 slab */ |
3024 | } else { | 3004 | |
3025 | if(unlikely((adapter->hw.mac_type < e1000_82543) && | 3005 | if (max_frame <= E1000_RXBUFFER_256) |
3026 | (max_frame > MAXIMUM_ETHERNET_FRAME_SIZE))) { | 3006 | adapter->rx_buffer_len = E1000_RXBUFFER_256; |
3027 | DPRINTK(PROBE, ERR, "Jumbo Frames not supported " | 3007 | else if (max_frame <= E1000_RXBUFFER_512) |
3028 | "on 82542\n"); | 3008 | adapter->rx_buffer_len = E1000_RXBUFFER_512; |
3029 | return -EINVAL; | 3009 | else if (max_frame <= E1000_RXBUFFER_1024) |
3030 | } else { | 3010 | adapter->rx_buffer_len = E1000_RXBUFFER_1024; |
3031 | if(max_frame <= E1000_RXBUFFER_2048) | 3011 | else if (max_frame <= E1000_RXBUFFER_2048) |
3032 | adapter->rx_buffer_len = E1000_RXBUFFER_2048; | 3012 | adapter->rx_buffer_len = E1000_RXBUFFER_2048; |
3033 | else if(max_frame <= E1000_RXBUFFER_4096) | 3013 | else if (max_frame <= E1000_RXBUFFER_4096) |
3034 | adapter->rx_buffer_len = E1000_RXBUFFER_4096; | 3014 | adapter->rx_buffer_len = E1000_RXBUFFER_4096; |
3035 | else if(max_frame <= E1000_RXBUFFER_8192) | 3015 | else if (max_frame <= E1000_RXBUFFER_8192) |
3036 | adapter->rx_buffer_len = E1000_RXBUFFER_8192; | 3016 | adapter->rx_buffer_len = E1000_RXBUFFER_8192; |
3037 | else if(max_frame <= E1000_RXBUFFER_16384) | 3017 | else if (max_frame <= E1000_RXBUFFER_16384) |
3038 | adapter->rx_buffer_len = E1000_RXBUFFER_16384; | 3018 | adapter->rx_buffer_len = E1000_RXBUFFER_16384; |
3039 | } | 3019 | |
3040 | } | 3020 | /* adjust allocation if LPE protects us, and we aren't using SBP */ |
3021 | #define MAXIMUM_ETHERNET_VLAN_SIZE 1522 | ||
3022 | if (!adapter->hw.tbi_compatibility_on && | ||
3023 | ((max_frame == MAXIMUM_ETHERNET_FRAME_SIZE) || | ||
3024 | (max_frame == MAXIMUM_ETHERNET_VLAN_SIZE))) | ||
3025 | adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE; | ||
3041 | 3026 | ||
3042 | netdev->mtu = new_mtu; | 3027 | netdev->mtu = new_mtu; |
3043 | 3028 | ||
@@ -3060,11 +3045,21 @@ void | |||
3060 | e1000_update_stats(struct e1000_adapter *adapter) | 3045 | e1000_update_stats(struct e1000_adapter *adapter) |
3061 | { | 3046 | { |
3062 | struct e1000_hw *hw = &adapter->hw; | 3047 | struct e1000_hw *hw = &adapter->hw; |
3048 | struct pci_dev *pdev = adapter->pdev; | ||
3063 | unsigned long flags; | 3049 | unsigned long flags; |
3064 | uint16_t phy_tmp; | 3050 | uint16_t phy_tmp; |
3065 | 3051 | ||
3066 | #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF | 3052 | #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF |
3067 | 3053 | ||
3054 | /* | ||
3055 | * Prevent stats update while adapter is being reset, or if the pci | ||
3056 | * connection is down. | ||
3057 | */ | ||
3058 | if (adapter->link_speed == 0) | ||
3059 | return; | ||
3060 | if (pdev->error_state && pdev->error_state != pci_channel_io_normal) | ||
3061 | return; | ||
3062 | |||
3068 | spin_lock_irqsave(&adapter->stats_lock, flags); | 3063 | spin_lock_irqsave(&adapter->stats_lock, flags); |
3069 | 3064 | ||
3070 | /* these counters are modified from e1000_adjust_tbi_stats, | 3065 | /* these counters are modified from e1000_adjust_tbi_stats, |
@@ -3165,7 +3160,6 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
3165 | adapter->stats.crcerrs + adapter->stats.algnerrc + | 3160 | adapter->stats.crcerrs + adapter->stats.algnerrc + |
3166 | adapter->stats.ruc + adapter->stats.roc + | 3161 | adapter->stats.ruc + adapter->stats.roc + |
3167 | adapter->stats.cexterr; | 3162 | adapter->stats.cexterr; |
3168 | adapter->net_stats.rx_dropped = 0; | ||
3169 | adapter->net_stats.rx_length_errors = adapter->stats.ruc + | 3163 | adapter->net_stats.rx_length_errors = adapter->stats.ruc + |
3170 | adapter->stats.roc; | 3164 | adapter->stats.roc; |
3171 | adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs; | 3165 | adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs; |
@@ -3391,13 +3385,15 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter, | |||
3391 | 3385 | ||
3392 | tx_ring->next_to_clean = i; | 3386 | tx_ring->next_to_clean = i; |
3393 | 3387 | ||
3394 | spin_lock(&tx_ring->tx_lock); | 3388 | #define TX_WAKE_THRESHOLD 32 |
3395 | |||
3396 | if (unlikely(cleaned && netif_queue_stopped(netdev) && | 3389 | if (unlikely(cleaned && netif_queue_stopped(netdev) && |
3397 | netif_carrier_ok(netdev))) | 3390 | netif_carrier_ok(netdev))) { |
3398 | netif_wake_queue(netdev); | 3391 | spin_lock(&tx_ring->tx_lock); |
3399 | 3392 | if (netif_queue_stopped(netdev) && | |
3400 | spin_unlock(&tx_ring->tx_lock); | 3393 | (E1000_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD)) |
3394 | netif_wake_queue(netdev); | ||
3395 | spin_unlock(&tx_ring->tx_lock); | ||
3396 | } | ||
3401 | 3397 | ||
3402 | if (adapter->detect_tx_hung) { | 3398 | if (adapter->detect_tx_hung) { |
3403 | /* Detect a transmit hang in hardware, this serializes the | 3399 | /* Detect a transmit hang in hardware, this serializes the |
@@ -3445,7 +3441,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter, | |||
3445 | * @sk_buff: socket buffer with received data | 3441 | * @sk_buff: socket buffer with received data |
3446 | **/ | 3442 | **/ |
3447 | 3443 | ||
3448 | static inline void | 3444 | static void |
3449 | e1000_rx_checksum(struct e1000_adapter *adapter, | 3445 | e1000_rx_checksum(struct e1000_adapter *adapter, |
3450 | uint32_t status_err, uint32_t csum, | 3446 | uint32_t status_err, uint32_t csum, |
3451 | struct sk_buff *skb) | 3447 | struct sk_buff *skb) |
@@ -3567,7 +3563,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
3567 | flags); | 3563 | flags); |
3568 | length--; | 3564 | length--; |
3569 | } else { | 3565 | } else { |
3570 | dev_kfree_skb_irq(skb); | 3566 | /* recycle */ |
3567 | buffer_info->skb = skb; | ||
3571 | goto next_desc; | 3568 | goto next_desc; |
3572 | } | 3569 | } |
3573 | } | 3570 | } |
@@ -3675,6 +3672,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
3675 | i = rx_ring->next_to_clean; | 3672 | i = rx_ring->next_to_clean; |
3676 | rx_desc = E1000_RX_DESC_PS(*rx_ring, i); | 3673 | rx_desc = E1000_RX_DESC_PS(*rx_ring, i); |
3677 | staterr = le32_to_cpu(rx_desc->wb.middle.status_error); | 3674 | staterr = le32_to_cpu(rx_desc->wb.middle.status_error); |
3675 | buffer_info = &rx_ring->buffer_info[i]; | ||
3678 | 3676 | ||
3679 | while (staterr & E1000_RXD_STAT_DD) { | 3677 | while (staterr & E1000_RXD_STAT_DD) { |
3680 | buffer_info = &rx_ring->buffer_info[i]; | 3678 | buffer_info = &rx_ring->buffer_info[i]; |
@@ -3733,9 +3731,9 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
3733 | 3731 | ||
3734 | /* page alloc/put takes too long and effects small packet | 3732 | /* page alloc/put takes too long and effects small packet |
3735 | * throughput, so unsplit small packets and save the alloc/put*/ | 3733 | * throughput, so unsplit small packets and save the alloc/put*/ |
3736 | if (l1 && ((length + l1) < E1000_CB_LENGTH)) { | 3734 | if (l1 && ((length + l1) <= adapter->rx_ps_bsize0)) { |
3737 | u8 *vaddr; | 3735 | u8 *vaddr; |
3738 | /* there is no documentation about how to call | 3736 | /* there is no documentation about how to call |
3739 | * kmap_atomic, so we can't hold the mapping | 3737 | * kmap_atomic, so we can't hold the mapping |
3740 | * very long */ | 3738 | * very long */ |
3741 | pci_dma_sync_single_for_cpu(pdev, | 3739 | pci_dma_sync_single_for_cpu(pdev, |
@@ -4155,7 +4153,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4155 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | 4153 | spin_unlock_irqrestore(&adapter->stats_lock, flags); |
4156 | return -EIO; | 4154 | return -EIO; |
4157 | } | 4155 | } |
4158 | if (adapter->hw.phy_type == e1000_media_type_copper) { | 4156 | if (adapter->hw.media_type == e1000_media_type_copper) { |
4159 | switch (data->reg_num) { | 4157 | switch (data->reg_num) { |
4160 | case PHY_CTRL: | 4158 | case PHY_CTRL: |
4161 | if (mii_reg & MII_CR_POWER_DOWN) | 4159 | if (mii_reg & MII_CR_POWER_DOWN) |
@@ -4514,21 +4512,13 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4514 | 4512 | ||
4515 | E1000_WRITE_REG(&adapter->hw, WUC, E1000_WUC_PME_EN); | 4513 | E1000_WRITE_REG(&adapter->hw, WUC, E1000_WUC_PME_EN); |
4516 | E1000_WRITE_REG(&adapter->hw, WUFC, wufc); | 4514 | E1000_WRITE_REG(&adapter->hw, WUFC, wufc); |
4517 | retval = pci_enable_wake(pdev, PCI_D3hot, 1); | 4515 | pci_enable_wake(pdev, PCI_D3hot, 1); |
4518 | if (retval) | 4516 | pci_enable_wake(pdev, PCI_D3cold, 1); |
4519 | DPRINTK(PROBE, ERR, "Error enabling D3 wake\n"); | ||
4520 | retval = pci_enable_wake(pdev, PCI_D3cold, 1); | ||
4521 | if (retval) | ||
4522 | DPRINTK(PROBE, ERR, "Error enabling D3 cold wake\n"); | ||
4523 | } else { | 4517 | } else { |
4524 | E1000_WRITE_REG(&adapter->hw, WUC, 0); | 4518 | E1000_WRITE_REG(&adapter->hw, WUC, 0); |
4525 | E1000_WRITE_REG(&adapter->hw, WUFC, 0); | 4519 | E1000_WRITE_REG(&adapter->hw, WUFC, 0); |
4526 | retval = pci_enable_wake(pdev, PCI_D3hot, 0); | 4520 | pci_enable_wake(pdev, PCI_D3hot, 0); |
4527 | if (retval) | 4521 | pci_enable_wake(pdev, PCI_D3cold, 0); |
4528 | DPRINTK(PROBE, ERR, "Error enabling D3 wake\n"); | ||
4529 | retval = pci_enable_wake(pdev, PCI_D3cold, 0); | ||
4530 | if (retval) | ||
4531 | DPRINTK(PROBE, ERR, "Error enabling D3 cold wake\n"); | ||
4532 | } | 4522 | } |
4533 | 4523 | ||
4534 | if (adapter->hw.mac_type >= e1000_82540 && | 4524 | if (adapter->hw.mac_type >= e1000_82540 && |
@@ -4537,13 +4527,8 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4537 | if (manc & E1000_MANC_SMBUS_EN) { | 4527 | if (manc & E1000_MANC_SMBUS_EN) { |
4538 | manc |= E1000_MANC_ARP_EN; | 4528 | manc |= E1000_MANC_ARP_EN; |
4539 | E1000_WRITE_REG(&adapter->hw, MANC, manc); | 4529 | E1000_WRITE_REG(&adapter->hw, MANC, manc); |
4540 | retval = pci_enable_wake(pdev, PCI_D3hot, 1); | 4530 | pci_enable_wake(pdev, PCI_D3hot, 1); |
4541 | if (retval) | 4531 | pci_enable_wake(pdev, PCI_D3cold, 1); |
4542 | DPRINTK(PROBE, ERR, "Error enabling D3 wake\n"); | ||
4543 | retval = pci_enable_wake(pdev, PCI_D3cold, 1); | ||
4544 | if (retval) | ||
4545 | DPRINTK(PROBE, ERR, | ||
4546 | "Error enabling D3 cold wake\n"); | ||
4547 | } | 4532 | } |
4548 | } | 4533 | } |
4549 | 4534 | ||
@@ -4553,9 +4538,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4553 | 4538 | ||
4554 | pci_disable_device(pdev); | 4539 | pci_disable_device(pdev); |
4555 | 4540 | ||
4556 | retval = pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 4541 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
4557 | if (retval) | ||
4558 | DPRINTK(PROBE, ERR, "Error in setting power state\n"); | ||
4559 | 4542 | ||
4560 | return 0; | 4543 | return 0; |
4561 | } | 4544 | } |
@@ -4566,22 +4549,15 @@ e1000_resume(struct pci_dev *pdev) | |||
4566 | { | 4549 | { |
4567 | struct net_device *netdev = pci_get_drvdata(pdev); | 4550 | struct net_device *netdev = pci_get_drvdata(pdev); |
4568 | struct e1000_adapter *adapter = netdev_priv(netdev); | 4551 | struct e1000_adapter *adapter = netdev_priv(netdev); |
4569 | int retval; | ||
4570 | uint32_t manc, ret_val; | 4552 | uint32_t manc, ret_val; |
4571 | 4553 | ||
4572 | retval = pci_set_power_state(pdev, PCI_D0); | 4554 | pci_set_power_state(pdev, PCI_D0); |
4573 | if (retval) | ||
4574 | DPRINTK(PROBE, ERR, "Error in setting power state\n"); | ||
4575 | e1000_pci_restore_state(adapter); | 4555 | e1000_pci_restore_state(adapter); |
4576 | ret_val = pci_enable_device(pdev); | 4556 | ret_val = pci_enable_device(pdev); |
4577 | pci_set_master(pdev); | 4557 | pci_set_master(pdev); |
4578 | 4558 | ||
4579 | retval = pci_enable_wake(pdev, PCI_D3hot, 0); | 4559 | pci_enable_wake(pdev, PCI_D3hot, 0); |
4580 | if (retval) | 4560 | pci_enable_wake(pdev, PCI_D3cold, 0); |
4581 | DPRINTK(PROBE, ERR, "Error enabling D3 wake\n"); | ||
4582 | retval = pci_enable_wake(pdev, PCI_D3cold, 0); | ||
4583 | if (retval) | ||
4584 | DPRINTK(PROBE, ERR, "Error enabling D3 cold wake\n"); | ||
4585 | 4561 | ||
4586 | e1000_reset(adapter); | 4562 | e1000_reset(adapter); |
4587 | E1000_WRITE_REG(&adapter->hw, WUS, ~0); | 4563 | E1000_WRITE_REG(&adapter->hw, WUS, ~0); |
@@ -4635,4 +4611,101 @@ e1000_netpoll(struct net_device *netdev) | |||
4635 | } | 4611 | } |
4636 | #endif | 4612 | #endif |
4637 | 4613 | ||
4614 | /** | ||
4615 | * e1000_io_error_detected - called when PCI error is detected | ||
4616 | * @pdev: Pointer to PCI device | ||
4617 | * @state: The current pci conneection state | ||
4618 | * | ||
4619 | * This function is called after a PCI bus error affecting | ||
4620 | * this device has been detected. | ||
4621 | */ | ||
4622 | static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state) | ||
4623 | { | ||
4624 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
4625 | struct e1000_adapter *adapter = netdev->priv; | ||
4626 | |||
4627 | netif_device_detach(netdev); | ||
4628 | |||
4629 | if (netif_running(netdev)) | ||
4630 | e1000_down(adapter); | ||
4631 | |||
4632 | /* Request a slot slot reset. */ | ||
4633 | return PCI_ERS_RESULT_NEED_RESET; | ||
4634 | } | ||
4635 | |||
4636 | /** | ||
4637 | * e1000_io_slot_reset - called after the pci bus has been reset. | ||
4638 | * @pdev: Pointer to PCI device | ||
4639 | * | ||
4640 | * Restart the card from scratch, as if from a cold-boot. Implementation | ||
4641 | * resembles the first-half of the e1000_resume routine. | ||
4642 | */ | ||
4643 | static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev) | ||
4644 | { | ||
4645 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
4646 | struct e1000_adapter *adapter = netdev->priv; | ||
4647 | |||
4648 | if (pci_enable_device(pdev)) { | ||
4649 | printk(KERN_ERR "e1000: Cannot re-enable PCI device after reset.\n"); | ||
4650 | return PCI_ERS_RESULT_DISCONNECT; | ||
4651 | } | ||
4652 | pci_set_master(pdev); | ||
4653 | |||
4654 | pci_enable_wake(pdev, 3, 0); | ||
4655 | pci_enable_wake(pdev, 4, 0); /* 4 == D3 cold */ | ||
4656 | |||
4657 | /* Perform card reset only on one instance of the card */ | ||
4658 | if (PCI_FUNC (pdev->devfn) != 0) | ||
4659 | return PCI_ERS_RESULT_RECOVERED; | ||
4660 | |||
4661 | e1000_reset(adapter); | ||
4662 | E1000_WRITE_REG(&adapter->hw, WUS, ~0); | ||
4663 | |||
4664 | return PCI_ERS_RESULT_RECOVERED; | ||
4665 | } | ||
4666 | |||
4667 | /** | ||
4668 | * e1000_io_resume - called when traffic can start flowing again. | ||
4669 | * @pdev: Pointer to PCI device | ||
4670 | * | ||
4671 | * This callback is called when the error recovery driver tells us that | ||
4672 | * its OK to resume normal operation. Implementation resembles the | ||
4673 | * second-half of the e1000_resume routine. | ||
4674 | */ | ||
4675 | static void e1000_io_resume(struct pci_dev *pdev) | ||
4676 | { | ||
4677 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
4678 | struct e1000_adapter *adapter = netdev->priv; | ||
4679 | uint32_t manc, swsm; | ||
4680 | |||
4681 | if (netif_running(netdev)) { | ||
4682 | if (e1000_up(adapter)) { | ||
4683 | printk("e1000: can't bring device back up after reset\n"); | ||
4684 | return; | ||
4685 | } | ||
4686 | } | ||
4687 | |||
4688 | netif_device_attach(netdev); | ||
4689 | |||
4690 | if (adapter->hw.mac_type >= e1000_82540 && | ||
4691 | adapter->hw.media_type == e1000_media_type_copper) { | ||
4692 | manc = E1000_READ_REG(&adapter->hw, MANC); | ||
4693 | manc &= ~(E1000_MANC_ARP_EN); | ||
4694 | E1000_WRITE_REG(&adapter->hw, MANC, manc); | ||
4695 | } | ||
4696 | |||
4697 | switch (adapter->hw.mac_type) { | ||
4698 | case e1000_82573: | ||
4699 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | ||
4700 | E1000_WRITE_REG(&adapter->hw, SWSM, | ||
4701 | swsm | E1000_SWSM_DRV_LOAD); | ||
4702 | break; | ||
4703 | default: | ||
4704 | break; | ||
4705 | } | ||
4706 | |||
4707 | if (netif_running(netdev)) | ||
4708 | mod_timer(&adapter->watchdog_timer, jiffies); | ||
4709 | } | ||
4710 | |||
4638 | /* e1000_main.c */ | 4711 | /* e1000_main.c */ |