vlan: Don't check for vlan group before vlan_tx_tag_present.
[linux-2.6.git] / drivers / net / e1000e / netdev.c
index 5304959..ec8cf3f 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel PRO/1000 Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -38,6 +38,7 @@
 #include <linux/netdevice.h>
 #include <linux/tcp.h>
 #include <linux/ipv6.h>
+#include <linux/slab.h>
 #include <net/checksum.h>
 #include <net/ip6_checksum.h>
 #include <linux/mii.h>
@@ -51,7 +52,9 @@
 
 #include "e1000.h"
 
-#define DRV_VERSION "1.0.2-k2"
+#define DRV_EXTRAVERSION "-k2"
+
+#define DRV_VERSION "1.2.7" DRV_EXTRAVERSION
 char e1000e_driver_name[] = "e1000e";
 const char e1000e_driver_version[] = DRV_VERSION;
 
@@ -66,8 +69,368 @@ static const struct e1000_info *e1000_info_tbl[] = {
        [board_ich9lan]         = &e1000_ich9_info,
        [board_ich10lan]        = &e1000_ich10_info,
        [board_pchlan]          = &e1000_pch_info,
+       [board_pch2lan]         = &e1000_pch2_info,
+};
+
+struct e1000_reg_info {
+       u32 ofs;
+       char *name;
+};
+
+#define E1000_RDFH     0x02410 /* Rx Data FIFO Head - RW */
+#define E1000_RDFT     0x02418 /* Rx Data FIFO Tail - RW */
+#define E1000_RDFHS    0x02420 /* Rx Data FIFO Head Saved - RW */
+#define E1000_RDFTS    0x02428 /* Rx Data FIFO Tail Saved - RW */
+#define E1000_RDFPC    0x02430 /* Rx Data FIFO Packet Count - RW */
+
+#define E1000_TDFH     0x03410 /* Tx Data FIFO Head - RW */
+#define E1000_TDFT     0x03418 /* Tx Data FIFO Tail - RW */
+#define E1000_TDFHS    0x03420 /* Tx Data FIFO Head Saved - RW */
+#define E1000_TDFTS    0x03428 /* Tx Data FIFO Tail Saved - RW */
+#define E1000_TDFPC    0x03430 /* Tx Data FIFO Packet Count - RW */
+
+static const struct e1000_reg_info e1000_reg_info_tbl[] = {
+
+       /* General Registers */
+       {E1000_CTRL, "CTRL"},
+       {E1000_STATUS, "STATUS"},
+       {E1000_CTRL_EXT, "CTRL_EXT"},
+
+       /* Interrupt Registers */
+       {E1000_ICR, "ICR"},
+
+       /* RX Registers */
+       {E1000_RCTL, "RCTL"},
+       {E1000_RDLEN, "RDLEN"},
+       {E1000_RDH, "RDH"},
+       {E1000_RDT, "RDT"},
+       {E1000_RDTR, "RDTR"},
+       {E1000_RXDCTL(0), "RXDCTL"},
+       {E1000_ERT, "ERT"},
+       {E1000_RDBAL, "RDBAL"},
+       {E1000_RDBAH, "RDBAH"},
+       {E1000_RDFH, "RDFH"},
+       {E1000_RDFT, "RDFT"},
+       {E1000_RDFHS, "RDFHS"},
+       {E1000_RDFTS, "RDFTS"},
+       {E1000_RDFPC, "RDFPC"},
+
+       /* TX Registers */
+       {E1000_TCTL, "TCTL"},
+       {E1000_TDBAL, "TDBAL"},
+       {E1000_TDBAH, "TDBAH"},
+       {E1000_TDLEN, "TDLEN"},
+       {E1000_TDH, "TDH"},
+       {E1000_TDT, "TDT"},
+       {E1000_TIDV, "TIDV"},
+       {E1000_TXDCTL(0), "TXDCTL"},
+       {E1000_TADV, "TADV"},
+       {E1000_TARC(0), "TARC"},
+       {E1000_TDFH, "TDFH"},
+       {E1000_TDFT, "TDFT"},
+       {E1000_TDFHS, "TDFHS"},
+       {E1000_TDFTS, "TDFTS"},
+       {E1000_TDFPC, "TDFPC"},
+
+       /* List Terminator */
+       {}
 };
 
