aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDimitris Michailidis <dm@chelsio.com>2010-05-18 06:07:12 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-18 18:16:45 -0400
commitaaefae9b32b2cba7350a4d524357168119372e51 (patch)
tree9d243b81071edbb3177417a1a35c973aa21f3d42 /drivers/net
parentb6bd29e793c1747e0b4be8791d5738acea3a86df (diff)
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/cxgb4/cxgb4.h1
-rw-r--r--drivers/net/cxgb4/cxgb4_main.c49
2 files changed, 22 insertions, 28 deletions
diff --git a/drivers/net/cxgb4/cxgb4.h b/drivers/net/cxgb4/cxgb4.h
index d3a5c3433df7..dd1770e075e6 100644
--- a/drivers/net/cxgb4/cxgb4.h
+++ b/drivers/net/cxgb4/cxgb4.h
@@ -477,7 +477,6 @@ struct adapter {
477 struct pci_dev *pdev; 477 struct pci_dev *pdev;
478 struct device *pdev_dev; 478 struct device *pdev_dev;
479 unsigned long registered_device_map; 479 unsigned long registered_device_map;
480 unsigned long open_device_map;
481 unsigned long flags; 480 unsigned long flags;
482 481
483 const char *name; 482 const char *name;
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index 1f5997167ff3..87161ceb3ea7 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -2433,23 +2433,17 @@ EXPORT_SYMBOL(cxgb4_unregister_uld);
2433 */ 2433 */
2434static int cxgb_up(struct adapter *adap) 2434static int cxgb_up(struct adapter *adap)
2435{ 2435{
2436 int err = 0; 2436 int err;
2437 2437
2438 if (!(adap->flags & FULL_INIT_DONE)) { 2438 err = setup_sge_queues(adap);
2439 err = setup_sge_queues(adap); 2439 if (err)
2440 if (err) 2440 goto out;
2441 goto out; 2441 err = setup_rss(adap);
2442 err = setup_rss(adap); 2442 if (err)
2443 if (err) { 2443 goto freeq;
2444 t4_free_sge_resources(adap);
2445 goto out;
2446 }
2447 if (adap->flags & USING_MSIX)
2448 name_msix_vecs(adap);
2449 adap->flags |= FULL_INIT_DONE;
2450 }
2451 2444
2452 if (adap->flags & USING_MSIX) { 2445 if (adap->flags & USING_MSIX) {
2446 name_msix_vecs(adap);
2453 err = request_irq(adap->msix_info[0].vec, t4_nondata_intr, 0, 2447 err = request_irq(adap->msix_info[0].vec, t4_nondata_intr, 0,
2454 adap->msix_info[0].desc, adap); 2448 adap->msix_info[0].desc, adap);
2455 if (err) 2449 if (err)
@@ -2470,11 +2464,14 @@ static int cxgb_up(struct adapter *adap)
2470 enable_rx(adap); 2464 enable_rx(adap);
2471 t4_sge_start(adap); 2465 t4_sge_start(adap);
2472 t4_intr_enable(adap); 2466 t4_intr_enable(adap);
2467 adap->flags |= FULL_INIT_DONE;
2473 notify_ulds(adap, CXGB4_STATE_UP); 2468 notify_ulds(adap, CXGB4_STATE_UP);
2474 out: 2469 out:
2475 return err; 2470 return err;
2476 irq_err: 2471 irq_err:
2477 dev_err(adap->pdev_dev, "request_irq failed, err %d\n", err); 2472 dev_err(adap->pdev_dev, "request_irq failed, err %d\n", err);
2473 freeq:
2474 t4_free_sge_resources(adap);
2478 goto out; 2475 goto out;
2479} 2476}
2480 2477
@@ -2490,6 +2487,9 @@ static void cxgb_down(struct adapter *adapter)
2490 } else 2487 } else
2491 free_irq(adapter->pdev->irq, adapter); 2488 free_irq(adapter->pdev->irq, adapter);
2492 quiesce_rx(adapter); 2489 quiesce_rx(adapter);
2490 t4_sge_stop(adapter);
2491 t4_free_sge_resources(adapter);
2492 adapter->flags &= ~FULL_INIT_DONE;
2493} 2493}
2494 2494
2495/* 2495/*
@@ -2501,11 +2501,13 @@ static int cxgb_open(struct net_device *dev)
2501 struct port_info *pi = netdev_priv(dev); 2501 struct port_info *pi = netdev_priv(dev);
2502 struct adapter *adapter = pi->adapter; 2502 struct adapter *adapter = pi->adapter;
2503 2503
2504 if (!adapter->open_device_map && (err = cxgb_up(adapter)) < 0) 2504 if (!(adapter->flags & FULL_INIT_DONE)) {
2505 return err; 2505 err = cxgb_up(adapter);
2506 if (err < 0)
2507 return err;
2508 }
2506 2509
2507 dev->real_num_tx_queues = pi->nqsets; 2510 dev->real_num_tx_queues = pi->nqsets;
2508 set_bit(pi->tx_chan, &adapter->open_device_map);
2509 link_start(dev); 2511 link_start(dev);
2510 netif_tx_start_all_queues(dev); 2512 netif_tx_start_all_queues(dev);
2511 return 0; 2513 return 0;
@@ -2513,19 +2515,12 @@ static int cxgb_open(struct net_device *dev)
2513 2515
2514static int cxgb_close(struct net_device *dev) 2516static int cxgb_close(struct net_device *dev)
2515{ 2517{
2516 int ret;
2517 struct port_info *pi = netdev_priv(dev); 2518 struct port_info *pi = netdev_priv(dev);
2518 struct adapter *adapter = pi->adapter; 2519 struct adapter *adapter = pi->adapter;
2519 2520
2520 netif_tx_stop_all_queues(dev); 2521 netif_tx_stop_all_queues(dev);
2521 netif_carrier_off(dev); 2522 netif_carrier_off(dev);
2522 ret = t4_enable_vi(adapter, 0, pi->viid, false, false); 2523 return t4_enable_vi(adapter, 0, pi->viid, false, false);
2523
2524 clear_bit(pi->tx_chan, &adapter->open_device_map);
2525
2526 if (!adapter->open_device_map)
2527 cxgb_down(adapter);
2528 return 0;
2529} 2524}
2530 2525
2531static struct net_device_stats *cxgb_get_stats(struct net_device *dev) 2526static struct net_device_stats *cxgb_get_stats(struct net_device *dev)
@@ -3360,8 +3355,8 @@ static void __devexit remove_one(struct pci_dev *pdev)
3360 if (adapter->debugfs_root) 3355 if (adapter->debugfs_root)
3361 debugfs_remove_recursive(adapter->debugfs_root); 3356 debugfs_remove_recursive(adapter->debugfs_root);
3362 3357
3363 t4_sge_stop(adapter); 3358 if (adapter->flags & FULL_INIT_DONE)
3364 t4_free_sge_resources(adapter); 3359 cxgb_down(adapter);
3365 t4_free_mem(adapter->l2t); 3360 t4_free_mem(adapter->l2t);
3366 t4_free_mem(adapter->tids.tid_tab); 3361 t4_free_mem(adapter->tids.tid_tab);
3367 disable_msi(adapter); 3362 disable_msi(adapter);