]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/ixgbe/ixgbe_main.c
ixgbe: update version number for ixgbe
[net-next-2.6.git] / drivers / net / ixgbe / ixgbe_main.c
index 6e56f7b7c8fd01738d07ab691af7ab2628d67002..02541956744063359ffaa0120d24484b2e91de3c 100644 (file)
@@ -52,13 +52,14 @@ char ixgbe_driver_name[] = "ixgbe";
 static const char ixgbe_driver_string[] =
                              "Intel(R) 10 Gigabit PCI Express Network Driver";
 
-#define DRV_VERSION "2.0.84-k2"
+#define DRV_VERSION "3.0.12-k2"
 const char ixgbe_driver_version[] = DRV_VERSION;
 static char ixgbe_copyright[] = "Copyright (c) 1999-2010 Intel Corporation.";
 
 static const struct ixgbe_info *ixgbe_info_tbl[] = {
        [board_82598] = &ixgbe_82598_info,
        [board_82599] = &ixgbe_82599_info,
+       [board_X540] = &ixgbe_X540_info,
 };
 
 /* ixgbe_pci_tbl - PCI Device ID Table
@@ -112,6 +113,8 @@ static DEFINE_PCI_DEVICE_TABLE(ixgbe_pci_tbl) = {
         board_82599 },
        {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_COMBO_BACKPLANE),
         board_82599 },
+       {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X540T),
+        board_82599 },
 
        /* required last entry */
        {0, }
@@ -560,6 +563,7 @@ static void ixgbe_set_ivar(struct ixgbe_adapter *adapter, s8 direction,
                IXGBE_WRITE_REG(hw, IXGBE_IVAR(index), ivar);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                if (direction == -1) {
                        /* other causes */
                        msix_vector |= IXGBE_IVAR_ALLOC_VAL;
@@ -595,6 +599,7 @@ static inline void ixgbe_irq_rearm_queues(struct ixgbe_adapter *adapter,
                IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, mask);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                mask = (qmask & 0xFFFFFFFF);
                IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS_EX(0), mask);
                mask = (qmask >> 32);
@@ -922,6 +927,7 @@ static void ixgbe_update_rx_dca(struct ixgbe_adapter *adapter,
                rxctrl |= dca3_get_tag(&adapter->pdev->dev, cpu);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                rxctrl &= ~IXGBE_DCA_RXCTRL_CPUID_MASK_82599;
                rxctrl |= (dca3_get_tag(&adapter->pdev->dev, cpu) <<
                           IXGBE_DCA_RXCTRL_CPUID_SHIFT_82599);
@@ -955,6 +961,7 @@ static void ixgbe_update_tx_dca(struct ixgbe_adapter *adapter,
                IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(reg_idx), txctrl);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(reg_idx));
                txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK_82599;
                txctrl |= (dca3_get_tag(&adapter->pdev->dev, cpu) <<
@@ -1580,6 +1587,7 @@ static void ixgbe_configure_msix(struct ixgbe_adapter *adapter)
                               v_idx);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                ixgbe_set_ivar(adapter, -1, 1, v_idx);
                break;
 
@@ -1687,8 +1695,9 @@ void ixgbe_write_eitr(struct ixgbe_q_vector *q_vector)
                itr_reg |= (itr_reg << 16);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                /*
-                * 82599 can support a value of zero, so allow it for
+                * 82599 and X540 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
                 */
@@ -1884,6 +1893,7 @@ static irqreturn_t ixgbe_msix_lsc(int irq, void *data)
 
        switch (hw->mac.type) {
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                /* Handle Flow Director Full threshold interrupt */
                if (eicr & IXGBE_EICR_FLOW_DIR) {
                        int i;
@@ -1929,6 +1939,7 @@ static inline void ixgbe_irq_enable_queues(struct ixgbe_adapter *adapter,
                IXGBE_WRITE_REG(hw, IXGBE_EIMS, mask);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                mask = (qmask & 0xFFFFFFFF);
                if (mask)
                        IXGBE_WRITE_REG(hw, IXGBE_EIMS_EX(0), mask);
@@ -1954,6 +1965,7 @@ static inline void ixgbe_irq_disable_queues(struct ixgbe_adapter *adapter,
                IXGBE_WRITE_REG(hw, IXGBE_EIMC, mask);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                mask = (qmask & 0xFFFFFFFF);
                if (mask)
                        IXGBE_WRITE_REG(hw, IXGBE_EIMC_EX(0), mask);
@@ -2426,6 +2438,7 @@ static inline void ixgbe_irq_enable(struct ixgbe_adapter *adapter, bool queues,
                mask |= IXGBE_EIMS_GPI_SDP1;
        switch (adapter->hw.mac.type) {
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                mask |= IXGBE_EIMS_ECC;
                mask |= IXGBE_EIMS_GPI_SDP1;
                mask |= IXGBE_EIMS_GPI_SDP2;
@@ -2491,6 +2504,7 @@ static irqreturn_t ixgbe_intr(int irq, void *data)
 
        switch (hw->mac.type) {
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                ixgbe_check_sfp_event(adapter, eicr);
                if ((adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) &&
                    ((eicr & IXGBE_EICR_GPI_SDP0) || (eicr & IXGBE_EICR_LSC))) {
@@ -2600,6 +2614,7 @@ static inline void ixgbe_irq_disable(struct ixgbe_adapter *adapter)
                IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, ~0);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFF0000);
                IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC_EX(0), ~0);
                IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC_EX(1), ~0);
@@ -2794,6 +2809,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter,
        }
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
        default:
                break;
        }
@@ -2890,12 +2906,29 @@ static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter)
        IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc);
 }
 