+/*
+ * e1000_regdump - register printout routine
+ */
+static void e1000_regdump(struct e1000_hw *hw, struct e1000_reg_info *reginfo)
+{
+       int n = 0;
+       char rname[16];
+       u32 regs[8];
+
+       switch (reginfo->ofs) {
+       case E1000_RXDCTL(0):
+               for (n = 0; n < 2; n++)
+                       regs[n] = __er32(hw, E1000_RXDCTL(n));
+               break;
+       case E1000_TXDCTL(0):
+               for (n = 0; n < 2; n++)
+                       regs[n] = __er32(hw, E1000_TXDCTL(n));
+               break;
+       case E1000_TARC(0):
+               for (n = 0; n < 2; n++)
+                       regs[n] = __er32(hw, E1000_TARC(n));
+               break;
+       default:
+               printk(KERN_INFO "%-15s %08x\n",
+                       reginfo->name, __er32(hw, reginfo->ofs));
+               return;
+       }
+
+       snprintf(rname, 16, "%s%s", reginfo->name, "[0-1]");
+       printk(KERN_INFO "%-15s ", rname);
+       for (n = 0; n < 2; n++)
+               printk(KERN_CONT "%08x ", regs[n]);
+       printk(KERN_CONT "\n");
+}
+
+
+/*
+ * e1000e_dump - Print registers, tx-ring and rx-ring
+ */
+static void e1000e_dump(struct e1000_adapter *adapter)
+{
+       struct net_device *netdev = adapter->netdev;
+       struct e1000_hw *hw = &adapter->hw;
+       struct e1000_reg_info *reginfo;
+       struct e1000_ring *tx_ring = adapter->tx_ring;
+       struct e1000_tx_desc *tx_desc;
+       struct my_u0 { u64 a; u64 b; } *u0;
+       struct e1000_buffer *buffer_info;
+       struct e1000_ring *rx_ring = adapter->rx_ring;
+       union e1000_rx_desc_packet_split *rx_desc_ps;
+       struct e1000_rx_desc *rx_desc;
+       struct my_u1 { u64 a; u64 b; u64 c; u64 d; } *u1;
+       u32 staterr;
+       int i = 0;
+
+       if (!netif_msg_hw(adapter))
+               return;
+
+       /* Print netdevice Info */
+       if (netdev) {
+               dev_info(&adapter->pdev->dev, "Net device Info\n");
+               printk(KERN_INFO "Device Name     state            "
+                       "trans_start      last_rx\n");
+               printk(KERN_INFO "%-15s %016lX %016lX %016lX\n",
+                       netdev->name,
+                       netdev->state,
+                       netdev->trans_start,
+                       netdev->last_rx);
+       }
+
+       /* Print Registers */
+       dev_info(&adapter->pdev->dev, "Register Dump\n");
+       printk(KERN_INFO " Register Name   Value\n");
+       for (reginfo = (struct e1000_reg_info *)e1000_reg_info_tbl;
+            reginfo->name; reginfo++) {
+               e1000_regdump(hw, reginfo);
+       }
+
+       /* Print TX Ring Summary */
+       if (!netdev || !netif_running(netdev))
+               goto exit;
+
+       dev_info(&adapter->pdev->dev, "TX Rings Summary\n");
+       printk(KERN_INFO "Queue [NTU] [NTC] [bi(ntc)->dma  ]"
+               " leng ntw timestamp\n");
+       buffer_info = &tx_ring->buffer_info[tx_ring->next_to_clean];
+       printk(KERN_INFO " %5d %5X %5X %016llX %04X %3X %016llX\n",
+               0, tx_ring->next_to_use, tx_ring->next_to_clean,
+               (unsigned long long)buffer_info->dma,
+               buffer_info->length,
+               buffer_info->next_to_watch,
+               (unsigned long long)buffer_info->time_stamp);
+
+       /* Print TX Rings */
+       if (!netif_msg_tx_done(adapter))
+               goto rx_ring_summary;
+
+       dev_info(&adapter->pdev->dev, "TX Rings Dump\n");
+
+       /* Transmit Descriptor Formats - DEXT[29] is 0 (Legacy) or 1 (Extended)
+        *
+        * Legacy Transmit Descriptor
+        *   +--------------------------------------------------------------+
+        * 0 |         Buffer Address [63:0] (Reserved on Write Back)       |
+        *   +--------------------------------------------------------------+
+        * 8 | Special  |    CSS     | Status |  CMD    |  CSO   |  Length  |
+        *   +--------------------------------------------------------------+
+        *   63       48 47        36 35    32 31     24 23    16 15        0
+        *
+        * Extended Context Descriptor (DTYP=0x0) for TSO or checksum offload
+        *   63      48 47    40 39       32 31             16 15    8 7      0
+        *   +----------------------------------------------------------------+
+        * 0 |  TUCSE  | TUCS0  |   TUCSS   |     IPCSE       | IPCS0 | IPCSS |
+        *   +----------------------------------------------------------------+
+        * 8 |   MSS   | HDRLEN | RSV | STA | TUCMD | DTYP |      PAYLEN      |
+        *   +----------------------------------------------------------------+
+        *   63      48 47    40 39 36 35 32 31   24 23  20 19                0
+        *
+        * Extended Data Descriptor (DTYP=0x1)
+        *   +----------------------------------------------------------------+
+        * 0 |                     Buffer Address [63:0]                      |
+        *   +----------------------------------------------------------------+
+        * 8 | VLAN tag |  POPTS  | Rsvd | Status | Command | DTYP |  DTALEN  |
+        *   +----------------------------------------------------------------+
+        *   63       48 47     40 39  36 35    32 31     24 23  20 19        0
+        */
+       printk(KERN_INFO "Tl[desc]     [address 63:0  ] [SpeCssSCmCsLen]"
+               " [bi->dma       ] leng  ntw timestamp        bi->skb "
+               "<-- Legacy format\n");
+       printk(KERN_INFO "Tc[desc]     [Ce CoCsIpceCoS] [MssHlRSCm0Plen]"
+               " [bi->dma       ] leng  ntw timestamp        bi->skb "
+               "<-- Ext Context format\n");
+       printk(KERN_INFO "Td[desc]     [address 63:0  ] [VlaPoRSCm1Dlen]"
+               " [bi->dma       ] leng  ntw timestamp        bi->skb "
+               "<-- Ext Data format\n");
+       for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) {
+               tx_desc = E1000_TX_DESC(*tx_ring, i);
+               buffer_info = &tx_ring->buffer_info[i];
+               u0 = (struct my_u0 *)tx_desc;
+               printk(KERN_INFO "T%c[0x%03X]    %016llX %016llX %016llX "
+                       "%04X  %3X %016llX %p",
+                      (!(le64_to_cpu(u0->b) & (1<<29)) ? 'l' :
+                       ((le64_to_cpu(u0->b) & (1<<20)) ? 'd' : 'c')), i,
+                      (unsigned long long)le64_to_cpu(u0->a),
+                      (unsigned long long)le64_to_cpu(u0->b),
+                      (unsigned long long)buffer_info->dma,
+                      buffer_info->length, buffer_info->next_to_watch,
+                      (unsigned long long)buffer_info->time_stamp,
+                      buffer_info->skb);
+               if (i == tx_ring->next_to_use && i == tx_ring->next_to_clean)
+                       printk(KERN_CONT " NTC/U\n");
+               else if (i == tx_ring->next_to_use)
+                       printk(KERN_CONT " NTU\n");
+               else if (i == tx_ring->next_to_clean)
+                       printk(KERN_CONT " NTC\n");
+               else
+                       printk(KERN_CONT "\n");
+
+               if (netif_msg_pktdata(adapter) && buffer_info->dma != 0)
+                       print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS,
+                                       16, 1, phys_to_virt(buffer_info->dma),
+                                       buffer_info->length, true);
+       }
+
+       /* Print RX Rings Summary */
+rx_ring_summary:
+       dev_info(&adapter->pdev->dev, "RX Rings Summary\n");
+       printk(KERN_INFO "Queue [NTU] [NTC]\n");
+       printk(KERN_INFO " %5d %5X %5X\n", 0,
+               rx_ring->next_to_use, rx_ring->next_to_clean);
+
+       /* Print RX Rings */
+       if (!netif_msg_rx_status(adapter))
+               goto exit;
+
+       dev_info(&adapter->pdev->dev, "RX Rings Dump\n");
+       switch (adapter->rx_ps_pages) {
+       case 1:
+       case 2:
+       case 3:
+               /* [Extended] Packet Split Receive Descriptor Format
+                *
+                *    +-----------------------------------------------------+
+                *  0 |                Buffer Address 0 [63:0]              |
+                *    +-----------------------------------------------------+
+                *  8 |                Buffer Address 1 [63:0]              |
+                *    +-----------------------------------------------------+
+                * 16 |                Buffer Address 2 [63:0]              |
+                *    +-----------------------------------------------------+
+                * 24 |                Buffer Address 3 [63:0]              |
+                *    +-----------------------------------------------------+
+                */
+               printk(KERN_INFO "R  [desc]      [buffer 0 63:0 ] "
+                       "[buffer 1 63:0 ] "
+                      "[buffer 2 63:0 ] [buffer 3 63:0 ] [bi->dma       ] "
+                      "[bi->skb] <-- Ext Pkt Split format\n");
+               /* [Extended] Receive Descriptor (Write-Back) Format
+                *
+                *   63       48 47    32 31     13 12    8 7    4 3        0
+                *   +------------------------------------------------------+
+                * 0 | Packet   | IP     |  Rsvd   | MRQ   | Rsvd | MRQ RSS |
+                *   | Checksum | Ident  |         | Queue |      |  Type   |
+                *   +------------------------------------------------------+
+                * 8 | VLAN Tag | Length | Extended Error | Extended Status |
+                *   +------------------------------------------------------+
+                *   63       48 47    32 31            20 19               0
+                */
+               printk(KERN_INFO "RWB[desc]      [ck ipid mrqhsh] "
+                       "[vl   l0 ee  es] "
+                      "[ l3  l2  l1 hs] [reserved      ] ---------------- "
+                      "[bi->skb] <-- Ext Rx Write-Back format\n");
+               for (i = 0; i < rx_ring->count; i++) {
+                       buffer_info = &rx_ring->buffer_info[i];
+                       rx_desc_ps = E1000_RX_DESC_PS(*rx_ring, i);
+                       u1 = (struct my_u1 *)rx_desc_ps;
+                       staterr =
+                               le32_to_cpu(rx_desc_ps->wb.middle.status_error);
+                       if (staterr & E1000_RXD_STAT_DD) {
+                               /* Descriptor Done */
+                               printk(KERN_INFO "RWB[0x%03X]     %016llX "
+                                       "%016llX %016llX %016llX "
+                                       "---------------- %p", i,
+                                       (unsigned long long)le64_to_cpu(u1->a),
+                                       (unsigned long long)le64_to_cpu(u1->b),
+                                       (unsigned long long)le64_to_cpu(u1->c),
+                                       (unsigned long long)le64_to_cpu(u1->d),
+                                       buffer_info->skb);
+                       } else {
+                               printk(KERN_INFO "R  [0x%03X]     %016llX "
+                                       "%016llX %016llX %016llX %016llX %p", i,
+                                       (unsigned long long)le64_to_cpu(u1->a),
+                                       (unsigned long long)le64_to_cpu(u1->b),
+                                       (unsigned long long)le64_to_cpu(u1->c),
+                                       (unsigned long long)le64_to_cpu(u1->d),
+                                       (unsigned long long)buffer_info->dma,
+                                       buffer_info->skb);
+
+                               if (netif_msg_pktdata(adapter))
+                                       print_hex_dump(KERN_INFO, "",
+                                               DUMP_PREFIX_ADDRESS, 16, 1,
+                                               phys_to_virt(buffer_info->dma),
+                                               adapter->rx_ps_bsize0, true);
+                       }
+
+                       if (i == rx_ring->next_to_use)
+                               printk(KERN_CONT " NTU\n");
+                       else if (i == rx_ring->next_to_clean)
+                               printk(KERN_CONT " NTC\n");
+                       else
+                               printk(KERN_CONT "\n");
+               }
+               break;
+       default:
+       case 0:
+               /* Legacy Receive Descriptor Format
+                *
+                * +-----------------------------------------------------+
+                * |                Buffer Address [63:0]                |
+                * +-----------------------------------------------------+
+                * | VLAN Tag | Errors | Status 0 | Packet csum | Length |
+                * +-----------------------------------------------------+
+                * 63       48 47    40 39      32 31         16 15      0
+                */
+               printk(KERN_INFO "Rl[desc]     [address 63:0  ] "
+                       "[vl er S cks ln] [bi->dma       ] [bi->skb] "
+                       "<-- Legacy format\n");
+               for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) {
+                       rx_desc = E1000_RX_DESC(*rx_ring, i);
+                       buffer_info = &rx_ring->buffer_info[i];
+                       u0 = (struct my_u0 *)rx_desc;
+                       printk(KERN_INFO "Rl[0x%03X]    %016llX %016llX "
+                               "%016llX %p", i,
+                               (unsigned long long)le64_to_cpu(u0->a),
+                               (unsigned long long)le64_to_cpu(u0->b),
+                               (unsigned long long)buffer_info->dma,
+                               buffer_info->skb);
+                       if (i == rx_ring->next_to_use)
+                               printk(KERN_CONT " NTU\n");
+                       else if (i == rx_ring->next_to_clean)
+                               printk(KERN_CONT " NTC\n");
+                       else
+                               printk(KERN_CONT "\n");
+
+                       if (netif_msg_pktdata(adapter))
+                               print_hex_dump(KERN_INFO, "",
+                                       DUMP_PREFIX_ADDRESS,
+                                       16, 1, phys_to_virt(buffer_info->dma),
+                                       adapter->rx_buffer_len, true);
+               }
+       }
+
+exit:
+       return;
+}
+
 /**
  * e1000_desc_unused - calculate if we have unused descriptors
  **/
@@ -112,7 +475,8 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err,
 {
        u16 status = (u16)status_err;
        u8 errors = (u8)(status_err >> 24);
-       skb->ip_summed = CHECKSUM_NONE;
+
+       skb_checksum_none_assert(skb);
 
        /* Ignore Checksum bit is set */
        if (status & E1000_RXD_STAT_IXSM)
@@ -180,10 +544,10 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
 
                buffer_info->skb = skb;
 map_skb:
-               buffer_info->dma = pci_map_single(pdev, skb->data,
+               buffer_info->dma = dma_map_single(&pdev->dev, skb->data,
                                                  adapter->rx_buffer_len,
-                                                 PCI_DMA_FROMDEVICE);
-               if (pci_dma_mapping_error(pdev, buffer_info->dma)) {
+                                                 DMA_FROM_DEVICE);
+               if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
                        dev_err(&pdev->dev, "RX DMA map failed\n");
                        adapter->rx_dma_failed++;
                        break;
@@ -192,26 +556,23 @@ map_skb:
                rx_desc = E1000_RX_DESC(*rx_ring, i);
                rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
 
+               if (unlikely(!(i & (E1000_RX_BUFFER_WRITE - 1)))) {
+                       /*
+                        * Force memory writes to complete before letting h/w
+                        * know there are new descriptors to fetch.  (Only
+                        * applicable for weak-ordered memory model archs,
+                        * such as IA-64).
+                        */
+                       wmb();
+                       writel(i, adapter->hw.hw_addr + rx_ring->tail);
+               }
                i++;
                if (i == rx_ring->count)
                        i = 0;
                buffer_info = &rx_ring->buffer_info[i];
        }
 
-       if (rx_ring->next_to_use != i) {
-               rx_ring->next_to_use = i;
-               if (i-- == 0)
-                       i = (rx_ring->count - 1);
-
-               /*
-                * Force memory writes to complete before letting h/w
-                * know there are new descriptors to fetch.  (Only
-                * applicable for weak-ordered memory model archs,
-                * such as IA-64).
-                */
-               wmb();
-               writel(i, adapter->hw.hw_addr + rx_ring->tail);
-       }
+       rx_ring->next_to_use = i;
 }
 
 /**
@@ -249,11 +610,12 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
                                        adapter->alloc_rx_buff_failed++;
                                        goto no_buffers;
                                }
-                               ps_page->dma = pci_map_page(pdev,
-                                                  ps_page->page,
-                                                  0, PAGE_SIZE,
-                                                  PCI_DMA_FROMDEVICE);
-                               if (pci_dma_mapping_error(pdev, ps_page->dma)) {
+                               ps_page->dma = dma_map_page(&pdev->dev,
+                                                           ps_page->page,
+                                                           0, PAGE_SIZE,
+                                                           DMA_FROM_DEVICE);
+                               if (dma_mapping_error(&pdev->dev,
+                                                     ps_page->dma)) {
                                        dev_err(&adapter->pdev->dev,
                                          "RX DMA page map failed\n");
                                        adapter->rx_dma_failed++;
@@ -278,10 +640,10 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
                }
 
                buffer_info->skb = skb;
-               buffer_info->dma = pci_map_single(pdev, skb->data,
+               buffer_info->dma = dma_map_single(&pdev->dev, skb->data,
                                                  adapter->rx_ps_bsize0,
-                                                 PCI_DMA_FROMDEVICE);
-               if (pci_dma_mapping_error(pdev, buffer_info->dma)) {
+                                                 DMA_FROM_DEVICE);
+               if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
                        dev_err(&pdev->dev, "RX DMA map failed\n");
                        adapter->rx_dma_failed++;
                        /* cleanup skb */
