cxgb4: keep interrupts available when the ports are brought down
authorDimitris Michailidis <dm@chelsio.com>
Tue, 18 May 2010 10:07:12 +0000 (10:07 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 May 2010 22:16:45 +0000 (15:16 -0700)
The PF driver needs to remain alert while its ports are down to service
requests or errors from virtual functions or FW so keep interrupts and
queues available when the ports are brought down.  The change makes
open_device_map unnecessary so remove it.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/cxgb4/cxgb4.h
drivers/net/cxgb4/cxgb4_main.c

index d3a5c3433df77be239ca971d3cab4919951131a5..dd1770e075e68c8bbe4b95828c903f5dae0eaa6b 100644 (file)
@@ -477,7 +477,6 @@ struct adapter {
        struct pci_dev *pdev;
        struct device *pdev_dev;
        unsigned long registered_device_map;
-       unsigned long open_device_map;
        unsigned long flags;
 
        const char *name;
index 1f5997167ff31298beeac9f01c13f6d80567250c..87161ceb3ea7985b3af06d7c21bdad09516b7e2c 100644 (file)
@@ -2433,23 +2433,17 @@ EXPORT_SYMBOL(cxgb4_unregister_uld);
  */
 static int cxgb_up(struct adapter *adap)
 {
-       int err = 0;
+       int err;
 
-       if (!(adap->flags & FULL_INIT_DONE)) {
-               err = setup_sge_queues(adap);
-               if (err)
-                       goto out;
-               err = setup_rss(adap);
-               if (err) {
-                       t4_free_sge_resources(adap);
-                       goto out;
-               }
-               if (adap->flags & USING_MSIX)
-                       name_msix_vecs(adap);
-               adap->flags |= FULL_INIT_DONE;
-       }
+       err = setup_sge_queues(adap);
+       if (err)
+               goto out;
+       err = setup_rss(adap);
+       if (err)
+               goto freeq;
 
        if (adap->flags & USING_MSIX) {
+               name_msix_vecs(adap);
                err = request_irq(adap->msix_info[0].vec, t4_nondata_intr, 0,
                                  adap->msix_info[0].desc, adap);
                if (err)
@@ -2470,11 +2464,14 @@ static int cxgb_up(struct adapter *adap)
        enable_rx(adap);
        t4_sge_start(adap);
        t4_intr_enable(adap);
+       adap->flags |= FULL_INIT_DONE;
        notify_ulds(adap, CXGB4_STATE_UP);
  out:
        return err;
  irq_err:
        dev_err(adap->pdev_dev, "request_irq failed, err %d\n", err);
+ freeq:
+       t4_free_sge_resources(adap);
        goto out;
 }
 
@@ -2490,6 +2487,9 @@ static void cxgb_down(struct adapter *adapter)
        } else
                free_irq(adapter->pdev->irq, adapter);
        quiesce_rx(adapter);
+       t4_sge_stop(adapter);
+       t4_free_sge_resources(adapter);
+       adapter->flags &= ~FULL_INIT_DONE;
 }
 
 /*
@@ -2501,11 +2501,13 @@ static int cxgb_open(struct net_device *dev)
        struct port_info *pi = netdev_priv(dev);
        struct adapter *adapter = pi->adapter;
 
-       if (!adapter->open_device_map && (err = cxgb_up(adapter)) < 0)
-               return err;
+       if (!(adapter->flags & FULL_INIT_DONE)) {
+               err = cxgb_up(adapter);
+               if (err < 0)
+                       return err;
+       }
 
        dev->real_num_tx_queues = pi->nqsets;
-       set_bit(pi->tx_chan, &adapter->open_device_map);
        link_start(dev);
        netif_tx_start_all_queues(dev);
        return 0;
@@ -2513,19 +2515,12 @@ static int cxgb_open(struct net_device *dev)
 
 static int cxgb_close(struct net_device *dev)
 {
-       int ret;
        struct port_info *pi = netdev_priv(dev);
        struct adapter *adapter = pi->adapter;
 
        netif_tx_stop_all_queues(dev);
        netif_carrier_off(dev);
-       ret = t4_enable_vi(adapter, 0, pi->viid, false, false);
-
-       clear_bit(pi->tx_chan, &adapter->open_device_map);
-
-       if (!adapter->open_device_map)
-               cxgb_down(adapter);
-       return 0;
+       return t4_enable_vi(adapter, 0, pi->viid, false, false);
 }
 
 static struct net_device_stats *cxgb_get_stats(struct net_device *dev)
@@ -3360,8 +3355,8 @@ static void __devexit remove_one(struct pci_dev *pdev)
                if (adapter->debugfs_root)
                        debugfs_remove_recursive(adapter->debugfs_root);
 
-               t4_sge_stop(adapter);
-               t4_free_sge_resources(adapter);
+               if (adapter->flags & FULL_INIT_DONE)
+                       cxgb_down(adapter);
                t4_free_mem(adapter->l2t);
                t4_free_mem(adapter->tids.tid_tab);
                disable_msi(adapter);