igb: remove 82576 quad adapter
[linux-2.6.git] / drivers / net / igb / igb_main.c
index 1ab8e3e..634c4c9 100644 (file)
@@ -61,7 +61,6 @@ static struct pci_device_id igb_pci_tbl[] = {
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576), board_82575 },
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_FIBER), board_82575 },
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES), board_82575 },
-       { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_QUAD_COPPER), board_82575 },
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_COPPER), board_82575 },
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_FIBER_SERDES), board_82575 },
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575GB_QUAD_COPPER), board_82575 },
@@ -311,7 +310,7 @@ static void igb_assign_vector(struct igb_adapter *adapter, int rx_queue,
                array_wr32(E1000_MSIXBM(0), msix_vector, msixbm);
                break;
        case e1000_82576:
-               /* Kawela uses a table-based method for assigning vectors.
+               /* The 82576 uses a table-based method for assigning vectors.
                   Each queue has a single entry in the table to which we write
                   a vector number along with a "valid" bit.  Sadly, the layout
                   of the table is somewhat counterintuitive. */
@@ -385,7 +384,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)
 
        for (i = 0; i < adapter->num_rx_queues; i++) {
                struct igb_ring *rx_ring = &adapter->rx_ring[i];
-               rx_ring->buddy = 0;
+               rx_ring->buddy = NULL;
                igb_assign_vector(adapter, i, IGB_N0_QUEUE, vector++);
                adapter->eims_enable_mask |= rx_ring->eims_value;
                if (rx_ring->itr_val)
@@ -521,7 +520,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter)
                              adapter->msix_entries,
                              numvecs);
        if (err == 0)
-               return;
+               goto out;
 
        igb_reset_interrupt_capability(adapter);
 
@@ -531,11 +530,9 @@ msi_only:
        adapter->num_tx_queues = 1;
        if (!pci_enable_msi(adapter->pdev))
                adapter->flags |= IGB_FLAG_HAS_MSI;
-
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
+out:
        /* Notify the stack of the (possibly) reduced Tx Queue count. */
-       adapter->netdev->egress_subqueue_count = adapter->num_tx_queues;
-#endif
+       adapter->netdev->real_num_tx_queues = adapter->num_tx_queues;
        return;
 }
 
@@ -722,28 +719,6 @@ static void igb_get_hw_control(struct igb_adapter *adapter)
                        ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
 }
 
-static void igb_init_manageability(struct igb_adapter *adapter)
-{
-       struct e1000_hw *hw = &adapter->hw;
-
-       if (adapter->en_mng_pt) {
-               u32 manc2h = rd32(E1000_MANC2H);
-               u32 manc = rd32(E1000_MANC);
-
-               /* enable receiving management packets to the host */
-               /* this will probably generate destination unreachable messages
-                * from the host OS, but the packets will be handled on SMBUS */
-               manc |= E1000_MANC_EN_MNG2HOST;
-#define E1000_MNG2HOST_PORT_623 (1 << 5)
-#define E1000_MNG2HOST_PORT_664 (1 << 6)
-               manc2h |= E1000_MNG2HOST_PORT_623;
-               manc2h |= E1000_MNG2HOST_PORT_664;
-               wr32(E1000_MANC2H, manc2h);
-
-               wr32(E1000_MANC, manc);
-       }
-}
-
 /**
  * igb_configure - configure the hardware for RX and TX
  * @adapter: private board structure
@@ -757,7 +732,6 @@ static void igb_configure(struct igb_adapter *adapter)
        igb_set_multi(netdev);
 
        igb_restore_vlan(adapter);
-       igb_init_manageability(adapter);
 
        igb_configure_tx(adapter);
        igb_setup_rctl(adapter);
@@ -823,11 +797,7 @@ void igb_down(struct igb_adapter *adapter)
        wr32(E1000_RCTL, rctl & ~E1000_RCTL_EN);
        /* flush and sleep below */
 
-       netif_stop_queue(netdev);
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
-       for (i = 0; i < adapter->num_tx_queues; i++)
-               netif_stop_subqueue(netdev, i);
-#endif
+       netif_tx_stop_all_queues(netdev);
 
        /* disable transmits in the hardware */
        tctl = rd32(E1000_TCTL);
@@ -1042,11 +1012,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
        pci_save_state(pdev);
 
        err = -ENOMEM;
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
        netdev = alloc_etherdev_mq(sizeof(struct igb_adapter), IGB_MAX_TX_QUEUES);
-#else
-       netdev = alloc_etherdev(sizeof(struct igb_adapter));
-#endif /* CONFIG_NETDEVICES_MULTIQUEUE */
        if (!netdev)
                goto err_alloc_etherdev;
 