@@ -292,6 +654,17 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
 
                rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma);
 
+               if (unlikely(!(i & (E1000_RX_BUFFER_WRITE - 1)))) {
+                       /*
+                        * Force memory writes to complete before letting h/w
+                        * know there are new descriptors to fetch.  (Only
+                        * applicable for weak-ordered memory model archs,
+                        * such as IA-64).
+                        */
+                       wmb();
+                       writel(i<<1, adapter->hw.hw_addr + rx_ring->tail);
+               }
+
                i++;
                if (i == rx_ring->count)
                        i = 0;
@@ -299,26 +672,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
        }
 
 no_buffers:
-       if (rx_ring->next_to_use != i) {
-               rx_ring->next_to_use = i;
-
-               if (!(i--))
-                       i = (rx_ring->count - 1);
-
-               /*
-                * Force memory writes to complete before letting h/w
-                * know there are new descriptors to fetch.  (Only
-                * applicable for weak-ordered memory model archs,
-                * such as IA-64).
-                */
-               wmb();
-               /*
-                * Hardware increments by 16 bytes, but packet split
-                * descriptors are 32 bytes...so we increment tail
-                * twice as much.
-                */
-               writel(i<<1, adapter->hw.hw_addr + rx_ring->tail);
-       }
+       rx_ring->next_to_use = i;
 }
 
 /**
@@ -368,10 +722,10 @@ check_page:
                }
 
                if (!buffer_info->dma)
-                       buffer_info->dma = pci_map_page(pdev,
+                       buffer_info->dma = dma_map_page(&pdev->dev,
                                                        buffer_info->page, 0,
                                                        PAGE_SIZE,
-                                                       PCI_DMA_FROMDEVICE);
+                                                       DMA_FROM_DEVICE);
 
                rx_desc = E1000_RX_DESC(*rx_ring, i);
                rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
@@ -428,6 +782,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
                if (*work_done >= work_to_do)
                        break;
                (*work_done)++;
+               rmb();  /* read descriptor and rx_buffer_info after status DD */
 
                status = rx_desc->status;
                skb = buffer_info->skb;
@@ -445,10 +800,10 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
 
                cleaned = 1;
                cleaned_count++;
-               pci_unmap_single(pdev,
+               dma_unmap_single(&pdev->dev,
                                 buffer_info->dma,
                                 adapter->rx_buffer_len,
-                                PCI_DMA_FROMDEVICE);
+                                DMA_FROM_DEVICE);
                buffer_info->dma = 0;
 
                length = le16_to_cpu(rx_desc->length);
@@ -549,12 +904,11 @@ static void e1000_put_txbuf(struct e1000_adapter *adapter,
 {
        if (buffer_info->dma) {
                if (buffer_info->mapped_as_page)
-                       pci_unmap_page(adapter->pdev, buffer_info->dma,
-                                      buffer_info->length, PCI_DMA_TODEVICE);
+                       dma_unmap_page(&adapter->pdev->dev, buffer_info->dma,
+                                      buffer_info->length, DMA_TO_DEVICE);
                else
-                       pci_unmap_single(adapter->pdev, buffer_info->dma,
-                                        buffer_info->length,
-                                        PCI_DMA_TODEVICE);
+                       dma_unmap_single(&adapter->pdev->dev, buffer_info->dma,
+                                        buffer_info->length, DMA_TO_DEVICE);
                buffer_info->dma = 0;
        }
        if (buffer_info->skb) {
@@ -639,20 +993,15 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
        while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) &&
               (count < tx_ring->count)) {
                bool cleaned = false;
+               rmb(); /* read buffer_info after eop_desc */
                for (; !cleaned; count++) {
                        tx_desc = E1000_TX_DESC(*tx_ring, i);
                        buffer_info = &tx_ring->buffer_info[i];
                        cleaned = (i == eop);
 
                        if (cleaned) {
-                               struct sk_buff *skb = buffer_info->skb;
-                               unsigned int segs, bytecount;
-                               segs = skb_shinfo(skb)->gso_segs ?: 1;
-                               /* multiply data chunks by size of headers */
-                               bytecount = ((segs - 1) * skb_headlen(skb)) +
-                                           skb->len;
-                               total_tx_packets += segs;
-                               total_tx_bytes += bytecount;
+                               total_tx_packets += buffer_info->segs;
+                               total_tx_bytes += buffer_info->bytecount;
                        }
 
                        e1000_put_txbuf(adapter, buffer_info);
@@ -663,6 +1012,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
                                i = 0;
                }
 
+               if (i == tx_ring->next_to_use)
+                       break;
                eop = tx_ring->buffer_info[i].next_to_watch;
                eop_desc = E1000_TX_DESC(*tx_ring, eop);
        }
@@ -702,7 +1053,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
        adapter->total_tx_packets += total_tx_packets;
        netdev->stats.tx_bytes += total_tx_bytes;
        netdev->stats.tx_packets += total_tx_packets;
-       return (count < tx_ring->count);
+       return count < tx_ring->count;
 }
 
 /**
@@ -739,6 +1090,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
                        break;
                (*work_done)++;
                skb = buffer_info->skb;
+               rmb();  /* read descriptor and rx_buffer_info after status DD */
 
                /* in the packet split case this is header only */
                prefetch(skb->data - NET_IP_ALIGN);
@@ -753,9 +1105,9 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
 
                cleaned = 1;
                cleaned_count++;
-               pci_unmap_single(pdev, buffer_info->dma,
+               dma_unmap_single(&pdev->dev, buffer_info->dma,
                                 adapter->rx_ps_bsize0,
-                                PCI_DMA_FROMDEVICE);
+                                DMA_FROM_DEVICE);
                buffer_info->dma = 0;
 
                /* see !EOP comment in other rx routine */
@@ -811,13 +1163,13 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
                         * kmap_atomic, so we can't hold the mapping
                         * very long
                         */
-                       pci_dma_sync_single_for_cpu(pdev, ps_page->dma,
-                               PAGE_SIZE, PCI_DMA_FROMDEVICE);
+                       dma_sync_single_for_cpu(&pdev->dev, ps_page->dma,
+                                               PAGE_SIZE, DMA_FROM_DEVICE);
                        vaddr = kmap_atomic(ps_page->page, KM_SKB_DATA_SOFTIRQ);
                        memcpy(skb_tail_pointer(skb), vaddr, l1);
                        kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ);
-                       pci_dma_sync_single_for_device(pdev, ps_page->dma,
-                               PAGE_SIZE, PCI_DMA_FROMDEVICE);
+                       dma_sync_single_for_device(&pdev->dev, ps_page->dma,
+                                                  PAGE_SIZE, DMA_FROM_DEVICE);
 
                        /* remove the CRC */
                        if (!(adapter->flags2 & FLAG2_CRC_STRIPPING))
@@ -834,8 +1186,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
                                break;
 
                        ps_page = &buffer_info->ps_pages[j];
-                       pci_unmap_page(pdev, ps_page->dma, PAGE_SIZE,
-                                      PCI_DMA_FROMDEVICE);
+                       dma_unmap_page(&pdev->dev, ps_page->dma, PAGE_SIZE,
+                                      DMA_FROM_DEVICE);
                        ps_page->dma = 0;
                        skb_fill_page_desc(skb, j, ps_page->page, 0, length);
                        ps_page->page = NULL;
@@ -938,6 +1290,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
                if (*work_done >= work_to_do)
                        break;
                (*work_done)++;
+               rmb();  /* read descriptor and rx_buffer_info after status DD */
 
                status = rx_desc->status;
                skb = buffer_info->skb;
@@ -953,8 +1306,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
 
                cleaned = true;
                cleaned_count++;
-               pci_unmap_page(pdev, buffer_info->dma, PAGE_SIZE,
-                              PCI_DMA_FROMDEVICE);
+               dma_unmap_page(&pdev->dev, buffer_info->dma, PAGE_SIZE,
+                              DMA_FROM_DEVICE);
                buffer_info->dma = 0;
 
                length = le16_to_cpu(rx_desc->length);
@@ -1090,17 +1443,17 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter)
                buffer_info = &rx_ring->buffer_info[i];
                if (buffer_info->dma) {
                        if (adapter->clean_rx == e1000_clean_rx_irq)
-                               pci_unmap_single(pdev, buffer_info->dma,
+                               dma_unmap_single(&pdev->dev, buffer_info->dma,
                                                 adapter->rx_buffer_len,
-                                                PCI_DMA_FROMDEVICE);
+                                                DMA_FROM_DEVICE);
                        else if (adapter->clean_rx == e1000_clean_jumbo_rx_irq)
-                               pci_unmap_page(pdev, buffer_info->dma,
+                               dma_unmap_page(&pdev->dev, buffer_info->dma,
                                               PAGE_SIZE,
-                                              PCI_DMA_FROMDEVICE);
+                                              DMA_FROM_DEVICE);
                        else if (adapter->clean_rx == e1000_clean_rx_irq_ps)
-                               pci_unmap_single(pdev, buffer_info->dma,
+                               dma_unmap_single(&pdev->dev, buffer_info->dma,
                                                 adapter->rx_ps_bsize0,
-                                                PCI_DMA_FROMDEVICE);
+                                                DMA_FROM_DEVICE);
                        buffer_info->dma = 0;
                }
 
