1 diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
2 index 462351c..b2c910c 100644
3 --- a/drivers/net/e1000e/82571.c
4 +++ b/drivers/net/e1000e/82571.c
6 * 82573V Gigabit Ethernet Controller (Copper)
7 * 82573E Gigabit Ethernet Controller (Copper)
8 * 82573L Gigabit Ethernet Controller
9 + * 82574L Gigabit Network Connection
12 #include <linux/netdevice.h>
15 #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000
17 +#define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */
19 static s32 e1000_get_phy_id_82571(struct e1000_hw *hw);
20 static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw);
21 static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw);
22 @@ -63,6 +66,8 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw);
23 static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw);
24 static s32 e1000_setup_link_82571(struct e1000_hw *hw);
25 static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw);
26 +static bool e1000_check_mng_mode_82574(struct e1000_hw *hw);
27 +static s32 e1000_led_on_82574(struct e1000_hw *hw);
30 * e1000_init_phy_params_82571 - Init PHY func ptrs.
31 @@ -92,6 +97,9 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
33 phy->type = e1000_phy_m88;
36 + phy->type = e1000_phy_bm;
39 return -E1000_ERR_PHY;
41 @@ -111,6 +119,10 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
42 if (phy->id != M88E1111_I_PHY_ID)
43 return -E1000_ERR_PHY;
46 + if (phy->id != BME1000_E_PHY_ID_R2)
47 + return -E1000_ERR_PHY;
50 return -E1000_ERR_PHY;
52 @@ -150,6 +162,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
54 switch (hw->mac.type) {
57 if (((eecd >> 15) & 0x3) == 0x3) {
58 nvm->type = e1000_nvm_flash_hw;
59 nvm->word_size = 2048;
60 @@ -245,6 +258,17 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
64 + switch (hw->mac.type) {
66 + func->check_mng_mode = e1000_check_mng_mode_82574;
67 + func->led_on = e1000_led_on_82574;
70 + func->check_mng_mode = e1000e_check_mng_mode_generic;
71 + func->led_on = e1000e_led_on_generic;
78 @@ -330,6 +354,8 @@ static s32 e1000_get_variants_82571(struct e1000_adapter *adapter)
79 static s32 e1000_get_phy_id_82571(struct e1000_hw *hw)
81 struct e1000_phy_info *phy = &hw->phy;
85 switch (hw->mac.type) {
87 @@ -345,6 +371,20 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw)
89 return e1000e_get_phy_id(hw);
92 + ret_val = e1e_rphy(hw, PHY_ID1, &phy_id);
96 + phy->id = (u32)(phy_id << 16);
98 + ret_val = e1e_rphy(hw, PHY_ID2, &phy_id);
102 + phy->id |= (u32)(phy_id);
103 + phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK);
106 return -E1000_ERR_PHY;
108 @@ -421,7 +461,7 @@ static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw)
112 - if (hw->mac.type != e1000_82573)
113 + if (hw->mac.type != e1000_82573 && hw->mac.type != e1000_82574)
114 ret_val = e1000e_acquire_nvm(hw);
117 @@ -461,6 +501,7 @@ static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words,
119 switch (hw->mac.type) {
122 ret_val = e1000_write_nvm_eewr_82571(hw, offset, words, data);
125 @@ -735,7 +776,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
126 * Must acquire the MDIO ownership before MAC reset.
127 * Ownership defaults to firmware after a reset.
129 - if (hw->mac.type == e1000_82573) {
130 + if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) {
131 extcnf_ctrl = er32(EXTCNF_CTRL);
132 extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
134 @@ -776,7 +817,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
135 * Need to wait for Phy configuration completion before accessing
138 - if (hw->mac.type == e1000_82573)
139 + if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574)
142 /* Clear any pending interrupt events. */
143 @@ -843,7 +884,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
144 ew32(TXDCTL(0), reg_data);
146 /* ...for both queues. */
147 - if (mac->type != e1000_82573) {
148 + if (mac->type != e1000_82573 && mac->type != e1000_82574) {
149 reg_data = er32(TXDCTL(1));
150 reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) |
151 E1000_TXDCTL_FULL_TX_DESC_WB |
152 @@ -918,19 +959,28 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
156 - if (hw->mac.type == e1000_82573) {
157 + if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) {
163 /* Extended Device Control */
164 - if (hw->mac.type == e1000_82573) {
165 + if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) {
166 reg = er32(CTRL_EXT);
172 + /* PCI-Ex Control Register */
173 + if (hw->mac.type == e1000_82574) {
183 @@ -947,7 +997,7 @@ void e1000e_clear_vfta(struct e1000_hw *hw)
185 u32 vfta_bit_in_reg = 0;
187 - if (hw->mac.type == e1000_82573) {
188 + if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) {
189 if (hw->mng_cookie.vlan_id != 0) {
191 * The VFTA is a 4096b bit-field, each identifying
192 @@ -976,6 +1026,48 @@ void e1000e_clear_vfta(struct e1000_hw *hw)
196 + * e1000_check_mng_mode_82574 - Check manageability is enabled
197 + * @hw: pointer to the HW structure
199 + * Reads the NVM Initialization Control Word 2 and returns true
200 + * (>0) if any manageability is enabled, else false (0).
202 +static bool e1000_check_mng_mode_82574(struct e1000_hw *hw)
206 + e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data);
207 + return (data & E1000_NVM_INIT_CTRL2_MNGM) != 0;
211 + * e1000_led_on_82574 - Turn LED on
212 + * @hw: pointer to the HW structure
216 +static s32 e1000_led_on_82574(struct e1000_hw *hw)
221 + ctrl = hw->mac.ledctl_mode2;
222 + if (!(E1000_STATUS_LU & er32(STATUS))) {
224 + * If no link, then turn LED on by setting the invert bit
225 + * for each LED that's "on" (0x0E) in ledctl_mode2.
227 + for (i = 0; i < 4; i++)
228 + if (((hw->mac.ledctl_mode2 >> (i * 8)) & 0xFF) ==
229 + E1000_LEDCTL_MODE_LED_ON)
230 + ctrl |= (E1000_LEDCTL_LED0_IVRT << (i * 8));
232 + ew32(LEDCTL, ctrl);
238 * e1000_update_mc_addr_list_82571 - Update Multicast addresses
239 * @hw: pointer to the HW structure
240 * @mc_addr_list: array of multicast addresses to program
241 @@ -1018,7 +1110,8 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw)
242 * the default flow control setting, so we explicitly
245 - if (hw->mac.type == e1000_82573)
246 + if ((hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) &&
247 + hw->fc.type == e1000_fc_default)
248 hw->fc.type = e1000_fc_full;
250 return e1000e_setup_link(hw);
251 @@ -1045,6 +1138,7 @@ static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw)
253 switch (hw->phy.type) {
256 ret_val = e1000e_copper_link_setup_m88(hw);
258 case e1000_phy_igp_2:
259 @@ -1114,11 +1208,10 @@ static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data)
263 - if (hw->mac.type == e1000_82573 &&
264 + if ((hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) &&
265 *data == ID_LED_RESERVED_F746)
266 *data = ID_LED_DEFAULT_82573;
267 - else if (*data == ID_LED_RESERVED_0000 ||
268 - *data == ID_LED_RESERVED_FFFF)
269 + else if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF)
270 *data = ID_LED_DEFAULT;
273 @@ -1265,13 +1358,13 @@ static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw)
276 static struct e1000_mac_operations e82571_mac_ops = {
277 - .mng_mode_enab = E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT,
278 + /* .check_mng_mode: mac type dependent */
279 /* .check_for_link: media type dependent */
280 .cleanup_led = e1000e_cleanup_led_generic,
281 .clear_hw_cntrs = e1000_clear_hw_cntrs_82571,
282 .get_bus_info = e1000e_get_bus_info_pcie,
283 /* .get_link_up_info: media type dependent */
284 - .led_on = e1000e_led_on_generic,
285 + /* .led_on: mac type dependent */
286 .led_off = e1000e_led_off_generic,
287 .update_mc_addr_list = e1000_update_mc_addr_list_82571,
288 .reset_hw = e1000_reset_hw_82571,
289 @@ -1312,6 +1405,22 @@ static struct e1000_phy_operations e82_phy_ops_m88 = {
290 .write_phy_reg = e1000e_write_phy_reg_m88,
293 +static struct e1000_phy_operations e82_phy_ops_bm = {
294 + .acquire_phy = e1000_get_hw_semaphore_82571,
295 + .check_reset_block = e1000e_check_reset_block_generic,
296 + .commit_phy = e1000e_phy_sw_reset,
297 + .force_speed_duplex = e1000e_phy_force_speed_duplex_m88,
298 + .get_cfg_done = e1000e_get_cfg_done,
299 + .get_cable_length = e1000e_get_cable_length_m88,
300 + .get_phy_info = e1000e_get_phy_info_m88,
301 + .read_phy_reg = e1000e_read_phy_reg_bm2,
302 + .release_phy = e1000_put_hw_semaphore_82571,
303 + .reset_phy = e1000e_phy_hw_reset_generic,
304 + .set_d0_lplu_state = e1000_set_d0_lplu_state_82571,
305 + .set_d3_lplu_state = e1000e_set_d3_lplu_state,
306 + .write_phy_reg = e1000e_write_phy_reg_bm2,
309 static struct e1000_nvm_operations e82571_nvm_ops = {
310 .acquire_nvm = e1000_acquire_nvm_82571,
311 .read_nvm = e1000e_read_nvm_eerd,
312 @@ -1375,3 +1484,21 @@ struct e1000_info e1000_82573_info = {
313 .nvm_ops = &e82571_nvm_ops,
316 +struct e1000_info e1000_82574_info = {
317 + .mac = e1000_82574,
318 + .flags = FLAG_HAS_HW_VLAN_FILTER
320 + | FLAG_HAS_JUMBO_FRAMES
322 + | FLAG_APME_IN_CTRL3
323 + | FLAG_RX_CSUM_ENABLED
324 + | FLAG_HAS_SMART_POWER_DOWN
326 + | FLAG_HAS_CTRLEXT_ON_LOAD,
328 + .get_variants = e1000_get_variants_82571,
329 + .mac_ops = &e82571_mac_ops,
330 + .phy_ops = &e82_phy_ops_bm,
331 + .nvm_ops = &e82571_nvm_ops,
334 diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
335 index 4b21fa9..48f79ec 100644
336 --- a/drivers/net/e1000e/defines.h
337 +++ b/drivers/net/e1000e/defines.h
339 #define E1000_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */
340 #define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
341 #define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000
342 +#define E1000_CTRL_EXT_EIAME 0x01000000
343 #define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */
344 #define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */
345 #define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */
346 +#define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */
348 /* Receive Descriptor bit definitions */
349 #define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */
351 #define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */
353 /* Header split receive */
354 +#define E1000_RFCTL_ACK_DIS 0x00001000
355 #define E1000_RFCTL_EXTEN 0x00008000
356 #define E1000_RFCTL_IPV6_EX_DIS 0x00010000
357 #define E1000_RFCTL_NEW_IPV6_EXT_DIS 0x00020000
359 #define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */
360 #define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */
361 #define E1000_ICR_INT_ASSERTED 0x80000000 /* If this bit asserted, the driver should claim the interrupt */
362 +#define E1000_ICR_RXQ0 0x00100000 /* Rx Queue 0 Interrupt */
363 +#define E1000_ICR_RXQ1 0x00200000 /* Rx Queue 1 Interrupt */
364 +#define E1000_ICR_TXQ0 0x00400000 /* Tx Queue 0 Interrupt */
365 +#define E1000_ICR_TXQ1 0x00800000 /* Tx Queue 1 Interrupt */
366 +#define E1000_ICR_OTHER 0x01000000 /* Other Interrupts */
369 * This defines the bits that are set in the Interrupt Mask
371 #define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */
372 #define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */
373 #define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */
374 +#define E1000_IMS_RXQ0 E1000_ICR_RXQ0 /* Rx Queue 0 Interrupt */
375 +#define E1000_IMS_RXQ1 E1000_ICR_RXQ1 /* Rx Queue 1 Interrupt */
376 +#define E1000_IMS_TXQ0 E1000_ICR_TXQ0 /* Tx Queue 0 Interrupt */
377 +#define E1000_IMS_TXQ1 E1000_ICR_TXQ1 /* Tx Queue 1 Interrupt */
378 +#define E1000_IMS_OTHER E1000_ICR_OTHER /* Other Interrupts */
380 /* Interrupt Cause Set */
381 #define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */
382 diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
383 index d5f8e8a..c55fd6f 100644
384 --- a/drivers/net/e1000e/e1000.h
385 +++ b/drivers/net/e1000e/e1000.h
386 @@ -62,6 +62,11 @@ struct e1000_info;
387 e_printk(KERN_NOTICE, adapter, format, ## arg)
390 +/* Interrupt modes, as used by the IntMode paramter */
391 +#define E1000E_INT_MODE_LEGACY 0
392 +#define E1000E_INT_MODE_MSI 1
393 +#define E1000E_INT_MODE_MSIX 2
395 /* Tx/Rx descriptor defines */
396 #define E1000_DEFAULT_TXD 256
397 #define E1000_MAX_TXD 4096
398 @@ -95,6 +100,7 @@ enum e1000_boards {
406 @@ -147,6 +153,12 @@ struct e1000_ring {
407 /* array of buffer information structs */
408 struct e1000_buffer *buffer_info;
410 + char name[IFNAMSIZ + 5];
416 struct sk_buff *rx_skb_top;
418 struct e1000_queue_stats stats;
419 @@ -274,6 +286,9 @@ struct e1000_adapter {
423 + struct msix_entry *msix_entries;
429 @@ -311,6 +326,7 @@ struct e1000_info {
430 #define FLAG_HAS_JUMBO_FRAMES (1 << 7)
431 #define FLAG_READ_ONLY_NVM (1 << 8)
432 #define FLAG_IS_ICH (1 << 9)
433 +#define FLAG_HAS_MSIX (1 << 10)
434 #define FLAG_HAS_SMART_POWER_DOWN (1 << 11)
435 #define FLAG_IS_QUAD_PORT_A (1 << 12)
436 #define FLAG_IS_QUAD_PORT (1 << 13)
437 @@ -372,6 +388,8 @@ extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter);
438 extern void e1000e_free_rx_resources(struct e1000_adapter *adapter);
439 extern void e1000e_free_tx_resources(struct e1000_adapter *adapter);
440 extern void e1000e_update_stats(struct e1000_adapter *adapter);
441 +extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter);
442 +extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter);
444 extern unsigned int copybreak;
446 @@ -380,6 +398,7 @@ extern char *e1000e_get_hw_dev_name(struct e1000_hw *hw);
447 extern struct e1000_info e1000_82571_info;
448 extern struct e1000_info e1000_82572_info;
449 extern struct e1000_info e1000_82573_info;
450 +extern struct e1000_info e1000_82574_info;
451 extern struct e1000_info e1000_ich8_info;
452 extern struct e1000_info e1000_ich9_info;
453 extern struct e1000_info e1000_ich10_info;
454 @@ -461,6 +480,8 @@ extern enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id);
455 extern s32 e1000e_determine_phy_address(struct e1000_hw *hw);
456 extern s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data);
457 extern s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data);
458 +extern s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data);
459 +extern s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data);
460 extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl);
461 extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
462 extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
463 @@ -531,7 +552,12 @@ static inline s32 e1000_get_phy_info(struct e1000_hw *hw)
464 return hw->phy.ops.get_phy_info(hw);
467 -extern bool e1000e_check_mng_mode(struct e1000_hw *hw);
468 +static inline s32 e1000e_check_mng_mode(struct e1000_hw *hw)
470 + return hw->mac.ops.check_mng_mode(hw);
473 +extern bool e1000e_check_mng_mode_generic(struct e1000_hw *hw);
474 extern bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw);
475 extern s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length);
477 diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
478 index dc552d7..da9c09c 100644
479 --- a/drivers/net/e1000e/es2lan.c
480 +++ b/drivers/net/e1000e/es2lan.c
481 @@ -1247,7 +1247,7 @@ static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw)
484 static struct e1000_mac_operations es2_mac_ops = {
485 - .mng_mode_enab = E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT,
486 + .check_mng_mode = e1000e_check_mng_mode_generic,
487 /* check_for_link dependent on media type */
488 .cleanup_led = e1000e_cleanup_led_generic,
489 .clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan,
490 diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
491 index 5b7e6b5..62421ce 100644
492 --- a/drivers/net/e1000e/ethtool.c
493 +++ b/drivers/net/e1000e/ethtool.c
494 @@ -575,6 +575,7 @@ static int e1000_set_eeprom(struct net_device *netdev,
495 * and flush shadow RAM for 82573 controllers
497 if ((ret_val == 0) && ((first_word <= NVM_CHECKSUM_REG) ||
498 + (hw->mac.type == e1000_82574) ||
499 (hw->mac.type == e1000_82573)))
500 e1000e_update_nvm_checksum(hw);
502 @@ -786,6 +787,7 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
510 @@ -894,10 +896,18 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
512 u32 irq = adapter->pdev->irq;
515 + int int_mode = E1000E_INT_MODE_LEGACY;
519 - /* NOTE: we don't test MSI interrupts here, yet */
520 + /* NOTE: we don't test MSI/MSI-X interrupts here, yet */
521 + if (adapter->int_mode == E1000E_INT_MODE_MSIX) {
522 + int_mode = adapter->int_mode;
523 + e1000e_reset_interrupt_capability(adapter);
524 + adapter->int_mode = E1000E_INT_MODE_LEGACY;
525 + e1000e_set_interrupt_capability(adapter);
527 /* Hook up test interrupt handler just for this test */
528 if (!request_irq(irq, &e1000_test_intr, IRQF_PROBE_SHARED, netdev->name,
530 @@ -905,7 +915,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
531 } else if (request_irq(irq, &e1000_test_intr, IRQF_SHARED,
532 netdev->name, netdev)) {
538 e_info("testing %s interrupt\n", (shared_int ? "shared" : "unshared"));
540 @@ -995,7 +1006,14 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
541 /* Unhook test interrupt handler */
542 free_irq(irq, netdev);
546 + if (int_mode == E1000E_INT_MODE_MSIX) {
547 + e1000e_reset_interrupt_capability(adapter);
548 + adapter->int_mode = int_mode;
549 + e1000e_set_interrupt_capability(adapter);
555 static void e1000_free_desc_rings(struct e1000_adapter *adapter)
556 @@ -1780,11 +1798,13 @@ static void e1000_led_blink_callback(unsigned long data)
557 static int e1000_phys_id(struct net_device *netdev, u32 data)
559 struct e1000_adapter *adapter = netdev_priv(netdev);
560 + struct e1000_hw *hw = &adapter->hw;
565 - if (adapter->hw.phy.type == e1000_phy_ife) {
566 + if ((hw->phy.type == e1000_phy_ife) ||
567 + (hw->mac.type == e1000_82574)) {
568 if (!adapter->blink_timer.function) {
569 init_timer(&adapter->blink_timer);
570 adapter->blink_timer.function =
571 @@ -1794,16 +1814,16 @@ static int e1000_phys_id(struct net_device *netdev, u32 data)
572 mod_timer(&adapter->blink_timer, jiffies);
573 msleep_interruptible(data * 1000);
574 del_timer_sync(&adapter->blink_timer);
575 - e1e_wphy(&adapter->hw,
576 - IFE_PHY_SPECIAL_CONTROL_LED, 0);
577 + if (hw->phy.type == e1000_phy_ife)
578 + e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED, 0);
580 - e1000e_blink_led(&adapter->hw);
581 + e1000e_blink_led(hw);
582 msleep_interruptible(data * 1000);
585 - adapter->hw.mac.ops.led_off(&adapter->hw);
586 + hw->mac.ops.led_off(hw);
587 clear_bit(E1000_LED_ON, &adapter->led_status);
588 - adapter->hw.mac.ops.cleanup_led(&adapter->hw);
589 + hw->mac.ops.cleanup_led(hw);
593 diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
594 index 3005394..52612da 100644
595 --- a/drivers/net/e1000e/hw.h
596 +++ b/drivers/net/e1000e/hw.h
597 @@ -65,7 +65,11 @@ enum e1e_registers {
598 E1000_ICS = 0x000C8, /* Interrupt Cause Set - WO */
599 E1000_IMS = 0x000D0, /* Interrupt Mask Set - RW */
600 E1000_IMC = 0x000D8, /* Interrupt Mask Clear - WO */
601 + E1000_EIAC_82574 = 0x000DC, /* Ext. Interrupt Auto Clear - RW */
602 E1000_IAM = 0x000E0, /* Interrupt Acknowledge Auto Mask */
603 + E1000_IVAR = 0x000E4, /* Interrupt Vector Allocation - RW */
604 + E1000_EITR_82574_BASE = 0x000E8, /* Interrupt Throttling - RW */
605 +#define E1000_EITR_82574(_n) (E1000_EITR_82574_BASE + (_n << 2))
606 E1000_RCTL = 0x00100, /* Rx Control - RW */
607 E1000_FCTTV = 0x00170, /* Flow Control Transmit Timer Value - RW */
608 E1000_TXCW = 0x00178, /* Tx Configuration Word - RW */
609 @@ -332,6 +336,7 @@ enum e1e_registers {
610 #define E1000_DEV_ID_82573E 0x108B
611 #define E1000_DEV_ID_82573E_IAMT 0x108C
612 #define E1000_DEV_ID_82573L 0x109A
613 +#define E1000_DEV_ID_82574L 0x10D3
615 #define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096
616 #define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098
617 @@ -359,12 +364,15 @@ enum e1e_registers {
618 #define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE
619 #define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF
621 +#define E1000_REVISION_4 4
623 #define E1000_FUNC_1 1
625 enum e1000_mac_type {
633 @@ -699,8 +707,7 @@ struct e1000_host_mng_command_info {
635 /* Function pointers and static data for the MAC. */
636 struct e1000_mac_operations {
639 + bool (*check_mng_mode)(struct e1000_hw *);
640 s32 (*check_for_link)(struct e1000_hw *);
641 s32 (*cleanup_led)(struct e1000_hw *);
642 void (*clear_hw_cntrs)(struct e1000_hw *);
643 diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
644 index d2acf48..8e0bd0f 100644
645 --- a/drivers/net/e1000e/ich8lan.c
646 +++ b/drivers/net/e1000e/ich8lan.c
647 @@ -451,6 +451,22 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
651 + * e1000_check_mng_mode_ich8lan - Checks management mode
652 + * @hw: pointer to the HW structure
654 + * This checks if the adapter has manageability enabled.
655 + * This is a function pointer entry point only called by read/write
656 + * routines for the PHY and NVM parts.
658 +static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw)
660 + u32 fwsm = er32(FWSM);
662 + return (fwsm & E1000_FWSM_MODE_MASK) ==
663 + (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT);
667 * e1000_check_reset_block_ich8lan - Check if PHY reset is blocked
668 * @hw: pointer to the HW structure
670 @@ -2481,7 +2497,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
673 static struct e1000_mac_operations ich8_mac_ops = {
674 - .mng_mode_enab = E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT,
675 + .check_mng_mode = e1000_check_mng_mode_ich8lan,
676 .check_for_link = e1000e_check_for_copper_link,
677 .cleanup_led = e1000_cleanup_led_ich8lan,
678 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan,
679 diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
680 index f1f4e9d..c733730 100644
681 --- a/drivers/net/e1000e/lib.c
682 +++ b/drivers/net/e1000e/lib.c
683 @@ -2222,17 +2222,18 @@ static s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
687 - * e1000e_check_mng_mode - check management mode
688 + * e1000e_check_mng_mode_generic - check management mode
689 * @hw: pointer to the HW structure
691 * Reads the firmware semaphore register and returns true (>0) if
692 * manageability is enabled, else false (0).
694 -bool e1000e_check_mng_mode(struct e1000_hw *hw)
695 +bool e1000e_check_mng_mode_generic(struct e1000_hw *hw)
697 u32 fwsm = er32(FWSM);
699 - return (fwsm & E1000_FWSM_MODE_MASK) == hw->mac.ops.mng_mode_enab;
700 + return (fwsm & E1000_FWSM_MODE_MASK) ==
701 + (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT);
705 diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
706 index c4287ca..51f4dcc 100644
707 --- a/drivers/net/e1000e/netdev.c
708 +++ b/drivers/net/e1000e/netdev.c
709 @@ -55,6 +55,7 @@ static const struct e1000_info *e1000_info_tbl[] = {
710 [board_82571] = &e1000_82571_info,
711 [board_82572] = &e1000_82572_info,
712 [board_82573] = &e1000_82573_info,
713 + [board_82574] = &e1000_82574_info,
714 [board_80003es2lan] = &e1000_es2_info,
715 [board_ich8lan] = &e1000_ich8_info,
716 [board_ich9lan] = &e1000_ich9_info,
717 @@ -1202,8 +1203,8 @@ static irqreturn_t e1000_intr(int irq, void *data)
718 struct net_device *netdev = data;
719 struct e1000_adapter *adapter = netdev_priv(netdev);
720 struct e1000_hw *hw = &adapter->hw;
722 u32 rctl, icr = er32(ICR);
725 return IRQ_NONE; /* Not our interrupt */
727 @@ -1259,6 +1260,263 @@ static irqreturn_t e1000_intr(int irq, void *data)
731 +static irqreturn_t e1000_msix_other(int irq, void *data)
733 + struct net_device *netdev = data;
734 + struct e1000_adapter *adapter = netdev_priv(netdev);
735 + struct e1000_hw *hw = &adapter->hw;
736 + u32 icr = er32(ICR);
738 + if (!(icr & E1000_ICR_INT_ASSERTED)) {
739 + ew32(IMS, E1000_IMS_OTHER);
743 + if (icr & adapter->eiac_mask)
744 + ew32(ICS, (icr & adapter->eiac_mask));
746 + if (icr & E1000_ICR_OTHER) {
747 + if (!(icr & E1000_ICR_LSC))
748 + goto no_link_interrupt;
749 + hw->mac.get_link_status = 1;
750 + /* guard against interrupt when we're going down */
751 + if (!test_bit(__E1000_DOWN, &adapter->state))
752 + mod_timer(&adapter->watchdog_timer, jiffies + 1);
756 + ew32(IMS, E1000_IMS_LSC | E1000_IMS_OTHER);
758 + return IRQ_HANDLED;
762 +static irqreturn_t e1000_intr_msix_tx(int irq, void *data)
764 + struct net_device *netdev = data;
765 + struct e1000_adapter *adapter = netdev_priv(netdev);
766 + struct e1000_hw *hw = &adapter->hw;
767 + struct e1000_ring *tx_ring = adapter->tx_ring;
770 + adapter->total_tx_bytes = 0;
771 + adapter->total_tx_packets = 0;
773 + if (!e1000_clean_tx_irq(adapter))
774 + /* Ring was not completely cleaned, so fire another interrupt */
775 + ew32(ICS, tx_ring->ims_val);
777 + return IRQ_HANDLED;
780 +static irqreturn_t e1000_intr_msix_rx(int irq, void *data)
782 + struct net_device *netdev = data;
783 + struct e1000_adapter *adapter = netdev_priv(netdev);
785 + /* Write the ITR value calculated at the end of the
786 + * previous interrupt.
788 + if (adapter->rx_ring->set_itr) {
789 + writel(1000000000 / (adapter->rx_ring->itr_val * 256),
790 + adapter->hw.hw_addr + adapter->rx_ring->itr_register);
791 + adapter->rx_ring->set_itr = 0;
794 + if (netif_rx_schedule_prep(netdev, &adapter->napi)) {
795 + adapter->total_rx_bytes = 0;
796 + adapter->total_rx_packets = 0;
797 + __netif_rx_schedule(netdev, &adapter->napi);
799 + return IRQ_HANDLED;
803 + * e1000_configure_msix - Configure MSI-X hardware
805 + * e1000_configure_msix sets up the hardware to properly
806 + * generate MSI-X interrupts.
808 +static void e1000_configure_msix(struct e1000_adapter *adapter)
810 + struct e1000_hw *hw = &adapter->hw;
811 + struct e1000_ring *rx_ring = adapter->rx_ring;
812 + struct e1000_ring *tx_ring = adapter->tx_ring;
814 + u32 ctrl_ext, ivar = 0;
816 + adapter->eiac_mask = 0;
818 + /* Workaround issue with spurious interrupts on 82574 in MSI-X mode */
819 + if (hw->mac.type == e1000_82574) {
820 + u32 rfctl = er32(RFCTL);
821 + rfctl |= E1000_RFCTL_ACK_DIS;
822 + ew32(RFCTL, rfctl);
825 +#define E1000_IVAR_INT_ALLOC_VALID 0x8
826 + /* Configure Rx vector */
827 + rx_ring->ims_val = E1000_IMS_RXQ0;
828 + adapter->eiac_mask |= rx_ring->ims_val;
829 + if (rx_ring->itr_val)
830 + writel(1000000000 / (rx_ring->itr_val * 256),
831 + hw->hw_addr + rx_ring->itr_register);
833 + writel(1, hw->hw_addr + rx_ring->itr_register);
834 + ivar = E1000_IVAR_INT_ALLOC_VALID | vector;
836 + /* Configure Tx vector */
837 + tx_ring->ims_val = E1000_IMS_TXQ0;
839 + if (tx_ring->itr_val)
840 + writel(1000000000 / (tx_ring->itr_val * 256),
841 + hw->hw_addr + tx_ring->itr_register);
843 + writel(1, hw->hw_addr + tx_ring->itr_register);
844 + adapter->eiac_mask |= tx_ring->ims_val;
845 + ivar |= ((E1000_IVAR_INT_ALLOC_VALID | vector) << 8);
847 + /* set vector for Other Causes, e.g. link changes */
849 + ivar |= ((E1000_IVAR_INT_ALLOC_VALID | vector) << 16);
850 + if (rx_ring->itr_val)
851 + writel(1000000000 / (rx_ring->itr_val * 256),
852 + hw->hw_addr + E1000_EITR_82574(vector));
854 + writel(1, hw->hw_addr + E1000_EITR_82574(vector));
856 + /* Cause Tx interrupts on every write back */
861 + /* enable MSI-X PBA support */
862 + ctrl_ext = er32(CTRL_EXT);
863 + ctrl_ext |= E1000_CTRL_EXT_PBA_CLR;
865 + /* Auto-Mask Other interrupts upon ICR read */
866 +#define E1000_EIAC_MASK_82574 0x01F00000
867 + ew32(IAM, ~E1000_EIAC_MASK_82574 | E1000_IMS_OTHER);
868 + ctrl_ext |= E1000_CTRL_EXT_EIAME;
869 + ew32(CTRL_EXT, ctrl_ext);
873 +void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter)
875 + if (adapter->msix_entries) {
876 + pci_disable_msix(adapter->pdev);
877 + kfree(adapter->msix_entries);
878 + adapter->msix_entries = NULL;
879 + } else if (adapter->flags & FLAG_MSI_ENABLED) {
880 + pci_disable_msi(adapter->pdev);
881 + adapter->flags &= ~FLAG_MSI_ENABLED;
888 + * e1000e_set_interrupt_capability - set MSI or MSI-X if supported
890 + * Attempt to configure interrupts using the best available
891 + * capabilities of the hardware and kernel.
893 +void e1000e_set_interrupt_capability(struct e1000_adapter *adapter)
899 + switch (adapter->int_mode) {
900 + case E1000E_INT_MODE_MSIX:
901 + if (adapter->flags & FLAG_HAS_MSIX) {
902 + numvecs = 3; /* RxQ0, TxQ0 and other */
903 + adapter->msix_entries = kcalloc(numvecs,
904 + sizeof(struct msix_entry),
906 + if (adapter->msix_entries) {
907 + for (i = 0; i < numvecs; i++)
908 + adapter->msix_entries[i].entry = i;
910 + err = pci_enable_msix(adapter->pdev,
911 + adapter->msix_entries,
916 + /* MSI-X failed, so fall through and try MSI */
917 + e_err("Failed to initialize MSI-X interrupts. "
918 + "Falling back to MSI interrupts.\n");
919 + e1000e_reset_interrupt_capability(adapter);
921 + adapter->int_mode = E1000E_INT_MODE_MSI;
923 + case E1000E_INT_MODE_MSI:
924 + if (!pci_enable_msi(adapter->pdev)) {
925 + adapter->flags |= FLAG_MSI_ENABLED;
927 + adapter->int_mode = E1000E_INT_MODE_LEGACY;
928 + e_err("Failed to initialize MSI interrupts. Falling "
929 + "back to legacy interrupts.\n");
932 + case E1000E_INT_MODE_LEGACY:
933 + /* Don't do anything; this is the system default */
941 + * e1000_request_msix - Initialize MSI-X interrupts
943 + * e1000_request_msix allocates MSI-X vectors and requests interrupts from the
946 +static int e1000_request_msix(struct e1000_adapter *adapter)
948 + struct net_device *netdev = adapter->netdev;
949 + int err = 0, vector = 0;
951 + if (strlen(netdev->name) < (IFNAMSIZ - 5))
952 + sprintf(adapter->rx_ring->name, "%s-rx0", netdev->name);
954 + memcpy(adapter->rx_ring->name, netdev->name, IFNAMSIZ);
955 + err = request_irq(adapter->msix_entries[vector].vector,
956 + &e1000_intr_msix_rx, 0, adapter->rx_ring->name,
960 + adapter->rx_ring->itr_register = E1000_EITR_82574(vector);
961 + adapter->rx_ring->itr_val = adapter->itr;
964 + if (strlen(netdev->name) < (IFNAMSIZ - 5))
965 + sprintf(adapter->tx_ring->name, "%s-tx0", netdev->name);
967 + memcpy(adapter->tx_ring->name, netdev->name, IFNAMSIZ);
968 + err = request_irq(adapter->msix_entries[vector].vector,
969 + &e1000_intr_msix_tx, 0, adapter->tx_ring->name,
973 + adapter->tx_ring->itr_register = E1000_EITR_82574(vector);
974 + adapter->tx_ring->itr_val = adapter->itr;
977 + err = request_irq(adapter->msix_entries[vector].vector,
978 + &e1000_msix_other, 0, netdev->name, netdev);
982 + e1000_configure_msix(adapter);
989 * e1000_request_irq - initialize interrupts
991 @@ -1268,29 +1526,33 @@ static irqreturn_t e1000_intr(int irq, void *data)
992 static int e1000_request_irq(struct e1000_adapter *adapter)
994 struct net_device *netdev = adapter->netdev;
995 - int irq_flags = IRQF_SHARED;
998 - if (!(adapter->flags & FLAG_MSI_TEST_FAILED)) {
999 - err = pci_enable_msi(adapter->pdev);
1001 - adapter->flags |= FLAG_MSI_ENABLED;
1004 + if (adapter->msix_entries) {
1005 + err = e1000_request_msix(adapter);
1008 + /* fall back to MSI */
1009 + e1000e_reset_interrupt_capability(adapter);
1010 + adapter->int_mode = E1000E_INT_MODE_MSI;
1011 + e1000e_set_interrupt_capability(adapter);
1013 + if (adapter->flags & FLAG_MSI_ENABLED) {
1014 + err = request_irq(adapter->pdev->irq, &e1000_intr_msi, 0,
1015 + netdev->name, netdev);
1019 - err = request_irq(adapter->pdev->irq,
1020 - ((adapter->flags & FLAG_MSI_ENABLED) ?
1021 - &e1000_intr_msi : &e1000_intr),
1022 - irq_flags, netdev->name, netdev);
1024 - if (adapter->flags & FLAG_MSI_ENABLED) {
1025 - pci_disable_msi(adapter->pdev);
1026 - adapter->flags &= ~FLAG_MSI_ENABLED;
1028 - e_err("Unable to allocate interrupt, Error: %d\n", err);
1029 + /* fall back to legacy interrupt */
1030 + e1000e_reset_interrupt_capability(adapter);
1031 + adapter->int_mode = E1000E_INT_MODE_LEGACY;
1034 + err = request_irq(adapter->pdev->irq, &e1000_intr, IRQF_SHARED,
1035 + netdev->name, netdev);
1037 + e_err("Unable to allocate interrupt, Error: %d\n", err);
1042 @@ -1298,11 +1560,21 @@ static void e1000_free_irq(struct e1000_adapter *adapter)
1044 struct net_device *netdev = adapter->netdev;
1046 - free_irq(adapter->pdev->irq, netdev);
1047 - if (adapter->flags & FLAG_MSI_ENABLED) {
1048 - pci_disable_msi(adapter->pdev);
1049 - adapter->flags &= ~FLAG_MSI_ENABLED;
1050 + if (adapter->msix_entries) {
1053 + free_irq(adapter->msix_entries[vector].vector, netdev);
1056 + free_irq(adapter->msix_entries[vector].vector, netdev);
1059 + /* Other Causes interrupt vector */
1060 + free_irq(adapter->msix_entries[vector].vector, netdev);
1064 + free_irq(adapter->pdev->irq, netdev);
1068 @@ -1313,6 +1585,8 @@ static void e1000_irq_disable(struct e1000_adapter *adapter)
1069 struct e1000_hw *hw = &adapter->hw;
1072 + if (adapter->msix_entries)
1073 + ew32(EIAC_82574, 0);
1075 synchronize_irq(adapter->pdev->irq);
1077 @@ -1324,7 +1598,12 @@ static void e1000_irq_enable(struct e1000_adapter *adapter)
1079 struct e1000_hw *hw = &adapter->hw;
1081 - ew32(IMS, IMS_ENABLE_MASK);
1082 + if (adapter->msix_entries) {
1083 + ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574);
1084 + ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER | E1000_IMS_LSC);
1086 + ew32(IMS, IMS_ENABLE_MASK);
1091 @@ -1574,9 +1853,8 @@ void e1000e_free_rx_resources(struct e1000_adapter *adapter)
1092 * traffic pattern. Constants in this function were computed
1093 * based on theoretical maximum wire speed and thresholds were set based
1094 * on testing data as well as attempting to minimize response time
1095 - * while increasing bulk throughput.
1096 - * this functionality is controlled by the InterruptThrottleRate module
1097 - * parameter (see e1000_param.c)
1098 + * while increasing bulk throughput. This functionality is controlled
1099 + * by the InterruptThrottleRate module parameter.
1101 static unsigned int e1000_update_itr(struct e1000_adapter *adapter,
1102 u16 itr_setting, int packets,
1103 @@ -1684,11 +1962,37 @@ set_itr_now:
1104 min(adapter->itr + (new_itr >> 2), new_itr) :
1106 adapter->itr = new_itr;
1107 - ew32(ITR, 1000000000 / (new_itr * 256));
1108 + adapter->rx_ring->itr_val = new_itr;
1109 + if (adapter->msix_entries)
1110 + adapter->rx_ring->set_itr = 1;
1112 + ew32(ITR, 1000000000 / (new_itr * 256));
1117 + * e1000_alloc_queues - Allocate memory for all rings
1118 + * @adapter: board private structure to initialize
1120 +static int __devinit e1000_alloc_queues(struct e1000_adapter *adapter)
1122 + adapter->tx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL);
1123 + if (!adapter->tx_ring)
1126 + adapter->rx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL);
1127 + if (!adapter->rx_ring)
1132 + e_err("Unable to allocate memory for queues\n");
1133 + kfree(adapter->rx_ring);
1134 + kfree(adapter->tx_ring);
1139 * e1000_clean - NAPI Rx polling callback
1140 * @napi: struct associated with this polling callback
1141 * @budget: amount of packets driver is allowed to process this poll
1142 @@ -1696,12 +2000,17 @@ set_itr_now:
1143 static int e1000_clean(struct napi_struct *napi, int budget)
1145 struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi);
1146 + struct e1000_hw *hw = &adapter->hw;
1147 struct net_device *poll_dev = adapter->netdev;
1148 int tx_cleaned = 0, work_done = 0;
1150 /* Must NOT use netdev_priv macro here. */
1151 adapter = poll_dev->priv;
1153 + if (adapter->msix_entries &&
1154 + !(adapter->rx_ring->ims_val & adapter->tx_ring->ims_val))
1158 * e1000_clean is called per-cpu. This lock protects
1159 * tx_ring from being cleaned by multiple cpus
1160 @@ -1713,6 +2022,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1161 spin_unlock(&adapter->tx_queue_lock);
1165 adapter->clean_rx(adapter, &work_done, budget);
1168 @@ -1723,7 +2033,10 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1169 if (adapter->itr_setting & 3)
1170 e1000_set_itr(adapter);
1171 netif_rx_complete(poll_dev, napi);
1172 - e1000_irq_enable(adapter);
1173 + if (adapter->msix_entries)
1174 + ew32(IMS, adapter->rx_ring->ims_val);
1176 + e1000_irq_enable(adapter);
1180 @@ -2523,6 +2836,8 @@ int e1000e_up(struct e1000_adapter *adapter)
1181 clear_bit(__E1000_DOWN, &adapter->state);
1183 napi_enable(&adapter->napi);
1184 + if (adapter->msix_entries)
1185 + e1000_configure_msix(adapter);
1186 e1000_irq_enable(adapter);
1188 /* fire a link change interrupt to start the watchdog */
1189 @@ -2606,13 +2921,10 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
1190 adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
1191 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
1193 - adapter->tx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL);
1194 - if (!adapter->tx_ring)
1196 + e1000e_set_interrupt_capability(adapter);
1198 - adapter->rx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL);
1199 - if (!adapter->rx_ring)
1201 + if (e1000_alloc_queues(adapter))
1204 spin_lock_init(&adapter->tx_queue_lock);
1206 @@ -2621,12 +2933,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
1208 set_bit(__E1000_DOWN, &adapter->state);
1212 - e_err("Unable to allocate memory for queues\n");
1213 - kfree(adapter->rx_ring);
1214 - kfree(adapter->tx_ring);
1219 @@ -2668,6 +2974,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
1221 /* free the real vector and request a test handler */
1222 e1000_free_irq(adapter);
1223 + e1000e_reset_interrupt_capability(adapter);
1225 /* Assume that the test fails, if it succeeds then the test
1226 * MSI irq handler will unset this flag */
1227 @@ -2698,6 +3005,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
1230 if (adapter->flags & FLAG_MSI_TEST_FAILED) {
1231 + adapter->int_mode = E1000E_INT_MODE_LEGACY;
1233 e_info("MSI interrupt test failed!\n");
1235 @@ -2711,7 +3019,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
1236 /* okay so the test worked, restore settings */
1237 e_dbg("%s: MSI interrupt test succeeded!\n", netdev->name);
1239 - /* restore the original vector, even if it failed */
1240 + e1000e_set_interrupt_capability(adapter);
1241 e1000_request_irq(adapter);
1244 @@ -2821,7 +3129,7 @@ static int e1000_open(struct net_device *netdev)
1245 * ignore e1000e MSI messages, which means we need to test our MSI
1249 + if (adapter->int_mode != E1000E_INT_MODE_LEGACY) {
1250 err = e1000_test_msi(adapter);
1252 e_err("Interrupt allocation failed\n");
1253 @@ -3016,7 +3324,8 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
1255 adapter->stats.algnerrc += er32(ALGNERRC);
1256 adapter->stats.rxerrc += er32(RXERRC);
1257 - adapter->stats.tncrs += er32(TNCRS);
1258 + if (hw->mac.type != e1000_82574)
1259 + adapter->stats.tncrs += er32(TNCRS);
1260 adapter->stats.cexterr += er32(CEXTERR);
1261 adapter->stats.tsctc += er32(TSCTC);
1262 adapter->stats.tsctfc += er32(TSCTFC);
1263 @@ -3347,7 +3656,10 @@ link_up:
1266 /* Cause software interrupt to ensure Rx ring is cleaned */
1267 - ew32(ICS, E1000_ICS_RXDMT0);
1268 + if (adapter->msix_entries)
1269 + ew32(ICS, adapter->rx_ring->ims_val);
1271 + ew32(ICS, E1000_ICS_RXDMT0);
1273 /* Force detection of hung controller every watchdog period */
1274 adapter->detect_tx_hung = 1;
1275 @@ -4064,6 +4376,7 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
1276 e1000e_down(adapter);
1277 e1000_free_irq(adapter);
1279 + e1000e_reset_interrupt_capability(adapter);
1281 retval = pci_save_state(pdev);
1283 @@ -4190,6 +4503,7 @@ static int e1000_resume(struct pci_dev *pdev)
1284 pci_enable_wake(pdev, PCI_D3hot, 0);
1285 pci_enable_wake(pdev, PCI_D3cold, 0);
1287 + e1000e_set_interrupt_capability(adapter);
1288 if (netif_running(netdev)) {
1289 err = e1000_request_irq(adapter);
1291 @@ -4502,6 +4816,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
1293 e1000e_check_options(adapter);
1295 + e1000e_check_options(adapter);
1297 /* setup adapter struct */
1298 err = e1000_sw_init(adapter);
1300 @@ -4744,6 +5060,7 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
1301 if (!e1000_check_reset_block(&adapter->hw))
1302 e1000_phy_hw_reset(&adapter->hw);
1304 + e1000e_reset_interrupt_capability(adapter);
1305 kfree(adapter->tx_ring);
1306 kfree(adapter->rx_ring);
1308 @@ -4785,6 +5102,8 @@ static struct pci_device_id e1000_pci_tbl[] = {
1309 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82573E_IAMT), board_82573 },
1310 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82573L), board_82573 },
1312 + { PCI_VDEVICE(INTEL, E1000_DEV_ID_82574L), board_82574 },
1314 { PCI_VDEVICE(INTEL, E1000_DEV_ID_80003ES2LAN_COPPER_DPT),
1315 board_80003es2lan },
1316 { PCI_VDEVICE(INTEL, E1000_DEV_ID_80003ES2LAN_COPPER_SPT),
1317 diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c
1318 index a7c8b99..e909f96 100644
1319 --- a/drivers/net/e1000e/param.c
1320 +++ b/drivers/net/e1000e/param.c
1321 @@ -114,6 +114,15 @@ E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
1322 #define DEFAULT_ITR 3
1323 #define MAX_ITR 100000
1325 +/* IntMode (Interrupt Mode)
1327 + * Valid Range: 0 - 2
1329 + * Default Value: 2 (MSI-X)
1331 +E1000_PARAM(IntMode, "Interrupt Mode");
1332 +#define MAX_INTMODE 2
1333 +#define MIN_INTMODE 0
1336 * Enable Smart Power Down of the PHY
1337 @@ -371,6 +380,24 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
1338 adapter->itr = 20000;
1341 + { /* Interrupt Mode */
1342 + struct e1000_option opt = {
1343 + .type = range_option,
1344 + .name = "Interrupt Mode",
1345 + .err = "defaulting to 2 (MSI-X)",
1346 + .def = E1000E_INT_MODE_MSIX,
1347 + .arg = { .r = { .min = MIN_INTMODE,
1348 + .max = MAX_INTMODE } }
1351 + if (num_IntMode > bd) {
1352 + unsigned int int_mode = IntMode[bd];
1353 + e1000_validate_option(&int_mode, &opt, adapter);
1354 + adapter->int_mode = int_mode;
1356 + adapter->int_mode = opt.def;
1359 { /* Smart Power Down */
1360 const struct e1000_option opt = {
1361 .type = enable_option,
1362 diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
1363 index 16724f8..6cd333a 100644
1364 --- a/drivers/net/e1000e/phy.c
1365 +++ b/drivers/net/e1000e/phy.c
1366 @@ -476,7 +476,9 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
1370 - if ((phy->type == e1000_phy_m88) && (phy->revision < 4)) {
1371 + if ((phy->type == e1000_phy_m88) &&
1372 + (phy->revision < E1000_REVISION_4) &&
1373 + (phy->id != BME1000_E_PHY_ID_R2)) {
1375 * Force TX_CLK in the Extended PHY Specific Control Register
1377 @@ -504,6 +506,18 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
1381 + if ((phy->type == e1000_phy_bm) && (phy->id == BME1000_E_PHY_ID_R2)) {
1382 + /* Set PHY page 0, register 29 to 0x0003 */
1383 + ret_val = e1e_wphy(hw, 29, 0x0003);
1387 + /* Set PHY page 0, register 30 to 0x0000 */
1388 + ret_val = e1e_wphy(hw, 30, 0x0000);
1393 /* Commit the changes. */
1394 ret_val = e1000e_commit_phy(hw);
1396 @@ -2054,6 +2068,99 @@ out:
1400 + * e1000e_read_phy_reg_bm2 - Read BM PHY register
1401 + * @hw: pointer to the HW structure
1402 + * @offset: register offset to be read
1403 + * @data: pointer to the read data
1405 + * Acquires semaphore, if necessary, then reads the PHY register at offset
1406 + * and storing the retrieved information in data. Release any acquired
1407 + * semaphores before exiting.
1409 +s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data)
1412 + u16 page = (u16)(offset >> IGP_PAGE_SHIFT);
1414 + /* Page 800 works differently than the rest so it has its own func */
1415 + if (page == BM_WUC_PAGE) {
1416 + ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data,
1421 + ret_val = hw->phy.ops.acquire_phy(hw);
1427 + if (offset > MAX_PHY_MULTI_PAGE_REG) {
1429 + /* Page is shifted left, PHY expects (page x 32) */
1430 + ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT,
1434 + hw->phy.ops.release_phy(hw);
1439 + ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
1441 + hw->phy.ops.release_phy(hw);
1447 + * e1000e_write_phy_reg_bm2 - Write BM PHY register
1448 + * @hw: pointer to the HW structure
1449 + * @offset: register offset to write to
1450 + * @data: data to write at register offset
1452 + * Acquires semaphore, if necessary, then writes the data to PHY register
1453 + * at the offset. Release any acquired semaphores before exiting.
1455 +s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data)
1458 + u16 page = (u16)(offset >> IGP_PAGE_SHIFT);
1460 + /* Page 800 works differently than the rest so it has its own func */
1461 + if (page == BM_WUC_PAGE) {
1462 + ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data,
1467 + ret_val = hw->phy.ops.acquire_phy(hw);
1473 + if (offset > MAX_PHY_MULTI_PAGE_REG) {
1474 + /* Page is shifted left, PHY expects (page x 32) */
1475 + ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT,
1479 + hw->phy.ops.release_phy(hw);
1484 + ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
1487 + hw->phy.ops.release_phy(hw);
1493 * e1000_access_phy_wakeup_reg_bm - Read BM PHY wakeup register
1494 * @hw: pointer to the HW structure
1495 * @offset: register offset to be read or written