@@ -1163,10 +1129,6 @@ static int __devinit igb_probe(struct pci_dev *pdev,
        if (pci_using_dac)
                netdev->features |= NETIF_F_HIGHDMA;
 
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
-       netdev->features |= NETIF_F_MULTI_QUEUE;
-#endif
-
        netdev->features |= NETIF_F_LLTX;
        adapter->en_mng_pt = igb_enable_mng_pass_thru(&adapter->hw);
 
@@ -1254,16 +1216,6 @@ static int __devinit igb_probe(struct pci_dev *pdev,
                if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1)
                        adapter->eeprom_wol = 0;
                break;
-       case E1000_DEV_ID_82576_QUAD_COPPER:
-               /* if quad port adapter, disable WoL on all but port A */
-               if (global_quad_port_a != 0)
-                       adapter->eeprom_wol = 0;
-               else
-                       adapter->flags |= IGB_FLAG_QUAD_PORT_A;
-               /* Reset for multiple quad port adapters */
-               if (++global_quad_port_a == 4)
-                       global_quad_port_a = 0;
-               break;
        }
 
        /* initialize the wol settings based on the eeprom settings */
@@ -1278,11 +1230,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
 
        /* tell the stack to leave us alone until igb_open() is called */
        netif_carrier_off(netdev);
-       netif_stop_queue(netdev);
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
-       for (i = 0; i < adapter->num_tx_queues; i++)
-               netif_stop_subqueue(netdev, i);
-#endif
+       netif_tx_stop_all_queues(netdev);
 
        strcpy(netdev->name, "eth%d");
        err = register_netdev(netdev);
@@ -1390,7 +1338,8 @@ static void __devexit igb_remove(struct pci_dev *pdev)
 
        unregister_netdev(netdev);
 
-       if (!igb_check_reset_block(&adapter->hw))
+       if (adapter->hw.phy.ops.reset_phy &&
+           !igb_check_reset_block(&adapter->hw))
                adapter->hw.phy.ops.reset_phy(&adapter->hw);
 
        igb_remove_device(&adapter->hw);
@@ -1432,11 +1381,7 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
        /* Number of supported queues. */
        /* Having more queues than CPUs doesn't make sense. */
        adapter->num_rx_queues = min((u32)IGB_MAX_RX_QUEUES, (u32)num_online_cpus());
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
        adapter->num_tx_queues = min(IGB_MAX_TX_QUEUES, num_online_cpus());
-#else
-       adapter->num_tx_queues = 1;
-#endif /* CONFIG_NET_MULTI_QUEUE_DEVICE */
 
        /* This call may decrease the number of queues depending on
         * interrupt mode. */
@@ -1515,6 +1460,8 @@ static int igb_open(struct net_device *netdev)
 
        igb_irq_enable(adapter);
 
+       netif_tx_start_all_queues(netdev);
+
        /* Fire a link status change interrupt to start the watchdog. */
        wr32(E1000_ICS, E1000_ICS_LSC);
 
@@ -1619,9 +1566,7 @@ err:
 static int igb_setup_all_tx_resources(struct igb_adapter *adapter)
 {
        int i, err = 0;
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
        int r_idx;
-#endif 
 
        for (i = 0; i < adapter->num_tx_queues; i++) {
                err = igb_setup_tx_resources(adapter, &adapter->tx_ring[i]);
@@ -1634,12 +1579,10 @@ static int igb_setup_all_tx_resources(struct igb_adapter *adapter)
                }
        }
 
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
        for (i = 0; i < IGB_MAX_TX_QUEUES; i++) {
                r_idx = i % adapter->num_tx_queues;
                adapter->multi_tx_table[i] = &adapter->tx_ring[r_idx];
        }       
-#endif         
        return err;
 }
 
@@ -2277,8 +2220,7 @@ static void igb_set_multi(struct net_device *netdev)
                        rctl &= ~E1000_RCTL_UPE;
                } else
                        rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE);
-               if (adapter->vlgrp)
-                       rctl |= E1000_RCTL_VFE;
+               rctl |= E1000_RCTL_VFE;
        }
        wr32(E1000_RCTL, rctl);
 
@@ -2337,10 +2279,9 @@ static void igb_watchdog_task(struct work_struct *work)
        struct igb_ring *tx_ring = adapter->tx_ring;
        struct e1000_mac_info *mac = &adapter->hw.mac;
        u32 link;
+       u32 eics = 0;
        s32 ret_val;
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
        int i;
-#endif
 
        if ((netif_carrier_ok(netdev)) &&
            (rd32(E1000_STATUS) & E1000_STATUS_LU))
@@ -2396,11 +2337,7 @@ static void igb_watchdog_task(struct work_struct *work)
                        }
 
                        netif_carrier_on(netdev);
-                       netif_wake_queue(netdev);
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
-                       for (i = 0; i < adapter->num_tx_queues; i++)
-                               netif_wake_subqueue(netdev, i);
-#endif
+                       netif_tx_wake_all_queues(netdev);
 
                        if (!test_bit(__IGB_DOWN, &adapter->state))
                                mod_timer(&adapter->phy_info_timer,
@@ -2412,11 +2349,7 @@ static void igb_watchdog_task(struct work_struct *work)
                        adapter->link_duplex = 0;
                        dev_info(&adapter->pdev->dev, "NIC Link is Down\n");
                        netif_carrier_off(netdev);
-                       netif_stop_queue(netdev);
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
-                       for (i = 0; i < adapter->num_tx_queues; i++)
-                               netif_stop_subqueue(netdev, i);
-#endif
+                       netif_tx_stop_all_queues(netdev);
                        if (!test_bit(__IGB_DOWN, &adapter->state))
                                mod_timer(&adapter->phy_info_timer,
                                          round_jiffies(jiffies + 2 * HZ));
@@ -2450,7 +2383,13 @@ link_up:
        }
 
        /* Cause software interrupt to ensure rx ring is cleaned */