@@ -1118,8 +1471,8 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter)
                        ps_page = &buffer_info->ps_pages[j];
                        if (!ps_page->page)
                                break;
-                       pci_unmap_page(pdev, ps_page->dma, PAGE_SIZE,
-                                      PCI_DMA_FROMDEVICE);
+                       dma_unmap_page(&pdev->dev, ps_page->dma, PAGE_SIZE,
+                                      DMA_FROM_DEVICE);
                        ps_page->dma = 0;
                        put_page(ps_page->page);
                        ps_page->page = NULL;
@@ -1426,8 +1779,6 @@ void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter)
                pci_disable_msi(adapter->pdev);
                adapter->flags &= ~FLAG_MSI_ENABLED;
        }
-
-       return;
 }
 
 /**
@@ -1439,25 +1790,25 @@ void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter)
 void e1000e_set_interrupt_capability(struct e1000_adapter *adapter)
 {
        int err;
-       int numvecs, i;
-
+       int i;
 
        switch (adapter->int_mode) {
        case E1000E_INT_MODE_MSIX:
                if (adapter->flags & FLAG_HAS_MSIX) {
-                       numvecs = 3; /* RxQ0, TxQ0 and other */
-                       adapter->msix_entries = kcalloc(numvecs,
+                       adapter->num_vectors = 3; /* RxQ0, TxQ0 and other */
+                       adapter->msix_entries = kcalloc(adapter->num_vectors,
                                                      sizeof(struct msix_entry),
                                                      GFP_KERNEL);
                        if (adapter->msix_entries) {
-                               for (i = 0; i < numvecs; i++)
+                               for (i = 0; i < adapter->num_vectors; i++)
                                        adapter->msix_entries[i].entry = i;
 
                                err = pci_enable_msix(adapter->pdev,
                                                      adapter->msix_entries,
-                                                     numvecs);
-                               if (err == 0)
+                                                     adapter->num_vectors);
+                               if (err == 0) {
                                        return;
+                               }
                        }
                        /* MSI-X failed, so fall through and try MSI */
                        e_err("Failed to initialize MSI-X interrupts.  "
@@ -1480,7 +1831,8 @@ void e1000e_set_interrupt_capability(struct e1000_adapter *adapter)
                break;
        }
 
-       return;
+       /* store the number of vectors being used */
+       adapter->num_vectors = 1;
 }
 
 /**
@@ -1602,7 +1954,14 @@ static void e1000_irq_disable(struct e1000_adapter *adapter)
        if (adapter->msix_entries)
                ew32(EIAC_82574, 0);
        e1e_flush();
-       synchronize_irq(adapter->pdev->irq);
+
+       if (adapter->msix_entries) {
+               int i;
+               for (i = 0; i < adapter->num_vectors; i++)
+                       synchronize_irq(adapter->msix_entries[i].vector);
+       } else {
+               synchronize_irq(adapter->pdev->irq);
+       }
 }
 
 /**
@@ -1931,6 +2290,11 @@ static void e1000_set_itr(struct e1000_adapter *adapter)
                goto set_itr_now;
        }
 
+       if (adapter->flags2 & FLAG2_DISABLE_AIM) {
+               new_itr = 0;
+               goto set_itr_now;
+       }
+
        adapter->tx_itr = e1000_update_itr(adapter,
                                    adapter->tx_itr,
                                    adapter->total_tx_packets,
@@ -1979,7 +2343,10 @@ set_itr_now:
                if (adapter->msix_entries)
                        adapter->rx_ring->set_itr = 1;
                else
-                       ew32(ITR, 1000000000 / (new_itr * 256));
+                       if (new_itr)
+                               ew32(ITR, 1000000000 / (new_itr * 256));
+                       else
+                               ew32(ITR, 0);
        }
 }
 
@@ -2178,17 +2545,17 @@ static void e1000_restore_vlan(struct e1000_adapter *adapter)
        if (!adapter->vlgrp)
                return;
 
-       for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
+       for (vid = 0; vid < VLAN_N_VID; vid++) {
                if (!vlan_group_get_device(adapter->vlgrp, vid))
                        continue;
                e1000_vlan_rx_add_vid(adapter->netdev, vid);
        }
 }
 
-static void e1000_init_manageability(struct e1000_adapter *adapter)
+static void e1000_init_manageability_pt(struct e1000_adapter *adapter)
 {
        struct e1000_hw *hw = &adapter->hw;
-       u32 manc, manc2h;
+       u32 manc, manc2h, mdef, i, j;
 
        if (!(adapter->flags & FLAG_MNG_PT_ENABLED))
                return;
@@ -2202,10 +2569,49 @@ static void e1000_init_manageability(struct e1000_adapter *adapter)
         */
        manc |= E1000_MANC_EN_MNG2HOST;
        manc2h = er32(MANC2H);
-#define E1000_MNG2HOST_PORT_623 (1 << 5)
-#define E1000_MNG2HOST_PORT_664 (1 << 6)
-       manc2h |= E1000_MNG2HOST_PORT_623;
-       manc2h |= E1000_MNG2HOST_PORT_664;
+
+       switch (hw->mac.type) {
+       default:
+               manc2h |= (E1000_MANC2H_PORT_623 | E1000_MANC2H_PORT_664);
+               break;
+       case e1000_82574:
+       case e1000_82583:
+               /*
+                * Check if IPMI pass-through decision filter already exists;
+                * if so, enable it.
+                */
+               for (i = 0, j = 0; i < 8; i++) {
+                       mdef = er32(MDEF(i));
+
+                       /* Ignore filters with anything other than IPMI ports */
+                       if (mdef & ~(E1000_MDEF_PORT_623 | E1000_MDEF_PORT_664))
+                               continue;
+
+                       /* Enable this decision filter in MANC2H */
+                       if (mdef)
+                               manc2h |= (1 << i);
+
+                       j |= mdef;
+               }
+
+               if (j == (E1000_MDEF_PORT_623 | E1000_MDEF_PORT_664))
+                       break;
+
+               /* Create new decision filter in an empty filter */
+               for (i = 0, j = 0; i < 8; i++)
+                       if (er32(MDEF(i)) == 0) {
+                               ew32(MDEF(i), (E1000_MDEF_PORT_623 |
+                                              E1000_MDEF_PORT_664));
+                               manc2h |= (1 << 1);
+                               j++;
+                               break;
+                       }
+
+               if (!j)
+                       e_warn("Unable to create IPMI pass-through filter\n");
+               break;
+       }
+
        ew32(MANC2H, manc2h);
        ew32(MANC, manc);
 }
@@ -2252,6 +2658,26 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
        /* Tx irq moderation */
        ew32(TADV, adapter->tx_abs_int_delay);
 
+       if (adapter->flags2 & FLAG2_DMA_BURST) {
+               u32 txdctl = er32(TXDCTL(0));
+               txdctl &= ~(E1000_TXDCTL_PTHRESH | E1000_TXDCTL_HTHRESH |
+                           E1000_TXDCTL_WTHRESH);
+               /*
+                * set up some performance related parameters to encourage the
+                * hardware to use the bus more efficiently in bursts, depends
+                * on the tx_int_delay to be enabled,
+                * wthresh = 5 ==> burst write a cacheline (64 bytes) at a time
+                * hthresh = 1 ==> prefetch when one or more available
+                * pthresh = 0x1f ==> prefetch if internal cache 31 or less
+                * BEWARE: this seems to work but should be considered first if
+                * there are tx hangs or other tx related bugs
+                */
+               txdctl |= E1000_TXDCTL_DMA_BURST_ENABLE;
+               ew32(TXDCTL(0), txdctl);
+               /* erratum work around: set txdctl the same for both queues */
+               ew32(TXDCTL(1), txdctl);
+       }
+
        /* Program the Transmit Control Register */
        tctl = er32(TCTL);
        tctl &= ~E1000_TCTL_CT;
@@ -2292,8 +2718,6 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
        ew32(TCTL, tctl);
 
        e1000e_config_collision_dist(hw);
-
-       adapter->tx_queue_len = adapter->netdev->tx_queue_len;
 }
 
 /**
@@ -2309,6 +2733,16 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
        u32 psrctl = 0;
        u32 pages = 0;
 
+       /* Workaround Si errata on 82579 - configure jumbo frame flow */
+       if (hw->mac.type == e1000_pch2lan) {
+               s32 ret_val;
+
+               if (adapter->netdev->mtu > ETH_DATA_LEN)
+                       ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, true);
+               else
+                       ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, false);
+       }
+
        /* Program MC offset vector base */
        rctl = er32(RCTL);
        rctl &= ~(3 << E1000_RCTL_MO_SHIFT);
@@ -2385,7 +2819,7 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
         * per packet.
         */
        pages = PAGE_USE_COUNT(adapter->netdev->mtu);
