.. | .. |
---|
28 | 28 | |
---|
29 | 29 | #include "e1000.h" |
---|
30 | 30 | |
---|
31 | | -#define DRV_EXTRAVERSION "-k" |
---|
32 | | - |
---|
33 | | -#define DRV_VERSION "3.2.6" DRV_EXTRAVERSION |
---|
34 | 31 | char e1000e_driver_name[] = "e1000e"; |
---|
35 | | -const char e1000e_driver_version[] = DRV_VERSION; |
---|
36 | 32 | |
---|
37 | 33 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) |
---|
38 | 34 | static int debug = -1; |
---|
.. | .. |
---|
54 | 50 | [board_pch_lpt] = &e1000_pch_lpt_info, |
---|
55 | 51 | [board_pch_spt] = &e1000_pch_spt_info, |
---|
56 | 52 | [board_pch_cnp] = &e1000_pch_cnp_info, |
---|
| 53 | + [board_pch_tgp] = &e1000_pch_tgp_info, |
---|
57 | 54 | }; |
---|
58 | 55 | |
---|
59 | 56 | struct e1000_reg_info { |
---|
.. | .. |
---|
466 | 463 | |
---|
467 | 464 | /** |
---|
468 | 465 | * e1000_desc_unused - calculate if we have unused descriptors |
---|
| 466 | + * @ring: pointer to ring struct to perform calculation on |
---|
469 | 467 | **/ |
---|
470 | 468 | static int e1000_desc_unused(struct e1000_ring *ring) |
---|
471 | 469 | { |
---|
.. | .. |
---|
542 | 540 | /** |
---|
543 | 541 | * e1000_receive_skb - helper function to handle Rx indications |
---|
544 | 542 | * @adapter: board private structure |
---|
| 543 | + * @netdev: pointer to netdev struct |
---|
545 | 544 | * @staterr: descriptor extended error and status field as written by hardware |
---|
546 | 545 | * @vlan: descriptor vlan field as written by hardware (no le/be conversion) |
---|
547 | 546 | * @skb: pointer to sk_buff to be indicated to stack |
---|
.. | .. |
---|
566 | 565 | * e1000_rx_checksum - Receive Checksum Offload |
---|
567 | 566 | * @adapter: board private structure |
---|
568 | 567 | * @status_err: receive descriptor status and error fields |
---|
569 | | - * @csum: receive descriptor csum field |
---|
570 | | - * @sk_buff: socket buffer with received data |
---|
| 568 | + * @skb: socket buffer with received data |
---|
571 | 569 | **/ |
---|
572 | 570 | static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, |
---|
573 | 571 | struct sk_buff *skb) |
---|
.. | .. |
---|
638 | 636 | /** |
---|
639 | 637 | * e1000_alloc_rx_buffers - Replace used receive buffers |
---|
640 | 638 | * @rx_ring: Rx descriptor ring |
---|
| 639 | + * @cleaned_count: number to reallocate |
---|
| 640 | + * @gfp: flags for allocation |
---|
641 | 641 | **/ |
---|
642 | 642 | static void e1000_alloc_rx_buffers(struct e1000_ring *rx_ring, |
---|
643 | 643 | int cleaned_count, gfp_t gfp) |
---|
.. | .. |
---|
706 | 706 | /** |
---|
707 | 707 | * e1000_alloc_rx_buffers_ps - Replace used receive buffers; packet split |
---|
708 | 708 | * @rx_ring: Rx descriptor ring |
---|
| 709 | + * @cleaned_count: number to reallocate |
---|
| 710 | + * @gfp: flags for allocation |
---|
709 | 711 | **/ |
---|
710 | 712 | static void e1000_alloc_rx_buffers_ps(struct e1000_ring *rx_ring, |
---|
711 | 713 | int cleaned_count, gfp_t gfp) |
---|
.. | .. |
---|
809 | 811 | * e1000_alloc_jumbo_rx_buffers - Replace used jumbo receive buffers |
---|
810 | 812 | * @rx_ring: Rx descriptor ring |
---|
811 | 813 | * @cleaned_count: number of buffers to allocate this pass |
---|
| 814 | + * @gfp: flags for allocation |
---|
812 | 815 | **/ |
---|
813 | 816 | |
---|
814 | 817 | static void e1000_alloc_jumbo_rx_buffers(struct e1000_ring *rx_ring, |
---|
.. | .. |
---|
898 | 901 | /** |
---|
899 | 902 | * e1000_clean_rx_irq - Send received data up the network stack |
---|
900 | 903 | * @rx_ring: Rx descriptor ring |
---|
| 904 | + * @work_done: output parameter for indicating completed work |
---|
| 905 | + * @work_to_do: how many packets we can clean |
---|
901 | 906 | * |
---|
902 | 907 | * the return value indicates whether actual cleaning was done, there |
---|
903 | 908 | * is no guarantee that everything was cleaned |
---|
.. | .. |
---|
1292 | 1297 | /** |
---|
1293 | 1298 | * e1000_clean_rx_irq_ps - Send received data up the network stack; packet split |
---|
1294 | 1299 | * @rx_ring: Rx descriptor ring |
---|
| 1300 | + * @work_done: output parameter for indicating completed work |
---|
| 1301 | + * @work_to_do: how many packets we can clean |
---|
1295 | 1302 | * |
---|
1296 | 1303 | * the return value indicates whether actual cleaning was done, there |
---|
1297 | 1304 | * is no guarantee that everything was cleaned |
---|
.. | .. |
---|
1482 | 1489 | return cleaned; |
---|
1483 | 1490 | } |
---|
1484 | 1491 | |
---|
1485 | | -/** |
---|
1486 | | - * e1000_consume_page - helper function |
---|
1487 | | - **/ |
---|
1488 | 1492 | static void e1000_consume_page(struct e1000_buffer *bi, struct sk_buff *skb, |
---|
1489 | 1493 | u16 length) |
---|
1490 | 1494 | { |
---|
.. | .. |
---|
1496 | 1500 | |
---|
1497 | 1501 | /** |
---|
1498 | 1502 | * e1000_clean_jumbo_rx_irq - Send received data up the network stack; legacy |
---|
1499 | | - * @adapter: board private structure |
---|
| 1503 | + * @rx_ring: Rx descriptor ring |
---|
| 1504 | + * @work_done: output parameter for indicating completed work |
---|
| 1505 | + * @work_to_do: how many packets we can clean |
---|
1500 | 1506 | * |
---|
1501 | 1507 | * the return value indicates whether actual cleaning was done, there |
---|
1502 | 1508 | * is no guarantee that everything was cleaned |
---|
.. | .. |
---|
1959 | 1965 | |
---|
1960 | 1966 | /** |
---|
1961 | 1967 | * e1000_configure_msix - Configure MSI-X hardware |
---|
| 1968 | + * @adapter: board private structure |
---|
1962 | 1969 | * |
---|
1963 | 1970 | * e1000_configure_msix sets up the hardware to properly |
---|
1964 | 1971 | * generate MSI-X interrupts. |
---|
.. | .. |
---|
2037 | 2044 | |
---|
2038 | 2045 | /** |
---|
2039 | 2046 | * e1000e_set_interrupt_capability - set MSI or MSI-X if supported |
---|
| 2047 | + * @adapter: board private structure |
---|
2040 | 2048 | * |
---|
2041 | 2049 | * Attempt to configure interrupts using the best available |
---|
2042 | 2050 | * capabilities of the hardware and kernel. |
---|
.. | .. |
---|
2072 | 2080 | e1000e_reset_interrupt_capability(adapter); |
---|
2073 | 2081 | } |
---|
2074 | 2082 | adapter->int_mode = E1000E_INT_MODE_MSI; |
---|
2075 | | - /* Fall through */ |
---|
| 2083 | + fallthrough; |
---|
2076 | 2084 | case E1000E_INT_MODE_MSI: |
---|
2077 | 2085 | if (!pci_enable_msi(adapter->pdev)) { |
---|
2078 | 2086 | adapter->flags |= FLAG_MSI_ENABLED; |
---|
.. | .. |
---|
2080 | 2088 | adapter->int_mode = E1000E_INT_MODE_LEGACY; |
---|
2081 | 2089 | e_err("Failed to initialize MSI interrupts. Falling back to legacy interrupts.\n"); |
---|
2082 | 2090 | } |
---|
2083 | | - /* Fall through */ |
---|
| 2091 | + fallthrough; |
---|
2084 | 2092 | case E1000E_INT_MODE_LEGACY: |
---|
2085 | 2093 | /* Don't do anything; this is the system default */ |
---|
2086 | 2094 | break; |
---|
.. | .. |
---|
2092 | 2100 | |
---|
2093 | 2101 | /** |
---|
2094 | 2102 | * e1000_request_msix - Initialize MSI-X interrupts |
---|
| 2103 | + * @adapter: board private structure |
---|
2095 | 2104 | * |
---|
2096 | 2105 | * e1000_request_msix allocates MSI-X vectors and requests interrupts from the |
---|
2097 | 2106 | * kernel. |
---|
.. | .. |
---|
2145 | 2154 | |
---|
2146 | 2155 | /** |
---|
2147 | 2156 | * e1000_request_irq - initialize interrupts |
---|
| 2157 | + * @adapter: board private structure |
---|
2148 | 2158 | * |
---|
2149 | 2159 | * Attempts to configure interrupts using the best available |
---|
2150 | 2160 | * capabilities of the hardware and kernel. |
---|
.. | .. |
---|
2205 | 2215 | |
---|
2206 | 2216 | /** |
---|
2207 | 2217 | * e1000_irq_disable - Mask off interrupt generation on the NIC |
---|
| 2218 | + * @adapter: board private structure |
---|
2208 | 2219 | **/ |
---|
2209 | 2220 | static void e1000_irq_disable(struct e1000_adapter *adapter) |
---|
2210 | 2221 | { |
---|
.. | .. |
---|
2227 | 2238 | |
---|
2228 | 2239 | /** |
---|
2229 | 2240 | * e1000_irq_enable - Enable default interrupt generation settings |
---|
| 2241 | + * @adapter: board private structure |
---|
2230 | 2242 | **/ |
---|
2231 | 2243 | static void e1000_irq_enable(struct e1000_adapter *adapter) |
---|
2232 | 2244 | { |
---|
.. | .. |
---|
2297 | 2309 | |
---|
2298 | 2310 | /** |
---|
2299 | 2311 | * e1000_alloc_ring_dma - allocate memory for a ring structure |
---|
| 2312 | + * @adapter: board private structure |
---|
| 2313 | + * @ring: ring struct for which to allocate dma |
---|
2300 | 2314 | **/ |
---|
2301 | 2315 | static int e1000_alloc_ring_dma(struct e1000_adapter *adapter, |
---|
2302 | 2316 | struct e1000_ring *ring) |
---|
2303 | 2317 | { |
---|
2304 | 2318 | struct pci_dev *pdev = adapter->pdev; |
---|
2305 | 2319 | |
---|
2306 | | - ring->desc = dma_zalloc_coherent(&pdev->dev, ring->size, &ring->dma, |
---|
2307 | | - GFP_KERNEL); |
---|
| 2320 | + ring->desc = dma_alloc_coherent(&pdev->dev, ring->size, &ring->dma, |
---|
| 2321 | + GFP_KERNEL); |
---|
2308 | 2322 | if (!ring->desc) |
---|
2309 | 2323 | return -ENOMEM; |
---|
2310 | 2324 | |
---|
.. | .. |
---|
2472 | 2486 | |
---|
2473 | 2487 | /** |
---|
2474 | 2488 | * e1000_update_itr - update the dynamic ITR value based on statistics |
---|
2475 | | - * @adapter: pointer to adapter |
---|
2476 | 2489 | * @itr_setting: current adapter->itr |
---|
2477 | 2490 | * @packets: the number of packets during this measurement interval |
---|
2478 | 2491 | * @bytes: the number of bytes during this measurement interval |
---|
.. | .. |
---|
2649 | 2662 | /** |
---|
2650 | 2663 | * e1000e_poll - NAPI Rx polling callback |
---|
2651 | 2664 | * @napi: struct associated with this polling callback |
---|
2652 | | - * @weight: number of packets driver is allowed to process this poll |
---|
| 2665 | + * @budget: number of packets driver is allowed to process this poll |
---|
2653 | 2666 | **/ |
---|
2654 | | -static int e1000e_poll(struct napi_struct *napi, int weight) |
---|
| 2667 | +static int e1000e_poll(struct napi_struct *napi, int budget) |
---|
2655 | 2668 | { |
---|
2656 | 2669 | struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, |
---|
2657 | 2670 | napi); |
---|
.. | .. |
---|
2665 | 2678 | (adapter->rx_ring->ims_val & adapter->tx_ring->ims_val)) |
---|
2666 | 2679 | tx_cleaned = e1000_clean_tx_irq(adapter->tx_ring); |
---|
2667 | 2680 | |
---|
2668 | | - adapter->clean_rx(adapter->rx_ring, &work_done, weight); |
---|
| 2681 | + adapter->clean_rx(adapter->rx_ring, &work_done, budget); |
---|
2669 | 2682 | |
---|
2670 | | - if (!tx_cleaned) |
---|
2671 | | - work_done = weight; |
---|
| 2683 | + if (!tx_cleaned || work_done == budget) |
---|
| 2684 | + return budget; |
---|
2672 | 2685 | |
---|
2673 | | - /* If weight not fully consumed, exit the polling mode */ |
---|
2674 | | - if (work_done < weight) { |
---|
| 2686 | + /* Exit the polling mode, but don't re-enable interrupts if stack might |
---|
| 2687 | + * poll us due to busy-polling |
---|
| 2688 | + */ |
---|
| 2689 | + if (likely(napi_complete_done(napi, work_done))) { |
---|
2675 | 2690 | if (adapter->itr_setting & 3) |
---|
2676 | 2691 | e1000_set_itr(adapter); |
---|
2677 | | - napi_complete_done(napi, work_done); |
---|
2678 | 2692 | if (!test_bit(__E1000_DOWN, &adapter->state)) { |
---|
2679 | 2693 | if (adapter->msix_entries) |
---|
2680 | 2694 | ew32(IMS, adapter->rx_ring->ims_val); |
---|
.. | .. |
---|
3013 | 3027 | } |
---|
3014 | 3028 | } |
---|
3015 | 3029 | |
---|
| 3030 | +#define PAGE_USE_COUNT(S) (((S) >> PAGE_SHIFT) + \ |
---|
| 3031 | + (((S) & (PAGE_SIZE - 1)) ? 1 : 0)) |
---|
| 3032 | + |
---|
3016 | 3033 | /** |
---|
3017 | 3034 | * e1000_setup_rctl - configure the receive control registers |
---|
3018 | 3035 | * @adapter: Board private structure |
---|
3019 | 3036 | **/ |
---|
3020 | | -#define PAGE_USE_COUNT(S) (((S) >> PAGE_SHIFT) + \ |
---|
3021 | | - (((S) & (PAGE_SIZE - 1)) ? 1 : 0)) |
---|
3022 | 3037 | static void e1000_setup_rctl(struct e1000_adapter *adapter) |
---|
3023 | 3038 | { |
---|
3024 | 3039 | struct e1000_hw *hw = &adapter->hw; |
---|
.. | .. |
---|
3137 | 3152 | switch (adapter->rx_ps_pages) { |
---|
3138 | 3153 | case 3: |
---|
3139 | 3154 | psrctl |= PAGE_SIZE << E1000_PSRCTL_BSIZE3_SHIFT; |
---|
3140 | | - /* fall-through */ |
---|
| 3155 | + fallthrough; |
---|
3141 | 3156 | case 2: |
---|
3142 | 3157 | psrctl |= PAGE_SIZE << E1000_PSRCTL_BSIZE2_SHIFT; |
---|
3143 | | - /* fall-through */ |
---|
| 3158 | + fallthrough; |
---|
3144 | 3159 | case 1: |
---|
3145 | 3160 | psrctl |= PAGE_SIZE >> E1000_PSRCTL_BSIZE1_SHIFT; |
---|
3146 | 3161 | break; |
---|
.. | .. |
---|
3205 | 3220 | if (!(adapter->flags2 & FLAG2_NO_DISABLE_RX)) |
---|
3206 | 3221 | ew32(RCTL, rctl & ~E1000_RCTL_EN); |
---|
3207 | 3222 | e1e_flush(); |
---|
3208 | | - usleep_range(10000, 20000); |
---|
| 3223 | + usleep_range(10000, 11000); |
---|
3209 | 3224 | |
---|
3210 | 3225 | if (adapter->flags2 & FLAG2_DMA_BURST) { |
---|
3211 | 3226 | /* set the writeback threshold (only takes effect if the RDTR |
---|
.. | .. |
---|
3277 | 3292 | |
---|
3278 | 3293 | dev_info(&adapter->pdev->dev, |
---|
3279 | 3294 | "Some CPU C-states have been disabled in order to enable jumbo frames\n"); |
---|
3280 | | - pm_qos_update_request(&adapter->pm_qos_req, lat); |
---|
| 3295 | + cpu_latency_qos_update_request(&adapter->pm_qos_req, lat); |
---|
3281 | 3296 | } else { |
---|
3282 | | - pm_qos_update_request(&adapter->pm_qos_req, |
---|
3283 | | - PM_QOS_DEFAULT_VALUE); |
---|
| 3297 | + cpu_latency_qos_update_request(&adapter->pm_qos_req, |
---|
| 3298 | + PM_QOS_DEFAULT_VALUE); |
---|
3284 | 3299 | } |
---|
3285 | 3300 | |
---|
3286 | 3301 | /* Enable Receives */ |
---|
.. | .. |
---|
3532 | 3547 | adapter->cc.shift = shift; |
---|
3533 | 3548 | break; |
---|
3534 | 3549 | case e1000_pch_cnp: |
---|
| 3550 | + case e1000_pch_tgp: |
---|
| 3551 | + case e1000_pch_adp: |
---|
| 3552 | + case e1000_pch_mtp: |
---|
3535 | 3553 | if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI) { |
---|
3536 | 3554 | /* Stable 24MHz frequency */ |
---|
3537 | 3555 | incperiod = INCPERIOD_24MHZ; |
---|
.. | .. |
---|
3567 | 3585 | /** |
---|
3568 | 3586 | * e1000e_config_hwtstamp - configure the hwtstamp registers and enable/disable |
---|
3569 | 3587 | * @adapter: board private structure |
---|
| 3588 | + * @config: timestamp configuration |
---|
3570 | 3589 | * |
---|
3571 | 3590 | * Outgoing time stamping can be enabled and disabled. Play nice and |
---|
3572 | 3591 | * disable it when requested, although it shouldn't cause any overhead |
---|
.. | .. |
---|
3635 | 3654 | is_l2 = true; |
---|
3636 | 3655 | break; |
---|
3637 | 3656 | case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: |
---|
3638 | | - /* Hardware cannot filter just V2 L4 Sync messages; |
---|
3639 | | - * fall-through to V2 (both L2 and L4) Sync. |
---|
3640 | | - */ |
---|
| 3657 | + /* Hardware cannot filter just V2 L4 Sync messages */ |
---|
| 3658 | + fallthrough; |
---|
3641 | 3659 | case HWTSTAMP_FILTER_PTP_V2_SYNC: |
---|
3642 | 3660 | /* Also time stamps V2 Path Delay Request/Response. */ |
---|
3643 | 3661 | tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L2_L4_V2; |
---|
.. | .. |
---|
3646 | 3664 | is_l4 = true; |
---|
3647 | 3665 | break; |
---|
3648 | 3666 | case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: |
---|
3649 | | - /* Hardware cannot filter just V2 L4 Delay Request messages; |
---|
3650 | | - * fall-through to V2 (both L2 and L4) Delay Request. |
---|
3651 | | - */ |
---|
| 3667 | + /* Hardware cannot filter just V2 L4 Delay Request messages */ |
---|
| 3668 | + fallthrough; |
---|
3652 | 3669 | case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: |
---|
3653 | 3670 | /* Also time stamps V2 Path Delay Request/Response. */ |
---|
3654 | 3671 | tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L2_L4_V2; |
---|
.. | .. |
---|
3658 | 3675 | break; |
---|
3659 | 3676 | case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: |
---|
3660 | 3677 | case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: |
---|
3661 | | - /* Hardware cannot filter just V2 L4 or L2 Event messages; |
---|
3662 | | - * fall-through to all V2 (both L2 and L4) Events. |
---|
3663 | | - */ |
---|
| 3678 | + /* Hardware cannot filter just V2 L4 or L2 Event messages */ |
---|
| 3679 | + fallthrough; |
---|
3664 | 3680 | case HWTSTAMP_FILTER_PTP_V2_EVENT: |
---|
3665 | 3681 | tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_EVENT_V2; |
---|
3666 | 3682 | config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; |
---|
.. | .. |
---|
3672 | 3688 | * Delay Request messages but not both so fall-through to |
---|
3673 | 3689 | * time stamp all packets. |
---|
3674 | 3690 | */ |
---|
| 3691 | + fallthrough; |
---|
3675 | 3692 | case HWTSTAMP_FILTER_NTP_ALL: |
---|
3676 | 3693 | case HWTSTAMP_FILTER_ALL: |
---|
3677 | 3694 | is_l2 = true; |
---|
.. | .. |
---|
3772 | 3789 | |
---|
3773 | 3790 | /** |
---|
3774 | 3791 | * e1000_power_down_phy - Power down the PHY |
---|
| 3792 | + * @adapter: board private structure |
---|
3775 | 3793 | * |
---|
3776 | 3794 | * Power down the PHY so no link is implied when interface is down. |
---|
3777 | 3795 | * The PHY cannot be powered down if management or WoL is active. |
---|
.. | .. |
---|
3784 | 3802 | |
---|
3785 | 3803 | /** |
---|
3786 | 3804 | * e1000_flush_tx_ring - remove all descriptors from the tx_ring |
---|
| 3805 | + * @adapter: board private structure |
---|
3787 | 3806 | * |
---|
3788 | 3807 | * We want to clear all pending descriptors from the TX ring. |
---|
3789 | 3808 | * zeroing happens when the HW reads the regs. We assign the ring itself as |
---|
.. | .. |
---|
3803 | 3822 | tdt = er32(TDT(0)); |
---|
3804 | 3823 | BUG_ON(tdt != tx_ring->next_to_use); |
---|
3805 | 3824 | tx_desc = E1000_TX_DESC(*tx_ring, tx_ring->next_to_use); |
---|
3806 | | - tx_desc->buffer_addr = tx_ring->dma; |
---|
| 3825 | + tx_desc->buffer_addr = cpu_to_le64(tx_ring->dma); |
---|
3807 | 3826 | |
---|
3808 | 3827 | tx_desc->lower.data = cpu_to_le32(txd_lower | size); |
---|
3809 | 3828 | tx_desc->upper.data = 0; |
---|
.. | .. |
---|
3813 | 3832 | if (tx_ring->next_to_use == tx_ring->count) |
---|
3814 | 3833 | tx_ring->next_to_use = 0; |
---|
3815 | 3834 | ew32(TDT(0), tx_ring->next_to_use); |
---|
3816 | | - mmiowb(); |
---|
3817 | 3835 | usleep_range(200, 250); |
---|
3818 | 3836 | } |
---|
3819 | 3837 | |
---|
3820 | 3838 | /** |
---|
3821 | 3839 | * e1000_flush_rx_ring - remove all descriptors from the rx_ring |
---|
| 3840 | + * @adapter: board private structure |
---|
3822 | 3841 | * |
---|
3823 | 3842 | * Mark all descriptors in the RX ring as consumed and disable the rx ring |
---|
3824 | 3843 | */ |
---|
.. | .. |
---|
3851 | 3870 | |
---|
3852 | 3871 | /** |
---|
3853 | 3872 | * e1000_flush_desc_rings - remove all descriptors from the descriptor rings |
---|
| 3873 | + * @adapter: board private structure |
---|
3854 | 3874 | * |
---|
3855 | 3875 | * In i219, the descriptor rings must be emptied before resetting the HW |
---|
3856 | 3876 | * or before changing the device state to D3 during runtime (runtime PM). |
---|
.. | .. |
---|
3933 | 3953 | |
---|
3934 | 3954 | /** |
---|
3935 | 3955 | * e1000e_reset - bring the hardware into a known good state |
---|
| 3956 | + * @adapter: board private structure |
---|
3936 | 3957 | * |
---|
3937 | 3958 | * This function boots the hardware and enables some settings that |
---|
3938 | 3959 | * require a configuration cycle of the hardware - those cannot be |
---|
.. | .. |
---|
4019 | 4040 | fc->low_water = fc->high_water - 8; |
---|
4020 | 4041 | break; |
---|
4021 | 4042 | } |
---|
4022 | | - /* fall-through */ |
---|
| 4043 | + fallthrough; |
---|
4023 | 4044 | default: |
---|
4024 | 4045 | hwm = min(((pba << 10) * 9 / 10), |
---|
4025 | 4046 | ((pba << 10) - adapter->max_frame_size)); |
---|
.. | .. |
---|
4044 | 4065 | case e1000_pch_lpt: |
---|
4045 | 4066 | case e1000_pch_spt: |
---|
4046 | 4067 | case e1000_pch_cnp: |
---|
4047 | | - fc->refresh_time = 0x0400; |
---|
| 4068 | + case e1000_pch_tgp: |
---|
| 4069 | + case e1000_pch_adp: |
---|
| 4070 | + case e1000_pch_mtp: |
---|
| 4071 | + fc->refresh_time = 0xFFFF; |
---|
| 4072 | + fc->pause_time = 0xFFFF; |
---|
4048 | 4073 | |
---|
4049 | 4074 | if (adapter->netdev->mtu <= ETH_DATA_LEN) { |
---|
4050 | 4075 | fc->high_water = 0x05C20; |
---|
4051 | 4076 | fc->low_water = 0x05048; |
---|
4052 | | - fc->pause_time = 0x0650; |
---|
4053 | 4077 | break; |
---|
4054 | 4078 | } |
---|
4055 | 4079 | |
---|
.. | .. |
---|
4270 | 4294 | |
---|
4271 | 4295 | /* flush both disables and wait for them to finish */ |
---|
4272 | 4296 | e1e_flush(); |
---|
4273 | | - usleep_range(10000, 20000); |
---|
| 4297 | + usleep_range(10000, 11000); |
---|
4274 | 4298 | |
---|
4275 | 4299 | e1000_irq_disable(adapter); |
---|
4276 | 4300 | |
---|
.. | .. |
---|
4308 | 4332 | { |
---|
4309 | 4333 | might_sleep(); |
---|
4310 | 4334 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
---|
4311 | | - usleep_range(1000, 2000); |
---|
| 4335 | + usleep_range(1000, 1100); |
---|
4312 | 4336 | e1000e_down(adapter, true); |
---|
4313 | 4337 | e1000e_up(adapter); |
---|
4314 | 4338 | clear_bit(__E1000_RESETTING, &adapter->state); |
---|
.. | .. |
---|
4317 | 4341 | /** |
---|
4318 | 4342 | * e1000e_sanitize_systim - sanitize raw cycle counter reads |
---|
4319 | 4343 | * @hw: pointer to the HW structure |
---|
4320 | | - * @systim: time value read, sanitized and returned |
---|
| 4344 | + * @systim: PHC time value read, sanitized and returned |
---|
| 4345 | + * @sts: structure to hold system time before and after reading SYSTIML, |
---|
| 4346 | + * may be NULL |
---|
4321 | 4347 | * |
---|
4322 | 4348 | * Errata for 82574/82583 possible bad bits read from SYSTIMH/L: |
---|
4323 | 4349 | * check to see that the time is incrementing at a reasonable |
---|
4324 | 4350 | * rate and is a multiple of incvalue. |
---|
4325 | 4351 | **/ |
---|
4326 | | -static u64 e1000e_sanitize_systim(struct e1000_hw *hw, u64 systim) |
---|
| 4352 | +static u64 e1000e_sanitize_systim(struct e1000_hw *hw, u64 systim, |
---|
| 4353 | + struct ptp_system_timestamp *sts) |
---|
4327 | 4354 | { |
---|
4328 | 4355 | u64 time_delta, rem, temp; |
---|
4329 | 4356 | u64 systim_next; |
---|
.. | .. |
---|
4333 | 4360 | incvalue = er32(TIMINCA) & E1000_TIMINCA_INCVALUE_MASK; |
---|
4334 | 4361 | for (i = 0; i < E1000_MAX_82574_SYSTIM_REREADS; i++) { |
---|
4335 | 4362 | /* latch SYSTIMH on read of SYSTIML */ |
---|
| 4363 | + ptp_read_system_prets(sts); |
---|
4336 | 4364 | systim_next = (u64)er32(SYSTIML); |
---|
| 4365 | + ptp_read_system_postts(sts); |
---|
4337 | 4366 | systim_next |= (u64)er32(SYSTIMH) << 32; |
---|
4338 | 4367 | |
---|
4339 | 4368 | time_delta = systim_next - systim; |
---|
.. | .. |
---|
4351 | 4380 | } |
---|
4352 | 4381 | |
---|
4353 | 4382 | /** |
---|
4354 | | - * e1000e_cyclecounter_read - read raw cycle counter (used by time counter) |
---|
4355 | | - * @cc: cyclecounter structure |
---|
| 4383 | + * e1000e_read_systim - read SYSTIM register |
---|
| 4384 | + * @adapter: board private structure |
---|
| 4385 | + * @sts: structure which will contain system time before and after reading |
---|
| 4386 | + * SYSTIML, may be NULL |
---|
4356 | 4387 | **/ |
---|
4357 | | -static u64 e1000e_cyclecounter_read(const struct cyclecounter *cc) |
---|
| 4388 | +u64 e1000e_read_systim(struct e1000_adapter *adapter, |
---|
| 4389 | + struct ptp_system_timestamp *sts) |
---|
4358 | 4390 | { |
---|
4359 | | - struct e1000_adapter *adapter = container_of(cc, struct e1000_adapter, |
---|
4360 | | - cc); |
---|
4361 | 4391 | struct e1000_hw *hw = &adapter->hw; |
---|
4362 | | - u32 systimel, systimeh; |
---|
| 4392 | + u32 systimel, systimel_2, systimeh; |
---|
4363 | 4393 | u64 systim; |
---|
4364 | 4394 | /* SYSTIMH latching upon SYSTIML read does not work well. |
---|
4365 | 4395 | * This means that if SYSTIML overflows after we read it but before |
---|
.. | .. |
---|
4367 | 4397 | * will experience a huge non linear increment in the systime value |
---|
4368 | 4398 | * to fix that we test for overflow and if true, we re-read systime. |
---|
4369 | 4399 | */ |
---|
| 4400 | + ptp_read_system_prets(sts); |
---|
4370 | 4401 | systimel = er32(SYSTIML); |
---|
| 4402 | + ptp_read_system_postts(sts); |
---|
4371 | 4403 | systimeh = er32(SYSTIMH); |
---|
4372 | 4404 | /* Is systimel is so large that overflow is possible? */ |
---|
4373 | 4405 | if (systimel >= (u32)0xffffffff - E1000_TIMINCA_INCVALUE_MASK) { |
---|
4374 | | - u32 systimel_2 = er32(SYSTIML); |
---|
| 4406 | + ptp_read_system_prets(sts); |
---|
| 4407 | + systimel_2 = er32(SYSTIML); |
---|
| 4408 | + ptp_read_system_postts(sts); |
---|
4375 | 4409 | if (systimel > systimel_2) { |
---|
4376 | 4410 | /* There was an overflow, read again SYSTIMH, and use |
---|
4377 | 4411 | * systimel_2 |
---|
.. | .. |
---|
4384 | 4418 | systim |= (u64)systimeh << 32; |
---|
4385 | 4419 | |
---|
4386 | 4420 | if (adapter->flags2 & FLAG2_CHECK_SYSTIM_OVERFLOW) |
---|
4387 | | - systim = e1000e_sanitize_systim(hw, systim); |
---|
| 4421 | + systim = e1000e_sanitize_systim(hw, systim, sts); |
---|
4388 | 4422 | |
---|
4389 | 4423 | return systim; |
---|
| 4424 | +} |
---|
| 4425 | + |
---|
| 4426 | +/** |
---|
| 4427 | + * e1000e_cyclecounter_read - read raw cycle counter (used by time counter) |
---|
| 4428 | + * @cc: cyclecounter structure |
---|
| 4429 | + **/ |
---|
| 4430 | +static u64 e1000e_cyclecounter_read(const struct cyclecounter *cc) |
---|
| 4431 | +{ |
---|
| 4432 | + struct e1000_adapter *adapter = container_of(cc, struct e1000_adapter, |
---|
| 4433 | + cc); |
---|
| 4434 | + |
---|
| 4435 | + return e1000e_read_systim(adapter, NULL); |
---|
4390 | 4436 | } |
---|
4391 | 4437 | |
---|
4392 | 4438 | /** |
---|
.. | .. |
---|
4609 | 4655 | e1000_update_mng_vlan(adapter); |
---|
4610 | 4656 | |
---|
4611 | 4657 | /* DMA latency requirement to workaround jumbo issue */ |
---|
4612 | | - pm_qos_add_request(&adapter->pm_qos_req, PM_QOS_CPU_DMA_LATENCY, |
---|
4613 | | - PM_QOS_DEFAULT_VALUE); |
---|
| 4658 | + cpu_latency_qos_add_request(&adapter->pm_qos_req, PM_QOS_DEFAULT_VALUE); |
---|
4614 | 4659 | |
---|
4615 | 4660 | /* before we allocate an interrupt, we must be ready to handle it. |
---|
4616 | 4661 | * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt |
---|
.. | .. |
---|
4652 | 4697 | return 0; |
---|
4653 | 4698 | |
---|
4654 | 4699 | err_req_irq: |
---|
4655 | | - pm_qos_remove_request(&adapter->pm_qos_req); |
---|
| 4700 | + cpu_latency_qos_remove_request(&adapter->pm_qos_req); |
---|
4656 | 4701 | e1000e_release_hw_control(adapter); |
---|
4657 | 4702 | e1000_power_down_phy(adapter); |
---|
4658 | 4703 | e1000e_free_rx_resources(adapter->rx_ring); |
---|
.. | .. |
---|
4683 | 4728 | int count = E1000_CHECK_RESET_COUNT; |
---|
4684 | 4729 | |
---|
4685 | 4730 | while (test_bit(__E1000_RESETTING, &adapter->state) && count--) |
---|
4686 | | - usleep_range(10000, 20000); |
---|
| 4731 | + usleep_range(10000, 11000); |
---|
4687 | 4732 | |
---|
4688 | 4733 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); |
---|
4689 | 4734 | |
---|
4690 | 4735 | pm_runtime_get_sync(&pdev->dev); |
---|
4691 | 4736 | |
---|
4692 | | - if (!test_bit(__E1000_DOWN, &adapter->state)) { |
---|
| 4737 | + if (netif_device_present(netdev)) { |
---|
4693 | 4738 | e1000e_down(adapter, true); |
---|
4694 | 4739 | e1000_free_irq(adapter); |
---|
4695 | 4740 | |
---|
4696 | 4741 | /* Link status message must follow this format */ |
---|
4697 | | - pr_info("%s NIC Link is Down\n", adapter->netdev->name); |
---|
| 4742 | + netdev_info(netdev, "NIC Link is Down\n"); |
---|
4698 | 4743 | } |
---|
4699 | 4744 | |
---|
4700 | 4745 | napi_disable(&adapter->napi); |
---|
.. | .. |
---|
4716 | 4761 | !test_bit(__E1000_TESTING, &adapter->state)) |
---|
4717 | 4762 | e1000e_release_hw_control(adapter); |
---|
4718 | 4763 | |
---|
4719 | | - pm_qos_remove_request(&adapter->pm_qos_req); |
---|
| 4764 | + cpu_latency_qos_remove_request(&adapter->pm_qos_req); |
---|
4720 | 4765 | |
---|
4721 | 4766 | pm_runtime_put_sync(&pdev->dev); |
---|
4722 | 4767 | |
---|
.. | .. |
---|
4789 | 4834 | |
---|
4790 | 4835 | /** |
---|
4791 | 4836 | * e1000_update_phy_info - timre call-back to update PHY info |
---|
4792 | | - * @data: pointer to adapter cast into an unsigned long |
---|
| 4837 | + * @t: pointer to timer_list containing private info adapter |
---|
4793 | 4838 | * |
---|
4794 | 4839 | * Need to wait a few seconds after link up to get diagnostic information from |
---|
4795 | 4840 | * the phy |
---|
.. | .. |
---|
5044 | 5089 | u32 ctrl = er32(CTRL); |
---|
5045 | 5090 | |
---|
5046 | 5091 | /* Link status message must follow this format for user tools */ |
---|
5047 | | - pr_info("%s NIC Link is Up %d Mbps %s Duplex, Flow Control: %s\n", |
---|
5048 | | - adapter->netdev->name, adapter->link_speed, |
---|
5049 | | - adapter->link_duplex == FULL_DUPLEX ? "Full" : "Half", |
---|
5050 | | - (ctrl & E1000_CTRL_TFCE) && (ctrl & E1000_CTRL_RFCE) ? "Rx/Tx" : |
---|
5051 | | - (ctrl & E1000_CTRL_RFCE) ? "Rx" : |
---|
5052 | | - (ctrl & E1000_CTRL_TFCE) ? "Tx" : "None"); |
---|
| 5092 | + netdev_info(adapter->netdev, |
---|
| 5093 | + "NIC Link is Up %d Mbps %s Duplex, Flow Control: %s\n", |
---|
| 5094 | + adapter->link_speed, |
---|
| 5095 | + adapter->link_duplex == FULL_DUPLEX ? "Full" : "Half", |
---|
| 5096 | + (ctrl & E1000_CTRL_TFCE) && (ctrl & E1000_CTRL_RFCE) ? "Rx/Tx" : |
---|
| 5097 | + (ctrl & E1000_CTRL_RFCE) ? "Rx" : |
---|
| 5098 | + (ctrl & E1000_CTRL_TFCE) ? "Tx" : "None"); |
---|
5053 | 5099 | } |
---|
5054 | 5100 | |
---|
5055 | 5101 | static bool e1000e_has_link(struct e1000_adapter *adapter) |
---|
.. | .. |
---|
5128 | 5174 | |
---|
5129 | 5175 | /** |
---|
5130 | 5176 | * e1000_watchdog - Timer Call-back |
---|
5131 | | - * @data: pointer to adapter cast into an unsigned long |
---|
| 5177 | + * @t: pointer to timer_list containing private info adapter |
---|
5132 | 5178 | **/ |
---|
5133 | 5179 | static void e1000_watchdog(struct timer_list *t) |
---|
5134 | 5180 | { |
---|
.. | .. |
---|
5149 | 5195 | struct e1000_mac_info *mac = &adapter->hw.mac; |
---|
5150 | 5196 | struct e1000_phy_info *phy = &adapter->hw.phy; |
---|
5151 | 5197 | struct e1000_ring *tx_ring = adapter->tx_ring; |
---|
| 5198 | + u32 dmoff_exit_timeout = 100, tries = 0; |
---|
5152 | 5199 | struct e1000_hw *hw = &adapter->hw; |
---|
5153 | | - u32 link, tctl; |
---|
| 5200 | + u32 link, tctl, pcim_state; |
---|
5154 | 5201 | |
---|
5155 | 5202 | if (test_bit(__E1000_DOWN, &adapter->state)) |
---|
5156 | 5203 | return; |
---|
.. | .. |
---|
5174 | 5221 | |
---|
5175 | 5222 | /* Cancel scheduled suspend requests. */ |
---|
5176 | 5223 | pm_runtime_resume(netdev->dev.parent); |
---|
| 5224 | + |
---|
| 5225 | + /* Checking if MAC is in DMoff state*/ |
---|
| 5226 | + if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID) { |
---|
| 5227 | + pcim_state = er32(STATUS); |
---|
| 5228 | + while (pcim_state & E1000_STATUS_PCIM_STATE) { |
---|
| 5229 | + if (tries++ == dmoff_exit_timeout) { |
---|
| 5230 | + e_dbg("Error in exiting dmoff\n"); |
---|
| 5231 | + break; |
---|
| 5232 | + } |
---|
| 5233 | + usleep_range(10000, 20000); |
---|
| 5234 | + pcim_state = er32(STATUS); |
---|
| 5235 | + |
---|
| 5236 | + /* Checking if MAC exited DMoff state */ |
---|
| 5237 | + if (!(pcim_state & E1000_STATUS_PCIM_STATE)) |
---|
| 5238 | + e1000_phy_hw_reset(&adapter->hw); |
---|
| 5239 | + } |
---|
| 5240 | + } |
---|
5177 | 5241 | |
---|
5178 | 5242 | /* update snapshot of PHY registers on LSC */ |
---|
5179 | 5243 | e1000_phy_read_status(adapter); |
---|
.. | .. |
---|
5230 | 5294 | ew32(TARC(0), tarc0); |
---|
5231 | 5295 | } |
---|
5232 | 5296 | |
---|
5233 | | - /* disable TSO for pcie and 10/100 speeds, to avoid |
---|
5234 | | - * some hardware issues |
---|
5235 | | - */ |
---|
5236 | | - if (!(adapter->flags & FLAG_TSO_FORCE)) { |
---|
5237 | | - switch (adapter->link_speed) { |
---|
5238 | | - case SPEED_10: |
---|
5239 | | - case SPEED_100: |
---|
5240 | | - e_info("10/100 speed: disabling TSO\n"); |
---|
5241 | | - netdev->features &= ~NETIF_F_TSO; |
---|
5242 | | - netdev->features &= ~NETIF_F_TSO6; |
---|
5243 | | - break; |
---|
5244 | | - case SPEED_1000: |
---|
5245 | | - netdev->features |= NETIF_F_TSO; |
---|
5246 | | - netdev->features |= NETIF_F_TSO6; |
---|
5247 | | - break; |
---|
5248 | | - default: |
---|
5249 | | - /* oops */ |
---|
5250 | | - break; |
---|
5251 | | - } |
---|
5252 | | - if (hw->mac.type == e1000_pch_spt) { |
---|
5253 | | - netdev->features &= ~NETIF_F_TSO; |
---|
5254 | | - netdev->features &= ~NETIF_F_TSO6; |
---|
5255 | | - } |
---|
5256 | | - } |
---|
5257 | | - |
---|
5258 | 5297 | /* enable transmits in the hardware, need to do this |
---|
5259 | 5298 | * after setting TARC(0) |
---|
5260 | 5299 | */ |
---|
.. | .. |
---|
5280 | 5319 | adapter->link_speed = 0; |
---|
5281 | 5320 | adapter->link_duplex = 0; |
---|
5282 | 5321 | /* Link status message must follow this format */ |
---|
5283 | | - pr_info("%s NIC Link is Down\n", adapter->netdev->name); |
---|
| 5322 | + netdev_info(netdev, "NIC Link is Down\n"); |
---|
5284 | 5323 | netif_carrier_off(netdev); |
---|
5285 | 5324 | netif_stop_queue(netdev); |
---|
5286 | 5325 | if (!test_bit(__E1000_DOWN, &adapter->state)) |
---|
.. | .. |
---|
5422 | 5461 | cmd_length = E1000_TXD_CMD_IP; |
---|
5423 | 5462 | ipcse = skb_transport_offset(skb) - 1; |
---|
5424 | 5463 | } else if (skb_is_gso_v6(skb)) { |
---|
5425 | | - ipv6_hdr(skb)->payload_len = 0; |
---|
5426 | | - tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
---|
5427 | | - &ipv6_hdr(skb)->daddr, |
---|
5428 | | - 0, IPPROTO_TCP, 0); |
---|
| 5464 | + tcp_v6_gso_csum_prep(skb); |
---|
5429 | 5465 | ipcse = 0; |
---|
5430 | 5466 | } |
---|
5431 | 5467 | ipcss = skb_network_offset(skb); |
---|
.. | .. |
---|
5554 | 5590 | } |
---|
5555 | 5591 | |
---|
5556 | 5592 | for (f = 0; f < nr_frags; f++) { |
---|
5557 | | - const struct skb_frag_struct *frag; |
---|
| 5593 | + const skb_frag_t *frag = &skb_shinfo(skb)->frags[f]; |
---|
5558 | 5594 | |
---|
5559 | | - frag = &skb_shinfo(skb)->frags[f]; |
---|
5560 | 5595 | len = skb_frag_size(frag); |
---|
5561 | 5596 | offset = 0; |
---|
5562 | 5597 | |
---|
.. | .. |
---|
5877 | 5912 | e1000_tx_queue(tx_ring, tx_flags, count); |
---|
5878 | 5913 | /* Make sure there is space in the ring for the next send. */ |
---|
5879 | 5914 | e1000_maybe_stop_tx(tx_ring, |
---|
5880 | | - (MAX_SKB_FRAGS * |
---|
| 5915 | + ((MAX_SKB_FRAGS + 1) * |
---|
5881 | 5916 | DIV_ROUND_UP(PAGE_SIZE, |
---|
5882 | | - adapter->tx_fifo_limit) + 2)); |
---|
| 5917 | + adapter->tx_fifo_limit) + 4)); |
---|
5883 | 5918 | |
---|
5884 | | - if (!skb->xmit_more || |
---|
| 5919 | + if (!netdev_xmit_more() || |
---|
5885 | 5920 | netif_xmit_stopped(netdev_get_tx_queue(netdev, 0))) { |
---|
5886 | 5921 | if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA) |
---|
5887 | 5922 | e1000e_update_tdt_wa(tx_ring, |
---|
5888 | 5923 | tx_ring->next_to_use); |
---|
5889 | 5924 | else |
---|
5890 | 5925 | writel(tx_ring->next_to_use, tx_ring->tail); |
---|
5891 | | - |
---|
5892 | | - /* we need this if more than one processor can write |
---|
5893 | | - * to our tail at a time, it synchronizes IO on |
---|
5894 | | - *IA64/Altix systems |
---|
5895 | | - */ |
---|
5896 | | - mmiowb(); |
---|
5897 | 5926 | } |
---|
5898 | 5927 | } else { |
---|
5899 | 5928 | dev_kfree_skb_any(skb); |
---|
.. | .. |
---|
5907 | 5936 | /** |
---|
5908 | 5937 | * e1000_tx_timeout - Respond to a Tx Hang |
---|
5909 | 5938 | * @netdev: network interface device structure |
---|
| 5939 | + * @txqueue: index of the hung queue (unused) |
---|
5910 | 5940 | **/ |
---|
5911 | | -static void e1000_tx_timeout(struct net_device *netdev) |
---|
| 5941 | +static void e1000_tx_timeout(struct net_device *netdev, unsigned int __always_unused txqueue) |
---|
5912 | 5942 | { |
---|
5913 | 5943 | struct e1000_adapter *adapter = netdev_priv(netdev); |
---|
5914 | 5944 | |
---|
.. | .. |
---|
6011 | 6041 | } |
---|
6012 | 6042 | |
---|
6013 | 6043 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
---|
6014 | | - usleep_range(1000, 2000); |
---|
| 6044 | + usleep_range(1000, 1100); |
---|
6015 | 6045 | /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */ |
---|
6016 | 6046 | adapter->max_frame_size = max_frame; |
---|
6017 | | - e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu); |
---|
| 6047 | + netdev_dbg(netdev, "changing MTU from %d to %d\n", |
---|
| 6048 | + netdev->mtu, new_mtu); |
---|
6018 | 6049 | netdev->mtu = new_mtu; |
---|
6019 | 6050 | |
---|
6020 | 6051 | pm_runtime_get_sync(netdev->dev.parent); |
---|
.. | .. |
---|
6112 | 6143 | /** |
---|
6113 | 6144 | * e1000e_hwtstamp_ioctl - control hardware time stamping |
---|
6114 | 6145 | * @netdev: network interface device structure |
---|
6115 | | - * @ifreq: interface request |
---|
| 6146 | + * @ifr: interface request |
---|
6116 | 6147 | * |
---|
6117 | 6148 | * Outgoing time stamping can be enabled and disabled. Play nice and |
---|
6118 | 6149 | * disable it when requested, although it shouldn't cause any overhead |
---|
.. | .. |
---|
6280 | 6311 | pm_runtime_put_sync(netdev->dev.parent); |
---|
6281 | 6312 | } |
---|
6282 | 6313 | |
---|
| 6314 | +/* S0ix implementation */ |
---|
| 6315 | +static void e1000e_s0ix_entry_flow(struct e1000_adapter *adapter) |
---|
| 6316 | +{ |
---|
| 6317 | + struct e1000_hw *hw = &adapter->hw; |
---|
| 6318 | + u32 mac_data; |
---|
| 6319 | + u16 phy_data; |
---|
| 6320 | + |
---|
| 6321 | + /* Disable the periodic inband message, |
---|
| 6322 | + * don't request PCIe clock in K1 page770_17[10:9] = 10b |
---|
| 6323 | + */ |
---|
| 6324 | + e1e_rphy(hw, HV_PM_CTRL, &phy_data); |
---|
| 6325 | + phy_data &= ~HV_PM_CTRL_K1_CLK_REQ; |
---|
| 6326 | + phy_data |= BIT(10); |
---|
| 6327 | + e1e_wphy(hw, HV_PM_CTRL, phy_data); |
---|
| 6328 | + |
---|
| 6329 | + /* Make sure we don't exit K1 every time a new packet arrives |
---|
| 6330 | + * 772_29[5] = 1 CS_Mode_Stay_In_K1 |
---|
| 6331 | + */ |
---|
| 6332 | + e1e_rphy(hw, I217_CGFREG, &phy_data); |
---|
| 6333 | + phy_data |= BIT(5); |
---|
| 6334 | + e1e_wphy(hw, I217_CGFREG, phy_data); |
---|
| 6335 | + |
---|
| 6336 | + /* Change the MAC/PHY interface to SMBus |
---|
| 6337 | + * Force the SMBus in PHY page769_23[0] = 1 |
---|
| 6338 | + * Force the SMBus in MAC CTRL_EXT[11] = 1 |
---|
| 6339 | + */ |
---|
| 6340 | + e1e_rphy(hw, CV_SMB_CTRL, &phy_data); |
---|
| 6341 | + phy_data |= CV_SMB_CTRL_FORCE_SMBUS; |
---|
| 6342 | + e1e_wphy(hw, CV_SMB_CTRL, phy_data); |
---|
| 6343 | + mac_data = er32(CTRL_EXT); |
---|
| 6344 | + mac_data |= E1000_CTRL_EXT_FORCE_SMBUS; |
---|
| 6345 | + ew32(CTRL_EXT, mac_data); |
---|
| 6346 | + |
---|
| 6347 | + /* DFT control: PHY bit: page769_20[0] = 1 |
---|
| 6348 | + * Gate PPW via EXTCNF_CTRL - set 0x0F00[7] = 1 |
---|
| 6349 | + */ |
---|
| 6350 | + e1e_rphy(hw, I82579_DFT_CTRL, &phy_data); |
---|
| 6351 | + phy_data |= BIT(0); |
---|
| 6352 | + e1e_wphy(hw, I82579_DFT_CTRL, phy_data); |
---|
| 6353 | + |
---|
| 6354 | + mac_data = er32(EXTCNF_CTRL); |
---|
| 6355 | + mac_data |= E1000_EXTCNF_CTRL_GATE_PHY_CFG; |
---|
| 6356 | + ew32(EXTCNF_CTRL, mac_data); |
---|
| 6357 | + |
---|
| 6358 | + /* Check MAC Tx/Rx packet buffer pointers. |
---|
| 6359 | + * Reset MAC Tx/Rx packet buffer pointers to suppress any |
---|
| 6360 | + * pending traffic indication that would prevent power gating. |
---|
| 6361 | + */ |
---|
| 6362 | + mac_data = er32(TDFH); |
---|
| 6363 | + if (mac_data) |
---|
| 6364 | + ew32(TDFH, 0); |
---|
| 6365 | + mac_data = er32(TDFT); |
---|
| 6366 | + if (mac_data) |
---|
| 6367 | + ew32(TDFT, 0); |
---|
| 6368 | + mac_data = er32(TDFHS); |
---|
| 6369 | + if (mac_data) |
---|
| 6370 | + ew32(TDFHS, 0); |
---|
| 6371 | + mac_data = er32(TDFTS); |
---|
| 6372 | + if (mac_data) |
---|
| 6373 | + ew32(TDFTS, 0); |
---|
| 6374 | + mac_data = er32(TDFPC); |
---|
| 6375 | + if (mac_data) |
---|
| 6376 | + ew32(TDFPC, 0); |
---|
| 6377 | + mac_data = er32(RDFH); |
---|
| 6378 | + if (mac_data) |
---|
| 6379 | + ew32(RDFH, 0); |
---|
| 6380 | + mac_data = er32(RDFT); |
---|
| 6381 | + if (mac_data) |
---|
| 6382 | + ew32(RDFT, 0); |
---|
| 6383 | + mac_data = er32(RDFHS); |
---|
| 6384 | + if (mac_data) |
---|
| 6385 | + ew32(RDFHS, 0); |
---|
| 6386 | + mac_data = er32(RDFTS); |
---|
| 6387 | + if (mac_data) |
---|
| 6388 | + ew32(RDFTS, 0); |
---|
| 6389 | + mac_data = er32(RDFPC); |
---|
| 6390 | + if (mac_data) |
---|
| 6391 | + ew32(RDFPC, 0); |
---|
| 6392 | + |
---|
| 6393 | + /* Enable the Dynamic Power Gating in the MAC */ |
---|
| 6394 | + mac_data = er32(FEXTNVM7); |
---|
| 6395 | + mac_data |= BIT(22); |
---|
| 6396 | + ew32(FEXTNVM7, mac_data); |
---|
| 6397 | + |
---|
| 6398 | + /* Disable the time synchronization clock */ |
---|
| 6399 | + mac_data = er32(FEXTNVM7); |
---|
| 6400 | + mac_data |= BIT(31); |
---|
| 6401 | + mac_data &= ~BIT(0); |
---|
| 6402 | + ew32(FEXTNVM7, mac_data); |
---|
| 6403 | + |
---|
| 6404 | + /* Dynamic Power Gating Enable */ |
---|
| 6405 | + mac_data = er32(CTRL_EXT); |
---|
| 6406 | + mac_data |= BIT(3); |
---|
| 6407 | + ew32(CTRL_EXT, mac_data); |
---|
| 6408 | + |
---|
| 6409 | + /* Disable disconnected cable conditioning for Power Gating */ |
---|
| 6410 | + mac_data = er32(DPGFR); |
---|
| 6411 | + mac_data |= BIT(2); |
---|
| 6412 | + ew32(DPGFR, mac_data); |
---|
| 6413 | + |
---|
| 6414 | + /* Don't wake from dynamic Power Gating with clock request */ |
---|
| 6415 | + mac_data = er32(FEXTNVM12); |
---|
| 6416 | + mac_data |= BIT(12); |
---|
| 6417 | + ew32(FEXTNVM12, mac_data); |
---|
| 6418 | + |
---|
| 6419 | + /* Ungate PGCB clock */ |
---|
| 6420 | + mac_data = er32(FEXTNVM9); |
---|
| 6421 | + mac_data &= ~BIT(28); |
---|
| 6422 | + ew32(FEXTNVM9, mac_data); |
---|
| 6423 | + |
---|
| 6424 | + /* Enable K1 off to enable mPHY Power Gating */ |
---|
| 6425 | + mac_data = er32(FEXTNVM6); |
---|
| 6426 | + mac_data |= BIT(31); |
---|
| 6427 | + ew32(FEXTNVM6, mac_data); |
---|
| 6428 | + |
---|
| 6429 | + /* Enable mPHY power gating for any link and speed */ |
---|
| 6430 | + mac_data = er32(FEXTNVM8); |
---|
| 6431 | + mac_data |= BIT(9); |
---|
| 6432 | + ew32(FEXTNVM8, mac_data); |
---|
| 6433 | + |
---|
| 6434 | + /* Enable the Dynamic Clock Gating in the DMA and MAC */ |
---|
| 6435 | + mac_data = er32(CTRL_EXT); |
---|
| 6436 | + mac_data |= E1000_CTRL_EXT_DMA_DYN_CLK_EN; |
---|
| 6437 | + ew32(CTRL_EXT, mac_data); |
---|
| 6438 | + |
---|
| 6439 | + /* No MAC DPG gating SLP_S0 in modern standby |
---|
| 6440 | + * Switch the logic of the lanphypc to use PMC counter |
---|
| 6441 | + */ |
---|
| 6442 | + mac_data = er32(FEXTNVM5); |
---|
| 6443 | + mac_data |= BIT(7); |
---|
| 6444 | + ew32(FEXTNVM5, mac_data); |
---|
| 6445 | +} |
---|
| 6446 | + |
---|
| 6447 | +static void e1000e_s0ix_exit_flow(struct e1000_adapter *adapter) |
---|
| 6448 | +{ |
---|
| 6449 | + struct e1000_hw *hw = &adapter->hw; |
---|
| 6450 | + u32 mac_data; |
---|
| 6451 | + u16 phy_data; |
---|
| 6452 | + |
---|
| 6453 | + /* Disable the Dynamic Power Gating in the MAC */ |
---|
| 6454 | + mac_data = er32(FEXTNVM7); |
---|
| 6455 | + mac_data &= 0xFFBFFFFF; |
---|
| 6456 | + ew32(FEXTNVM7, mac_data); |
---|
| 6457 | + |
---|
| 6458 | + /* Enable the time synchronization clock */ |
---|
| 6459 | + mac_data = er32(FEXTNVM7); |
---|
| 6460 | + mac_data |= BIT(0); |
---|
| 6461 | + ew32(FEXTNVM7, mac_data); |
---|
| 6462 | + |
---|
| 6463 | + /* Disable mPHY power gating for any link and speed */ |
---|
| 6464 | + mac_data = er32(FEXTNVM8); |
---|
| 6465 | + mac_data &= ~BIT(9); |
---|
| 6466 | + ew32(FEXTNVM8, mac_data); |
---|
| 6467 | + |
---|
| 6468 | + /* Disable K1 off */ |
---|
| 6469 | + mac_data = er32(FEXTNVM6); |
---|
| 6470 | + mac_data &= ~BIT(31); |
---|
| 6471 | + ew32(FEXTNVM6, mac_data); |
---|
| 6472 | + |
---|
| 6473 | + /* Disable Ungate PGCB clock */ |
---|
| 6474 | + mac_data = er32(FEXTNVM9); |
---|
| 6475 | + mac_data |= BIT(28); |
---|
| 6476 | + ew32(FEXTNVM9, mac_data); |
---|
| 6477 | + |
---|
| 6478 | + /* Cancel not waking from dynamic |
---|
| 6479 | + * Power Gating with clock request |
---|
| 6480 | + */ |
---|
| 6481 | + mac_data = er32(FEXTNVM12); |
---|
| 6482 | + mac_data &= ~BIT(12); |
---|
| 6483 | + ew32(FEXTNVM12, mac_data); |
---|
| 6484 | + |
---|
| 6485 | + /* Cancel disable disconnected cable conditioning |
---|
| 6486 | + * for Power Gating |
---|
| 6487 | + */ |
---|
| 6488 | + mac_data = er32(DPGFR); |
---|
| 6489 | + mac_data &= ~BIT(2); |
---|
| 6490 | + ew32(DPGFR, mac_data); |
---|
| 6491 | + |
---|
| 6492 | + /* Disable Dynamic Power Gating */ |
---|
| 6493 | + mac_data = er32(CTRL_EXT); |
---|
| 6494 | + mac_data &= 0xFFFFFFF7; |
---|
| 6495 | + ew32(CTRL_EXT, mac_data); |
---|
| 6496 | + |
---|
| 6497 | + /* Disable the Dynamic Clock Gating in the DMA and MAC */ |
---|
| 6498 | + mac_data = er32(CTRL_EXT); |
---|
| 6499 | + mac_data &= 0xFFF7FFFF; |
---|
| 6500 | + ew32(CTRL_EXT, mac_data); |
---|
| 6501 | + |
---|
| 6502 | + /* Revert the lanphypc logic to use the internal Gbe counter |
---|
| 6503 | + * and not the PMC counter |
---|
| 6504 | + */ |
---|
| 6505 | + mac_data = er32(FEXTNVM5); |
---|
| 6506 | + mac_data &= 0xFFFFFF7F; |
---|
| 6507 | + ew32(FEXTNVM5, mac_data); |
---|
| 6508 | + |
---|
| 6509 | + /* Enable the periodic inband message, |
---|
| 6510 | + * Request PCIe clock in K1 page770_17[10:9] =01b |
---|
| 6511 | + */ |
---|
| 6512 | + e1e_rphy(hw, HV_PM_CTRL, &phy_data); |
---|
| 6513 | + phy_data &= 0xFBFF; |
---|
| 6514 | + phy_data |= HV_PM_CTRL_K1_CLK_REQ; |
---|
| 6515 | + e1e_wphy(hw, HV_PM_CTRL, phy_data); |
---|
| 6516 | + |
---|
| 6517 | + /* Return back configuration |
---|
| 6518 | + * 772_29[5] = 0 CS_Mode_Stay_In_K1 |
---|
| 6519 | + */ |
---|
| 6520 | + e1e_rphy(hw, I217_CGFREG, &phy_data); |
---|
| 6521 | + phy_data &= 0xFFDF; |
---|
| 6522 | + e1e_wphy(hw, I217_CGFREG, phy_data); |
---|
| 6523 | + |
---|
| 6524 | + /* Change the MAC/PHY interface to Kumeran |
---|
| 6525 | + * Unforce the SMBus in PHY page769_23[0] = 0 |
---|
| 6526 | + * Unforce the SMBus in MAC CTRL_EXT[11] = 0 |
---|
| 6527 | + */ |
---|
| 6528 | + e1e_rphy(hw, CV_SMB_CTRL, &phy_data); |
---|
| 6529 | + phy_data &= ~CV_SMB_CTRL_FORCE_SMBUS; |
---|
| 6530 | + e1e_wphy(hw, CV_SMB_CTRL, phy_data); |
---|
| 6531 | + mac_data = er32(CTRL_EXT); |
---|
| 6532 | + mac_data &= ~E1000_CTRL_EXT_FORCE_SMBUS; |
---|
| 6533 | + ew32(CTRL_EXT, mac_data); |
---|
| 6534 | +} |
---|
| 6535 | + |
---|
6283 | 6536 | static int e1000e_pm_freeze(struct device *dev) |
---|
6284 | 6537 | { |
---|
6285 | | - struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev)); |
---|
| 6538 | + struct net_device *netdev = dev_get_drvdata(dev); |
---|
6286 | 6539 | struct e1000_adapter *adapter = netdev_priv(netdev); |
---|
| 6540 | + bool present; |
---|
6287 | 6541 | |
---|
| 6542 | + rtnl_lock(); |
---|
| 6543 | + |
---|
| 6544 | + present = netif_device_present(netdev); |
---|
6288 | 6545 | netif_device_detach(netdev); |
---|
6289 | 6546 | |
---|
6290 | | - if (netif_running(netdev)) { |
---|
| 6547 | + if (present && netif_running(netdev)) { |
---|
6291 | 6548 | int count = E1000_CHECK_RESET_COUNT; |
---|
6292 | 6549 | |
---|
6293 | 6550 | while (test_bit(__E1000_RESETTING, &adapter->state) && count--) |
---|
6294 | | - usleep_range(10000, 20000); |
---|
| 6551 | + usleep_range(10000, 11000); |
---|
6295 | 6552 | |
---|
6296 | 6553 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); |
---|
6297 | 6554 | |
---|
.. | .. |
---|
6299 | 6556 | e1000e_down(adapter, false); |
---|
6300 | 6557 | e1000_free_irq(adapter); |
---|
6301 | 6558 | } |
---|
| 6559 | + rtnl_unlock(); |
---|
| 6560 | + |
---|
6302 | 6561 | e1000e_reset_interrupt_capability(adapter); |
---|
6303 | 6562 | |
---|
6304 | 6563 | /* Allow time for pending master requests to run */ |
---|
.. | .. |
---|
6471 | 6730 | case PCIE_LINK_STATE_L0S: |
---|
6472 | 6731 | case PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1: |
---|
6473 | 6732 | aspm_dis_mask |= PCI_EXP_LNKCTL_ASPM_L0S; |
---|
6474 | | - /* fall-through - can't have L1 without L0s */ |
---|
| 6733 | + fallthrough; /* can't have L1 without L0s */ |
---|
6475 | 6734 | case PCIE_LINK_STATE_L1: |
---|
6476 | 6735 | aspm_dis_mask |= PCI_EXP_LNKCTL_ASPM_L1; |
---|
6477 | 6736 | break; |
---|
.. | .. |
---|
6552 | 6811 | __e1000e_disable_aspm(pdev, state, 1); |
---|
6553 | 6812 | } |
---|
6554 | 6813 | |
---|
6555 | | -#ifdef CONFIG_PM |
---|
| 6814 | +static int e1000e_pm_thaw(struct device *dev) |
---|
| 6815 | +{ |
---|
| 6816 | + struct net_device *netdev = dev_get_drvdata(dev); |
---|
| 6817 | + struct e1000_adapter *adapter = netdev_priv(netdev); |
---|
| 6818 | + int rc = 0; |
---|
| 6819 | + |
---|
| 6820 | + e1000e_set_interrupt_capability(adapter); |
---|
| 6821 | + |
---|
| 6822 | + rtnl_lock(); |
---|
| 6823 | + if (netif_running(netdev)) { |
---|
| 6824 | + rc = e1000_request_irq(adapter); |
---|
| 6825 | + if (rc) |
---|
| 6826 | + goto err_irq; |
---|
| 6827 | + |
---|
| 6828 | + e1000e_up(adapter); |
---|
| 6829 | + } |
---|
| 6830 | + |
---|
| 6831 | + netif_device_attach(netdev); |
---|
| 6832 | +err_irq: |
---|
| 6833 | + rtnl_unlock(); |
---|
| 6834 | + |
---|
| 6835 | + return rc; |
---|
| 6836 | +} |
---|
| 6837 | + |
---|
6556 | 6838 | static int __e1000_resume(struct pci_dev *pdev) |
---|
6557 | 6839 | { |
---|
6558 | 6840 | struct net_device *netdev = pci_get_drvdata(pdev); |
---|
.. | .. |
---|
6618 | 6900 | return 0; |
---|
6619 | 6901 | } |
---|
6620 | 6902 | |
---|
6621 | | -#ifdef CONFIG_PM_SLEEP |
---|
6622 | | -static int e1000e_pm_thaw(struct device *dev) |
---|
| 6903 | +static __maybe_unused int e1000e_pm_suspend(struct device *dev) |
---|
6623 | 6904 | { |
---|
6624 | 6905 | struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev)); |
---|
6625 | 6906 | struct e1000_adapter *adapter = netdev_priv(netdev); |
---|
6626 | | - |
---|
6627 | | - e1000e_set_interrupt_capability(adapter); |
---|
6628 | | - if (netif_running(netdev)) { |
---|
6629 | | - u32 err = e1000_request_irq(adapter); |
---|
6630 | | - |
---|
6631 | | - if (err) |
---|
6632 | | - return err; |
---|
6633 | | - |
---|
6634 | | - e1000e_up(adapter); |
---|
6635 | | - } |
---|
6636 | | - |
---|
6637 | | - netif_device_attach(netdev); |
---|
6638 | | - |
---|
6639 | | - return 0; |
---|
6640 | | -} |
---|
6641 | | - |
---|
6642 | | -static int e1000e_pm_suspend(struct device *dev) |
---|
6643 | | -{ |
---|
6644 | 6907 | struct pci_dev *pdev = to_pci_dev(dev); |
---|
6645 | 6908 | int rc; |
---|
6646 | 6909 | |
---|
.. | .. |
---|
6649 | 6912 | e1000e_pm_freeze(dev); |
---|
6650 | 6913 | |
---|
6651 | 6914 | rc = __e1000_shutdown(pdev, false); |
---|
6652 | | - if (rc) |
---|
| 6915 | + if (rc) { |
---|
6653 | 6916 | e1000e_pm_thaw(dev); |
---|
| 6917 | + } else { |
---|
| 6918 | + /* Introduce S0ix implementation */ |
---|
| 6919 | + if (adapter->flags2 & FLAG2_ENABLE_S0IX_FLOWS) |
---|
| 6920 | + e1000e_s0ix_entry_flow(adapter); |
---|
| 6921 | + } |
---|
6654 | 6922 | |
---|
6655 | 6923 | return rc; |
---|
6656 | 6924 | } |
---|
6657 | 6925 | |
---|
6658 | | -static int e1000e_pm_resume(struct device *dev) |
---|
| 6926 | +static __maybe_unused int e1000e_pm_resume(struct device *dev) |
---|
6659 | 6927 | { |
---|
| 6928 | + struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev)); |
---|
| 6929 | + struct e1000_adapter *adapter = netdev_priv(netdev); |
---|
6660 | 6930 | struct pci_dev *pdev = to_pci_dev(dev); |
---|
6661 | 6931 | int rc; |
---|
| 6932 | + |
---|
| 6933 | + /* Introduce S0ix implementation */ |
---|
| 6934 | + if (adapter->flags2 & FLAG2_ENABLE_S0IX_FLOWS) |
---|
| 6935 | + e1000e_s0ix_exit_flow(adapter); |
---|
6662 | 6936 | |
---|
6663 | 6937 | rc = __e1000_resume(pdev); |
---|
6664 | 6938 | if (rc) |
---|
.. | .. |
---|
6666 | 6940 | |
---|
6667 | 6941 | return e1000e_pm_thaw(dev); |
---|
6668 | 6942 | } |
---|
6669 | | -#endif /* CONFIG_PM_SLEEP */ |
---|
6670 | 6943 | |
---|
6671 | | -static int e1000e_pm_runtime_idle(struct device *dev) |
---|
| 6944 | +static __maybe_unused int e1000e_pm_runtime_idle(struct device *dev) |
---|
6672 | 6945 | { |
---|
6673 | | - struct pci_dev *pdev = to_pci_dev(dev); |
---|
6674 | | - struct net_device *netdev = pci_get_drvdata(pdev); |
---|
| 6946 | + struct net_device *netdev = dev_get_drvdata(dev); |
---|
6675 | 6947 | struct e1000_adapter *adapter = netdev_priv(netdev); |
---|
6676 | 6948 | u16 eee_lp; |
---|
6677 | 6949 | |
---|
.. | .. |
---|
6685 | 6957 | return -EBUSY; |
---|
6686 | 6958 | } |
---|
6687 | 6959 | |
---|
6688 | | -static int e1000e_pm_runtime_resume(struct device *dev) |
---|
| 6960 | +static __maybe_unused int e1000e_pm_runtime_resume(struct device *dev) |
---|
6689 | 6961 | { |
---|
6690 | 6962 | struct pci_dev *pdev = to_pci_dev(dev); |
---|
6691 | 6963 | struct net_device *netdev = pci_get_drvdata(pdev); |
---|
.. | .. |
---|
6702 | 6974 | return rc; |
---|
6703 | 6975 | } |
---|
6704 | 6976 | |
---|
6705 | | -static int e1000e_pm_runtime_suspend(struct device *dev) |
---|
| 6977 | +static __maybe_unused int e1000e_pm_runtime_suspend(struct device *dev) |
---|
6706 | 6978 | { |
---|
6707 | 6979 | struct pci_dev *pdev = to_pci_dev(dev); |
---|
6708 | 6980 | struct net_device *netdev = pci_get_drvdata(pdev); |
---|
.. | .. |
---|
6712 | 6984 | int count = E1000_CHECK_RESET_COUNT; |
---|
6713 | 6985 | |
---|
6714 | 6986 | while (test_bit(__E1000_RESETTING, &adapter->state) && count--) |
---|
6715 | | - usleep_range(10000, 20000); |
---|
| 6987 | + usleep_range(10000, 11000); |
---|
6716 | 6988 | |
---|
6717 | 6989 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); |
---|
6718 | 6990 | |
---|
.. | .. |
---|
6727 | 6999 | |
---|
6728 | 7000 | return 0; |
---|
6729 | 7001 | } |
---|
6730 | | -#endif /* CONFIG_PM */ |
---|
6731 | 7002 | |
---|
6732 | 7003 | static void e1000_shutdown(struct pci_dev *pdev) |
---|
6733 | 7004 | { |
---|
.. | .. |
---|
6811 | 7082 | static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, |
---|
6812 | 7083 | pci_channel_state_t state) |
---|
6813 | 7084 | { |
---|
6814 | | - struct net_device *netdev = pci_get_drvdata(pdev); |
---|
6815 | | - struct e1000_adapter *adapter = netdev_priv(netdev); |
---|
6816 | | - |
---|
6817 | | - netif_device_detach(netdev); |
---|
| 7085 | + e1000e_pm_freeze(&pdev->dev); |
---|
6818 | 7086 | |
---|
6819 | 7087 | if (state == pci_channel_io_perm_failure) |
---|
6820 | 7088 | return PCI_ERS_RESULT_DISCONNECT; |
---|
6821 | 7089 | |
---|
6822 | | - if (netif_running(netdev)) |
---|
6823 | | - e1000e_down(adapter, true); |
---|
6824 | 7090 | pci_disable_device(pdev); |
---|
6825 | 7091 | |
---|
6826 | 7092 | /* Request a slot slot reset. */ |
---|
.. | .. |
---|
6868 | 7134 | result = PCI_ERS_RESULT_RECOVERED; |
---|
6869 | 7135 | } |
---|
6870 | 7136 | |
---|
6871 | | - pci_cleanup_aer_uncorrect_error_status(pdev); |
---|
6872 | | - |
---|
6873 | 7137 | return result; |
---|
6874 | 7138 | } |
---|
6875 | 7139 | |
---|
.. | .. |
---|
6888 | 7152 | |
---|
6889 | 7153 | e1000_init_manageability_pt(adapter); |
---|
6890 | 7154 | |
---|
6891 | | - if (netif_running(netdev)) |
---|
6892 | | - e1000e_up(adapter); |
---|
6893 | | - |
---|
6894 | | - netif_device_attach(netdev); |
---|
| 7155 | + e1000e_pm_thaw(&pdev->dev); |
---|
6895 | 7156 | |
---|
6896 | 7157 | /* If the controller has AMT, do not set DRV_LOAD until the interface |
---|
6897 | 7158 | * is up. For all other cases, let the f/w know that the h/w is now |
---|
.. | .. |
---|
6999 | 7260 | else |
---|
7000 | 7261 | e1000e_reset(adapter); |
---|
7001 | 7262 | |
---|
7002 | | - return 0; |
---|
| 7263 | + return 1; |
---|
7003 | 7264 | } |
---|
7004 | 7265 | |
---|
7005 | 7266 | static const struct net_device_ops e1000e_netdev_ops = { |
---|
.. | .. |
---|
7191 | 7452 | NETIF_F_RXCSUM | |
---|
7192 | 7453 | NETIF_F_HW_CSUM); |
---|
7193 | 7454 | |
---|
| 7455 | + /* disable TSO for pcie and 10/100 speeds to avoid |
---|
| 7456 | + * some hardware issues and for i219 to fix transfer |
---|
| 7457 | + * speed being capped at 60% |
---|
| 7458 | + */ |
---|
| 7459 | + if (!(adapter->flags & FLAG_TSO_FORCE)) { |
---|
| 7460 | + switch (adapter->link_speed) { |
---|
| 7461 | + case SPEED_10: |
---|
| 7462 | + case SPEED_100: |
---|
| 7463 | + e_info("10/100 speed: disabling TSO\n"); |
---|
| 7464 | + netdev->features &= ~NETIF_F_TSO; |
---|
| 7465 | + netdev->features &= ~NETIF_F_TSO6; |
---|
| 7466 | + break; |
---|
| 7467 | + case SPEED_1000: |
---|
| 7468 | + netdev->features |= NETIF_F_TSO; |
---|
| 7469 | + netdev->features |= NETIF_F_TSO6; |
---|
| 7470 | + break; |
---|
| 7471 | + default: |
---|
| 7472 | + /* oops */ |
---|
| 7473 | + break; |
---|
| 7474 | + } |
---|
| 7475 | + if (hw->mac.type == e1000_pch_spt) { |
---|
| 7476 | + netdev->features &= ~NETIF_F_TSO; |
---|
| 7477 | + netdev->features &= ~NETIF_F_TSO6; |
---|
| 7478 | + } |
---|
| 7479 | + } |
---|
| 7480 | + |
---|
7194 | 7481 | /* Set user-changeable features (subset of all device features) */ |
---|
7195 | 7482 | netdev->hw_features = netdev->features; |
---|
7196 | 7483 | netdev->hw_features |= NETIF_F_RXFCS; |
---|
.. | .. |
---|
7334 | 7621 | if (!(adapter->flags & FLAG_HAS_AMT)) |
---|
7335 | 7622 | e1000e_get_hw_control(adapter); |
---|
7336 | 7623 | |
---|
| 7624 | + if (hw->mac.type >= e1000_pch_cnp) |
---|
| 7625 | + adapter->flags2 |= FLAG2_ENABLE_S0IX_FLOWS; |
---|
| 7626 | + |
---|
7337 | 7627 | strlcpy(netdev->name, "eth%d", sizeof(netdev->name)); |
---|
7338 | 7628 | err = register_netdev(netdev); |
---|
7339 | 7629 | if (err) |
---|
.. | .. |
---|
7344 | 7634 | |
---|
7345 | 7635 | e1000_print_device_info(adapter); |
---|
7346 | 7636 | |
---|
7347 | | - dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NEVER_SKIP); |
---|
| 7637 | + dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NO_DIRECT_COMPLETE); |
---|
7348 | 7638 | |
---|
7349 | 7639 | if (pci_dev_run_wake(pdev) && hw->mac.type < e1000_pch_cnp) |
---|
7350 | 7640 | pm_runtime_put_noidle(&pdev->dev); |
---|
.. | .. |
---|
7390 | 7680 | { |
---|
7391 | 7681 | struct net_device *netdev = pci_get_drvdata(pdev); |
---|
7392 | 7682 | struct e1000_adapter *adapter = netdev_priv(netdev); |
---|
7393 | | - bool down = test_bit(__E1000_DOWN, &adapter->state); |
---|
7394 | 7683 | |
---|
7395 | 7684 | e1000e_ptp_remove(adapter); |
---|
7396 | 7685 | |
---|
7397 | 7686 | /* The timers may be rescheduled, so explicitly disable them |
---|
7398 | 7687 | * from being rescheduled. |
---|
7399 | 7688 | */ |
---|
7400 | | - if (!down) |
---|
7401 | | - set_bit(__E1000_DOWN, &adapter->state); |
---|
| 7689 | + set_bit(__E1000_DOWN, &adapter->state); |
---|
7402 | 7690 | del_timer_sync(&adapter->watchdog_timer); |
---|
7403 | 7691 | del_timer_sync(&adapter->phy_info_timer); |
---|
7404 | 7692 | |
---|
.. | .. |
---|
7416 | 7704 | } |
---|
7417 | 7705 | } |
---|
7418 | 7706 | |
---|
7419 | | - /* Don't lie to e1000_close() down the road. */ |
---|
7420 | | - if (!down) |
---|
7421 | | - clear_bit(__E1000_DOWN, &adapter->state); |
---|
7422 | 7707 | unregister_netdev(netdev); |
---|
7423 | 7708 | |
---|
7424 | 7709 | if (pci_dev_run_wake(pdev)) |
---|
.. | .. |
---|
7548 | 7833 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ICP_I219_V8), board_pch_cnp }, |
---|
7549 | 7834 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ICP_I219_LM9), board_pch_cnp }, |
---|
7550 | 7835 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ICP_I219_V9), board_pch_cnp }, |
---|
| 7836 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_CMP_I219_LM10), board_pch_cnp }, |
---|
| 7837 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_CMP_I219_V10), board_pch_cnp }, |
---|
| 7838 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_CMP_I219_LM11), board_pch_cnp }, |
---|
| 7839 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_CMP_I219_V11), board_pch_cnp }, |
---|
| 7840 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_CMP_I219_LM12), board_pch_spt }, |
---|
| 7841 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_CMP_I219_V12), board_pch_spt }, |
---|
| 7842 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM13), board_pch_tgp }, |
---|
| 7843 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V13), board_pch_tgp }, |
---|
| 7844 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM14), board_pch_tgp }, |
---|
| 7845 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V14), board_pch_tgp }, |
---|
| 7846 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM15), board_pch_tgp }, |
---|
| 7847 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V15), board_pch_tgp }, |
---|
| 7848 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_tgp }, |
---|
| 7849 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_tgp }, |
---|
| 7850 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_tgp }, |
---|
| 7851 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_tgp }, |
---|
| 7852 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_tgp }, |
---|
| 7853 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_tgp }, |
---|
| 7854 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_tgp }, |
---|
| 7855 | + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_tgp }, |
---|
7551 | 7856 | |
---|
7552 | 7857 | { 0, 0, 0, 0, 0, 0, 0 } /* terminate list */ |
---|
7553 | 7858 | }; |
---|
.. | .. |
---|
7587 | 7892 | **/ |
---|
7588 | 7893 | static int __init e1000_init_module(void) |
---|
7589 | 7894 | { |
---|
7590 | | - pr_info("Intel(R) PRO/1000 Network Driver - %s\n", |
---|
7591 | | - e1000e_driver_version); |
---|
| 7895 | + pr_info("Intel(R) PRO/1000 Network Driver\n"); |
---|
7592 | 7896 | pr_info("Copyright(c) 1999 - 2015 Intel Corporation.\n"); |
---|
7593 | 7897 | |
---|
7594 | 7898 | return pci_register_driver(&e1000_driver); |
---|
.. | .. |
---|
7609 | 7913 | |
---|
7610 | 7914 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); |
---|
7611 | 7915 | MODULE_DESCRIPTION("Intel(R) PRO/1000 Network Driver"); |
---|
7612 | | -MODULE_LICENSE("GPL"); |
---|
7613 | | -MODULE_VERSION(DRV_VERSION); |
---|
| 7916 | +MODULE_LICENSE("GPL v2"); |
---|
7614 | 7917 | |
---|
7615 | 7918 | /* netdev.c */ |
---|