Lines Matching +full:eth +full:- +full:ck
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
35 static int debug = -1;
110 * __ew32_prepare - prepare to write to MAC CSR register on certain parts
125 while ((er32(FWSM) & E1000_ICH_FWSM_PCIM2PCI) && --i) in __ew32_prepare()
131 if (hw->adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA) in __ew32()
134 writel(val, hw->hw_addr + reg); in __ew32()
138 * e1000_regdump - register printout routine
148 switch (reginfo->ofs) { in e1000_regdump()
162 pr_info("%-15s %08x\n", in e1000_regdump()
163 reginfo->name, __er32(hw, reginfo->ofs)); in e1000_regdump()
167 snprintf(rname, 16, "%s%s", reginfo->name, "[0-1]"); in e1000_regdump()
168 pr_info("%-15s %08x %08x\n", rname, regs[0], regs[1]); in e1000_regdump()
177 for (i = 0; i < adapter->rx_ps_pages; i++) { in e1000e_dump_ps_pages()
178 ps_page = &bi->ps_pages[i]; in e1000e_dump_ps_pages()
180 if (ps_page->page) { in e1000e_dump_ps_pages()
183 16, 1, page_address(ps_page->page), in e1000e_dump_ps_pages()
190 * e1000e_dump - Print registers, Tx-ring and Rx-ring
195 struct net_device *netdev = adapter->netdev; in e1000e_dump()
196 struct e1000_hw *hw = &adapter->hw; in e1000e_dump()
198 struct e1000_ring *tx_ring = adapter->tx_ring; in e1000e_dump()
205 struct e1000_ring *rx_ring = adapter->rx_ring; in e1000e_dump()
222 dev_info(&adapter->pdev->dev, "Net device Info\n"); in e1000e_dump()
224 pr_info("%-15s %016lX %016lX\n", netdev->name, in e1000e_dump()
225 netdev->state, dev_trans_start(netdev)); in e1000e_dump()
229 dev_info(&adapter->pdev->dev, "Register Dump\n"); in e1000e_dump()
232 reginfo->name; reginfo++) { in e1000e_dump()
240 dev_info(&adapter->pdev->dev, "Tx Ring Summary\n"); in e1000e_dump()
241 pr_info("Queue [NTU] [NTC] [bi(ntc)->dma ] leng ntw timestamp\n"); in e1000e_dump()
242 buffer_info = &tx_ring->buffer_info[tx_ring->next_to_clean]; in e1000e_dump()
244 0, tx_ring->next_to_use, tx_ring->next_to_clean, in e1000e_dump()
245 (unsigned long long)buffer_info->dma, in e1000e_dump()
246 buffer_info->length, in e1000e_dump()
247 buffer_info->next_to_watch, in e1000e_dump()
248 (unsigned long long)buffer_info->time_stamp); in e1000e_dump()
254 dev_info(&adapter->pdev->dev, "Tx Ring Dump\n"); in e1000e_dump()
256 /* Transmit Descriptor Formats - DEXT[29] is 0 (Legacy) or 1 (Extended) in e1000e_dump()
259 * +--------------------------------------------------------------+ in e1000e_dump()
261 * +--------------------------------------------------------------+ in e1000e_dump()
263 * +--------------------------------------------------------------+ in e1000e_dump()
268 * +----------------------------------------------------------------+ in e1000e_dump()
270 * +----------------------------------------------------------------+ in e1000e_dump()
272 * +----------------------------------------------------------------+ in e1000e_dump()
276 * +----------------------------------------------------------------+ in e1000e_dump()
278 * +----------------------------------------------------------------+ in e1000e_dump()
280 * +----------------------------------------------------------------+ in e1000e_dump()
283 …Tl[desc] [address 63:0 ] [SpeCssSCmCsLen] [bi->dma ] leng ntw timestamp bi->skb… in e1000e_dump()
284 …Tc[desc] [Ce CoCsIpceCoS] [MssHlRSCm0Plen] [bi->dma ] leng ntw timestamp bi->skb… in e1000e_dump()
285 …Td[desc] [address 63:0 ] [VlaPoRSCm1Dlen] [bi->dma ] leng ntw timestamp bi->skb… in e1000e_dump()
286 for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { in e1000e_dump()
289 buffer_info = &tx_ring->buffer_info[i]; in e1000e_dump()
291 if (i == tx_ring->next_to_use && i == tx_ring->next_to_clean) in e1000e_dump()
293 else if (i == tx_ring->next_to_use) in e1000e_dump()
295 else if (i == tx_ring->next_to_clean) in e1000e_dump()
300 (!(le64_to_cpu(u0->b) & BIT(29)) ? 'l' : in e1000e_dump()
301 ((le64_to_cpu(u0->b) & BIT(20)) ? 'd' : 'c')), in e1000e_dump()
303 (unsigned long long)le64_to_cpu(u0->a), in e1000e_dump()
304 (unsigned long long)le64_to_cpu(u0->b), in e1000e_dump()
305 (unsigned long long)buffer_info->dma, in e1000e_dump()
306 buffer_info->length, buffer_info->next_to_watch, in e1000e_dump()
307 (unsigned long long)buffer_info->time_stamp, in e1000e_dump()
308 buffer_info->skb, next_desc); in e1000e_dump()
310 if (netif_msg_pktdata(adapter) && buffer_info->skb) in e1000e_dump()
312 16, 1, buffer_info->skb->data, in e1000e_dump()
313 buffer_info->skb->len, true); in e1000e_dump()
318 dev_info(&adapter->pdev->dev, "Rx Ring Summary\n"); in e1000e_dump()
321 0, rx_ring->next_to_use, rx_ring->next_to_clean); in e1000e_dump()
327 dev_info(&adapter->pdev->dev, "Rx Ring Dump\n"); in e1000e_dump()
328 switch (adapter->rx_ps_pages) { in e1000e_dump()
334 * +-----------------------------------------------------+ in e1000e_dump()
336 * +-----------------------------------------------------+ in e1000e_dump()
338 * +-----------------------------------------------------+ in e1000e_dump()
340 * +-----------------------------------------------------+ in e1000e_dump()
342 * +-----------------------------------------------------+ in e1000e_dump()
344 …0 63:0 ] [buffer 1 63:0 ] [buffer 2 63:0 ] [buffer 3 63:0 ] [bi->dma ] [bi->skb] <-- Ext Pkt… in e1000e_dump()
345 /* [Extended] Receive Descriptor (Write-Back) Format in e1000e_dump()
348 * +------------------------------------------------------+ in e1000e_dump()
351 * +------------------------------------------------------+ in e1000e_dump()
353 * +------------------------------------------------------+ in e1000e_dump()
356 …nfo("RWB[desc] [ck ipid mrqhsh] [vl l0 ee es] [ l3 l2 l1 hs] [reserved ] ----------… in e1000e_dump()
357 for (i = 0; i < rx_ring->count; i++) { in e1000e_dump()
359 buffer_info = &rx_ring->buffer_info[i]; in e1000e_dump()
363 le32_to_cpu(rx_desc_ps->wb.middle.status_error); in e1000e_dump()
365 if (i == rx_ring->next_to_use) in e1000e_dump()
367 else if (i == rx_ring->next_to_clean) in e1000e_dump()
374 pr_info("%s[0x%03X] %016llX %016llX %016llX %016llX ---------------- %p%s\n", in e1000e_dump()
376 (unsigned long long)le64_to_cpu(u1->a), in e1000e_dump()
377 (unsigned long long)le64_to_cpu(u1->b), in e1000e_dump()
378 (unsigned long long)le64_to_cpu(u1->c), in e1000e_dump()
379 (unsigned long long)le64_to_cpu(u1->d), in e1000e_dump()
380 buffer_info->skb, next_desc); in e1000e_dump()
384 (unsigned long long)le64_to_cpu(u1->a), in e1000e_dump()
385 (unsigned long long)le64_to_cpu(u1->b), in e1000e_dump()
386 (unsigned long long)le64_to_cpu(u1->c), in e1000e_dump()
387 (unsigned long long)le64_to_cpu(u1->d), in e1000e_dump()
388 (unsigned long long)buffer_info->dma, in e1000e_dump()
389 buffer_info->skb, next_desc); in e1000e_dump()
401 * +-----------------------------------------------------+ in e1000e_dump()
403 * +-----------------------------------------------------+ in e1000e_dump()
405 * +-----------------------------------------------------+ in e1000e_dump()
407 …pr_info("R [desc] [buf addr 63:0 ] [reserved 63:0 ] [bi->dma ] [bi->skb] <-- Ext (Read… in e1000e_dump()
408 /* Extended Receive Descriptor (Write-Back) Format in e1000e_dump()
411 * +------------------------------------------------------+ in e1000e_dump()
413 * 0 +-------------------+ Rsvd | Reserved | MRQ RSS | in e1000e_dump()
416 * +------------------------------------------------------+ in e1000e_dump()
418 * +------------------------------------------------------+ in e1000e_dump()
421 …pr_info("RWB[desc] [cs ipid mrq] [vt ln xe xs] [bi->skb] <-- Ext (Write-Back) format\n"… in e1000e_dump()
423 for (i = 0; i < rx_ring->count; i++) { in e1000e_dump()
426 buffer_info = &rx_ring->buffer_info[i]; in e1000e_dump()
429 staterr = le32_to_cpu(rx_desc->wb.upper.status_error); in e1000e_dump()
431 if (i == rx_ring->next_to_use) in e1000e_dump()
433 else if (i == rx_ring->next_to_clean) in e1000e_dump()
440 pr_info("%s[0x%03X] %016llX %016llX ---------------- %p%s\n", in e1000e_dump()
442 (unsigned long long)le64_to_cpu(u1->a), in e1000e_dump()
443 (unsigned long long)le64_to_cpu(u1->b), in e1000e_dump()
444 buffer_info->skb, next_desc); in e1000e_dump()
448 (unsigned long long)le64_to_cpu(u1->a), in e1000e_dump()
449 (unsigned long long)le64_to_cpu(u1->b), in e1000e_dump()
450 (unsigned long long)buffer_info->dma, in e1000e_dump()
451 buffer_info->skb, next_desc); in e1000e_dump()
454 buffer_info->skb) in e1000e_dump()
458 buffer_info->skb->data, in e1000e_dump()
459 adapter->rx_buffer_len, in e1000e_dump()
467 * e1000_desc_unused - calculate if we have unused descriptors
472 if (ring->next_to_clean > ring->next_to_use) in e1000_desc_unused()
473 return ring->next_to_clean - ring->next_to_use - 1; in e1000_desc_unused()
475 return ring->count + ring->next_to_clean - ring->next_to_use - 1; in e1000_desc_unused()
479 * e1000e_systim_to_hwtstamp - convert system time value to hw time stamp
499 spin_lock_irqsave(&adapter->systim_lock, flags); in e1000e_systim_to_hwtstamp()
500 ns = timecounter_cyc2time(&adapter->tc, systim); in e1000e_systim_to_hwtstamp()
501 spin_unlock_irqrestore(&adapter->systim_lock, flags); in e1000e_systim_to_hwtstamp()
504 hwtstamps->hwtstamp = ns_to_ktime(ns); in e1000e_systim_to_hwtstamp()
508 * e1000e_rx_hwtstamp - utility function which checks for Rx time stamp
520 struct e1000_hw *hw = &adapter->hw; in e1000e_rx_hwtstamp()
523 if (!(adapter->flags & FLAG_HAS_HW_TIMESTAMP) || in e1000e_rx_hwtstamp()
539 adapter->flags2 &= ~FLAG2_CHECK_RX_HWTSTAMP; in e1000e_rx_hwtstamp()
543 * e1000_receive_skb - helper function to handle Rx indications
558 skb->protocol = eth_type_trans(skb, netdev); in e1000_receive_skb()
563 napi_gro_receive(&adapter->napi, skb); in e1000_receive_skb()
567 * e1000_rx_checksum - Receive Checksum Offload
581 if (!(adapter->netdev->features & NETIF_F_RXCSUM)) in e1000_rx_checksum()
591 adapter->hw_csum_err++; in e1000_rx_checksum()
600 skb->ip_summed = CHECKSUM_UNNECESSARY; in e1000_rx_checksum()
601 adapter->hw_csum_good++; in e1000_rx_checksum()
606 struct e1000_adapter *adapter = rx_ring->adapter; in e1000e_update_rdt_wa()
607 struct e1000_hw *hw = &adapter->hw; in e1000e_update_rdt_wa()
610 writel(i, rx_ring->tail); in e1000e_update_rdt_wa()
612 if (unlikely(i != readl(rx_ring->tail))) { in e1000e_update_rdt_wa()
616 e_err("ME firmware caused invalid RDT - resetting\n"); in e1000e_update_rdt_wa()
617 schedule_work(&adapter->reset_task); in e1000e_update_rdt_wa()
623 struct e1000_adapter *adapter = tx_ring->adapter; in e1000e_update_tdt_wa()
624 struct e1000_hw *hw = &adapter->hw; in e1000e_update_tdt_wa()
627 writel(i, tx_ring->tail); in e1000e_update_tdt_wa()
629 if (unlikely(i != readl(tx_ring->tail))) { in e1000e_update_tdt_wa()
633 e_err("ME firmware caused invalid TDT - resetting\n"); in e1000e_update_tdt_wa()
634 schedule_work(&adapter->reset_task); in e1000e_update_tdt_wa()
639 * e1000_alloc_rx_buffers - Replace used receive buffers
647 struct e1000_adapter *adapter = rx_ring->adapter; in e1000_alloc_rx_buffers()
648 struct net_device *netdev = adapter->netdev; in e1000_alloc_rx_buffers()
649 struct pci_dev *pdev = adapter->pdev; in e1000_alloc_rx_buffers()
654 unsigned int bufsz = adapter->rx_buffer_len; in e1000_alloc_rx_buffers()
656 i = rx_ring->next_to_use; in e1000_alloc_rx_buffers()
657 buffer_info = &rx_ring->buffer_info[i]; in e1000_alloc_rx_buffers()
659 while (cleaned_count--) { in e1000_alloc_rx_buffers()
660 skb = buffer_info->skb; in e1000_alloc_rx_buffers()
669 adapter->alloc_rx_buff_failed++; in e1000_alloc_rx_buffers()
673 buffer_info->skb = skb; in e1000_alloc_rx_buffers()
675 buffer_info->dma = dma_map_single(&pdev->dev, skb->data, in e1000_alloc_rx_buffers()
676 adapter->rx_buffer_len, in e1000_alloc_rx_buffers()
678 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { in e1000_alloc_rx_buffers()
679 dev_err(&pdev->dev, "Rx DMA map failed\n"); in e1000_alloc_rx_buffers()
680 adapter->rx_dma_failed++; in e1000_alloc_rx_buffers()
685 rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma); in e1000_alloc_rx_buffers()
687 if (unlikely(!(i & (E1000_RX_BUFFER_WRITE - 1)))) { in e1000_alloc_rx_buffers()
690 * applicable for weak-ordered memory model archs, in e1000_alloc_rx_buffers()
691 * such as IA-64). in e1000_alloc_rx_buffers()
694 if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA) in e1000_alloc_rx_buffers()
697 writel(i, rx_ring->tail); in e1000_alloc_rx_buffers()
700 if (i == rx_ring->count) in e1000_alloc_rx_buffers()
702 buffer_info = &rx_ring->buffer_info[i]; in e1000_alloc_rx_buffers()
705 rx_ring->next_to_use = i; in e1000_alloc_rx_buffers()
709 * e1000_alloc_rx_buffers_ps - Replace used receive buffers; packet split
717 struct e1000_adapter *adapter = rx_ring->adapter; in e1000_alloc_rx_buffers_ps()
718 struct net_device *netdev = adapter->netdev; in e1000_alloc_rx_buffers_ps()
719 struct pci_dev *pdev = adapter->pdev; in e1000_alloc_rx_buffers_ps()
726 i = rx_ring->next_to_use; in e1000_alloc_rx_buffers_ps()
727 buffer_info = &rx_ring->buffer_info[i]; in e1000_alloc_rx_buffers_ps()
729 while (cleaned_count--) { in e1000_alloc_rx_buffers_ps()
733 ps_page = &buffer_info->ps_pages[j]; in e1000_alloc_rx_buffers_ps()
734 if (j >= adapter->rx_ps_pages) { in e1000_alloc_rx_buffers_ps()
736 rx_desc->read.buffer_addr[j + 1] = in e1000_alloc_rx_buffers_ps()
740 if (!ps_page->page) { in e1000_alloc_rx_buffers_ps()
741 ps_page->page = alloc_page(gfp); in e1000_alloc_rx_buffers_ps()
742 if (!ps_page->page) { in e1000_alloc_rx_buffers_ps()
743 adapter->alloc_rx_buff_failed++; in e1000_alloc_rx_buffers_ps()
746 ps_page->dma = dma_map_page(&pdev->dev, in e1000_alloc_rx_buffers_ps()
747 ps_page->page, in e1000_alloc_rx_buffers_ps()
750 if (dma_mapping_error(&pdev->dev, in e1000_alloc_rx_buffers_ps()
751 ps_page->dma)) { in e1000_alloc_rx_buffers_ps()
752 dev_err(&adapter->pdev->dev, in e1000_alloc_rx_buffers_ps()
754 adapter->rx_dma_failed++; in e1000_alloc_rx_buffers_ps()
759 * didn't change because each write-back in e1000_alloc_rx_buffers_ps()
762 rx_desc->read.buffer_addr[j + 1] = in e1000_alloc_rx_buffers_ps()
763 cpu_to_le64(ps_page->dma); in e1000_alloc_rx_buffers_ps()
766 skb = __netdev_alloc_skb_ip_align(netdev, adapter->rx_ps_bsize0, in e1000_alloc_rx_buffers_ps()
770 adapter->alloc_rx_buff_failed++; in e1000_alloc_rx_buffers_ps()
774 buffer_info->skb = skb; in e1000_alloc_rx_buffers_ps()
775 buffer_info->dma = dma_map_single(&pdev->dev, skb->data, in e1000_alloc_rx_buffers_ps()
776 adapter->rx_ps_bsize0, in e1000_alloc_rx_buffers_ps()
778 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { in e1000_alloc_rx_buffers_ps()
779 dev_err(&pdev->dev, "Rx DMA map failed\n"); in e1000_alloc_rx_buffers_ps()
780 adapter->rx_dma_failed++; in e1000_alloc_rx_buffers_ps()
783 buffer_info->skb = NULL; in e1000_alloc_rx_buffers_ps()
787 rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma); in e1000_alloc_rx_buffers_ps()
789 if (unlikely(!(i & (E1000_RX_BUFFER_WRITE - 1)))) { in e1000_alloc_rx_buffers_ps()
792 * applicable for weak-ordered memory model archs, in e1000_alloc_rx_buffers_ps()
793 * such as IA-64). in e1000_alloc_rx_buffers_ps()
796 if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA) in e1000_alloc_rx_buffers_ps()
799 writel(i << 1, rx_ring->tail); in e1000_alloc_rx_buffers_ps()
803 if (i == rx_ring->count) in e1000_alloc_rx_buffers_ps()
805 buffer_info = &rx_ring->buffer_info[i]; in e1000_alloc_rx_buffers_ps()
809 rx_ring->next_to_use = i; in e1000_alloc_rx_buffers_ps()
813 * e1000_alloc_jumbo_rx_buffers - Replace used jumbo receive buffers
822 struct e1000_adapter *adapter = rx_ring->adapter; in e1000_alloc_jumbo_rx_buffers()
823 struct net_device *netdev = adapter->netdev; in e1000_alloc_jumbo_rx_buffers()
824 struct pci_dev *pdev = adapter->pdev; in e1000_alloc_jumbo_rx_buffers()
829 unsigned int bufsz = 256 - 16; /* for skb_reserve */ in e1000_alloc_jumbo_rx_buffers()
831 i = rx_ring->next_to_use; in e1000_alloc_jumbo_rx_buffers()
832 buffer_info = &rx_ring->buffer_info[i]; in e1000_alloc_jumbo_rx_buffers()
834 while (cleaned_count--) { in e1000_alloc_jumbo_rx_buffers()
835 skb = buffer_info->skb; in e1000_alloc_jumbo_rx_buffers()
844 adapter->alloc_rx_buff_failed++; in e1000_alloc_jumbo_rx_buffers()
848 buffer_info->skb = skb; in e1000_alloc_jumbo_rx_buffers()
851 if (!buffer_info->page) { in e1000_alloc_jumbo_rx_buffers()
852 buffer_info->page = alloc_page(gfp); in e1000_alloc_jumbo_rx_buffers()
853 if (unlikely(!buffer_info->page)) { in e1000_alloc_jumbo_rx_buffers()
854 adapter->alloc_rx_buff_failed++; in e1000_alloc_jumbo_rx_buffers()
859 if (!buffer_info->dma) { in e1000_alloc_jumbo_rx_buffers()
860 buffer_info->dma = dma_map_page(&pdev->dev, in e1000_alloc_jumbo_rx_buffers()
861 buffer_info->page, 0, in e1000_alloc_jumbo_rx_buffers()
864 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { in e1000_alloc_jumbo_rx_buffers()
865 adapter->alloc_rx_buff_failed++; in e1000_alloc_jumbo_rx_buffers()
871 rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma); in e1000_alloc_jumbo_rx_buffers()
873 if (unlikely(++i == rx_ring->count)) in e1000_alloc_jumbo_rx_buffers()
875 buffer_info = &rx_ring->buffer_info[i]; in e1000_alloc_jumbo_rx_buffers()
878 if (likely(rx_ring->next_to_use != i)) { in e1000_alloc_jumbo_rx_buffers()
879 rx_ring->next_to_use = i; in e1000_alloc_jumbo_rx_buffers()
880 if (unlikely(i-- == 0)) in e1000_alloc_jumbo_rx_buffers()
881 i = (rx_ring->count - 1); in e1000_alloc_jumbo_rx_buffers()
885 * applicable for weak-ordered memory model archs, in e1000_alloc_jumbo_rx_buffers()
886 * such as IA-64). in e1000_alloc_jumbo_rx_buffers()
889 if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA) in e1000_alloc_jumbo_rx_buffers()
892 writel(i, rx_ring->tail); in e1000_alloc_jumbo_rx_buffers()
899 if (netdev->features & NETIF_F_RXHASH) in e1000_rx_hash()
904 * e1000_clean_rx_irq - Send received data up the network stack
915 struct e1000_adapter *adapter = rx_ring->adapter; in e1000_clean_rx_irq()
916 struct net_device *netdev = adapter->netdev; in e1000_clean_rx_irq()
917 struct pci_dev *pdev = adapter->pdev; in e1000_clean_rx_irq()
918 struct e1000_hw *hw = &adapter->hw; in e1000_clean_rx_irq()
927 i = rx_ring->next_to_clean; in e1000_clean_rx_irq()
929 staterr = le32_to_cpu(rx_desc->wb.upper.status_error); in e1000_clean_rx_irq()
930 buffer_info = &rx_ring->buffer_info[i]; in e1000_clean_rx_irq()
940 skb = buffer_info->skb; in e1000_clean_rx_irq()
941 buffer_info->skb = NULL; in e1000_clean_rx_irq()
943 prefetch(skb->data - NET_IP_ALIGN); in e1000_clean_rx_irq()
946 if (i == rx_ring->count) in e1000_clean_rx_irq()
951 next_buffer = &rx_ring->buffer_info[i]; in e1000_clean_rx_irq()
955 dma_unmap_single(&pdev->dev, buffer_info->dma, in e1000_clean_rx_irq()
956 adapter->rx_buffer_len, DMA_FROM_DEVICE); in e1000_clean_rx_irq()
957 buffer_info->dma = 0; in e1000_clean_rx_irq()
959 length = le16_to_cpu(rx_desc->wb.upper.length); in e1000_clean_rx_irq()
968 adapter->flags2 |= FLAG2_IS_DISCARDING; in e1000_clean_rx_irq()
970 if (adapter->flags2 & FLAG2_IS_DISCARDING) { in e1000_clean_rx_irq()
974 buffer_info->skb = skb; in e1000_clean_rx_irq()
976 adapter->flags2 &= ~FLAG2_IS_DISCARDING; in e1000_clean_rx_irq()
981 !(netdev->features & NETIF_F_RXALL))) { in e1000_clean_rx_irq()
983 buffer_info->skb = skb; in e1000_clean_rx_irq()
988 if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) { in e1000_clean_rx_irq()
993 if (netdev->features & NETIF_F_RXFCS) in e1000_clean_rx_irq()
994 total_rx_bytes -= 4; in e1000_clean_rx_irq()
996 length -= 4; in e1000_clean_rx_irq()
1008 napi_alloc_skb(&adapter->napi, length); in e1000_clean_rx_irq()
1011 -NET_IP_ALIGN, in e1000_clean_rx_irq()
1012 (skb->data - in e1000_clean_rx_irq()
1017 buffer_info->skb = skb; in e1000_clean_rx_irq()
1028 e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); in e1000_clean_rx_irq()
1031 rx_desc->wb.upper.vlan); in e1000_clean_rx_irq()
1034 rx_desc->wb.upper.status_error &= cpu_to_le32(~0xFF); in e1000_clean_rx_irq()
1038 adapter->alloc_rx_buf(rx_ring, cleaned_count, in e1000_clean_rx_irq()
1047 staterr = le32_to_cpu(rx_desc->wb.upper.status_error); in e1000_clean_rx_irq()
1049 rx_ring->next_to_clean = i; in e1000_clean_rx_irq()
1053 adapter->alloc_rx_buf(rx_ring, cleaned_count, GFP_ATOMIC); in e1000_clean_rx_irq()
1055 adapter->total_rx_bytes += total_rx_bytes; in e1000_clean_rx_irq()
1056 adapter->total_rx_packets += total_rx_packets; in e1000_clean_rx_irq()
1064 struct e1000_adapter *adapter = tx_ring->adapter; in e1000_put_txbuf()
1066 if (buffer_info->dma) { in e1000_put_txbuf()
1067 if (buffer_info->mapped_as_page) in e1000_put_txbuf()
1068 dma_unmap_page(&adapter->pdev->dev, buffer_info->dma, in e1000_put_txbuf()
1069 buffer_info->length, DMA_TO_DEVICE); in e1000_put_txbuf()
1071 dma_unmap_single(&adapter->pdev->dev, buffer_info->dma, in e1000_put_txbuf()
1072 buffer_info->length, DMA_TO_DEVICE); in e1000_put_txbuf()
1073 buffer_info->dma = 0; in e1000_put_txbuf()
1075 if (buffer_info->skb) { in e1000_put_txbuf()
1077 dev_kfree_skb_any(buffer_info->skb); in e1000_put_txbuf()
1079 dev_consume_skb_any(buffer_info->skb); in e1000_put_txbuf()
1080 buffer_info->skb = NULL; in e1000_put_txbuf()
1082 buffer_info->time_stamp = 0; in e1000_put_txbuf()
1090 struct net_device *netdev = adapter->netdev; in e1000_print_hw_hang()
1091 struct e1000_ring *tx_ring = adapter->tx_ring; in e1000_print_hw_hang()
1092 unsigned int i = tx_ring->next_to_clean; in e1000_print_hw_hang()
1093 unsigned int eop = tx_ring->buffer_info[i].next_to_watch; in e1000_print_hw_hang()
1095 struct e1000_hw *hw = &adapter->hw; in e1000_print_hw_hang()
1099 if (test_bit(__E1000_DOWN, &adapter->state)) in e1000_print_hw_hang()
1102 if (!adapter->tx_hang_recheck && (adapter->flags2 & FLAG2_DMA_BURST)) { in e1000_print_hw_hang()
1103 /* May be block on write-back, flush and detect again in e1000_print_hw_hang()
1106 ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); in e1000_print_hw_hang()
1112 ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); in e1000_print_hw_hang()
1115 adapter->tx_hang_recheck = true; in e1000_print_hw_hang()
1118 adapter->tx_hang_recheck = false; in e1000_print_hw_hang()
1132 pci_read_config_word(adapter->pdev, PCI_STATUS, &pci_status); in e1000_print_hw_hang()
1147 "PHY 1000BASE-T Status <%x>\n" in e1000_print_hw_hang()
1150 readl(tx_ring->head), readl(tx_ring->tail), tx_ring->next_to_use, in e1000_print_hw_hang()
1151 tx_ring->next_to_clean, tx_ring->buffer_info[eop].time_stamp, in e1000_print_hw_hang()
1152 eop, jiffies, eop_desc->upper.fields.status, er32(STATUS), in e1000_print_hw_hang()
1158 if ((hw->mac.type == e1000_pchlan) && (er32(CTRL) & E1000_CTRL_TFCE)) in e1000_print_hw_hang()
1163 * e1000e_tx_hwtstamp_work - check for Tx time stamp
1174 struct e1000_hw *hw = &adapter->hw; in e1000e_tx_hwtstamp_work()
1177 struct sk_buff *skb = adapter->tx_hwtstamp_skb; in e1000e_tx_hwtstamp_work()
1189 adapter->tx_hwtstamp_skb = NULL; in e1000e_tx_hwtstamp_work()
1194 } else if (time_after(jiffies, adapter->tx_hwtstamp_start in e1000e_tx_hwtstamp_work()
1195 + adapter->tx_timeout_factor * HZ)) { in e1000e_tx_hwtstamp_work()
1196 dev_kfree_skb_any(adapter->tx_hwtstamp_skb); in e1000e_tx_hwtstamp_work()
1197 adapter->tx_hwtstamp_skb = NULL; in e1000e_tx_hwtstamp_work()
1198 adapter->tx_hwtstamp_timeouts++; in e1000e_tx_hwtstamp_work()
1202 schedule_work(&adapter->tx_hwtstamp_work); in e1000e_tx_hwtstamp_work()
1207 * e1000_clean_tx_irq - Reclaim resources after transmit completes
1215 struct e1000_adapter *adapter = tx_ring->adapter; in e1000_clean_tx_irq()
1216 struct net_device *netdev = adapter->netdev; in e1000_clean_tx_irq()
1217 struct e1000_hw *hw = &adapter->hw; in e1000_clean_tx_irq()
1225 i = tx_ring->next_to_clean; in e1000_clean_tx_irq()
1226 eop = tx_ring->buffer_info[i].next_to_watch; in e1000_clean_tx_irq()
1229 while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && in e1000_clean_tx_irq()
1230 (count < tx_ring->count)) { in e1000_clean_tx_irq()
1236 buffer_info = &tx_ring->buffer_info[i]; in e1000_clean_tx_irq()
1240 total_tx_packets += buffer_info->segs; in e1000_clean_tx_irq()
1241 total_tx_bytes += buffer_info->bytecount; in e1000_clean_tx_irq()
1242 if (buffer_info->skb) { in e1000_clean_tx_irq()
1243 bytes_compl += buffer_info->skb->len; in e1000_clean_tx_irq()
1249 tx_desc->upper.data = 0; in e1000_clean_tx_irq()
1252 if (i == tx_ring->count) in e1000_clean_tx_irq()
1256 if (i == tx_ring->next_to_use) in e1000_clean_tx_irq()
1258 eop = tx_ring->buffer_info[i].next_to_watch; in e1000_clean_tx_irq()
1262 tx_ring->next_to_clean = i; in e1000_clean_tx_irq()
1275 !(test_bit(__E1000_DOWN, &adapter->state))) { in e1000_clean_tx_irq()
1277 ++adapter->restart_queue; in e1000_clean_tx_irq()
1281 if (adapter->detect_tx_hung) { in e1000_clean_tx_irq()
1285 adapter->detect_tx_hung = false; in e1000_clean_tx_irq()
1286 if (tx_ring->buffer_info[i].time_stamp && in e1000_clean_tx_irq()
1287 time_after(jiffies, tx_ring->buffer_info[i].time_stamp in e1000_clean_tx_irq()
1288 + (adapter->tx_timeout_factor * HZ)) && in e1000_clean_tx_irq()
1290 schedule_work(&adapter->print_hang_task); in e1000_clean_tx_irq()
1292 adapter->tx_hang_recheck = false; in e1000_clean_tx_irq()
1294 adapter->total_tx_bytes += total_tx_bytes; in e1000_clean_tx_irq()
1295 adapter->total_tx_packets += total_tx_packets; in e1000_clean_tx_irq()
1296 return count < tx_ring->count; in e1000_clean_tx_irq()
1300 * e1000_clean_rx_irq_ps - Send received data up the network stack; packet split
1311 struct e1000_adapter *adapter = rx_ring->adapter; in e1000_clean_rx_irq_ps()
1312 struct e1000_hw *hw = &adapter->hw; in e1000_clean_rx_irq_ps()
1314 struct net_device *netdev = adapter->netdev; in e1000_clean_rx_irq_ps()
1315 struct pci_dev *pdev = adapter->pdev; in e1000_clean_rx_irq_ps()
1325 i = rx_ring->next_to_clean; in e1000_clean_rx_irq_ps()
1327 staterr = le32_to_cpu(rx_desc->wb.middle.status_error); in e1000_clean_rx_irq_ps()
1328 buffer_info = &rx_ring->buffer_info[i]; in e1000_clean_rx_irq_ps()
1334 skb = buffer_info->skb; in e1000_clean_rx_irq_ps()
1338 prefetch(skb->data - NET_IP_ALIGN); in e1000_clean_rx_irq_ps()
1341 if (i == rx_ring->count) in e1000_clean_rx_irq_ps()
1346 next_buffer = &rx_ring->buffer_info[i]; in e1000_clean_rx_irq_ps()
1350 dma_unmap_single(&pdev->dev, buffer_info->dma, in e1000_clean_rx_irq_ps()
1351 adapter->rx_ps_bsize0, DMA_FROM_DEVICE); in e1000_clean_rx_irq_ps()
1352 buffer_info->dma = 0; in e1000_clean_rx_irq_ps()
1356 adapter->flags2 |= FLAG2_IS_DISCARDING; in e1000_clean_rx_irq_ps()
1358 if (adapter->flags2 & FLAG2_IS_DISCARDING) { in e1000_clean_rx_irq_ps()
1362 adapter->flags2 &= ~FLAG2_IS_DISCARDING; in e1000_clean_rx_irq_ps()
1367 !(netdev->features & NETIF_F_RXALL))) { in e1000_clean_rx_irq_ps()
1372 length = le16_to_cpu(rx_desc->wb.middle.length0); in e1000_clean_rx_irq_ps()
1387 int l1 = le16_to_cpu(rx_desc->wb.upper.length[0]); in e1000_clean_rx_irq_ps()
1395 ((length + l1) <= adapter->rx_ps_bsize0)) { in e1000_clean_rx_irq_ps()
1398 ps_page = &buffer_info->ps_pages[0]; in e1000_clean_rx_irq_ps()
1404 dma_sync_single_for_cpu(&pdev->dev, in e1000_clean_rx_irq_ps()
1405 ps_page->dma, in e1000_clean_rx_irq_ps()
1408 vaddr = kmap_atomic(ps_page->page); in e1000_clean_rx_irq_ps()
1411 dma_sync_single_for_device(&pdev->dev, in e1000_clean_rx_irq_ps()
1412 ps_page->dma, in e1000_clean_rx_irq_ps()
1417 if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) { in e1000_clean_rx_irq_ps()
1418 if (!(netdev->features & NETIF_F_RXFCS)) in e1000_clean_rx_irq_ps()
1419 l1 -= 4; in e1000_clean_rx_irq_ps()
1428 length = le16_to_cpu(rx_desc->wb.upper.length[j]); in e1000_clean_rx_irq_ps()
1432 ps_page = &buffer_info->ps_pages[j]; in e1000_clean_rx_irq_ps()
1433 dma_unmap_page(&pdev->dev, ps_page->dma, PAGE_SIZE, in e1000_clean_rx_irq_ps()
1435 ps_page->dma = 0; in e1000_clean_rx_irq_ps()
1436 skb_fill_page_desc(skb, j, ps_page->page, 0, length); in e1000_clean_rx_irq_ps()
1437 ps_page->page = NULL; in e1000_clean_rx_irq_ps()
1438 skb->len += length; in e1000_clean_rx_irq_ps()
1439 skb->data_len += length; in e1000_clean_rx_irq_ps()
1440 skb->truesize += PAGE_SIZE; in e1000_clean_rx_irq_ps()
1446 if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) { in e1000_clean_rx_irq_ps()
1447 if (!(netdev->features & NETIF_F_RXFCS)) in e1000_clean_rx_irq_ps()
1448 pskb_trim(skb, skb->len - 4); in e1000_clean_rx_irq_ps()
1452 total_rx_bytes += skb->len; in e1000_clean_rx_irq_ps()
1457 e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); in e1000_clean_rx_irq_ps()
1459 if (rx_desc->wb.upper.header_status & in e1000_clean_rx_irq_ps()
1461 adapter->rx_hdr_split++; in e1000_clean_rx_irq_ps()
1464 rx_desc->wb.middle.vlan); in e1000_clean_rx_irq_ps()
1467 rx_desc->wb.middle.status_error &= cpu_to_le32(~0xFF); in e1000_clean_rx_irq_ps()
1468 buffer_info->skb = NULL; in e1000_clean_rx_irq_ps()
1472 adapter->alloc_rx_buf(rx_ring, cleaned_count, in e1000_clean_rx_irq_ps()
1481 staterr = le32_to_cpu(rx_desc->wb.middle.status_error); in e1000_clean_rx_irq_ps()
1483 rx_ring->next_to_clean = i; in e1000_clean_rx_irq_ps()
1487 adapter->alloc_rx_buf(rx_ring, cleaned_count, GFP_ATOMIC); in e1000_clean_rx_irq_ps()
1489 adapter->total_rx_bytes += total_rx_bytes; in e1000_clean_rx_irq_ps()
1490 adapter->total_rx_packets += total_rx_packets; in e1000_clean_rx_irq_ps()
1497 bi->page = NULL; in e1000_consume_page()
1498 skb->len += length; in e1000_consume_page()
1499 skb->data_len += length; in e1000_consume_page()
1500 skb->truesize += PAGE_SIZE; in e1000_consume_page()
1504 * e1000_clean_jumbo_rx_irq - Send received data up the network stack; legacy
1515 struct e1000_adapter *adapter = rx_ring->adapter; in e1000_clean_jumbo_rx_irq()
1516 struct net_device *netdev = adapter->netdev; in e1000_clean_jumbo_rx_irq()
1517 struct pci_dev *pdev = adapter->pdev; in e1000_clean_jumbo_rx_irq()
1527 i = rx_ring->next_to_clean; in e1000_clean_jumbo_rx_irq()
1529 staterr = le32_to_cpu(rx_desc->wb.upper.status_error); in e1000_clean_jumbo_rx_irq()
1530 buffer_info = &rx_ring->buffer_info[i]; in e1000_clean_jumbo_rx_irq()
1540 skb = buffer_info->skb; in e1000_clean_jumbo_rx_irq()
1541 buffer_info->skb = NULL; in e1000_clean_jumbo_rx_irq()
1544 if (i == rx_ring->count) in e1000_clean_jumbo_rx_irq()
1549 next_buffer = &rx_ring->buffer_info[i]; in e1000_clean_jumbo_rx_irq()
1553 dma_unmap_page(&pdev->dev, buffer_info->dma, PAGE_SIZE, in e1000_clean_jumbo_rx_irq()
1555 buffer_info->dma = 0; in e1000_clean_jumbo_rx_irq()
1557 length = le16_to_cpu(rx_desc->wb.upper.length); in e1000_clean_jumbo_rx_irq()
1562 !(netdev->features & NETIF_F_RXALL)))) { in e1000_clean_jumbo_rx_irq()
1564 buffer_info->skb = skb; in e1000_clean_jumbo_rx_irq()
1566 if (rx_ring->rx_skb_top) in e1000_clean_jumbo_rx_irq()
1567 dev_kfree_skb_irq(rx_ring->rx_skb_top); in e1000_clean_jumbo_rx_irq()
1568 rx_ring->rx_skb_top = NULL; in e1000_clean_jumbo_rx_irq()
1571 #define rxtop (rx_ring->rx_skb_top) in e1000_clean_jumbo_rx_irq()
1577 skb_fill_page_desc(rxtop, 0, buffer_info->page, in e1000_clean_jumbo_rx_irq()
1582 skb_fill_page_desc(rxtop, shinfo->nr_frags, in e1000_clean_jumbo_rx_irq()
1583 buffer_info->page, 0, in e1000_clean_jumbo_rx_irq()
1585 /* re-use the skb, only consumed the page */ in e1000_clean_jumbo_rx_irq()
1586 buffer_info->skb = skb; in e1000_clean_jumbo_rx_irq()
1594 skb_fill_page_desc(rxtop, shinfo->nr_frags, in e1000_clean_jumbo_rx_irq()
1595 buffer_info->page, 0, in e1000_clean_jumbo_rx_irq()
1597 /* re-use the current skb, we only consumed the in e1000_clean_jumbo_rx_irq()
1600 buffer_info->skb = skb; in e1000_clean_jumbo_rx_irq()
1611 vaddr = kmap_atomic(buffer_info->page); in e1000_clean_jumbo_rx_irq()
1615 /* re-use the page, so don't erase in e1000_clean_jumbo_rx_irq()
1616 * buffer_info->page in e1000_clean_jumbo_rx_irq()
1621 buffer_info->page, 0, in e1000_clean_jumbo_rx_irq()
1632 e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); in e1000_clean_jumbo_rx_irq()
1635 total_rx_bytes += skb->len; in e1000_clean_jumbo_rx_irq()
1638 /* eth type trans needs skb->data to point to something */ in e1000_clean_jumbo_rx_irq()
1646 rx_desc->wb.upper.vlan); in e1000_clean_jumbo_rx_irq()
1649 rx_desc->wb.upper.status_error &= cpu_to_le32(~0xFF); in e1000_clean_jumbo_rx_irq()
1653 adapter->alloc_rx_buf(rx_ring, cleaned_count, in e1000_clean_jumbo_rx_irq()
1662 staterr = le32_to_cpu(rx_desc->wb.upper.status_error); in e1000_clean_jumbo_rx_irq()
1664 rx_ring->next_to_clean = i; in e1000_clean_jumbo_rx_irq()
1668 adapter->alloc_rx_buf(rx_ring, cleaned_count, GFP_ATOMIC); in e1000_clean_jumbo_rx_irq()
1670 adapter->total_rx_bytes += total_rx_bytes; in e1000_clean_jumbo_rx_irq()
1671 adapter->total_rx_packets += total_rx_packets; in e1000_clean_jumbo_rx_irq()
1676 * e1000_clean_rx_ring - Free Rx Buffers per Queue
1681 struct e1000_adapter *adapter = rx_ring->adapter; in e1000_clean_rx_ring()
1684 struct pci_dev *pdev = adapter->pdev; in e1000_clean_rx_ring()
1688 for (i = 0; i < rx_ring->count; i++) { in e1000_clean_rx_ring()
1689 buffer_info = &rx_ring->buffer_info[i]; in e1000_clean_rx_ring()
1690 if (buffer_info->dma) { in e1000_clean_rx_ring()
1691 if (adapter->clean_rx == e1000_clean_rx_irq) in e1000_clean_rx_ring()
1692 dma_unmap_single(&pdev->dev, buffer_info->dma, in e1000_clean_rx_ring()
1693 adapter->rx_buffer_len, in e1000_clean_rx_ring()
1695 else if (adapter->clean_rx == e1000_clean_jumbo_rx_irq) in e1000_clean_rx_ring()
1696 dma_unmap_page(&pdev->dev, buffer_info->dma, in e1000_clean_rx_ring()
1698 else if (adapter->clean_rx == e1000_clean_rx_irq_ps) in e1000_clean_rx_ring()
1699 dma_unmap_single(&pdev->dev, buffer_info->dma, in e1000_clean_rx_ring()
1700 adapter->rx_ps_bsize0, in e1000_clean_rx_ring()
1702 buffer_info->dma = 0; in e1000_clean_rx_ring()
1705 if (buffer_info->page) { in e1000_clean_rx_ring()
1706 put_page(buffer_info->page); in e1000_clean_rx_ring()
1707 buffer_info->page = NULL; in e1000_clean_rx_ring()
1710 if (buffer_info->skb) { in e1000_clean_rx_ring()
1711 dev_kfree_skb(buffer_info->skb); in e1000_clean_rx_ring()
1712 buffer_info->skb = NULL; in e1000_clean_rx_ring()
1716 ps_page = &buffer_info->ps_pages[j]; in e1000_clean_rx_ring()
1717 if (!ps_page->page) in e1000_clean_rx_ring()
1719 dma_unmap_page(&pdev->dev, ps_page->dma, PAGE_SIZE, in e1000_clean_rx_ring()
1721 ps_page->dma = 0; in e1000_clean_rx_ring()
1722 put_page(ps_page->page); in e1000_clean_rx_ring()
1723 ps_page->page = NULL; in e1000_clean_rx_ring()
1728 if (rx_ring->rx_skb_top) { in e1000_clean_rx_ring()
1729 dev_kfree_skb(rx_ring->rx_skb_top); in e1000_clean_rx_ring()
1730 rx_ring->rx_skb_top = NULL; in e1000_clean_rx_ring()
1734 memset(rx_ring->desc, 0, rx_ring->size); in e1000_clean_rx_ring()
1736 rx_ring->next_to_clean = 0; in e1000_clean_rx_ring()
1737 rx_ring->next_to_use = 0; in e1000_clean_rx_ring()
1738 adapter->flags2 &= ~FLAG2_IS_DISCARDING; in e1000_clean_rx_ring()
1747 if (test_bit(__E1000_DOWN, &adapter->state)) in e1000e_downshift_workaround()
1750 e1000e_gig_downshift_workaround_ich8lan(&adapter->hw); in e1000e_downshift_workaround()
1754 * e1000_intr_msi - Interrupt Handler
1762 struct e1000_hw *hw = &adapter->hw; in e1000_intr_msi()
1767 hw->mac.get_link_status = true; in e1000_intr_msi()
1768 /* ICH8 workaround-- Call gig speed drop workaround on cable in e1000_intr_msi()
1771 if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && in e1000_intr_msi()
1773 schedule_work(&adapter->downshift_task); in e1000_intr_msi()
1775 /* 80003ES2LAN workaround-- For packet buffer work-around on in e1000_intr_msi()
1780 adapter->flags & FLAG_RX_NEEDS_RESTART) { in e1000_intr_msi()
1785 adapter->flags |= FLAG_RESTART_NOW; in e1000_intr_msi()
1788 if (!test_bit(__E1000_DOWN, &adapter->state)) in e1000_intr_msi()
1789 mod_timer(&adapter->watchdog_timer, jiffies + 1); in e1000_intr_msi()
1793 if ((icr & E1000_ICR_ECCER) && (hw->mac.type >= e1000_pch_lpt)) { in e1000_intr_msi()
1796 adapter->corr_errors += in e1000_intr_msi()
1798 adapter->uncorr_errors += in e1000_intr_msi()
1803 schedule_work(&adapter->reset_task); in e1000_intr_msi()
1809 if (napi_schedule_prep(&adapter->napi)) { in e1000_intr_msi()
1810 adapter->total_tx_bytes = 0; in e1000_intr_msi()
1811 adapter->total_tx_packets = 0; in e1000_intr_msi()
1812 adapter->total_rx_bytes = 0; in e1000_intr_msi()
1813 adapter->total_rx_packets = 0; in e1000_intr_msi()
1814 __napi_schedule(&adapter->napi); in e1000_intr_msi()
1821 * e1000_intr - Interrupt Handler
1829 struct e1000_hw *hw = &adapter->hw; in e1000_intr()
1832 if (!icr || test_bit(__E1000_DOWN, &adapter->state)) in e1000_intr()
1835 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is in e1000_intr()
1841 /* Interrupt Auto-Mask...upon reading ICR, in e1000_intr()
1847 hw->mac.get_link_status = true; in e1000_intr()
1848 /* ICH8 workaround-- Call gig speed drop workaround on cable in e1000_intr()
1851 if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && in e1000_intr()
1853 schedule_work(&adapter->downshift_task); in e1000_intr()
1855 /* 80003ES2LAN workaround-- in e1000_intr()
1856 * For packet buffer work-around on link down event; in e1000_intr()
1861 (adapter->flags & FLAG_RX_NEEDS_RESTART)) { in e1000_intr()
1865 adapter->flags |= FLAG_RESTART_NOW; in e1000_intr()
1868 if (!test_bit(__E1000_DOWN, &adapter->state)) in e1000_intr()
1869 mod_timer(&adapter->watchdog_timer, jiffies + 1); in e1000_intr()
1873 if ((icr & E1000_ICR_ECCER) && (hw->mac.type >= e1000_pch_lpt)) { in e1000_intr()
1876 adapter->corr_errors += in e1000_intr()
1878 adapter->uncorr_errors += in e1000_intr()
1883 schedule_work(&adapter->reset_task); in e1000_intr()
1889 if (napi_schedule_prep(&adapter->napi)) { in e1000_intr()
1890 adapter->total_tx_bytes = 0; in e1000_intr()
1891 adapter->total_tx_packets = 0; in e1000_intr()
1892 adapter->total_rx_bytes = 0; in e1000_intr()
1893 adapter->total_rx_packets = 0; in e1000_intr()
1894 __napi_schedule(&adapter->napi); in e1000_intr()
1904 struct e1000_hw *hw = &adapter->hw; in e1000_msix_other()
1907 if (icr & adapter->eiac_mask) in e1000_msix_other()
1908 ew32(ICS, (icr & adapter->eiac_mask)); in e1000_msix_other()
1911 hw->mac.get_link_status = true; in e1000_msix_other()
1913 if (!test_bit(__E1000_DOWN, &adapter->state)) in e1000_msix_other()
1914 mod_timer(&adapter->watchdog_timer, jiffies + 1); in e1000_msix_other()
1917 if (!test_bit(__E1000_DOWN, &adapter->state)) in e1000_msix_other()
1927 struct e1000_hw *hw = &adapter->hw; in e1000_intr_msix_tx()
1928 struct e1000_ring *tx_ring = adapter->tx_ring; in e1000_intr_msix_tx()
1930 adapter->total_tx_bytes = 0; in e1000_intr_msix_tx()
1931 adapter->total_tx_packets = 0; in e1000_intr_msix_tx()
1935 ew32(ICS, tx_ring->ims_val); in e1000_intr_msix_tx()
1937 if (!test_bit(__E1000_DOWN, &adapter->state)) in e1000_intr_msix_tx()
1938 ew32(IMS, adapter->tx_ring->ims_val); in e1000_intr_msix_tx()
1947 struct e1000_ring *rx_ring = adapter->rx_ring; in e1000_intr_msix_rx()
1952 if (rx_ring->set_itr) { in e1000_intr_msix_rx()
1953 u32 itr = rx_ring->itr_val ? in e1000_intr_msix_rx()
1954 1000000000 / (rx_ring->itr_val * 256) : 0; in e1000_intr_msix_rx()
1956 writel(itr, rx_ring->itr_register); in e1000_intr_msix_rx()
1957 rx_ring->set_itr = 0; in e1000_intr_msix_rx()
1960 if (napi_schedule_prep(&adapter->napi)) { in e1000_intr_msix_rx()
1961 adapter->total_rx_bytes = 0; in e1000_intr_msix_rx()
1962 adapter->total_rx_packets = 0; in e1000_intr_msix_rx()
1963 __napi_schedule(&adapter->napi); in e1000_intr_msix_rx()
1969 * e1000_configure_msix - Configure MSI-X hardware
1973 * generate MSI-X interrupts.
1977 struct e1000_hw *hw = &adapter->hw; in e1000_configure_msix()
1978 struct e1000_ring *rx_ring = adapter->rx_ring; in e1000_configure_msix()
1979 struct e1000_ring *tx_ring = adapter->tx_ring; in e1000_configure_msix()
1983 adapter->eiac_mask = 0; in e1000_configure_msix()
1985 /* Workaround issue with spurious interrupts on 82574 in MSI-X mode */ in e1000_configure_msix()
1986 if (hw->mac.type == e1000_82574) { in e1000_configure_msix()
1994 rx_ring->ims_val = E1000_IMS_RXQ0; in e1000_configure_msix()
1995 adapter->eiac_mask |= rx_ring->ims_val; in e1000_configure_msix()
1996 if (rx_ring->itr_val) in e1000_configure_msix()
1997 writel(1000000000 / (rx_ring->itr_val * 256), in e1000_configure_msix()
1998 rx_ring->itr_register); in e1000_configure_msix()
2000 writel(1, rx_ring->itr_register); in e1000_configure_msix()
2004 tx_ring->ims_val = E1000_IMS_TXQ0; in e1000_configure_msix()
2006 if (tx_ring->itr_val) in e1000_configure_msix()
2007 writel(1000000000 / (tx_ring->itr_val * 256), in e1000_configure_msix()
2008 tx_ring->itr_register); in e1000_configure_msix()
2010 writel(1, tx_ring->itr_register); in e1000_configure_msix()
2011 adapter->eiac_mask |= tx_ring->ims_val; in e1000_configure_msix()
2017 if (rx_ring->itr_val) in e1000_configure_msix()
2018 writel(1000000000 / (rx_ring->itr_val * 256), in e1000_configure_msix()
2019 hw->hw_addr + E1000_EITR_82574(vector)); in e1000_configure_msix()
2021 writel(1, hw->hw_addr + E1000_EITR_82574(vector)); in e1000_configure_msix()
2028 /* enable MSI-X PBA support */ in e1000_configure_msix()
2037 if (adapter->msix_entries) { in e1000e_reset_interrupt_capability()
2038 pci_disable_msix(adapter->pdev); in e1000e_reset_interrupt_capability()
2039 kfree(adapter->msix_entries); in e1000e_reset_interrupt_capability()
2040 adapter->msix_entries = NULL; in e1000e_reset_interrupt_capability()
2041 } else if (adapter->flags & FLAG_MSI_ENABLED) { in e1000e_reset_interrupt_capability()
2042 pci_disable_msi(adapter->pdev); in e1000e_reset_interrupt_capability()
2043 adapter->flags &= ~FLAG_MSI_ENABLED; in e1000e_reset_interrupt_capability()
2048 * e1000e_set_interrupt_capability - set MSI or MSI-X if supported
2059 switch (adapter->int_mode) { in e1000e_set_interrupt_capability()
2061 if (adapter->flags & FLAG_HAS_MSIX) { in e1000e_set_interrupt_capability()
2062 adapter->num_vectors = 3; /* RxQ0, TxQ0 and other */ in e1000e_set_interrupt_capability()
2063 adapter->msix_entries = kcalloc(adapter->num_vectors, in e1000e_set_interrupt_capability()
2067 if (adapter->msix_entries) { in e1000e_set_interrupt_capability()
2070 for (i = 0; i < adapter->num_vectors; i++) in e1000e_set_interrupt_capability()
2071 adapter->msix_entries[i].entry = i; in e1000e_set_interrupt_capability()
2073 err = pci_enable_msix_range(a->pdev, in e1000e_set_interrupt_capability()
2074 a->msix_entries, in e1000e_set_interrupt_capability()
2075 a->num_vectors, in e1000e_set_interrupt_capability()
2076 a->num_vectors); in e1000e_set_interrupt_capability()
2080 /* MSI-X failed, so fall through and try MSI */ in e1000e_set_interrupt_capability()
2081 e_err("Failed to initialize MSI-X interrupts. Falling back to MSI interrupts.\n"); in e1000e_set_interrupt_capability()
2084 adapter->int_mode = E1000E_INT_MODE_MSI; in e1000e_set_interrupt_capability()
2087 if (!pci_enable_msi(adapter->pdev)) { in e1000e_set_interrupt_capability()
2088 adapter->flags |= FLAG_MSI_ENABLED; in e1000e_set_interrupt_capability()
2090 adapter->int_mode = E1000E_INT_MODE_LEGACY; in e1000e_set_interrupt_capability()
2100 adapter->num_vectors = 1; in e1000e_set_interrupt_capability()
2104 * e1000_request_msix - Initialize MSI-X interrupts
2107 * e1000_request_msix allocates MSI-X vectors and requests interrupts from the
2112 struct net_device *netdev = adapter->netdev; in e1000_request_msix()
2115 if (strlen(netdev->name) < (IFNAMSIZ - 5)) in e1000_request_msix()
2116 snprintf(adapter->rx_ring->name, in e1000_request_msix()
2117 sizeof(adapter->rx_ring->name) - 1, in e1000_request_msix()
2118 "%.14s-rx-0", netdev->name); in e1000_request_msix()
2120 memcpy(adapter->rx_ring->name, netdev->name, IFNAMSIZ); in e1000_request_msix()
2121 err = request_irq(adapter->msix_entries[vector].vector, in e1000_request_msix()
2122 e1000_intr_msix_rx, 0, adapter->rx_ring->name, in e1000_request_msix()
2126 adapter->rx_ring->itr_register = adapter->hw.hw_addr + in e1000_request_msix()
2128 adapter->rx_ring->itr_val = adapter->itr; in e1000_request_msix()
2131 if (strlen(netdev->name) < (IFNAMSIZ - 5)) in e1000_request_msix()
2132 snprintf(adapter->tx_ring->name, in e1000_request_msix()
2133 sizeof(adapter->tx_ring->name) - 1, in e1000_request_msix()
2134 "%.14s-tx-0", netdev->name); in e1000_request_msix()
2136 memcpy(adapter->tx_ring->name, netdev->name, IFNAMSIZ); in e1000_request_msix()
2137 err = request_irq(adapter->msix_entries[vector].vector, in e1000_request_msix()
2138 e1000_intr_msix_tx, 0, adapter->tx_ring->name, in e1000_request_msix()
2142 adapter->tx_ring->itr_register = adapter->hw.hw_addr + in e1000_request_msix()
2144 adapter->tx_ring->itr_val = adapter->itr; in e1000_request_msix()
2147 err = request_irq(adapter->msix_entries[vector].vector, in e1000_request_msix()
2148 e1000_msix_other, 0, netdev->name, netdev); in e1000_request_msix()
2158 * e1000_request_irq - initialize interrupts
2166 struct net_device *netdev = adapter->netdev; in e1000_request_irq()
2169 if (adapter->msix_entries) { in e1000_request_irq()
2175 adapter->int_mode = E1000E_INT_MODE_MSI; in e1000_request_irq()
2178 if (adapter->flags & FLAG_MSI_ENABLED) { in e1000_request_irq()
2179 err = request_irq(adapter->pdev->irq, e1000_intr_msi, 0, in e1000_request_irq()
2180 netdev->name, netdev); in e1000_request_irq()
2186 adapter->int_mode = E1000E_INT_MODE_LEGACY; in e1000_request_irq()
2189 err = request_irq(adapter->pdev->irq, e1000_intr, IRQF_SHARED, in e1000_request_irq()
2190 netdev->name, netdev); in e1000_request_irq()
2199 struct net_device *netdev = adapter->netdev; in e1000_free_irq()
2201 if (adapter->msix_entries) { in e1000_free_irq()
2204 free_irq(adapter->msix_entries[vector].vector, netdev); in e1000_free_irq()
2207 free_irq(adapter->msix_entries[vector].vector, netdev); in e1000_free_irq()
2211 free_irq(adapter->msix_entries[vector].vector, netdev); in e1000_free_irq()
2215 free_irq(adapter->pdev->irq, netdev); in e1000_free_irq()
2219 * e1000_irq_disable - Mask off interrupt generation on the NIC
2224 struct e1000_hw *hw = &adapter->hw; in e1000_irq_disable()
2227 if (adapter->msix_entries) in e1000_irq_disable()
2231 if (adapter->msix_entries) { in e1000_irq_disable()
2234 for (i = 0; i < adapter->num_vectors; i++) in e1000_irq_disable()
2235 synchronize_irq(adapter->msix_entries[i].vector); in e1000_irq_disable()
2237 synchronize_irq(adapter->pdev->irq); in e1000_irq_disable()
2242 * e1000_irq_enable - Enable default interrupt generation settings
2247 struct e1000_hw *hw = &adapter->hw; in e1000_irq_enable()
2249 if (adapter->msix_entries) { in e1000_irq_enable()
2250 ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574); in e1000_irq_enable()
2251 ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER | in e1000_irq_enable()
2253 } else if (hw->mac.type >= e1000_pch_lpt) { in e1000_irq_enable()
2262 * e1000e_get_hw_control - get control of the h/w from f/w
2272 struct e1000_hw *hw = &adapter->hw; in e1000e_get_hw_control()
2277 if (adapter->flags & FLAG_HAS_SWSM_ON_LOAD) { in e1000e_get_hw_control()
2280 } else if (adapter->flags & FLAG_HAS_CTRLEXT_ON_LOAD) { in e1000e_get_hw_control()
2287 * e1000e_release_hw_control - release control of the h/w to f/w
2298 struct e1000_hw *hw = &adapter->hw; in e1000e_release_hw_control()
2303 if (adapter->flags & FLAG_HAS_SWSM_ON_LOAD) { in e1000e_release_hw_control()
2306 } else if (adapter->flags & FLAG_HAS_CTRLEXT_ON_LOAD) { in e1000e_release_hw_control()
2313 * e1000_alloc_ring_dma - allocate memory for a ring structure
2320 struct pci_dev *pdev = adapter->pdev; in e1000_alloc_ring_dma()
2322 ring->desc = dma_alloc_coherent(&pdev->dev, ring->size, &ring->dma, in e1000_alloc_ring_dma()
2324 if (!ring->desc) in e1000_alloc_ring_dma()
2325 return -ENOMEM; in e1000_alloc_ring_dma()
2331 * e1000e_setup_tx_resources - allocate Tx resources (Descriptors)
2338 struct e1000_adapter *adapter = tx_ring->adapter; in e1000e_setup_tx_resources()
2339 int err = -ENOMEM, size; in e1000e_setup_tx_resources()
2341 size = sizeof(struct e1000_buffer) * tx_ring->count; in e1000e_setup_tx_resources()
2342 tx_ring->buffer_info = vzalloc(size); in e1000e_setup_tx_resources()
2343 if (!tx_ring->buffer_info) in e1000e_setup_tx_resources()
2347 tx_ring->size = tx_ring->count * sizeof(struct e1000_tx_desc); in e1000e_setup_tx_resources()
2348 tx_ring->size = ALIGN(tx_ring->size, 4096); in e1000e_setup_tx_resources()
2354 tx_ring->next_to_use = 0; in e1000e_setup_tx_resources()
2355 tx_ring->next_to_clean = 0; in e1000e_setup_tx_resources()
2359 vfree(tx_ring->buffer_info); in e1000e_setup_tx_resources()
2365 * e1000e_setup_rx_resources - allocate Rx resources (Descriptors)
2372 struct e1000_adapter *adapter = rx_ring->adapter; in e1000e_setup_rx_resources()
2374 int i, size, desc_len, err = -ENOMEM; in e1000e_setup_rx_resources()
2376 size = sizeof(struct e1000_buffer) * rx_ring->count; in e1000e_setup_rx_resources()
2377 rx_ring->buffer_info = vzalloc(size); in e1000e_setup_rx_resources()
2378 if (!rx_ring->buffer_info) in e1000e_setup_rx_resources()
2381 for (i = 0; i < rx_ring->count; i++) { in e1000e_setup_rx_resources()
2382 buffer_info = &rx_ring->buffer_info[i]; in e1000e_setup_rx_resources()
2383 buffer_info->ps_pages = kcalloc(PS_PAGE_BUFFERS, in e1000e_setup_rx_resources()
2386 if (!buffer_info->ps_pages) in e1000e_setup_rx_resources()
2393 rx_ring->size = rx_ring->count * desc_len; in e1000e_setup_rx_resources()
2394 rx_ring->size = ALIGN(rx_ring->size, 4096); in e1000e_setup_rx_resources()
2400 rx_ring->next_to_clean = 0; in e1000e_setup_rx_resources()
2401 rx_ring->next_to_use = 0; in e1000e_setup_rx_resources()
2402 rx_ring->rx_skb_top = NULL; in e1000e_setup_rx_resources()
2407 for (i = 0; i < rx_ring->count; i++) { in e1000e_setup_rx_resources()
2408 buffer_info = &rx_ring->buffer_info[i]; in e1000e_setup_rx_resources()
2409 kfree(buffer_info->ps_pages); in e1000e_setup_rx_resources()
2412 vfree(rx_ring->buffer_info); in e1000e_setup_rx_resources()
2418 * e1000_clean_tx_ring - Free Tx Buffers
2423 struct e1000_adapter *adapter = tx_ring->adapter; in e1000_clean_tx_ring()
2428 for (i = 0; i < tx_ring->count; i++) { in e1000_clean_tx_ring()
2429 buffer_info = &tx_ring->buffer_info[i]; in e1000_clean_tx_ring()
2433 netdev_reset_queue(adapter->netdev); in e1000_clean_tx_ring()
2434 size = sizeof(struct e1000_buffer) * tx_ring->count; in e1000_clean_tx_ring()
2435 memset(tx_ring->buffer_info, 0, size); in e1000_clean_tx_ring()
2437 memset(tx_ring->desc, 0, tx_ring->size); in e1000_clean_tx_ring()
2439 tx_ring->next_to_use = 0; in e1000_clean_tx_ring()
2440 tx_ring->next_to_clean = 0; in e1000_clean_tx_ring()
2444 * e1000e_free_tx_resources - Free Tx Resources per Queue
2451 struct e1000_adapter *adapter = tx_ring->adapter; in e1000e_free_tx_resources()
2452 struct pci_dev *pdev = adapter->pdev; in e1000e_free_tx_resources()
2456 vfree(tx_ring->buffer_info); in e1000e_free_tx_resources()
2457 tx_ring->buffer_info = NULL; in e1000e_free_tx_resources()
2459 dma_free_coherent(&pdev->dev, tx_ring->size, tx_ring->desc, in e1000e_free_tx_resources()
2460 tx_ring->dma); in e1000e_free_tx_resources()
2461 tx_ring->desc = NULL; in e1000e_free_tx_resources()
2465 * e1000e_free_rx_resources - Free Rx Resources
2472 struct e1000_adapter *adapter = rx_ring->adapter; in e1000e_free_rx_resources()
2473 struct pci_dev *pdev = adapter->pdev; in e1000e_free_rx_resources()
2478 for (i = 0; i < rx_ring->count; i++) in e1000e_free_rx_resources()
2479 kfree(rx_ring->buffer_info[i].ps_pages); in e1000e_free_rx_resources()
2481 vfree(rx_ring->buffer_info); in e1000e_free_rx_resources()
2482 rx_ring->buffer_info = NULL; in e1000e_free_rx_resources()
2484 dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc, in e1000e_free_rx_resources()
2485 rx_ring->dma); in e1000e_free_rx_resources()
2486 rx_ring->desc = NULL; in e1000e_free_rx_resources()
2490 * e1000_update_itr - update the dynamic ITR value based on statistics
2491 * @itr_setting: current adapter->itr
2550 u32 new_itr = adapter->itr; in e1000_set_itr()
2552 /* for non-gigabit speeds, just fix the interrupt rate at 4000 */ in e1000_set_itr()
2553 if (adapter->link_speed != SPEED_1000) { in e1000_set_itr()
2558 if (adapter->flags2 & FLAG2_DISABLE_AIM) { in e1000_set_itr()
2563 adapter->tx_itr = e1000_update_itr(adapter->tx_itr, in e1000_set_itr()
2564 adapter->total_tx_packets, in e1000_set_itr()
2565 adapter->total_tx_bytes); in e1000_set_itr()
2567 if (adapter->itr_setting == 3 && adapter->tx_itr == lowest_latency) in e1000_set_itr()
2568 adapter->tx_itr = low_latency; in e1000_set_itr()
2570 adapter->rx_itr = e1000_update_itr(adapter->rx_itr, in e1000_set_itr()
2571 adapter->total_rx_packets, in e1000_set_itr()
2572 adapter->total_rx_bytes); in e1000_set_itr()
2574 if (adapter->itr_setting == 3 && adapter->rx_itr == lowest_latency) in e1000_set_itr()
2575 adapter->rx_itr = low_latency; in e1000_set_itr()
2577 current_itr = max(adapter->rx_itr, adapter->tx_itr); in e1000_set_itr()
2595 if (new_itr != adapter->itr) { in e1000_set_itr()
2600 new_itr = new_itr > adapter->itr ? in e1000_set_itr()
2601 min(adapter->itr + (new_itr >> 2), new_itr) : new_itr; in e1000_set_itr()
2602 adapter->itr = new_itr; in e1000_set_itr()
2603 adapter->rx_ring->itr_val = new_itr; in e1000_set_itr()
2604 if (adapter->msix_entries) in e1000_set_itr()
2605 adapter->rx_ring->set_itr = 1; in e1000_set_itr()
2612 * e1000e_write_itr - write the ITR value to the appropriate registers
2616 * e1000e_write_itr determines if the adapter is in MSI-X mode
2622 struct e1000_hw *hw = &adapter->hw; in e1000e_write_itr()
2625 if (adapter->msix_entries) { in e1000e_write_itr()
2628 for (vector = 0; vector < adapter->num_vectors; vector++) in e1000e_write_itr()
2629 writel(new_itr, hw->hw_addr + E1000_EITR_82574(vector)); in e1000e_write_itr()
2636 * e1000_alloc_queues - Allocate memory for all rings
2643 adapter->tx_ring = kzalloc(size, GFP_KERNEL); in e1000_alloc_queues()
2644 if (!adapter->tx_ring) in e1000_alloc_queues()
2646 adapter->tx_ring->count = adapter->tx_ring_count; in e1000_alloc_queues()
2647 adapter->tx_ring->adapter = adapter; in e1000_alloc_queues()
2649 adapter->rx_ring = kzalloc(size, GFP_KERNEL); in e1000_alloc_queues()
2650 if (!adapter->rx_ring) in e1000_alloc_queues()
2652 adapter->rx_ring->count = adapter->rx_ring_count; in e1000_alloc_queues()
2653 adapter->rx_ring->adapter = adapter; in e1000_alloc_queues()
2658 kfree(adapter->rx_ring); in e1000_alloc_queues()
2659 kfree(adapter->tx_ring); in e1000_alloc_queues()
2660 return -ENOMEM; in e1000_alloc_queues()
2664 * e1000e_poll - NAPI Rx polling callback
2672 struct e1000_hw *hw = &adapter->hw; in e1000e_poll()
2673 struct net_device *poll_dev = adapter->netdev; in e1000e_poll()
2678 if (!adapter->msix_entries || in e1000e_poll()
2679 (adapter->rx_ring->ims_val & adapter->tx_ring->ims_val)) in e1000e_poll()
2680 tx_cleaned = e1000_clean_tx_irq(adapter->tx_ring); in e1000e_poll()
2682 adapter->clean_rx(adapter->rx_ring, &work_done, budget); in e1000e_poll()
2687 /* Exit the polling mode, but don't re-enable interrupts if stack might in e1000e_poll()
2688 * poll us due to busy-polling in e1000e_poll()
2691 if (adapter->itr_setting & 3) in e1000e_poll()
2693 if (!test_bit(__E1000_DOWN, &adapter->state)) { in e1000e_poll()
2694 if (adapter->msix_entries) in e1000e_poll()
2695 ew32(IMS, adapter->rx_ring->ims_val); in e1000e_poll()
2708 struct e1000_hw *hw = &adapter->hw; in e1000_vlan_rx_add_vid()
2712 if ((adapter->hw.mng_cookie.status & in e1000_vlan_rx_add_vid()
2714 (vid == adapter->mng_vlan_id)) in e1000_vlan_rx_add_vid()
2718 if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { in e1000_vlan_rx_add_vid()
2722 hw->mac.ops.write_vfta(hw, index, vfta); in e1000_vlan_rx_add_vid()
2725 set_bit(vid, adapter->active_vlans); in e1000_vlan_rx_add_vid()
2734 struct e1000_hw *hw = &adapter->hw; in e1000_vlan_rx_kill_vid()
2737 if ((adapter->hw.mng_cookie.status & in e1000_vlan_rx_kill_vid()
2739 (vid == adapter->mng_vlan_id)) { in e1000_vlan_rx_kill_vid()
2746 if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { in e1000_vlan_rx_kill_vid()
2750 hw->mac.ops.write_vfta(hw, index, vfta); in e1000_vlan_rx_kill_vid()
2753 clear_bit(vid, adapter->active_vlans); in e1000_vlan_rx_kill_vid()
2759 * e1000e_vlan_filter_disable - helper to disable hw VLAN filtering
2764 struct net_device *netdev = adapter->netdev; in e1000e_vlan_filter_disable()
2765 struct e1000_hw *hw = &adapter->hw; in e1000e_vlan_filter_disable()
2768 if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { in e1000e_vlan_filter_disable()
2774 if (adapter->mng_vlan_id != (u16)E1000_MNG_VLAN_NONE) { in e1000e_vlan_filter_disable()
2776 adapter->mng_vlan_id); in e1000e_vlan_filter_disable()
2777 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; in e1000e_vlan_filter_disable()
2783 * e1000e_vlan_filter_enable - helper to enable HW VLAN filtering
2788 struct e1000_hw *hw = &adapter->hw; in e1000e_vlan_filter_enable()
2791 if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { in e1000e_vlan_filter_enable()
2801 * e1000e_vlan_strip_disable - helper to disable HW VLAN stripping
2806 struct e1000_hw *hw = &adapter->hw; in e1000e_vlan_strip_disable()
2816 * e1000e_vlan_strip_enable - helper to enable HW VLAN stripping
2821 struct e1000_hw *hw = &adapter->hw; in e1000e_vlan_strip_enable()
2832 struct net_device *netdev = adapter->netdev; in e1000_update_mng_vlan()
2833 u16 vid = adapter->hw.mng_cookie.vlan_id; in e1000_update_mng_vlan()
2834 u16 old_vid = adapter->mng_vlan_id; in e1000_update_mng_vlan()
2836 if (adapter->hw.mng_cookie.status & E1000_MNG_DHCP_COOKIE_STATUS_VLAN) { in e1000_update_mng_vlan()
2838 adapter->mng_vlan_id = vid; in e1000_update_mng_vlan()
2849 e1000_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), 0); in e1000_restore_vlan()
2851 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) in e1000_restore_vlan()
2852 e1000_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid); in e1000_restore_vlan()
2857 struct e1000_hw *hw = &adapter->hw; in e1000_init_manageability_pt()
2860 if (!(adapter->flags & FLAG_MNG_PT_ENABLED)) in e1000_init_manageability_pt()
2872 switch (hw->mac.type) { in e1000_init_manageability_pt()
2878 /* Check if IPMI pass-through decision filter already exists; in e1000_init_manageability_pt()
2909 e_warn("Unable to create IPMI pass-through filter\n"); in e1000_init_manageability_pt()
2918 * e1000_configure_tx - Configure Transmit Unit after Reset
2925 struct e1000_hw *hw = &adapter->hw; in e1000_configure_tx()
2926 struct e1000_ring *tx_ring = adapter->tx_ring; in e1000_configure_tx()
2931 tdba = tx_ring->dma; in e1000_configure_tx()
2932 tdlen = tx_ring->count * sizeof(struct e1000_tx_desc); in e1000_configure_tx()
2938 tx_ring->head = adapter->hw.hw_addr + E1000_TDH(0); in e1000_configure_tx()
2939 tx_ring->tail = adapter->hw.hw_addr + E1000_TDT(0); in e1000_configure_tx()
2941 writel(0, tx_ring->head); in e1000_configure_tx()
2942 if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA) in e1000_configure_tx()
2945 writel(0, tx_ring->tail); in e1000_configure_tx()
2948 ew32(TIDV, adapter->tx_int_delay); in e1000_configure_tx()
2950 ew32(TADV, adapter->tx_abs_int_delay); in e1000_configure_tx()
2952 if (adapter->flags2 & FLAG2_DMA_BURST) { in e1000_configure_tx()
2978 if (adapter->flags & FLAG_TARC_SPEED_MODE_BIT) { in e1000_configure_tx()
2989 if (adapter->flags & FLAG_TARC_SET_BIT_ZERO) { in e1000_configure_tx()
2999 adapter->txd_cmd = E1000_TXD_CMD_EOP | E1000_TXD_CMD_IFCS; in e1000_configure_tx()
3002 if (adapter->tx_int_delay) in e1000_configure_tx()
3003 adapter->txd_cmd |= E1000_TXD_CMD_IDE; in e1000_configure_tx()
3006 adapter->txd_cmd |= E1000_TXD_CMD_RS; in e1000_configure_tx()
3010 hw->mac.ops.config_collision_dist(hw); in e1000_configure_tx()
3013 if (hw->mac.type == e1000_pch_spt) { in e1000_configure_tx()
3032 (((S) & (PAGE_SIZE - 1)) ? 1 : 0))
3035 * e1000_setup_rctl - configure the receive control registers
3040 struct e1000_hw *hw = &adapter->hw; in e1000_setup_rctl()
3044 /* Workaround Si errata on PCHx - configure jumbo frame flow. in e1000_setup_rctl()
3048 if (hw->mac.type >= e1000_pch2lan) { in e1000_setup_rctl()
3051 if (adapter->netdev->mtu > ETH_DATA_LEN) in e1000_setup_rctl()
3065 (adapter->hw.mac.mc_filter_type << E1000_RCTL_MO_SHIFT); in e1000_setup_rctl()
3071 if (adapter->netdev->mtu <= ETH_DATA_LEN) in e1000_setup_rctl()
3080 if (adapter->flags2 & FLAG2_CRC_STRIPPING) in e1000_setup_rctl()
3083 /* Workaround Si errata on 82577 PHY - configure IPG for jumbos */ in e1000_setup_rctl()
3084 if ((hw->phy.type == e1000_phy_82577) && (rctl & E1000_RCTL_LPE)) { in e1000_setup_rctl()
3103 switch (adapter->rx_buffer_len) { in e1000_setup_rctl()
3125 /* 82571 and greater support packet-split where the protocol in e1000_setup_rctl()
3126 * header is placed in skb->data and the packet data is in e1000_setup_rctl()
3127 * placed in pages hanging off of skb_shinfo(skb)->nr_frags. in e1000_setup_rctl()
3128 * In the case of a non-split, skb->data is linearly filled, in e1000_setup_rctl()
3129 * followed by the page buffers. Therefore, skb->data is in e1000_setup_rctl()
3139 pages = PAGE_USE_COUNT(adapter->netdev->mtu); in e1000_setup_rctl()
3141 adapter->rx_ps_pages = pages; in e1000_setup_rctl()
3143 adapter->rx_ps_pages = 0; in e1000_setup_rctl()
3145 if (adapter->rx_ps_pages) { in e1000_setup_rctl()
3151 psrctl |= adapter->rx_ps_bsize0 >> E1000_PSRCTL_BSIZE0_SHIFT; in e1000_setup_rctl()
3153 switch (adapter->rx_ps_pages) { in e1000_setup_rctl()
3169 if (adapter->netdev->features & NETIF_F_RXALL) { in e1000_setup_rctl()
3187 adapter->flags &= ~FLAG_RESTART_NOW; in e1000_setup_rctl()
3191 * e1000_configure_rx - Configure Receive Unit after Reset
3198 struct e1000_hw *hw = &adapter->hw; in e1000_configure_rx()
3199 struct e1000_ring *rx_ring = adapter->rx_ring; in e1000_configure_rx()
3203 if (adapter->rx_ps_pages) { in e1000_configure_rx()
3205 rdlen = rx_ring->count * in e1000_configure_rx()
3207 adapter->clean_rx = e1000_clean_rx_irq_ps; in e1000_configure_rx()
3208 adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; in e1000_configure_rx()
3209 } else if (adapter->netdev->mtu > ETH_FRAME_LEN + ETH_FCS_LEN) { in e1000_configure_rx()
3210 rdlen = rx_ring->count * sizeof(union e1000_rx_desc_extended); in e1000_configure_rx()
3211 adapter->clean_rx = e1000_clean_jumbo_rx_irq; in e1000_configure_rx()
3212 adapter->alloc_rx_buf = e1000_alloc_jumbo_rx_buffers; in e1000_configure_rx()
3214 rdlen = rx_ring->count * sizeof(union e1000_rx_desc_extended); in e1000_configure_rx()
3215 adapter->clean_rx = e1000_clean_rx_irq; in e1000_configure_rx()
3216 adapter->alloc_rx_buf = e1000_alloc_rx_buffers; in e1000_configure_rx()
3221 if (!(adapter->flags2 & FLAG2_NO_DISABLE_RX)) in e1000_configure_rx()
3226 if (adapter->flags2 & FLAG2_DMA_BURST) { in e1000_configure_rx()
3240 ew32(RDTR, adapter->rx_int_delay); in e1000_configure_rx()
3243 ew32(RADV, adapter->rx_abs_int_delay); in e1000_configure_rx()
3244 if ((adapter->itr_setting != 0) && (adapter->itr != 0)) in e1000_configure_rx()
3245 e1000e_write_itr(adapter, adapter->itr); in e1000_configure_rx()
3248 /* Auto-Mask interrupts upon ICR access */ in e1000_configure_rx()
3257 rdba = rx_ring->dma; in e1000_configure_rx()
3263 rx_ring->head = adapter->hw.hw_addr + E1000_RDH(0); in e1000_configure_rx()
3264 rx_ring->tail = adapter->hw.hw_addr + E1000_RDT(0); in e1000_configure_rx()
3266 writel(0, rx_ring->head); in e1000_configure_rx()
3267 if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA) in e1000_configure_rx()
3270 writel(0, rx_ring->tail); in e1000_configure_rx()
3274 if (adapter->netdev->features & NETIF_F_RXCSUM) in e1000_configure_rx()
3280 /* With jumbo frames, excessive C-state transition latencies result in e1000_configure_rx()
3283 if (adapter->netdev->mtu > ETH_DATA_LEN) { in e1000_configure_rx()
3285 ((er32(PBA) & E1000_PBA_RXA_MASK) * 1024 - in e1000_configure_rx()
3286 adapter->max_frame_size) * 8 / 1000; in e1000_configure_rx()
3288 if (adapter->flags & FLAG_IS_ICH) { in e1000_configure_rx()
3294 dev_info(&adapter->pdev->dev, in e1000_configure_rx()
3295 "Some CPU C-states have been disabled in order to enable jumbo frames\n"); in e1000_configure_rx()
3296 cpu_latency_qos_update_request(&adapter->pm_qos_req, lat); in e1000_configure_rx()
3298 cpu_latency_qos_update_request(&adapter->pm_qos_req, in e1000_configure_rx()
3307 * e1000e_write_mc_addr_list - write multicast addresses to MTA
3311 * Returns: -ENOMEM on failure
3318 struct e1000_hw *hw = &adapter->hw; in e1000e_write_mc_addr_list()
3325 hw->mac.ops.update_mc_addr_list(hw, NULL, 0); in e1000e_write_mc_addr_list()
3331 return -ENOMEM; in e1000e_write_mc_addr_list()
3336 memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN); in e1000e_write_mc_addr_list()
3338 hw->mac.ops.update_mc_addr_list(hw, mta_list, i); in e1000e_write_mc_addr_list()
3345 * e1000e_write_uc_addr_list - write unicast addresses to RAR table
3349 * Returns: -ENOMEM on failure/insufficient address space
3356 struct e1000_hw *hw = &adapter->hw; in e1000e_write_uc_addr_list()
3360 rar_entries = hw->mac.ops.rar_get_count(hw); in e1000e_write_uc_addr_list()
3363 rar_entries--; in e1000e_write_uc_addr_list()
3366 if (adapter->flags & FLAG_RESET_OVERWRITES_LAA) in e1000e_write_uc_addr_list()
3367 rar_entries--; in e1000e_write_uc_addr_list()
3371 return -ENOMEM; in e1000e_write_uc_addr_list()
3384 ret_val = hw->mac.ops.rar_set(hw, ha->addr, rar_entries--); in e1000e_write_uc_addr_list()
3386 return -ENOMEM; in e1000e_write_uc_addr_list()
3392 for (; rar_entries > 0; rar_entries--) { in e1000e_write_uc_addr_list()
3402 * e1000e_set_rx_mode - secondary unicast, Multicast and Promiscuous mode set
3408 * promiscuous mode, and all-multi behavior.
3413 struct e1000_hw *hw = &adapter->hw; in e1000e_set_rx_mode()
3416 if (pm_runtime_suspended(netdev->dev.parent)) in e1000e_set_rx_mode()
3425 if (netdev->flags & IFF_PROMISC) { in e1000e_set_rx_mode()
3432 if (netdev->flags & IFF_ALLMULTI) { in e1000e_set_rx_mode()
3455 if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) in e1000e_set_rx_mode()
3463 struct e1000_hw *hw = &adapter->hw; in e1000e_setup_rss_hash()
3494 * e1000e_get_base_timinca - get default SYSTIM time increment attributes
3503 struct e1000_hw *hw = &adapter->hw; in e1000e_get_base_timinca()
3509 if ((hw->mac.type >= e1000_pch_lpt) && in e1000e_get_base_timinca()
3520 switch (hw->mac.type) { in e1000e_get_base_timinca()
3526 adapter->cc.shift = shift + INCPERIOD_SHIFT_96MHZ; in e1000e_get_base_timinca()
3534 adapter->cc.shift = shift + INCPERIOD_SHIFT_96MHZ; in e1000e_get_base_timinca()
3540 adapter->cc.shift = shift; in e1000e_get_base_timinca()
3548 adapter->cc.shift = shift; in e1000e_get_base_timinca()
3560 adapter->cc.shift = shift; in e1000e_get_base_timinca()
3566 adapter->cc.shift = shift; in e1000e_get_base_timinca()
3575 adapter->cc.shift = shift; in e1000e_get_base_timinca()
3578 return -EINVAL; in e1000e_get_base_timinca()
3588 * e1000e_config_hwtstamp - configure the hwtstamp registers and enable/disable
3606 struct e1000_hw *hw = &adapter->hw; in e1000e_config_hwtstamp()
3615 if (!(adapter->flags & FLAG_HAS_HW_TIMESTAMP)) in e1000e_config_hwtstamp()
3616 return -EINVAL; in e1000e_config_hwtstamp()
3618 switch (config->tx_type) { in e1000e_config_hwtstamp()
3625 return -ERANGE; in e1000e_config_hwtstamp()
3628 switch (config->rx_filter) { in e1000e_config_hwtstamp()
3680 config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; in e1000e_config_hwtstamp()
3686 * Delay Request messages but not both so fall-through to in e1000e_config_hwtstamp()
3695 config->rx_filter = HWTSTAMP_FILTER_ALL; in e1000e_config_hwtstamp()
3698 return -ERANGE; in e1000e_config_hwtstamp()
3701 adapter->hwtstamp_config = *config; in e1000e_config_hwtstamp()
3711 return -EAGAIN; in e1000e_config_hwtstamp()
3724 return -EAGAIN; in e1000e_config_hwtstamp()
3751 * e1000_configure - configure the hardware for Rx and Tx
3756 struct e1000_ring *rx_ring = adapter->rx_ring; in e1000_configure()
3758 e1000e_set_rx_mode(adapter->netdev); in e1000_configure()
3765 if (adapter->netdev->features & NETIF_F_RXHASH) in e1000_configure()
3769 adapter->alloc_rx_buf(rx_ring, e1000_desc_unused(rx_ring), GFP_KERNEL); in e1000_configure()
3773 * e1000e_power_up_phy - restore link in case the phy was powered down
3782 if (adapter->hw.phy.ops.power_up) in e1000e_power_up_phy()
3783 adapter->hw.phy.ops.power_up(&adapter->hw); in e1000e_power_up_phy()
3785 adapter->hw.mac.ops.setup_link(&adapter->hw); in e1000e_power_up_phy()
3789 * e1000_power_down_phy - Power down the PHY
3797 if (adapter->hw.phy.ops.power_down) in e1000_power_down_phy()
3798 adapter->hw.phy.ops.power_down(&adapter->hw); in e1000_power_down_phy()
3802 * e1000_flush_tx_ring - remove all descriptors from the tx_ring
3812 struct e1000_hw *hw = &adapter->hw; in e1000_flush_tx_ring()
3813 struct e1000_ring *tx_ring = adapter->tx_ring; in e1000_flush_tx_ring()
3821 BUG_ON(tdt != tx_ring->next_to_use); in e1000_flush_tx_ring()
3822 tx_desc = E1000_TX_DESC(*tx_ring, tx_ring->next_to_use); in e1000_flush_tx_ring()
3823 tx_desc->buffer_addr = cpu_to_le64(tx_ring->dma); in e1000_flush_tx_ring()
3825 tx_desc->lower.data = cpu_to_le32(txd_lower | size); in e1000_flush_tx_ring()
3826 tx_desc->upper.data = 0; in e1000_flush_tx_ring()
3829 tx_ring->next_to_use++; in e1000_flush_tx_ring()
3830 if (tx_ring->next_to_use == tx_ring->count) in e1000_flush_tx_ring()
3831 tx_ring->next_to_use = 0; in e1000_flush_tx_ring()
3832 ew32(TDT(0), tx_ring->next_to_use); in e1000_flush_tx_ring()
3837 * e1000_flush_rx_ring - remove all descriptors from the rx_ring
3845 struct e1000_hw *hw = &adapter->hw; in e1000_flush_rx_ring()
3870 * e1000_flush_desc_rings - remove all descriptors from the descriptor rings
3885 struct e1000_hw *hw = &adapter->hw; in e1000_flush_desc_rings()
3893 pci_read_config_word(adapter->pdev, PCICFG_DESC_RING_STATUS, in e1000_flush_desc_rings()
3899 pci_read_config_word(adapter->pdev, PCICFG_DESC_RING_STATUS, in e1000_flush_desc_rings()
3906 * e1000e_systim_reset - reset the timesync registers after a hardware reset
3916 struct ptp_clock_info *info = &adapter->ptp_clock_info; in e1000e_systim_reset()
3917 struct e1000_hw *hw = &adapter->hw; in e1000e_systim_reset()
3922 if (!(adapter->flags & FLAG_HAS_HW_TIMESTAMP)) in e1000e_systim_reset()
3925 if (info->adjfine) { in e1000e_systim_reset()
3927 ret_val = info->adjfine(info, adapter->ptp_delta); in e1000e_systim_reset()
3936 dev_warn(&adapter->pdev->dev, in e1000e_systim_reset()
3943 spin_lock_irqsave(&adapter->systim_lock, flags); in e1000e_systim_reset()
3944 timecounter_init(&adapter->tc, &adapter->cc, in e1000e_systim_reset()
3946 spin_unlock_irqrestore(&adapter->systim_lock, flags); in e1000e_systim_reset()
3949 e1000e_config_hwtstamp(adapter, &adapter->hwtstamp_config); in e1000e_systim_reset()
3953 * e1000e_reset - bring the hardware into a known good state
3957 * require a configuration cycle of the hardware - those cannot be
3963 struct e1000_mac_info *mac = &adapter->hw.mac; in e1000e_reset()
3964 struct e1000_fc_info *fc = &adapter->hw.fc; in e1000e_reset()
3965 struct e1000_hw *hw = &adapter->hw; in e1000e_reset()
3967 u32 pba = adapter->pba; in e1000e_reset()
3973 if (adapter->max_frame_size > (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)) { in e1000e_reset()
3989 min_tx_space = (adapter->max_frame_size + in e1000e_reset()
3990 sizeof(struct e1000_tx_desc) - ETH_FCS_LEN) * 2; in e1000e_reset()
3994 min_rx_space = adapter->max_frame_size; in e1000e_reset()
4003 ((min_tx_space - tx_space) < pba)) { in e1000e_reset()
4004 pba -= min_tx_space - tx_space; in e1000e_reset()
4021 * - 90% of the Rx FIFO size, and in e1000e_reset()
4022 * - the full Rx FIFO size minus one full frame in e1000e_reset()
4024 if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME) in e1000e_reset()
4025 fc->pause_time = 0xFFFF; in e1000e_reset()
4027 fc->pause_time = E1000_FC_PAUSE_TIME; in e1000e_reset()
4028 fc->send_xon = true; in e1000e_reset()
4029 fc->current_mode = fc->requested_mode; in e1000e_reset()
4031 switch (hw->mac.type) { in e1000e_reset()
4034 if (adapter->netdev->mtu > ETH_DATA_LEN) { in e1000e_reset()
4037 fc->high_water = 0x2800; in e1000e_reset()
4038 fc->low_water = fc->high_water - 8; in e1000e_reset()
4044 ((pba << 10) - adapter->max_frame_size)); in e1000e_reset()
4046 fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */ in e1000e_reset()
4047 fc->low_water = fc->high_water - 8; in e1000e_reset()
4053 if (adapter->netdev->mtu > ETH_DATA_LEN) { in e1000e_reset()
4054 fc->high_water = 0x3500; in e1000e_reset()
4055 fc->low_water = 0x1500; in e1000e_reset()
4057 fc->high_water = 0x5000; in e1000e_reset()
4058 fc->low_water = 0x3000; in e1000e_reset()
4060 fc->refresh_time = 0x1000; in e1000e_reset()
4070 fc->refresh_time = 0xFFFF; in e1000e_reset()
4071 fc->pause_time = 0xFFFF; in e1000e_reset()
4073 if (adapter->netdev->mtu <= ETH_DATA_LEN) { in e1000e_reset()
4074 fc->high_water = 0x05C20; in e1000e_reset()
4075 fc->low_water = 0x05048; in e1000e_reset()
4081 fc->high_water = ((pba << 10) * 9 / 10) & E1000_FCRTH_RTH; in e1000e_reset()
4082 fc->low_water = ((pba << 10) * 8 / 10) & E1000_FCRTL_RTL; in e1000e_reset()
4091 adapter->tx_fifo_limit = min_t(u32, ((er32(PBA) >> 16) << 10) - 96, in e1000e_reset()
4097 if (adapter->itr_setting & 0x3) { in e1000e_reset()
4098 if ((adapter->max_frame_size * 2) > (pba << 10)) { in e1000e_reset()
4099 if (!(adapter->flags2 & FLAG2_DISABLE_AIM)) { in e1000e_reset()
4100 dev_info(&adapter->pdev->dev, in e1000e_reset()
4102 adapter->flags2 |= FLAG2_DISABLE_AIM; in e1000e_reset()
4105 } else if (adapter->flags2 & FLAG2_DISABLE_AIM) { in e1000e_reset()
4106 dev_info(&adapter->pdev->dev, in e1000e_reset()
4108 adapter->flags2 &= ~FLAG2_DISABLE_AIM; in e1000e_reset()
4109 adapter->itr = 20000; in e1000e_reset()
4110 e1000e_write_itr(adapter, adapter->itr); in e1000e_reset()
4114 if (hw->mac.type >= e1000_pch_spt) in e1000e_reset()
4117 mac->ops.reset_hw(hw); in e1000e_reset()
4122 if (adapter->flags & FLAG_HAS_AMT) in e1000e_reset()
4127 if (mac->ops.init_hw(hw)) in e1000e_reset()
4141 if (adapter->flags2 & FLAG2_HAS_EEE) { in e1000e_reset()
4145 switch (hw->phy.type) { in e1000e_reset()
4153 dev_err(&adapter->pdev->dev, in e1000e_reset()
4158 ret_val = hw->phy.ops.acquire(hw); in e1000e_reset()
4160 dev_err(&adapter->pdev->dev, in e1000e_reset()
4161 "EEE advertisement - unable to acquire PHY\n"); in e1000e_reset()
4166 hw->dev_spec.ich8lan.eee_disable ? in e1000e_reset()
4167 0 : adapter->eee_advert); in e1000e_reset()
4169 hw->phy.ops.release(hw); in e1000e_reset()
4172 if (!netif_running(adapter->netdev) && in e1000e_reset()
4173 !test_bit(__E1000_TESTING, &adapter->state)) in e1000e_reset()
4178 if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) && in e1000e_reset()
4179 !(adapter->flags & FLAG_SMART_POWER_DOWN)) { in e1000e_reset()
4189 if (hw->mac.type >= e1000_pch_spt && adapter->int_mode == 0) { in e1000e_reset()
4206 * e1000e_trigger_lsc - trigger an LSC interrupt
4213 struct e1000_hw *hw = &adapter->hw; in e1000e_trigger_lsc()
4215 if (adapter->msix_entries) in e1000e_trigger_lsc()
4226 clear_bit(__E1000_DOWN, &adapter->state); in e1000e_up()
4228 if (adapter->msix_entries) in e1000e_up()
4239 struct e1000_hw *hw = &adapter->hw; in e1000e_flush_descriptors()
4241 if (!(adapter->flags2 & FLAG2_DMA_BURST)) in e1000e_flush_descriptors()
4245 ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); in e1000e_flush_descriptors()
4246 ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD); in e1000e_flush_descriptors()
4254 ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); in e1000e_flush_descriptors()
4255 ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD); in e1000e_flush_descriptors()
4264 * e1000e_down - quiesce the device and optionally reset the hardware
4270 struct net_device *netdev = adapter->netdev; in e1000e_down()
4271 struct e1000_hw *hw = &adapter->hw; in e1000e_down()
4277 set_bit(__E1000_DOWN, &adapter->state); in e1000e_down()
4283 if (!(adapter->flags2 & FLAG2_NO_DISABLE_RX)) in e1000e_down()
4300 napi_synchronize(&adapter->napi); in e1000e_down()
4302 del_timer_sync(&adapter->watchdog_timer); in e1000e_down()
4303 del_timer_sync(&adapter->phy_info_timer); in e1000e_down()
4305 spin_lock(&adapter->stats64_lock); in e1000e_down()
4307 spin_unlock(&adapter->stats64_lock); in e1000e_down()
4311 adapter->link_speed = 0; in e1000e_down()
4312 adapter->link_duplex = 0; in e1000e_down()
4315 if ((hw->mac.type >= e1000_pch2lan) && in e1000e_down()
4316 (adapter->netdev->mtu > ETH_DATA_LEN) && in e1000e_down()
4320 if (!pci_channel_offline(adapter->pdev)) { in e1000e_down()
4323 else if (hw->mac.type >= e1000_pch_spt) in e1000e_down()
4326 e1000_clean_tx_ring(adapter->tx_ring); in e1000e_down()
4327 e1000_clean_rx_ring(adapter->rx_ring); in e1000e_down()
4333 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) in e1000e_reinit_locked()
4337 clear_bit(__E1000_RESETTING, &adapter->state); in e1000e_reinit_locked()
4341 * e1000e_sanitize_systim - sanitize raw cycle counter reads
4367 time_delta = systim_next - systim; in e1000e_sanitize_systim()
4382 * e1000e_read_systim - read SYSTIM register
4390 struct e1000_hw *hw = &adapter->hw; in e1000e_read_systim()
4397 * to fix that we test for overflow and if true, we re-read systime. in e1000e_read_systim()
4404 if (systimel >= (u32)0xffffffff - E1000_TIMINCA_INCVALUE_MASK) { in e1000e_read_systim()
4419 if (adapter->flags2 & FLAG2_CHECK_SYSTIM_OVERFLOW) in e1000e_read_systim()
4426 * e1000e_cyclecounter_read - read raw cycle counter (used by time counter)
4438 * e1000_sw_init - Initialize general software structures (struct e1000_adapter)
4447 struct net_device *netdev = adapter->netdev; in e1000_sw_init()
4449 adapter->rx_buffer_len = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN; in e1000_sw_init()
4450 adapter->rx_ps_bsize0 = 128; in e1000_sw_init()
4451 adapter->max_frame_size = netdev->mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; in e1000_sw_init()
4452 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; in e1000_sw_init()
4453 adapter->tx_ring_count = E1000_DEFAULT_TXD; in e1000_sw_init()
4454 adapter->rx_ring_count = E1000_DEFAULT_RXD; in e1000_sw_init()
4456 spin_lock_init(&adapter->stats64_lock); in e1000_sw_init()
4461 return -ENOMEM; in e1000_sw_init()
4464 if (adapter->flags & FLAG_HAS_HW_TIMESTAMP) { in e1000_sw_init()
4465 adapter->cc.read = e1000e_cyclecounter_read; in e1000_sw_init()
4466 adapter->cc.mask = CYCLECOUNTER_MASK(64); in e1000_sw_init()
4467 adapter->cc.mult = 1; in e1000_sw_init()
4470 spin_lock_init(&adapter->systim_lock); in e1000_sw_init()
4471 INIT_WORK(&adapter->tx_hwtstamp_work, e1000e_tx_hwtstamp_work); in e1000_sw_init()
4477 set_bit(__E1000_DOWN, &adapter->state); in e1000_sw_init()
4482 * e1000_intr_msi_test - Interrupt Handler
4490 struct e1000_hw *hw = &adapter->hw; in e1000_intr_msi_test()
4495 adapter->flags &= ~FLAG_MSI_TEST_FAILED; in e1000_intr_msi_test()
4506 * e1000_test_msi_interrupt - Returns 0 for successful test
4513 struct net_device *netdev = adapter->netdev; in e1000_test_msi_interrupt()
4514 struct e1000_hw *hw = &adapter->hw; in e1000_test_msi_interrupt()
4528 adapter->flags |= FLAG_MSI_TEST_FAILED; in e1000_test_msi_interrupt()
4530 err = pci_enable_msi(adapter->pdev); in e1000_test_msi_interrupt()
4534 err = request_irq(adapter->pdev->irq, e1000_intr_msi_test, 0, in e1000_test_msi_interrupt()
4535 netdev->name, netdev); in e1000_test_msi_interrupt()
4537 pci_disable_msi(adapter->pdev); in e1000_test_msi_interrupt()
4557 if (adapter->flags & FLAG_MSI_TEST_FAILED) { in e1000_test_msi_interrupt()
4558 adapter->int_mode = E1000E_INT_MODE_LEGACY; in e1000_test_msi_interrupt()
4564 free_irq(adapter->pdev->irq, netdev); in e1000_test_msi_interrupt()
4565 pci_disable_msi(adapter->pdev); in e1000_test_msi_interrupt()
4573 * e1000_test_msi - Returns 0 if MSI test succeeds or INTx mode is restored
4583 if (!(adapter->flags & FLAG_MSI_ENABLED)) in e1000_test_msi()
4587 pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd); in e1000_test_msi()
4589 pci_write_config_word(adapter->pdev, PCI_COMMAND, in e1000_test_msi()
4594 /* re-enable SERR */ in e1000_test_msi()
4596 pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd); in e1000_test_msi()
4598 pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd); in e1000_test_msi()
4605 * e1000e_open - Called when a network interface is made active
4619 struct e1000_hw *hw = &adapter->hw; in e1000e_open()
4620 struct pci_dev *pdev = adapter->pdev; in e1000e_open()
4624 if (test_bit(__E1000_TESTING, &adapter->state)) in e1000e_open()
4625 return -EBUSY; in e1000e_open()
4627 pm_runtime_get_sync(&pdev->dev); in e1000e_open()
4633 err = e1000e_setup_tx_resources(adapter->tx_ring); in e1000e_open()
4638 err = e1000e_setup_rx_resources(adapter->rx_ring); in e1000e_open()
4645 if (adapter->flags & FLAG_HAS_AMT) { in e1000e_open()
4652 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; in e1000e_open()
4653 if ((adapter->hw.mng_cookie.status & E1000_MNG_DHCP_COOKIE_STATUS_VLAN)) in e1000e_open()
4657 cpu_latency_qos_add_request(&adapter->pm_qos_req, PM_QOS_DEFAULT_VALUE); in e1000e_open()
4674 if (adapter->int_mode != E1000E_INT_MODE_LEGACY) { in e1000e_open()
4683 clear_bit(__E1000_DOWN, &adapter->state); in e1000e_open()
4685 napi_enable(&adapter->napi); in e1000e_open()
4689 adapter->tx_hang_recheck = false; in e1000e_open()
4691 hw->mac.get_link_status = true; in e1000e_open()
4692 pm_runtime_put(&pdev->dev); in e1000e_open()
4699 cpu_latency_qos_remove_request(&adapter->pm_qos_req); in e1000e_open()
4702 e1000e_free_rx_resources(adapter->rx_ring); in e1000e_open()
4704 e1000e_free_tx_resources(adapter->tx_ring); in e1000e_open()
4707 pm_runtime_put_sync(&pdev->dev); in e1000e_open()
4713 * e1000e_close - Disables a network interface
4718 * The close entry point is called when an interface is de-activated
4726 struct pci_dev *pdev = adapter->pdev; in e1000e_close()
4729 while (test_bit(__E1000_RESETTING, &adapter->state) && count--) in e1000e_close()
4732 WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); in e1000e_close()
4734 pm_runtime_get_sync(&pdev->dev); in e1000e_close()
4744 napi_disable(&adapter->napi); in e1000e_close()
4746 e1000e_free_tx_resources(adapter->tx_ring); in e1000e_close()
4747 e1000e_free_rx_resources(adapter->rx_ring); in e1000e_close()
4752 if (adapter->hw.mng_cookie.status & E1000_MNG_DHCP_COOKIE_STATUS_VLAN) in e1000e_close()
4754 adapter->mng_vlan_id); in e1000e_close()
4759 if ((adapter->flags & FLAG_HAS_AMT) && in e1000e_close()
4760 !test_bit(__E1000_TESTING, &adapter->state)) in e1000e_close()
4763 cpu_latency_qos_remove_request(&adapter->pm_qos_req); in e1000e_close()
4765 pm_runtime_put_sync(&pdev->dev); in e1000e_close()
4771 * e1000_set_mac - Change the Ethernet Address of the NIC
4780 struct e1000_hw *hw = &adapter->hw; in e1000_set_mac()
4783 if (!is_valid_ether_addr(addr->sa_data)) in e1000_set_mac()
4784 return -EADDRNOTAVAIL; in e1000_set_mac()
4786 eth_hw_addr_set(netdev, addr->sa_data); in e1000_set_mac()
4787 memcpy(adapter->hw.mac.addr, addr->sa_data, netdev->addr_len); in e1000_set_mac()
4789 hw->mac.ops.rar_set(&adapter->hw, adapter->hw.mac.addr, 0); in e1000_set_mac()
4791 if (adapter->flags & FLAG_RESET_OVERWRITES_LAA) { in e1000_set_mac()
4793 e1000e_set_laa_state_82571(&adapter->hw, 1); in e1000_set_mac()
4802 hw->mac.ops.rar_set(&adapter->hw, adapter->hw.mac.addr, in e1000_set_mac()
4803 adapter->hw.mac.rar_entry_count - 1); in e1000_set_mac()
4810 * e1000e_update_phy_task - work thread to update phy
4822 struct e1000_hw *hw = &adapter->hw; in e1000e_update_phy_task()
4824 if (test_bit(__E1000_DOWN, &adapter->state)) in e1000e_update_phy_task()
4830 if (hw->phy.type >= e1000_phy_82579) in e1000e_update_phy_task()
4835 * e1000_update_phy_info - timre call-back to update PHY info
4845 if (test_bit(__E1000_DOWN, &adapter->state)) in e1000_update_phy_info()
4848 schedule_work(&adapter->update_phy_task); in e1000_update_phy_info()
4852 * e1000e_update_phy_stats - Update the PHY statistics counters
4855 * Read/clear the upper 16-bit PHY registers and read/accumulate lower
4859 struct e1000_hw *hw = &adapter->hw; in e1000e_update_phy_stats()
4863 ret_val = hw->phy.ops.acquire(hw); in e1000e_update_phy_stats()
4870 hw->phy.addr = 1; in e1000e_update_phy_stats()
4876 ret_val = hw->phy.ops.set_page(hw, in e1000e_update_phy_stats()
4883 hw->phy.ops.read_reg_page(hw, HV_SCC_UPPER, &phy_data); in e1000e_update_phy_stats()
4884 ret_val = hw->phy.ops.read_reg_page(hw, HV_SCC_LOWER, &phy_data); in e1000e_update_phy_stats()
4886 adapter->stats.scc += phy_data; in e1000e_update_phy_stats()
4889 hw->phy.ops.read_reg_page(hw, HV_ECOL_UPPER, &phy_data); in e1000e_update_phy_stats()
4890 ret_val = hw->phy.ops.read_reg_page(hw, HV_ECOL_LOWER, &phy_data); in e1000e_update_phy_stats()
4892 adapter->stats.ecol += phy_data; in e1000e_update_phy_stats()
4895 hw->phy.ops.read_reg_page(hw, HV_MCC_UPPER, &phy_data); in e1000e_update_phy_stats()
4896 ret_val = hw->phy.ops.read_reg_page(hw, HV_MCC_LOWER, &phy_data); in e1000e_update_phy_stats()
4898 adapter->stats.mcc += phy_data; in e1000e_update_phy_stats()
4901 hw->phy.ops.read_reg_page(hw, HV_LATECOL_UPPER, &phy_data); in e1000e_update_phy_stats()
4902 ret_val = hw->phy.ops.read_reg_page(hw, HV_LATECOL_LOWER, &phy_data); in e1000e_update_phy_stats()
4904 adapter->stats.latecol += phy_data; in e1000e_update_phy_stats()
4906 /* Collision Count - also used for adaptive IFS */ in e1000e_update_phy_stats()
4907 hw->phy.ops.read_reg_page(hw, HV_COLC_UPPER, &phy_data); in e1000e_update_phy_stats()
4908 ret_val = hw->phy.ops.read_reg_page(hw, HV_COLC_LOWER, &phy_data); in e1000e_update_phy_stats()
4910 hw->mac.collision_delta = phy_data; in e1000e_update_phy_stats()
4913 hw->phy.ops.read_reg_page(hw, HV_DC_UPPER, &phy_data); in e1000e_update_phy_stats()
4914 ret_val = hw->phy.ops.read_reg_page(hw, HV_DC_LOWER, &phy_data); in e1000e_update_phy_stats()
4916 adapter->stats.dc += phy_data; in e1000e_update_phy_stats()
4919 hw->phy.ops.read_reg_page(hw, HV_TNCRS_UPPER, &phy_data); in e1000e_update_phy_stats()
4920 ret_val = hw->phy.ops.read_reg_page(hw, HV_TNCRS_LOWER, &phy_data); in e1000e_update_phy_stats()
4922 adapter->stats.tncrs += phy_data; in e1000e_update_phy_stats()
4925 hw->phy.ops.release(hw); in e1000e_update_phy_stats()
4929 * e1000e_update_stats - Update the board statistics counters
4934 struct net_device *netdev = adapter->netdev; in e1000e_update_stats()
4935 struct e1000_hw *hw = &adapter->hw; in e1000e_update_stats()
4936 struct pci_dev *pdev = adapter->pdev; in e1000e_update_stats()
4941 if (adapter->link_speed == 0) in e1000e_update_stats()
4946 adapter->stats.crcerrs += er32(CRCERRS); in e1000e_update_stats()
4947 adapter->stats.gprc += er32(GPRC); in e1000e_update_stats()
4948 adapter->stats.gorc += er32(GORCL); in e1000e_update_stats()
4950 adapter->stats.bprc += er32(BPRC); in e1000e_update_stats()
4951 adapter->stats.mprc += er32(MPRC); in e1000e_update_stats()
4952 adapter->stats.roc += er32(ROC); in e1000e_update_stats()
4954 adapter->stats.mpc += er32(MPC); in e1000e_update_stats()
4956 /* Half-duplex statistics */ in e1000e_update_stats()
4957 if (adapter->link_duplex == HALF_DUPLEX) { in e1000e_update_stats()
4958 if (adapter->flags2 & FLAG2_HAS_PHY_STATS) { in e1000e_update_stats()
4961 adapter->stats.scc += er32(SCC); in e1000e_update_stats()
4962 adapter->stats.ecol += er32(ECOL); in e1000e_update_stats()
4963 adapter->stats.mcc += er32(MCC); in e1000e_update_stats()
4964 adapter->stats.latecol += er32(LATECOL); in e1000e_update_stats()
4965 adapter->stats.dc += er32(DC); in e1000e_update_stats()
4967 hw->mac.collision_delta = er32(COLC); in e1000e_update_stats()
4969 if ((hw->mac.type != e1000_82574) && in e1000e_update_stats()
4970 (hw->mac.type != e1000_82583)) in e1000e_update_stats()
4971 adapter->stats.tncrs += er32(TNCRS); in e1000e_update_stats()
4973 adapter->stats.colc += hw->mac.collision_delta; in e1000e_update_stats()
4976 adapter->stats.xonrxc += er32(XONRXC); in e1000e_update_stats()
4977 adapter->stats.xontxc += er32(XONTXC); in e1000e_update_stats()
4978 adapter->stats.xoffrxc += er32(XOFFRXC); in e1000e_update_stats()
4979 adapter->stats.xofftxc += er32(XOFFTXC); in e1000e_update_stats()
4980 adapter->stats.gptc += er32(GPTC); in e1000e_update_stats()
4981 adapter->stats.gotc += er32(GOTCL); in e1000e_update_stats()
4983 adapter->stats.rnbc += er32(RNBC); in e1000e_update_stats()
4984 adapter->stats.ruc += er32(RUC); in e1000e_update_stats()
4986 adapter->stats.mptc += er32(MPTC); in e1000e_update_stats()
4987 adapter->stats.bptc += er32(BPTC); in e1000e_update_stats()
4991 hw->mac.tx_packet_delta = er32(TPT); in e1000e_update_stats()
4992 adapter->stats.tpt += hw->mac.tx_packet_delta; in e1000e_update_stats()
4994 adapter->stats.algnerrc += er32(ALGNERRC); in e1000e_update_stats()
4995 adapter->stats.rxerrc += er32(RXERRC); in e1000e_update_stats()
4996 adapter->stats.cexterr += er32(CEXTERR); in e1000e_update_stats()
4997 adapter->stats.tsctc += er32(TSCTC); in e1000e_update_stats()
4998 adapter->stats.tsctfc += er32(TSCTFC); in e1000e_update_stats()
5001 netdev->stats.multicast = adapter->stats.mprc; in e1000e_update_stats()
5002 netdev->stats.collisions = adapter->stats.colc; in e1000e_update_stats()
5009 netdev->stats.rx_errors = adapter->stats.rxerrc + in e1000e_update_stats()
5010 adapter->stats.crcerrs + adapter->stats.algnerrc + in e1000e_update_stats()
5011 adapter->stats.ruc + adapter->stats.roc + adapter->stats.cexterr; in e1000e_update_stats()
5012 netdev->stats.rx_length_errors = adapter->stats.ruc + in e1000e_update_stats()
5013 adapter->stats.roc; in e1000e_update_stats()
5014 netdev->stats.rx_crc_errors = adapter->stats.crcerrs; in e1000e_update_stats()
5015 netdev->stats.rx_frame_errors = adapter->stats.algnerrc; in e1000e_update_stats()
5016 netdev->stats.rx_missed_errors = adapter->stats.mpc; in e1000e_update_stats()
5019 netdev->stats.tx_errors = adapter->stats.ecol + adapter->stats.latecol; in e1000e_update_stats()
5020 netdev->stats.tx_aborted_errors = adapter->stats.ecol; in e1000e_update_stats()
5021 netdev->stats.tx_window_errors = adapter->stats.latecol; in e1000e_update_stats()
5022 netdev->stats.tx_carrier_errors = adapter->stats.tncrs; in e1000e_update_stats()
5027 adapter->stats.mgptc += er32(MGTPTC); in e1000e_update_stats()
5028 adapter->stats.mgprc += er32(MGTPRC); in e1000e_update_stats()
5029 adapter->stats.mgpdc += er32(MGTPDC); in e1000e_update_stats()
5032 if (hw->mac.type >= e1000_pch_lpt) { in e1000e_update_stats()
5035 adapter->corr_errors += in e1000e_update_stats()
5037 adapter->uncorr_errors += in e1000e_update_stats()
5044 * e1000_phy_read_status - Update the PHY register status snapshot
5049 struct e1000_hw *hw = &adapter->hw; in e1000_phy_read_status()
5050 struct e1000_phy_regs *phy = &adapter->phy_regs; in e1000_phy_read_status()
5052 if (!pm_runtime_suspended((&adapter->pdev->dev)->parent) && in e1000_phy_read_status()
5054 (adapter->hw.phy.media_type == e1000_media_type_copper)) { in e1000_phy_read_status()
5057 ret_val = e1e_rphy(hw, MII_BMCR, &phy->bmcr); in e1000_phy_read_status()
5058 ret_val |= e1e_rphy(hw, MII_BMSR, &phy->bmsr); in e1000_phy_read_status()
5059 ret_val |= e1e_rphy(hw, MII_ADVERTISE, &phy->advertise); in e1000_phy_read_status()
5060 ret_val |= e1e_rphy(hw, MII_LPA, &phy->lpa); in e1000_phy_read_status()
5061 ret_val |= e1e_rphy(hw, MII_EXPANSION, &phy->expansion); in e1000_phy_read_status()
5062 ret_val |= e1e_rphy(hw, MII_CTRL1000, &phy->ctrl1000); in e1000_phy_read_status()
5063 ret_val |= e1e_rphy(hw, MII_STAT1000, &phy->stat1000); in e1000_phy_read_status()
5064 ret_val |= e1e_rphy(hw, MII_ESTATUS, &phy->estatus); in e1000_phy_read_status()
5069 * Set values to typical power-on defaults in e1000_phy_read_status()
5071 phy->bmcr = (BMCR_SPEED1000 | BMCR_ANENABLE | BMCR_FULLDPLX); in e1000_phy_read_status()
5072 phy->bmsr = (BMSR_100FULL | BMSR_100HALF | BMSR_10FULL | in e1000_phy_read_status()
5075 phy->advertise = (ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP | in e1000_phy_read_status()
5077 phy->lpa = 0; in e1000_phy_read_status()
5078 phy->expansion = EXPANSION_ENABLENPAGE; in e1000_phy_read_status()
5079 phy->ctrl1000 = ADVERTISE_1000FULL; in e1000_phy_read_status()
5080 phy->stat1000 = 0; in e1000_phy_read_status()
5081 phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF); in e1000_phy_read_status()
5087 struct e1000_hw *hw = &adapter->hw; in e1000_print_link_info()
5091 netdev_info(adapter->netdev, in e1000_print_link_info()
5093 adapter->link_speed, in e1000_print_link_info()
5094 adapter->link_duplex == FULL_DUPLEX ? "Full" : "Half", in e1000_print_link_info()
5102 struct e1000_hw *hw = &adapter->hw; in e1000e_has_link()
5111 switch (hw->phy.media_type) { in e1000e_has_link()
5113 if (hw->mac.get_link_status) { in e1000e_has_link()
5114 ret_val = hw->mac.ops.check_for_link(hw); in e1000e_has_link()
5115 link_active = !hw->mac.get_link_status; in e1000e_has_link()
5121 ret_val = hw->mac.ops.check_for_link(hw); in e1000e_has_link()
5125 ret_val = hw->mac.ops.check_for_link(hw); in e1000e_has_link()
5126 link_active = hw->mac.serdes_has_link; in e1000e_has_link()
5133 if ((ret_val == -E1000_ERR_PHY) && (hw->phy.type == e1000_phy_igp_3) && in e1000e_has_link()
5145 if ((adapter->flags & FLAG_RX_NEEDS_RESTART) && in e1000e_enable_receives()
5146 (adapter->flags & FLAG_RESTART_NOW)) { in e1000e_enable_receives()
5147 struct e1000_hw *hw = &adapter->hw; in e1000e_enable_receives()
5151 adapter->flags &= ~FLAG_RESTART_NOW; in e1000e_enable_receives()
5157 struct e1000_hw *hw = &adapter->hw; in e1000e_check_82574_phy_workaround()
5163 adapter->phy_hang_count++; in e1000e_check_82574_phy_workaround()
5165 adapter->phy_hang_count = 0; in e1000e_check_82574_phy_workaround()
5167 if (adapter->phy_hang_count > 1) { in e1000e_check_82574_phy_workaround()
5168 adapter->phy_hang_count = 0; in e1000e_check_82574_phy_workaround()
5169 e_dbg("PHY appears hung - resetting\n"); in e1000e_check_82574_phy_workaround()
5170 schedule_work(&adapter->reset_task); in e1000e_check_82574_phy_workaround()
5175 * e1000_watchdog - Timer Call-back
5183 schedule_work(&adapter->watchdog_task); in e1000_watchdog()
5193 struct net_device *netdev = adapter->netdev; in e1000_watchdog_task()
5194 struct e1000_mac_info *mac = &adapter->hw.mac; in e1000_watchdog_task()
5195 struct e1000_phy_info *phy = &adapter->hw.phy; in e1000_watchdog_task()
5196 struct e1000_ring *tx_ring = adapter->tx_ring; in e1000_watchdog_task()
5198 struct e1000_hw *hw = &adapter->hw; in e1000_watchdog_task()
5201 if (test_bit(__E1000_DOWN, &adapter->state)) in e1000_watchdog_task()
5207 pm_runtime_resume(netdev->dev.parent); in e1000_watchdog_task()
5214 (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id)) in e1000_watchdog_task()
5222 pm_runtime_resume(netdev->dev.parent); in e1000_watchdog_task()
5237 e1000_phy_hw_reset(&adapter->hw); in e1000_watchdog_task()
5243 mac->ops.get_link_up_info(&adapter->hw, in e1000_watchdog_task()
5244 &adapter->link_speed, in e1000_watchdog_task()
5245 &adapter->link_duplex); in e1000_watchdog_task()
5250 if (phy->speed_downgraded) in e1000_watchdog_task()
5257 if ((hw->phy.type == e1000_phy_igp_3 || in e1000_watchdog_task()
5258 hw->phy.type == e1000_phy_bm) && in e1000_watchdog_task()
5259 hw->mac.autoneg && in e1000_watchdog_task()
5260 (adapter->link_speed == SPEED_10 || in e1000_watchdog_task()
5261 adapter->link_speed == SPEED_100) && in e1000_watchdog_task()
5262 (adapter->link_duplex == HALF_DUPLEX)) { in e1000_watchdog_task()
5272 adapter->tx_timeout_factor = 1; in e1000_watchdog_task()
5273 switch (adapter->link_speed) { in e1000_watchdog_task()
5276 adapter->tx_timeout_factor = 16; in e1000_watchdog_task()
5280 adapter->tx_timeout_factor = 10; in e1000_watchdog_task()
5284 /* workaround: re-program speed mode bit after in e1000_watchdog_task()
5285 * link-up event in e1000_watchdog_task()
5287 if ((adapter->flags & FLAG_TARC_SPEED_MODE_BIT) && in e1000_watchdog_task()
5299 if (!(adapter->flags & FLAG_TSO_FORCE)) { in e1000_watchdog_task()
5300 switch (adapter->link_speed) { in e1000_watchdog_task()
5304 netdev->features &= ~NETIF_F_TSO; in e1000_watchdog_task()
5305 netdev->features &= ~NETIF_F_TSO6; in e1000_watchdog_task()
5308 netdev->features |= NETIF_F_TSO; in e1000_watchdog_task()
5309 netdev->features |= NETIF_F_TSO6; in e1000_watchdog_task()
5315 if (hw->mac.type == e1000_pch_spt) { in e1000_watchdog_task()
5316 netdev->features &= ~NETIF_F_TSO; in e1000_watchdog_task()
5317 netdev->features &= ~NETIF_F_TSO6; in e1000_watchdog_task()
5328 /* Perform any post-link-up configuration before in e1000_watchdog_task()
5331 if (phy->ops.cfg_on_link_up) in e1000_watchdog_task()
5332 phy->ops.cfg_on_link_up(hw); in e1000_watchdog_task()
5337 if (!test_bit(__E1000_DOWN, &adapter->state)) in e1000_watchdog_task()
5338 mod_timer(&adapter->phy_info_timer, in e1000_watchdog_task()
5343 adapter->link_speed = 0; in e1000_watchdog_task()
5344 adapter->link_duplex = 0; in e1000_watchdog_task()
5349 if (!test_bit(__E1000_DOWN, &adapter->state)) in e1000_watchdog_task()
5350 mod_timer(&adapter->phy_info_timer, in e1000_watchdog_task()
5353 /* 8000ES2LAN requires a Rx packet buffer work-around in e1000_watchdog_task()
5357 if (adapter->flags & FLAG_RX_NEEDS_RESTART) in e1000_watchdog_task()
5358 adapter->flags |= FLAG_RESTART_NOW; in e1000_watchdog_task()
5360 pm_schedule_suspend(netdev->dev.parent, in e1000_watchdog_task()
5366 spin_lock(&adapter->stats64_lock); in e1000_watchdog_task()
5369 mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old; in e1000_watchdog_task()
5370 adapter->tpt_old = adapter->stats.tpt; in e1000_watchdog_task()
5371 mac->collision_delta = adapter->stats.colc - adapter->colc_old; in e1000_watchdog_task()
5372 adapter->colc_old = adapter->stats.colc; in e1000_watchdog_task()
5374 adapter->gorc = adapter->stats.gorc - adapter->gorc_old; in e1000_watchdog_task()
5375 adapter->gorc_old = adapter->stats.gorc; in e1000_watchdog_task()
5376 adapter->gotc = adapter->stats.gotc - adapter->gotc_old; in e1000_watchdog_task()
5377 adapter->gotc_old = adapter->stats.gotc; in e1000_watchdog_task()
5378 spin_unlock(&adapter->stats64_lock); in e1000_watchdog_task()
5385 (e1000_desc_unused(tx_ring) + 1 < tx_ring->count)) in e1000_watchdog_task()
5386 adapter->flags |= FLAG_RESTART_NOW; in e1000_watchdog_task()
5389 if (adapter->flags & FLAG_RESTART_NOW) { in e1000_watchdog_task()
5390 schedule_work(&adapter->reset_task); in e1000_watchdog_task()
5395 e1000e_update_adaptive(&adapter->hw); in e1000_watchdog_task()
5398 if (adapter->itr_setting == 4) { in e1000_watchdog_task()
5401 * everyone else is between 2000-8000. in e1000_watchdog_task()
5403 u32 goc = (adapter->gotc + adapter->gorc) / 10000; in e1000_watchdog_task()
5404 u32 dif = (adapter->gotc > adapter->gorc ? in e1000_watchdog_task()
5405 adapter->gotc - adapter->gorc : in e1000_watchdog_task()
5406 adapter->gorc - adapter->gotc) / 10000; in e1000_watchdog_task()
5413 if (adapter->msix_entries) in e1000_watchdog_task()
5414 ew32(ICS, adapter->rx_ring->ims_val); in e1000_watchdog_task()
5422 adapter->detect_tx_hung = true; in e1000_watchdog_task()
5428 hw->mac.ops.rar_set(hw, adapter->hw.mac.addr, 0); in e1000_watchdog_task()
5430 if (adapter->flags2 & FLAG2_CHECK_PHY_HANG) in e1000_watchdog_task()
5434 if (adapter->hwtstamp_config.rx_filter != HWTSTAMP_FILTER_NONE) { in e1000_watchdog_task()
5435 if ((adapter->flags2 & FLAG2_CHECK_RX_HWTSTAMP) && in e1000_watchdog_task()
5438 adapter->rx_hwtstamp_cleared++; in e1000_watchdog_task()
5440 adapter->flags2 |= FLAG2_CHECK_RX_HWTSTAMP; in e1000_watchdog_task()
5445 if (!test_bit(__E1000_DOWN, &adapter->state)) in e1000_watchdog_task()
5446 mod_timer(&adapter->watchdog_timer, in e1000_watchdog_task()
5478 mss = skb_shinfo(skb)->gso_size; in e1000_tso()
5481 iph->tot_len = 0; in e1000_tso()
5482 iph->check = 0; in e1000_tso()
5483 tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, in e1000_tso()
5486 ipcse = skb_transport_offset(skb) - 1; in e1000_tso()
5492 ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data; in e1000_tso()
5494 tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data; in e1000_tso()
5497 E1000_TXD_CMD_TCP | (skb->len - (hdr_len))); in e1000_tso()
5499 i = tx_ring->next_to_use; in e1000_tso()
5501 buffer_info = &tx_ring->buffer_info[i]; in e1000_tso()
5503 context_desc->lower_setup.ip_fields.ipcss = ipcss; in e1000_tso()
5504 context_desc->lower_setup.ip_fields.ipcso = ipcso; in e1000_tso()
5505 context_desc->lower_setup.ip_fields.ipcse = cpu_to_le16(ipcse); in e1000_tso()
5506 context_desc->upper_setup.tcp_fields.tucss = tucss; in e1000_tso()
5507 context_desc->upper_setup.tcp_fields.tucso = tucso; in e1000_tso()
5508 context_desc->upper_setup.tcp_fields.tucse = 0; in e1000_tso()
5509 context_desc->tcp_seg_setup.fields.mss = cpu_to_le16(mss); in e1000_tso()
5510 context_desc->tcp_seg_setup.fields.hdr_len = hdr_len; in e1000_tso()
5511 context_desc->cmd_and_length = cpu_to_le32(cmd_length); in e1000_tso()
5513 buffer_info->time_stamp = jiffies; in e1000_tso()
5514 buffer_info->next_to_watch = i; in e1000_tso()
5517 if (i == tx_ring->count) in e1000_tso()
5519 tx_ring->next_to_use = i; in e1000_tso()
5527 struct e1000_adapter *adapter = tx_ring->adapter; in e1000_tx_csum()
5534 if (skb->ip_summed != CHECKSUM_PARTIAL) in e1000_tx_csum()
5539 if (ip_hdr(skb)->protocol == IPPROTO_TCP) in e1000_tx_csum()
5544 if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP) in e1000_tx_csum()
5556 i = tx_ring->next_to_use; in e1000_tx_csum()
5557 buffer_info = &tx_ring->buffer_info[i]; in e1000_tx_csum()
5560 context_desc->lower_setup.ip_config = 0; in e1000_tx_csum()
5561 context_desc->upper_setup.tcp_fields.tucss = css; in e1000_tx_csum()
5562 context_desc->upper_setup.tcp_fields.tucso = css + skb->csum_offset; in e1000_tx_csum()
5563 context_desc->upper_setup.tcp_fields.tucse = 0; in e1000_tx_csum()
5564 context_desc->tcp_seg_setup.data = 0; in e1000_tx_csum()
5565 context_desc->cmd_and_length = cpu_to_le32(cmd_len); in e1000_tx_csum()
5567 buffer_info->time_stamp = jiffies; in e1000_tx_csum()
5568 buffer_info->next_to_watch = i; in e1000_tx_csum()
5571 if (i == tx_ring->count) in e1000_tx_csum()
5573 tx_ring->next_to_use = i; in e1000_tx_csum()
5582 struct e1000_adapter *adapter = tx_ring->adapter; in e1000_tx_map()
5583 struct pci_dev *pdev = adapter->pdev; in e1000_tx_map()
5589 i = tx_ring->next_to_use; in e1000_tx_map()
5592 buffer_info = &tx_ring->buffer_info[i]; in e1000_tx_map()
5595 buffer_info->length = size; in e1000_tx_map()
5596 buffer_info->time_stamp = jiffies; in e1000_tx_map()
5597 buffer_info->next_to_watch = i; in e1000_tx_map()
5598 buffer_info->dma = dma_map_single(&pdev->dev, in e1000_tx_map()
5599 skb->data + offset, in e1000_tx_map()
5601 buffer_info->mapped_as_page = false; in e1000_tx_map()
5602 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) in e1000_tx_map()
5605 len -= size; in e1000_tx_map()
5611 if (i == tx_ring->count) in e1000_tx_map()
5617 const skb_frag_t *frag = &skb_shinfo(skb)->frags[f]; in e1000_tx_map()
5624 if (i == tx_ring->count) in e1000_tx_map()
5627 buffer_info = &tx_ring->buffer_info[i]; in e1000_tx_map()
5630 buffer_info->length = size; in e1000_tx_map()
5631 buffer_info->time_stamp = jiffies; in e1000_tx_map()
5632 buffer_info->next_to_watch = i; in e1000_tx_map()
5633 buffer_info->dma = skb_frag_dma_map(&pdev->dev, frag, in e1000_tx_map()
5636 buffer_info->mapped_as_page = true; in e1000_tx_map()
5637 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) in e1000_tx_map()
5640 len -= size; in e1000_tx_map()
5646 segs = skb_shinfo(skb)->gso_segs ? : 1; in e1000_tx_map()
5648 bytecount = ((segs - 1) * skb_headlen(skb)) + skb->len; in e1000_tx_map()
5650 tx_ring->buffer_info[i].skb = skb; in e1000_tx_map()
5651 tx_ring->buffer_info[i].segs = segs; in e1000_tx_map()
5652 tx_ring->buffer_info[i].bytecount = bytecount; in e1000_tx_map()
5653 tx_ring->buffer_info[first].next_to_watch = i; in e1000_tx_map()
5658 dev_err(&pdev->dev, "Tx DMA map failed\n"); in e1000_tx_map()
5659 buffer_info->dma = 0; in e1000_tx_map()
5661 count--; in e1000_tx_map()
5663 while (count--) { in e1000_tx_map()
5665 i += tx_ring->count; in e1000_tx_map()
5666 i--; in e1000_tx_map()
5667 buffer_info = &tx_ring->buffer_info[i]; in e1000_tx_map()
5676 struct e1000_adapter *adapter = tx_ring->adapter; in e1000_tx_queue()
5709 i = tx_ring->next_to_use; in e1000_tx_queue()
5712 buffer_info = &tx_ring->buffer_info[i]; in e1000_tx_queue()
5714 tx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); in e1000_tx_queue()
5715 tx_desc->lower.data = cpu_to_le32(txd_lower | in e1000_tx_queue()
5716 buffer_info->length); in e1000_tx_queue()
5717 tx_desc->upper.data = cpu_to_le32(txd_upper); in e1000_tx_queue()
5720 if (i == tx_ring->count) in e1000_tx_queue()
5722 } while (--count > 0); in e1000_tx_queue()
5724 tx_desc->lower.data |= cpu_to_le32(adapter->txd_cmd); in e1000_tx_queue()
5726 /* txd_cmd re-enables FCS, so we'll re-disable it here as desired. */ in e1000_tx_queue()
5728 tx_desc->lower.data &= ~(cpu_to_le32(E1000_TXD_CMD_IFCS)); in e1000_tx_queue()
5732 * applicable for weak-ordered memory model archs, in e1000_tx_queue()
5733 * such as IA-64). in e1000_tx_queue()
5737 tx_ring->next_to_use = i; in e1000_tx_queue()
5744 struct e1000_hw *hw = &adapter->hw; in e1000_transfer_dhcp_info()
5748 !((skb_vlan_tag_get(skb) == adapter->hw.mng_cookie.vlan_id) && in e1000_transfer_dhcp_info()
5749 (adapter->hw.mng_cookie.status & in e1000_transfer_dhcp_info()
5753 if (skb->len <= MINIMUM_DHCP_PACKET_SIZE) in e1000_transfer_dhcp_info()
5756 if (((struct ethhdr *)skb->data)->h_proto != htons(ETH_P_IP)) in e1000_transfer_dhcp_info()
5760 const struct iphdr *ip = (struct iphdr *)((u8 *)skb->data + 14); in e1000_transfer_dhcp_info()
5763 if (ip->protocol != IPPROTO_UDP) in e1000_transfer_dhcp_info()
5766 udp = (struct udphdr *)((u8 *)ip + (ip->ihl << 2)); in e1000_transfer_dhcp_info()
5767 if (ntohs(udp->dest) != 67) in e1000_transfer_dhcp_info()
5770 offset = (u8 *)udp + 8 - skb->data; in e1000_transfer_dhcp_info()
5771 length = skb->len - offset; in e1000_transfer_dhcp_info()
5780 struct e1000_adapter *adapter = tx_ring->adapter; in __e1000_maybe_stop_tx()
5782 netif_stop_queue(adapter->netdev); in __e1000_maybe_stop_tx()
5793 return -EBUSY; in __e1000_maybe_stop_tx()
5796 netif_start_queue(adapter->netdev); in __e1000_maybe_stop_tx()
5797 ++adapter->restart_queue; in __e1000_maybe_stop_tx()
5803 BUG_ON(size > tx_ring->count); in e1000_maybe_stop_tx()
5814 struct e1000_ring *tx_ring = adapter->tx_ring; in e1000_xmit_frame()
5825 if (test_bit(__E1000_DOWN, &adapter->state)) { in e1000_xmit_frame()
5830 if (skb->len <= 0) { in e1000_xmit_frame()
5841 mss = skb_shinfo(skb)->gso_size; in e1000_xmit_frame()
5845 /* TSO Workaround for 82571/2/3 Controllers -- if skb->data in e1000_xmit_frame()
5847 * frags into skb->data in e1000_xmit_frame()
5850 /* we do this workaround for ES2LAN, but it is un-necessary, in e1000_xmit_frame()
5853 if (skb->data_len && (hdr_len == len)) { in e1000_xmit_frame()
5856 pull_size = min_t(unsigned int, 4, skb->data_len); in e1000_xmit_frame()
5867 if ((mss) || (skb->ip_summed == CHECKSUM_PARTIAL)) in e1000_xmit_frame()
5871 count += DIV_ROUND_UP(len, adapter->tx_fifo_limit); in e1000_xmit_frame()
5873 nr_frags = skb_shinfo(skb)->nr_frags; in e1000_xmit_frame()
5875 count += DIV_ROUND_UP(skb_frag_size(&skb_shinfo(skb)->frags[f]), in e1000_xmit_frame()
5876 adapter->tx_fifo_limit); in e1000_xmit_frame()
5878 if (adapter->hw.mac.tx_pkt_filtering) in e1000_xmit_frame()
5893 first = tx_ring->next_to_use; in e1000_xmit_frame()
5913 if (unlikely(skb->no_fcs)) in e1000_xmit_frame()
5917 count = e1000_tx_map(tx_ring, skb, first, adapter->tx_fifo_limit, in e1000_xmit_frame()
5920 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && in e1000_xmit_frame()
5921 (adapter->flags & FLAG_HAS_HW_TIMESTAMP)) { in e1000_xmit_frame()
5922 if (!adapter->tx_hwtstamp_skb) { in e1000_xmit_frame()
5923 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; in e1000_xmit_frame()
5925 adapter->tx_hwtstamp_skb = skb_get(skb); in e1000_xmit_frame()
5926 adapter->tx_hwtstamp_start = jiffies; in e1000_xmit_frame()
5927 schedule_work(&adapter->tx_hwtstamp_work); in e1000_xmit_frame()
5929 adapter->tx_hwtstamp_skipped++; in e1000_xmit_frame()
5935 netdev_sent_queue(netdev, skb->len); in e1000_xmit_frame()
5941 adapter->tx_fifo_limit) + 4)); in e1000_xmit_frame()
5945 if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA) in e1000_xmit_frame()
5947 tx_ring->next_to_use); in e1000_xmit_frame()
5949 writel(tx_ring->next_to_use, tx_ring->tail); in e1000_xmit_frame()
5953 tx_ring->buffer_info[first].time_stamp = 0; in e1000_xmit_frame()
5954 tx_ring->next_to_use = first; in e1000_xmit_frame()
5961 * e1000_tx_timeout - Respond to a Tx Hang
5970 adapter->tx_timeout_count++; in e1000_tx_timeout()
5971 schedule_work(&adapter->reset_task); in e1000_tx_timeout()
5981 if (test_bit(__E1000_DOWN, &adapter->state)) { in e1000_reset_task()
5986 if (!(adapter->flags & FLAG_RESTART_NOW)) { in e1000_reset_task()
5995 * e1000e_get_stats64 - Get System Network Statistics
6006 spin_lock(&adapter->stats64_lock); in e1000e_get_stats64()
6009 stats->rx_bytes = adapter->stats.gorc; in e1000e_get_stats64()
6010 stats->rx_packets = adapter->stats.gprc; in e1000e_get_stats64()
6011 stats->tx_bytes = adapter->stats.gotc; in e1000e_get_stats64()
6012 stats->tx_packets = adapter->stats.gptc; in e1000e_get_stats64()
6013 stats->multicast = adapter->stats.mprc; in e1000e_get_stats64()
6014 stats->collisions = adapter->stats.colc; in e1000e_get_stats64()
6021 stats->rx_errors = adapter->stats.rxerrc + in e1000e_get_stats64()
6022 adapter->stats.crcerrs + adapter->stats.algnerrc + in e1000e_get_stats64()
6023 adapter->stats.ruc + adapter->stats.roc + adapter->stats.cexterr; in e1000e_get_stats64()
6024 stats->rx_length_errors = adapter->stats.ruc + adapter->stats.roc; in e1000e_get_stats64()
6025 stats->rx_crc_errors = adapter->stats.crcerrs; in e1000e_get_stats64()
6026 stats->rx_frame_errors = adapter->stats.algnerrc; in e1000e_get_stats64()
6027 stats->rx_missed_errors = adapter->stats.mpc; in e1000e_get_stats64()
6030 stats->tx_errors = adapter->stats.ecol + adapter->stats.latecol; in e1000e_get_stats64()
6031 stats->tx_aborted_errors = adapter->stats.ecol; in e1000e_get_stats64()
6032 stats->tx_window_errors = adapter->stats.latecol; in e1000e_get_stats64()
6033 stats->tx_carrier_errors = adapter->stats.tncrs; in e1000e_get_stats64()
6037 spin_unlock(&adapter->stats64_lock); in e1000e_get_stats64()
6041 * e1000_change_mtu - Change the Maximum Transfer Unit
6054 !(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { in e1000_change_mtu()
6056 return -EINVAL; in e1000_change_mtu()
6060 if ((adapter->hw.mac.type >= e1000_pch2lan) && in e1000_change_mtu()
6061 !(adapter->flags2 & FLAG2_CRC_STRIPPING) && in e1000_change_mtu()
6064 return -EINVAL; in e1000_change_mtu()
6067 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) in e1000_change_mtu()
6069 /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */ in e1000_change_mtu()
6070 adapter->max_frame_size = max_frame; in e1000_change_mtu()
6072 netdev->mtu, new_mtu); in e1000_change_mtu()
6073 netdev->mtu = new_mtu; in e1000_change_mtu()
6075 pm_runtime_get_sync(netdev->dev.parent); in e1000_change_mtu()
6083 * i.e. RXBUFFER_2048 --> size-4096 slab in e1000_change_mtu()
6089 adapter->rx_buffer_len = 2048; in e1000_change_mtu()
6091 adapter->rx_buffer_len = 4096; in e1000_change_mtu()
6095 adapter->rx_buffer_len = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN; in e1000_change_mtu()
6102 pm_runtime_put_sync(netdev->dev.parent); in e1000_change_mtu()
6104 clear_bit(__E1000_RESETTING, &adapter->state); in e1000_change_mtu()
6115 if (adapter->hw.phy.media_type != e1000_media_type_copper) in e1000_mii_ioctl()
6116 return -EOPNOTSUPP; in e1000_mii_ioctl()
6120 data->phy_id = adapter->hw.phy.addr; in e1000_mii_ioctl()
6125 switch (data->reg_num & 0x1F) { in e1000_mii_ioctl()
6127 data->val_out = adapter->phy_regs.bmcr; in e1000_mii_ioctl()
6130 data->val_out = adapter->phy_regs.bmsr; in e1000_mii_ioctl()
6133 data->val_out = (adapter->hw.phy.id >> 16); in e1000_mii_ioctl()
6136 data->val_out = (adapter->hw.phy.id & 0xFFFF); in e1000_mii_ioctl()
6139 data->val_out = adapter->phy_regs.advertise; in e1000_mii_ioctl()
6142 data->val_out = adapter->phy_regs.lpa; in e1000_mii_ioctl()
6145 data->val_out = adapter->phy_regs.expansion; in e1000_mii_ioctl()
6148 data->val_out = adapter->phy_regs.ctrl1000; in e1000_mii_ioctl()
6151 data->val_out = adapter->phy_regs.stat1000; in e1000_mii_ioctl()
6154 data->val_out = adapter->phy_regs.estatus; in e1000_mii_ioctl()
6157 return -EIO; in e1000_mii_ioctl()
6162 return -EOPNOTSUPP; in e1000_mii_ioctl()
6168 * e1000e_hwtstamp_set - control hardware time stamping
6189 if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) in e1000e_hwtstamp_set()
6190 return -EFAULT; in e1000e_hwtstamp_set()
6214 return copy_to_user(ifr->ifr_data, &config, in e1000e_hwtstamp_set()
6215 sizeof(config)) ? -EFAULT : 0; in e1000e_hwtstamp_set()
6222 return copy_to_user(ifr->ifr_data, &adapter->hwtstamp_config, in e1000e_hwtstamp_get()
6223 sizeof(adapter->hwtstamp_config)) ? -EFAULT : 0; in e1000e_hwtstamp_get()
6238 return -EOPNOTSUPP; in e1000_ioctl()
6244 struct e1000_hw *hw = &adapter->hw; in e1000_init_phy_wakeup()
6252 retval = hw->phy.ops.acquire(hw); in e1000_init_phy_wakeup()
6263 /* copy MAC MTA to PHY MTA - only needed for pchlan */ in e1000_init_phy_wakeup()
6264 for (i = 0; i < adapter->hw.mac.mta_reg_count; i++) { in e1000_init_phy_wakeup()
6266 hw->phy.ops.write_reg_page(hw, BM_MTA(i), in e1000_init_phy_wakeup()
6268 hw->phy.ops.write_reg_page(hw, BM_MTA(i) + 1, in e1000_init_phy_wakeup()
6273 hw->phy.ops.read_reg_page(&adapter->hw, BM_RCTL, &phy_reg); in e1000_init_phy_wakeup()
6290 hw->phy.ops.write_reg_page(&adapter->hw, BM_RCTL, phy_reg); in e1000_init_phy_wakeup()
6302 hw->phy.ops.write_reg_page(&adapter->hw, BM_WUFC, wufc); in e1000_init_phy_wakeup()
6303 hw->phy.ops.write_reg_page(&adapter->hw, BM_WUC, wuc); in e1000_init_phy_wakeup()
6311 hw->phy.ops.release(hw); in e1000_init_phy_wakeup()
6320 struct e1000_hw *hw = &adapter->hw; in e1000e_flush_lpic()
6323 pm_runtime_get_sync(netdev->dev.parent); in e1000e_flush_lpic()
6325 ret_val = hw->phy.ops.acquire(hw); in e1000e_flush_lpic()
6332 hw->phy.ops.release(hw); in e1000e_flush_lpic()
6335 pm_runtime_put_sync(netdev->dev.parent); in e1000e_flush_lpic()
6341 struct e1000_hw *hw = &adapter->hw; in e1000e_s0ix_entry_flow()
6346 hw->mac.type >= e1000_pch_adp) { in e1000e_s0ix_entry_flow()
6381 * page769_20[7] - PHY PLL stop in e1000e_s0ix_entry_flow()
6382 * page769_20[8] - PHY go to the electrical idle in e1000e_s0ix_entry_flow()
6383 * page769_20[9] - PHY serdes disable in e1000e_s0ix_entry_flow()
6384 * Gate PPW via EXTCNF_CTRL - set 0x0F00[7] = 1 in e1000e_s0ix_entry_flow()
6489 struct e1000_hw *hw = &adapter->hw; in e1000e_s0ix_exit_flow()
6496 hw->mac.type >= e1000_pch_adp) { in e1000e_s0ix_exit_flow()
6630 while (test_bit(__E1000_RESETTING, &adapter->state) && count--) in e1000e_pm_freeze()
6633 WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); in e1000e_pm_freeze()
6644 e1000e_disable_pcie_master(&adapter->hw); in e1000e_pm_freeze()
6653 struct e1000_hw *hw = &adapter->hw; in __e1000_shutdown()
6660 else if (device_may_wakeup(&pdev->dev)) in __e1000_shutdown()
6661 wufc = adapter->wol; in __e1000_shutdown()
6673 /* turn on all-multi mode if wake on multicast is enabled */ in __e1000_shutdown()
6682 if (!(adapter->flags2 & FLAG2_HAS_PHY_WAKEUP)) in __e1000_shutdown()
6686 if (adapter->hw.phy.media_type == e1000_media_type_fiber || in __e1000_shutdown()
6687 adapter->hw.phy.media_type == in __e1000_shutdown()
6698 if (adapter->flags & FLAG_IS_ICH) in __e1000_shutdown()
6699 e1000_suspend_workarounds_ich8lan(&adapter->hw); in __e1000_shutdown()
6701 if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) { in __e1000_shutdown()
6718 if (adapter->hw.phy.type == e1000_phy_igp_3) { in __e1000_shutdown()
6719 e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); in __e1000_shutdown()
6720 } else if (hw->mac.type >= e1000_pch_lpt) { in __e1000_shutdown()
6734 if ((hw->phy.type >= e1000_phy_i217) && in __e1000_shutdown()
6735 adapter->eee_advert && hw->dev_spec.ich8lan.eee_lp_ability) { in __e1000_shutdown()
6738 retval = hw->phy.ops.acquire(hw); in __e1000_shutdown()
6743 if (adapter->eee_advert & in __e1000_shutdown()
6744 hw->dev_spec.ich8lan.eee_lp_ability & in __e1000_shutdown()
6747 if (adapter->eee_advert & in __e1000_shutdown()
6748 hw->dev_spec.ich8lan.eee_lp_ability & in __e1000_shutdown()
6756 hw->phy.ops.release(hw); in __e1000_shutdown()
6766 /* The pci-e switch on some quad port adapters will report a in __e1000_shutdown()
6769 * downstream port of the pci-e switch. in __e1000_shutdown()
6775 if (adapter->flags & FLAG_IS_QUAD_PORT) { in __e1000_shutdown()
6776 struct pci_dev *us_dev = pdev->bus->self; in __e1000_shutdown()
6796 * __e1000e_disable_aspm - Disable ASPM states
6798 * @state: bit-mask of ASPM states to disable
6805 struct pci_dev *parent = pdev->bus->self; in __e1000e_disable_aspm()
6835 dev_info(&pdev->dev, "Disabling ASPM %s %s\n", in __e1000e_disable_aspm()
6847 /* Double-check ASPM control. If not disabled by the above, the in __e1000e_disable_aspm()
6869 * e1000e_disable_aspm - Disable ASPM states.
6871 * @state: bit-mask of ASPM states to disable
6882 * e1000e_disable_aspm_locked - Disable ASPM states.
6884 * @state: bit-mask of ASPM states to disable
6922 struct e1000_hw *hw = &adapter->hw; in __e1000_resume()
6925 if (adapter->flags2 & FLAG2_DISABLE_ASPM_L0S) in __e1000_resume()
6927 if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1) in __e1000_resume()
6934 if (hw->mac.type >= e1000_pch2lan) in __e1000_resume()
6935 e1000_resume_workarounds_pchlan(&adapter->hw); in __e1000_resume()
6940 if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) { in __e1000_resume()
6943 e1e_rphy(&adapter->hw, BM_WUS, &phy_data); in __e1000_resume()
6945 e_info("PHY Wakeup cause - %s\n", in __e1000_resume()
6953 e1e_wphy(&adapter->hw, BM_WUS, ~0); in __e1000_resume()
6958 e_info("MAC Wakeup cause - %s\n", in __e1000_resume()
6977 if (!(adapter->flags & FLAG_HAS_AMT)) in __e1000_resume()
7005 if (adapter->flags2 & FLAG2_ENABLE_S0IX_FLOWS) in e1000e_pm_suspend()
7020 if (adapter->flags2 & FLAG2_ENABLE_S0IX_FLOWS) in e1000e_pm_resume()
7036 eee_lp = adapter->hw.dev_spec.ich8lan.eee_lp_ability; in e1000e_pm_runtime_idle()
7039 adapter->hw.dev_spec.ich8lan.eee_lp_ability = eee_lp; in e1000e_pm_runtime_idle()
7043 return -EBUSY; in e1000e_pm_runtime_idle()
7057 if (netdev->flags & IFF_UP) in e1000e_pm_runtime_resume()
7069 if (netdev->flags & IFF_UP) { in e1000e_pm_runtime_suspend()
7072 while (test_bit(__E1000_RESETTING, &adapter->state) && count--) in e1000e_pm_runtime_suspend()
7075 WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); in e1000e_pm_runtime_suspend()
7083 return -EBUSY; in e1000e_pm_runtime_suspend()
7093 e1000e_pm_freeze(&pdev->dev); in e1000_shutdown()
7105 if (adapter->msix_entries) { in e1000_intr_msix()
7109 msix_irq = adapter->msix_entries[vector].vector; in e1000_intr_msix()
7115 msix_irq = adapter->msix_entries[vector].vector; in e1000_intr_msix()
7121 msix_irq = adapter->msix_entries[vector].vector; in e1000_intr_msix()
7134 * Polling 'interrupt' - used by things like netconsole to send skbs
7135 * without having to re-enable interrupts. It's not called while
7142 switch (adapter->int_mode) { in e1000_netpoll()
7144 e1000_intr_msix(adapter->pdev->irq, netdev); in e1000_netpoll()
7147 if (disable_hardirq(adapter->pdev->irq)) in e1000_netpoll()
7148 e1000_intr_msi(adapter->pdev->irq, netdev); in e1000_netpoll()
7149 enable_irq(adapter->pdev->irq); in e1000_netpoll()
7152 if (disable_hardirq(adapter->pdev->irq)) in e1000_netpoll()
7153 e1000_intr(adapter->pdev->irq, netdev); in e1000_netpoll()
7154 enable_irq(adapter->pdev->irq); in e1000_netpoll()
7161 * e1000_io_error_detected - called when PCI error is detected
7171 e1000e_pm_freeze(&pdev->dev); in e1000_io_error_detected()
7183 * e1000_io_slot_reset - called after the pci bus has been reset.
7186 * Restart the card from scratch, as if from a cold-boot. Implementation
7187 * resembles the first-half of the e1000e_pm_resume routine.
7193 struct e1000_hw *hw = &adapter->hw; in e1000_io_slot_reset()
7198 if (adapter->flags2 & FLAG2_DISABLE_ASPM_L0S) in e1000_io_slot_reset()
7200 if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1) in e1000_io_slot_reset()
7207 dev_err(&pdev->dev, in e1000_io_slot_reset()
7208 "Cannot re-enable PCI device after reset.\n"); in e1000_io_slot_reset()
7211 pdev->state_saved = true; in e1000_io_slot_reset()
7227 * e1000_io_resume - called when traffic can start flowing again.
7232 * second-half of the e1000e_pm_resume routine.
7241 e1000e_pm_thaw(&pdev->dev); in e1000_io_resume()
7247 if (!(adapter->flags & FLAG_HAS_AMT)) in e1000_io_resume()
7253 struct e1000_hw *hw = &adapter->hw; in e1000_print_device_info()
7254 struct net_device *netdev = adapter->netdev; in e1000_print_device_info()
7261 ((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" : in e1000_print_device_info()
7264 netdev->dev_addr); in e1000_print_device_info()
7266 (hw->phy.type == e1000_phy_ife) ? "10/100" : "1000"); in e1000_print_device_info()
7272 hw->mac.type, hw->phy.type, pba_str); in e1000_print_device_info()
7277 struct e1000_hw *hw = &adapter->hw; in e1000_eeprom_checks()
7281 if (hw->mac.type != e1000_82573) in e1000_eeprom_checks()
7288 dev_warn(&adapter->pdev->dev, in e1000_eeprom_checks()
7297 struct e1000_hw *hw = &adapter->hw; in e1000_fix_features()
7300 if ((hw->mac.type >= e1000_pch2lan) && (netdev->mtu > ETH_DATA_LEN)) in e1000_fix_features()
7318 netdev_features_t changed = features ^ netdev->features; in e1000_set_features()
7321 adapter->flags |= FLAG_TSO_FORCE; in e1000_set_features()
7330 adapter->flags2 &= ~FLAG2_CRC_STRIPPING; in e1000_set_features()
7335 if (adapter->flags2 & FLAG2_DFLT_CRC_STRIPPING) in e1000_set_features()
7336 adapter->flags2 |= FLAG2_CRC_STRIPPING; in e1000_set_features()
7338 adapter->flags2 &= ~FLAG2_CRC_STRIPPING; in e1000_set_features()
7342 netdev->features = features; in e1000_set_features()
7375 * e1000_probe - Device Initialization Routine
7390 const struct e1000_info *ei = e1000_info_tbl[ent->driver_data]; in e1000_probe()
7400 if (ei->flags2 & FLAG2_DISABLE_ASPM_L0S) in e1000_probe()
7402 if (ei->flags2 & FLAG2_DISABLE_ASPM_L1) in e1000_probe()
7411 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); in e1000_probe()
7413 dev_err(&pdev->dev, in e1000_probe()
7433 err = -ENOMEM; in e1000_probe()
7438 SET_NETDEV_DEV(netdev, &pdev->dev); in e1000_probe()
7440 netdev->irq = pdev->irq; in e1000_probe()
7444 hw = &adapter->hw; in e1000_probe()
7445 adapter->netdev = netdev; in e1000_probe()
7446 adapter->pdev = pdev; in e1000_probe()
7447 adapter->ei = ei; in e1000_probe()
7448 adapter->pba = ei->pba; in e1000_probe()
7449 adapter->flags = ei->flags; in e1000_probe()
7450 adapter->flags2 = ei->flags2; in e1000_probe()
7451 adapter->hw.adapter = adapter; in e1000_probe()
7452 adapter->hw.mac.type = ei->mac; in e1000_probe()
7453 adapter->max_hw_frame_size = ei->max_hw_frame_size; in e1000_probe()
7454 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); in e1000_probe()
7459 err = -EIO; in e1000_probe()
7460 adapter->hw.hw_addr = ioremap(mmio_start, mmio_len); in e1000_probe()
7461 if (!adapter->hw.hw_addr) in e1000_probe()
7464 if ((adapter->flags & FLAG_HAS_FLASH) && in e1000_probe()
7466 (hw->mac.type < e1000_pch_spt)) { in e1000_probe()
7469 adapter->hw.flash_address = ioremap(flash_start, flash_len); in e1000_probe()
7470 if (!adapter->hw.flash_address) in e1000_probe()
7475 if (adapter->flags2 & FLAG2_HAS_EEE) in e1000_probe()
7476 adapter->eee_advert = MDIO_EEE_100TX | MDIO_EEE_1000T; in e1000_probe()
7479 netdev->netdev_ops = &e1000e_netdev_ops; in e1000_probe()
7481 netdev->watchdog_timeo = 5 * HZ; in e1000_probe()
7482 netif_napi_add(netdev, &adapter->napi, e1000e_poll); in e1000_probe()
7483 strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name)); in e1000_probe()
7485 netdev->mem_start = mmio_start; in e1000_probe()
7486 netdev->mem_end = mmio_start + mmio_len; in e1000_probe()
7488 adapter->bd_number = cards_found++; in e1000_probe()
7497 memcpy(&hw->mac.ops, ei->mac_ops, sizeof(hw->mac.ops)); in e1000_probe()
7498 memcpy(&hw->nvm.ops, ei->nvm_ops, sizeof(hw->nvm.ops)); in e1000_probe()
7499 memcpy(&hw->phy.ops, ei->phy_ops, sizeof(hw->phy.ops)); in e1000_probe()
7501 err = ei->get_variants(adapter); in e1000_probe()
7505 if ((adapter->flags & FLAG_IS_ICH) && in e1000_probe()
7506 (adapter->flags & FLAG_READ_ONLY_NVM) && in e1000_probe()
7507 (hw->mac.type < e1000_pch_spt)) in e1000_probe()
7508 e1000e_write_protect_nvm_ich8lan(&adapter->hw); in e1000_probe()
7510 hw->mac.ops.get_bus_info(&adapter->hw); in e1000_probe()
7512 adapter->hw.phy.autoneg_wait_to_complete = 0; in e1000_probe()
7515 if (adapter->hw.phy.media_type == e1000_media_type_copper) { in e1000_probe()
7516 adapter->hw.phy.mdix = AUTO_ALL_MODES; in e1000_probe()
7517 adapter->hw.phy.disable_polarity_correction = 0; in e1000_probe()
7518 adapter->hw.phy.ms_type = e1000_ms_hw_default; in e1000_probe()
7521 if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw)) in e1000_probe()
7522 dev_info(&pdev->dev, in e1000_probe()
7526 netdev->features = (NETIF_F_SG | in e1000_probe()
7535 /* Set user-changeable features (subset of all device features) */ in e1000_probe()
7536 netdev->hw_features = netdev->features; in e1000_probe()
7537 netdev->hw_features |= NETIF_F_RXFCS; in e1000_probe()
7538 netdev->priv_flags |= IFF_SUPP_NOFCS; in e1000_probe()
7539 netdev->hw_features |= NETIF_F_RXALL; in e1000_probe()
7541 if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) in e1000_probe()
7542 netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; in e1000_probe()
7544 netdev->vlan_features |= (NETIF_F_SG | in e1000_probe()
7549 netdev->priv_flags |= IFF_UNICAST_FLT; in e1000_probe()
7551 netdev->features |= NETIF_F_HIGHDMA; in e1000_probe()
7552 netdev->vlan_features |= NETIF_F_HIGHDMA; in e1000_probe()
7554 /* MTU range: 68 - max_hw_frame_size */ in e1000_probe()
7555 netdev->min_mtu = ETH_MIN_MTU; in e1000_probe()
7556 netdev->max_mtu = adapter->max_hw_frame_size - in e1000_probe()
7559 if (e1000e_enable_mng_pass_thru(&adapter->hw)) in e1000_probe()
7560 adapter->flags |= FLAG_MNG_PT_ENABLED; in e1000_probe()
7565 adapter->hw.mac.ops.reset_hw(&adapter->hw); in e1000_probe()
7571 if (e1000_validate_nvm_checksum(&adapter->hw) >= 0) in e1000_probe()
7574 dev_err(&pdev->dev, "The NVM Checksum Is Not Valid\n"); in e1000_probe()
7575 err = -EIO; in e1000_probe()
7583 if (e1000e_read_mac_addr(&adapter->hw)) in e1000_probe()
7584 dev_err(&pdev->dev, in e1000_probe()
7587 eth_hw_addr_set(netdev, adapter->hw.mac.addr); in e1000_probe()
7589 if (!is_valid_ether_addr(netdev->dev_addr)) { in e1000_probe()
7590 dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", in e1000_probe()
7591 netdev->dev_addr); in e1000_probe()
7592 err = -EIO; in e1000_probe()
7596 timer_setup(&adapter->watchdog_timer, e1000_watchdog, 0); in e1000_probe()
7597 timer_setup(&adapter->phy_info_timer, e1000_update_phy_info, 0); in e1000_probe()
7599 INIT_WORK(&adapter->reset_task, e1000_reset_task); in e1000_probe()
7600 INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task); in e1000_probe()
7601 INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround); in e1000_probe()
7602 INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task); in e1000_probe()
7603 INIT_WORK(&adapter->print_hang_task, e1000_print_hw_hang); in e1000_probe()
7606 adapter->hw.mac.autoneg = 1; in e1000_probe()
7607 adapter->fc_autoneg = true; in e1000_probe()
7608 adapter->hw.fc.requested_mode = e1000_fc_default; in e1000_probe()
7609 adapter->hw.fc.current_mode = e1000_fc_default; in e1000_probe()
7610 adapter->hw.phy.autoneg_advertised = 0x2f; in e1000_probe()
7612 /* Initial Wake on LAN setting - If APM wake is enabled in in e1000_probe()
7615 if (adapter->flags & FLAG_APME_IN_WUC) { in e1000_probe()
7619 if ((hw->mac.type > e1000_ich10lan) && in e1000_probe()
7621 adapter->flags2 |= FLAG2_HAS_PHY_WAKEUP; in e1000_probe()
7622 } else if (adapter->flags & FLAG_APME_IN_CTRL3) { in e1000_probe()
7623 if (adapter->flags & FLAG_APME_CHECK_PORT_B && in e1000_probe()
7624 (adapter->hw.bus.func == 1)) in e1000_probe()
7625 ret_val = e1000_read_nvm(&adapter->hw, in e1000_probe()
7629 ret_val = e1000_read_nvm(&adapter->hw, in e1000_probe()
7638 adapter->eeprom_wol |= E1000_WUFC_MAG; in e1000_probe()
7644 if (!(adapter->flags & FLAG_HAS_WOL)) in e1000_probe()
7645 adapter->eeprom_wol = 0; in e1000_probe()
7648 adapter->wol = adapter->eeprom_wol; in e1000_probe()
7651 if (adapter->wol || (adapter->flags & FLAG_MNG_PT_ENABLED) || in e1000_probe()
7652 (hw->mac.ops.check_mng_mode(hw))) in e1000_probe()
7653 device_wakeup_enable(&pdev->dev); in e1000_probe()
7656 ret_val = e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers); in e1000_probe()
7660 adapter->eeprom_vers = 0; in e1000_probe()
7673 if (!(adapter->flags & FLAG_HAS_AMT)) in e1000_probe()
7676 if (hw->mac.type >= e1000_pch_cnp) in e1000_probe()
7677 adapter->flags2 |= FLAG2_ENABLE_S0IX_FLOWS; in e1000_probe()
7679 strscpy(netdev->name, "eth%d", sizeof(netdev->name)); in e1000_probe()
7689 dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_SMART_PREPARE); in e1000_probe()
7691 if (pci_dev_run_wake(pdev) && hw->mac.type != e1000_pch_cnp) in e1000_probe()
7692 pm_runtime_put_noidle(&pdev->dev); in e1000_probe()
7697 if (!(adapter->flags & FLAG_HAS_AMT)) in e1000_probe()
7700 if (hw->phy.ops.check_reset_block && !hw->phy.ops.check_reset_block(hw)) in e1000_probe()
7701 e1000_phy_hw_reset(&adapter->hw); in e1000_probe()
7703 kfree(adapter->tx_ring); in e1000_probe()
7704 kfree(adapter->rx_ring); in e1000_probe()
7706 if ((adapter->hw.flash_address) && (hw->mac.type < e1000_pch_spt)) in e1000_probe()
7707 iounmap(adapter->hw.flash_address); in e1000_probe()
7710 iounmap(adapter->hw.hw_addr); in e1000_probe()
7723 * e1000_remove - Device Removal Routine
7728 * Hot-Plug event, or because the driver is going to be removed from
7741 set_bit(__E1000_DOWN, &adapter->state); in e1000_remove()
7742 del_timer_sync(&adapter->watchdog_timer); in e1000_remove()
7743 del_timer_sync(&adapter->phy_info_timer); in e1000_remove()
7745 cancel_work_sync(&adapter->reset_task); in e1000_remove()
7746 cancel_work_sync(&adapter->watchdog_task); in e1000_remove()
7747 cancel_work_sync(&adapter->downshift_task); in e1000_remove()
7748 cancel_work_sync(&adapter->update_phy_task); in e1000_remove()
7749 cancel_work_sync(&adapter->print_hang_task); in e1000_remove()
7751 if (adapter->flags & FLAG_HAS_HW_TIMESTAMP) { in e1000_remove()
7752 cancel_work_sync(&adapter->tx_hwtstamp_work); in e1000_remove()
7753 if (adapter->tx_hwtstamp_skb) { in e1000_remove()
7754 dev_consume_skb_any(adapter->tx_hwtstamp_skb); in e1000_remove()
7755 adapter->tx_hwtstamp_skb = NULL; in e1000_remove()
7762 pm_runtime_get_noresume(&pdev->dev); in e1000_remove()
7770 kfree(adapter->tx_ring); in e1000_remove()
7771 kfree(adapter->rx_ring); in e1000_remove()
7773 iounmap(adapter->hw.hw_addr); in e1000_remove()
7774 if ((adapter->hw.flash_address) && in e1000_remove()
7775 (adapter->hw.mac.type < e1000_pch_spt)) in e1000_remove()
7776 iounmap(adapter->hw.flash_address); in e1000_remove()
7949 * e1000_init_module - Driver Registration Routine
7957 pr_info("Copyright(c) 1999 - 2015 Intel Corporation.\n"); in e1000_init_module()
7964 * e1000_exit_module - Driver Exit Cleanup Routine