-       wr32(E1000_ICS, E1000_ICS_RXDMT0);
+       if (adapter->msix_entries) {
+               for (i = 0; i < adapter->num_rx_queues; i++)
+                       eics |= adapter->rx_ring[i].eims_value;
+               wr32(E1000_EICS, eics);
+       } else {
+               wr32(E1000_ICS, E1000_ICS_RXDMT0);
+       }
 
        /* Force detection of hung controller every watchdog period */
        tx_ring->detect_tx_hung = true;
@@ -2944,11 +2883,7 @@ static int __igb_maybe_stop_tx(struct net_device *netdev,
 {
        struct igb_adapter *adapter = netdev_priv(netdev);
 
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
        netif_stop_subqueue(netdev, tx_ring->queue_index);
-#else
-       netif_stop_queue(netdev);
-#endif
 
        /* Herbert's original patch had:
         *  smp_mb__after_netif_stop_queue();
@@ -2961,11 +2896,7 @@ static int __igb_maybe_stop_tx(struct net_device *netdev,
                return -EBUSY;
 
        /* A reprieve! */
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
        netif_wake_subqueue(netdev, tx_ring->queue_index);
-#else
-       netif_wake_queue(netdev);
-#endif 
        ++adapter->restart_queue;
        return 0;
 }
@@ -3052,14 +2983,9 @@ static int igb_xmit_frame_adv(struct sk_buff *skb, struct net_device *netdev)
        struct igb_adapter *adapter = netdev_priv(netdev);
        struct igb_ring *tx_ring;
 
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
        int r_idx = 0;
        r_idx = skb->queue_mapping & (IGB_MAX_TX_QUEUES - 1);
        tx_ring = adapter->multi_tx_table[r_idx];
-#else
-       tx_ring = &adapter->tx_ring[0];
-#endif
-
 
        /* This goes back to the question of how to logically map a tx queue
         * to a flow.  Right now, performance is impacted slightly negatively
@@ -3746,19 +3672,11 @@ done_cleaning:
                 * sees the new next_to_clean.
                 */
                smp_mb();
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
                if (__netif_subqueue_stopped(netdev, tx_ring->queue_index) &&
                    !(test_bit(__IGB_DOWN, &adapter->state))) {
                        netif_wake_subqueue(netdev, tx_ring->queue_index);
                        ++adapter->restart_queue;
                }
-#else
-               if (netif_queue_stopped(netdev) &&
-                   !(test_bit(__IGB_DOWN, &adapter->state))) {
-                       netif_wake_queue(netdev);
-                       ++adapter->restart_queue;
-               }
-#endif         
        }
 
        if (tx_ring->detect_tx_hung) {
@@ -3794,11 +3712,7 @@ done_cleaning:
                                tx_ring->buffer_info[i].time_stamp,
                                jiffies,
                                tx_desc->upper.fields.status);
-#ifdef CONFIG_NETDEVICES_MULTIQUEUE
                        netif_stop_subqueue(netdev, tx_ring->queue_index);
-#else
-                       netif_stop_queue(netdev);
-#endif
                }
        }
        tx_ring->total_bytes += total_bytes;
@@ -4224,8 +4138,6 @@ static void igb_vlan_rx_register(struct net_device *netdev,
 
                /* enable VLAN receive filtering */
                rctl = rd32(E1000_RCTL);
-               if (!(netdev->flags & IFF_PROMISC))
-                       rctl |= E1000_RCTL_VFE;
                rctl &= ~E1000_RCTL_CFIEN;
                wr32(E1000_RCTL, rctl);
                igb_update_mng_vlan(adapter);
@@ -4237,10 +4149,6 @@ static void igb_vlan_rx_register(struct net_device *netdev,
                ctrl &= ~E1000_CTRL_VME;
                wr32(E1000_CTRL, ctrl);
 
-               /* disable VLAN filtering */
-               rctl = rd32(E1000_RCTL);
-               rctl &= ~E1000_RCTL_VFE;
-               wr32(E1000_RCTL, rctl);
                if (adapter->mng_vlan_id != (u16)IGB_MNG_VLAN_NONE) {
                        igb_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
                        adapter->mng_vlan_id = IGB_MNG_VLAN_NONE;
@@ -4590,8 +4498,6 @@ static void igb_io_resume(struct pci_dev *pdev)
        struct net_device *netdev = pci_get_drvdata(pdev);
        struct igb_adapter *adapter = netdev_priv(netdev);
 
-       igb_init_manageability(adapter);
-
        if (netif_running(netdev)) {
                if (igb_up(adapter)) {
                        dev_err(&pdev->dev, "igb_up failed after reset\n");