diff options
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 297 |
1 files changed, 151 insertions, 146 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index edb71e1bc43a..d03eef96c0ba 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -1634,34 +1634,35 @@ static void ixgbe_check_overtemp_task(struct work_struct *work) | |||
1634 | struct ixgbe_hw *hw = &adapter->hw; | 1634 | struct ixgbe_hw *hw = &adapter->hw; |
1635 | u32 eicr = adapter->interrupt_event; | 1635 | u32 eicr = adapter->interrupt_event; |
1636 | 1636 | ||
1637 | if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) { | 1637 | if (!(adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE)) |
1638 | switch (hw->device_id) { | 1638 | return; |
1639 | case IXGBE_DEV_ID_82599_T3_LOM: { | 1639 | |
1640 | u32 autoneg; | 1640 | switch (hw->device_id) { |
1641 | bool link_up = false; | 1641 | case IXGBE_DEV_ID_82599_T3_LOM: { |
1642 | 1642 | u32 autoneg; | |
1643 | if (hw->mac.ops.check_link) | 1643 | bool link_up = false; |
1644 | hw->mac.ops.check_link(hw, &autoneg, &link_up, false); | 1644 | |
1645 | 1645 | if (hw->mac.ops.check_link) | |
1646 | if (((eicr & IXGBE_EICR_GPI_SDP0) && (!link_up)) || | 1646 | hw->mac.ops.check_link(hw, &autoneg, &link_up, false); |
1647 | (eicr & IXGBE_EICR_LSC)) | 1647 | |
1648 | /* Check if this is due to overtemp */ | 1648 | if (((eicr & IXGBE_EICR_GPI_SDP0) && (!link_up)) || |
1649 | if (hw->phy.ops.check_overtemp(hw) == IXGBE_ERR_OVERTEMP) | 1649 | (eicr & IXGBE_EICR_LSC)) |
1650 | break; | 1650 | /* Check if this is due to overtemp */ |
1651 | } | 1651 | if (hw->phy.ops.check_overtemp(hw) == IXGBE_ERR_OVERTEMP) |
1652 | break; | ||
1653 | return; | ||
1654 | } | ||
1655 | default: | ||
1656 | if (!(eicr & IXGBE_EICR_GPI_SDP0)) | ||
1652 | return; | 1657 | return; |
1653 | default: | 1658 | break; |
1654 | if (!(eicr & IXGBE_EICR_GPI_SDP0)) | ||
1655 | return; | ||
1656 | break; | ||
1657 | } | ||
1658 | e_crit(drv, "Network adapter has been stopped because it has " | ||
1659 | "over heated. Restart the computer. If the problem " | ||
1660 | "persists, power off the system and replace the " | ||
1661 | "adapter\n"); | ||
1662 | /* write to clear the interrupt */ | ||
1663 | IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP0); | ||
1664 | } | 1659 | } |
1660 | e_crit(drv, | ||
1661 | "Network adapter has been stopped because it has over heated. " | ||
1662 | "Restart the computer. If the problem persists, " | ||
1663 | "power off the system and replace the adapter\n"); | ||
1664 | /* write to clear the interrupt */ | ||
1665 | IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP0); | ||
1665 | } | 1666 | } |
1666 | 1667 | ||
1667 | static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr) | 1668 | static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr) |
@@ -5396,6 +5397,7 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) | |||
5396 | u64 total_mpc = 0; | 5397 | u64 total_mpc = 0; |
5397 | u32 i, missed_rx = 0, mpc, bprc, lxon, lxoff, xon_off_tot; | 5398 | u32 i, missed_rx = 0, mpc, bprc, lxon, lxoff, xon_off_tot; |
5398 | u64 non_eop_descs = 0, restart_queue = 0; | 5399 | u64 non_eop_descs = 0, restart_queue = 0; |
5400 | struct ixgbe_hw_stats *hwstats = &adapter->stats; | ||
5399 | 5401 | ||
5400 | if (test_bit(__IXGBE_DOWN, &adapter->state) || | 5402 | if (test_bit(__IXGBE_DOWN, &adapter->state) || |
5401 | test_bit(__IXGBE_RESETTING, &adapter->state)) | 5403 | test_bit(__IXGBE_RESETTING, &adapter->state)) |
@@ -5406,7 +5408,7 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) | |||
5406 | u64 rsc_flush = 0; | 5408 | u64 rsc_flush = 0; |
5407 | for (i = 0; i < 16; i++) | 5409 | for (i = 0; i < 16; i++) |
5408 | adapter->hw_rx_no_dma_resources += | 5410 | adapter->hw_rx_no_dma_resources += |
5409 | IXGBE_READ_REG(hw, IXGBE_QPRDC(i)); | 5411 | IXGBE_READ_REG(hw, IXGBE_QPRDC(i)); |
5410 | for (i = 0; i < adapter->num_rx_queues; i++) { | 5412 | for (i = 0; i < adapter->num_rx_queues; i++) { |
5411 | rsc_count += adapter->rx_ring[i]->rsc_count; | 5413 | rsc_count += adapter->rx_ring[i]->rsc_count; |
5412 | rsc_flush += adapter->rx_ring[i]->rsc_flush; | 5414 | rsc_flush += adapter->rx_ring[i]->rsc_flush; |
@@ -5424,121 +5426,118 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) | |||
5424 | non_eop_descs += adapter->rx_ring[i]->non_eop_descs; | 5426 | non_eop_descs += adapter->rx_ring[i]->non_eop_descs; |
5425 | adapter->non_eop_descs = non_eop_descs; | 5427 | adapter->non_eop_descs = non_eop_descs; |
5426 | 5428 | ||
5427 | adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); | 5429 | hwstats->crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); |
5428 | for (i = 0; i < 8; i++) { | 5430 | for (i = 0; i < 8; i++) { |
5429 | /* for packet buffers not used, the register should read 0 */ | 5431 | /* for packet buffers not used, the register should read 0 */ |
5430 | mpc = IXGBE_READ_REG(hw, IXGBE_MPC(i)); | 5432 | mpc = IXGBE_READ_REG(hw, IXGBE_MPC(i)); |
5431 | missed_rx += mpc; | 5433 | missed_rx += mpc; |
5432 | adapter->stats.mpc[i] += mpc; | 5434 | hwstats->mpc[i] += mpc; |
5433 | total_mpc += adapter->stats.mpc[i]; | 5435 | total_mpc += hwstats->mpc[i]; |
5434 | if (hw->mac.type == ixgbe_mac_82598EB) | 5436 | if (hw->mac.type == ixgbe_mac_82598EB) |
5435 | adapter->stats.rnbc[i] += IXGBE_READ_REG(hw, IXGBE_RNBC(i)); | 5437 | hwstats->rnbc[i] += IXGBE_READ_REG(hw, IXGBE_RNBC(i)); |
5436 | adapter->stats.qptc[i] += IXGBE_READ_REG(hw, IXGBE_QPTC(i)); | 5438 | hwstats->qptc[i] += IXGBE_READ_REG(hw, IXGBE_QPTC(i)); |
5437 | adapter->stats.qbtc[i] += IXGBE_READ_REG(hw, IXGBE_QBTC(i)); | 5439 | hwstats->qbtc[i] += IXGBE_READ_REG(hw, IXGBE_QBTC(i)); |
5438 | adapter->stats.qprc[i] += IXGBE_READ_REG(hw, IXGBE_QPRC(i)); | 5440 | hwstats->qprc[i] += IXGBE_READ_REG(hw, IXGBE_QPRC(i)); |
5439 | adapter->stats.qbrc[i] += IXGBE_READ_REG(hw, IXGBE_QBRC(i)); | 5441 | hwstats->qbrc[i] += IXGBE_READ_REG(hw, IXGBE_QBRC(i)); |
5440 | if (hw->mac.type == ixgbe_mac_82599EB) { | 5442 | if (hw->mac.type == ixgbe_mac_82599EB) { |
5441 | adapter->stats.pxonrxc[i] += IXGBE_READ_REG(hw, | 5443 | hwstats->pxonrxc[i] += |
5442 | IXGBE_PXONRXCNT(i)); | 5444 | IXGBE_READ_REG(hw, IXGBE_PXONRXCNT(i)); |
5443 | adapter->stats.pxoffrxc[i] += IXGBE_READ_REG(hw, | 5445 | hwstats->pxoffrxc[i] += |
5444 | IXGBE_PXOFFRXCNT(i)); | 5446 | IXGBE_READ_REG(hw, IXGBE_PXOFFRXCNT(i)); |
5445 | adapter->stats.qprdc[i] += IXGBE_READ_REG(hw, IXGBE_QPRDC(i)); | 5447 | hwstats->qprdc[i] += IXGBE_READ_REG(hw, IXGBE_QPRDC(i)); |
5446 | } else { | 5448 | } else { |
5447 | adapter->stats.pxonrxc[i] += IXGBE_READ_REG(hw, | 5449 | hwstats->pxonrxc[i] += |
5448 | IXGBE_PXONRXC(i)); | 5450 | IXGBE_READ_REG(hw, IXGBE_PXONRXC(i)); |
5449 | adapter->stats.pxoffrxc[i] += IXGBE_READ_REG(hw, | 5451 | hwstats->pxoffrxc[i] += |
5450 | IXGBE_PXOFFRXC(i)); | 5452 | IXGBE_READ_REG(hw, IXGBE_PXOFFRXC(i)); |
5451 | } | 5453 | } |
5452 | adapter->stats.pxontxc[i] += IXGBE_READ_REG(hw, | 5454 | hwstats->pxontxc[i] += IXGBE_READ_REG(hw, IXGBE_PXONTXC(i)); |
5453 | IXGBE_PXONTXC(i)); | 5455 | hwstats->pxofftxc[i] += IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(i)); |
5454 | adapter->stats.pxofftxc[i] += IXGBE_READ_REG(hw, | ||
5455 | IXGBE_PXOFFTXC(i)); | ||
5456 | } | 5456 | } |
5457 | adapter->stats.gprc += IXGBE_READ_REG(hw, IXGBE_GPRC); | 5457 | hwstats->gprc += IXGBE_READ_REG(hw, IXGBE_GPRC); |
5458 | /* work around hardware counting issue */ | 5458 | /* work around hardware counting issue */ |
5459 | adapter->stats.gprc -= missed_rx; | 5459 | hwstats->gprc -= missed_rx; |
5460 | 5460 | ||
5461 | /* 82598 hardware only has a 32 bit counter in the high register */ | 5461 | /* 82598 hardware only has a 32 bit counter in the high register */ |
5462 | if (hw->mac.type == ixgbe_mac_82599EB) { | 5462 | if (hw->mac.type == ixgbe_mac_82599EB) { |
5463 | u64 tmp; | 5463 | u64 tmp; |
5464 | adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCL); | 5464 | hwstats->gorc += IXGBE_READ_REG(hw, IXGBE_GORCL); |
5465 | tmp = IXGBE_READ_REG(hw, IXGBE_GORCH) & 0xF; | 5465 | tmp = IXGBE_READ_REG(hw, IXGBE_GORCH) & 0xF; |
5466 | /* 4 high bits of GORC */ | 5466 | /* 4 high bits of GORC */ |
5467 | adapter->stats.gorc += (tmp << 32); | 5467 | hwstats->gorc += (tmp << 32); |
5468 | adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCL); | 5468 | hwstats->gotc += IXGBE_READ_REG(hw, IXGBE_GOTCL); |
5469 | tmp = IXGBE_READ_REG(hw, IXGBE_GOTCH) & 0xF; | 5469 | tmp = IXGBE_READ_REG(hw, IXGBE_GOTCH) & 0xF; |
5470 | /* 4 high bits of GOTC */ | 5470 | /* 4 high bits of GOTC */ |
5471 | adapter->stats.gotc += (tmp << 32); | 5471 | hwstats->gotc += (tmp << 32); |
5472 | adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORL); | 5472 | hwstats->tor += IXGBE_READ_REG(hw, IXGBE_TORL); |
5473 | IXGBE_READ_REG(hw, IXGBE_TORH); /* to clear */ | 5473 | IXGBE_READ_REG(hw, IXGBE_TORH); /* to clear */ |
5474 | adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); | 5474 | hwstats->lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); |
5475 | adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); | 5475 | hwstats->lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); |
5476 | adapter->stats.fdirmatch += IXGBE_READ_REG(hw, IXGBE_FDIRMATCH); | 5476 | hwstats->fdirmatch += IXGBE_READ_REG(hw, IXGBE_FDIRMATCH); |
5477 | adapter->stats.fdirmiss += IXGBE_READ_REG(hw, IXGBE_FDIRMISS); | 5477 | hwstats->fdirmiss += IXGBE_READ_REG(hw, IXGBE_FDIRMISS); |
5478 | #ifdef IXGBE_FCOE | 5478 | #ifdef IXGBE_FCOE |
5479 | adapter->stats.fccrc += IXGBE_READ_REG(hw, IXGBE_FCCRC); | 5479 | hwstats->fccrc += IXGBE_READ_REG(hw, IXGBE_FCCRC); |
5480 | adapter->stats.fcoerpdc += IXGBE_READ_REG(hw, IXGBE_FCOERPDC); | 5480 | hwstats->fcoerpdc += IXGBE_READ_REG(hw, IXGBE_FCOERPDC); |
5481 | adapter->stats.fcoeprc += IXGBE_READ_REG(hw, IXGBE_FCOEPRC); | 5481 | hwstats->fcoeprc += IXGBE_READ_REG(hw, IXGBE_FCOEPRC); |
5482 | adapter->stats.fcoeptc += IXGBE_READ_REG(hw, IXGBE_FCOEPTC); | 5482 | hwstats->fcoeptc += IXGBE_READ_REG(hw, IXGBE_FCOEPTC); |
5483 | adapter->stats.fcoedwrc += IXGBE_READ_REG(hw, IXGBE_FCOEDWRC); | 5483 | hwstats->fcoedwrc += IXGBE_READ_REG(hw, IXGBE_FCOEDWRC); |
5484 | adapter->stats.fcoedwtc += IXGBE_READ_REG(hw, IXGBE_FCOEDWTC); | 5484 | hwstats->fcoedwtc += IXGBE_READ_REG(hw, IXGBE_FCOEDWTC); |
5485 | #endif /* IXGBE_FCOE */ | 5485 | #endif /* IXGBE_FCOE */ |
5486 | } else { | 5486 | } else { |
5487 | adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXC); | 5487 | hwstats->lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXC); |
5488 | adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); | 5488 | hwstats->lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); |
5489 | adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCH); | 5489 | hwstats->gorc += IXGBE_READ_REG(hw, IXGBE_GORCH); |
5490 | adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCH); | 5490 | hwstats->gotc += IXGBE_READ_REG(hw, IXGBE_GOTCH); |
5491 | adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORH); | 5491 | hwstats->tor += IXGBE_READ_REG(hw, IXGBE_TORH); |
5492 | } | 5492 | } |
5493 | bprc = IXGBE_READ_REG(hw, IXGBE_BPRC); | 5493 | bprc = IXGBE_READ_REG(hw, IXGBE_BPRC); |
5494 | adapter->stats.bprc += bprc; | 5494 | hwstats->bprc += bprc; |
5495 | adapter->stats.mprc += IXGBE_READ_REG(hw, IXGBE_MPRC); | 5495 | hwstats->mprc += IXGBE_READ_REG(hw, IXGBE_MPRC); |
5496 | if (hw->mac.type == ixgbe_mac_82598EB) | 5496 | if (hw->mac.type == ixgbe_mac_82598EB) |
5497 | adapter->stats.mprc -= bprc; | 5497 | hwstats->mprc -= bprc; |
5498 | adapter->stats.roc += IXGBE_READ_REG(hw, IXGBE_ROC); | 5498 | hwstats->roc += IXGBE_READ_REG(hw, IXGBE_ROC); |
5499 | adapter->stats.prc64 += IXGBE_READ_REG(hw, IXGBE_PRC64); | 5499 | hwstats->prc64 += IXGBE_READ_REG(hw, IXGBE_PRC64); |
5500 | adapter->stats.prc127 += IXGBE_READ_REG(hw, IXGBE_PRC127); | 5500 | hwstats->prc127 += IXGBE_READ_REG(hw, IXGBE_PRC127); |
5501 | adapter->stats.prc255 += IXGBE_READ_REG(hw, IXGBE_PRC255); | 5501 | hwstats->prc255 += IXGBE_READ_REG(hw, IXGBE_PRC255); |
5502 | adapter->stats.prc511 += IXGBE_READ_REG(hw, IXGBE_PRC511); | 5502 | hwstats->prc511 += IXGBE_READ_REG(hw, IXGBE_PRC511); |
5503 | adapter->stats.prc1023 += IXGBE_READ_REG(hw, IXGBE_PRC1023); | 5503 | hwstats->prc1023 += IXGBE_READ_REG(hw, IXGBE_PRC1023); |
5504 | adapter->stats.prc1522 += IXGBE_READ_REG(hw, IXGBE_PRC1522); | 5504 | hwstats->prc1522 += IXGBE_READ_REG(hw, IXGBE_PRC1522); |
5505 | adapter->stats.rlec += IXGBE_READ_REG(hw, IXGBE_RLEC); | 5505 | hwstats->rlec += IXGBE_READ_REG(hw, IXGBE_RLEC); |
5506 | lxon = IXGBE_READ_REG(hw, IXGBE_LXONTXC); | 5506 | lxon = IXGBE_READ_REG(hw, IXGBE_LXONTXC); |
5507 | adapter->stats.lxontxc += lxon; | 5507 | hwstats->lxontxc += lxon; |
5508 | lxoff = IXGBE_READ_REG(hw, IXGBE_LXOFFTXC); | 5508 | lxoff = IXGBE_READ_REG(hw, IXGBE_LXOFFTXC); |
5509 | adapter->stats.lxofftxc += lxoff; | 5509 | hwstats->lxofftxc += lxoff; |
5510 | adapter->stats.ruc += IXGBE_READ_REG(hw, IXGBE_RUC); | 5510 | hwstats->ruc += IXGBE_READ_REG(hw, IXGBE_RUC); |
5511 | adapter->stats.gptc += IXGBE_READ_REG(hw, IXGBE_GPTC); | 5511 | hwstats->gptc += IXGBE_READ_REG(hw, IXGBE_GPTC); |
5512 | adapter->stats.mptc += IXGBE_READ_REG(hw, IXGBE_MPTC); | 5512 | hwstats->mptc += IXGBE_READ_REG(hw, IXGBE_MPTC); |
5513 | /* | 5513 | /* |
5514 | * 82598 errata - tx of flow control packets is included in tx counters | 5514 | * 82598 errata - tx of flow control packets is included in tx counters |
5515 | */ | 5515 | */ |
5516 | xon_off_tot = lxon + lxoff; | 5516 | xon_off_tot = lxon + lxoff; |
5517 | adapter->stats.gptc -= xon_off_tot; | 5517 | hwstats->gptc -= xon_off_tot; |
5518 | adapter->stats.mptc -= xon_off_tot; | 5518 | hwstats->mptc -= xon_off_tot; |
5519 | adapter->stats.gotc -= (xon_off_tot * (ETH_ZLEN + ETH_FCS_LEN)); | 5519 | hwstats->gotc -= (xon_off_tot * (ETH_ZLEN + ETH_FCS_LEN)); |
5520 | adapter->stats.ruc += IXGBE_READ_REG(hw, IXGBE_RUC); | 5520 | hwstats->ruc += IXGBE_READ_REG(hw, IXGBE_RUC); |
5521 | adapter->stats.rfc += IXGBE_READ_REG(hw, IXGBE_RFC); | 5521 | hwstats->rfc += IXGBE_READ_REG(hw, IXGBE_RFC); |
5522 | adapter->stats.rjc += IXGBE_READ_REG(hw, IXGBE_RJC); | 5522 | hwstats->rjc += IXGBE_READ_REG(hw, IXGBE_RJC); |
5523 | adapter->stats.tpr += IXGBE_READ_REG(hw, IXGBE_TPR); | 5523 | hwstats->tpr += IXGBE_READ_REG(hw, IXGBE_TPR); |
5524 | adapter->stats.ptc64 += IXGBE_READ_REG(hw, IXGBE_PTC64); | 5524 | hwstats->ptc64 += IXGBE_READ_REG(hw, IXGBE_PTC64); |
5525 | adapter->stats.ptc64 -= xon_off_tot; | 5525 | hwstats->ptc64 -= xon_off_tot; |
5526 | adapter->stats.ptc127 += IXGBE_READ_REG(hw, IXGBE_PTC127); | 5526 | hwstats->ptc127 += IXGBE_READ_REG(hw, IXGBE_PTC127); |
5527 | adapter->stats.ptc255 += IXGBE_READ_REG(hw, IXGBE_PTC255); | 5527 | hwstats->ptc255 += IXGBE_READ_REG(hw, IXGBE_PTC255); |
5528 | adapter->stats.ptc511 += IXGBE_READ_REG(hw, IXGBE_PTC511); | 5528 | hwstats->ptc511 += IXGBE_READ_REG(hw, IXGBE_PTC511); |
5529 | adapter->stats.ptc1023 += IXGBE_READ_REG(hw, IXGBE_PTC1023); | 5529 | hwstats->ptc1023 += IXGBE_READ_REG(hw, IXGBE_PTC1023); |
5530 | adapter->stats.ptc1522 += IXGBE_READ_REG(hw, IXGBE_PTC1522); | 5530 | hwstats->ptc1522 += IXGBE_READ_REG(hw, IXGBE_PTC1522); |
5531 | adapter->stats.bptc += IXGBE_READ_REG(hw, IXGBE_BPTC); | 5531 | hwstats->bptc += IXGBE_READ_REG(hw, IXGBE_BPTC); |
5532 | 5532 | ||
5533 | /* Fill out the OS statistics structure */ | 5533 | /* Fill out the OS statistics structure */ |
5534 | netdev->stats.multicast = adapter->stats.mprc; | 5534 | netdev->stats.multicast = hwstats->mprc; |
5535 | 5535 | ||
5536 | /* Rx Errors */ | 5536 | /* Rx Errors */ |
5537 | netdev->stats.rx_errors = adapter->stats.crcerrs + | 5537 | netdev->stats.rx_errors = hwstats->crcerrs + hwstats->rlec; |
5538 | adapter->stats.rlec; | ||
5539 | netdev->stats.rx_dropped = 0; | 5538 | netdev->stats.rx_dropped = 0; |
5540 | netdev->stats.rx_length_errors = adapter->stats.rlec; | 5539 | netdev->stats.rx_length_errors = hwstats->rlec; |
5541 | netdev->stats.rx_crc_errors = adapter->stats.crcerrs; | 5540 | netdev->stats.rx_crc_errors = hwstats->crcerrs; |
5542 | netdev->stats.rx_missed_errors = total_mpc; | 5541 | netdev->stats.rx_missed_errors = total_mpc; |
5543 | } | 5542 | } |
5544 | 5543 | ||
@@ -5868,6 +5867,50 @@ static int ixgbe_tso(struct ixgbe_adapter *adapter, | |||
5868 | return false; | 5867 | return false; |
5869 | } | 5868 | } |
5870 | 5869 | ||
5870 | static u32 ixgbe_psum(struct ixgbe_adapter *adapter, struct sk_buff *skb) | ||
5871 | { | ||
5872 | u32 rtn = 0; | ||
5873 | __be16 protocol; | ||
5874 | |||
5875 | if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) | ||
5876 | protocol = ((const struct vlan_ethhdr *)skb->data)-> | ||
5877 | h_vlan_encapsulated_proto; | ||
5878 | else | ||
5879 | protocol = skb->protocol; | ||
5880 | |||
5881 | switch (protocol) { | ||
5882 | case cpu_to_be16(ETH_P_IP): | ||
5883 | rtn |= IXGBE_ADVTXD_TUCMD_IPV4; | ||
5884 | switch (ip_hdr(skb)->protocol) { | ||
5885 | case IPPROTO_TCP: | ||
5886 | rtn |= IXGBE_ADVTXD_TUCMD_L4T_TCP; | ||
5887 | break; | ||
5888 | case IPPROTO_SCTP: | ||
5889 | rtn |= IXGBE_ADVTXD_TUCMD_L4T_SCTP; | ||
5890 | break; | ||
5891 | } | ||
5892 | break; | ||
5893 | case cpu_to_be16(ETH_P_IPV6): | ||
5894 | /* XXX what about other V6 headers?? */ | ||
5895 | switch (ipv6_hdr(skb)->nexthdr) { | ||
5896 | case IPPROTO_TCP: | ||
5897 | rtn |= IXGBE_ADVTXD_TUCMD_L4T_TCP; | ||
5898 | break; | ||
5899 | case IPPROTO_SCTP: | ||
5900 | rtn |= IXGBE_ADVTXD_TUCMD_L4T_SCTP; | ||
5901 | break; | ||
5902 | } | ||
5903 | break; | ||
5904 | default: | ||
5905 | if (unlikely(net_ratelimit())) | ||
5906 | e_warn(probe, "partial checksum but proto=%x!\n", | ||
5907 | skb->protocol); | ||
5908 | break; | ||
5909 | } | ||
5910 | |||
5911 | return rtn; | ||
5912 | } | ||
5913 | |||
5871 | static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter, | 5914 | static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter, |
5872 | struct ixgbe_ring *tx_ring, | 5915 | struct ixgbe_ring *tx_ring, |
5873 | struct sk_buff *skb, u32 tx_flags) | 5916 | struct sk_buff *skb, u32 tx_flags) |
@@ -5898,46 +5941,8 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter, | |||
5898 | type_tucmd_mlhl |= (IXGBE_TXD_CMD_DEXT | | 5941 | type_tucmd_mlhl |= (IXGBE_TXD_CMD_DEXT | |
5899 | IXGBE_ADVTXD_DTYP_CTXT); | 5942 | IXGBE_ADVTXD_DTYP_CTXT); |
5900 | 5943 | ||
5901 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 5944 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
5902 | __be16 protocol; | 5945 | type_tucmd_mlhl |= ixgbe_psum(adapter, skb); |
5903 | |||
5904 | if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) { | ||
5905 | const struct vlan_ethhdr *vhdr = | ||
5906 | (const struct vlan_ethhdr *)skb->data; | ||
5907 | |||
5908 | protocol = vhdr->h_vlan_encapsulated_proto; | ||
5909 | } else { | ||
5910 | protocol = skb->protocol; | ||
5911 | } | ||
5912 | |||
5913 | switch (protocol) { | ||
5914 | case cpu_to_be16(ETH_P_IP): | ||
5915 | type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4; | ||
5916 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) | ||
5917 | type_tucmd_mlhl |= | ||
5918 | IXGBE_ADVTXD_TUCMD_L4T_TCP; | ||
5919 | else if (ip_hdr(skb)->protocol == IPPROTO_SCTP) | ||
5920 | type_tucmd_mlhl |= | ||
5921 | IXGBE_ADVTXD_TUCMD_L4T_SCTP; | ||
5922 | break; | ||
5923 | case cpu_to_be16(ETH_P_IPV6): | ||
5924 | /* XXX what about other V6 headers?? */ | ||
5925 | if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP) | ||
5926 | type_tucmd_mlhl |= | ||
5927 | IXGBE_ADVTXD_TUCMD_L4T_TCP; | ||
5928 | else if (ipv6_hdr(skb)->nexthdr == IPPROTO_SCTP) | ||
5929 | type_tucmd_mlhl |= | ||
5930 | IXGBE_ADVTXD_TUCMD_L4T_SCTP; | ||
5931 | break; | ||
5932 | default: | ||
5933 | if (unlikely(net_ratelimit())) { | ||
5934 | e_warn(probe, "partial checksum " | ||
5935 | "but proto=%x!\n", | ||
5936 | skb->protocol); | ||
5937 | } | ||
5938 | break; | ||
5939 | } | ||
5940 | } | ||
5941 | 5946 | ||
5942 | context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd_mlhl); | 5947 | context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd_mlhl); |
5943 | /* use index zero for tx checksum offload */ | 5948 | /* use index zero for tx checksum offload */ |