ixgbe: drop support for UDP in RSS hash generation
[deliverable/linux.git] / drivers / net / ixgbe / ixgbe_main.c
index 6c00ee493a3bb1c1bae50b59fdb2afb58688c22e..813d2cb5b4d09b6e13baaeab0ee80c094e744bb4 100644 (file)
@@ -108,6 +108,8 @@ static DEFINE_PCI_DEVICE_TABLE(ixgbe_pci_tbl) = {
         board_82599 },
        {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_CX4),
         board_82599 },
+       {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_T3_LOM),
+        board_82599 },
        {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_COMBO_BACKPLANE),
         board_82599 },
 
@@ -175,6 +177,345 @@ static inline void ixgbe_disable_sriov(struct ixgbe_adapter *adapter)
        adapter->flags &= ~IXGBE_FLAG_SRIOV_ENABLED;
 }
 
+struct ixgbe_reg_info {
+       u32 ofs;
+       char *name;
+};
+
+static const struct ixgbe_reg_info ixgbe_reg_info_tbl[] = {
+
+       /* General Registers */
+       {IXGBE_CTRL, "CTRL"},
+       {IXGBE_STATUS, "STATUS"},
+       {IXGBE_CTRL_EXT, "CTRL_EXT"},
+
+       /* Interrupt Registers */
+       {IXGBE_EICR, "EICR"},
+
+       /* RX Registers */
+       {IXGBE_SRRCTL(0), "SRRCTL"},
+       {IXGBE_DCA_RXCTRL(0), "DRXCTL"},
+       {IXGBE_RDLEN(0), "RDLEN"},
+       {IXGBE_RDH(0), "RDH"},
+       {IXGBE_RDT(0), "RDT"},
+       {IXGBE_RXDCTL(0), "RXDCTL"},
+       {IXGBE_RDBAL(0), "RDBAL"},
+       {IXGBE_RDBAH(0), "RDBAH"},
+
+       /* TX Registers */
+       {IXGBE_TDBAL(0), "TDBAL"},
+       {IXGBE_TDBAH(0), "TDBAH"},
+       {IXGBE_TDLEN(0), "TDLEN"},
+       {IXGBE_TDH(0), "TDH"},
+       {IXGBE_TDT(0), "TDT"},
+       {IXGBE_TXDCTL(0), "TXDCTL"},
+
+       /* List Terminator */
+       {}
+};
+
+
+/*
+ * ixgbe_regdump - register printout routine
+ */
+static void ixgbe_regdump(struct ixgbe_hw *hw, struct ixgbe_reg_info *reginfo)
+{
+       int i = 0, j = 0;
+       char rname[16];
+       u32 regs[64];
+
+       switch (reginfo->ofs) {
+       case IXGBE_SRRCTL(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_SRRCTL(i));
+               break;
+       case IXGBE_DCA_RXCTRL(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i));
+               break;
+       case IXGBE_RDLEN(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_RDLEN(i));
+               break;
+       case IXGBE_RDH(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_RDH(i));
+               break;
+       case IXGBE_RDT(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_RDT(i));
+               break;
+       case IXGBE_RXDCTL(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i));
+               break;
+       case IXGBE_RDBAL(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_RDBAL(i));
+               break;
+       case IXGBE_RDBAH(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_RDBAH(i));
+               break;
+       case IXGBE_TDBAL(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_TDBAL(i));
+               break;
+       case IXGBE_TDBAH(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_TDBAH(i));
+               break;
+       case IXGBE_TDLEN(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_TDLEN(i));
+               break;
+       case IXGBE_TDH(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_TDH(i));
+               break;
+       case IXGBE_TDT(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_TDT(i));
+               break;
+       case IXGBE_TXDCTL(0):
+               for (i = 0; i < 64; i++)
+                       regs[i] = IXGBE_READ_REG(hw, IXGBE_TXDCTL(i));
+               break;
+       default:
+               printk(KERN_INFO "%-15s %08x\n", reginfo->name,
+                       IXGBE_READ_REG(hw, reginfo->ofs));
+               return;
+       }
+
+       for (i = 0; i < 8; i++) {
+               snprintf(rname, 16, "%s[%d-%d]", reginfo->name, i*8, i*8+7);
+               printk(KERN_ERR "%-15s ", rname);
+               for (j = 0; j < 8; j++)
+                       printk(KERN_CONT "%08x ", regs[i*8+j]);
+               printk(KERN_CONT "\n");
+       }
+
+}
+
+/*
+ * ixgbe_dump - Print registers, tx-rings and rx-rings
+ */
+static void ixgbe_dump(struct ixgbe_adapter *adapter)
+{
+       struct net_device *netdev = adapter->netdev;
+       struct ixgbe_hw *hw = &adapter->hw;
+       struct ixgbe_reg_info *reginfo;
+       int n = 0;
+       struct ixgbe_ring *tx_ring;
+       struct ixgbe_tx_buffer *tx_buffer_info;
+       union ixgbe_adv_tx_desc *tx_desc;
+       struct my_u0 { u64 a; u64 b; } *u0;
+       struct ixgbe_ring *rx_ring;
+       union ixgbe_adv_rx_desc *rx_desc;
+       struct ixgbe_rx_buffer *rx_buffer_info;
+       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 ixgbe_reg_info *)ixgbe_reg_info_tbl;
+            reginfo->name; reginfo++) {
+               ixgbe_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");
+       for (n = 0; n < adapter->num_tx_queues; n++) {
+               tx_ring = adapter->tx_ring[n];
+               tx_buffer_info =
+                       &tx_ring->tx_buffer_info[tx_ring->next_to_clean];
+               printk(KERN_INFO " %5d %5X %5X %016llX %04X %3X %016llX\n",
+                          n, tx_ring->next_to_use, tx_ring->next_to_clean,
+                          (u64)tx_buffer_info->dma,
+                          tx_buffer_info->length,
+                          tx_buffer_info->next_to_watch,
+                          (u64)tx_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
+        *
+        * Advanced Transmit Descriptor
+        *   +--------------------------------------------------------------+
+        * 0 |         Buffer Address [63:0]                                |
+        *   +--------------------------------------------------------------+
+        * 8 |  PAYLEN  | PORTS  | IDX | STA | DCMD  |DTYP |  RSV |  DTALEN |
+        *   +--------------------------------------------------------------+
+        *   63       46 45    40 39 36 35 32 31   24 23 20 19              0
+        */
+
+       for (n = 0; n < adapter->num_tx_queues; n++) {
+               tx_ring = adapter->tx_ring[n];
+               printk(KERN_INFO "------------------------------------\n");
+               printk(KERN_INFO "TX QUEUE INDEX = %d\n", tx_ring->queue_index);
+               printk(KERN_INFO "------------------------------------\n");
+               printk(KERN_INFO "T [desc]     [address 63:0  ] "
+                       "[PlPOIdStDDt Ln] [bi->dma       ] "
+                       "leng  ntw timestamp        bi->skb\n");
+
+               for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) {
+                       tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, i);
+                       tx_buffer_info = &tx_ring->tx_buffer_info[i];
+                       u0 = (struct my_u0 *)tx_desc;
+                       printk(KERN_INFO "T [0x%03X]    %016llX %016llX %016llX"
+                               " %04X  %3X %016llX %p", i,
+                               le64_to_cpu(u0->a),
+                               le64_to_cpu(u0->b),
+                               (u64)tx_buffer_info->dma,
+                               tx_buffer_info->length,
+                               tx_buffer_info->next_to_watch,
+                               (u64)tx_buffer_info->time_stamp,
+                               tx_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) &&
+                               tx_buffer_info->dma != 0)
+                               print_hex_dump(KERN_INFO, "",
+                                       DUMP_PREFIX_ADDRESS, 16, 1,
+                                       phys_to_virt(tx_buffer_info->dma),
+                                       tx_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");
+       for (n = 0; n < adapter->num_rx_queues; n++) {
+               rx_ring = adapter->rx_ring[n];
+               printk(KERN_INFO "%5d %5X %5X\n", n,
+                          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");
+
+       /* Advanced Receive Descriptor (Read) Format
+        *    63                                           1        0
+        *    +-----------------------------------------------------+
+        *  0 |       Packet Buffer Address [63:1]           |A0/NSE|
+        *    +----------------------------------------------+------+
+        *  8 |       Header Buffer Address [63:1]           |  DD  |
+        *    +-----------------------------------------------------+
+        *
+        *
+        * Advanced Receive Descriptor (Write-Back) Format
+        *
+        *   63       48 47    32 31  30      21 20 16 15   4 3     0
+        *   +------------------------------------------------------+
+        * 0 | Packet     IP     |SPH| HDR_LEN   | RSV|Packet|  RSS |
+        *   | Checksum   Ident  |   |           |    | Type | Type |
+        *   +------------------------------------------------------+
+        * 8 | VLAN Tag | Length | Extended Error | Extended Status |
+        *   +------------------------------------------------------+
+        *   63       48 47    32 31            20 19               0
+        */
+       for (n = 0; n < adapter->num_rx_queues; n++) {
+               rx_ring = adapter->rx_ring[n];
+               printk(KERN_INFO "------------------------------------\n");
+               printk(KERN_INFO "RX QUEUE INDEX = %d\n", rx_ring->queue_index);
+               printk(KERN_INFO "------------------------------------\n");
+               printk(KERN_INFO "R  [desc]      [ PktBuf     A0] "
+                       "[  HeadBuf   DD] [bi->dma       ] [bi->skb] "
+                       "<-- Adv Rx Read format\n");
+               printk(KERN_INFO "RWB[desc]      [PcsmIpSHl PtRs] "
+                       "[vl er S cks ln] ---------------- [bi->skb] "
+                       "<-- Adv Rx Write-Back format\n");
+
+               for (i = 0; i < rx_ring->count; i++) {
+                       rx_buffer_info = &rx_ring->rx_buffer_info[i];
+                       rx_desc = IXGBE_RX_DESC_ADV(*rx_ring, i);
+                       u0 = (struct my_u0 *)rx_desc;
+                       staterr = le32_to_cpu(rx_desc->wb.upper.status_error);
+                       if (staterr & IXGBE_RXD_STAT_DD) {
+                               /* Descriptor Done */
+                               printk(KERN_INFO "RWB[0x%03X]     %016llX "
+                                       "%016llX ---------------- %p", i,
+                                       le64_to_cpu(u0->a),
+                                       le64_to_cpu(u0->b),
+                                       rx_buffer_info->skb);
+                       } else {
+                               printk(KERN_INFO "R  [0x%03X]     %016llX "
+                                       "%016llX %016llX %p", i,
+                                       le64_to_cpu(u0->a),
+                                       le64_to_cpu(u0->b),
+                                       (u64)rx_buffer_info->dma,
+                                       rx_buffer_info->skb);
+
+                               if (netif_msg_pktdata(adapter)) {
+                                       print_hex_dump(KERN_INFO, "",
+                                          DUMP_PREFIX_ADDRESS, 16, 1,
+                                          phys_to_virt(rx_buffer_info->dma),
+                                          rx_ring->rx_buf_len, true);
+
+                                       if (rx_ring->rx_buf_len
+                                               < IXGBE_RXBUFFER_2048)
+                                               print_hex_dump(KERN_INFO, "",
+                                                 DUMP_PREFIX_ADDRESS, 16, 1,
+                                                 phys_to_virt(
+                                                   rx_buffer_info->page_dma +
+                                                   rx_buffer_info->page_offset
+                                                 ),
+                                                 PAGE_SIZE/2, 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");
+
+               }
+       }
+
+exit:
+       return;
+}
+
 static void ixgbe_release_hw_control(struct ixgbe_adapter *adapter)
 {
        u32 ctrl_ext;
@@ -266,15 +607,15 @@ static void ixgbe_unmap_and_free_tx_resource(struct ixgbe_adapter *adapter,
 {
        if (tx_buffer_info->dma) {
                if (tx_buffer_info->mapped_as_page)
-                       pci_unmap_page(adapter->pdev,
+                       dma_unmap_page(&adapter->pdev->dev,
                                       tx_buffer_info->dma,
                                       tx_buffer_info->length,
-                                      PCI_DMA_TODEVICE);
+                                      DMA_TO_DEVICE);
                else
-                       pci_unmap_single(adapter->pdev,
+                       dma_unmap_single(&adapter->pdev->dev,
                                         tx_buffer_info->dma,
                                         tx_buffer_info->length,
-                                        PCI_DMA_TODEVICE);
+                                        DMA_TO_DEVICE);
                tx_buffer_info->dma = 0;
        }
        if (tx_buffer_info->skb) {
@@ -286,22 +627,22 @@ static void ixgbe_unmap_and_free_tx_resource(struct ixgbe_adapter *adapter,
 }
 
 /**
- * ixgbe_tx_is_paused - check if the tx ring is paused
+ * ixgbe_tx_xon_state - check the tx ring xon state
  * @adapter: the ixgbe adapter
  * @tx_ring: the corresponding tx_ring
  *
  * If not in DCB mode, checks TFCS.TXOFF, otherwise, find out the
  * corresponding TC of this tx_ring when checking TFCS.
  *
- * Returns : true if paused
+ * Returns : true if in xon state (currently not paused)
  */
-static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter,
+static inline bool ixgbe_tx_xon_state(struct ixgbe_adapter *adapter,
                                       struct ixgbe_ring *tx_ring)
 {
        u32 txoff = IXGBE_TFCS_TXOFF;
 
 #ifdef CONFIG_IXGBE_DCB
-       if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
+       if (adapter->dcb_cfg.pfc_mode_enable) {
                int tc;
                int reg_idx = tx_ring->reg_idx;
                int dcb_i = adapter->ring_feature[RING_F_DCB].indices;
@@ -351,23 +692,23 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter,
        adapter->detect_tx_hung = false;
        if (tx_ring->tx_buffer_info[eop].time_stamp &&
            time_after(jiffies, tx_ring->tx_buffer_info[eop].time_stamp + HZ) &&
-           !ixgbe_tx_is_paused(adapter, tx_ring)) {
+           ixgbe_tx_xon_state(adapter, tx_ring)) {
                /* detected Tx unit hang */
                union ixgbe_adv_tx_desc *tx_desc;
                tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop);
-               DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n"
-                       "  Tx Queue             <%d>\n"
-                       "  TDH, TDT             <%x>, <%x>\n"
-                       "  next_to_use          <%x>\n"
-                       "  next_to_clean        <%x>\n"
-                       "tx_buffer_info[next_to_clean]\n"
-                       "  time_stamp           <%lx>\n"
-                       "  jiffies              <%lx>\n",
-                       tx_ring->queue_index,
-                       IXGBE_READ_REG(hw, tx_ring->head),
-                       IXGBE_READ_REG(hw, tx_ring->tail),
-                       tx_ring->next_to_use, eop,
-                       tx_ring->tx_buffer_info[eop].time_stamp, jiffies);
+               e_err(drv, "Detected Tx Unit Hang\n"
+                     "  Tx Queue             <%d>\n"
+                     "  TDH, TDT             <%x>, <%x>\n"
+                     "  next_to_use          <%x>\n"
+                     "  next_to_clean        <%x>\n"
+                     "tx_buffer_info[next_to_clean]\n"
+                     "  time_stamp           <%lx>\n"
+                     "  jiffies              <%lx>\n",
+                     tx_ring->queue_index,
+                     IXGBE_READ_REG(hw, tx_ring->head),
+                     IXGBE_READ_REG(hw, tx_ring->tail),
+                     tx_ring->next_to_use, eop,
+                     tx_ring->tx_buffer_info[eop].time_stamp, jiffies);
                return true;
        }
 
@@ -471,9 +812,8 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
        if (adapter->detect_tx_hung) {
                if (ixgbe_check_tx_hang(adapter, tx_ring, i)) {
                        /* schedule immediate reset if we believe we hung */
-                       DPRINTK(PROBE, INFO,
-                               "tx hang %d detected, resetting adapter\n",
-                               adapter->tx_timeout_count + 1);
+                       e_info(probe, "tx hang %d detected, resetting "
+                              "adapter\n", adapter->tx_timeout_count + 1);
                        ixgbe_tx_timeout(adapter->netdev);
                }
        }
@@ -721,10 +1061,10 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter,
                                bi->page_offset ^= (PAGE_SIZE / 2);
                        }
 
-                       bi->page_dma = pci_map_page(pdev, bi->page,
+                       bi->page_dma = dma_map_page(&pdev->dev, bi->page,
                                                    bi->page_offset,
                                                    (PAGE_SIZE / 2),
-                                                   PCI_DMA_FROMDEVICE);
+                                                   DMA_FROM_DEVICE);
                }
 
                if (!bi->skb) {
@@ -743,9 +1083,9 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter,
                                          - skb->data));
 
                        bi->skb = skb;
-                       bi->dma = pci_map_single(pdev, skb->data,
+                       bi->dma = dma_map_single(&pdev->dev, skb->data,
                                                 rx_ring->rx_buf_len,
-                                                PCI_DMA_FROMDEVICE);
+                                                DMA_FROM_DEVICE);
                }
                /* Refresh the desc even if buffer_addrs didn't change because
                 * each write-back erases this info. */
@@ -821,6 +1161,7 @@ static inline struct sk_buff *ixgbe_transform_rsc_queue(struct sk_buff *skb,
 
 struct ixgbe_rsc_cb {
        dma_addr_t dma;
+       bool delay_unmap;
 };
 
 #define IXGBE_RSC_CB(skb) ((struct ixgbe_rsc_cb *)(skb)->cb)
@@ -861,9 +1202,10 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
                        hdr_info = le16_to_cpu(ixgbe_get_hdr_info(rx_desc));
                        len = (hdr_info & IXGBE_RXDADV_HDRBUFLEN_MASK) >>
                               IXGBE_RXDADV_HDRBUFLEN_SHIFT;
-                       if (len > IXGBE_RX_HDR_SIZE)
-                               len = IXGBE_RX_HDR_SIZE;
                        upper_len = le16_to_cpu(rx_desc->wb.upper.length);
+                       if ((len > IXGBE_RX_HDR_SIZE) ||
+                           (upper_len && !(hdr_info & IXGBE_RXDADV_SPH)))
+                               len = IXGBE_RX_HDR_SIZE;
                } else {
                        len = le16_to_cpu(rx_desc->wb.upper.length);
                }
@@ -876,7 +1218,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
                if (rx_buffer_info->dma) {
                        if ((adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) &&
                            (!(staterr & IXGBE_RXD_STAT_EOP)) &&
-                                (!(skb->prev)))
+                                (!(skb->prev))) {
                                /*
                                 * When HWRSC is enabled, delay unmapping
                                 * of the first packet. It carries the
@@ -884,18 +1226,21 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
                                 * access the header after the writeback.
                                 * Only unmap it when EOP is reached
                                 */
+                               IXGBE_RSC_CB(skb)->delay_unmap = true;
                                IXGBE_RSC_CB(skb)->dma = rx_buffer_info->dma;
-                       else
-                               pci_unmap_single(pdev, rx_buffer_info->dma,
+                       } else {
+                               dma_unmap_single(&pdev->dev,
+                                                rx_buffer_info->dma,
                                                 rx_ring->rx_buf_len,
-                                                PCI_DMA_FROMDEVICE);
+                                                DMA_FROM_DEVICE);
+                       }
                        rx_buffer_info->dma = 0;
                        skb_put(skb, len);
                }
 
                if (upper_len) {
-                       pci_unmap_page(pdev, rx_buffer_info->page_dma,
-                                      PAGE_SIZE / 2, PCI_DMA_FROMDEVICE);
+                       dma_unmap_page(&pdev->dev, rx_buffer_info->page_dma,
+                                      PAGE_SIZE / 2, DMA_FROM_DEVICE);
                        rx_buffer_info->page_dma = 0;
                        skb_fill_page_desc(skb, skb_shinfo(skb)->nr_frags,
                                           rx_buffer_info->page,
@@ -936,11 +1281,13 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
                        if (skb->prev)
                                skb = ixgbe_transform_rsc_queue(skb, &(rx_ring->rsc_count));
                        if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
-                               if (IXGBE_RSC_CB(skb)->dma) {
-                                       pci_unmap_single(pdev, IXGBE_RSC_CB(skb)->dma,
+                               if (IXGBE_RSC_CB(skb)->delay_unmap) {
+                                       dma_unmap_single(&pdev->dev,
+                                                        IXGBE_RSC_CB(skb)->dma,
                                                         rx_ring->rx_buf_len,
-                                                        PCI_DMA_FROMDEVICE);
+                                                        DMA_FROM_DEVICE);
                                        IXGBE_RSC_CB(skb)->dma = 0;
+                                       IXGBE_RSC_CB(skb)->delay_unmap = false;
                                }
                                if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED)
                                        rx_ring->rsc_count += skb_shinfo(skb)->nr_frags;
@@ -1189,6 +1536,15 @@ void ixgbe_write_eitr(struct ixgbe_q_vector *q_vector)
                /* must write high and low 16 bits to reset counter */
                itr_reg |= (itr_reg << 16);
        } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
+               /*
+                * 82599 can support a value of zero, so allow it for
+                * max interrupt rate, but there is an errata where it can
+                * not be zero with RSC
+                */
+               if (itr_reg == 8 &&
+                   !(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))
+                       itr_reg = 0;
+
                /*
                 * set the WDIS bit to not clear the timer bits and cause an
                 * immediate assertion of the interrupt
@@ -1261,8 +1617,48 @@ static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector)
 
                ixgbe_write_eitr(q_vector);
        }
+}
 
-       return;
+/**
+ * ixgbe_check_overtemp_task - worker thread to check over tempurature
+ * @work: pointer to work_struct containing our data
+ **/
+static void ixgbe_check_overtemp_task(struct work_struct *work)
+{
+       struct ixgbe_adapter *adapter = container_of(work,
+                                                    struct ixgbe_adapter,
+                                                    check_overtemp_task);
+       struct ixgbe_hw *hw = &adapter->hw;
+       u32 eicr = adapter->interrupt_event;
+
+       if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) {
+               switch (hw->device_id) {
+               case IXGBE_DEV_ID_82599_T3_LOM: {
+                       u32 autoneg;
+                       bool link_up = false;
+
+                       if (hw->mac.ops.check_link)
+                               hw->mac.ops.check_link(hw, &autoneg, &link_up, false);
+
+                       if (((eicr & IXGBE_EICR_GPI_SDP0) && (!link_up)) ||
+                           (eicr & IXGBE_EICR_LSC))
+                               /* Check if this is due to overtemp */
+                               if (hw->phy.ops.check_overtemp(hw) == IXGBE_ERR_OVERTEMP)
+                                       break;
+                       }
+                       return;
+               default:
+                       if (!(eicr & IXGBE_EICR_GPI_SDP0))
+                               return;
+                       break;
+               }
+               e_crit(drv, "Network adapter has been stopped because it has "
+                      "over heated. Restart the computer. If the problem "
+                      "persists, power off the system and replace the "
+                      "adapter\n");
+               /* write to clear the interrupt */
+               IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP0);
+       }
 }
 
 static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr)
@@ -1271,7 +1667,7 @@ static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr)
 
        if ((adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) &&
            (eicr & IXGBE_EICR_GPI_SDP1)) {
-               DPRINTK(PROBE, CRIT, "Fan has stopped, replace the adapter\n");
+               e_crit(probe, "Fan has stopped, replace the adapter\n");
                /* write to clear the interrupt */
                IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1);
        }
@@ -1336,6 +1732,10 @@ static irqreturn_t ixgbe_msix_lsc(int irq, void *data)
 
        if (hw->mac.type == ixgbe_mac_82599EB) {
                ixgbe_check_sfp_event(adapter, eicr);
+               adapter->interrupt_event = eicr;
+               if ((adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) &&
+                   ((eicr & IXGBE_EICR_GPI_SDP0) || (eicr & IXGBE_EICR_LSC)))
+                       schedule_work(&adapter->check_overtemp_task);
 
                /* Handle Flow Director Full threshold interrupt */
                if (eicr & IXGBE_EICR_FLOW_DIR) {
@@ -1753,9 +2153,8 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter)
                                  handler, 0, adapter->name[vector],
                                  adapter->q_vector[vector]);
                if (err) {
-                       DPRINTK(PROBE, ERR,
-                               "request_irq failed for MSIX interrupt "
-                               "Error: %d\n", err);
+                       e_err(probe, "request_irq failed for MSIX interrupt "
+                             "Error: %d\n", err);
                        goto free_queue_irqs;
                }
        }
@@ -1764,8 +2163,7 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter)
        err = request_irq(adapter->msix_entries[vector].vector,
                          ixgbe_msix_lsc, 0, adapter->name[vector], netdev);
        if (err) {
-               DPRINTK(PROBE, ERR,
-                       "request_irq for msix_lsc failed: %d\n", err);
+               e_err(probe, "request_irq for msix_lsc failed: %d\n", err);
                goto free_queue_irqs;
        }
 