-       if (!(adapter->flags & FLAG_IS_ICH) && (pages <= 3) &&
+       if (!(adapter->flags & FLAG_HAS_ERT) && (pages <= 3) &&
            (PAGE_SIZE <= 16384) && (rctl & E1000_RCTL_LPE))
                adapter->rx_ps_pages = pages;
        else
@@ -2466,12 +2900,35 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
        e1e_flush();
        msleep(10);
 
+       if (adapter->flags2 & FLAG2_DMA_BURST) {
+               /*
+                * set the writeback threshold (only takes effect if the RDTR
+                * is set). set GRAN=1 and write back up to 0x4 worth, and
+                * enable prefetching of 0x20 rx descriptors
+                * granularity = 01
+                * wthresh = 04,
+                * hthresh = 04,
+                * pthresh = 0x20
+                */
+               ew32(RXDCTL(0), E1000_RXDCTL_DMA_BURST_ENABLE);
+               ew32(RXDCTL(1), E1000_RXDCTL_DMA_BURST_ENABLE);
+
+               /*
+                * override the delay timers for enabling bursting, only if
+                * the value was not set by the user via module options
+                */
+               if (adapter->rx_int_delay == DEFAULT_RDTR)
+                       adapter->rx_int_delay = BURST_RDTR;
+               if (adapter->rx_abs_int_delay == DEFAULT_RADV)
+                       adapter->rx_abs_int_delay = BURST_RADV;
+       }
+
        /* set the Receive Delay Timer Register */
        ew32(RDTR, adapter->rx_int_delay);
 
        /* irq moderation */
        ew32(RADV, adapter->rx_abs_int_delay);
-       if (adapter->itr_setting != 0)
+       if ((adapter->itr_setting != 0) && (adapter->itr != 0))
                ew32(ITR, 1000000000 / (adapter->itr * 256));
 
        ctrl_ext = er32(CTRL_EXT);
@@ -2516,22 +2973,24 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
         * packet size is equal or larger than the specified value (in 8 byte
         * units), e.g. using jumbo frames when setting to E1000_ERT_2048
         */
-       if (adapter->flags & FLAG_HAS_ERT) {
+       if ((adapter->flags & FLAG_HAS_ERT) ||
+           (adapter->hw.mac.type == e1000_pch2lan)) {
                if (adapter->netdev->mtu > ETH_DATA_LEN) {
                        u32 rxdctl = er32(RXDCTL(0));
                        ew32(RXDCTL(0), rxdctl | 0x3);
-                       ew32(ERT, E1000_ERT_2048 | (1 << 13));
+                       if (adapter->flags & FLAG_HAS_ERT)
+                               ew32(ERT, E1000_ERT_2048 | (1 << 13));
                        /*
                         * With jumbo frames and early-receive enabled,
                         * excessive C-state transition latencies result in
                         * dropped transactions.
                         */
-                       pm_qos_update_requirement(PM_QOS_CPU_DMA_LATENCY,
-                                                 adapter->netdev->name, 55);
+                       pm_qos_update_request(
+                               &adapter->netdev->pm_qos_req, 55);
                } else {
-                       pm_qos_update_requirement(PM_QOS_CPU_DMA_LATENCY,
-                                                 adapter->netdev->name,
-                                                 PM_QOS_DEFAULT_VALUE);
+                       pm_qos_update_request(
+                               &adapter->netdev->pm_qos_req,
+                               PM_QOS_DEFAULT_VALUE);
                }
        }
 
@@ -2567,7 +3026,7 @@ static void e1000_set_multi(struct net_device *netdev)
 {
        struct e1000_adapter *adapter = netdev_priv(netdev);
        struct e1000_hw *hw = &adapter->hw;
-       struct dev_mc_list *mc_ptr;
+       struct netdev_hw_addr *ha;
        u8  *mta_list;
        u32 rctl;
        int i;
@@ -2599,9 +3058,8 @@ static void e1000_set_multi(struct net_device *netdev)
 
                /* prepare a packed array of only addresses. */
                i = 0;
-               netdev_for_each_mc_addr(mc_ptr, netdev)
-                       memcpy(mta_list + (i++ * ETH_ALEN),
-                              mc_ptr->dmi_addr, ETH_ALEN);
+               netdev_for_each_mc_addr(ha, netdev)
+                       memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN);
 
                e1000_update_mc_addr_list(hw, mta_list, i);
                kfree(mta_list);
@@ -2623,7 +3081,7 @@ static void e1000_configure(struct e1000_adapter *adapter)
        e1000_set_multi(adapter->netdev);
 
        e1000_restore_vlan(adapter);
-       e1000_init_manageability(adapter);
+       e1000_init_manageability_pt(adapter);
 
        e1000_configure_tx(adapter);
        e1000_setup_rctl(adapter);
@@ -2745,7 +3203,27 @@ void e1000e_reset(struct e1000_adapter *adapter)
         *   with ERT support assuming ERT set to E1000_ERT_2048), or
         * - the full Rx FIFO size minus one full frame
         */
-       if (hw->mac.type == e1000_pchlan) {
+       if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME)
+               fc->pause_time = 0xFFFF;
+       else
+               fc->pause_time = E1000_FC_PAUSE_TIME;
+       fc->send_xon = 1;
+       fc->current_mode = fc->requested_mode;
+
+       switch (hw->mac.type) {
+       default:
+               if ((adapter->flags & FLAG_HAS_ERT) &&
+                   (adapter->netdev->mtu > ETH_DATA_LEN))
+                       hwm = min(((pba << 10) * 9 / 10),
+                                 ((pba << 10) - (E1000_ERT_2048 << 3)));
+               else
+                       hwm = min(((pba << 10) * 9 / 10),
+                                 ((pba << 10) - adapter->max_frame_size));
+
+               fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */
+               fc->low_water = fc->high_water - 8;
+               break;
+       case e1000_pchlan:
                /*
                 * Workaround PCH LOM adapter hangs with certain network
                 * loads.  If hangs persist, try disabling Tx flow control.
@@ -2757,25 +3235,41 @@ void e1000e_reset(struct e1000_adapter *adapter)
                        fc->high_water = 0x5000;
                        fc->low_water  = 0x3000;
                }
-       } else {
-               if ((adapter->flags & FLAG_HAS_ERT) &&
-                   (adapter->netdev->mtu > ETH_DATA_LEN))
-                       hwm = min(((pba << 10) * 9 / 10),
-                                 ((pba << 10) - (E1000_ERT_2048 << 3)));
-               else
-                       hwm = min(((pba << 10) * 9 / 10),
-                                 ((pba << 10) - adapter->max_frame_size));
-
-               fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */
-               fc->low_water = fc->high_water - 8;
+               fc->refresh_time = 0x1000;
+               break;
+       case e1000_pch2lan:
+               fc->high_water = 0x05C20;
+               fc->low_water = 0x05048;
+               fc->pause_time = 0x0650;
+               fc->refresh_time = 0x0400;
+               if (adapter->netdev->mtu > ETH_DATA_LEN) {
+                       pba = 14;
+                       ew32(PBA, pba);
+               }
+               break;
        }
 
-       if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME)
-               fc->pause_time = 0xFFFF;
-       else
-               fc->pause_time = E1000_FC_PAUSE_TIME;
-       fc->send_xon = 1;
-       fc->current_mode = fc->requested_mode;
+       /*
+        * Disable Adaptive Interrupt Moderation if 2 full packets cannot
+        * fit in receive buffer and early-receive not supported.
+        */
+       if (adapter->itr_setting & 0x3) {
+               if (((adapter->max_frame_size * 2) > (pba << 10)) &&
+                   !(adapter->flags & FLAG_HAS_ERT)) {
+                       if (!(adapter->flags2 & FLAG2_DISABLE_AIM)) {
+                               dev_info(&adapter->pdev->dev,
+                                       "Interrupt Throttle Rate turned off\n");
+                               adapter->flags2 |= FLAG2_DISABLE_AIM;
+                               ew32(ITR, 0);
+                       }
+               } else if (adapter->flags2 & FLAG2_DISABLE_AIM) {
+                       dev_info(&adapter->pdev->dev,
+                                "Interrupt Throttle Rate turned on\n");
+                       adapter->flags2 &= ~FLAG2_DISABLE_AIM;
+                       adapter->itr = 20000;
+                       ew32(ITR, 1000000000 / (adapter->itr * 256));
+               }
+       }
 
        /* Allow time for pending master requests to run */
        mac->ops.reset_hw(hw);
@@ -2788,16 +3282,10 @@ void e1000e_reset(struct e1000_adapter *adapter)
                e1000_get_hw_control(adapter);
 
        ew32(WUC, 0);
-       if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP)
-               e1e_wphy(&adapter->hw, BM_WUC, 0);
 
        if (mac->ops.init_hw(hw))
                e_err("Hardware Error\n");
 
-       /* additional part of the flow-control workaround above */
-       if (hw->mac.type == e1000_pchlan)
-               ew32(FCRTV_PCH, 0x1000);
-
        e1000_update_mng_vlan(adapter);
 
        /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
@@ -2824,12 +3312,6 @@ int e1000e_up(struct e1000_adapter *adapter)
 {
        struct e1000_hw *hw = &adapter->hw;
 
-       /* DMA latency requirement to workaround early-receive/jumbo issue */
-       if (adapter->flags & FLAG_HAS_ERT)
-               pm_qos_add_requirement(PM_QOS_CPU_DMA_LATENCY,
-                                      adapter->netdev->name,
-                                      PM_QOS_DEFAULT_VALUE);
-
        /* hardware has been reset, we need to reload some things */
        e1000_configure(adapter);
 
@@ -2843,7 +3325,11 @@ int e1000e_up(struct e1000_adapter *adapter)
        netif_wake_queue(adapter->netdev);
 
        /* fire a link change interrupt to start the watchdog */
-       ew32(ICS, E1000_ICS_LSC);
+       if (adapter->msix_entries)
+               ew32(ICS, E1000_ICS_LSC | E1000_ICR_OTHER);
+       else
+               ew32(ICS, E1000_ICS_LSC);
+
        return 0;
 }
 
@@ -2880,7 +3366,6 @@ void e1000e_down(struct e1000_adapter *adapter)
        del_timer_sync(&adapter->watchdog_timer);
        del_timer_sync(&adapter->phy_info_timer);
 
-       netdev->tx_queue_len = adapter->tx_queue_len;
        netif_carrier_off(netdev);
        adapter->link_speed = 0;
        adapter->link_duplex = 0;
@@ -2890,10 +3375,6 @@ void e1000e_down(struct e1000_adapter *adapter)
        e1000_clean_tx_ring(adapter);
        e1000_clean_rx_ring(adapter);
 
-       if (adapter->flags & FLAG_HAS_ERT)
-               pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY,
-                                         adapter->netdev->name);
-
        /*
         * TODO: for power management, we could drop the link and
         * pci_disable_device here.
@@ -3010,22 +3491,16 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
 
        if (adapter->flags & FLAG_MSI_TEST_FAILED) {
                adapter->int_mode = E1000E_INT_MODE_LEGACY;
-               err = -EIO;
-               e_info("MSI interrupt test failed!\n");
-       }
+               e_info("MSI interrupt test failed, using legacy interrupt.\n");
+       } else
+               e_dbg("MSI interrupt test succeeded!\n");
 
        free_irq(adapter->pdev->irq, netdev);
        pci_disable_msi(adapter->pdev);
 
-       if (err == -EIO)
-               goto msi_test_failed;
-
-       /* okay so the test worked, restore settings */
-       e_dbg("MSI interrupt test succeeded!\n");
 msi_test_failed:
        e1000e_set_interrupt_capability(adapter);