+/**
+ * ixgbe_clear_rscctl - disable RSC for the indicated ring
+ * @adapter: address of board private structure
+ * @ring: structure containing ring specific data
+ **/
+void ixgbe_clear_rscctl(struct ixgbe_adapter *adapter,
+                        struct ixgbe_ring *ring)
+{
+       struct ixgbe_hw *hw = &adapter->hw;
+       u32 rscctrl;
+       u8 reg_idx = ring->reg_idx;
+
+       rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(reg_idx));
+       rscctrl &= ~IXGBE_RSCCTL_RSCEN;
+       IXGBE_WRITE_REG(hw, IXGBE_RSCCTL(reg_idx), rscctrl);
+}
+
 /**
  * ixgbe_configure_rscctl - enable RSC for the indicated ring
  * @adapter:    address of board private structure
  * @index:      index of ring to set
  **/
-static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter,
+void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter,
                                   struct ixgbe_ring *ring)
 {
        struct ixgbe_hw *hw = &adapter->hw;
@@ -3200,6 +3233,7 @@ static void ixgbe_setup_rdrxctl(struct ixgbe_adapter *adapter)
                rdrxctl |= IXGBE_RDRXCTL_MVMEN;
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                /* Disable RSC for ACK packets */
                IXGBE_WRITE_REG(hw, IXGBE_RSCDBU,
                   (IXGBE_RSCDBU_RSCACKDIS | IXGBE_READ_REG(hw, IXGBE_RSCDBU)));
@@ -3327,6 +3361,7 @@ static void ixgbe_vlan_strip_disable(struct ixgbe_adapter *adapter)
                IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                for (i = 0; i < adapter->num_rx_queues; i++) {
                        j = adapter->rx_ring[i]->reg_idx;
                        vlnctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(j));
@@ -3356,6 +3391,7 @@ static void ixgbe_vlan_strip_enable(struct ixgbe_adapter *adapter)
                IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                for (i = 0; i < adapter->num_rx_queues; i++) {
                        j = adapter->rx_ring[i]->reg_idx;
                        vlnctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(j));
@@ -3711,8 +3747,9 @@ static void ixgbe_setup_gpie(struct ixgbe_adapter *adapter)
                case ixgbe_mac_82598EB:
                        IXGBE_WRITE_REG(hw, IXGBE_EIAM, IXGBE_EICS_RTX_QUEUE);
                        break;
-               default:
                case ixgbe_mac_82599EB:
+               case ixgbe_mac_X540:
+               default:
                        IXGBE_WRITE_REG(hw, IXGBE_EIAM_EX(0), 0xFFFFFFFF);
                        IXGBE_WRITE_REG(hw, IXGBE_EIAM_EX(1), 0xFFFFFFFF);
                        break;
@@ -4060,6 +4097,7 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
        /* Disable the Tx DMA engine on 82599 */
        switch (hw->mac.type) {
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                IXGBE_WRITE_REG(hw, IXGBE_DMATXCTL,
                                (IXGBE_READ_REG(hw, IXGBE_DMATXCTL) &
                                 ~IXGBE_DMATXCTL_TE));
@@ -4434,6 +4472,7 @@ static inline bool ixgbe_cache_ring_dcb(struct ixgbe_adapter *adapter)
                ret = true;
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                if (dcb_i == 8) {
                        /*
                         * Tx TC0 starts at: descriptor queue 0
@@ -4637,71 +4676,55 @@ static void ixgbe_cache_ring_register(struct ixgbe_adapter *adapter)
  **/
 static int ixgbe_alloc_queues(struct ixgbe_adapter *adapter)
 {
-       int i;
-       int rx_count;
-       int orig_node = adapter->node;
+       int rx = 0, tx = 0, nid = adapter->node;
 
-       for (i = 0; i < adapter->num_tx_queues; i++) {
-               struct ixgbe_ring *ring = adapter->tx_ring[i];
-               if (orig_node == -1) {
-                       int cur_node = next_online_node(adapter->node);
-                       if (cur_node == MAX_NUMNODES)
-                               cur_node = first_online_node;
-                       adapter->node = cur_node;
-               }
-               ring = kzalloc_node(sizeof(struct ixgbe_ring), GFP_KERNEL,
-                                   adapter->node);
+       if (nid < 0 || !node_online(nid))
+               nid = first_online_node;
+
+       for (; tx < adapter->num_tx_queues; tx++) {
+               struct ixgbe_ring *ring;
+
+               ring = kzalloc_node(sizeof(*ring), GFP_KERNEL, nid);
                if (!ring)
-                       ring = kzalloc(sizeof(struct ixgbe_ring), GFP_KERNEL);
+                       ring = kzalloc(sizeof(*ring), GFP_KERNEL);
                if (!ring)
-                       goto err_tx_ring_allocation;
+                       goto err_allocation;
                ring->count = adapter->tx_ring_count;
-               ring->queue_index = i;
+               ring->queue_index = tx;
+               ring->numa_node = nid;
                ring->dev = &adapter->pdev->dev;
                ring->netdev = adapter->netdev;
-               ring->numa_node = adapter->node;
 
-               adapter->tx_ring[i] = ring;
+               adapter->tx_ring[tx] = ring;
        }
 
-       /* Restore the adapter's original node */
-       adapter->node = orig_node;
+       for (; rx < adapter->num_rx_queues; rx++) {
+               struct ixgbe_ring *ring;
 
-       rx_count = adapter->rx_ring_count;
-       for (i = 0; i < adapter->num_rx_queues; i++) {
-               struct ixgbe_ring *ring = adapter->rx_ring[i];
-               if (orig_node == -1) {
-                       int cur_node = next_online_node(adapter->node);
-                       if (cur_node == MAX_NUMNODES)
-                               cur_node = first_online_node;
-                       adapter->node = cur_node;
-               }
-               ring = kzalloc_node(sizeof(struct ixgbe_ring), GFP_KERNEL,
-                                   adapter->node);
+               ring = kzalloc_node(sizeof(*ring), GFP_KERNEL, nid);
                if (!ring)
-                       ring = kzalloc(sizeof(struct ixgbe_ring), GFP_KERNEL);
+                       ring = kzalloc(sizeof(*ring), GFP_KERNEL);
                if (!ring)
-                       goto err_rx_ring_allocation;
-               ring->count = rx_count;
-               ring->queue_index = i;
+                       goto err_allocation;
+               ring->count = adapter->rx_ring_count;
+               ring->queue_index = rx;
+               ring->numa_node = nid;
                ring->dev = &adapter->pdev->dev;
                ring->netdev = adapter->netdev;
-               ring->numa_node = adapter->node;
 
-               adapter->rx_ring[i] = ring;
+               adapter->rx_ring[rx] = ring;
        }
 
-       /* Restore the adapter's original node */
-       adapter->node = orig_node;
-
        ixgbe_cache_ring_register(adapter);
 
        return 0;
 
-err_rx_ring_allocation:
-       for (i = 0; i < adapter->num_tx_queues; i++)
-               kfree(adapter->tx_ring[i]);
-err_tx_ring_allocation:
+err_allocation:
+       while (tx)
+               kfree(adapter->tx_ring[--tx]);
+
+       while (rx)
+               kfree(adapter->rx_ring[--rx]);
        return -ENOMEM;
 }
 
@@ -5048,6 +5071,7 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
                adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82598;
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599;
                adapter->flags2 |= IXGBE_FLAG2_RSC_CAPABLE;
                adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED;
@@ -5566,6 +5590,7 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
                pci_wake_from_d3(pdev, false);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                pci_wake_from_d3(pdev, !!wufc);
                break;
        default:
@@ -5695,6 +5720,7 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter)
                                IXGBE_READ_REG(hw, IXGBE_PXONRXC(i));
                        break;
                case ixgbe_mac_82599EB:
+               case ixgbe_mac_X540:
                        hwstats->pxonrxc[i] +=
                                IXGBE_READ_REG(hw, IXGBE_PXONRXCNT(i));
                        break;
@@ -5719,6 +5745,7 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter)
                hwstats->tor += IXGBE_READ_REG(hw, IXGBE_TORH);
                break;
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                hwstats->gorc += IXGBE_READ_REG(hw, IXGBE_GORCL);
                IXGBE_READ_REG(hw, IXGBE_GORCH); /* to clear */
                hwstats->gotc += IXGBE_READ_REG(hw, IXGBE_GOTCL);
@@ -5982,7 +6009,8 @@ static void ixgbe_watchdog_task(struct work_struct *work)
                                flow_tx = !!(rmcs & IXGBE_RMCS_TFCE_802_3X);
                        }
                                break;
-                       case ixgbe_mac_82599EB: {
+                       case ixgbe_mac_82599EB:
+                       case ixgbe_mac_X540: {
                                u32 mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);
                                u32 fccfg = IXGBE_READ_REG(hw, IXGBE_FCCFG);
                                flow_rx = !!(mflcn & IXGBE_MFLCN_RFCE);
@@ -7056,8 +7084,14 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
                goto err_sw_init;
 
        /* Make it possible the adapter to be woken up via WOL */
-       if (adapter->hw.mac.type == ixgbe_mac_82599EB)
+       switch (adapter->hw.mac.type) {
+       case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:
                IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0);
+               break;
+       default:
+               break;
+       }
 
        /*
         * If there is a fan on this device and it has failed log the