@@ -1826,8 +2224,6 @@ static void ixgbe_set_itr(struct ixgbe_adapter *adapter)
 
                ixgbe_write_eitr(q_vector);
        }
-
-       return;
 }
 
 /**
@@ -1839,6 +2235,8 @@ static inline void ixgbe_irq_enable(struct ixgbe_adapter *adapter)
        u32 mask;
 
        mask = (IXGBE_EIMS_ENABLE_MASK & ~IXGBE_EIMS_RTX_QUEUE);
+       if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE)
+               mask |= IXGBE_EIMS_GPI_SDP0;
        if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE)
                mask |= IXGBE_EIMS_GPI_SDP1;
        if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
@@ -1899,6 +2297,9 @@ static irqreturn_t ixgbe_intr(int irq, void *data)
                ixgbe_check_sfp_event(adapter, eicr);
 
        ixgbe_check_fan_failure(adapter, eicr);
+       if ((adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) &&
+           ((eicr & IXGBE_EICR_GPI_SDP0) || (eicr & IXGBE_EICR_LSC)))
+               schedule_work(&adapter->check_overtemp_task);
 
        if (napi_schedule_prep(&(q_vector->napi))) {
                adapter->tx_ring[0]->total_packets = 0;
@@ -1948,7 +2349,7 @@ static int ixgbe_request_irq(struct ixgbe_adapter *adapter)
        }
 
        if (err)
-               DPRINTK(PROBE, ERR, "request_irq failed, Error %d\n", err);
+               e_err(probe, "request_irq failed, Error %d\n", err);
 
        return err;
 }
@@ -2019,7 +2420,7 @@ static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter)
        map_vector_to_rxq(adapter, 0, 0);
        map_vector_to_txq(adapter, 0, 0);
 
-       DPRINTK(HW, INFO, "Legacy interrupt IVAR setup done\n");
+       e_info(hw, "Legacy interrupt IVAR setup done\n");
 }
 
 /**
@@ -2372,7 +2773,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
                IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), (1 << vf_shift));
                IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), (1 << vf_shift));
                IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);
-               ixgbe_set_vmolr(hw, adapter->num_vfs);
+               ixgbe_set_vmolr(hw, adapter->num_vfs, true);
        }
 
        /* Program MRQC for the distribution of queues */