-       e1000_request_irq(adapter);
-       return err;
+       return e1000_request_irq(adapter);
 }
 
 /**
@@ -3044,28 +3519,18 @@ static int e1000_test_msi(struct e1000_adapter *adapter)
 
        /* disable SERR in case the MSI write causes a master abort */
        pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd);
-       pci_write_config_word(adapter->pdev, PCI_COMMAND,
-                             pci_cmd & ~PCI_COMMAND_SERR);
+       if (pci_cmd & PCI_COMMAND_SERR)
+               pci_write_config_word(adapter->pdev, PCI_COMMAND,
+                                     pci_cmd & ~PCI_COMMAND_SERR);
 
        err = e1000_test_msi_interrupt(adapter);
 
-       /* restore previous setting of command word */
-       pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd);
-
-       /* success ! */
-       if (!err)
-               return 0;
-
-       /* EIO means MSI test failed */
-       if (err != -EIO)
-               return err;
-
-       /* back to INTx mode */
-       e_warn("MSI interrupt test failed, using legacy interrupt.\n");
-
-       e1000_free_irq(adapter);
-
-       err = e1000_request_irq(adapter);
+       /* re-enable SERR */
+       if (pci_cmd & PCI_COMMAND_SERR) {
+               pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd);
+               pci_cmd |= PCI_COMMAND_SERR;
+               pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd);
+       }
 
        return err;
 }
@@ -3107,6 +3572,15 @@ static int e1000_open(struct net_device *netdev)
        if (err)
                goto err_setup_rx;
 
+       /*
+        * If AMT is enabled, let the firmware know that the network
+        * interface is now open and reset the part to a known state.
+        */
+       if (adapter->flags & FLAG_HAS_AMT) {
+               e1000_get_hw_control(adapter);
+               e1000e_reset(adapter);
+       }
+
        e1000e_power_up_phy(adapter);
 
        adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
@@ -3114,12 +3588,12 @@ static int e1000_open(struct net_device *netdev)
             E1000_MNG_DHCP_COOKIE_STATUS_VLAN))
                e1000_update_mng_vlan(adapter);
 
-       /*
-        * If AMT is enabled, let the firmware know that the network
-        * interface is now open
-        */
-       if (adapter->flags & FLAG_HAS_AMT)
-               e1000_get_hw_control(adapter);
+       /* DMA latency requirement to workaround early-receive/jumbo issue */
+       if ((adapter->flags & FLAG_HAS_ERT) ||
+           (adapter->hw.mac.type == e1000_pch2lan))
+               pm_qos_add_request(&adapter->netdev->pm_qos_req,
+                                  PM_QOS_CPU_DMA_LATENCY,
+                                  PM_QOS_DEFAULT_VALUE);
 
        /*
         * before we allocate an interrupt, we must be ready to handle it.
@@ -3159,7 +3633,10 @@ static int e1000_open(struct net_device *netdev)
        pm_runtime_put(&pdev->dev);
 
        /* fire a link status change interrupt to start the watchdog */
-       ew32(ICS, E1000_ICS_LSC);
+       if (adapter->msix_entries)
+               ew32(ICS, E1000_ICS_LSC | E1000_ICR_OTHER);
+       else
+               ew32(ICS, E1000_ICS_LSC);
 
        return 0;
 
@@ -3222,6 +3699,10 @@ static int e1000_close(struct net_device *netdev)
        if (adapter->flags & FLAG_HAS_AMT)
                e1000_release_hw_control(adapter);
 
+       if ((adapter->flags & FLAG_HAS_ERT) ||
+           (adapter->hw.mac.type == e1000_pch2lan))
+               pm_qos_remove_request(&adapter->netdev->pm_qos_req);
+
        pm_runtime_put_sync(&pdev->dev);
 
        return 0;
@@ -3292,6 +3773,110 @@ static void e1000_update_phy_info(unsigned long data)
 }
 
 /**
+ * e1000e_update_phy_stats - Update the PHY statistics counters
+ * @adapter: board private structure
+ **/
+static void e1000e_update_phy_stats(struct e1000_adapter *adapter)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       s32 ret_val;
+       u16 phy_data;
+
+       ret_val = hw->phy.ops.acquire(hw);
+       if (ret_val)
+               return;
+
+       hw->phy.addr = 1;
+
+#define HV_PHY_STATS_PAGE      778
+       /*
+        * A page set is expensive so check if already on desired page.
+        * If not, set to the page with the PHY status registers.
+        */
+       ret_val = e1000e_read_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT,
+                                          &phy_data);
+       if (ret_val)
+               goto release;
+       if (phy_data != (HV_PHY_STATS_PAGE << IGP_PAGE_SHIFT)) {
+               ret_val = e1000e_write_phy_reg_mdic(hw,
+                                                   IGP01E1000_PHY_PAGE_SELECT,
+                                                   (HV_PHY_STATS_PAGE <<
+                                                    IGP_PAGE_SHIFT));
+               if (ret_val)
+                       goto release;
+       }
+
+       /* Read/clear the upper 16-bit registers and read/accumulate lower */
+
+       /* Single Collision Count */
+       e1000e_read_phy_reg_mdic(hw, HV_SCC_UPPER & MAX_PHY_REG_ADDRESS,
+                                &phy_data);
+       ret_val = e1000e_read_phy_reg_mdic(hw,
+                                          HV_SCC_LOWER & MAX_PHY_REG_ADDRESS,
+                                          &phy_data);
+       if (!ret_val)
+               adapter->stats.scc += phy_data;
+
+       /* Excessive Collision Count */
+       e1000e_read_phy_reg_mdic(hw, HV_ECOL_UPPER & MAX_PHY_REG_ADDRESS,
+                                &phy_data);
+       ret_val = e1000e_read_phy_reg_mdic(hw,
+                                          HV_ECOL_LOWER & MAX_PHY_REG_ADDRESS,
+                                          &phy_data);
+       if (!ret_val)
+               adapter->stats.ecol += phy_data;
+
+       /* Multiple Collision Count */
+       e1000e_read_phy_reg_mdic(hw, HV_MCC_UPPER & MAX_PHY_REG_ADDRESS,
+                                &phy_data);
+       ret_val = e1000e_read_phy_reg_mdic(hw,
+                                          HV_MCC_LOWER & MAX_PHY_REG_ADDRESS,
+                                          &phy_data);
+       if (!ret_val)
+               adapter->stats.mcc += phy_data;
+
+       /* Late Collision Count */
+       e1000e_read_phy_reg_mdic(hw, HV_LATECOL_UPPER & MAX_PHY_REG_ADDRESS,
+                                &phy_data);
+       ret_val = e1000e_read_phy_reg_mdic(hw,
+                                          HV_LATECOL_LOWER &
+                                          MAX_PHY_REG_ADDRESS,
+                                          &phy_data);
+       if (!ret_val)
+               adapter->stats.latecol += phy_data;
+
+       /* Collision Count - also used for adaptive IFS */
+       e1000e_read_phy_reg_mdic(hw, HV_COLC_UPPER & MAX_PHY_REG_ADDRESS,
+                                &phy_data);
+       ret_val = e1000e_read_phy_reg_mdic(hw,
+                                          HV_COLC_LOWER & MAX_PHY_REG_ADDRESS,
+                                          &phy_data);
+       if (!ret_val)
+               hw->mac.collision_delta = phy_data;
+
+       /* Defer Count */
+       e1000e_read_phy_reg_mdic(hw, HV_DC_UPPER & MAX_PHY_REG_ADDRESS,
+                                &phy_data);
+       ret_val = e1000e_read_phy_reg_mdic(hw,
+                                          HV_DC_LOWER & MAX_PHY_REG_ADDRESS,
+                                          &phy_data);
+       if (!ret_val)
+               adapter->stats.dc += phy_data;
+
+       /* Transmit with no CRS */
+       e1000e_read_phy_reg_mdic(hw, HV_TNCRS_UPPER & MAX_PHY_REG_ADDRESS,
+                                &phy_data);
+       ret_val = e1000e_read_phy_reg_mdic(hw,
+                                          HV_TNCRS_LOWER & MAX_PHY_REG_ADDRESS,
+                                          &phy_data);
+       if (!ret_val)
+               adapter->stats.tncrs += phy_data;
+
+release:
+       hw->phy.ops.release(hw);
+}
+
+/**
  * e1000e_update_stats - Update the board statistics counters
  * @adapter: board private structure
  **/
@@ -3300,7 +3885,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
        struct net_device *netdev = adapter->netdev;
        struct e1000_hw *hw = &adapter->hw;
        struct pci_dev *pdev = adapter->pdev;
-       u16 phy_data;
 
        /*
         * Prevent stats update while adapter is being reset, or if the pci
@@ -3320,34 +3904,27 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
        adapter->stats.roc += er32(ROC);
 
        adapter->stats.mpc += er32(MPC);
-       if ((hw->phy.type == e1000_phy_82578) ||
-           (hw->phy.type == e1000_phy_82577)) {
-               e1e_rphy(hw, HV_SCC_UPPER, &phy_data);
-               if (!e1e_rphy(hw, HV_SCC_LOWER, &phy_data))
-                       adapter->stats.scc += phy_data;
-
-               e1e_rphy(hw, HV_ECOL_UPPER, &phy_data);
-               if (!e1e_rphy(hw, HV_ECOL_LOWER, &phy_data))
-                       adapter->stats.ecol += phy_data;
-
-               e1e_rphy(hw, HV_MCC_UPPER, &phy_data);
-               if (!e1e_rphy(hw, HV_MCC_LOWER, &phy_data))
-                       adapter->stats.mcc += phy_data;
-
-               e1e_rphy(hw, HV_LATECOL_UPPER, &phy_data);
-               if (!e1e_rphy(hw, HV_LATECOL_LOWER, &phy_data))
-                       adapter->stats.latecol += phy_data;
-
-               e1e_rphy(hw, HV_DC_UPPER, &phy_data);
-               if (!e1e_rphy(hw, HV_DC_LOWER, &phy_data))
-                       adapter->stats.dc += phy_data;
-       } else {
-               adapter->stats.scc += er32(SCC);
-               adapter->stats.ecol += er32(ECOL);
-               adapter->stats.mcc += er32(MCC);
-               adapter->stats.latecol += er32(LATECOL);
-               adapter->stats.dc += er32(DC);
+
+       /* Half-duplex statistics */
+       if (adapter->link_duplex == HALF_DUPLEX) {
+               if (adapter->flags2 & FLAG2_HAS_PHY_STATS) {
+                       e1000e_update_phy_stats(adapter);
+               } else {
+                       adapter->stats.scc += er32(SCC);
+                       adapter->stats.ecol += er32(ECOL);
+                       adapter->stats.mcc += er32(MCC);
+                       adapter->stats.latecol += er32(LATECOL);
+                       adapter->stats.dc += er32(DC);
+
+                       hw->mac.collision_delta = er32(COLC);
+
+                       if ((hw->mac.type != e1000_82574) &&
+                           (hw->mac.type != e1000_82583))
+                               adapter->stats.tncrs += er32(TNCRS);
+               }
+               adapter->stats.colc += hw->mac.collision_delta;
        }
