aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.osdl.org>2006-12-29 13:03:54 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-29 13:03:54 -0500
commit6c722e90d7ede7db2d2b28a3cc69a8545db67ea1 (patch)
tree2473530190795c11f841db37b7d74df9bcc0416b /drivers/net/e1000
parent007fb598b4674de82492a9961e82826875012229 (diff)
parent81f4e6c190a0fa016fd7eecaf76a5f95d121afc2 (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (42 commits) r8169: extraneous Cmd{Tx/Rx}Enb write forcedeth: modified comment header NetXen: Reducing ring sizes for IOMMU issue. NetXen: Fix for PPC machines. NetXen: work queue fixes. NetXen: Link status message correction for quad port cards. NetXen: Multiple adapter fix. NetXen: Using correct CHECKSUM flag. NetXen: driver reload fix for newer firmware. NetXen: Adding new device ids. PHY probe not working properly for ibm_emac (PPC4xx) ep93xx: some minor cleanups to the ep93xx eth driver sky2: phy power down needs PCI config write enabled sky2: power management/MSI workaround sky2: dual port NAPI problem via-velocity uses INET interfaces e1000: Do not truncate TSO TCP header with 82544 workaround myri10ge: handle failures in suspend and resume myri10ge: no need to save MSI and PCIe state in the driver myri10ge: make msi configurable at runtime through sysfs ...
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r--drivers/net/e1000/e1000_ethtool.c3
-rw-r--r--drivers/net/e1000/e1000_hw.c296
-rw-r--r--drivers/net/e1000/e1000_hw.h310
-rw-r--r--drivers/net/e1000/e1000_main.c345
-rw-r--r--drivers/net/e1000/e1000_param.c4
5 files changed, 568 insertions, 390 deletions
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index da459f7177c6..fb96c87f9e56 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -100,6 +100,9 @@ static const struct e1000_stats e1000_gstrings_stats[] = {
100 { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) }, 100 { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) },
101 { "rx_header_split", E1000_STAT(rx_hdr_split) }, 101 { "rx_header_split", E1000_STAT(rx_hdr_split) },
102 { "alloc_rx_buff_failed", E1000_STAT(alloc_rx_buff_failed) }, 102 { "alloc_rx_buff_failed", E1000_STAT(alloc_rx_buff_failed) },
103 { "tx_smbus", E1000_STAT(stats.mgptc) },
104 { "rx_smbus", E1000_STAT(stats.mgprc) },
105 { "dropped_smbus", E1000_STAT(stats.mgpdc) },
103}; 106};
104 107
105#define E1000_QUEUE_STATS_LEN 0 108#define E1000_QUEUE_STATS_LEN 0
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 3655d902b0bd..9be44699300b 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -308,141 +308,160 @@ e1000_phy_init_script(struct e1000_hw *hw)
308int32_t 308int32_t
309e1000_set_mac_type(struct e1000_hw *hw) 309e1000_set_mac_type(struct e1000_hw *hw)
310{ 310{
311 DEBUGFUNC("e1000_set_mac_type"); 311 DEBUGFUNC("e1000_set_mac_type");
312 312
313 switch (hw->device_id) { 313 switch (hw->device_id) {
314 case E1000_DEV_ID_82542: 314 case E1000_DEV_ID_82542:
315 switch (hw->revision_id) { 315 switch (hw->revision_id) {
316 case E1000_82542_2_0_REV_ID: 316 case E1000_82542_2_0_REV_ID:
317 hw->mac_type = e1000_82542_rev2_0; 317 hw->mac_type = e1000_82542_rev2_0;
318 break; 318 break;
319 case E1000_82542_2_1_REV_ID: 319 case E1000_82542_2_1_REV_ID:
320 hw->mac_type = e1000_82542_rev2_1; 320 hw->mac_type = e1000_82542_rev2_1;
321 break; 321 break;
322 default: 322 default:
323 /* Invalid 82542 revision ID */ 323 /* Invalid 82542 revision ID */
324 return -E1000_ERR_MAC_TYPE; 324 return -E1000_ERR_MAC_TYPE;
325 } 325 }
326 break; 326 break;
327 case E1000_DEV_ID_82543GC_FIBER: 327 case E1000_DEV_ID_82543GC_FIBER:
328 case E1000_DEV_ID_82543GC_COPPER: 328 case E1000_DEV_ID_82543GC_COPPER:
329 hw->mac_type = e1000_82543; 329 hw->mac_type = e1000_82543;
330 break; 330 break;
331 case E1000_DEV_ID_82544EI_COPPER: 331 case E1000_DEV_ID_82544EI_COPPER:
332 case E1000_DEV_ID_82544EI_FIBER: 332 case E1000_DEV_ID_82544EI_FIBER:
333 case E1000_DEV_ID_82544GC_COPPER: 333 case E1000_DEV_ID_82544GC_COPPER:
334 case E1000_DEV_ID_82544GC_LOM: 334 case E1000_DEV_ID_82544GC_LOM:
335 hw->mac_type = e1000_82544; 335 hw->mac_type = e1000_82544;
336 break; 336 break;
337 case E1000_DEV_ID_82540EM: 337 case E1000_DEV_ID_82540EM:
338 case E1000_DEV_ID_82540EM_LOM: 338 case E1000_DEV_ID_82540EM_LOM:
339 case E1000_DEV_ID_82540EP: 339 case E1000_DEV_ID_82540EP:
340 case E1000_DEV_ID_82540EP_LOM: 340 case E1000_DEV_ID_82540EP_LOM:
341 case E1000_DEV_ID_82540EP_LP: 341 case E1000_DEV_ID_82540EP_LP:
342 hw->mac_type = e1000_82540; 342 hw->mac_type = e1000_82540;
343 break; 343 break;
344 case E1000_DEV_ID_82545EM_COPPER: 344 case E1000_DEV_ID_82545EM_COPPER:
345 case E1000_DEV_ID_82545EM_FIBER: 345 case E1000_DEV_ID_82545EM_FIBER:
346 hw->mac_type = e1000_82545; 346 hw->mac_type = e1000_82545;
347 break; 347 break;
348 case E1000_DEV_ID_82545GM_COPPER: 348 case E1000_DEV_ID_82545GM_COPPER:
349 case E1000_DEV_ID_82545GM_FIBER: 349 case E1000_DEV_ID_82545GM_FIBER:
350 case E1000_DEV_ID_82545GM_SERDES: 350 case E1000_DEV_ID_82545GM_SERDES:
351 hw->mac_type = e1000_82545_rev_3; 351 hw->mac_type = e1000_82545_rev_3;
352 break; 352 break;
353 case E1000_DEV_ID_82546EB_COPPER: 353 case E1000_DEV_ID_82546EB_COPPER:
354 case E1000_DEV_ID_82546EB_FIBER: 354 case E1000_DEV_ID_82546EB_FIBER:
355 case E1000_DEV_ID_82546EB_QUAD_COPPER: 355 case E1000_DEV_ID_82546EB_QUAD_COPPER:
356 hw->mac_type = e1000_82546; 356 hw->mac_type = e1000_82546;
357 break; 357 break;
358 case E1000_DEV_ID_82546GB_COPPER: 358 case E1000_DEV_ID_82546GB_COPPER:
359 case E1000_DEV_ID_82546GB_FIBER: 359 case E1000_DEV_ID_82546GB_FIBER:
360 case E1000_DEV_ID_82546GB_SERDES: 360 case E1000_DEV_ID_82546GB_SERDES:
361 case E1000_DEV_ID_82546GB_PCIE: 361 case E1000_DEV_ID_82546GB_PCIE:
362 case E1000_DEV_ID_82546GB_QUAD_COPPER: 362 case E1000_DEV_ID_82546GB_QUAD_COPPER:
363 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: 363 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
364 hw->mac_type = e1000_82546_rev_3; 364 hw->mac_type = e1000_82546_rev_3;
365 break; 365 break;
366 case E1000_DEV_ID_82541EI: 366 case E1000_DEV_ID_82541EI:
367 case E1000_DEV_ID_82541EI_MOBILE: 367 case E1000_DEV_ID_82541EI_MOBILE:
368 case E1000_DEV_ID_82541ER_LOM: 368 case E1000_DEV_ID_82541ER_LOM:
369 hw->mac_type = e1000_82541; 369 hw->mac_type = e1000_82541;
370 break; 370 break;
371 case E1000_DEV_ID_82541ER: 371 case E1000_DEV_ID_82541ER:
372 case E1000_DEV_ID_82541GI: 372 case E1000_DEV_ID_82541GI:
373 case E1000_DEV_ID_82541GI_LF: 373 case E1000_DEV_ID_82541GI_LF:
374 case E1000_DEV_ID_82541GI_MOBILE: 374 case E1000_DEV_ID_82541GI_MOBILE:
375 hw->mac_type = e1000_82541_rev_2; 375 hw->mac_type = e1000_82541_rev_2;
376 break; 376 break;
377 case E1000_DEV_ID_82547EI: 377 case E1000_DEV_ID_82547EI:
378 case E1000_DEV_ID_82547EI_MOBILE: 378 case E1000_DEV_ID_82547EI_MOBILE:
379 hw->mac_type = e1000_82547; 379 hw->mac_type = e1000_82547;
380 break; 380 break;
381 case E1000_DEV_ID_82547GI: 381 case E1000_DEV_ID_82547GI:
382 hw->mac_type = e1000_82547_rev_2; 382 hw->mac_type = e1000_82547_rev_2;
383 break; 383 break;
384 case E1000_DEV_ID_82571EB_COPPER: 384 case E1000_DEV_ID_82571EB_COPPER:
385 case E1000_DEV_ID_82571EB_FIBER: 385 case E1000_DEV_ID_82571EB_FIBER:
386 case E1000_DEV_ID_82571EB_SERDES: 386 case E1000_DEV_ID_82571EB_SERDES:
387 case E1000_DEV_ID_82571EB_QUAD_COPPER: 387 case E1000_DEV_ID_82571EB_QUAD_COPPER:
388 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: 388 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
389 hw->mac_type = e1000_82571; 389 hw->mac_type = e1000_82571;
390 break; 390 break;
391 case E1000_DEV_ID_82572EI_COPPER: 391 case E1000_DEV_ID_82572EI_COPPER:
392 case E1000_DEV_ID_82572EI_FIBER: 392 case E1000_DEV_ID_82572EI_FIBER:
393 case E1000_DEV_ID_82572EI_SERDES: 393 case E1000_DEV_ID_82572EI_SERDES:
394 case E1000_DEV_ID_82572EI: 394 case E1000_DEV_ID_82572EI:
395 hw->mac_type = e1000_82572; 395 hw->mac_type = e1000_82572;
396 break; 396 break;
397 case E1000_DEV_ID_82573E: 397 case E1000_DEV_ID_82573E:
398 case E1000_DEV_ID_82573E_IAMT: 398 case E1000_DEV_ID_82573E_IAMT:
399 case E1000_DEV_ID_82573L: 399 case E1000_DEV_ID_82573L:
400 hw->mac_type = e1000_82573; 400 hw->mac_type = e1000_82573;
401 break; 401 break;
402 case E1000_DEV_ID_80003ES2LAN_COPPER_SPT: 402 case E1000_DEV_ID_80003ES2LAN_COPPER_SPT:
403 case E1000_DEV_ID_80003ES2LAN_SERDES_SPT: 403 case E1000_DEV_ID_80003ES2LAN_SERDES_SPT:
404 case E1000_DEV_ID_80003ES2LAN_COPPER_DPT: 404 case E1000_DEV_ID_80003ES2LAN_COPPER_DPT:
405 case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: 405 case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
406 hw->mac_type = e1000_80003es2lan; 406 hw->mac_type = e1000_80003es2lan;
407 break; 407 break;
408 case E1000_DEV_ID_ICH8_IGP_M_AMT: 408 case E1000_DEV_ID_ICH8_IGP_M_AMT:
409 case E1000_DEV_ID_ICH8_IGP_AMT: 409 case E1000_DEV_ID_ICH8_IGP_AMT:
410 case E1000_DEV_ID_ICH8_IGP_C: 410 case E1000_DEV_ID_ICH8_IGP_C:
411 case E1000_DEV_ID_ICH8_IFE: 411 case E1000_DEV_ID_ICH8_IFE:
412 case E1000_DEV_ID_ICH8_IFE_GT: 412 case E1000_DEV_ID_ICH8_IFE_GT:
413 case E1000_DEV_ID_ICH8_IFE_G: 413 case E1000_DEV_ID_ICH8_IFE_G:
414 case E1000_DEV_ID_ICH8_IGP_M: 414 case E1000_DEV_ID_ICH8_IGP_M:
415 hw->mac_type = e1000_ich8lan; 415 hw->mac_type = e1000_ich8lan;
416 break; 416 break;
417 default: 417 default:
418 /* Should never have loaded on this device */ 418 /* Should never have loaded on this device */
419 return -E1000_ERR_MAC_TYPE; 419 return -E1000_ERR_MAC_TYPE;
420 } 420 }
421 421
422 switch (hw->mac_type) { 422 switch (hw->mac_type) {
423 case e1000_ich8lan: 423 case e1000_ich8lan:
424 hw->swfwhw_semaphore_present = TRUE; 424 hw->swfwhw_semaphore_present = TRUE;
425 hw->asf_firmware_present = TRUE; 425 hw->asf_firmware_present = TRUE;
426 break; 426 break;
427 case e1000_80003es2lan: 427 case e1000_80003es2lan:
428 hw->swfw_sync_present = TRUE; 428 hw->swfw_sync_present = TRUE;
429 /* fall through */ 429 /* fall through */
430 case e1000_82571: 430 case e1000_82571:
431 case e1000_82572: 431 case e1000_82572:
432 case e1000_82573: 432 case e1000_82573:
433 hw->eeprom_semaphore_present = TRUE; 433 hw->eeprom_semaphore_present = TRUE;
434 /* fall through */ 434 /* fall through */
435 case e1000_82541: 435 case e1000_82541:
436 case e1000_82547: 436 case e1000_82547:
437 case e1000_82541_rev_2: 437 case e1000_82541_rev_2:
438 case e1000_82547_rev_2: 438 case e1000_82547_rev_2:
439 hw->asf_firmware_present = TRUE; 439 hw->asf_firmware_present = TRUE;
440 break; 440 break;
441 default: 441 default:
442 break; 442 break;
443 } 443 }
444 444
445 return E1000_SUCCESS; 445 /* The 82543 chip does not count tx_carrier_errors properly in
446 * FD mode
447 */
448 if (hw->mac_type == e1000_82543)
449 hw->bad_tx_carr_stats_fd = TRUE;
450
451 /* capable of receiving management packets to the host */
452 if (hw->mac_type >= e1000_82571)
453 hw->has_manc2h = TRUE;
454
455 /* In rare occasions, ESB2 systems would end up started without
456 * the RX unit being turned on.
457 */
458 if (hw->mac_type == e1000_80003es2lan)
459 hw->rx_needs_kicking = TRUE;
460
461 if (hw->mac_type > e1000_82544)
462 hw->has_smbus = TRUE;
463
464 return E1000_SUCCESS;
446} 465}
447 466
448/***************************************************************************** 467/*****************************************************************************
@@ -6575,7 +6594,7 @@ e1000_get_bus_info(struct e1000_hw *hw)
6575 switch (hw->mac_type) { 6594 switch (hw->mac_type) {
6576 case e1000_82542_rev2_0: 6595 case e1000_82542_rev2_0:
6577 case e1000_82542_rev2_1: 6596 case e1000_82542_rev2_1:
6578 hw->bus_type = e1000_bus_type_unknown; 6597 hw->bus_type = e1000_bus_type_pci;
6579 hw->bus_speed = e1000_bus_speed_unknown; 6598 hw->bus_speed = e1000_bus_speed_unknown;
6580 hw->bus_width = e1000_bus_width_unknown; 6599 hw->bus_width = e1000_bus_width_unknown;
6581 break; 6600 break;
@@ -7817,9 +7836,8 @@ e1000_enable_mng_pass_thru(struct e1000_hw *hw)
7817 fwsm = E1000_READ_REG(hw, FWSM); 7836 fwsm = E1000_READ_REG(hw, FWSM);
7818 factps = E1000_READ_REG(hw, FACTPS); 7837 factps = E1000_READ_REG(hw, FACTPS);
7819 7838
7820 if (((fwsm & E1000_FWSM_MODE_MASK) == 7839 if ((((fwsm & E1000_FWSM_MODE_MASK) >> E1000_FWSM_MODE_SHIFT) ==
7821 (e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT)) && 7840 e1000_mng_mode_pt) && !(factps & E1000_FACTPS_MNGCG))
7822 (factps & E1000_FACTPS_MNGCG))
7823 return TRUE; 7841 return TRUE;
7824 } else 7842 } else
7825 if ((manc & E1000_MANC_SMBUS_EN) && !(manc & E1000_MANC_ASF_EN)) 7843 if ((manc & E1000_MANC_SMBUS_EN) && !(manc & E1000_MANC_ASF_EN))
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index 3321fb13bfa9..d67105883341 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -1301,165 +1301,170 @@ struct e1000_ffvt_entry {
1301#define E1000_82542_RSSIR E1000_RSSIR 1301#define E1000_82542_RSSIR E1000_RSSIR
1302#define E1000_82542_KUMCTRLSTA E1000_KUMCTRLSTA 1302#define E1000_82542_KUMCTRLSTA E1000_KUMCTRLSTA
1303#define E1000_82542_SW_FW_SYNC E1000_SW_FW_SYNC 1303#define E1000_82542_SW_FW_SYNC E1000_SW_FW_SYNC
1304#define E1000_82542_MANC2H E1000_MANC2H
1304 1305
1305/* Statistics counters collected by the MAC */ 1306/* Statistics counters collected by the MAC */
1306struct e1000_hw_stats { 1307struct e1000_hw_stats {
1307 uint64_t crcerrs; 1308 uint64_t crcerrs;
1308 uint64_t algnerrc; 1309 uint64_t algnerrc;
1309 uint64_t symerrs; 1310 uint64_t symerrs;
1310 uint64_t rxerrc; 1311 uint64_t rxerrc;
1311 uint64_t txerrc; 1312 uint64_t txerrc;
1312 uint64_t mpc; 1313 uint64_t mpc;
1313 uint64_t scc; 1314 uint64_t scc;
1314 uint64_t ecol; 1315 uint64_t ecol;
1315 uint64_t mcc; 1316 uint64_t mcc;
1316 uint64_t latecol; 1317 uint64_t latecol;
1317 uint64_t colc; 1318 uint64_t colc;
1318 uint64_t dc; 1319 uint64_t dc;
1319 uint64_t tncrs; 1320 uint64_t tncrs;
1320 uint64_t sec; 1321 uint64_t sec;
1321 uint64_t cexterr; 1322 uint64_t cexterr;
1322 uint64_t rlec; 1323 uint64_t rlec;
1323 uint64_t xonrxc; 1324 uint64_t xonrxc;
1324 uint64_t xontxc; 1325 uint64_t xontxc;
1325 uint64_t xoffrxc; 1326 uint64_t xoffrxc;
1326 uint64_t xofftxc; 1327 uint64_t xofftxc;
1327 uint64_t fcruc; 1328 uint64_t fcruc;
1328 uint64_t prc64; 1329 uint64_t prc64;
1329 uint64_t prc127; 1330 uint64_t prc127;
1330 uint64_t prc255; 1331 uint64_t prc255;
1331 uint64_t prc511; 1332 uint64_t prc511;
1332 uint64_t prc1023; 1333 uint64_t prc1023;
1333 uint64_t prc1522; 1334 uint64_t prc1522;
1334 uint64_t gprc; 1335 uint64_t gprc;
1335 uint64_t bprc; 1336 uint64_t bprc;
1336 uint64_t mprc; 1337 uint64_t mprc;
1337 uint64_t gptc; 1338 uint64_t gptc;
1338 uint64_t gorcl; 1339 uint64_t gorcl;
1339 uint64_t gorch; 1340 uint64_t gorch;
1340 uint64_t gotcl; 1341 uint64_t gotcl;
1341 uint64_t gotch; 1342 uint64_t gotch;
1342 uint64_t rnbc; 1343 uint64_t rnbc;
1343 uint64_t ruc; 1344 uint64_t ruc;
1344 uint64_t rfc; 1345 uint64_t rfc;
1345 uint64_t roc; 1346 uint64_t roc;
1346 uint64_t rlerrc; 1347 uint64_t rlerrc;
1347 uint64_t rjc; 1348 uint64_t rjc;
1348 uint64_t mgprc; 1349 uint64_t mgprc;
1349 uint64_t mgpdc; 1350 uint64_t mgpdc;
1350 uint64_t mgptc; 1351 uint64_t mgptc;
1351 uint64_t torl; 1352 uint64_t torl;
1352 uint64_t torh; 1353 uint64_t torh;
1353 uint64_t totl; 1354 uint64_t totl;
1354 uint64_t toth; 1355 uint64_t toth;
1355 uint64_t tpr; 1356 uint64_t tpr;
1356 uint64_t tpt; 1357 uint64_t tpt;
1357 uint64_t ptc64; 1358 uint64_t ptc64;
1358 uint64_t ptc127; 1359 uint64_t ptc127;
1359 uint64_t ptc255; 1360 uint64_t ptc255;
1360 uint64_t ptc511; 1361 uint64_t ptc511;
1361 uint64_t ptc1023; 1362 uint64_t ptc1023;
1362 uint64_t ptc1522; 1363 uint64_t ptc1522;
1363 uint64_t mptc; 1364 uint64_t mptc;
1364 uint64_t bptc; 1365 uint64_t bptc;
1365 uint64_t tsctc; 1366 uint64_t tsctc;
1366 uint64_t tsctfc; 1367 uint64_t tsctfc;
1367 uint64_t iac; 1368 uint64_t iac;
1368 uint64_t icrxptc; 1369 uint64_t icrxptc;
1369 uint64_t icrxatc; 1370 uint64_t icrxatc;
1370 uint64_t ictxptc; 1371 uint64_t ictxptc;
1371 uint64_t ictxatc; 1372 uint64_t ictxatc;
1372 uint64_t ictxqec; 1373 uint64_t ictxqec;
1373 uint64_t ictxqmtc; 1374 uint64_t ictxqmtc;
1374 uint64_t icrxdmtc; 1375 uint64_t icrxdmtc;
1375 uint64_t icrxoc; 1376 uint64_t icrxoc;
1376}; 1377};
1377 1378
1378/* Structure containing variables used by the shared code (e1000_hw.c) */ 1379/* Structure containing variables used by the shared code (e1000_hw.c) */
1379struct e1000_hw { 1380struct e1000_hw {
1380 uint8_t __iomem *hw_addr; 1381 uint8_t __iomem *hw_addr;
1381 uint8_t __iomem *flash_address; 1382 uint8_t __iomem *flash_address;
1382 e1000_mac_type mac_type; 1383 e1000_mac_type mac_type;
1383 e1000_phy_type phy_type; 1384 e1000_phy_type phy_type;
1384 uint32_t phy_init_script; 1385 uint32_t phy_init_script;
1385 e1000_media_type media_type; 1386 e1000_media_type media_type;
1386 void *back; 1387 void *back;
1387 struct e1000_shadow_ram *eeprom_shadow_ram; 1388 struct e1000_shadow_ram *eeprom_shadow_ram;
1388 uint32_t flash_bank_size; 1389 uint32_t flash_bank_size;
1389 uint32_t flash_base_addr; 1390 uint32_t flash_base_addr;
1390 e1000_fc_type fc; 1391 e1000_fc_type fc;
1391 e1000_bus_speed bus_speed; 1392 e1000_bus_speed bus_speed;
1392 e1000_bus_width bus_width; 1393 e1000_bus_width bus_width;
1393 e1000_bus_type bus_type; 1394 e1000_bus_type bus_type;
1394 struct e1000_eeprom_info eeprom; 1395 struct e1000_eeprom_info eeprom;
1395 e1000_ms_type master_slave; 1396 e1000_ms_type master_slave;
1396 e1000_ms_type original_master_slave; 1397 e1000_ms_type original_master_slave;
1397 e1000_ffe_config ffe_config_state; 1398 e1000_ffe_config ffe_config_state;
1398 uint32_t asf_firmware_present; 1399 uint32_t asf_firmware_present;
1399 uint32_t eeprom_semaphore_present; 1400 uint32_t eeprom_semaphore_present;
1400 uint32_t swfw_sync_present; 1401 uint32_t swfw_sync_present;
1401 uint32_t swfwhw_semaphore_present; 1402 uint32_t swfwhw_semaphore_present;
1402 unsigned long io_base; 1403 unsigned long io_base;
1403 uint32_t phy_id; 1404 uint32_t phy_id;
1404 uint32_t phy_revision; 1405 uint32_t phy_revision;
1405 uint32_t phy_addr; 1406 uint32_t phy_addr;
1406 uint32_t original_fc; 1407 uint32_t original_fc;
1407 uint32_t txcw; 1408 uint32_t txcw;
1408 uint32_t autoneg_failed; 1409 uint32_t autoneg_failed;
1409 uint32_t max_frame_size; 1410 uint32_t max_frame_size;
1410 uint32_t min_frame_size; 1411 uint32_t min_frame_size;
1411 uint32_t mc_filter_type; 1412 uint32_t mc_filter_type;
1412 uint32_t num_mc_addrs; 1413 uint32_t num_mc_addrs;
1413 uint32_t collision_delta; 1414 uint32_t collision_delta;
1414 uint32_t tx_packet_delta; 1415 uint32_t tx_packet_delta;
1415 uint32_t ledctl_default; 1416 uint32_t ledctl_default;
1416 uint32_t ledctl_mode1; 1417 uint32_t ledctl_mode1;
1417 uint32_t ledctl_mode2; 1418 uint32_t ledctl_mode2;
1418 boolean_t tx_pkt_filtering; 1419 boolean_t tx_pkt_filtering;
1419 struct e1000_host_mng_dhcp_cookie mng_cookie; 1420 struct e1000_host_mng_dhcp_cookie mng_cookie;
1420 uint16_t phy_spd_default; 1421 uint16_t phy_spd_default;
1421 uint16_t autoneg_advertised; 1422 uint16_t autoneg_advertised;
1422 uint16_t pci_cmd_word; 1423 uint16_t pci_cmd_word;
1423 uint16_t fc_high_water; 1424 uint16_t fc_high_water;
1424 uint16_t fc_low_water; 1425 uint16_t fc_low_water;
1425 uint16_t fc_pause_time; 1426 uint16_t fc_pause_time;
1426 uint16_t current_ifs_val; 1427 uint16_t current_ifs_val;
1427 uint16_t ifs_min_val; 1428 uint16_t ifs_min_val;
1428 uint16_t ifs_max_val; 1429 uint16_t ifs_max_val;
1429 uint16_t ifs_step_size; 1430 uint16_t ifs_step_size;
1430 uint16_t ifs_ratio; 1431 uint16_t ifs_ratio;
1431 uint16_t device_id; 1432 uint16_t device_id;
1432 uint16_t vendor_id; 1433 uint16_t vendor_id;
1433 uint16_t subsystem_id; 1434 uint16_t subsystem_id;
1434 uint16_t subsystem_vendor_id; 1435 uint16_t subsystem_vendor_id;
1435 uint8_t revision_id; 1436 uint8_t revision_id;
1436 uint8_t autoneg; 1437 uint8_t autoneg;
1437 uint8_t mdix; 1438 uint8_t mdix;
1438 uint8_t forced_speed_duplex; 1439 uint8_t forced_speed_duplex;
1439 uint8_t wait_autoneg_complete; 1440 uint8_t wait_autoneg_complete;
1440 uint8_t dma_fairness; 1441 uint8_t dma_fairness;
1441 uint8_t mac_addr[NODE_ADDRESS_SIZE]; 1442 uint8_t mac_addr[NODE_ADDRESS_SIZE];
1442 uint8_t perm_mac_addr[NODE_ADDRESS_SIZE]; 1443 uint8_t perm_mac_addr[NODE_ADDRESS_SIZE];
1443 boolean_t disable_polarity_correction; 1444 boolean_t disable_polarity_correction;
1444 boolean_t speed_downgraded; 1445 boolean_t speed_downgraded;
1445 e1000_smart_speed smart_speed; 1446 e1000_smart_speed smart_speed;
1446 e1000_dsp_config dsp_config_state; 1447 e1000_dsp_config dsp_config_state;
1447 boolean_t get_link_status; 1448 boolean_t get_link_status;
1448 boolean_t serdes_link_down; 1449 boolean_t serdes_link_down;
1449 boolean_t tbi_compatibility_en; 1450 boolean_t tbi_compatibility_en;
1450 boolean_t tbi_compatibility_on; 1451 boolean_t tbi_compatibility_on;
1451 boolean_t laa_is_present; 1452 boolean_t laa_is_present;
1452 boolean_t phy_reset_disable; 1453 boolean_t phy_reset_disable;
1453 boolean_t initialize_hw_bits_disable; 1454 boolean_t initialize_hw_bits_disable;
1454 boolean_t fc_send_xon; 1455 boolean_t fc_send_xon;
1455 boolean_t fc_strict_ieee; 1456 boolean_t fc_strict_ieee;
1456 boolean_t report_tx_early; 1457 boolean_t report_tx_early;
1457 boolean_t adaptive_ifs; 1458 boolean_t adaptive_ifs;
1458 boolean_t ifs_params_forced; 1459 boolean_t ifs_params_forced;
1459 boolean_t in_ifs_mode; 1460 boolean_t in_ifs_mode;
1460 boolean_t mng_reg_access_disabled; 1461 boolean_t mng_reg_access_disabled;
1461 boolean_t leave_av_bit_off; 1462 boolean_t leave_av_bit_off;
1462 boolean_t kmrn_lock_loss_workaround_disabled; 1463 boolean_t kmrn_lock_loss_workaround_disabled;
1464 boolean_t bad_tx_carr_stats_fd;
1465 boolean_t has_manc2h;
1466 boolean_t rx_needs_kicking;
1467 boolean_t has_smbus;
1463}; 1468};
1464 1469
1465 1470
@@ -2418,6 +2423,7 @@ struct e1000_host_command_info {
2418#define E1000_PBA_8K 0x0008 /* 8KB, default Rx allocation */ 2423#define E1000_PBA_8K 0x0008 /* 8KB, default Rx allocation */
2419#define E1000_PBA_12K 0x000C /* 12KB, default Rx allocation */ 2424#define E1000_PBA_12K 0x000C /* 12KB, default Rx allocation */
2420#define E1000_PBA_16K 0x0010 /* 16KB, default TX allocation */ 2425#define E1000_PBA_16K 0x0010 /* 16KB, default TX allocation */
2426#define E1000_PBA_20K 0x0014
2421#define E1000_PBA_22K 0x0016 2427#define E1000_PBA_22K 0x0016
2422#define E1000_PBA_24K 0x0018 2428#define E1000_PBA_24K 0x0018
2423#define E1000_PBA_30K 0x001E 2429#define E1000_PBA_30K 0x001E
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 73f3a85fd238..4c1ff752048c 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -213,6 +213,12 @@ static void e1000_netpoll (struct net_device *netdev);
213 213
214extern void e1000_check_options(struct e1000_adapter *adapter); 214extern void e1000_check_options(struct e1000_adapter *adapter);
215 215
216#define COPYBREAK_DEFAULT 256
217static unsigned int copybreak __read_mostly = COPYBREAK_DEFAULT;
218module_param(copybreak, uint, 0644);
219MODULE_PARM_DESC(copybreak,
220 "Maximum size of packet that is copied to a new buffer on receive");
221
216static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, 222static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev,
217 pci_channel_state_t state); 223 pci_channel_state_t state);
218static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev); 224static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev);
@@ -264,7 +270,13 @@ e1000_init_module(void)
264 printk(KERN_INFO "%s\n", e1000_copyright); 270 printk(KERN_INFO "%s\n", e1000_copyright);
265 271
266 ret = pci_register_driver(&e1000_driver); 272 ret = pci_register_driver(&e1000_driver);
267 273 if (copybreak != COPYBREAK_DEFAULT) {
274 if (copybreak == 0)
275 printk(KERN_INFO "e1000: copybreak disabled\n");
276 else
277 printk(KERN_INFO "e1000: copybreak enabled for "
278 "packets <= %u bytes\n", copybreak);
279 }
268 return ret; 280 return ret;
269} 281}
270 282
@@ -464,6 +476,52 @@ e1000_get_hw_control(struct e1000_adapter *adapter)
464 } 476 }
465} 477}
466 478
479static void
480e1000_init_manageability(struct e1000_adapter *adapter)
481{
482 if (adapter->en_mng_pt) {
483 uint32_t manc = E1000_READ_REG(&adapter->hw, MANC);
484
485 /* disable hardware interception of ARP */
486 manc &= ~(E1000_MANC_ARP_EN);
487
488 /* enable receiving management packets to the host */
489 /* this will probably generate destination unreachable messages
490 * from the host OS, but the packets will be handled on SMBUS */
491 if (adapter->hw.has_manc2h) {
492 uint32_t manc2h = E1000_READ_REG(&adapter->hw, MANC2H);
493
494 manc |= E1000_MANC_EN_MNG2HOST;
495#define E1000_MNG2HOST_PORT_623 (1 << 5)
496#define E1000_MNG2HOST_PORT_664 (1 << 6)
497 manc2h |= E1000_MNG2HOST_PORT_623;
498 manc2h |= E1000_MNG2HOST_PORT_664;
499 E1000_WRITE_REG(&adapter->hw, MANC2H, manc2h);
500 }
501
502 E1000_WRITE_REG(&adapter->hw, MANC, manc);
503 }
504}
505
506static void
507e1000_release_manageability(struct e1000_adapter *adapter)
508{
509 if (adapter->en_mng_pt) {
510 uint32_t manc = E1000_READ_REG(&adapter->hw, MANC);
511
512 /* re-enable hardware interception of ARP */
513 manc |= E1000_MANC_ARP_EN;
514
515 if (adapter->hw.has_manc2h)
516 manc &= ~E1000_MANC_EN_MNG2HOST;
517
518 /* don't explicitly have to mess with MANC2H since
519 * MANC has an enable disable that gates MANC2H */
520
521 E1000_WRITE_REG(&adapter->hw, MANC, manc);
522 }
523}
524
467int 525int
468e1000_up(struct e1000_adapter *adapter) 526e1000_up(struct e1000_adapter *adapter)
469{ 527{
@@ -475,6 +533,7 @@ e1000_up(struct e1000_adapter *adapter)
475 e1000_set_multi(netdev); 533 e1000_set_multi(netdev);
476 534
477 e1000_restore_vlan(adapter); 535 e1000_restore_vlan(adapter);
536 e1000_init_manageability(adapter);
478 537
479 e1000_configure_tx(adapter); 538 e1000_configure_tx(adapter);
480 e1000_setup_rctl(adapter); 539 e1000_setup_rctl(adapter);
@@ -497,7 +556,8 @@ e1000_up(struct e1000_adapter *adapter)
497 556
498 clear_bit(__E1000_DOWN, &adapter->flags); 557 clear_bit(__E1000_DOWN, &adapter->flags);
499 558
500 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); 559 /* fire a link change interrupt to start the watchdog */
560 E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_LSC);
501 return 0; 561 return 0;
502} 562}
503 563
@@ -614,16 +674,34 @@ e1000_reinit_locked(struct e1000_adapter *adapter)
614void 674void
615e1000_reset(struct e1000_adapter *adapter) 675e1000_reset(struct e1000_adapter *adapter)
616{ 676{
617 uint32_t pba, manc; 677 uint32_t pba = 0, tx_space, min_tx_space, min_rx_space;
618 uint16_t fc_high_water_mark = E1000_FC_HIGH_DIFF; 678 uint16_t fc_high_water_mark = E1000_FC_HIGH_DIFF;
679 boolean_t legacy_pba_adjust = FALSE;
619 680
620 /* Repartition Pba for greater than 9k mtu 681 /* Repartition Pba for greater than 9k mtu
621 * To take effect CTRL.RST is required. 682 * To take effect CTRL.RST is required.
622 */ 683 */
623 684
624 switch (adapter->hw.mac_type) { 685 switch (adapter->hw.mac_type) {
686 case e1000_82542_rev2_0:
687 case e1000_82542_rev2_1:
688 case e1000_82543:
689 case e1000_82544:
690 case e1000_82540:
691 case e1000_82541:
692 case e1000_82541_rev_2:
693 legacy_pba_adjust = TRUE;
694 pba = E1000_PBA_48K;
695 break;
696 case e1000_82545:
697 case e1000_82545_rev_3:
698 case e1000_82546:
699 case e1000_82546_rev_3:
700 pba = E1000_PBA_48K;
701 break;
625 case e1000_82547: 702 case e1000_82547:
626 case e1000_82547_rev_2: 703 case e1000_82547_rev_2:
704 legacy_pba_adjust = TRUE;
627 pba = E1000_PBA_30K; 705 pba = E1000_PBA_30K;
628 break; 706 break;
629 case e1000_82571: 707 case e1000_82571:
@@ -632,27 +710,80 @@ e1000_reset(struct e1000_adapter *adapter)
632 pba = E1000_PBA_38K; 710 pba = E1000_PBA_38K;
633 break; 711 break;
634 case e1000_82573: 712 case e1000_82573:
635 pba = E1000_PBA_12K; 713 pba = E1000_PBA_20K;
636 break; 714 break;
637 case e1000_ich8lan: 715 case e1000_ich8lan:
638 pba = E1000_PBA_8K; 716 pba = E1000_PBA_8K;
639 break; 717 case e1000_undefined:
640 default: 718 case e1000_num_macs:
641 pba = E1000_PBA_48K;
642 break; 719 break;
643 } 720 }
644 721
645 if ((adapter->hw.mac_type != e1000_82573) && 722 if (legacy_pba_adjust == TRUE) {
646 (adapter->netdev->mtu > E1000_RXBUFFER_8192)) 723 if (adapter->netdev->mtu > E1000_RXBUFFER_8192)
647 pba -= 8; /* allocate more FIFO for Tx */ 724 pba -= 8; /* allocate more FIFO for Tx */
648 725
726 if (adapter->hw.mac_type == e1000_82547) {
727 adapter->tx_fifo_head = 0;
728 adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT;
729 adapter->tx_fifo_size =
730 (E1000_PBA_40K - pba) << E1000_PBA_BYTES_SHIFT;
731 atomic_set(&adapter->tx_fifo_stall, 0);
732 }
733 } else if (adapter->hw.max_frame_size > MAXIMUM_ETHERNET_FRAME_SIZE) {
734 /* adjust PBA for jumbo frames */
735 E1000_WRITE_REG(&adapter->hw, PBA, pba);
736
737 /* To maintain wire speed transmits, the Tx FIFO should be
738 * large enough to accomodate two full transmit packets,
739 * rounded up to the next 1KB and expressed in KB. Likewise,
740 * the Rx FIFO should be large enough to accomodate at least
741 * one full receive packet and is similarly rounded up and
742 * expressed in KB. */
743 pba = E1000_READ_REG(&adapter->hw, PBA);
744 /* upper 16 bits has Tx packet buffer allocation size in KB */
745 tx_space = pba >> 16;
746 /* lower 16 bits has Rx packet buffer allocation size in KB */
747 pba &= 0xffff;
748 /* don't include ethernet FCS because hardware appends/strips */
749 min_rx_space = adapter->netdev->mtu + ENET_HEADER_SIZE +
750 VLAN_TAG_SIZE;
751 min_tx_space = min_rx_space;
752 min_tx_space *= 2;
753 E1000_ROUNDUP(min_tx_space, 1024);
754 min_tx_space >>= 10;
755 E1000_ROUNDUP(min_rx_space, 1024);
756 min_rx_space >>= 10;
757
758 /* If current Tx allocation is less than the min Tx FIFO size,
759 * and the min Tx FIFO size is less than the current Rx FIFO
760 * allocation, take space away from current Rx allocation */
761 if (tx_space < min_tx_space &&
762 ((min_tx_space - tx_space) < pba)) {
763 pba = pba - (min_tx_space - tx_space);
764
765 /* PCI/PCIx hardware has PBA alignment constraints */
766 switch (adapter->hw.mac_type) {
767 case e1000_82545 ... e1000_82546_rev_3:
768 pba &= ~(E1000_PBA_8K - 1);
769 break;
770 default:
771 break;
772 }
649 773
650 if (adapter->hw.mac_type == e1000_82547) { 774 /* if short on rx space, rx wins and must trump tx
651 adapter->tx_fifo_head = 0; 775 * adjustment or use Early Receive if available */
652 adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT; 776 if (pba < min_rx_space) {
653 adapter->tx_fifo_size = 777 switch (adapter->hw.mac_type) {
654 (E1000_PBA_40K - pba) << E1000_PBA_BYTES_SHIFT; 778 case e1000_82573:
655 atomic_set(&adapter->tx_fifo_stall, 0); 779 /* ERT enabled in e1000_configure_rx */
780 break;
781 default:
782 pba = min_rx_space;
783 break;
784 }
785 }
786 }
656 } 787 }
657 788
658 E1000_WRITE_REG(&adapter->hw, PBA, pba); 789 E1000_WRITE_REG(&adapter->hw, PBA, pba);
@@ -685,6 +816,20 @@ e1000_reset(struct e1000_adapter *adapter)
685 if (e1000_init_hw(&adapter->hw)) 816 if (e1000_init_hw(&adapter->hw))
686 DPRINTK(PROBE, ERR, "Hardware Error\n"); 817 DPRINTK(PROBE, ERR, "Hardware Error\n");
687 e1000_update_mng_vlan(adapter); 818 e1000_update_mng_vlan(adapter);
819
820 /* if (adapter->hwflags & HWFLAGS_PHY_PWR_BIT) { */
821 if (adapter->hw.mac_type >= e1000_82544 &&
822 adapter->hw.mac_type <= e1000_82547_rev_2 &&
823 adapter->hw.autoneg == 1 &&
824 adapter->hw.autoneg_advertised == ADVERTISE_1000_FULL) {
825 uint32_t ctrl = E1000_READ_REG(&adapter->hw, CTRL);
826 /* clear phy power management bit if we are in gig only mode,
827 * which if enabled will attempt negotiation to 100Mb, which
828 * can cause a loss of link at power off or driver unload */
829 ctrl &= ~E1000_CTRL_SWDPIN3;
830 E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
831 }
832
688 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ 833 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
689 E1000_WRITE_REG(&adapter->hw, VET, ETHERNET_IEEE_VLAN_TYPE); 834 E1000_WRITE_REG(&adapter->hw, VET, ETHERNET_IEEE_VLAN_TYPE);
690 835
@@ -705,14 +850,7 @@ e1000_reset(struct e1000_adapter *adapter)
705 phy_data); 850 phy_data);
706 } 851 }
707 852
708 if ((adapter->en_mng_pt) && 853 e1000_release_manageability(adapter);
709 (adapter->hw.mac_type >= e1000_82540) &&
710 (adapter->hw.mac_type < e1000_82571) &&
711 (adapter->hw.media_type == e1000_media_type_copper)) {
712 manc = E1000_READ_REG(&adapter->hw, MANC);
713 manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST);
714 E1000_WRITE_REG(&adapter->hw, MANC, manc);
715 }
716} 854}
717 855
718/** 856/**
@@ -857,6 +995,12 @@ e1000_probe(struct pci_dev *pdev,
857 (adapter->hw.mac_type != e1000_82547)) 995 (adapter->hw.mac_type != e1000_82547))
858 netdev->features |= NETIF_F_TSO; 996 netdev->features |= NETIF_F_TSO;
859 997
998#ifdef CONFIG_DEBUG_SLAB
999 /* 82544's work arounds do not play nicely with DEBUG SLAB */
1000 if (adapter->hw.mac_type == e1000_82544)
1001 netdev->features &= ~NETIF_F_TSO;
1002#endif
1003
860#ifdef NETIF_F_TSO6 1004#ifdef NETIF_F_TSO6
861 if (adapter->hw.mac_type > e1000_82547_rev_2) 1005 if (adapter->hw.mac_type > e1000_82547_rev_2)
862 netdev->features |= NETIF_F_TSO6; 1006 netdev->features |= NETIF_F_TSO6;
@@ -1078,22 +1222,13 @@ e1000_remove(struct pci_dev *pdev)
1078{ 1222{
1079 struct net_device *netdev = pci_get_drvdata(pdev); 1223 struct net_device *netdev = pci_get_drvdata(pdev);
1080 struct e1000_adapter *adapter = netdev_priv(netdev); 1224 struct e1000_adapter *adapter = netdev_priv(netdev);
1081 uint32_t manc;
1082#ifdef CONFIG_E1000_NAPI 1225#ifdef CONFIG_E1000_NAPI
1083 int i; 1226 int i;
1084#endif 1227#endif
1085 1228
1086 flush_scheduled_work(); 1229 flush_scheduled_work();
1087 1230
1088 if (adapter->hw.mac_type >= e1000_82540 && 1231 e1000_release_manageability(adapter);
1089 adapter->hw.mac_type < e1000_82571 &&
1090 adapter->hw.media_type == e1000_media_type_copper) {
1091 manc = E1000_READ_REG(&adapter->hw, MANC);
1092 if (manc & E1000_MANC_SMBUS_EN) {
1093 manc |= E1000_MANC_ARP_EN;
1094 E1000_WRITE_REG(&adapter->hw, MANC, manc);
1095 }
1096 }
1097 1232
1098 /* Release control of h/w to f/w. If f/w is AMT enabled, this 1233 /* Release control of h/w to f/w. If f/w is AMT enabled, this
1099 * would have already happened in close and is redundant. */ 1234 * would have already happened in close and is redundant. */
@@ -1531,9 +1666,9 @@ e1000_configure_tx(struct e1000_adapter *adapter)
1531 } 1666 }
1532 1667
1533 /* Set the default values for the Tx Inter Packet Gap timer */ 1668 /* Set the default values for the Tx Inter Packet Gap timer */
1534 1669 if (adapter->hw.mac_type <= e1000_82547_rev_2 &&
1535 if (hw->media_type == e1000_media_type_fiber || 1670 (hw->media_type == e1000_media_type_fiber ||
1536 hw->media_type == e1000_media_type_internal_serdes) 1671 hw->media_type == e1000_media_type_internal_serdes))
1537 tipg = DEFAULT_82543_TIPG_IPGT_FIBER; 1672 tipg = DEFAULT_82543_TIPG_IPGT_FIBER;
1538 else 1673 else
1539 tipg = DEFAULT_82543_TIPG_IPGT_COPPER; 1674 tipg = DEFAULT_82543_TIPG_IPGT_COPPER;
@@ -2528,6 +2663,13 @@ e1000_watchdog(unsigned long data)
2528 netif_wake_queue(netdev); 2663 netif_wake_queue(netdev);
2529 mod_timer(&adapter->phy_info_timer, jiffies + 2 * HZ); 2664 mod_timer(&adapter->phy_info_timer, jiffies + 2 * HZ);
2530 adapter->smartspeed = 0; 2665 adapter->smartspeed = 0;
2666 } else {
2667 /* make sure the receive unit is started */
2668 if (adapter->hw.rx_needs_kicking) {
2669 struct e1000_hw *hw = &adapter->hw;
2670 uint32_t rctl = E1000_READ_REG(hw, RCTL);
2671 E1000_WRITE_REG(hw, RCTL, rctl | E1000_RCTL_EN);
2672 }
2531 } 2673 }
2532 } else { 2674 } else {
2533 if (netif_carrier_ok(netdev)) { 2675 if (netif_carrier_ok(netdev)) {
@@ -2628,29 +2770,34 @@ static unsigned int e1000_update_itr(struct e1000_adapter *adapter,
2628 if (packets == 0) 2770 if (packets == 0)
2629 goto update_itr_done; 2771 goto update_itr_done;
2630 2772
2631
2632 switch (itr_setting) { 2773 switch (itr_setting) {
2633 case lowest_latency: 2774 case lowest_latency:
2634 if ((packets < 5) && (bytes > 512)) 2775 /* jumbo frames get bulk treatment*/
2776 if (bytes/packets > 8000)
2777 retval = bulk_latency;
2778 else if ((packets < 5) && (bytes > 512))
2635 retval = low_latency; 2779 retval = low_latency;
2636 break; 2780 break;
2637 case low_latency: /* 50 usec aka 20000 ints/s */ 2781 case low_latency: /* 50 usec aka 20000 ints/s */
2638 if (bytes > 10000) { 2782 if (bytes > 10000) {
2639 if ((packets < 10) || 2783 /* jumbo frames need bulk latency setting */
2640 ((bytes/packets) > 1200)) 2784 if (bytes/packets > 8000)
2785 retval = bulk_latency;
2786 else if ((packets < 10) || ((bytes/packets) > 1200))
2641 retval = bulk_latency; 2787 retval = bulk_latency;
2642 else if ((packets > 35)) 2788 else if ((packets > 35))
2643 retval = lowest_latency; 2789 retval = lowest_latency;
2644 } else if (packets <= 2 && bytes < 512) 2790 } else if (bytes/packets > 2000)
2791 retval = bulk_latency;
2792 else if (packets <= 2 && bytes < 512)
2645 retval = lowest_latency; 2793 retval = lowest_latency;
2646 break; 2794 break;
2647 case bulk_latency: /* 250 usec aka 4000 ints/s */ 2795 case bulk_latency: /* 250 usec aka 4000 ints/s */
2648 if (bytes > 25000) { 2796 if (bytes > 25000) {
2649 if (packets > 35) 2797 if (packets > 35)
2650 retval = low_latency; 2798 retval = low_latency;
2651 } else { 2799 } else if (bytes < 6000) {
2652 if (bytes < 6000) 2800 retval = low_latency;
2653 retval = low_latency;
2654 } 2801 }
2655 break; 2802 break;
2656 } 2803 }
@@ -2679,17 +2826,20 @@ static void e1000_set_itr(struct e1000_adapter *adapter)
2679 adapter->tx_itr, 2826 adapter->tx_itr,
2680 adapter->total_tx_packets, 2827 adapter->total_tx_packets,
2681 adapter->total_tx_bytes); 2828 adapter->total_tx_bytes);
2829 /* conservative mode (itr 3) eliminates the lowest_latency setting */
2830 if (adapter->itr_setting == 3 && adapter->tx_itr == lowest_latency)
2831 adapter->tx_itr = low_latency;
2832
2682 adapter->rx_itr = e1000_update_itr(adapter, 2833 adapter->rx_itr = e1000_update_itr(adapter,
2683 adapter->rx_itr, 2834 adapter->rx_itr,
2684 adapter->total_rx_packets, 2835 adapter->total_rx_packets,
2685 adapter->total_rx_bytes); 2836 adapter->total_rx_bytes);
2837 /* conservative mode (itr 3) eliminates the lowest_latency setting */
2838 if (adapter->itr_setting == 3 && adapter->rx_itr == lowest_latency)
2839 adapter->rx_itr = low_latency;
2686 2840
2687 current_itr = max(adapter->rx_itr, adapter->tx_itr); 2841 current_itr = max(adapter->rx_itr, adapter->tx_itr);
2688 2842
2689 /* conservative mode eliminates the lowest_latency setting */
2690 if (current_itr == lowest_latency && (adapter->itr_setting == 3))
2691 current_itr = low_latency;
2692
2693 switch (current_itr) { 2843 switch (current_itr) {
2694 /* counts and packets in update_itr are dependent on these numbers */ 2844 /* counts and packets in update_itr are dependent on these numbers */
2695 case lowest_latency: 2845 case lowest_latency:
@@ -3168,6 +3318,16 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
3168 if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) { 3318 if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) {
3169 switch (adapter->hw.mac_type) { 3319 switch (adapter->hw.mac_type) {
3170 unsigned int pull_size; 3320 unsigned int pull_size;
3321 case e1000_82544:
3322 /* Make sure we have room to chop off 4 bytes,
3323 * and that the end alignment will work out to
3324 * this hardware's requirements
3325 * NOTE: this is a TSO only workaround
3326 * if end byte alignment not correct move us
3327 * into the next dword */
3328 if ((unsigned long)(skb->tail - 1) & 4)
3329 break;
3330 /* fall through */
3171 case e1000_82571: 3331 case e1000_82571:
3172 case e1000_82572: 3332 case e1000_82572:
3173 case e1000_82573: 3333 case e1000_82573:
@@ -3419,12 +3579,11 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu)
3419 adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE; 3579 adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE;
3420 3580
3421 netdev->mtu = new_mtu; 3581 netdev->mtu = new_mtu;
3582 adapter->hw.max_frame_size = max_frame;
3422 3583
3423 if (netif_running(netdev)) 3584 if (netif_running(netdev))
3424 e1000_reinit_locked(adapter); 3585 e1000_reinit_locked(adapter);
3425 3586
3426 adapter->hw.max_frame_size = max_frame;
3427
3428 return 0; 3587 return 0;
3429} 3588}
3430 3589
@@ -3573,6 +3732,11 @@ e1000_update_stats(struct e1000_adapter *adapter)
3573 adapter->net_stats.tx_aborted_errors = adapter->stats.ecol; 3732 adapter->net_stats.tx_aborted_errors = adapter->stats.ecol;
3574 adapter->net_stats.tx_window_errors = adapter->stats.latecol; 3733 adapter->net_stats.tx_window_errors = adapter->stats.latecol;
3575 adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs; 3734 adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs;
3735 if (adapter->hw.bad_tx_carr_stats_fd &&
3736 adapter->link_duplex == FULL_DUPLEX) {
3737 adapter->net_stats.tx_carrier_errors = 0;
3738 adapter->stats.tncrs = 0;
3739 }
3576 3740
3577 /* Tx Dropped needs to be maintained elsewhere */ 3741 /* Tx Dropped needs to be maintained elsewhere */
3578 3742
@@ -3590,6 +3754,13 @@ e1000_update_stats(struct e1000_adapter *adapter)
3590 adapter->phy_stats.receive_errors += phy_tmp; 3754 adapter->phy_stats.receive_errors += phy_tmp;
3591 } 3755 }
3592 3756
3757 /* Management Stats */
3758 if (adapter->hw.has_smbus) {
3759 adapter->stats.mgptc += E1000_READ_REG(hw, MGTPTC);
3760 adapter->stats.mgprc += E1000_READ_REG(hw, MGTPRC);
3761 adapter->stats.mgpdc += E1000_READ_REG(hw, MGTPDC);
3762 }
3763
3593 spin_unlock_irqrestore(&adapter->stats_lock, flags); 3764 spin_unlock_irqrestore(&adapter->stats_lock, flags);
3594} 3765}
3595#ifdef CONFIG_PCI_MSI 3766#ifdef CONFIG_PCI_MSI
@@ -3868,11 +4039,11 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
3868 cleaned = (i == eop); 4039 cleaned = (i == eop);
3869 4040
3870 if (cleaned) { 4041 if (cleaned) {
3871 /* this packet count is wrong for TSO but has a 4042 struct sk_buff *skb = buffer_info->skb;
3872 * tendency to make dynamic ITR change more 4043 unsigned int segs = skb_shinfo(skb)->gso_segs;
3873 * towards bulk */ 4044 total_tx_packets += segs;
3874 total_tx_packets++; 4045 total_tx_packets++;
3875 total_tx_bytes += buffer_info->skb->len; 4046 total_tx_bytes += skb->len;
3876 } 4047 }
3877 e1000_unmap_and_free_tx_resource(adapter, buffer_info); 4048 e1000_unmap_and_free_tx_resource(adapter, buffer_info);
3878 tx_desc->upper.data = 0; 4049 tx_desc->upper.data = 0;
@@ -4094,8 +4265,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
4094 /* code added for copybreak, this should improve 4265 /* code added for copybreak, this should improve
4095 * performance for small packets with large amounts 4266 * performance for small packets with large amounts
4096 * of reassembly being done in the stack */ 4267 * of reassembly being done in the stack */
4097#define E1000_CB_LENGTH 256 4268 if (length < copybreak) {
4098 if (length < E1000_CB_LENGTH) {
4099 struct sk_buff *new_skb = 4269 struct sk_buff *new_skb =
4100 netdev_alloc_skb(netdev, length + NET_IP_ALIGN); 4270 netdev_alloc_skb(netdev, length + NET_IP_ALIGN);
4101 if (new_skb) { 4271 if (new_skb) {
@@ -4253,7 +4423,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
4253 4423
4254 /* page alloc/put takes too long and effects small packet 4424 /* page alloc/put takes too long and effects small packet
4255 * throughput, so unsplit small packets and save the alloc/put*/ 4425 * throughput, so unsplit small packets and save the alloc/put*/
4256 if (l1 && ((length + l1) <= adapter->rx_ps_bsize0)) { 4426 if (l1 && (l1 <= copybreak) && ((length + l1) <= adapter->rx_ps_bsize0)) {
4257 u8 *vaddr; 4427 u8 *vaddr;
4258 /* there is no documentation about how to call 4428 /* there is no documentation about how to call
4259 * kmap_atomic, so we can't hold the mapping 4429 * kmap_atomic, so we can't hold the mapping
@@ -4998,7 +5168,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4998{ 5168{
4999 struct net_device *netdev = pci_get_drvdata(pdev); 5169 struct net_device *netdev = pci_get_drvdata(pdev);
5000 struct e1000_adapter *adapter = netdev_priv(netdev); 5170 struct e1000_adapter *adapter = netdev_priv(netdev);
5001 uint32_t ctrl, ctrl_ext, rctl, manc, status; 5171 uint32_t ctrl, ctrl_ext, rctl, status;
5002 uint32_t wufc = adapter->wol; 5172 uint32_t wufc = adapter->wol;
5003#ifdef CONFIG_PM 5173#ifdef CONFIG_PM
5004 int retval = 0; 5174 int retval = 0;
@@ -5067,16 +5237,12 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
5067 pci_enable_wake(pdev, PCI_D3cold, 0); 5237 pci_enable_wake(pdev, PCI_D3cold, 0);
5068 } 5238 }
5069 5239
5070 if (adapter->hw.mac_type >= e1000_82540 && 5240 e1000_release_manageability(adapter);
5071 adapter->hw.mac_type < e1000_82571 && 5241
5072 adapter->hw.media_type == e1000_media_type_copper) { 5242 /* make sure adapter isn't asleep if manageability is enabled */
5073 manc = E1000_READ_REG(&adapter->hw, MANC); 5243 if (adapter->en_mng_pt) {
5074 if (manc & E1000_MANC_SMBUS_EN) { 5244 pci_enable_wake(pdev, PCI_D3hot, 1);
5075 manc |= E1000_MANC_ARP_EN; 5245 pci_enable_wake(pdev, PCI_D3cold, 1);
5076 E1000_WRITE_REG(&adapter->hw, MANC, manc);
5077 pci_enable_wake(pdev, PCI_D3hot, 1);
5078 pci_enable_wake(pdev, PCI_D3cold, 1);
5079 }
5080 } 5246 }
5081 5247
5082 if (adapter->hw.phy_type == e1000_phy_igp_3) 5248 if (adapter->hw.phy_type == e1000_phy_igp_3)
@@ -5102,7 +5268,7 @@ e1000_resume(struct pci_dev *pdev)
5102{ 5268{
5103 struct net_device *netdev = pci_get_drvdata(pdev); 5269 struct net_device *netdev = pci_get_drvdata(pdev);
5104 struct e1000_adapter *adapter = netdev_priv(netdev); 5270 struct e1000_adapter *adapter = netdev_priv(netdev);
5105 uint32_t manc, err; 5271 uint32_t err;
5106 5272
5107 pci_set_power_state(pdev, PCI_D0); 5273 pci_set_power_state(pdev, PCI_D0);
5108 e1000_pci_restore_state(adapter); 5274 e1000_pci_restore_state(adapter);
@@ -5122,19 +5288,13 @@ e1000_resume(struct pci_dev *pdev)
5122 e1000_reset(adapter); 5288 e1000_reset(adapter);
5123 E1000_WRITE_REG(&adapter->hw, WUS, ~0); 5289 E1000_WRITE_REG(&adapter->hw, WUS, ~0);
5124 5290
5291 e1000_init_manageability(adapter);
5292
5125 if (netif_running(netdev)) 5293 if (netif_running(netdev))
5126 e1000_up(adapter); 5294 e1000_up(adapter);
5127 5295
5128 netif_device_attach(netdev); 5296 netif_device_attach(netdev);
5129 5297
5130 if (adapter->hw.mac_type >= e1000_82540 &&
5131 adapter->hw.mac_type < e1000_82571 &&
5132 adapter->hw.media_type == e1000_media_type_copper) {
5133 manc = E1000_READ_REG(&adapter->hw, MANC);
5134 manc &= ~(E1000_MANC_ARP_EN);
5135 E1000_WRITE_REG(&adapter->hw, MANC, manc);
5136 }
5137
5138 /* If the controller is 82573 and f/w is AMT, do not set 5298 /* If the controller is 82573 and f/w is AMT, do not set
5139 * DRV_LOAD until the interface is up. For all other cases, 5299 * DRV_LOAD until the interface is up. For all other cases,
5140 * let the f/w know that the h/w is now under the control 5300 * let the f/w know that the h/w is now under the control
@@ -5235,7 +5395,8 @@ static void e1000_io_resume(struct pci_dev *pdev)
5235{ 5395{
5236 struct net_device *netdev = pci_get_drvdata(pdev); 5396 struct net_device *netdev = pci_get_drvdata(pdev);
5237 struct e1000_adapter *adapter = netdev->priv; 5397 struct e1000_adapter *adapter = netdev->priv;
5238 uint32_t manc, swsm; 5398
5399 e1000_init_manageability(adapter);
5239 5400
5240 if (netif_running(netdev)) { 5401 if (netif_running(netdev)) {
5241 if (e1000_up(adapter)) { 5402 if (e1000_up(adapter)) {
@@ -5246,26 +5407,14 @@ static void e1000_io_resume(struct pci_dev *pdev)
5246 5407
5247 netif_device_attach(netdev); 5408 netif_device_attach(netdev);
5248 5409
5249 if (adapter->hw.mac_type >= e1000_82540 && 5410 /* If the controller is 82573 and f/w is AMT, do not set
5250 adapter->hw.mac_type < e1000_82571 && 5411 * DRV_LOAD until the interface is up. For all other cases,
5251 adapter->hw.media_type == e1000_media_type_copper) { 5412 * let the f/w know that the h/w is now under the control
5252 manc = E1000_READ_REG(&adapter->hw, MANC); 5413 * of the driver. */
5253 manc &= ~(E1000_MANC_ARP_EN); 5414 if (adapter->hw.mac_type != e1000_82573 ||
5254 E1000_WRITE_REG(&adapter->hw, MANC, manc); 5415 !e1000_check_mng_mode(&adapter->hw))
5255 } 5416 e1000_get_hw_control(adapter);
5256
5257 switch (adapter->hw.mac_type) {
5258 case e1000_82573:
5259 swsm = E1000_READ_REG(&adapter->hw, SWSM);
5260 E1000_WRITE_REG(&adapter->hw, SWSM,
5261 swsm | E1000_SWSM_DRV_LOAD);
5262 break;
5263 default:
5264 break;
5265 }
5266 5417
5267 if (netif_running(netdev))
5268 mod_timer(&adapter->watchdog_timer, jiffies);
5269} 5418}
5270 5419
5271/* e1000_main.c */ 5420/* e1000_main.c */
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index cbfcd7f2889f..cf2a279307e1 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -487,7 +487,9 @@ e1000_check_options(struct e1000_adapter *adapter)
487 e1000_validate_option(&adapter->itr, &opt, 487 e1000_validate_option(&adapter->itr, &opt,
488 adapter); 488 adapter);
489 /* save the setting, because the dynamic bits change itr */ 489 /* save the setting, because the dynamic bits change itr */
490 adapter->itr_setting = adapter->itr; 490 /* clear the lower two bits because they are
491 * used as control */
492 adapter->itr_setting = adapter->itr & ~3;
491 break; 493 break;
492 } 494 }
493 } else { 495 } else {