@@ -2399,10 +2800,8 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
                    /* Perform hash on these packet types */
                mrqc |= IXGBE_MRQC_RSS_FIELD_IPV4
                      | IXGBE_MRQC_RSS_FIELD_IPV4_TCP
-                     | IXGBE_MRQC_RSS_FIELD_IPV4_UDP
                      | IXGBE_MRQC_RSS_FIELD_IPV6
-                     | IXGBE_MRQC_RSS_FIELD_IPV6_TCP
-                     | IXGBE_MRQC_RSS_FIELD_IPV6_UDP;
+                     | IXGBE_MRQC_RSS_FIELD_IPV6_TCP;
        }
        IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc);
 
@@ -2482,12 +2881,82 @@ static void ixgbe_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
        hw->mac.ops.set_vfta(&adapter->hw, vid, pool_ndx, false);
 }
 
+/**
+ * ixgbe_vlan_filter_disable - helper to disable hw vlan filtering
+ * @adapter: driver data
+ */
+static void ixgbe_vlan_filter_disable(struct ixgbe_adapter *adapter)
+{
+       struct ixgbe_hw *hw = &adapter->hw;
+       u32 vlnctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
+       int i, j;
+
+       switch (hw->mac.type) {
+       case ixgbe_mac_82598EB:
+               vlnctrl &= ~IXGBE_VLNCTRL_VFE;
+#ifdef CONFIG_IXGBE_DCB
+               if (!(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
+                       vlnctrl &= ~IXGBE_VLNCTRL_VME;
+#endif
+               vlnctrl &= ~IXGBE_VLNCTRL_CFIEN;
+               IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
+               break;
+       case ixgbe_mac_82599EB:
+               vlnctrl &= ~IXGBE_VLNCTRL_VFE;
+               vlnctrl &= ~IXGBE_VLNCTRL_CFIEN;
+               IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
+#ifdef CONFIG_IXGBE_DCB
+               if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
+                       break;
+#endif
+               for (i = 0; i < adapter->num_rx_queues; i++) {
+                       j = adapter->rx_ring[i]->reg_idx;
+                       vlnctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(j));
+                       vlnctrl &= ~IXGBE_RXDCTL_VME;
+                       IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(j), vlnctrl);
+               }
+               break;
+       default:
+               break;
+       }
+}
+
+/**
+ * ixgbe_vlan_filter_enable - helper to enable hw vlan filtering
+ * @adapter: driver data
+ */
+static void ixgbe_vlan_filter_enable(struct ixgbe_adapter *adapter)
+{
+       struct ixgbe_hw *hw = &adapter->hw;
+       u32 vlnctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
+       int i, j;
+
+       switch (hw->mac.type) {
+       case ixgbe_mac_82598EB:
+               vlnctrl |= IXGBE_VLNCTRL_VME | IXGBE_VLNCTRL_VFE;
+               vlnctrl &= ~IXGBE_VLNCTRL_CFIEN;
+               IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
+               break;
+       case ixgbe_mac_82599EB:
+               vlnctrl |= IXGBE_VLNCTRL_VFE;
+               vlnctrl &= ~IXGBE_VLNCTRL_CFIEN;
+               IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
+               for (i = 0; i < adapter->num_rx_queues; i++) {
+                       j = adapter->rx_ring[i]->reg_idx;
+                       vlnctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(j));
+                       vlnctrl |= IXGBE_RXDCTL_VME;
+                       IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(j), vlnctrl);
+               }
+               break;
+       default:
+               break;
+       }
+}
+
 static void ixgbe_vlan_rx_register(struct net_device *netdev,
                                    struct vlan_group *grp)
 {
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
-       u32 ctrl;
-       int i, j;
 
        if (!test_bit(__IXGBE_DOWN, &adapter->state))
                ixgbe_irq_disable(adapter);
@@ -2498,25 +2967,7 @@ static void ixgbe_vlan_rx_register(struct net_device *netdev,
         * still receive traffic from a DCB-enabled host even if we're
         * not in DCB mode.
         */
-       ctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_VLNCTRL);
-
-       /* Disable CFI check */
-       ctrl &= ~IXGBE_VLNCTRL_CFIEN;
-
-       /* enable VLAN tag stripping */
-       if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
-               ctrl |= IXGBE_VLNCTRL_VME;
-       } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
-               for (i = 0; i < adapter->num_rx_queues; i++) {
-                       u32 ctrl;
-                       j = adapter->rx_ring[i]->reg_idx;
-                       ctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_RXDCTL(j));
-                       ctrl |= IXGBE_RXDCTL_VME;
-                       IXGBE_WRITE_REG(&adapter->hw, IXGBE_RXDCTL(j), ctrl);
-               }
-       }
-
-       IXGBE_WRITE_REG(&adapter->hw, IXGBE_VLNCTRL, ctrl);
+       ixgbe_vlan_filter_enable(adapter);
 
        ixgbe_vlan_rx_add_vid(netdev, 0);
 
