aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r--drivers/net/e1000e/82571.c153
-rw-r--r--drivers/net/e1000e/defines.h13
-rw-r--r--drivers/net/e1000e/e1000.h28
-rw-r--r--drivers/net/e1000e/es2lan.c2
-rw-r--r--drivers/net/e1000e/ethtool.c38
-rw-r--r--drivers/net/e1000e/hw.h11
-rw-r--r--drivers/net/e1000e/ich8lan.c18
-rw-r--r--drivers/net/e1000e/lib.c7
-rw-r--r--drivers/net/e1000e/netdev.c409
-rw-r--r--drivers/net/e1000e/param.c27
-rw-r--r--drivers/net/e1000e/phy.c109
11 files changed, 738 insertions, 77 deletions
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index 462351ca2c81..b2c910c52df9 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -38,6 +38,7 @@
38 * 82573V Gigabit Ethernet Controller (Copper) 38 * 82573V Gigabit Ethernet Controller (Copper)
39 * 82573E Gigabit Ethernet Controller (Copper) 39 * 82573E Gigabit Ethernet Controller (Copper)
40 * 82573L Gigabit Ethernet Controller 40 * 82573L Gigabit Ethernet Controller
41 * 82574L Gigabit Network Connection
41 */ 42 */
42 43
43#include <linux/netdevice.h> 44#include <linux/netdevice.h>
@@ -54,6 +55,8 @@
54 55
55#define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 56#define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000
56 57
58#define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */
59
57static s32 e1000_get_phy_id_82571(struct e1000_hw *hw); 60static s32 e1000_get_phy_id_82571(struct e1000_hw *hw);
58static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw); 61static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw);
59static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw); 62static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw);
@@ -63,6 +66,8 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw);
63static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw); 66static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw);
64static s32 e1000_setup_link_82571(struct e1000_hw *hw); 67static s32 e1000_setup_link_82571(struct e1000_hw *hw);
65static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw); 68static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw);
69static bool e1000_check_mng_mode_82574(struct e1000_hw *hw);
70static s32 e1000_led_on_82574(struct e1000_hw *hw);
66 71
67/** 72/**
68 * e1000_init_phy_params_82571 - Init PHY func ptrs. 73 * e1000_init_phy_params_82571 - Init PHY func ptrs.
@@ -92,6 +97,9 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
92 case e1000_82573: 97 case e1000_82573:
93 phy->type = e1000_phy_m88; 98 phy->type = e1000_phy_m88;
94 break; 99 break;
100 case e1000_82574:
101 phy->type = e1000_phy_bm;
102 break;
95 default: 103 default:
96 return -E1000_ERR_PHY; 104 return -E1000_ERR_PHY;
97 break; 105 break;
@@ -111,6 +119,10 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
111 if (phy->id != M88E1111_I_PHY_ID) 119 if (phy->id != M88E1111_I_PHY_ID)
112 return -E1000_ERR_PHY; 120 return -E1000_ERR_PHY;
113 break; 121 break;
122 case e1000_82574:
123 if (phy->id != BME1000_E_PHY_ID_R2)
124 return -E1000_ERR_PHY;
125 break;
114 default: 126 default:
115 return -E1000_ERR_PHY; 127 return -E1000_ERR_PHY;
116 break; 128 break;
@@ -150,6 +162,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
150 162
151 switch (hw->mac.type) { 163 switch (hw->mac.type) {
152 case e1000_82573: 164 case e1000_82573:
165 case e1000_82574:
153 if (((eecd >> 15) & 0x3) == 0x3) { 166 if (((eecd >> 15) & 0x3) == 0x3) {
154 nvm->type = e1000_nvm_flash_hw; 167 nvm->type = e1000_nvm_flash_hw;
155 nvm->word_size = 2048; 168 nvm->word_size = 2048;
@@ -245,6 +258,17 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
245 break; 258 break;
246 } 259 }
247 260
261 switch (hw->mac.type) {
262 case e1000_82574:
263 func->check_mng_mode = e1000_check_mng_mode_82574;
264 func->led_on = e1000_led_on_82574;
265 break;
266 default:
267 func->check_mng_mode = e1000e_check_mng_mode_generic;
268 func->led_on = e1000e_led_on_generic;
269 break;
270 }
271
248 return 0; 272 return 0;
249} 273}
250 274
@@ -330,6 +354,8 @@ static s32 e1000_get_variants_82571(struct e1000_adapter *adapter)
330static s32 e1000_get_phy_id_82571(struct e1000_hw *hw) 354static s32 e1000_get_phy_id_82571(struct e1000_hw *hw)
331{ 355{
332 struct e1000_phy_info *phy = &hw->phy; 356 struct e1000_phy_info *phy = &hw->phy;
357 s32 ret_val;
358 u16 phy_id = 0;
333 359
334 switch (hw->mac.type) { 360 switch (hw->mac.type) {
335 case e1000_82571: 361 case e1000_82571:
@@ -345,6 +371,20 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw)
345 case e1000_82573: 371 case e1000_82573:
346 return e1000e_get_phy_id(hw); 372 return e1000e_get_phy_id(hw);
347 break; 373 break;
374 case e1000_82574:
375 ret_val = e1e_rphy(hw, PHY_ID1, &phy_id);
376 if (ret_val)
377 return ret_val;
378
379 phy->id = (u32)(phy_id << 16);
380 udelay(20);
381 ret_val = e1e_rphy(hw, PHY_ID2, &phy_id);
382 if (ret_val)
383 return ret_val;
384
385 phy->id |= (u32)(phy_id);
386 phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK);
387 break;
348 default: 388 default:
349 return -E1000_ERR_PHY; 389 return -E1000_ERR_PHY;
350 break; 390 break;
@@ -421,7 +461,7 @@ static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw)
421 if (ret_val) 461 if (ret_val)
422 return ret_val; 462 return ret_val;
423 463
424 if (hw->mac.type != e1000_82573) 464 if (hw->mac.type != e1000_82573 && hw->mac.type != e1000_82574)
425 ret_val = e1000e_acquire_nvm(hw); 465 ret_val = e1000e_acquire_nvm(hw);
426 466
427 if (ret_val) 467 if (ret_val)
@@ -461,6 +501,7 @@ static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words,
461 501
462 switch (hw->mac.type) { 502 switch (hw->mac.type) {
463 case e1000_82573: 503 case e1000_82573:
504 case e1000_82574:
464 ret_val = e1000_write_nvm_eewr_82571(hw, offset, words, data); 505 ret_val = e1000_write_nvm_eewr_82571(hw, offset, words, data);
465 break; 506 break;
466 case e1000_82571: 507 case e1000_82571:
@@ -735,7 +776,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
735 * Must acquire the MDIO ownership before MAC reset. 776 * Must acquire the MDIO ownership before MAC reset.
736 * Ownership defaults to firmware after a reset. 777 * Ownership defaults to firmware after a reset.
737 */ 778 */
738 if (hw->mac.type == e1000_82573) { 779 if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) {
739 extcnf_ctrl = er32(EXTCNF_CTRL); 780 extcnf_ctrl = er32(EXTCNF_CTRL);
740 extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; 781 extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
741 782
@@ -776,7 +817,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
776 * Need to wait for Phy configuration completion before accessing 817 * Need to wait for Phy configuration completion before accessing
777 * NVM and Phy. 818 * NVM and Phy.
778 */ 819 */
779 if (hw->mac.type == e1000_82573) 820 if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574)
780 msleep(25); 821 msleep(25);
781 822
782 /* Clear any pending interrupt events. */ 823 /* Clear any pending interrupt events. */
@@ -843,7 +884,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
843 ew32(TXDCTL(0), reg_data); 884 ew32(TXDCTL(0), reg_data);
844 885
845 /* ...for both queues. */ 886 /* ...for both queues. */
846 if (mac->type != e1000_82573) { 887 if (mac->type != e1000_82573 && mac->type != e1000_82574) {
847 reg_data = er32(TXDCTL(1)); 888 reg_data = er32(TXDCTL(1));
848 reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | 889 reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) |
849 E1000_TXDCTL_FULL_TX_DESC_WB | 890 E1000_TXDCTL_FULL_TX_DESC_WB |
@@ -918,19 +959,28 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
918 } 959 }
919 960
920 /* Device Control */ 961 /* Device Control */
921 if (hw->mac.type == e1000_82573) { 962 if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) {
922 reg = er32(CTRL); 963 reg = er32(CTRL);
923 reg &= ~(1 << 29); 964 reg &= ~(1 << 29);
924 ew32(CTRL, reg); 965 ew32(CTRL, reg);
925 } 966 }
926 967
927 /* Extended Device Control */ 968 /* Extended Device Control */
928 if (hw->mac.type == e1000_82573) { 969 if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) {
929 reg = er32(CTRL_EXT); 970 reg = er32(CTRL_EXT);
930 reg &= ~(1 << 23); 971 reg &= ~(1 << 23);
931 reg |= (1 << 22); 972 reg |= (1 << 22);
932 ew32(CTRL_EXT, reg); 973 ew32(CTRL_EXT, reg);
933 } 974 }
975
976 /* PCI-Ex Control Register */
977 if (hw->mac.type == e1000_82574) {
978 reg = er32(GCR);
979 reg |= (1 << 22);
980 ew32(GCR, reg);
981 }
982
983 return;
934} 984}
935 985
936/** 986/**
@@ -947,7 +997,7 @@ void e1000e_clear_vfta(struct e1000_hw *hw)
947 u32 vfta_offset = 0; 997 u32 vfta_offset = 0;
948 u32 vfta_bit_in_reg = 0; 998 u32 vfta_bit_in_reg = 0;
949 999
950 if (hw->mac.type == e1000_82573) { 1000 if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) {
951 if (hw->mng_cookie.vlan_id != 0) { 1001 if (hw->mng_cookie.vlan_id != 0) {
952 /* 1002 /*
953 * The VFTA is a 4096b bit-field, each identifying 1003 * The VFTA is a 4096b bit-field, each identifying
@@ -976,6 +1026,48 @@ void e1000e_clear_vfta(struct e1000_hw *hw)
976} 1026}
977 1027
978/** 1028/**
1029 * e1000_check_mng_mode_82574 - Check manageability is enabled
1030 * @hw: pointer to the HW structure
1031 *
1032 * Reads the NVM Initialization Control Word 2 and returns true
1033 * (>0) if any manageability is enabled, else false (0).
1034 **/
1035static bool e1000_check_mng_mode_82574(struct e1000_hw *hw)
1036{
1037 u16 data;
1038
1039 e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data);
1040 return (data & E1000_NVM_INIT_CTRL2_MNGM) != 0;
1041}
1042
1043/**
1044 * e1000_led_on_82574 - Turn LED on
1045 * @hw: pointer to the HW structure
1046 *
1047 * Turn LED on.
1048 **/
1049static s32 e1000_led_on_82574(struct e1000_hw *hw)
1050{
1051 u32 ctrl;
1052 u32 i;
1053
1054 ctrl = hw->mac.ledctl_mode2;
1055 if (!(E1000_STATUS_LU & er32(STATUS))) {
1056 /*
1057 * If no link, then turn LED on by setting the invert bit
1058 * for each LED that's "on" (0x0E) in ledctl_mode2.
1059 */
1060 for (i = 0; i < 4; i++)
1061 if (((hw->mac.ledctl_mode2 >> (i * 8)) & 0xFF) ==
1062 E1000_LEDCTL_MODE_LED_ON)
1063 ctrl |= (E1000_LEDCTL_LED0_IVRT << (i * 8));
1064 }
1065 ew32(LEDCTL, ctrl);
1066
1067 return 0;
1068}
1069
1070/**
979 * e1000_update_mc_addr_list_82571 - Update Multicast addresses 1071 * e1000_update_mc_addr_list_82571 - Update Multicast addresses
980 * @hw: pointer to the HW structure 1072 * @hw: pointer to the HW structure
981 * @mc_addr_list: array of multicast addresses to program 1073 * @mc_addr_list: array of multicast addresses to program
@@ -1018,7 +1110,8 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw)
1018 * the default flow control setting, so we explicitly 1110 * the default flow control setting, so we explicitly
1019 * set it to full. 1111 * set it to full.
1020 */ 1112 */
1021 if (hw->mac.type == e1000_82573) 1113 if ((hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) &&
1114 hw->fc.type == e1000_fc_default)
1022 hw->fc.type = e1000_fc_full; 1115 hw->fc.type = e1000_fc_full;
1023 1116
1024 return e1000e_setup_link(hw); 1117 return e1000e_setup_link(hw);
@@ -1045,6 +1138,7 @@ static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw)
1045 1138
1046 switch (hw->phy.type) { 1139 switch (hw->phy.type) {
1047 case e1000_phy_m88: 1140 case e1000_phy_m88:
1141 case e1000_phy_bm:
1048 ret_val = e1000e_copper_link_setup_m88(hw); 1142 ret_val = e1000e_copper_link_setup_m88(hw);
1049 break; 1143 break;
1050 case e1000_phy_igp_2: 1144 case e1000_phy_igp_2:
@@ -1114,11 +1208,10 @@ static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data)
1114 return ret_val; 1208 return ret_val;
1115 } 1209 }
1116 1210
1117 if (hw->mac.type == e1000_82573 && 1211 if ((hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) &&
1118 *data == ID_LED_RESERVED_F746) 1212 *data == ID_LED_RESERVED_F746)
1119 *data = ID_LED_DEFAULT_82573; 1213 *data = ID_LED_DEFAULT_82573;
1120 else if (*data == ID_LED_RESERVED_0000 || 1214 else if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF)
1121 *data == ID_LED_RESERVED_FFFF)
1122 *data = ID_LED_DEFAULT; 1215 *data = ID_LED_DEFAULT;
1123 1216
1124 return 0; 1217 return 0;
@@ -1265,13 +1358,13 @@ static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw)
1265} 1358}
1266 1359
1267static struct e1000_mac_operations e82571_mac_ops = { 1360static struct e1000_mac_operations e82571_mac_ops = {
1268 .mng_mode_enab = E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT, 1361 /* .check_mng_mode: mac type dependent */
1269 /* .check_for_link: media type dependent */ 1362 /* .check_for_link: media type dependent */
1270 .cleanup_led = e1000e_cleanup_led_generic, 1363 .cleanup_led = e1000e_cleanup_led_generic,
1271 .clear_hw_cntrs = e1000_clear_hw_cntrs_82571, 1364 .clear_hw_cntrs = e1000_clear_hw_cntrs_82571,
1272 .get_bus_info = e1000e_get_bus_info_pcie, 1365 .get_bus_info = e1000e_get_bus_info_pcie,
1273 /* .get_link_up_info: media type dependent */ 1366 /* .get_link_up_info: media type dependent */
1274 .led_on = e1000e_led_on_generic, 1367 /* .led_on: mac type dependent */
1275 .led_off = e1000e_led_off_generic, 1368 .led_off = e1000e_led_off_generic,
1276 .update_mc_addr_list = e1000_update_mc_addr_list_82571, 1369 .update_mc_addr_list = e1000_update_mc_addr_list_82571,
1277 .reset_hw = e1000_reset_hw_82571, 1370 .reset_hw = e1000_reset_hw_82571,
@@ -1312,6 +1405,22 @@ static struct e1000_phy_operations e82_phy_ops_m88 = {
1312 .write_phy_reg = e1000e_write_phy_reg_m88, 1405 .write_phy_reg = e1000e_write_phy_reg_m88,
1313}; 1406};
1314 1407
1408static struct e1000_phy_operations e82_phy_ops_bm = {
1409 .acquire_phy = e1000_get_hw_semaphore_82571,
1410 .check_reset_block = e1000e_check_reset_block_generic,
1411 .commit_phy = e1000e_phy_sw_reset,
1412 .force_speed_duplex = e1000e_phy_force_speed_duplex_m88,
1413 .get_cfg_done = e1000e_get_cfg_done,
1414 .get_cable_length = e1000e_get_cable_length_m88,
1415 .get_phy_info = e1000e_get_phy_info_m88,
1416 .read_phy_reg = e1000e_read_phy_reg_bm2,
1417 .release_phy = e1000_put_hw_semaphore_82571,
1418 .reset_phy = e1000e_phy_hw_reset_generic,
1419 .set_d0_lplu_state = e1000_set_d0_lplu_state_82571,
1420 .set_d3_lplu_state = e1000e_set_d3_lplu_state,
1421 .write_phy_reg = e1000e_write_phy_reg_bm2,
1422};
1423
1315static struct e1000_nvm_operations e82571_nvm_ops = { 1424static struct e1000_nvm_operations e82571_nvm_ops = {
1316 .acquire_nvm = e1000_acquire_nvm_82571, 1425 .acquire_nvm = e1000_acquire_nvm_82571,
1317 .read_nvm = e1000e_read_nvm_eerd, 1426 .read_nvm = e1000e_read_nvm_eerd,
@@ -1375,3 +1484,21 @@ struct e1000_info e1000_82573_info = {
1375 .nvm_ops = &e82571_nvm_ops, 1484 .nvm_ops = &e82571_nvm_ops,
1376}; 1485};
1377 1486
1487struct e1000_info e1000_82574_info = {
1488 .mac = e1000_82574,
1489 .flags = FLAG_HAS_HW_VLAN_FILTER
1490 | FLAG_HAS_MSIX
1491 | FLAG_HAS_JUMBO_FRAMES
1492 | FLAG_HAS_WOL
1493 | FLAG_APME_IN_CTRL3
1494 | FLAG_RX_CSUM_ENABLED
1495 | FLAG_HAS_SMART_POWER_DOWN
1496 | FLAG_HAS_AMT
1497 | FLAG_HAS_CTRLEXT_ON_LOAD,
1498 .pba = 20,
1499 .get_variants = e1000_get_variants_82571,
1500 .mac_ops = &e82571_mac_ops,
1501 .phy_ops = &e82_phy_ops_bm,
1502 .nvm_ops = &e82571_nvm_ops,
1503};
1504
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index 4b21fa99d68e..48f79ecb82a0 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -71,9 +71,11 @@
71#define E1000_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */ 71#define E1000_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */
72#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 72#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
73#define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000 73#define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000
74#define E1000_CTRL_EXT_EIAME 0x01000000
74#define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ 75#define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */
75#define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */ 76#define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */
76#define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */ 77#define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */
78#define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */
77 79
78/* Receive Descriptor bit definitions */ 80/* Receive Descriptor bit definitions */
79#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */ 81#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */
@@ -299,6 +301,7 @@
299#define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ 301#define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */
300 302
301/* Header split receive */ 303/* Header split receive */
304#define E1000_RFCTL_ACK_DIS 0x00001000
302#define E1000_RFCTL_EXTEN 0x00008000 305#define E1000_RFCTL_EXTEN 0x00008000
303#define E1000_RFCTL_IPV6_EX_DIS 0x00010000 306#define E1000_RFCTL_IPV6_EX_DIS 0x00010000
304#define E1000_RFCTL_NEW_IPV6_EXT_DIS 0x00020000 307#define E1000_RFCTL_NEW_IPV6_EXT_DIS 0x00020000
@@ -363,6 +366,11 @@
363#define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */ 366#define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */
364#define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */ 367#define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */
365#define E1000_ICR_INT_ASSERTED 0x80000000 /* If this bit asserted, the driver should claim the interrupt */ 368#define E1000_ICR_INT_ASSERTED 0x80000000 /* If this bit asserted, the driver should claim the interrupt */
369#define E1000_ICR_RXQ0 0x00100000 /* Rx Queue 0 Interrupt */
370#define E1000_ICR_RXQ1 0x00200000 /* Rx Queue 1 Interrupt */
371#define E1000_ICR_TXQ0 0x00400000 /* Tx Queue 0 Interrupt */
372#define E1000_ICR_TXQ1 0x00800000 /* Tx Queue 1 Interrupt */
373#define E1000_ICR_OTHER 0x01000000 /* Other Interrupts */
366 374
367/* 375/*
368 * This defines the bits that are set in the Interrupt Mask 376 * This defines the bits that are set in the Interrupt Mask
@@ -386,6 +394,11 @@
386#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */ 394#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */
387#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ 395#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */
388#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */ 396#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */
397#define E1000_IMS_RXQ0 E1000_ICR_RXQ0 /* Rx Queue 0 Interrupt */
398#define E1000_IMS_RXQ1 E1000_ICR_RXQ1 /* Rx Queue 1 Interrupt */
399#define E1000_IMS_TXQ0 E1000_ICR_TXQ0 /* Tx Queue 0 Interrupt */
400#define E1000_IMS_TXQ1 E1000_ICR_TXQ1 /* Tx Queue 1 Interrupt */
401#define E1000_IMS_OTHER E1000_ICR_OTHER /* Other Interrupts */
389 402
390/* Interrupt Cause Set */ 403/* Interrupt Cause Set */
391#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ 404#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index ef66dc44fae6..0a1916b0419d 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -62,6 +62,11 @@ struct e1000_info;
62 e_printk(KERN_NOTICE, adapter, format, ## arg) 62 e_printk(KERN_NOTICE, adapter, format, ## arg)
63 63
64 64
65/* Interrupt modes, as used by the IntMode paramter */
66#define E1000E_INT_MODE_LEGACY 0
67#define E1000E_INT_MODE_MSI 1
68#define E1000E_INT_MODE_MSIX 2
69
65/* Tx/Rx descriptor defines */ 70/* Tx/Rx descriptor defines */
66#define E1000_DEFAULT_TXD 256 71#define E1000_DEFAULT_TXD 256
67#define E1000_MAX_TXD 4096 72#define E1000_MAX_TXD 4096
@@ -95,6 +100,7 @@ enum e1000_boards {
95 board_82571, 100 board_82571,
96 board_82572, 101 board_82572,
97 board_82573, 102 board_82573,
103 board_82574,
98 board_80003es2lan, 104 board_80003es2lan,
99 board_ich8lan, 105 board_ich8lan,
100 board_ich9lan, 106 board_ich9lan,
@@ -147,6 +153,12 @@ struct e1000_ring {
147 /* array of buffer information structs */ 153 /* array of buffer information structs */
148 struct e1000_buffer *buffer_info; 154 struct e1000_buffer *buffer_info;
149 155
156 char name[IFNAMSIZ + 5];
157 u32 ims_val;
158 u32 itr_val;
159 u16 itr_register;
160 int set_itr;
161
150 struct sk_buff *rx_skb_top; 162 struct sk_buff *rx_skb_top;
151 163
152 struct e1000_queue_stats stats; 164 struct e1000_queue_stats stats;
@@ -275,6 +287,9 @@ struct e1000_adapter {
275 u32 test_icr; 287 u32 test_icr;
276 288
277 u32 msg_enable; 289 u32 msg_enable;
290 struct msix_entry *msix_entries;
291 int int_mode;
292 u32 eiac_mask;
278 293
279 u32 eeprom_wol; 294 u32 eeprom_wol;
280 u32 wol; 295 u32 wol;
@@ -307,6 +322,7 @@ struct e1000_info {
307#define FLAG_HAS_SWSM_ON_LOAD (1 << 6) 322#define FLAG_HAS_SWSM_ON_LOAD (1 << 6)
308#define FLAG_HAS_JUMBO_FRAMES (1 << 7) 323#define FLAG_HAS_JUMBO_FRAMES (1 << 7)
309#define FLAG_IS_ICH (1 << 9) 324#define FLAG_IS_ICH (1 << 9)
325#define FLAG_HAS_MSIX (1 << 10)
310#define FLAG_HAS_SMART_POWER_DOWN (1 << 11) 326#define FLAG_HAS_SMART_POWER_DOWN (1 << 11)
311#define FLAG_IS_QUAD_PORT_A (1 << 12) 327#define FLAG_IS_QUAD_PORT_A (1 << 12)
312#define FLAG_IS_QUAD_PORT (1 << 13) 328#define FLAG_IS_QUAD_PORT (1 << 13)
@@ -365,6 +381,8 @@ extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter);
365extern void e1000e_free_rx_resources(struct e1000_adapter *adapter); 381extern void e1000e_free_rx_resources(struct e1000_adapter *adapter);
366extern void e1000e_free_tx_resources(struct e1000_adapter *adapter); 382extern void e1000e_free_tx_resources(struct e1000_adapter *adapter);
367extern void e1000e_update_stats(struct e1000_adapter *adapter); 383extern void e1000e_update_stats(struct e1000_adapter *adapter);
384extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter);
385extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter);
368 386
369extern unsigned int copybreak; 387extern unsigned int copybreak;
370 388
@@ -373,6 +391,7 @@ extern char *e1000e_get_hw_dev_name(struct e1000_hw *hw);
373extern struct e1000_info e1000_82571_info; 391extern struct e1000_info e1000_82571_info;
374extern struct e1000_info e1000_82572_info; 392extern struct e1000_info e1000_82572_info;
375extern struct e1000_info e1000_82573_info; 393extern struct e1000_info e1000_82573_info;
394extern struct e1000_info e1000_82574_info;
376extern struct e1000_info e1000_ich8_info; 395extern struct e1000_info e1000_ich8_info;
377extern struct e1000_info e1000_ich9_info; 396extern struct e1000_info e1000_ich9_info;
378extern struct e1000_info e1000_ich10_info; 397extern struct e1000_info e1000_ich10_info;
@@ -453,6 +472,8 @@ extern enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id);
453extern s32 e1000e_determine_phy_address(struct e1000_hw *hw); 472extern s32 e1000e_determine_phy_address(struct e1000_hw *hw);
454extern s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data); 473extern s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data);
455extern s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data); 474extern s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data);
475extern s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data);
476extern s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data);
456extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl); 477extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl);
457extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data); 478extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
458extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data); 479extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
@@ -523,7 +544,12 @@ static inline s32 e1000_get_phy_info(struct e1000_hw *hw)
523 return hw->phy.ops.get_phy_info(hw); 544 return hw->phy.ops.get_phy_info(hw);
524} 545}
525 546
526extern bool e1000e_check_mng_mode(struct e1000_hw *hw); 547static inline s32 e1000e_check_mng_mode(struct e1000_hw *hw)
548{
549 return hw->mac.ops.check_mng_mode(hw);
550}
551
552extern bool e1000e_check_mng_mode_generic(struct e1000_hw *hw);
527extern bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw); 553extern bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw);
528extern s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length); 554extern s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length);
529 555
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index dc552d7d6fac..da9c09c248ed 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -1247,7 +1247,7 @@ static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw)
1247} 1247}
1248 1248
1249static struct e1000_mac_operations es2_mac_ops = { 1249static struct e1000_mac_operations es2_mac_ops = {
1250 .mng_mode_enab = E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT, 1250 .check_mng_mode = e1000e_check_mng_mode_generic,
1251 /* check_for_link dependent on media type */ 1251 /* check_for_link dependent on media type */
1252 .cleanup_led = e1000e_cleanup_led_generic, 1252 .cleanup_led = e1000e_cleanup_led_generic,
1253 .clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan, 1253 .clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan,
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index a89498dcb636..52b762eb1745 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -568,6 +568,7 @@ static int e1000_set_eeprom(struct net_device *netdev,
568 * and flush shadow RAM for 82573 controllers 568 * and flush shadow RAM for 82573 controllers
569 */ 569 */
570 if ((ret_val == 0) && ((first_word <= NVM_CHECKSUM_REG) || 570 if ((ret_val == 0) && ((first_word <= NVM_CHECKSUM_REG) ||
571 (hw->mac.type == e1000_82574) ||
571 (hw->mac.type == e1000_82573))) 572 (hw->mac.type == e1000_82573)))
572 e1000e_update_nvm_checksum(hw); 573 e1000e_update_nvm_checksum(hw);
573 574
@@ -779,6 +780,7 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
779 toggle = 0x7FFFF3FF; 780 toggle = 0x7FFFF3FF;
780 break; 781 break;
781 case e1000_82573: 782 case e1000_82573:
783 case e1000_82574:
782 case e1000_ich8lan: 784 case e1000_ich8lan:
783 case e1000_ich9lan: 785 case e1000_ich9lan:
784 case e1000_ich10lan: 786 case e1000_ich10lan:
@@ -887,10 +889,18 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
887 u32 shared_int = 1; 889 u32 shared_int = 1;
888 u32 irq = adapter->pdev->irq; 890 u32 irq = adapter->pdev->irq;
889 int i; 891 int i;
892 int ret_val = 0;
893 int int_mode = E1000E_INT_MODE_LEGACY;
890 894
891 *data = 0; 895 *data = 0;
892 896
893 /* NOTE: we don't test MSI interrupts here, yet */ 897 /* NOTE: we don't test MSI/MSI-X interrupts here, yet */
898 if (adapter->int_mode == E1000E_INT_MODE_MSIX) {
899 int_mode = adapter->int_mode;
900 e1000e_reset_interrupt_capability(adapter);
901 adapter->int_mode = E1000E_INT_MODE_LEGACY;
902 e1000e_set_interrupt_capability(adapter);
903 }
894 /* Hook up test interrupt handler just for this test */ 904 /* Hook up test interrupt handler just for this test */
895 if (!request_irq(irq, &e1000_test_intr, IRQF_PROBE_SHARED, netdev->name, 905 if (!request_irq(irq, &e1000_test_intr, IRQF_PROBE_SHARED, netdev->name,
896 netdev)) { 906 netdev)) {
@@ -898,7 +908,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
898 } else if (request_irq(irq, &e1000_test_intr, IRQF_SHARED, 908 } else if (request_irq(irq, &e1000_test_intr, IRQF_SHARED,
899 netdev->name, netdev)) { 909 netdev->name, netdev)) {
900 *data = 1; 910 *data = 1;
901 return -1; 911 ret_val = -1;
912 goto out;
902 } 913 }
903 e_info("testing %s interrupt\n", (shared_int ? "shared" : "unshared")); 914 e_info("testing %s interrupt\n", (shared_int ? "shared" : "unshared"));
904 915
@@ -988,7 +999,14 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
988 /* Unhook test interrupt handler */ 999 /* Unhook test interrupt handler */
989 free_irq(irq, netdev); 1000 free_irq(irq, netdev);
990 1001
991 return *data; 1002out:
1003 if (int_mode == E1000E_INT_MODE_MSIX) {
1004 e1000e_reset_interrupt_capability(adapter);
1005 adapter->int_mode = int_mode;
1006 e1000e_set_interrupt_capability(adapter);
1007 }
1008
1009 return ret_val;
992} 1010}
993 1011
994static void e1000_free_desc_rings(struct e1000_adapter *adapter) 1012static void e1000_free_desc_rings(struct e1000_adapter *adapter)
@@ -1769,11 +1787,13 @@ static void e1000_led_blink_callback(unsigned long data)
1769static int e1000_phys_id(struct net_device *netdev, u32 data) 1787static int e1000_phys_id(struct net_device *netdev, u32 data)
1770{ 1788{
1771 struct e1000_adapter *adapter = netdev_priv(netdev); 1789 struct e1000_adapter *adapter = netdev_priv(netdev);
1790 struct e1000_hw *hw = &adapter->hw;
1772 1791
1773 if (!data) 1792 if (!data)
1774 data = INT_MAX; 1793 data = INT_MAX;
1775 1794
1776 if (adapter->hw.phy.type == e1000_phy_ife) { 1795 if ((hw->phy.type == e1000_phy_ife) ||
1796 (hw->mac.type == e1000_82574)) {
1777 if (!adapter->blink_timer.function) { 1797 if (!adapter->blink_timer.function) {
1778 init_timer(&adapter->blink_timer); 1798 init_timer(&adapter->blink_timer);
1779 adapter->blink_timer.function = 1799 adapter->blink_timer.function =
@@ -1783,16 +1803,16 @@ static int e1000_phys_id(struct net_device *netdev, u32 data)
1783 mod_timer(&adapter->blink_timer, jiffies); 1803 mod_timer(&adapter->blink_timer, jiffies);
1784 msleep_interruptible(data * 1000); 1804 msleep_interruptible(data * 1000);
1785 del_timer_sync(&adapter->blink_timer); 1805 del_timer_sync(&adapter->blink_timer);
1786 e1e_wphy(&adapter->hw, 1806 if (hw->phy.type == e1000_phy_ife)
1787 IFE_PHY_SPECIAL_CONTROL_LED, 0); 1807 e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED, 0);
1788 } else { 1808 } else {
1789 e1000e_blink_led(&adapter->hw); 1809 e1000e_blink_led(hw);
1790 msleep_interruptible(data * 1000); 1810 msleep_interruptible(data * 1000);
1791 } 1811 }
1792 1812
1793 adapter->hw.mac.ops.led_off(&adapter->hw); 1813 hw->mac.ops.led_off(hw);
1794 clear_bit(E1000_LED_ON, &adapter->led_status); 1814 clear_bit(E1000_LED_ON, &adapter->led_status);
1795 adapter->hw.mac.ops.cleanup_led(&adapter->hw); 1815 hw->mac.ops.cleanup_led(hw);
1796 1816
1797 return 0; 1817 return 0;
1798} 1818}
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index 5d2acc531b5c..f66ed37a7f76 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -65,7 +65,11 @@ enum e1e_registers {
65 E1000_ICS = 0x000C8, /* Interrupt Cause Set - WO */ 65 E1000_ICS = 0x000C8, /* Interrupt Cause Set - WO */
66 E1000_IMS = 0x000D0, /* Interrupt Mask Set - RW */ 66 E1000_IMS = 0x000D0, /* Interrupt Mask Set - RW */
67 E1000_IMC = 0x000D8, /* Interrupt Mask Clear - WO */ 67 E1000_IMC = 0x000D8, /* Interrupt Mask Clear - WO */
68 E1000_EIAC_82574 = 0x000DC, /* Ext. Interrupt Auto Clear - RW */
68 E1000_IAM = 0x000E0, /* Interrupt Acknowledge Auto Mask */ 69 E1000_IAM = 0x000E0, /* Interrupt Acknowledge Auto Mask */
70 E1000_IVAR = 0x000E4, /* Interrupt Vector Allocation - RW */
71 E1000_EITR_82574_BASE = 0x000E8, /* Interrupt Throttling - RW */
72#define E1000_EITR_82574(_n) (E1000_EITR_82574_BASE + (_n << 2))
69 E1000_RCTL = 0x00100, /* Rx Control - RW */ 73 E1000_RCTL = 0x00100, /* Rx Control - RW */
70 E1000_FCTTV = 0x00170, /* Flow Control Transmit Timer Value - RW */ 74 E1000_FCTTV = 0x00170, /* Flow Control Transmit Timer Value - RW */
71 E1000_TXCW = 0x00178, /* Tx Configuration Word - RW */ 75 E1000_TXCW = 0x00178, /* Tx Configuration Word - RW */
@@ -332,6 +336,7 @@ enum e1e_registers {
332#define E1000_DEV_ID_82573E 0x108B 336#define E1000_DEV_ID_82573E 0x108B
333#define E1000_DEV_ID_82573E_IAMT 0x108C 337#define E1000_DEV_ID_82573E_IAMT 0x108C
334#define E1000_DEV_ID_82573L 0x109A 338#define E1000_DEV_ID_82573L 0x109A
339#define E1000_DEV_ID_82574L 0x10D3
335 340
336#define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096 341#define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096
337#define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098 342#define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098
@@ -360,12 +365,15 @@ enum e1e_registers {
360#define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE 365#define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE
361#define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF 366#define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF
362 367
368#define E1000_REVISION_4 4
369
363#define E1000_FUNC_1 1 370#define E1000_FUNC_1 1
364 371
365enum e1000_mac_type { 372enum e1000_mac_type {
366 e1000_82571, 373 e1000_82571,
367 e1000_82572, 374 e1000_82572,
368 e1000_82573, 375 e1000_82573,
376 e1000_82574,
369 e1000_80003es2lan, 377 e1000_80003es2lan,
370 e1000_ich8lan, 378 e1000_ich8lan,
371 e1000_ich9lan, 379 e1000_ich9lan,
@@ -700,8 +708,7 @@ struct e1000_host_mng_command_info {
700 708
701/* Function pointers and static data for the MAC. */ 709/* Function pointers and static data for the MAC. */
702struct e1000_mac_operations { 710struct e1000_mac_operations {
703 u32 mng_mode_enab; 711 bool (*check_mng_mode)(struct e1000_hw *);
704
705 s32 (*check_for_link)(struct e1000_hw *); 712 s32 (*check_for_link)(struct e1000_hw *);
706 s32 (*cleanup_led)(struct e1000_hw *); 713 s32 (*cleanup_led)(struct e1000_hw *);
707 void (*clear_hw_cntrs)(struct e1000_hw *); 714 void (*clear_hw_cntrs)(struct e1000_hw *);
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 0e76bb0378fd..019b9c0bcdcb 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -422,6 +422,22 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
422} 422}
423 423
424/** 424/**
425 * e1000_check_mng_mode_ich8lan - Checks management mode
426 * @hw: pointer to the HW structure
427 *
428 * This checks if the adapter has manageability enabled.
429 * This is a function pointer entry point only called by read/write
430 * routines for the PHY and NVM parts.
431 **/
432static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw)
433{
434 u32 fwsm = er32(FWSM);
435
436 return (fwsm & E1000_FWSM_MODE_MASK) ==
437 (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT);
438}
439
440/**
425 * e1000_check_reset_block_ich8lan - Check if PHY reset is blocked 441 * e1000_check_reset_block_ich8lan - Check if PHY reset is blocked
426 * @hw: pointer to the HW structure 442 * @hw: pointer to the HW structure
427 * 443 *
@@ -2400,7 +2416,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
2400} 2416}
2401 2417
2402static struct e1000_mac_operations ich8_mac_ops = { 2418static struct e1000_mac_operations ich8_mac_ops = {
2403 .mng_mode_enab = E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT, 2419 .check_mng_mode = e1000_check_mng_mode_ich8lan,
2404 .check_for_link = e1000e_check_for_copper_link, 2420 .check_for_link = e1000e_check_for_copper_link,
2405 .cleanup_led = e1000_cleanup_led_ich8lan, 2421 .cleanup_led = e1000_cleanup_led_ich8lan,
2406 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, 2422 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan,
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index f1f4e9dfd0a0..c7337306ffa7 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -2222,17 +2222,18 @@ static s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
2222} 2222}
2223 2223
2224/** 2224/**
2225 * e1000e_check_mng_mode - check management mode 2225 * e1000e_check_mng_mode_generic - check management mode
2226 * @hw: pointer to the HW structure 2226 * @hw: pointer to the HW structure
2227 * 2227 *
2228 * Reads the firmware semaphore register and returns true (>0) if 2228 * Reads the firmware semaphore register and returns true (>0) if
2229 * manageability is enabled, else false (0). 2229 * manageability is enabled, else false (0).
2230 **/ 2230 **/
2231bool e1000e_check_mng_mode(struct e1000_hw *hw) 2231bool e1000e_check_mng_mode_generic(struct e1000_hw *hw)
2232{ 2232{
2233 u32 fwsm = er32(FWSM); 2233 u32 fwsm = er32(FWSM);
2234 2234
2235 return (fwsm & E1000_FWSM_MODE_MASK) == hw->mac.ops.mng_mode_enab; 2235 return (fwsm & E1000_FWSM_MODE_MASK) ==
2236 (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT);
2236} 2237}
2237 2238
2238/** 2239/**
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 2d9bcb02d093..0925204cd2d8 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -55,6 +55,7 @@ static const struct e1000_info *e1000_info_tbl[] = {
55 [board_82571] = &e1000_82571_info, 55 [board_82571] = &e1000_82571_info,
56 [board_82572] = &e1000_82572_info, 56 [board_82572] = &e1000_82572_info,
57 [board_82573] = &e1000_82573_info, 57 [board_82573] = &e1000_82573_info,
58 [board_82574] = &e1000_82574_info,
58 [board_80003es2lan] = &e1000_es2_info, 59 [board_80003es2lan] = &e1000_es2_info,
59 [board_ich8lan] = &e1000_ich8_info, 60 [board_ich8lan] = &e1000_ich8_info,
60 [board_ich9lan] = &e1000_ich9_info, 61 [board_ich9lan] = &e1000_ich9_info,
@@ -1180,8 +1181,8 @@ static irqreturn_t e1000_intr(int irq, void *data)
1180 struct net_device *netdev = data; 1181 struct net_device *netdev = data;
1181 struct e1000_adapter *adapter = netdev_priv(netdev); 1182 struct e1000_adapter *adapter = netdev_priv(netdev);
1182 struct e1000_hw *hw = &adapter->hw; 1183 struct e1000_hw *hw = &adapter->hw;
1183
1184 u32 rctl, icr = er32(ICR); 1184 u32 rctl, icr = er32(ICR);
1185
1185 if (!icr) 1186 if (!icr)
1186 return IRQ_NONE; /* Not our interrupt */ 1187 return IRQ_NONE; /* Not our interrupt */
1187 1188
@@ -1237,6 +1238,263 @@ static irqreturn_t e1000_intr(int irq, void *data)
1237 return IRQ_HANDLED; 1238 return IRQ_HANDLED;
1238} 1239}
1239 1240
1241static irqreturn_t e1000_msix_other(int irq, void *data)
1242{
1243 struct net_device *netdev = data;
1244 struct e1000_adapter *adapter = netdev_priv(netdev);
1245 struct e1000_hw *hw = &adapter->hw;
1246 u32 icr = er32(ICR);
1247
1248 if (!(icr & E1000_ICR_INT_ASSERTED)) {
1249 ew32(IMS, E1000_IMS_OTHER);
1250 return IRQ_NONE;
1251 }
1252
1253 if (icr & adapter->eiac_mask)
1254 ew32(ICS, (icr & adapter->eiac_mask));
1255
1256 if (icr & E1000_ICR_OTHER) {
1257 if (!(icr & E1000_ICR_LSC))
1258 goto no_link_interrupt;
1259 hw->mac.get_link_status = 1;
1260 /* guard against interrupt when we're going down */
1261 if (!test_bit(__E1000_DOWN, &adapter->state))
1262 mod_timer(&adapter->watchdog_timer, jiffies + 1);
1263 }
1264
1265no_link_interrupt:
1266 ew32(IMS, E1000_IMS_LSC | E1000_IMS_OTHER);
1267
1268 return IRQ_HANDLED;
1269}
1270
1271
1272static irqreturn_t e1000_intr_msix_tx(int irq, void *data)
1273{
1274 struct net_device *netdev = data;
1275 struct e1000_adapter *adapter = netdev_priv(netdev);
1276 struct e1000_hw *hw = &adapter->hw;
1277 struct e1000_ring *tx_ring = adapter->tx_ring;
1278
1279
1280 adapter->total_tx_bytes = 0;
1281 adapter->total_tx_packets = 0;
1282
1283 if (!e1000_clean_tx_irq(adapter))
1284 /* Ring was not completely cleaned, so fire another interrupt */
1285 ew32(ICS, tx_ring->ims_val);
1286
1287 return IRQ_HANDLED;
1288}
1289
1290static irqreturn_t e1000_intr_msix_rx(int irq, void *data)
1291{
1292 struct net_device *netdev = data;
1293 struct e1000_adapter *adapter = netdev_priv(netdev);
1294
1295 /* Write the ITR value calculated at the end of the
1296 * previous interrupt.
1297 */
1298 if (adapter->rx_ring->set_itr) {
1299 writel(1000000000 / (adapter->rx_ring->itr_val * 256),
1300 adapter->hw.hw_addr + adapter->rx_ring->itr_register);
1301 adapter->rx_ring->set_itr = 0;
1302 }
1303
1304 if (netif_rx_schedule_prep(netdev, &adapter->napi)) {
1305 adapter->total_rx_bytes = 0;
1306 adapter->total_rx_packets = 0;
1307 __netif_rx_schedule(netdev, &adapter->napi);
1308 }
1309 return IRQ_HANDLED;
1310}
1311
1312/**
1313 * e1000_configure_msix - Configure MSI-X hardware
1314 *
1315 * e1000_configure_msix sets up the hardware to properly
1316 * generate MSI-X interrupts.
1317 **/
1318static void e1000_configure_msix(struct e1000_adapter *adapter)
1319{
1320 struct e1000_hw *hw = &adapter->hw;
1321 struct e1000_ring *rx_ring = adapter->rx_ring;
1322 struct e1000_ring *tx_ring = adapter->tx_ring;
1323 int vector = 0;
1324 u32 ctrl_ext, ivar = 0;
1325
1326 adapter->eiac_mask = 0;
1327
1328 /* Workaround issue with spurious interrupts on 82574 in MSI-X mode */
1329 if (hw->mac.type == e1000_82574) {
1330 u32 rfctl = er32(RFCTL);
1331 rfctl |= E1000_RFCTL_ACK_DIS;
1332 ew32(RFCTL, rfctl);
1333 }
1334
1335#define E1000_IVAR_INT_ALLOC_VALID 0x8
1336 /* Configure Rx vector */
1337 rx_ring->ims_val = E1000_IMS_RXQ0;
1338 adapter->eiac_mask |= rx_ring->ims_val;
1339 if (rx_ring->itr_val)
1340 writel(1000000000 / (rx_ring->itr_val * 256),
1341 hw->hw_addr + rx_ring->itr_register);
1342 else
1343 writel(1, hw->hw_addr + rx_ring->itr_register);
1344 ivar = E1000_IVAR_INT_ALLOC_VALID | vector;
1345
1346 /* Configure Tx vector */
1347 tx_ring->ims_val = E1000_IMS_TXQ0;
1348 vector++;
1349 if (tx_ring->itr_val)
1350 writel(1000000000 / (tx_ring->itr_val * 256),
1351 hw->hw_addr + tx_ring->itr_register);
1352 else
1353 writel(1, hw->hw_addr + tx_ring->itr_register);
1354 adapter->eiac_mask |= tx_ring->ims_val;
1355 ivar |= ((E1000_IVAR_INT_ALLOC_VALID | vector) << 8);
1356
1357 /* set vector for Other Causes, e.g. link changes */
1358 vector++;
1359 ivar |= ((E1000_IVAR_INT_ALLOC_VALID | vector) << 16);
1360 if (rx_ring->itr_val)
1361 writel(1000000000 / (rx_ring->itr_val * 256),
1362 hw->hw_addr + E1000_EITR_82574(vector));
1363 else
1364 writel(1, hw->hw_addr + E1000_EITR_82574(vector));
1365
1366 /* Cause Tx interrupts on every write back */
1367 ivar |= (1 << 31);
1368
1369 ew32(IVAR, ivar);
1370
1371 /* enable MSI-X PBA support */
1372 ctrl_ext = er32(CTRL_EXT);
1373 ctrl_ext |= E1000_CTRL_EXT_PBA_CLR;
1374
1375 /* Auto-Mask Other interrupts upon ICR read */
1376#define E1000_EIAC_MASK_82574 0x01F00000
1377 ew32(IAM, ~E1000_EIAC_MASK_82574 | E1000_IMS_OTHER);
1378 ctrl_ext |= E1000_CTRL_EXT_EIAME;
1379 ew32(CTRL_EXT, ctrl_ext);
1380 e1e_flush();
1381}
1382
1383void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter)
1384{
1385 if (adapter->msix_entries) {
1386 pci_disable_msix(adapter->pdev);
1387 kfree(adapter->msix_entries);
1388 adapter->msix_entries = NULL;
1389 } else if (adapter->flags & FLAG_MSI_ENABLED) {
1390 pci_disable_msi(adapter->pdev);
1391 adapter->flags &= ~FLAG_MSI_ENABLED;
1392 }
1393
1394 return;
1395}
1396
1397/**
1398 * e1000e_set_interrupt_capability - set MSI or MSI-X if supported
1399 *
1400 * Attempt to configure interrupts using the best available
1401 * capabilities of the hardware and kernel.
1402 **/
1403void e1000e_set_interrupt_capability(struct e1000_adapter *adapter)
1404{
1405 int err;
1406 int numvecs, i;
1407
1408
1409 switch (adapter->int_mode) {
1410 case E1000E_INT_MODE_MSIX:
1411 if (adapter->flags & FLAG_HAS_MSIX) {
1412 numvecs = 3; /* RxQ0, TxQ0 and other */
1413 adapter->msix_entries = kcalloc(numvecs,
1414 sizeof(struct msix_entry),
1415 GFP_KERNEL);
1416 if (adapter->msix_entries) {
1417 for (i = 0; i < numvecs; i++)
1418 adapter->msix_entries[i].entry = i;
1419
1420 err = pci_enable_msix(adapter->pdev,
1421 adapter->msix_entries,
1422 numvecs);
1423 if (err == 0)
1424 return;
1425 }
1426 /* MSI-X failed, so fall through and try MSI */
1427 e_err("Failed to initialize MSI-X interrupts. "
1428 "Falling back to MSI interrupts.\n");
1429 e1000e_reset_interrupt_capability(adapter);
1430 }
1431 adapter->int_mode = E1000E_INT_MODE_MSI;
1432 /* Fall through */
1433 case E1000E_INT_MODE_MSI:
1434 if (!pci_enable_msi(adapter->pdev)) {
1435 adapter->flags |= FLAG_MSI_ENABLED;
1436 } else {
1437 adapter->int_mode = E1000E_INT_MODE_LEGACY;
1438 e_err("Failed to initialize MSI interrupts. Falling "
1439 "back to legacy interrupts.\n");
1440 }
1441 /* Fall through */
1442 case E1000E_INT_MODE_LEGACY:
1443 /* Don't do anything; this is the system default */
1444 break;
1445 }
1446
1447 return;
1448}
1449
1450/**
1451 * e1000_request_msix - Initialize MSI-X interrupts
1452 *
1453 * e1000_request_msix allocates MSI-X vectors and requests interrupts from the
1454 * kernel.
1455 **/
1456static int e1000_request_msix(struct e1000_adapter *adapter)
1457{
1458 struct net_device *netdev = adapter->netdev;
1459 int err = 0, vector = 0;
1460
1461 if (strlen(netdev->name) < (IFNAMSIZ - 5))
1462 sprintf(adapter->rx_ring->name, "%s-rx0", netdev->name);
1463 else
1464 memcpy(adapter->rx_ring->name, netdev->name, IFNAMSIZ);
1465 err = request_irq(adapter->msix_entries[vector].vector,
1466 &e1000_intr_msix_rx, 0, adapter->rx_ring->name,
1467 netdev);
1468 if (err)
1469 goto out;
1470 adapter->rx_ring->itr_register = E1000_EITR_82574(vector);
1471 adapter->rx_ring->itr_val = adapter->itr;
1472 vector++;
1473
1474 if (strlen(netdev->name) < (IFNAMSIZ - 5))
1475 sprintf(adapter->tx_ring->name, "%s-tx0", netdev->name);
1476 else
1477 memcpy(adapter->tx_ring->name, netdev->name, IFNAMSIZ);
1478 err = request_irq(adapter->msix_entries[vector].vector,
1479 &e1000_intr_msix_tx, 0, adapter->tx_ring->name,
1480 netdev);
1481 if (err)
1482 goto out;
1483 adapter->tx_ring->itr_register = E1000_EITR_82574(vector);
1484 adapter->tx_ring->itr_val = adapter->itr;
1485 vector++;
1486
1487 err = request_irq(adapter->msix_entries[vector].vector,
1488 &e1000_msix_other, 0, netdev->name, netdev);
1489 if (err)
1490 goto out;
1491
1492 e1000_configure_msix(adapter);
1493 return 0;
1494out:
1495 return err;
1496}
1497
1240/** 1498/**
1241 * e1000_request_irq - initialize interrupts 1499 * e1000_request_irq - initialize interrupts
1242 * 1500 *
@@ -1246,29 +1504,33 @@ static irqreturn_t e1000_intr(int irq, void *data)
1246static int e1000_request_irq(struct e1000_adapter *adapter) 1504static int e1000_request_irq(struct e1000_adapter *adapter)
1247{ 1505{
1248 struct net_device *netdev = adapter->netdev; 1506 struct net_device *netdev = adapter->netdev;
1249 int irq_flags = IRQF_SHARED;
1250 int err; 1507 int err;
1251 1508
1252 if (!(adapter->flags & FLAG_MSI_TEST_FAILED)) { 1509 if (adapter->msix_entries) {
1253 err = pci_enable_msi(adapter->pdev); 1510 err = e1000_request_msix(adapter);
1254 if (!err) { 1511 if (!err)
1255 adapter->flags |= FLAG_MSI_ENABLED; 1512 return err;
1256 irq_flags = 0; 1513 /* fall back to MSI */
1257 } 1514 e1000e_reset_interrupt_capability(adapter);
1515 adapter->int_mode = E1000E_INT_MODE_MSI;
1516 e1000e_set_interrupt_capability(adapter);
1258 } 1517 }
1518 if (adapter->flags & FLAG_MSI_ENABLED) {
1519 err = request_irq(adapter->pdev->irq, &e1000_intr_msi, 0,
1520 netdev->name, netdev);
1521 if (!err)
1522 return err;
1259 1523
1260 err = request_irq(adapter->pdev->irq, 1524 /* fall back to legacy interrupt */
1261 ((adapter->flags & FLAG_MSI_ENABLED) ? 1525 e1000e_reset_interrupt_capability(adapter);
1262 &e1000_intr_msi : &e1000_intr), 1526 adapter->int_mode = E1000E_INT_MODE_LEGACY;
1263 irq_flags, netdev->name, netdev);
1264 if (err) {
1265 if (adapter->flags & FLAG_MSI_ENABLED) {
1266 pci_disable_msi(adapter->pdev);
1267 adapter->flags &= ~FLAG_MSI_ENABLED;
1268 }
1269 e_err("Unable to allocate interrupt, Error: %d\n", err);
1270 } 1527 }
1271 1528
1529 err = request_irq(adapter->pdev->irq, &e1000_intr, IRQF_SHARED,
1530 netdev->name, netdev);
1531 if (err)
1532 e_err("Unable to allocate interrupt, Error: %d\n", err);
1533
1272 return err; 1534 return err;
1273} 1535}
1274 1536
@@ -1276,11 +1538,21 @@ static void e1000_free_irq(struct e1000_adapter *adapter)
1276{ 1538{
1277 struct net_device *netdev = adapter->netdev; 1539 struct net_device *netdev = adapter->netdev;
1278 1540
1279 free_irq(adapter->pdev->irq, netdev); 1541 if (adapter->msix_entries) {
1280 if (adapter->flags & FLAG_MSI_ENABLED) { 1542 int vector = 0;
1281 pci_disable_msi(adapter->pdev); 1543
1282 adapter->flags &= ~FLAG_MSI_ENABLED; 1544 free_irq(adapter->msix_entries[vector].vector, netdev);
1545 vector++;
1546
1547 free_irq(adapter->msix_entries[vector].vector, netdev);
1548 vector++;
1549
1550 /* Other Causes interrupt vector */
1551 free_irq(adapter->msix_entries[vector].vector, netdev);
1552 return;
1283 } 1553 }
1554
1555 free_irq(adapter->pdev->irq, netdev);
1284} 1556}
1285 1557
1286/** 1558/**
@@ -1291,6 +1563,8 @@ static void e1000_irq_disable(struct e1000_adapter *adapter)
1291 struct e1000_hw *hw = &adapter->hw; 1563 struct e1000_hw *hw = &adapter->hw;
1292 1564
1293 ew32(IMC, ~0); 1565 ew32(IMC, ~0);
1566 if (adapter->msix_entries)
1567 ew32(EIAC_82574, 0);
1294 e1e_flush(); 1568 e1e_flush();
1295 synchronize_irq(adapter->pdev->irq); 1569 synchronize_irq(adapter->pdev->irq);
1296} 1570}
@@ -1302,7 +1576,12 @@ static void e1000_irq_enable(struct e1000_adapter *adapter)
1302{ 1576{
1303 struct e1000_hw *hw = &adapter->hw; 1577 struct e1000_hw *hw = &adapter->hw;
1304 1578
1305 ew32(IMS, IMS_ENABLE_MASK); 1579 if (adapter->msix_entries) {
1580 ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574);
1581 ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER | E1000_IMS_LSC);
1582 } else {
1583 ew32(IMS, IMS_ENABLE_MASK);
1584 }
1306 e1e_flush(); 1585 e1e_flush();
1307} 1586}
1308 1587
@@ -1552,9 +1831,8 @@ void e1000e_free_rx_resources(struct e1000_adapter *adapter)
1552 * traffic pattern. Constants in this function were computed 1831 * traffic pattern. Constants in this function were computed
1553 * based on theoretical maximum wire speed and thresholds were set based 1832 * based on theoretical maximum wire speed and thresholds were set based
1554 * on testing data as well as attempting to minimize response time 1833 * on testing data as well as attempting to minimize response time
1555 * while increasing bulk throughput. 1834 * while increasing bulk throughput. This functionality is controlled
1556 * this functionality is controlled by the InterruptThrottleRate module 1835 * by the InterruptThrottleRate module parameter.
1557 * parameter (see e1000_param.c)
1558 **/ 1836 **/
1559static unsigned int e1000_update_itr(struct e1000_adapter *adapter, 1837static unsigned int e1000_update_itr(struct e1000_adapter *adapter,
1560 u16 itr_setting, int packets, 1838 u16 itr_setting, int packets,
@@ -1662,11 +1940,37 @@ set_itr_now:
1662 min(adapter->itr + (new_itr >> 2), new_itr) : 1940 min(adapter->itr + (new_itr >> 2), new_itr) :
1663 new_itr; 1941 new_itr;
1664 adapter->itr = new_itr; 1942 adapter->itr = new_itr;
1665 ew32(ITR, 1000000000 / (new_itr * 256)); 1943 adapter->rx_ring->itr_val = new_itr;
1944 if (adapter->msix_entries)
1945 adapter->rx_ring->set_itr = 1;
1946 else
1947 ew32(ITR, 1000000000 / (new_itr * 256));
1666 } 1948 }
1667} 1949}
1668 1950
1669/** 1951/**
1952 * e1000_alloc_queues - Allocate memory for all rings
1953 * @adapter: board private structure to initialize
1954 **/
1955static int __devinit e1000_alloc_queues(struct e1000_adapter *adapter)
1956{
1957 adapter->tx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL);
1958 if (!adapter->tx_ring)
1959 goto err;
1960
1961 adapter->rx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL);
1962 if (!adapter->rx_ring)
1963 goto err;
1964
1965 return 0;
1966err:
1967 e_err("Unable to allocate memory for queues\n");
1968 kfree(adapter->rx_ring);
1969 kfree(adapter->tx_ring);
1970 return -ENOMEM;
1971}
1972
1973/**
1670 * e1000_clean - NAPI Rx polling callback 1974 * e1000_clean - NAPI Rx polling callback
1671 * @napi: struct associated with this polling callback 1975 * @napi: struct associated with this polling callback
1672 * @budget: amount of packets driver is allowed to process this poll 1976 * @budget: amount of packets driver is allowed to process this poll
@@ -1674,12 +1978,17 @@ set_itr_now:
1674static int e1000_clean(struct napi_struct *napi, int budget) 1978static int e1000_clean(struct napi_struct *napi, int budget)
1675{ 1979{
1676 struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi); 1980 struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi);
1981 struct e1000_hw *hw = &adapter->hw;
1677 struct net_device *poll_dev = adapter->netdev; 1982 struct net_device *poll_dev = adapter->netdev;
1678 int tx_cleaned = 0, work_done = 0; 1983 int tx_cleaned = 0, work_done = 0;
1679 1984
1680 /* Must NOT use netdev_priv macro here. */ 1985 /* Must NOT use netdev_priv macro here. */
1681 adapter = poll_dev->priv; 1986 adapter = poll_dev->priv;
1682 1987
1988 if (adapter->msix_entries &&
1989 !(adapter->rx_ring->ims_val & adapter->tx_ring->ims_val))
1990 goto clean_rx;
1991
1683 /* 1992 /*
1684 * e1000_clean is called per-cpu. This lock protects 1993 * e1000_clean is called per-cpu. This lock protects
1685 * tx_ring from being cleaned by multiple cpus 1994 * tx_ring from being cleaned by multiple cpus
@@ -1691,6 +2000,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1691 spin_unlock(&adapter->tx_queue_lock); 2000 spin_unlock(&adapter->tx_queue_lock);
1692 } 2001 }
1693 2002
2003clean_rx:
1694 adapter->clean_rx(adapter, &work_done, budget); 2004 adapter->clean_rx(adapter, &work_done, budget);
1695 2005
1696 if (tx_cleaned) 2006 if (tx_cleaned)
@@ -1701,7 +2011,10 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1701 if (adapter->itr_setting & 3) 2011 if (adapter->itr_setting & 3)
1702 e1000_set_itr(adapter); 2012 e1000_set_itr(adapter);
1703 netif_rx_complete(poll_dev, napi); 2013 netif_rx_complete(poll_dev, napi);
1704 e1000_irq_enable(adapter); 2014 if (adapter->msix_entries)
2015 ew32(IMS, adapter->rx_ring->ims_val);
2016 else
2017 e1000_irq_enable(adapter);
1705 } 2018 }
1706 2019
1707 return work_done; 2020 return work_done;
@@ -2497,6 +2810,8 @@ int e1000e_up(struct e1000_adapter *adapter)
2497 clear_bit(__E1000_DOWN, &adapter->state); 2810 clear_bit(__E1000_DOWN, &adapter->state);
2498 2811
2499 napi_enable(&adapter->napi); 2812 napi_enable(&adapter->napi);
2813 if (adapter->msix_entries)
2814 e1000_configure_msix(adapter);
2500 e1000_irq_enable(adapter); 2815 e1000_irq_enable(adapter);
2501 2816
2502 /* fire a link change interrupt to start the watchdog */ 2817 /* fire a link change interrupt to start the watchdog */
@@ -2580,13 +2895,10 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
2580 adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; 2895 adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
2581 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; 2896 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
2582 2897
2583 adapter->tx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); 2898 e1000e_set_interrupt_capability(adapter);
2584 if (!adapter->tx_ring)
2585 goto err;
2586 2899
2587 adapter->rx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); 2900 if (e1000_alloc_queues(adapter))
2588 if (!adapter->rx_ring) 2901 return -ENOMEM;
2589 goto err;
2590 2902
2591 spin_lock_init(&adapter->tx_queue_lock); 2903 spin_lock_init(&adapter->tx_queue_lock);
2592 2904
@@ -2597,12 +2909,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
2597 2909
2598 set_bit(__E1000_DOWN, &adapter->state); 2910 set_bit(__E1000_DOWN, &adapter->state);
2599 return 0; 2911 return 0;
2600
2601err:
2602 e_err("Unable to allocate memory for queues\n");
2603 kfree(adapter->rx_ring);
2604 kfree(adapter->tx_ring);
2605 return -ENOMEM;
2606} 2912}
2607 2913
2608/** 2914/**
@@ -2644,6 +2950,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
2644 2950
2645 /* free the real vector and request a test handler */ 2951 /* free the real vector and request a test handler */
2646 e1000_free_irq(adapter); 2952 e1000_free_irq(adapter);
2953 e1000e_reset_interrupt_capability(adapter);
2647 2954
2648 /* Assume that the test fails, if it succeeds then the test 2955 /* Assume that the test fails, if it succeeds then the test
2649 * MSI irq handler will unset this flag */ 2956 * MSI irq handler will unset this flag */
@@ -2674,6 +2981,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
2674 rmb(); 2981 rmb();
2675 2982
2676 if (adapter->flags & FLAG_MSI_TEST_FAILED) { 2983 if (adapter->flags & FLAG_MSI_TEST_FAILED) {
2984 adapter->int_mode = E1000E_INT_MODE_LEGACY;
2677 err = -EIO; 2985 err = -EIO;
2678 e_info("MSI interrupt test failed!\n"); 2986 e_info("MSI interrupt test failed!\n");
2679 } 2987 }
@@ -2687,7 +2995,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
2687 /* okay so the test worked, restore settings */ 2995 /* okay so the test worked, restore settings */
2688 e_dbg("%s: MSI interrupt test succeeded!\n", netdev->name); 2996 e_dbg("%s: MSI interrupt test succeeded!\n", netdev->name);
2689msi_test_failed: 2997msi_test_failed:
2690 /* restore the original vector, even if it failed */ 2998 e1000e_set_interrupt_capability(adapter);
2691 e1000_request_irq(adapter); 2999 e1000_request_irq(adapter);
2692 return err; 3000 return err;
2693} 3001}
@@ -2797,7 +3105,7 @@ static int e1000_open(struct net_device *netdev)
2797 * ignore e1000e MSI messages, which means we need to test our MSI 3105 * ignore e1000e MSI messages, which means we need to test our MSI
2798 * interrupt now 3106 * interrupt now
2799 */ 3107 */
2800 { 3108 if (adapter->int_mode != E1000E_INT_MODE_LEGACY) {
2801 err = e1000_test_msi(adapter); 3109 err = e1000_test_msi(adapter);
2802 if (err) { 3110 if (err) {
2803 e_err("Interrupt allocation failed\n"); 3111 e_err("Interrupt allocation failed\n");
@@ -2989,7 +3297,8 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
2989 3297
2990 adapter->stats.algnerrc += er32(ALGNERRC); 3298 adapter->stats.algnerrc += er32(ALGNERRC);
2991 adapter->stats.rxerrc += er32(RXERRC); 3299 adapter->stats.rxerrc += er32(RXERRC);
2992 adapter->stats.tncrs += er32(TNCRS); 3300 if (hw->mac.type != e1000_82574)
3301 adapter->stats.tncrs += er32(TNCRS);
2993 adapter->stats.cexterr += er32(CEXTERR); 3302 adapter->stats.cexterr += er32(CEXTERR);
2994 adapter->stats.tsctc += er32(TSCTC); 3303 adapter->stats.tsctc += er32(TSCTC);
2995 adapter->stats.tsctfc += er32(TSCTFC); 3304 adapter->stats.tsctfc += er32(TSCTFC);
@@ -3337,7 +3646,10 @@ link_up:
3337 } 3646 }
3338 3647
3339 /* Cause software interrupt to ensure Rx ring is cleaned */ 3648 /* Cause software interrupt to ensure Rx ring is cleaned */
3340 ew32(ICS, E1000_ICS_RXDMT0); 3649 if (adapter->msix_entries)
3650 ew32(ICS, adapter->rx_ring->ims_val);
3651 else
3652 ew32(ICS, E1000_ICS_RXDMT0);
3341 3653
3342 /* Force detection of hung controller every watchdog period */ 3654 /* Force detection of hung controller every watchdog period */
3343 adapter->detect_tx_hung = 1; 3655 adapter->detect_tx_hung = 1;
@@ -4054,6 +4366,7 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4054 e1000e_down(adapter); 4366 e1000e_down(adapter);
4055 e1000_free_irq(adapter); 4367 e1000_free_irq(adapter);
4056 } 4368 }
4369 e1000e_reset_interrupt_capability(adapter);
4057 4370
4058 retval = pci_save_state(pdev); 4371 retval = pci_save_state(pdev);
4059 if (retval) 4372 if (retval)
@@ -4180,6 +4493,7 @@ static int e1000_resume(struct pci_dev *pdev)
4180 pci_enable_wake(pdev, PCI_D3hot, 0); 4493 pci_enable_wake(pdev, PCI_D3hot, 0);
4181 pci_enable_wake(pdev, PCI_D3cold, 0); 4494 pci_enable_wake(pdev, PCI_D3cold, 0);
4182 4495
4496 e1000e_set_interrupt_capability(adapter);
4183 if (netif_running(netdev)) { 4497 if (netif_running(netdev)) {
4184 err = e1000_request_irq(adapter); 4498 err = e1000_request_irq(adapter);
4185 if (err) 4499 if (err)
@@ -4489,6 +4803,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4489 4803
4490 adapter->bd_number = cards_found++; 4804 adapter->bd_number = cards_found++;
4491 4805
4806 e1000e_check_options(adapter);
4807
4492 /* setup adapter struct */ 4808 /* setup adapter struct */
4493 err = e1000_sw_init(adapter); 4809 err = e1000_sw_init(adapter);
4494 if (err) 4810 if (err)
@@ -4595,8 +4911,6 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4595 INIT_WORK(&adapter->reset_task, e1000_reset_task); 4911 INIT_WORK(&adapter->reset_task, e1000_reset_task);
4596 INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task); 4912 INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task);
4597 4913
4598 e1000e_check_options(adapter);
4599
4600 /* Initialize link parameters. User can change them with ethtool */ 4914 /* Initialize link parameters. User can change them with ethtool */
4601 adapter->hw.mac.autoneg = 1; 4915 adapter->hw.mac.autoneg = 1;
4602 adapter->fc_autoneg = 1; 4916 adapter->fc_autoneg = 1;
@@ -4726,6 +5040,7 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
4726 if (!e1000_check_reset_block(&adapter->hw)) 5040 if (!e1000_check_reset_block(&adapter->hw))
4727 e1000_phy_hw_reset(&adapter->hw); 5041 e1000_phy_hw_reset(&adapter->hw);
4728 5042
5043 e1000e_reset_interrupt_capability(adapter);
4729 kfree(adapter->tx_ring); 5044 kfree(adapter->tx_ring);
4730 kfree(adapter->rx_ring); 5045 kfree(adapter->rx_ring);
4731 5046
@@ -4767,6 +5082,8 @@ static struct pci_device_id e1000_pci_tbl[] = {
4767 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82573E_IAMT), board_82573 }, 5082 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82573E_IAMT), board_82573 },
4768 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82573L), board_82573 }, 5083 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82573L), board_82573 },
4769 5084
5085 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82574L), board_82574 },
5086
4770 { PCI_VDEVICE(INTEL, E1000_DEV_ID_80003ES2LAN_COPPER_DPT), 5087 { PCI_VDEVICE(INTEL, E1000_DEV_ID_80003ES2LAN_COPPER_DPT),
4771 board_80003es2lan }, 5088 board_80003es2lan },
4772 { PCI_VDEVICE(INTEL, E1000_DEV_ID_80003ES2LAN_COPPER_SPT), 5089 { PCI_VDEVICE(INTEL, E1000_DEV_ID_80003ES2LAN_COPPER_SPT),
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c
index ed912e023a72..f46db6cda487 100644
--- a/drivers/net/e1000e/param.c
+++ b/drivers/net/e1000e/param.c
@@ -114,6 +114,15 @@ E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
114#define DEFAULT_ITR 3 114#define DEFAULT_ITR 3
115#define MAX_ITR 100000 115#define MAX_ITR 100000
116#define MIN_ITR 100 116#define MIN_ITR 100
117/* IntMode (Interrupt Mode)
118 *
119 * Valid Range: 0 - 2
120 *
121 * Default Value: 2 (MSI-X)
122 */
123E1000_PARAM(IntMode, "Interrupt Mode");
124#define MAX_INTMODE 2
125#define MIN_INTMODE 0
117 126
118/* 127/*
119 * Enable Smart Power Down of the PHY 128 * Enable Smart Power Down of the PHY
@@ -352,6 +361,24 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
352 adapter->itr = 20000; 361 adapter->itr = 20000;
353 } 362 }
354 } 363 }
364 { /* Interrupt Mode */
365 struct e1000_option opt = {
366 .type = range_option,
367 .name = "Interrupt Mode",
368 .err = "defaulting to 2 (MSI-X)",
369 .def = E1000E_INT_MODE_MSIX,
370 .arg = { .r = { .min = MIN_INTMODE,
371 .max = MAX_INTMODE } }
372 };
373
374 if (num_IntMode > bd) {
375 unsigned int int_mode = IntMode[bd];
376 e1000_validate_option(&int_mode, &opt, adapter);
377 adapter->int_mode = int_mode;
378 } else {
379 adapter->int_mode = opt.def;
380 }
381 }
355 { /* Smart Power Down */ 382 { /* Smart Power Down */
356 const struct e1000_option opt = { 383 const struct e1000_option opt = {
357 .type = enable_option, 384 .type = enable_option,
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 16724f84d5ce..6cd333ae61d0 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -476,7 +476,9 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
476 if (ret_val) 476 if (ret_val)
477 return ret_val; 477 return ret_val;
478 478
479 if ((phy->type == e1000_phy_m88) && (phy->revision < 4)) { 479 if ((phy->type == e1000_phy_m88) &&
480 (phy->revision < E1000_REVISION_4) &&
481 (phy->id != BME1000_E_PHY_ID_R2)) {
480 /* 482 /*
481 * Force TX_CLK in the Extended PHY Specific Control Register 483 * Force TX_CLK in the Extended PHY Specific Control Register
482 * to 25MHz clock. 484 * to 25MHz clock.
@@ -504,6 +506,18 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
504 return ret_val; 506 return ret_val;
505 } 507 }
506 508
509 if ((phy->type == e1000_phy_bm) && (phy->id == BME1000_E_PHY_ID_R2)) {
510 /* Set PHY page 0, register 29 to 0x0003 */
511 ret_val = e1e_wphy(hw, 29, 0x0003);
512 if (ret_val)
513 return ret_val;
514
515 /* Set PHY page 0, register 30 to 0x0000 */
516 ret_val = e1e_wphy(hw, 30, 0x0000);
517 if (ret_val)
518 return ret_val;
519 }
520
507 /* Commit the changes. */ 521 /* Commit the changes. */
508 ret_val = e1000e_commit_phy(hw); 522 ret_val = e1000e_commit_phy(hw);
509 if (ret_val) 523 if (ret_val)
@@ -2054,6 +2068,99 @@ out:
2054} 2068}
2055 2069
2056/** 2070/**
2071 * e1000e_read_phy_reg_bm2 - Read BM PHY register
2072 * @hw: pointer to the HW structure
2073 * @offset: register offset to be read
2074 * @data: pointer to the read data
2075 *
2076 * Acquires semaphore, if necessary, then reads the PHY register at offset
2077 * and storing the retrieved information in data. Release any acquired
2078 * semaphores before exiting.
2079 **/
2080s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data)
2081{
2082 s32 ret_val;
2083 u16 page = (u16)(offset >> IGP_PAGE_SHIFT);
2084
2085 /* Page 800 works differently than the rest so it has its own func */
2086 if (page == BM_WUC_PAGE) {
2087 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data,
2088 true);
2089 return ret_val;
2090 }
2091
2092 ret_val = hw->phy.ops.acquire_phy(hw);
2093 if (ret_val)
2094 return ret_val;
2095
2096 hw->phy.addr = 1;
2097
2098 if (offset > MAX_PHY_MULTI_PAGE_REG) {
2099
2100 /* Page is shifted left, PHY expects (page x 32) */
2101 ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT,
2102 page);
2103
2104 if (ret_val) {
2105 hw->phy.ops.release_phy(hw);
2106 return ret_val;
2107 }
2108 }
2109
2110 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
2111 data);
2112 hw->phy.ops.release_phy(hw);
2113
2114 return ret_val;
2115}
2116
2117/**
2118 * e1000e_write_phy_reg_bm2 - Write BM PHY register
2119 * @hw: pointer to the HW structure
2120 * @offset: register offset to write to
2121 * @data: data to write at register offset
2122 *
2123 * Acquires semaphore, if necessary, then writes the data to PHY register
2124 * at the offset. Release any acquired semaphores before exiting.
2125 **/
2126s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data)
2127{
2128 s32 ret_val;
2129 u16 page = (u16)(offset >> IGP_PAGE_SHIFT);
2130
2131 /* Page 800 works differently than the rest so it has its own func */
2132 if (page == BM_WUC_PAGE) {
2133 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data,
2134 false);
2135 return ret_val;
2136 }
2137
2138 ret_val = hw->phy.ops.acquire_phy(hw);
2139 if (ret_val)
2140 return ret_val;
2141
2142 hw->phy.addr = 1;
2143
2144 if (offset > MAX_PHY_MULTI_PAGE_REG) {
2145 /* Page is shifted left, PHY expects (page x 32) */
2146 ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT,
2147 page);
2148
2149 if (ret_val) {
2150 hw->phy.ops.release_phy(hw);
2151 return ret_val;
2152 }
2153 }
2154
2155 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
2156 data);
2157
2158 hw->phy.ops.release_phy(hw);
2159
2160 return ret_val;
2161}
2162
2163/**
2057 * e1000_access_phy_wakeup_reg_bm - Read BM PHY wakeup register 2164 * e1000_access_phy_wakeup_reg_bm - Read BM PHY wakeup register
2058 * @hw: pointer to the HW structure 2165 * @hw: pointer to the HW structure
2059 * @offset: register offset to be read or written 2166 * @offset: register offset to be read or written