+
        adapter->stats.xonrxc += er32(XONRXC);
        adapter->stats.xontxc += er32(XONTXC);
        adapter->stats.xoffrxc += er32(XOFFRXC);
@@ -3365,28 +3942,9 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
 
        hw->mac.tx_packet_delta = er32(TPT);
        adapter->stats.tpt += hw->mac.tx_packet_delta;
-       if ((hw->phy.type == e1000_phy_82578) ||
-           (hw->phy.type == e1000_phy_82577)) {
-               e1e_rphy(hw, HV_COLC_UPPER, &phy_data);
-               if (!e1e_rphy(hw, HV_COLC_LOWER, &phy_data))
-                       hw->mac.collision_delta = phy_data;
-       } else {
-               hw->mac.collision_delta = er32(COLC);
-       }
-       adapter->stats.colc += hw->mac.collision_delta;
 
        adapter->stats.algnerrc += er32(ALGNERRC);
        adapter->stats.rxerrc += er32(RXERRC);
-       if ((hw->phy.type == e1000_phy_82578) ||
-           (hw->phy.type == e1000_phy_82577)) {
-               e1e_rphy(hw, HV_TNCRS_UPPER, &phy_data);
-               if (!e1e_rphy(hw, HV_TNCRS_LOWER, &phy_data))
-                       adapter->stats.tncrs += phy_data;
-       } else {
-               if ((hw->mac.type != e1000_82574) &&
-                   (hw->mac.type != e1000_82583))
-                       adapter->stats.tncrs += er32(TNCRS);
-       }
        adapter->stats.cexterr += er32(CEXTERR);
        adapter->stats.tsctc += er32(TSCTC);
        adapter->stats.tsctfc += er32(TSCTFC);
@@ -3485,7 +4043,7 @@ static void e1000_print_link_info(struct e1000_adapter *adapter)
               ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" )));
 }
 
-bool e1000e_has_link(struct e1000_adapter *adapter)
+static bool e1000e_has_link(struct e1000_adapter *adapter)
 {
        struct e1000_hw *hw = &adapter->hw;
        bool link_active = 0;
@@ -3613,21 +4171,15 @@ static void e1000_watchdog_task(struct work_struct *work)
                                               "link gets many collisions.\n");
                        }
 
-                       /*
-                        * tweak tx_queue_len according to speed/duplex
-                        * and adjust the timeout factor
-                        */
-                       netdev->tx_queue_len = adapter->tx_queue_len;
+                       /* adjust timeout factor according to speed/duplex */
                        adapter->tx_timeout_factor = 1;
                        switch (adapter->link_speed) {
                        case SPEED_10:
                                txb2b = 0;
-                               netdev->tx_queue_len = 10;
                                adapter->tx_timeout_factor = 16;
                                break;
                        case SPEED_100:
                                txb2b = 0;
-                               netdev->tx_queue_len = 100;
                                adapter->tx_timeout_factor = 10;
                                break;
                        }
@@ -3739,6 +4291,22 @@ link_up:
                }
        }
 
+       /* Simple mode for Interrupt Throttle Rate (ITR) */
+       if (adapter->itr_setting == 4) {
+               /*
+                * Symmetric Tx/Rx gets a reduced ITR=2000;
+                * Total asymmetrical Tx or Rx gets ITR=8000;
+                * everyone else is between 2000-8000.
+                */
+               u32 goc = (adapter->gotc + adapter->gorc) / 10000;
+               u32 dif = (adapter->gotc > adapter->gorc ?
+                           adapter->gotc - adapter->gorc :
+                           adapter->gorc - adapter->gotc) / 10000;
+               u32 itr = goc > 0 ? (dif * 6000 / goc + 2000) : 8000;
+
+               ew32(ITR, 1000000000 / (itr * 256));
+       }
+
        /* Cause software interrupt to ensure Rx ring is cleaned */
        if (adapter->msix_entries)
                ew32(ICS, adapter->rx_ring->ims_val);
@@ -3748,6 +4316,16 @@ link_up:
        /* Force detection of hung controller every watchdog period */
        adapter->detect_tx_hung = 1;
 
+       /* flush partial descriptors to memory before detecting tx hang */
+       if (adapter->flags2 & FLAG2_DMA_BURST) {
+               ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD);
+               ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD);
+               /*
+                * no need to flush the writes because the timeout code does
+                * an er32 first thing
+                */
+       }
+
        /*
         * With 82571 controllers, LAA may be overwritten due to controller
         * reset from the other port. Set the appropriate LAA in RAR[0]
@@ -3913,7 +4491,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
        struct e1000_buffer *buffer_info;
        unsigned int len = skb_headlen(skb);
        unsigned int offset = 0, size, count = 0, i;
-       unsigned int f;
+       unsigned int f, bytecount, segs;
 
        i = tx_ring->next_to_use;
 
@@ -3924,10 +4502,11 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
                buffer_info->length = size;
                buffer_info->time_stamp = jiffies;
                buffer_info->next_to_watch = i;
-               buffer_info->dma = pci_map_single(pdev, skb->data + offset,
-                                                 size, PCI_DMA_TODEVICE);
+               buffer_info->dma = dma_map_single(&pdev->dev,
+                                                 skb->data + offset,
+                                                 size, DMA_TO_DEVICE);
                buffer_info->mapped_as_page = false;
-               if (pci_dma_mapping_error(pdev, buffer_info->dma))
+               if (dma_mapping_error(&pdev->dev, buffer_info->dma))
                        goto dma_error;
 
                len -= size;
@@ -3959,11 +4538,11 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
                        buffer_info->length = size;
                        buffer_info->time_stamp = jiffies;
                        buffer_info->next_to_watch = i;
-                       buffer_info->dma = pci_map_page(pdev, frag->page,
+                       buffer_info->dma = dma_map_page(&pdev->dev, frag->page,
                                                        offset, size,
-                                                       PCI_DMA_TODEVICE);
+                                                       DMA_TO_DEVICE);
                        buffer_info->mapped_as_page = true;
-                       if (pci_dma_mapping_error(pdev, buffer_info->dma))
+                       if (dma_mapping_error(&pdev->dev, buffer_info->dma))
                                goto dma_error;
 
                        len -= size;
@@ -3972,7 +4551,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
                }
        }
 
+       segs = skb_shinfo(skb)->gso_segs ?: 1;
+       /* multiply data chunks by size of headers */
+       bytecount = ((segs - 1) * skb_headlen(skb)) + skb->len;
+
        tx_ring->buffer_info[i].skb = skb;
+       tx_ring->buffer_info[i].segs = segs;
+       tx_ring->buffer_info[i].bytecount = bytecount;
        tx_ring->buffer_info[first].next_to_watch = i;
 
        return count;
@@ -4139,7 +4724,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
        unsigned int max_per_txd = E1000_MAX_PER_TXD;
        unsigned int max_txd_pwr = E1000_MAX_TXD_PWR;
        unsigned int tx_flags = 0;
-       unsigned int len = skb->len - skb->data_len;
+       unsigned int len = skb_headlen(skb);
        unsigned int nr_frags;
        unsigned int mss;
        int count = 0;
@@ -4189,7 +4774,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
                                dev_kfree_skb_any(skb);
                                return NETDEV_TX_OK;
                        }
-                       len = skb->len - skb->data_len;
+                       len = skb_headlen(skb);
                }
        }
 
@@ -4215,7 +4800,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
        if (e1000_maybe_stop_tx(netdev, count + 2))
                return NETDEV_TX_BUSY;
 
-       if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
+       if (vlan_tx_tag_present(skb)) {
                tx_flags |= E1000_TX_FLAGS_VLAN;
                tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT);
        }
@@ -4275,6 +4860,8 @@ static void e1000_reset_task(struct work_struct *work)
        struct e1000_adapter *adapter;
        adapter = container_of(work, struct e1000_adapter, reset_task);
 
+       e1000e_dump(adapter);
+       e_err("Reset adapter\n");
        e1000e_reinit_locked(adapter);
 }
 
@@ -4317,6 +4904,23 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
                return -EINVAL;
        }
 
+       /* Jumbo frame workaround on 82579 requires CRC be stripped */
+       if ((adapter->hw.mac.type == e1000_pch2lan) &&
+           !(adapter->flags2 & FLAG2_CRC_STRIPPING) &&
+           (new_mtu > ETH_DATA_LEN)) {
+               e_err("Jumbo Frames not supported on 82579 when CRC "
+                     "stripping is disabled.\n");
+               return -EINVAL;
+       }
+
+       /* 82573 Errata 17 */
+       if (((adapter->hw.mac.type == e1000_82573) ||
+            (adapter->hw.mac.type == e1000_82574)) &&
+           (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN)) {
+               adapter->flags2 |= FLAG2_DISABLE_ASPM_L1;
+               e1000e_disable_aspm(adapter->pdev, PCIE_LINK_STATE_L1);
+       }
+
        while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
                msleep(1);
        /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */
@@ -4434,14 +5038,7 @@ static int e1000_init_phy_wakeup(struct e1000_adapter *adapter, u32 wufc)
        int retval = 0;
 
        /* copy MAC RARs to PHY RARs */