@@ -2538,19 +2989,46 @@ static void ixgbe_restore_vlan(struct ixgbe_adapter *adapter)
        }
 }
 
-static u8 *ixgbe_addr_list_itr(struct ixgbe_hw *hw, u8 **mc_addr_ptr, u32 *vmdq)
+/**
+ * ixgbe_write_uc_addr_list - write unicast addresses to RAR table
+ * @netdev: network interface device structure
+ *
+ * Writes unicast address list to the RAR table.
+ * Returns: -ENOMEM on failure/insufficient address space
+ *                0 on no addresses written
+ *                X on writing X addresses to the RAR table
+ **/
+static int ixgbe_write_uc_addr_list(struct net_device *netdev)
 {
-       struct dev_mc_list *mc_ptr;
-       u8 *addr = *mc_addr_ptr;
-       *vmdq = 0;
+       struct ixgbe_adapter *adapter = netdev_priv(netdev);
+       struct ixgbe_hw *hw = &adapter->hw;
+       unsigned int vfn = adapter->num_vfs;
+       unsigned int rar_entries = hw->mac.num_rar_entries - (vfn + 1);
+       int count = 0;
 
-       mc_ptr = container_of(addr, struct dev_mc_list, dmi_addr[0]);
-       if (mc_ptr->next)
-               *mc_addr_ptr = mc_ptr->next->dmi_addr;
-       else
-               *mc_addr_ptr = NULL;
+       /* return ENOMEM indicating insufficient memory for addresses */
+       if (netdev_uc_count(netdev) > rar_entries)
+               return -ENOMEM;
+
+       if (!netdev_uc_empty(netdev) && rar_entries) {
+               struct netdev_hw_addr *ha;
+               /* return error if we do not support writing to RAR table */
+               if (!hw->mac.ops.set_rar)
+                       return -ENOMEM;
+
+               netdev_for_each_uc_addr(ha, netdev) {
+                       if (!rar_entries)
+                               break;
+                       hw->mac.ops.set_rar(hw, rar_entries--, ha->addr,
+                                           vfn, IXGBE_RAH_AV);
+                       count++;
+               }
+       }
+       /* write the addresses in reverse order to avoid write combining */
+       for (; rar_entries > 0 ; rar_entries--)
+               hw->mac.ops.clear_rar(hw, rar_entries);
 
-       return addr;
+       return count;
 }
 
 /**
@@ -2566,44 +3044,58 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
 {
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
        struct ixgbe_hw *hw = &adapter->hw;
-       u32 fctrl, vlnctrl;
-       u8 *addr_list = NULL;
-       int addr_count = 0;
+       u32 fctrl, vmolr = IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE;
+       int count;
 
        /* Check for Promiscuous and All Multicast modes */
 
        fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
-       vlnctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
+
+       /* clear the bits we are changing the status of */
+       fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
 
        if (netdev->flags & IFF_PROMISC) {
-               hw->addr_ctrl.user_set_promisc = 1;
+               hw->addr_ctrl.user_set_promisc = true;
                fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
-               vlnctrl &= ~IXGBE_VLNCTRL_VFE;
+               vmolr |= (IXGBE_VMOLR_ROPE | IXGBE_VMOLR_MPE);
+               /* don't hardware filter vlans in promisc mode */
+               ixgbe_vlan_filter_disable(adapter);
        } else {
                if (netdev->flags & IFF_ALLMULTI) {
                        fctrl |= IXGBE_FCTRL_MPE;
-                       fctrl &= ~IXGBE_FCTRL_UPE;
+                       vmolr |= IXGBE_VMOLR_MPE;
                } else {
-                       fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
+                       /*
+                        * Write addresses to the MTA, if the attempt fails
+                        * then we should just turn on promiscous mode so
+                        * that we can at least receive multicast traffic
+                        */
+                       hw->mac.ops.update_mc_addr_list(hw, netdev);
+                       vmolr |= IXGBE_VMOLR_ROMPE;
+               }
+               ixgbe_vlan_filter_enable(adapter);
+               hw->addr_ctrl.user_set_promisc = false;
+               /*
+                * Write addresses to available RAR registers, if there is not
+                * sufficient space to store all the addresses then enable
+                * unicast promiscous mode
+                */
+               count = ixgbe_write_uc_addr_list(netdev);
+               if (count < 0) {
+                       fctrl |= IXGBE_FCTRL_UPE;
+                       vmolr |= IXGBE_VMOLR_ROPE;
                }
-               vlnctrl |= IXGBE_VLNCTRL_VFE;
-               hw->addr_ctrl.user_set_promisc = 0;
        }
 
-       IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
-       IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
-
-       /* reprogram secondary unicast list */
-       hw->mac.ops.update_uc_addr_list(hw, netdev);
-
-       /* reprogram multicast list */
-       addr_count = netdev_mc_count(netdev);
-       if (addr_count)
-               addr_list = netdev->mc_list->dmi_addr;
-       hw->mac.ops.update_mc_addr_list(hw, addr_list, addr_count,
-                                       ixgbe_addr_list_itr);
-       if (adapter->num_vfs)
+       if (adapter->num_vfs) {
                ixgbe_restore_vf_multicasts(adapter);
+               vmolr |= IXGBE_READ_REG(hw, IXGBE_VMOLR(adapter->num_vfs)) &
+                        ~(IXGBE_VMOLR_MPE | IXGBE_VMOLR_ROMPE |
+                          IXGBE_VMOLR_ROPE);
+               IXGBE_WRITE_REG(hw, IXGBE_VMOLR(adapter->num_vfs), vmolr);
+       }
+
+       IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
 }
 
 static void ixgbe_napi_enable_all(struct ixgbe_adapter *adapter)
@@ -2661,7 +3153,7 @@ static void ixgbe_napi_disable_all(struct ixgbe_adapter *adapter)
 static void ixgbe_configure_dcb(struct ixgbe_adapter *adapter)
 {
        struct ixgbe_hw *hw = &adapter->hw;
-       u32 txdctl, vlnctrl;
+       u32 txdctl;
        int i, j;
 
        ixgbe_dcb_check_config(&adapter->dcb_cfg);
@@ -2679,22 +3171,8 @@ static void ixgbe_configure_dcb(struct ixgbe_adapter *adapter)
                IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(j), txdctl);
        }
        /* Enable VLAN tag insert/strip */
-       vlnctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
-       if (hw->mac.type == ixgbe_mac_82598EB) {
-               vlnctrl |= IXGBE_VLNCTRL_VME | IXGBE_VLNCTRL_VFE;
-               vlnctrl &= ~IXGBE_VLNCTRL_CFIEN;
-               IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
-       } else if (hw->mac.type == ixgbe_mac_82599EB) {
-               vlnctrl |= IXGBE_VLNCTRL_VFE;
-               vlnctrl &= ~IXGBE_VLNCTRL_CFIEN;
-               IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
-               for (i = 0; i < adapter->num_rx_queues; i++) {
-                       j = adapter->rx_ring[i]->reg_idx;
-                       vlnctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(j));
-                       vlnctrl |= IXGBE_RXDCTL_VME;
-                       IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(j), vlnctrl);
-               }
-       }
+       ixgbe_vlan_filter_enable(adapter);
+
        hw->mac.ops.set_vfta(&adapter->hw, 0, 0, true);
 }
 
@@ -2750,8 +3228,10 @@ static inline bool ixgbe_is_sfp(struct ixgbe_hw *hw)
        case ixgbe_phy_sfp_ftl:
        case ixgbe_phy_sfp_intel:
        case ixgbe_phy_sfp_unknown:
-       case ixgbe_phy_tw_tyco:
-       case ixgbe_phy_tw_unknown:
+       case ixgbe_phy_sfp_passive_tyco:
+       case ixgbe_phy_sfp_passive_unknown:
+       case ixgbe_phy_sfp_active_unknown:
+       case ixgbe_phy_sfp_ftl_active:
                return true;
        default:
                return false;
@@ -2834,8 +3314,8 @@ static inline void ixgbe_rx_desc_queue_enable(struct ixgbe_adapter *adapter,
                        msleep(1);
        }
        if (k >= IXGBE_MAX_RX_DESC_POLL) {
-               DPRINTK(DRV, ERR, "RXDCTL.ENABLE on Rx queue %d "
-                       "not set within the polling period\n", rxr);
+               e_err(drv, "RXDCTL.ENABLE on Rx queue %d not set within "
+                     "the polling period\n", rxr);
        }
        ixgbe_release_rx_desc(&adapter->hw, adapter->rx_ring[rxr],
                              (adapter->rx_ring[rxr]->count - 1));
@@ -2895,6 +3375,13 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
                IXGBE_WRITE_REG(hw, IXGBE_EIAM, IXGBE_EICS_RTX_QUEUE);
        }
 
+       /* Enable Thermal over heat sensor interrupt */
+       if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) {
+               gpie = IXGBE_READ_REG(hw, IXGBE_GPIE);
+               gpie |= IXGBE_SDP0_GPIEN;
+               IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
+       }
+
        /* Enable fan failure interrupt if media type is copper */
        if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) {
                gpie = IXGBE_READ_REG(hw, IXGBE_GPIE);
@@ -2927,8 +3414,13 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
        for (i = 0; i < adapter->num_tx_queues; i++) {
                j = adapter->tx_ring[i]->reg_idx;
                txdctl = IXGBE_READ_REG(hw, IXGBE_TXDCTL(j));
-               /* enable WTHRESH=8 descriptors, to encourage burst writeback */
-               txdctl |= (8 << 16);
+               if (adapter->rx_itr_setting == 0) {
+                       /* cannot set wthresh when itr==0 */
+                       txdctl &= ~0x007F0000;
+               } else {
+                       /* enable WTHRESH=8 descriptors, to encourage burst writeback */
+                       txdctl |= (8 << 16);
+               }
                IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(j), txdctl);
        }
 
@@ -2952,8 +3444,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
                        } while (--wait_loop &&
                                 !(txdctl & IXGBE_TXDCTL_ENABLE));
                        if (!wait_loop)
-                               DPRINTK(DRV, ERR, "Could not enable "
-                                       "Tx Queue %d\n", j);
+                               e_err(drv, "Could not enable Tx Queue %d\n", j);
                }
        }
 
@@ -3001,8 +3492,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
        if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) {
                u32 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP);
                if (esdp & IXGBE_ESDP_SDP1)
-                       DPRINTK(DRV, CRIT,
-                               "Fan has stopped, replace the adapter\n");
+                       e_crit(drv, "Fan has stopped, replace the adapter\n");
        }
 
        /*
@@ -3031,7 +3521,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
        } else {
                err = ixgbe_non_sfp_link_config(hw);
                if (err)
-                       DPRINTK(PROBE, ERR, "link_config FAILED %d\n", err);
+                       e_err(probe, "link_config FAILED %d\n", err);
        }
 
        for (i = 0; i < adapter->num_tx_queues; i++)
@@ -3092,19 +3582,19 @@ void ixgbe_reset(struct ixgbe_adapter *adapter)
        case IXGBE_ERR_SFP_NOT_PRESENT:
                break;
        case IXGBE_ERR_MASTER_REQUESTS_PENDING:
-               dev_err(&adapter->pdev->dev, "master disable timed out\n");
+               e_dev_err("master disable timed out\n");
                break;
        case IXGBE_ERR_EEPROM_VERSION:
                /* We are running on a pre-production device, log a warning */
-               dev_warn(&adapter->pdev->dev, "This device is a pre-production "
-                        "adapter/LOM.  Please be aware there may be issues "
-                        "associated with your hardware.  If you are "
-                        "experiencing problems please contact your Intel or "
-                        "hardware representative who provided you with this "
-                        "hardware.\n");
+               e_dev_warn("This device is a pre-production adapter/LOM. "
+                          "Please be aware there may be issuesassociated with "
+                          "your hardware.  If you are experiencing problems "
+                          "please contact your Intel or hardware "
+                          "representative who provided you with this "
+                          "hardware.\n");
                break;
        default:
-               dev_err(&adapter->pdev->dev, "Hardware Error: %d\n", err);
+               e_dev_err("Hardware Error: %d\n", err);
        }
 
        /* reprogram the RAR[0] in case user changed it. */
@@ -3131,9 +3621,9 @@ static void ixgbe_clean_rx_ring(struct ixgbe_adapter *adapter,
 
                rx_buffer_info = &rx_ring->rx_buffer_info[i];
                if (rx_buffer_info->dma) {
-                       pci_unmap_single(pdev, rx_buffer_info->dma,
+                       dma_unmap_single(&pdev->dev, rx_buffer_info->dma,
                                         rx_ring->rx_buf_len,
-                                        PCI_DMA_FROMDEVICE);
+                                        DMA_FROM_DEVICE);
                        rx_buffer_info->dma = 0;
                }
                if (rx_buffer_info->skb) {
@@ -3141,11 +3631,13 @@ static void ixgbe_clean_rx_ring(struct ixgbe_adapter *adapter,
                        rx_buffer_info->skb = NULL;
                        do {
                                struct sk_buff *this = skb;
-                               if (IXGBE_RSC_CB(this)->dma) {
-                                       pci_unmap_single(pdev, IXGBE_RSC_CB(this)->dma,
+                               if (IXGBE_RSC_CB(this)->delay_unmap) {
+                                       dma_unmap_single(&pdev->dev,
+                                                        IXGBE_RSC_CB(this)->dma,
                                                         rx_ring->rx_buf_len,
-                                                        PCI_DMA_FROMDEVICE);
+                                                        DMA_FROM_DEVICE);
                                        IXGBE_RSC_CB(this)->dma = 0;
+                                       IXGBE_RSC_CB(skb)->delay_unmap = false;
                                }
                                skb = skb->prev;
                                dev_kfree_skb(this);
@@ -3154,8 +3646,8 @@ static void ixgbe_clean_rx_ring(struct ixgbe_adapter *adapter,
                if (!rx_buffer_info->page)
                        continue;
                if (rx_buffer_info->page_dma) {
-                       pci_unmap_page(pdev, rx_buffer_info->page_dma,
-                                      PAGE_SIZE / 2, PCI_DMA_FROMDEVICE);
+                       dma_unmap_page(&pdev->dev, rx_buffer_info->page_dma,
+                                      PAGE_SIZE / 2, DMA_FROM_DEVICE);
                        rx_buffer_info->page_dma = 0;
                }
                put_page(rx_buffer_info->page);
@@ -3247,10 +3739,6 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
        /* signal that we are down to the interrupt handler */
        set_bit(__IXGBE_DOWN, &adapter->state);
 
-       /* power down the optics */
-       if (hw->phy.multispeed_fiber)
-               hw->mac.ops.disable_tx_laser(hw);
-
        /* disable receive for all VFs and wait one second */
        if (adapter->num_vfs) {
                /* ping all the active vfs to let them know we are going down */
@@ -3268,26 +3756,30 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
        rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL);
        IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, rxctrl & ~IXGBE_RXCTRL_RXEN);
 
-       netif_tx_disable(netdev);
-
        IXGBE_WRITE_FLUSH(hw);
        msleep(10);
 
        netif_tx_stop_all_queues(netdev);
 
-       ixgbe_irq_disable(adapter);
-
-       ixgbe_napi_disable_all(adapter);
-
        clear_bit(__IXGBE_SFP_MODULE_NOT_FOUND, &adapter->state);
        del_timer_sync(&adapter->sfp_timer);
        del_timer_sync(&adapter->watchdog_timer);
        cancel_work_sync(&adapter->watchdog_task);
 
+       netif_carrier_off(netdev);
+       netif_tx_disable(netdev);
+
+       ixgbe_irq_disable(adapter);
+
+       ixgbe_napi_disable_all(adapter);
+
        if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE ||
            adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)
                cancel_work_sync(&adapter->fdir_reinit_task);
 
+       if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE)
+               cancel_work_sync(&adapter->check_overtemp_task);
+
        /* disable transmits in the hardware now that interrupts are off */
        for (i = 0; i < adapter->num_tx_queues; i++) {
                j = adapter->tx_ring[i]->reg_idx;
@@ -3301,7 +3793,9 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
                                (IXGBE_READ_REG(hw, IXGBE_DMATXCTL) &
                                 ~IXGBE_DMATXCTL_TE));
 
-       netif_carrier_off(netdev);
+       /* power down the optics */
+       if (hw->phy.multispeed_fiber)
+               hw->mac.ops.disable_tx_laser(hw);
 
        /* clear n-tuple filters that are cached */
        ethtool_ntuple_flush(netdev);
@@ -3379,6 +3873,8 @@ static void ixgbe_reset_task(struct work_struct *work)
 
        adapter->tx_timeout_count++;
 
+       ixgbe_dump(adapter);
+       netdev_err(adapter->netdev, "Reset adapter\n");
        ixgbe_reinit_locked(adapter);
 }
 
@@ -3479,12 +3975,12 @@ static inline bool ixgbe_set_fcoe_queues(struct ixgbe_adapter *adapter)
                adapter->num_tx_queues = 1;
 #ifdef CONFIG_IXGBE_DCB
                if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
-                       DPRINTK(PROBE, INFO, "FCoE enabled with DCB \n");
+                       e_info(probe, "FCoE enabled with DCB\n");
                        ixgbe_set_dcb_queues(adapter);
                }
 #endif
                if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) {
-                       DPRINTK(PROBE, INFO, "FCoE enabled with RSS \n");
+                       e_info(probe, "FCoE enabled with RSS\n");
                        if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
                            (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
                                ixgbe_set_fdir_queues(adapter);
@@ -3560,7 +4056,7 @@ static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
 
 done:
        /* Notify the stack of the (possibly) reduced Tx Queue count. */
-       adapter->netdev->real_num_tx_queues = adapter->num_tx_queues;
+       netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues);
 }
 
 static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
