cxgb4: keep interrupts available when the ports are brought down

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>
This commit is contained in:
Dimitris Michailidis 2010-05-18 10:07:12 +00:00 committed by David S. Miller
parent b6bd29e793
commit aaefae9b32
2 changed files with 22 additions and 28 deletions

View File

@ -477,7 +477,6 @@ struct adapter {
struct pci_dev *pdev; struct pci_dev *pdev;
struct device *pdev_dev; struct device *pdev_dev;
unsigned long registered_device_map; unsigned long registered_device_map;
unsigned long open_device_map;
unsigned long flags; unsigned long flags;
const char *name; const char *name;

View File

@ -2433,23 +2433,17 @@ EXPORT_SYMBOL(cxgb4_unregister_uld);
*/ */
static int cxgb_up(struct adapter *adap) static int cxgb_up(struct adapter *adap)
{ {
int err = 0; int err;
if (!(adap->flags & FULL_INIT_DONE)) { err = setup_sge_queues(adap);
err = setup_sge_queues(adap); if (err)
if (err) goto out;
goto out; err = setup_rss(adap);
err = setup_rss(adap); if (err)
if (err) { goto freeq;
t4_free_sge_resources(adap);
goto out;
}
if (adap->flags & USING_MSIX)
name_msix_vecs(adap);
adap->flags |= FULL_INIT_DONE;
}
if (adap->flags & USING_MSIX) { if (adap->flags & USING_MSIX) {
name_msix_vecs(adap);
err = request_irq(adap->msix_info[0].vec, t4_nondata_intr, 0, err = request_irq(adap->msix_info[0].vec, t4_nondata_intr, 0,
adap->msix_info[0].desc, adap); adap->msix_info[0].desc, adap);
if (err) if (err)
@ -2470,11 +2464,14 @@ static int cxgb_up(struct adapter *adap)
enable_rx(adap); enable_rx(adap);
t4_sge_start(adap); t4_sge_start(adap);
t4_intr_enable(adap); t4_intr_enable(adap);
adap->flags |= FULL_INIT_DONE;
notify_ulds(adap, CXGB4_STATE_UP); notify_ulds(adap, CXGB4_STATE_UP);
out: out:
return err; return err;
irq_err: irq_err:
dev_err(adap->pdev_dev, "request_irq failed, err %d\n", err); dev_err(adap->pdev_dev, "request_irq failed, err %d\n", err);
freeq:
t4_free_sge_resources(adap);
goto out; goto out;
} }
@ -2490,6 +2487,9 @@ static void cxgb_down(struct adapter *adapter)
} else } else
free_irq(adapter->pdev->irq, adapter); free_irq(adapter->pdev->irq, adapter);
quiesce_rx(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 port_info *pi = netdev_priv(dev);
struct adapter *adapter = pi->adapter; struct adapter *adapter = pi->adapter;
if (!adapter->open_device_map && (err = cxgb_up(adapter)) < 0) if (!(adapter->flags & FULL_INIT_DONE)) {
return err; err = cxgb_up(adapter);
if (err < 0)
return err;
}
dev->real_num_tx_queues = pi->nqsets; dev->real_num_tx_queues = pi->nqsets;
set_bit(pi->tx_chan, &adapter->open_device_map);
link_start(dev); link_start(dev);
netif_tx_start_all_queues(dev); netif_tx_start_all_queues(dev);
return 0; return 0;
@ -2513,19 +2515,12 @@ static int cxgb_open(struct net_device *dev)
static int cxgb_close(struct net_device *dev) static int cxgb_close(struct net_device *dev)
{ {
int ret;
struct port_info *pi = netdev_priv(dev); struct port_info *pi = netdev_priv(dev);
struct adapter *adapter = pi->adapter; struct adapter *adapter = pi->adapter;
netif_tx_stop_all_queues(dev); netif_tx_stop_all_queues(dev);
netif_carrier_off(dev); netif_carrier_off(dev);
ret = t4_enable_vi(adapter, 0, pi->viid, false, false); return 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;
} }
static struct net_device_stats *cxgb_get_stats(struct net_device *dev) 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) if (adapter->debugfs_root)
debugfs_remove_recursive(adapter->debugfs_root); debugfs_remove_recursive(adapter->debugfs_root);
t4_sge_stop(adapter); if (adapter->flags & FULL_INIT_DONE)
t4_free_sge_resources(adapter); cxgb_down(adapter);
t4_free_mem(adapter->l2t); t4_free_mem(adapter->l2t);
t4_free_mem(adapter->tids.tid_tab); t4_free_mem(adapter->tids.tid_tab);
disable_msi(adapter); disable_msi(adapter);