aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r--drivers/net/e1000/Makefile3
-rw-r--r--drivers/net/e1000/e1000.h6
-rw-r--r--drivers/net/e1000/e1000_ethtool.c41
-rw-r--r--drivers/net/e1000/e1000_hw.c115
-rw-r--r--drivers/net/e1000/e1000_hw.h7
-rw-r--r--drivers/net/e1000/e1000_main.c385
-rw-r--r--drivers/net/e1000/e1000_osdep.h3
-rw-r--r--drivers/net/e1000/e1000_param.c3
8 files changed, 322 insertions, 241 deletions
diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
index ca9f89552da3..5dea2b7dea4d 100644
--- a/drivers/net/e1000/Makefile
+++ b/drivers/net/e1000/Makefile
@@ -1,7 +1,7 @@
1################################################################################ 1################################################################################
2# 2#
3# 3#
4# Copyright(c) 1999 - 2003 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,6 +22,7 @@
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################################################################################
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 281de41d030a..2bc34fbfa69c 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -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,6 +22,7 @@
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*******************************************************************************/
@@ -114,6 +115,8 @@ struct e1000_adapter;
114/* Supported Rx Buffer Sizes */ 115/* Supported Rx Buffer Sizes */
115#define E1000_RXBUFFER_128 128 /* Used for packet split */ 116#define E1000_RXBUFFER_128 128 /* Used for packet split */
116#define E1000_RXBUFFER_256 256 /* Used for packet split */ 117#define E1000_RXBUFFER_256 256 /* Used for packet split */
118#define E1000_RXBUFFER_512 512
119#define E1000_RXBUFFER_1024 1024
117#define E1000_RXBUFFER_2048 2048 120#define E1000_RXBUFFER_2048 2048
118#define E1000_RXBUFFER_4096 4096 121#define E1000_RXBUFFER_4096 4096
119#define E1000_RXBUFFER_8192 8192 122#define E1000_RXBUFFER_8192 8192
@@ -334,7 +337,6 @@ struct e1000_adapter {
334 boolean_t have_msi; 337 boolean_t have_msi;
335#endif 338#endif
336 /* to not mess up cache alignment, always add to the bottom */ 339 /* to not mess up cache alignment, always add to the bottom */
337 boolean_t txb2b;
338#ifdef NETIF_F_TSO 340#ifdef NETIF_F_TSO
339 boolean_t tso_force; 341 boolean_t tso_force;
340#endif 342#endif
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index d1c705b412c2..6ed7f599eba3 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.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,6 +22,7 @@
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*******************************************************************************/
@@ -864,8 +865,8 @@ static int
864e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) 865e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
865{ 866{
866 struct net_device *netdev = adapter->netdev; 867 struct net_device *netdev = adapter->netdev;
867 uint32_t mask, i=0, shared_int = TRUE; 868 uint32_t mask, i=0, shared_int = TRUE;
868 uint32_t irq = adapter->pdev->irq; 869 uint32_t irq = adapter->pdev->irq;
869 870
870 *data = 0; 871 *data = 0;
871 872
@@ -891,22 +892,22 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
891 /* Interrupt to test */ 892 /* Interrupt to test */
892 mask = 1 << i; 893 mask = 1 << i;
893 894
894 if (!shared_int) { 895 if (!shared_int) {
895 /* Disable the interrupt to be reported in 896 /* Disable the interrupt to be reported in
896 * the cause register and then force the same 897 * the cause register and then force the same
897 * interrupt and see if one gets posted. If 898 * interrupt and see if one gets posted. If
898 * an interrupt was posted to the bus, the 899 * an interrupt was posted to the bus, the
899 * test failed. 900 * test failed.
900 */ 901 */
901 adapter->test_icr = 0; 902 adapter->test_icr = 0;
902 E1000_WRITE_REG(&adapter->hw, IMC, mask); 903 E1000_WRITE_REG(&adapter->hw, IMC, mask);
903 E1000_WRITE_REG(&adapter->hw, ICS, mask); 904 E1000_WRITE_REG(&adapter->hw, ICS, mask);
904 msec_delay(10); 905 msec_delay(10);
905 906
906 if (adapter->test_icr & mask) { 907 if (adapter->test_icr & mask) {
907 *data = 3; 908 *data = 3;
908 break; 909 break;
909 } 910 }
910 } 911 }
911 912
912 /* Enable the interrupt to be reported in 913 /* Enable the interrupt to be reported in
@@ -925,7 +926,7 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
925 break; 926 break;
926 } 927 }
927 928
928 if (!shared_int) { 929 if (!shared_int) {
929 /* Disable the other interrupts to be reported in 930 /* Disable the other interrupts to be reported in
930 * the cause register and then force the other 931 * the cause register and then force the other
931 * interrupts and see if any get posted. If 932 * interrupts and see if any get posted. If
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 523c2c9fc0ac..3959039b16ec 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.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,6 +22,7 @@
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*******************************************************************************/
@@ -764,7 +765,7 @@ e1000_init_hw(struct e1000_hw *hw)
764 } 765 }
765 766
766 if (hw->mac_type == e1000_82573) { 767 if (hw->mac_type == e1000_82573) {
767 e1000_enable_tx_pkt_filtering(hw); 768 e1000_enable_tx_pkt_filtering(hw);
768 } 769 }
769 770
770 switch (hw->mac_type) { 771 switch (hw->mac_type) {
@@ -860,7 +861,7 @@ e1000_adjust_serdes_amplitude(struct e1000_hw *hw)
860 861
861 if(eeprom_data != EEPROM_RESERVED_WORD) { 862 if(eeprom_data != EEPROM_RESERVED_WORD) {
862 /* Adjust SERDES output amplitude only. */ 863 /* Adjust SERDES output amplitude only. */
863 eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK; 864 eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK;
864 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, eeprom_data); 865 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, eeprom_data);
865 if(ret_val) 866 if(ret_val)
866 return ret_val; 867 return ret_val;
@@ -1227,7 +1228,7 @@ e1000_copper_link_igp_setup(struct e1000_hw *hw)
1227 1228
1228 if (hw->phy_reset_disable) 1229 if (hw->phy_reset_disable)
1229 return E1000_SUCCESS; 1230 return E1000_SUCCESS;
1230 1231
1231 ret_val = e1000_phy_reset(hw); 1232 ret_val = e1000_phy_reset(hw);
1232 if (ret_val) { 1233 if (ret_val) {
1233 DEBUGOUT("Error Resetting the PHY\n"); 1234 DEBUGOUT("Error Resetting the PHY\n");
@@ -1369,7 +1370,7 @@ e1000_copper_link_ggp_setup(struct e1000_hw *hw)
1369 DEBUGFUNC("e1000_copper_link_ggp_setup"); 1370 DEBUGFUNC("e1000_copper_link_ggp_setup");
1370 1371
1371 if(!hw->phy_reset_disable) { 1372 if(!hw->phy_reset_disable) {
1372 1373
1373 /* Enable CRS on TX for half-duplex operation. */ 1374 /* Enable CRS on TX for half-duplex operation. */
1374 ret_val = e1000_read_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, 1375 ret_val = e1000_read_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
1375 &phy_data); 1376 &phy_data);
@@ -1518,7 +1519,7 @@ e1000_copper_link_mgp_setup(struct e1000_hw *hw)
1518 1519
1519 if(hw->phy_reset_disable) 1520 if(hw->phy_reset_disable)
1520 return E1000_SUCCESS; 1521 return E1000_SUCCESS;
1521 1522
1522 /* Enable CRS on TX. This must be set for half-duplex operation. */ 1523 /* Enable CRS on TX. This must be set for half-duplex operation. */
1523 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); 1524 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
1524 if(ret_val) 1525 if(ret_val)
@@ -1664,7 +1665,7 @@ e1000_copper_link_autoneg(struct e1000_hw *hw)
1664* collision distance in the Transmit Control Register. 1665* collision distance in the Transmit Control Register.
1665* 2) Set up flow control on the MAC to that established with 1666* 2) Set up flow control on the MAC to that established with
1666* the link partner. 1667* the link partner.
1667* 3) Config DSP to improve Gigabit link quality for some PHY revisions. 1668* 3) Config DSP to improve Gigabit link quality for some PHY revisions.
1668* 1669*
1669* hw - Struct containing variables accessed by shared code 1670* hw - Struct containing variables accessed by shared code
1670******************************************************************************/ 1671******************************************************************************/
@@ -1673,7 +1674,7 @@ e1000_copper_link_postconfig(struct e1000_hw *hw)
1673{ 1674{
1674 int32_t ret_val; 1675 int32_t ret_val;
1675 DEBUGFUNC("e1000_copper_link_postconfig"); 1676 DEBUGFUNC("e1000_copper_link_postconfig");
1676 1677
1677 if(hw->mac_type >= e1000_82544) { 1678 if(hw->mac_type >= e1000_82544) {
1678 e1000_config_collision_dist(hw); 1679 e1000_config_collision_dist(hw);
1679 } else { 1680 } else {
@@ -1697,7 +1698,7 @@ e1000_copper_link_postconfig(struct e1000_hw *hw)
1697 return ret_val; 1698 return ret_val;
1698 } 1699 }
1699 } 1700 }
1700 1701
1701 return E1000_SUCCESS; 1702 return E1000_SUCCESS;
1702} 1703}
1703 1704
@@ -1753,11 +1754,11 @@ e1000_setup_copper_link(struct e1000_hw *hw)
1753 } 1754 }
1754 1755
1755 if(hw->autoneg) { 1756 if(hw->autoneg) {
1756 /* Setup autoneg and flow control advertisement 1757 /* Setup autoneg and flow control advertisement
1757 * and perform autonegotiation */ 1758 * and perform autonegotiation */
1758 ret_val = e1000_copper_link_autoneg(hw); 1759 ret_val = e1000_copper_link_autoneg(hw);
1759 if(ret_val) 1760 if(ret_val)
1760 return ret_val; 1761 return ret_val;
1761 } else { 1762 } else {
1762 /* PHY will be set to 10H, 10F, 100H,or 100F 1763 /* PHY will be set to 10H, 10F, 100H,or 100F
1763 * depending on value from forced_speed_duplex. */ 1764 * depending on value from forced_speed_duplex. */
@@ -1785,7 +1786,7 @@ e1000_setup_copper_link(struct e1000_hw *hw)
1785 ret_val = e1000_copper_link_postconfig(hw); 1786 ret_val = e1000_copper_link_postconfig(hw);
1786 if(ret_val) 1787 if(ret_val)
1787 return ret_val; 1788 return ret_val;
1788 1789
1789 DEBUGOUT("Valid link established!!!\n"); 1790 DEBUGOUT("Valid link established!!!\n");
1790 return E1000_SUCCESS; 1791 return E1000_SUCCESS;
1791 } 1792 }
@@ -1983,7 +1984,7 @@ e1000_phy_setup_autoneg(struct e1000_hw *hw)
1983 1984
1984 DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); 1985 DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
1985 1986
1986 ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg); 1987 ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg);
1987 if(ret_val) 1988 if(ret_val)
1988 return ret_val; 1989 return ret_val;
1989 1990
@@ -2272,7 +2273,7 @@ e1000_config_mac_to_phy(struct e1000_hw *hw)
2272 2273
2273 DEBUGFUNC("e1000_config_mac_to_phy"); 2274 DEBUGFUNC("e1000_config_mac_to_phy");
2274 2275
2275 /* 82544 or newer MAC, Auto Speed Detection takes care of 2276 /* 82544 or newer MAC, Auto Speed Detection takes care of
2276 * MAC speed/duplex configuration.*/ 2277 * MAC speed/duplex configuration.*/
2277 if (hw->mac_type >= e1000_82544) 2278 if (hw->mac_type >= e1000_82544)
2278 return E1000_SUCCESS; 2279 return E1000_SUCCESS;
@@ -2291,9 +2292,9 @@ e1000_config_mac_to_phy(struct e1000_hw *hw)
2291 if(ret_val) 2292 if(ret_val)
2292 return ret_val; 2293 return ret_val;
2293 2294
2294 if(phy_data & M88E1000_PSSR_DPLX) 2295 if(phy_data & M88E1000_PSSR_DPLX)
2295 ctrl |= E1000_CTRL_FD; 2296 ctrl |= E1000_CTRL_FD;
2296 else 2297 else
2297 ctrl &= ~E1000_CTRL_FD; 2298 ctrl &= ~E1000_CTRL_FD;
2298 2299
2299 e1000_config_collision_dist(hw); 2300 e1000_config_collision_dist(hw);
@@ -2492,10 +2493,10 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw)
2492 */ 2493 */
2493 if(hw->original_fc == e1000_fc_full) { 2494 if(hw->original_fc == e1000_fc_full) {
2494 hw->fc = e1000_fc_full; 2495 hw->fc = e1000_fc_full;
2495 DEBUGOUT("Flow Control = FULL.\r\n"); 2496 DEBUGOUT("Flow Control = FULL.\n");
2496 } else { 2497 } else {
2497 hw->fc = e1000_fc_rx_pause; 2498 hw->fc = e1000_fc_rx_pause;
2498 DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); 2499 DEBUGOUT("Flow Control = RX PAUSE frames only.\n");
2499 } 2500 }
2500 } 2501 }
2501 /* For receiving PAUSE frames ONLY. 2502 /* For receiving PAUSE frames ONLY.
@@ -2511,7 +2512,7 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw)
2511 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && 2512 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
2512 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { 2513 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
2513 hw->fc = e1000_fc_tx_pause; 2514 hw->fc = e1000_fc_tx_pause;
2514 DEBUGOUT("Flow Control = TX PAUSE frames only.\r\n"); 2515 DEBUGOUT("Flow Control = TX PAUSE frames only.\n");
2515 } 2516 }
2516 /* For transmitting PAUSE frames ONLY. 2517 /* For transmitting PAUSE frames ONLY.
2517 * 2518 *
@@ -2526,7 +2527,7 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw)
2526 !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && 2527 !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
2527 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { 2528 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
2528 hw->fc = e1000_fc_rx_pause; 2529 hw->fc = e1000_fc_rx_pause;
2529 DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); 2530 DEBUGOUT("Flow Control = RX PAUSE frames only.\n");
2530 } 2531 }
2531 /* Per the IEEE spec, at this point flow control should be 2532 /* Per the IEEE spec, at this point flow control should be
2532 * disabled. However, we want to consider that we could 2533 * disabled. However, we want to consider that we could
@@ -2552,10 +2553,10 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw)
2552 hw->original_fc == e1000_fc_tx_pause) || 2553 hw->original_fc == e1000_fc_tx_pause) ||
2553 hw->fc_strict_ieee) { 2554 hw->fc_strict_ieee) {
2554 hw->fc = e1000_fc_none; 2555 hw->fc = e1000_fc_none;
2555 DEBUGOUT("Flow Control = NONE.\r\n"); 2556 DEBUGOUT("Flow Control = NONE.\n");
2556 } else { 2557 } else {
2557 hw->fc = e1000_fc_rx_pause; 2558 hw->fc = e1000_fc_rx_pause;
2558 DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); 2559 DEBUGOUT("Flow Control = RX PAUSE frames only.\n");
2559 } 2560 }
2560 2561
2561 /* Now we need to do one last check... If we auto- 2562 /* Now we need to do one last check... If we auto-
@@ -2580,7 +2581,7 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw)
2580 return ret_val; 2581 return ret_val;
2581 } 2582 }
2582 } else { 2583 } else {
2583 DEBUGOUT("Copper PHY and Auto Neg has not completed.\r\n"); 2584 DEBUGOUT("Copper PHY and Auto Neg has not completed.\n");
2584 } 2585 }
2585 } 2586 }
2586 return E1000_SUCCESS; 2587 return E1000_SUCCESS;
@@ -2763,7 +2764,7 @@ e1000_check_for_link(struct e1000_hw *hw)
2763 hw->autoneg_failed = 1; 2764 hw->autoneg_failed = 1;
2764 return 0; 2765 return 0;
2765 } 2766 }
2766 DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\r\n"); 2767 DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n");
2767 2768
2768 /* Disable auto-negotiation in the TXCW register */ 2769 /* Disable auto-negotiation in the TXCW register */
2769 E1000_WRITE_REG(hw, TXCW, (hw->txcw & ~E1000_TXCW_ANE)); 2770 E1000_WRITE_REG(hw, TXCW, (hw->txcw & ~E1000_TXCW_ANE));
@@ -2788,7 +2789,7 @@ e1000_check_for_link(struct e1000_hw *hw)
2788 else if(((hw->media_type == e1000_media_type_fiber) || 2789 else if(((hw->media_type == e1000_media_type_fiber) ||
2789 (hw->media_type == e1000_media_type_internal_serdes)) && 2790 (hw->media_type == e1000_media_type_internal_serdes)) &&
2790 (ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) { 2791 (ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) {
2791 DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\r\n"); 2792 DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\n");
2792 E1000_WRITE_REG(hw, TXCW, hw->txcw); 2793 E1000_WRITE_REG(hw, TXCW, hw->txcw);
2793 E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU)); 2794 E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU));
2794 2795
@@ -2851,13 +2852,13 @@ e1000_get_speed_and_duplex(struct e1000_hw *hw,
2851 2852
2852 if(status & E1000_STATUS_FD) { 2853 if(status & E1000_STATUS_FD) {
2853 *duplex = FULL_DUPLEX; 2854 *duplex = FULL_DUPLEX;
2854 DEBUGOUT("Full Duplex\r\n"); 2855 DEBUGOUT("Full Duplex\n");
2855 } else { 2856 } else {
2856 *duplex = HALF_DUPLEX; 2857 *duplex = HALF_DUPLEX;
2857 DEBUGOUT(" Half Duplex\r\n"); 2858 DEBUGOUT(" Half Duplex\n");
2858 } 2859 }
2859 } else { 2860 } else {
2860 DEBUGOUT("1000 Mbs, Full Duplex\r\n"); 2861 DEBUGOUT("1000 Mbs, Full Duplex\n");
2861 *speed = SPEED_1000; 2862 *speed = SPEED_1000;
2862 *duplex = FULL_DUPLEX; 2863 *duplex = FULL_DUPLEX;
2863 } 2864 }
@@ -2883,7 +2884,7 @@ e1000_get_speed_and_duplex(struct e1000_hw *hw,
2883 } 2884 }
2884 } 2885 }
2885 2886
2886 if ((hw->mac_type == e1000_80003es2lan) && 2887 if ((hw->mac_type == e1000_80003es2lan) &&
2887 (hw->media_type == e1000_media_type_copper)) { 2888 (hw->media_type == e1000_media_type_copper)) {
2888 if (*speed == SPEED_1000) 2889 if (*speed == SPEED_1000)
2889 ret_val = e1000_configure_kmrn_for_1000(hw); 2890 ret_val = e1000_configure_kmrn_for_1000(hw);
@@ -3159,7 +3160,7 @@ e1000_read_phy_reg(struct e1000_hw *hw,
3159 if (e1000_swfw_sync_acquire(hw, swfw)) 3160 if (e1000_swfw_sync_acquire(hw, swfw))
3160 return -E1000_ERR_SWFW_SYNC; 3161 return -E1000_ERR_SWFW_SYNC;
3161 3162
3162 if((hw->phy_type == e1000_phy_igp || 3163 if((hw->phy_type == e1000_phy_igp ||
3163 hw->phy_type == e1000_phy_igp_2) && 3164 hw->phy_type == e1000_phy_igp_2) &&
3164 (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { 3165 (reg_addr > MAX_PHY_MULTI_PAGE_REG)) {
3165 ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, 3166 ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT,
@@ -3298,7 +3299,7 @@ e1000_write_phy_reg(struct e1000_hw *hw,
3298 if (e1000_swfw_sync_acquire(hw, swfw)) 3299 if (e1000_swfw_sync_acquire(hw, swfw))
3299 return -E1000_ERR_SWFW_SYNC; 3300 return -E1000_ERR_SWFW_SYNC;
3300 3301
3301 if((hw->phy_type == e1000_phy_igp || 3302 if((hw->phy_type == e1000_phy_igp ||
3302 hw->phy_type == e1000_phy_igp_2) && 3303 hw->phy_type == e1000_phy_igp_2) &&
3303 (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { 3304 (reg_addr > MAX_PHY_MULTI_PAGE_REG)) {
3304 ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, 3305 ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT,
@@ -3496,22 +3497,22 @@ e1000_phy_hw_reset(struct e1000_hw *hw)
3496 } 3497 }
3497 /* Read the device control register and assert the E1000_CTRL_PHY_RST 3498 /* Read the device control register and assert the E1000_CTRL_PHY_RST
3498 * bit. Then, take it out of reset. 3499 * bit. Then, take it out of reset.
3499 * For pre-e1000_82571 hardware, we delay for 10ms between the assert 3500 * For pre-e1000_82571 hardware, we delay for 10ms between the assert
3500 * and deassert. For e1000_82571 hardware and later, we instead delay 3501 * and deassert. For e1000_82571 hardware and later, we instead delay
3501 * for 50us between and 10ms after the deassertion. 3502 * for 50us between and 10ms after the deassertion.
3502 */ 3503 */
3503 ctrl = E1000_READ_REG(hw, CTRL); 3504 ctrl = E1000_READ_REG(hw, CTRL);
3504 E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PHY_RST); 3505 E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PHY_RST);
3505 E1000_WRITE_FLUSH(hw); 3506 E1000_WRITE_FLUSH(hw);
3506 3507
3507 if (hw->mac_type < e1000_82571) 3508 if (hw->mac_type < e1000_82571)
3508 msec_delay(10); 3509 msec_delay(10);
3509 else 3510 else
3510 udelay(100); 3511 udelay(100);
3511 3512
3512 E1000_WRITE_REG(hw, CTRL, ctrl); 3513 E1000_WRITE_REG(hw, CTRL, ctrl);
3513 E1000_WRITE_FLUSH(hw); 3514 E1000_WRITE_FLUSH(hw);
3514 3515
3515 if (hw->mac_type >= e1000_82571) 3516 if (hw->mac_type >= e1000_82571)
3516 msec_delay(10); 3517 msec_delay(10);
3517 e1000_swfw_sync_release(hw, swfw); 3518 e1000_swfw_sync_release(hw, swfw);
@@ -3815,7 +3816,7 @@ e1000_phy_m88_get_info(struct e1000_hw *hw,
3815 /* Check polarity status */ 3816 /* Check polarity status */
3816 ret_val = e1000_check_polarity(hw, &polarity); 3817 ret_val = e1000_check_polarity(hw, &polarity);
3817 if(ret_val) 3818 if(ret_val)
3818 return ret_val; 3819 return ret_val;
3819 phy_info->cable_polarity = polarity; 3820 phy_info->cable_polarity = polarity;
3820 3821
3821 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); 3822 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
@@ -4540,14 +4541,14 @@ e1000_read_eeprom_eerd(struct e1000_hw *hw,
4540 4541
4541 E1000_WRITE_REG(hw, EERD, eerd); 4542 E1000_WRITE_REG(hw, EERD, eerd);
4542 error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_READ); 4543 error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_READ);
4543 4544
4544 if(error) { 4545 if(error) {
4545 break; 4546 break;
4546 } 4547 }
4547 data[i] = (E1000_READ_REG(hw, EERD) >> E1000_EEPROM_RW_REG_DATA); 4548 data[i] = (E1000_READ_REG(hw, EERD) >> E1000_EEPROM_RW_REG_DATA);
4548 4549
4549 } 4550 }
4550 4551
4551 return error; 4552 return error;
4552} 4553}
4553 4554
@@ -4573,24 +4574,24 @@ e1000_write_eeprom_eewr(struct e1000_hw *hw,
4573 return -E1000_ERR_SWFW_SYNC; 4574 return -E1000_ERR_SWFW_SYNC;
4574 4575
4575 for (i = 0; i < words; i++) { 4576 for (i = 0; i < words; i++) {
4576 register_value = (data[i] << E1000_EEPROM_RW_REG_DATA) | 4577 register_value = (data[i] << E1000_EEPROM_RW_REG_DATA) |
4577 ((offset+i) << E1000_EEPROM_RW_ADDR_SHIFT) | 4578 ((offset+i) << E1000_EEPROM_RW_ADDR_SHIFT) |
4578 E1000_EEPROM_RW_REG_START; 4579 E1000_EEPROM_RW_REG_START;
4579 4580
4580 error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE); 4581 error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE);
4581 if(error) { 4582 if(error) {
4582 break; 4583 break;
4583 } 4584 }
4584 4585
4585 E1000_WRITE_REG(hw, EEWR, register_value); 4586 E1000_WRITE_REG(hw, EEWR, register_value);
4586 4587
4587 error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE); 4588 error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE);
4588 4589
4589 if(error) { 4590 if(error) {
4590 break; 4591 break;
4591 } 4592 }
4592 } 4593 }
4593 4594
4594 e1000_swfw_sync_release(hw, E1000_SWFW_EEP_SM); 4595 e1000_swfw_sync_release(hw, E1000_SWFW_EEP_SM);
4595 return error; 4596 return error;
4596} 4597}
@@ -4610,7 +4611,7 @@ e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd)
4610 for(i = 0; i < attempts; i++) { 4611 for(i = 0; i < attempts; i++) {
4611 if(eerd == E1000_EEPROM_POLL_READ) 4612 if(eerd == E1000_EEPROM_POLL_READ)
4612 reg = E1000_READ_REG(hw, EERD); 4613 reg = E1000_READ_REG(hw, EERD);
4613 else 4614 else
4614 reg = E1000_READ_REG(hw, EEWR); 4615 reg = E1000_READ_REG(hw, EEWR);
4615 4616
4616 if(reg & E1000_EEPROM_RW_REG_DONE) { 4617 if(reg & E1000_EEPROM_RW_REG_DONE) {
@@ -5135,7 +5136,7 @@ e1000_mc_addr_list_update(struct e1000_hw *hw,
5135 uint32_t i; 5136 uint32_t i;
5136 uint32_t num_rar_entry; 5137 uint32_t num_rar_entry;
5137 uint32_t num_mta_entry; 5138 uint32_t num_mta_entry;
5138 5139
5139 DEBUGFUNC("e1000_mc_addr_list_update"); 5140 DEBUGFUNC("e1000_mc_addr_list_update");
5140 5141
5141 /* Set the new number of MC addresses that we are being requested to use. */ 5142 /* Set the new number of MC addresses that we are being requested to use. */
@@ -6240,7 +6241,7 @@ e1000_check_polarity(struct e1000_hw *hw,
6240 * 1 - Downshift ocured. 6241 * 1 - Downshift ocured.
6241 * 6242 *
6242 * returns: - E1000_ERR_XXX 6243 * returns: - E1000_ERR_XXX
6243 * E1000_SUCCESS 6244 * E1000_SUCCESS
6244 * 6245 *
6245 * For phy's older then IGP, this function reads the Downshift bit in the Phy 6246 * For phy's older then IGP, this function reads the Downshift bit in the Phy
6246 * Specific Status register. For IGP phy's, it reads the Downgrade bit in the 6247 * Specific Status register. For IGP phy's, it reads the Downgrade bit in the
@@ -6255,7 +6256,7 @@ e1000_check_downshift(struct e1000_hw *hw)
6255 6256
6256 DEBUGFUNC("e1000_check_downshift"); 6257 DEBUGFUNC("e1000_check_downshift");
6257 6258
6258 if(hw->phy_type == e1000_phy_igp || 6259 if(hw->phy_type == e1000_phy_igp ||
6259 hw->phy_type == e1000_phy_igp_2) { 6260 hw->phy_type == e1000_phy_igp_2) {
6260 ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH, 6261 ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH,
6261 &phy_data); 6262 &phy_data);
@@ -6684,8 +6685,8 @@ e1000_set_d0_lplu_state(struct e1000_hw *hw,
6684 6685
6685 6686
6686 } else { 6687 } else {
6687 6688
6688 phy_data |= IGP02E1000_PM_D0_LPLU; 6689 phy_data |= IGP02E1000_PM_D0_LPLU;
6689 ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); 6690 ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data);
6690 if (ret_val) 6691 if (ret_val)
6691 return ret_val; 6692 return ret_val;
@@ -6777,7 +6778,7 @@ int32_t
6777e1000_host_if_read_cookie(struct e1000_hw * hw, uint8_t *buffer) 6778e1000_host_if_read_cookie(struct e1000_hw * hw, uint8_t *buffer)
6778{ 6779{
6779 uint8_t i; 6780 uint8_t i;
6780 uint32_t offset = E1000_MNG_DHCP_COOKIE_OFFSET; 6781 uint32_t offset = E1000_MNG_DHCP_COOKIE_OFFSET;
6781 uint8_t length = E1000_MNG_DHCP_COOKIE_LENGTH; 6782 uint8_t length = E1000_MNG_DHCP_COOKIE_LENGTH;
6782 6783
6783 length = (length >> 2); 6784 length = (length >> 2);
@@ -6796,7 +6797,7 @@ e1000_host_if_read_cookie(struct e1000_hw * hw, uint8_t *buffer)
6796 * and also checks whether the previous command is completed. 6797 * and also checks whether the previous command is completed.
6797 * It busy waits in case of previous command is not completed. 6798 * It busy waits in case of previous command is not completed.
6798 * 6799 *
6799 * returns: - E1000_ERR_HOST_INTERFACE_COMMAND in case if is not ready or 6800 * returns: - E1000_ERR_HOST_INTERFACE_COMMAND in case if is not ready or
6800 * timeout 6801 * timeout
6801 * - E1000_SUCCESS for success. 6802 * - E1000_SUCCESS for success.
6802 ****************************************************************************/ 6803 ****************************************************************************/
@@ -6820,7 +6821,7 @@ e1000_mng_enable_host_if(struct e1000_hw * hw)
6820 msec_delay_irq(1); 6821 msec_delay_irq(1);
6821 } 6822 }
6822 6823
6823 if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) { 6824 if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) {
6824 DEBUGOUT("Previous command timeout failed .\n"); 6825 DEBUGOUT("Previous command timeout failed .\n");
6825 return -E1000_ERR_HOST_INTERFACE_COMMAND; 6826 return -E1000_ERR_HOST_INTERFACE_COMMAND;
6826 } 6827 }
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index 150e45e30f87..467c9ed944f8 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -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,6 +22,7 @@
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*******************************************************************************/
@@ -374,7 +375,7 @@ struct e1000_host_mng_dhcp_cookie{
374}; 375};
375#endif 376#endif
376 377
377int32_t e1000_mng_write_dhcp_info(struct e1000_hw *hw, uint8_t *buffer, 378int32_t e1000_mng_write_dhcp_info(struct e1000_hw *hw, uint8_t *buffer,
378 uint16_t length); 379 uint16_t length);
379boolean_t e1000_check_mng_mode(struct e1000_hw *hw); 380boolean_t e1000_check_mng_mode(struct e1000_hw *hw);
380boolean_t e1000_enable_tx_pkt_filtering(struct e1000_hw *hw); 381boolean_t e1000_enable_tx_pkt_filtering(struct e1000_hw *hw);
@@ -1801,7 +1802,7 @@ struct e1000_hw {
1801 * value2 = [0..64512], default=4096 1802 * value2 = [0..64512], default=4096
1802 * value3 = [0..64512], default=0 1803 * value3 = [0..64512], default=0
1803 */ 1804 */
1804 1805
1805#define E1000_PSRCTL_BSIZE0_MASK 0x0000007F 1806#define E1000_PSRCTL_BSIZE0_MASK 0x0000007F
1806#define E1000_PSRCTL_BSIZE1_MASK 0x00003F00 1807#define E1000_PSRCTL_BSIZE1_MASK 0x00003F00
1807#define E1000_PSRCTL_BSIZE2_MASK 0x003F0000 1808#define E1000_PSRCTL_BSIZE2_MASK 0x003F0000
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
70char e1000_driver_name[] = "e1000"; 32char e1000_driver_name[] = "e1000";
71static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; 33static 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
78char e1000_driver_version[] = DRV_VERSION; 40char e1000_driver_version[] = DRV_VERSION;
79static char e1000_copyright[] = "Copyright (c) 1999-2005 Intel Corporation."; 41static 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);
208static void e1000_tx_timeout(struct net_device *dev); 170static void e1000_tx_timeout(struct net_device *dev);
209static void e1000_reset_task(struct net_device *dev); 171static void e1000_reset_task(struct net_device *dev);
210static void e1000_smartspeed(struct e1000_adapter *adapter); 172static void e1000_smartspeed(struct e1000_adapter *adapter);
211static inline int e1000_82547_fifo_workaround(struct e1000_adapter *adapter, 173static int e1000_82547_fifo_workaround(struct e1000_adapter *adapter,
212 struct sk_buff *skb); 174 struct sk_buff *skb);
213 175
214static void e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp); 176static void e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp);
215static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid); 177static 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);
227static void e1000_netpoll (struct net_device *netdev); 189static void e1000_netpoll (struct net_device *netdev);
228#endif 190#endif
229 191
192static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev,
193 pci_channel_state_t state);
194static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev);
195static void e1000_io_resume(struct pci_dev *pdev);
196
197static 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
231static struct pci_driver e1000_driver = { 203static 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
244MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); 217MODULE_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
296static inline void 269static void
297e1000_irq_disable(struct e1000_adapter *adapter) 270e1000_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
310static inline void 283static void
311e1000_irq_enable(struct e1000_adapter *adapter) 284e1000_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
354static inline void 327static void
355e1000_release_hw_control(struct e1000_adapter *adapter) 328e1000_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
388static inline void 362static void
389e1000_get_hw_control(struct e1000_adapter *adapter) 363e1000_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 **/
1184static inline boolean_t 1159static boolean_t
1185e1000_check_64k_bound(struct e1000_adapter *adapter, 1160e1000_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
1810static inline void 1791static void
1811e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter, 1792e1000_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
2403static inline int 2384static int
2404e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, 2385e1000_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
2483static inline boolean_t 2464static boolean_t
2484e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, 2465e1000_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
2519static inline int 2500static int
2520e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, 2501e1000_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
2628static inline void 2609static void
2629e1000_tx_queue(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, 2610e1000_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
2692static inline int 2673static int
2693e1000_82547_fifo_workaround(struct e1000_adapter *adapter, struct sk_buff *skb) 2674e1000_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
2719static inline int 2700static int
2720e1000_transfer_dhcp_info(struct e1000_adapter *adapter, struct sk_buff *skb) 2701e1000_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
3060e1000_update_stats(struct e1000_adapter *adapter) 3045e1000_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
3448static inline void 3444static void
3449e1000_rx_checksum(struct e1000_adapter *adapter, 3445e1000_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 */
4622static 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 */
4643static 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 */
4675static 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 */
diff --git a/drivers/net/e1000/e1000_osdep.h b/drivers/net/e1000/e1000_osdep.h
index 9790db974dc1..048d052be29d 100644
--- a/drivers/net/e1000/e1000_osdep.h
+++ b/drivers/net/e1000/e1000_osdep.h
@@ -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,6 +22,7 @@
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*******************************************************************************/
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index e0a4d37d1b85..e55f8969a0fb 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.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,6 +22,7 @@
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*******************************************************************************/