@@ -3597,7 +4093,8 @@ static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
                 * This just means we'll go with either a single MSI
                 * vector or fall back to legacy interrupts.
                 */
-               DPRINTK(HW, DEBUG, "Unable to allocate MSI-X interrupts\n");
+               netif_printk(adapter, hw, KERN_DEBUG, adapter->netdev,
+                            "Unable to allocate MSI-X interrupts\n");
                adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED;
                kfree(adapter->msix_entries);
                adapter->msix_entries = NULL;
@@ -3994,8 +4491,9 @@ static int ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
        if (!err) {
                adapter->flags |= IXGBE_FLAG_MSI_ENABLED;
        } else {
-               DPRINTK(HW, DEBUG, "Unable to allocate MSI interrupt, "
-                       "falling back to legacy.  Error: %d\n", err);
+               netif_printk(adapter, hw, KERN_DEBUG, adapter->netdev,
+                            "Unable to allocate MSI interrupt, "
+                            "falling back to legacy.  Error: %d\n", err);
                /* reset err */
                err = 0;
        }
@@ -4095,7 +4593,6 @@ static void ixgbe_reset_interrupt_capability(struct ixgbe_adapter *adapter)
                adapter->flags &= ~IXGBE_FLAG_MSI_ENABLED;
                pci_disable_msi(adapter->pdev);
        }
-       return;
 }
 
 /**
@@ -4117,27 +4614,25 @@ int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter)
 
        err = ixgbe_set_interrupt_capability(adapter);
        if (err) {
-               DPRINTK(PROBE, ERR, "Unable to setup interrupt capabilities\n");
+               e_dev_err("Unable to setup interrupt capabilities\n");
                goto err_set_interrupt;
        }
 
        err = ixgbe_alloc_q_vectors(adapter);
        if (err) {
-               DPRINTK(PROBE, ERR, "Unable to allocate memory for queue "
-                       "vectors\n");
+               e_dev_err("Unable to allocate memory for queue vectors\n");
                goto err_alloc_q_vectors;
        }
 
        err = ixgbe_alloc_queues(adapter);
        if (err) {
-               DPRINTK(PROBE, ERR, "Unable to allocate memory for queues\n");
+               e_dev_err("Unable to allocate memory for queues\n");
                goto err_alloc_queues;
        }
 
-       DPRINTK(DRV, INFO, "Multiqueue %s: Rx Queue count = %u, "
-               "Tx Queue count = %u\n",
-               (adapter->num_rx_queues > 1) ? "Enabled" :
-               "Disabled", adapter->num_rx_queues, adapter->num_tx_queues);
+       e_dev_info("Multiqueue %s: Rx Queue count = %u, Tx Queue count = %u\n",
+                  (adapter->num_rx_queues > 1) ? "Enabled" : "Disabled",
+                  adapter->num_rx_queues, adapter->num_tx_queues);
 
        set_bit(__IXGBE_DOWN, &adapter->state);
 
@@ -4208,15 +4703,13 @@ static void ixgbe_sfp_task(struct work_struct *work)
                        goto reschedule;
                ret = hw->phy.ops.reset(hw);
                if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) {
-                       dev_err(&adapter->pdev->dev, "failed to initialize "
-                               "because an unsupported SFP+ module type "
-                               "was detected.\n"
-                               "Reload the driver after installing a "
-                               "supported module.\n");
+                       e_dev_err("failed to initialize because an unsupported "
+                                 "SFP+ module type was detected.\n");
+                       e_dev_err("Reload the driver after installing a "
+                                 "supported module.\n");
                        unregister_netdev(adapter->netdev);
                } else {
-                       DPRINTK(PROBE, INFO, "detected SFP+: %d\n",
-                               hw->phy.sfp_type);
+                       e_info(probe, "detected SFP+: %d\n", hw->phy.sfp_type);
                }
                /* don't need this routine any more */
                clear_bit(__IXGBE_SFP_MODULE_NOT_FOUND, &adapter->state);
@@ -4268,6 +4761,8 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
                adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599;
                adapter->flags2 |= IXGBE_FLAG2_RSC_CAPABLE;
                adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED;
+               if (hw->device_id == IXGBE_DEV_ID_82599_T3_LOM)
+                       adapter->flags2 |= IXGBE_FLAG2_TEMP_SENSOR_CAPABLE;
                if (dev->features & NETIF_F_NTUPLE) {
                        /* Flow Director perfect filter enabled */
                        adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
@@ -4341,7 +4836,7 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
 
        /* initialize eeprom parameters */
        if (ixgbe_init_eeprom_params_generic(hw)) {
-               dev_err(&pdev->dev, "EEPROM initialization failed\n");
+               e_dev_err("EEPROM initialization failed\n");
                return -EIO;
        }
 
@@ -4381,8 +4876,8 @@ int ixgbe_setup_tx_resources(struct ixgbe_adapter *adapter,
        tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc);
        tx_ring->size = ALIGN(tx_ring->size, 4096);
 
-       tx_ring->desc = pci_alloc_consistent(pdev, tx_ring->size,
-                                            &tx_ring->dma);
+       tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size,
+                                          &tx_ring->dma, GFP_KERNEL);
        if (!tx_ring->desc)
                goto err;
 
@@ -4394,8 +4889,7 @@ int ixgbe_setup_tx_resources(struct ixgbe_adapter *adapter,
 err:
        vfree(tx_ring->tx_buffer_info);
        tx_ring->tx_buffer_info = NULL;
-       DPRINTK(PROBE, ERR, "Unable to allocate memory for the transmit "
-                           "descriptor ring\n");
+       e_err(probe, "Unable to allocate memory for the Tx descriptor ring\n");
        return -ENOMEM;
 }
 
@@ -4417,7 +4911,7 @@ static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter)
                err = ixgbe_setup_tx_resources(adapter, adapter->tx_ring[i]);
                if (!err)
                        continue;
-               DPRINTK(PROBE, ERR, "Allocation for Tx Queue %u failed\n", i);
+               e_err(probe, "Allocation for Tx Queue %u failed\n", i);
                break;
        }
 
@@ -4442,8 +4936,8 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
        if (!rx_ring->rx_buffer_info)
                rx_ring->rx_buffer_info = vmalloc(size);
        if (!rx_ring->rx_buffer_info) {
-               DPRINTK(PROBE, ERR,
-                       "vmalloc allocation failed for the rx desc ring\n");
+               e_err(probe, "vmalloc allocation failed for the Rx "
+                     "descriptor ring\n");
                goto alloc_failed;
        }
        memset(rx_ring->rx_buffer_info, 0, size);
@@ -4452,11 +4946,12 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
        rx_ring->size = rx_ring->count * sizeof(union ixgbe_adv_rx_desc);
        rx_ring->size = ALIGN(rx_ring->size, 4096);
 
-       rx_ring->desc = pci_alloc_consistent(pdev, rx_ring->size, &rx_ring->dma);
+       rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size,
+                                          &rx_ring->dma, GFP_KERNEL);
 
        if (!rx_ring->desc) {
-               DPRINTK(PROBE, ERR,
-                       "Memory allocation failed for the rx desc ring\n");
+               e_err(probe, "Memory allocation failed for the Rx "
+                     "descriptor ring\n");
                vfree(rx_ring->rx_buffer_info);
                goto alloc_failed;
        }
@@ -4489,7 +4984,7 @@ static int ixgbe_setup_all_rx_resources(struct ixgbe_adapter *adapter)
                err = ixgbe_setup_rx_resources(adapter, adapter->rx_ring[i]);
                if (!err)
                        continue;
-               DPRINTK(PROBE, ERR, "Allocation for Rx Queue %u failed\n", i);
+               e_err(probe, "Allocation for Rx Queue %u failed\n", i);
                break;
        }
 
@@ -4513,7 +5008,8 @@ void ixgbe_free_tx_resources(struct ixgbe_adapter *adapter,
        vfree(tx_ring->tx_buffer_info);
        tx_ring->tx_buffer_info = NULL;
 
-       pci_free_consistent(pdev, tx_ring->size, tx_ring->desc, tx_ring->dma);
+       dma_free_coherent(&pdev->dev, tx_ring->size, tx_ring->desc,
+                         tx_ring->dma);
 
        tx_ring->desc = NULL;
 }
@@ -4550,7 +5046,8 @@ void ixgbe_free_rx_resources(struct ixgbe_adapter *adapter,
        vfree(rx_ring->rx_buffer_info);
        rx_ring->rx_buffer_info = NULL;
 
-       pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma);
+       dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc,
+                         rx_ring->dma);
 
        rx_ring->desc = NULL;
 }
@@ -4586,8 +5083,7 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
        if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE))
                return -EINVAL;
 
-       DPRINTK(PROBE, INFO, "changing MTU from %d to %d\n",
-               netdev->mtu, new_mtu);
+       e_info(probe, "changing MTU from %d to %d\n", netdev->mtu, new_mtu);
        /* must set new MTU before calling down or up */
        netdev->mtu = new_mtu;
 
@@ -4700,8 +5196,7 @@ static int ixgbe_resume(struct pci_dev *pdev)
 
        err = pci_enable_device_mem(pdev);
        if (err) {
-               printk(KERN_ERR "ixgbe: Cannot enable PCI device from "
-                               "suspend\n");
+               e_dev_err("Cannot enable PCI device from suspend\n");
                return err;
        }
        pci_set_master(pdev);