-       for (i = 0; i < adapter->hw.mac.rar_entry_count; i++) {
-               mac_reg = er32(RAL(i));
-               e1e_wphy(hw, BM_RAR_L(i), (u16)(mac_reg & 0xFFFF));
-               e1e_wphy(hw, BM_RAR_M(i), (u16)((mac_reg >> 16) & 0xFFFF));
-               mac_reg = er32(RAH(i));
-               e1e_wphy(hw, BM_RAR_H(i), (u16)(mac_reg & 0xFFFF));
-               e1e_wphy(hw, BM_RAR_CTRL(i), (u16)((mac_reg >> 16) & 0xFFFF));
-       }
+       e1000_copy_rx_addrs_to_phy_ich8lan(hw);
 
        /* copy MAC MTA to PHY MTA */
        for (i = 0; i < adapter->hw.mac.mta_reg_count; i++) {
@@ -4641,29 +5238,42 @@ static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep,
        }
 }
 
-static void e1000e_disable_l1aspm(struct pci_dev *pdev)
+#ifdef CONFIG_PCIEASPM
+static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state)
+{
+       pci_disable_link_state(pdev, state);
+}
+#else
+static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state)
 {
        int pos;
-       u16 val;
+       u16 reg16;
 
        /*
-        * 82573 workaround - disable L1 ASPM on mobile chipsets
-        *
-        * L1 ASPM on various mobile (ich7) chipsets do not behave properly
-        * resulting in lost data or garbage information on the pci-e link
-        * level. This could result in (false) bad EEPROM checksum errors,
-        * long ping times (up to 2s) or even a system freeze/hang.
-        *
-        * Unfortunately this feature saves about 1W power consumption when
-        * active.
+        * Both device and parent should have the same ASPM setting.
+        * Disable ASPM in downstream component first and then upstream.
         */
-       pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
-       pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &val);
-       if (val & 0x2) {
-               dev_warn(&pdev->dev, "Disabling L1 ASPM\n");
-               val &= ~0x2;
-               pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, val);
-       }
+       pos = pci_pcie_cap(pdev);
+       pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &reg16);
+       reg16 &= ~state;
+       pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16);
+
+       if (!pdev->bus->self)
+               return;
+
+       pos = pci_pcie_cap(pdev->bus->self);
+       pci_read_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, &reg16);
+       reg16 &= ~state;
+       pci_write_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, reg16);
+}
+#endif
+void e1000e_disable_aspm(struct pci_dev *pdev, u16 state)
+{
+       dev_info(&pdev->dev, "Disabling ASPM %s %s\n",
+                (state & PCIE_LINK_STATE_L0S) ? "L0s" : "",
+                (state & PCIE_LINK_STATE_L1) ? "L1" : "");
+
+       __e1000e_disable_aspm(pdev, state);
 }
 
 #ifdef CONFIG_PM_OPS
@@ -4679,7 +5289,11 @@ static int __e1000_resume(struct pci_dev *pdev)
        struct e1000_hw *hw = &adapter->hw;
        u32 err;
 
-       e1000e_disable_l1aspm(pdev);
+       pci_set_power_state(pdev, PCI_D0);
+       pci_restore_state(pdev);
+       pci_save_state(pdev);
+       if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1)
+               e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1);
 
        e1000e_set_interrupt_capability(adapter);
        if (netif_running(netdev)) {
@@ -4721,7 +5335,7 @@ static int __e1000_resume(struct pci_dev *pdev)
 
        e1000e_reset(adapter);
 
-       e1000_init_manageability(adapter);
+       e1000_init_manageability_pt(adapter);
 
        if (netif_running(netdev))
                e1000e_up(adapter);
@@ -4884,7 +5498,8 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
        int err;
        pci_ers_result_t result;
 
-       e1000e_disable_l1aspm(pdev);
+       if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1)
+               e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1);
        err = pci_enable_device_mem(pdev);
        if (err) {
                dev_err(&pdev->dev,
@@ -4921,7 +5536,7 @@ static void e1000_io_resume(struct pci_dev *pdev)
        struct net_device *netdev = pci_get_drvdata(pdev);
        struct e1000_adapter *adapter = netdev_priv(netdev);
 
-       e1000_init_manageability(adapter);
+       e1000_init_manageability_pt(adapter);
 
        if (netif_running(netdev)) {
                if (e1000e_up(adapter)) {
@@ -4978,13 +5593,6 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter)
                dev_warn(&adapter->pdev->dev,
                         "Warning: detected DSPD enabled in EEPROM\n");
        }
-
-       ret_val = e1000_read_nvm(hw, NVM_INIT_3GIO_3, 1, &buf);
-       if (!ret_val && (le16_to_cpu(buf) & (3 << 2))) {
-               /* ASPM enable */
-               dev_warn(&adapter->pdev->dev,
-                        "Warning: detected ASPM enabled in EEPROM\n");
-       }
 }
 
 static const struct net_device_ops e1000e_netdev_ops = {
@@ -5033,23 +5641,24 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
        u16 eeprom_data = 0;
        u16 eeprom_apme_mask = E1000_EEPROM_APME;
 
-       e1000e_disable_l1aspm(pdev);
+       if (ei->flags2 & FLAG2_DISABLE_ASPM_L1)
+               e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1);
 
        err = pci_enable_device_mem(pdev);
        if (err)
                return err;
 
        pci_using_dac = 0;
-       err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
+       err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
        if (!err) {
-               err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
+               err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
                if (!err)
                        pci_using_dac = 1;
        } else {
-               err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+               err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
                if (err) {
-                       err = pci_set_consistent_dma_mask(pdev,
-                                                         DMA_BIT_MASK(32));
+                       err = dma_set_coherent_mask(&pdev->dev,
+                                                   DMA_BIT_MASK(32));
                        if (err) {
                                dev_err(&pdev->dev, "No usable DMA "
                                        "configuration, aborting\n");
@@ -5080,6 +5689,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 
        SET_NETDEV_DEV(netdev, &pdev->dev);
 
+       netdev->irq = pdev->irq;
+
        pci_set_drvdata(pdev, netdev);
        adapter = netdev_priv(netdev);
        hw = &adapter->hw;
@@ -5130,8 +5741,6 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
        if (err)
                goto err_sw_init;
 
-       err = -EIO;
-
        memcpy(&hw->mac.ops, ei->mac_ops, sizeof(hw->mac.ops));
        memcpy(&hw->nvm.ops, ei->nvm_ops, sizeof(hw->nvm.ops));
        memcpy(&hw->phy.ops, ei->phy_ops, sizeof(hw->phy.ops));
@@ -5174,8 +5783,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
        netdev->vlan_features |= NETIF_F_HW_CSUM;
        netdev->vlan_features |= NETIF_F_SG;
 
-       if (pci_using_dac)
+       if (pci_using_dac) {
                netdev->features |= NETIF_F_HIGHDMA;
+               netdev->vlan_features |= NETIF_F_HIGHDMA;
+       }
 
        if (e1000e_enable_mng_pass_thru(&adapter->hw))
                adapter->flags |= FLAG_MNG_PT_ENABLED;
@@ -5216,11 +5827,11 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
        }
 
        init_timer(&adapter->watchdog_timer);
-       adapter->watchdog_timer.function = &e1000_watchdog;
+       adapter->watchdog_timer.function = e1000_watchdog;
        adapter->watchdog_timer.data = (unsigned long) adapter;
 
        init_timer(&adapter->phy_info_timer);
-       adapter->phy_info_timer.function = &e1000_update_phy_info;
+       adapter->phy_info_timer.function = e1000_update_phy_info;
        adapter->phy_info_timer.data = (unsigned long) adapter;
 
        INIT_WORK(&adapter->reset_task, e1000_reset_task);
@@ -5300,11 +5911,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 
        e1000_print_device_info(adapter);
 
-       if (pci_dev_run_wake(pdev)) {
-               pm_runtime_set_active(&pdev->dev);
-               pm_runtime_enable(&pdev->dev);
-       }
-       pm_schedule_suspend(&pdev->dev, MSEC_PER_SEC);
+       if (pci_dev_run_wake(pdev))
+               pm_runtime_put_noidle(&pdev->dev);
 
        return 0;
 
@@ -5350,8 +5958,6 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
        struct e1000_adapter *adapter = netdev_priv(netdev);
        bool down = test_bit(__E1000_DOWN, &adapter->state);
 
-       pm_runtime_get_sync(&pdev->dev);
-
        /*
         * flush_scheduled work may reschedule our watchdog task, so
         * explicitly disable watchdog tasks from being rescheduled
@@ -5376,11 +5982,8 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
                clear_bit(__E1000_DOWN, &adapter->state);
        unregister_netdev(netdev);
 
-       if (pci_dev_run_wake(pdev)) {
-               pm_runtime_disable(&pdev->dev);
-               pm_runtime_set_suspended(&pdev->dev);
-       }
-       pm_runtime_put_noidle(&pdev->dev);
+       if (pci_dev_run_wake(pdev))
+               pm_runtime_get_noresume(&pdev->dev);
 
        /*
         * Release control of h/w to f/w.  If f/w is AMT enabled, this
@@ -5471,12 +6074,16 @@ static DEFINE_PCI_DEVICE_TABLE(e1000_pci_tbl) = {
 
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_D_BM_LM), board_ich10lan },
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_D_BM_LF), board_ich10lan },
+       { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_D_BM_V), board_ich10lan },
 
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_M_HV_LM), board_pchlan },
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_M_HV_LC), board_pchlan },
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_D_HV_DM), board_pchlan },
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_D_HV_DC), board_pchlan },
 
+       { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH2_LV_LM), board_pch2lan },
+       { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH2_LV_V), board_pch2lan },
+
        { }     /* terminate list */
 };
 MODULE_DEVICE_TABLE(pci, e1000_pci_tbl);
@@ -5513,7 +6120,7 @@ static int __init e1000_init_module(void)
        int ret;
        pr_info("Intel(R) PRO/1000 Network Driver - %s\n",
                e1000e_driver_version);
-       pr_info("Copyright (c) 1999 - 2009 Intel Corporation.\n");
+       pr_info("Copyright (c) 1999 - 2010 Intel Corporation.\n");
        ret = pci_register_driver(&e1000_driver);
 
        return ret;