@@ -4710,8 +5205,7 @@ static int ixgbe_resume(struct pci_dev *pdev)
 
        err = ixgbe_init_interrupt_scheme(adapter);
        if (err) {
-               printk(KERN_ERR "ixgbe: Cannot initialize interrupts for "
-                               "device\n");
+               e_dev_err("Cannot initialize interrupts for device\n");
                return err;
        }
 
@@ -4750,7 +5244,6 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
                ixgbe_free_all_tx_resources(adapter);
                ixgbe_free_all_rx_resources(adapter);
        }
-       ixgbe_clear_interrupt_scheme(adapter);
 
 #ifdef CONFIG_PM
        retval = pci_save_state(pdev);
@@ -4785,6 +5278,8 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
 
        *enable_wake = !!wufc;
 
+       ixgbe_clear_interrupt_scheme(adapter);
+
        ixgbe_release_hw_control(adapter);
 
        pci_disable_device(pdev);
@@ -4837,6 +5332,10 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter)
        u32 i, missed_rx = 0, mpc, bprc, lxon, lxoff, xon_off_tot;
        u64 non_eop_descs = 0, restart_queue = 0;
 
+       if (test_bit(__IXGBE_DOWN, &adapter->state) ||
+           test_bit(__IXGBE_RESETTING, &adapter->state))
+               return;
+
        if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
                u64 rsc_count = 0;
                u64 rsc_flush = 0;
@@ -5067,10 +5566,10 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work)
        err = hw->phy.ops.identify_sfp(hw);
 
        if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
-               dev_err(&adapter->pdev->dev, "failed to initialize because "
-                       "an unsupported SFP+ module type was detected.\n"
-                       "Reload the driver after installing a supported "
-                       "module.\n");
+               e_dev_err("failed to initialize because an unsupported SFP+ "
+                         "module type was detected.\n");
+               e_dev_err("Reload the driver after installing a supported "
+                         "module.\n");
                unregister_netdev(adapter->netdev);
                return;
        }
@@ -5099,8 +5598,8 @@ static void ixgbe_fdir_reinit_task(struct work_struct *work)
                        set_bit(__IXGBE_FDIR_INIT_DONE,
                                &(adapter->tx_ring[i]->reinit_state));
        } else {
-               DPRINTK(PROBE, ERR, "failed to finish FDIR re-initialization, "
-                       "ignored adding FDIR ATR filters \n");
+               e_err(probe, "failed to finish FDIR re-initialization, "
+                     "ignored adding FDIR ATR filters\n");
        }
        /* Done FDIR Re-initialization, enable transmits */
        netif_tx_start_all_queues(adapter->netdev);
@@ -5171,16 +5670,14 @@ static void ixgbe_watchdog_task(struct work_struct *work)
                                flow_tx = !!(rmcs & IXGBE_RMCS_TFCE_802_3X);
                        }
 
-                       printk(KERN_INFO "ixgbe: %s NIC Link is Up %s, "
-                              "Flow Control: %s\n",
-                              netdev->name,
+                       e_info(drv, "NIC Link is Up %s, Flow Control: %s\n",
                               (link_speed == IXGBE_LINK_SPEED_10GB_FULL ?
-                               "10 Gbps" :
-                               (link_speed == IXGBE_LINK_SPEED_1GB_FULL ?
-                                "1 Gbps" : "unknown speed")),
+                              "10 Gbps" :
+                              (link_speed == IXGBE_LINK_SPEED_1GB_FULL ?
+                              "1 Gbps" : "unknown speed")),
                               ((flow_rx && flow_tx) ? "RX/TX" :
-                               (flow_rx ? "RX" :
-                               (flow_tx ? "TX" : "None"))));
+                              (flow_rx ? "RX" :
+                              (flow_tx ? "TX" : "None"))));
 
                        netif_carrier_on(netdev);
                } else {
@@ -5191,8 +5688,7 @@ static void ixgbe_watchdog_task(struct work_struct *work)
                adapter->link_up = false;
                adapter->link_speed = 0;
                if (netif_carrier_ok(netdev)) {
-                       printk(KERN_INFO "ixgbe: %s NIC Link is Down\n",
-                              netdev->name);
+                       e_info(drv, "NIC Link is Down\n");
                        netif_carrier_off(netdev);
                }
        }
@@ -5368,9 +5864,9 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter,
                                break;
                        default:
                                if (unlikely(net_ratelimit())) {
-                                       DPRINTK(PROBE, WARNING,
-                                        "partial checksum but proto=%x!\n",
-                                        skb->protocol);
+                                       e_warn(probe, "partial checksum "
+                                              "but proto=%x!\n",
+                                              skb->protocol);
                                }
                                break;
                        }
@@ -5420,10 +5916,10 @@ static int ixgbe_tx_map(struct ixgbe_adapter *adapter,
 
                tx_buffer_info->length = size;
                tx_buffer_info->mapped_as_page = false;
-               tx_buffer_info->dma = pci_map_single(pdev,
+               tx_buffer_info->dma = dma_map_single(&pdev->dev,
                                                     skb->data + offset,
-                                                    size, PCI_DMA_TODEVICE);
-               if (pci_dma_mapping_error(pdev, tx_buffer_info->dma))
+                                                    size, DMA_TO_DEVICE);
+               if (dma_mapping_error(&pdev->dev, tx_buffer_info->dma))
                        goto dma_error;
                tx_buffer_info->time_stamp = jiffies;
                tx_buffer_info->next_to_watch = i;
@@ -5456,12 +5952,12 @@ static int ixgbe_tx_map(struct ixgbe_adapter *adapter,
                        size = min(len, (uint)IXGBE_MAX_DATA_PER_TXD);
 
                        tx_buffer_info->length = size;
-                       tx_buffer_info->dma = pci_map_page(adapter->pdev,
+                       tx_buffer_info->dma = dma_map_page(&adapter->pdev->dev,
                                                           frag->page,
                                                           offset, size,
-                                                          PCI_DMA_TODEVICE);
+                                                          DMA_TO_DEVICE);
                        tx_buffer_info->mapped_as_page = true;
-                       if (pci_dma_mapping_error(pdev, tx_buffer_info->dma))
+                       if (dma_mapping_error(&pdev->dev, tx_buffer_info->dma))
                                goto dma_error;
                        tx_buffer_info->time_stamp = jiffies;
                        tx_buffer_info->next_to_watch = i;
@@ -5481,7 +5977,7 @@ static int ixgbe_tx_map(struct ixgbe_adapter *adapter,
        return count;
 
 dma_error:
-       dev_err(&pdev->dev, "TX DMA map failed\n");
+       e_dev_err("TX DMA map failed\n");
 
        /* clear timestamp and dma mappings for failed tx_buffer_info map */
        tx_buffer_info->dma = 0;
@@ -5574,7 +6070,6 @@ static void ixgbe_tx_queue(struct ixgbe_adapter *adapter,
 static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb,
                      int queue, u32 tx_flags)
 {
-       /* Right now, we support IPv4 only */
        struct ixgbe_atr_input atr_input;
        struct tcphdr *th;
        struct iphdr *iph = ip_hdr(skb);
@@ -5583,6 +6078,9 @@ static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb,
        u32 src_ipv4_addr, dst_ipv4_addr;
        u8 l4type = 0;
 
+       /* Right now, we support IPv4 only */
+       if (skb->protocol != htons(ETH_P_IP))
+               return;
        /* check if we're UDP or TCP */
        if (iph->protocol == IPPROTO_TCP) {
                th = tcp_hdr(skb);
@@ -5697,7 +6195,8 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb,
                }
                tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT;
                tx_flags |= IXGBE_TX_FLAGS_VLAN;
-       } else if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
+       } else if (adapter->flags & IXGBE_FLAG_DCB_ENABLED &&
+                  skb->priority != TC_PRIO_CONTROL) {
                tx_flags |= ((skb->queue_mapping & 0x7) << 13);
                tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT;
                tx_flags |= IXGBE_TX_FLAGS_VLAN;
@@ -5942,6 +6441,10 @@ static const struct net_device_ops ixgbe_netdev_ops = {
        .ndo_vlan_rx_add_vid    = ixgbe_vlan_rx_add_vid,
        .ndo_vlan_rx_kill_vid   = ixgbe_vlan_rx_kill_vid,
        .ndo_do_ioctl           = ixgbe_ioctl,
+       .ndo_set_vf_mac         = ixgbe_ndo_set_vf_mac,
+       .ndo_set_vf_vlan        = ixgbe_ndo_set_vf_vlan,
+       .ndo_set_vf_tx_rate     = ixgbe_ndo_set_vf_bw,
+       .ndo_get_vf_config      = ixgbe_ndo_get_vf_config,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller    = ixgbe_netpoll,
 #endif
@@ -5973,8 +6476,7 @@ static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter,
        adapter->flags |= IXGBE_FLAG_SRIOV_ENABLED;
        err = pci_enable_sriov(adapter->pdev, adapter->num_vfs);
        if (err) {
-               DPRINTK(PROBE, ERR,
-                       "Failed to enable PCI sriov: %d\n", err);
+               e_err(probe, "Failed to enable PCI sriov: %d\n", err);
                goto err_novfs;
        }
        /* If call to enable VFs succeeded then allocate memory
@@ -5998,9 +6500,8 @@ static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter,
        }
 
        /* Oh oh */
-       DPRINTK(PROBE, ERR,
-               "Unable to allocate memory for VF "
-               "Data Storage - SRIOV disabled\n");
+       e_err(probe, "Unable to allocate memory for VF Data Storage - "
+             "SRIOV disabled\n");
        pci_disable_sriov(adapter->pdev);
 
 err_novfs:
@@ -6039,16 +6540,17 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        if (err)
                return err;
 
-       if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
-           !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
+       if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) &&
+           !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
                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");
+                               e_dev_err("No usable DMA configuration, "
+                                         "aborting\n");
                                goto err_dma;
                        }
                }
@@ -6058,8 +6560,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        err = pci_request_selected_regions(pdev, pci_select_bars(pdev,
                                           IORESOURCE_MEM), ixgbe_driver_name);
        if (err) {
-               dev_err(&pdev->dev,
-                       "pci_request_selected_regions failed 0x%x\n", err);
+               e_dev_err("pci_request_selected_regions failed 0x%x\n", err);
                goto err_pci_reg;
        }
 
@@ -6170,12 +6671,13 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) {
                u32 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP);
                if (esdp & IXGBE_ESDP_SDP1)
-                       DPRINTK(PROBE, CRIT,
-                               "Fan has stopped, replace the adapter\n");
+                       e_crit(probe, "Fan has stopped, replace the adapter\n");
        }
 
        /* reset_hw fills in the perm_addr as well */
+       hw->phy.reset_if_overtemp = true;
        err = hw->mac.ops.reset_hw(hw);
+       hw->phy.reset_if_overtemp = false;
        if (err == IXGBE_ERR_SFP_NOT_PRESENT &&
            hw->mac.type == ixgbe_mac_82598EB) {
                /*
@@ -6188,13 +6690,13 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
                          round_jiffies(jiffies + (2 * HZ)));
                err = 0;
        } else if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
-               dev_err(&adapter->pdev->dev, "failed to initialize because "
-                       "an unsupported SFP+ module type was detected.\n"
-                       "Reload the driver after installing a supported "
-                       "module.\n");
+               e_dev_err("failed to initialize because an unsupported SFP+ "
+                         "module type was detected.\n");
+               e_dev_err("Reload the driver after installing a supported "
+                         "module.\n");
                goto err_sw_init;
        } else if (err) {
-               dev_err(&adapter->pdev->dev, "HW Init failed: %d\n", err);
+               e_dev_err("HW Init failed: %d\n", err);
                goto err_sw_init;
        }
 
@@ -6247,7 +6749,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
 
        /* make sure the EEPROM is good */
        if (hw->eeprom.ops.validate_checksum(hw, NULL) < 0) {
-               dev_err(&pdev->dev, "The EEPROM Checksum Is Not Valid\n");
+               e_dev_err("The EEPROM Checksum Is Not Valid\n");
                err = -EIO;
                goto err_eeprom;
        }
@@ -6256,7 +6758,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        memcpy(netdev->perm_addr, hw->mac.perm_addr, netdev->addr_len);
 
        if (ixgbe_validate_mac_addr(netdev->perm_addr)) {
-               dev_err(&pdev->dev, "invalid MAC address\n");
+               e_dev_err("invalid MAC address\n");
                err = -EIO;
                goto err_eeprom;
        }
@@ -6291,7 +6793,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        hw->mac.ops.get_bus_info(hw);
 
        /* print bus type/speed/width info */
-       dev_info(&pdev->dev, "(PCI Express:%s:%s) %pM\n",
+       e_dev_info("(PCI Express:%s:%s) %pM\n",
                ((hw->bus.speed == ixgbe_bus_speed_5000) ? "5.0Gb/s":
                 (hw->bus.speed == ixgbe_bus_speed_2500) ? "2.5Gb/s":"Unknown"),
                ((hw->bus.width == ixgbe_bus_width_pcie_x8) ? "Width x8" :
@@ -6301,20 +6803,20 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
                netdev->dev_addr);
        ixgbe_read_pba_num_generic(hw, &part_num);
        if (ixgbe_is_sfp(hw) && hw->phy.sfp_type != ixgbe_sfp_type_not_present)
-               dev_info(&pdev->dev, "MAC: %d, PHY: %d, SFP+: %d, PBA No: %06x-%03x\n",
-                        hw->mac.type, hw->phy.type, hw->phy.sfp_type,
-                        (part_num >> 8), (part_num & 0xff));
+               e_dev_info("MAC: %d, PHY: %d, SFP+: %d, "
+                          "PBA No: %06x-%03x\n",
+                          hw->mac.type, hw->phy.type, hw->phy.sfp_type,
+                          (part_num >> 8), (part_num & 0xff));
        else
-               dev_info(&pdev->dev, "MAC: %d, PHY: %d, PBA No: %06x-%03x\n",
-                        hw->mac.type, hw->phy.type,
-                        (part_num >> 8), (part_num & 0xff));
+               e_dev_info("MAC: %d, PHY: %d, PBA No: %06x-%03x\n",
+                          hw->mac.type, hw->phy.type,
+                          (part_num >> 8), (part_num & 0xff));
 
        if (hw->bus.width <= ixgbe_bus_width_pcie_x4) {
-               dev_warn(&pdev->dev, "PCI-Express bandwidth available for "
-                        "this card is not sufficient for optimal "
-                        "performance.\n");
-               dev_warn(&pdev->dev, "For optimal performance a x8 "
-                        "PCI-Express slot is required.\n");
+               e_dev_warn("PCI-Express bandwidth available for this card is "
+                          "not sufficient for optimal performance.\n");
+               e_dev_warn("For optimal performance a x8 PCI-Express slot "
+                          "is required.\n");
        }
 
        /* save off EEPROM version number */
@@ -6325,12 +6827,12 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
 
        if (err == IXGBE_ERR_EEPROM_VERSION) {
                /* We are running on a pre-production device, log a warning */
-               dev_warn(&pdev->dev, "This device is a pre-production "
-                        "adapter/LOM.  Please be aware there may be issues "
-                        "associated with your hardware.  If you are "
-                        "experiencing problems please contact your Intel or "
-                        "hardware representative who provided you with this "
-                        "hardware.\n");
+               e_dev_warn("This device is a pre-production adapter/LOM. "
+                          "Please be aware there may be issues associated "
+                          "with your hardware.  If you are experiencing "
+                          "problems please contact your Intel or hardware "
+                          "representative who provided you with this "
+                          "hardware.\n");
        }
        strcpy(netdev->name, "eth%d");
        err = register_netdev(netdev);
@@ -6344,6 +6846,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
            adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)
                INIT_WORK(&adapter->fdir_reinit_task, ixgbe_fdir_reinit_task);
 
+       if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE)
+               INIT_WORK(&adapter->check_overtemp_task, ixgbe_check_overtemp_task);
 #ifdef CONFIG_IXGBE_DCA
        if (dca_add_requester(&pdev->dev) == 0) {
                adapter->flags |= IXGBE_FLAG_DCA_ENABLED;
@@ -6351,8 +6855,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        }
 #endif
        if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
-               DPRINTK(PROBE, INFO, "IOV is enabled with %d VFs\n",
-                       adapter->num_vfs);
+               e_info(probe, "IOV is enabled with %d VFs\n", adapter->num_vfs);
                for (i = 0; i < adapter->num_vfs; i++)
                        ixgbe_vf_configuration(pdev, (i | 0x10000000));
        }
@@ -6360,7 +6863,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        /* add san mac addr to netdev */
        ixgbe_add_sanmac_netdev(netdev);
 
-       dev_info(&pdev->dev, "Intel(R) 10 Gigabit Network Connection\n");
+       e_dev_info("Intel(R) 10 Gigabit Network Connection\n");
        cards_found++;
        return 0;
 
@@ -6450,7 +6953,7 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev)
        pci_release_selected_regions(pdev, pci_select_bars(pdev,
                                     IORESOURCE_MEM));
 
-       DPRINTK(PROBE, INFO, "complete\n");
+       e_dev_info("complete\n");
 
        free_netdev(netdev);
 
@@ -6500,8 +7003,7 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
        int err;
 
        if (pci_enable_device_mem(pdev)) {
-               DPRINTK(PROBE, ERR,
-                       "Cannot re-enable PCI device after reset.\n");
+               e_err(probe, "Cannot re-enable PCI device after reset.\n");
                result = PCI_ERS_RESULT_DISCONNECT;
        } else {
                pci_set_master(pdev);
@@ -6517,8 +7019,8 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
 
        err = pci_cleanup_aer_uncorrect_error_status(pdev);
        if (err) {
-               dev_err(&pdev->dev,
-                 "pci_cleanup_aer_uncorrect_error_status failed 0x%0x\n", err);
+               e_dev_err("pci_cleanup_aer_uncorrect_error_status "
+                         "failed 0x%0x\n", err);
                /* non-fatal, continue */
        }
 
@@ -6539,7 +7041,7 @@ static void ixgbe_io_resume(struct pci_dev *pdev)
 
        if (netif_running(netdev)) {
                if (ixgbe_up(adapter)) {
-                       DPRINTK(PROBE, INFO, "ixgbe_up failed after reset\n");
+                       e_info(probe, "ixgbe_up failed after reset\n");
                        return;
                }
        }
@@ -6575,10 +7077,9 @@ static struct pci_driver ixgbe_driver = {
 static int __init ixgbe_init_module(void)
 {
        int ret;
-       printk(KERN_INFO "%s: %s - version %s\n", ixgbe_driver_name,
-              ixgbe_driver_string, ixgbe_driver_version);
-
-       printk(KERN_INFO "%s: %s\n", ixgbe_driver_name, ixgbe_copyright);
+       pr_info("%s - version %s\n", ixgbe_driver_string,
+                  ixgbe_driver_version);
+       pr_info("%s\n", ixgbe_copyright);
 
 #ifdef CONFIG_IXGBE_DCA
        dca_register_notify(&dca_notifier);
@@ -6617,18 +7118,17 @@ static int ixgbe_notify_dca(struct notifier_block *nb, unsigned long event,
 }
 
 #endif /* CONFIG_IXGBE_DCA */
-#ifdef DEBUG
+
 /**
- * ixgbe_get_hw_dev_name - return device name string
+ * ixgbe_get_hw_dev return device
  * used by hardware layer to print debugging information
  **/
-char *ixgbe_get_hw_dev_name(struct ixgbe_hw *hw)
+struct net_device *ixgbe_get_hw_dev(struct ixgbe_hw *hw)
 {
        struct ixgbe_adapter *adapter = hw->back;
-       return adapter->netdev->name;
+       return adapter->netdev;
 }
 
-#endif
 module_exit(ixgbe_exit_module);
 
 /* ixgbe_main.c */
This page took 0.073351 seconds and 5 git commands to generate.