aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/cxgb3_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cxgb3/cxgb3_main.c')
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index ad19585d960b..1ecf53dafe06 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1286,7 +1286,7 @@ irq_err:
1286/* 1286/*
1287 * Release resources when all the ports and offloading have been stopped. 1287 * Release resources when all the ports and offloading have been stopped.
1288 */ 1288 */
1289static void cxgb_down(struct adapter *adapter) 1289static void cxgb_down(struct adapter *adapter, int on_wq)
1290{ 1290{
1291 t3_sge_stop(adapter); 1291 t3_sge_stop(adapter);
1292 spin_lock_irq(&adapter->work_lock); /* sync with PHY intr task */ 1292 spin_lock_irq(&adapter->work_lock); /* sync with PHY intr task */
@@ -1296,7 +1296,8 @@ static void cxgb_down(struct adapter *adapter)
1296 free_irq_resources(adapter); 1296 free_irq_resources(adapter);
1297 quiesce_rx(adapter); 1297 quiesce_rx(adapter);
1298 t3_sge_stop(adapter); 1298 t3_sge_stop(adapter);
1299 flush_workqueue(cxgb3_wq); /* wait for external IRQ handler */ 1299 if (!on_wq)
1300 flush_workqueue(cxgb3_wq);/* wait for external IRQ handler */
1300} 1301}
1301 1302
1302static void schedule_chk_task(struct adapter *adap) 1303static void schedule_chk_task(struct adapter *adap)
@@ -1374,7 +1375,7 @@ static int offload_close(struct t3cdev *tdev)
1374 clear_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map); 1375 clear_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map);
1375 1376
1376 if (!adapter->open_device_map) 1377 if (!adapter->open_device_map)
1377 cxgb_down(adapter); 1378 cxgb_down(adapter, 0);
1378 1379
1379 cxgb3_offload_deactivate(adapter); 1380 cxgb3_offload_deactivate(adapter);
1380 return 0; 1381 return 0;
@@ -1409,7 +1410,7 @@ static int cxgb_open(struct net_device *dev)
1409 return 0; 1410 return 0;
1410} 1411}
1411 1412
1412static int cxgb_close(struct net_device *dev) 1413static int __cxgb_close(struct net_device *dev, int on_wq)
1413{ 1414{
1414 struct port_info *pi = netdev_priv(dev); 1415 struct port_info *pi = netdev_priv(dev);
1415 struct adapter *adapter = pi->adapter; 1416 struct adapter *adapter = pi->adapter;
@@ -1436,12 +1437,17 @@ static int cxgb_close(struct net_device *dev)
1436 cancel_delayed_work_sync(&adapter->adap_check_task); 1437 cancel_delayed_work_sync(&adapter->adap_check_task);
1437 1438
1438 if (!adapter->open_device_map) 1439 if (!adapter->open_device_map)
1439 cxgb_down(adapter); 1440 cxgb_down(adapter, on_wq);
1440 1441
1441 cxgb3_event_notify(&adapter->tdev, OFFLOAD_PORT_DOWN, pi->port_id); 1442 cxgb3_event_notify(&adapter->tdev, OFFLOAD_PORT_DOWN, pi->port_id);
1442 return 0; 1443 return 0;
1443} 1444}
1444 1445
1446static int cxgb_close(struct net_device *dev)
1447{
1448 return __cxgb_close(dev, 0);
1449}
1450
1445static struct net_device_stats *cxgb_get_stats(struct net_device *dev) 1451static struct net_device_stats *cxgb_get_stats(struct net_device *dev)
1446{ 1452{
1447 struct port_info *pi = netdev_priv(dev); 1453 struct port_info *pi = netdev_priv(dev);
@@ -2862,7 +2868,7 @@ void t3_os_link_fault_handler(struct adapter *adapter, int port_id)
2862 spin_unlock(&adapter->work_lock); 2868 spin_unlock(&adapter->work_lock);
2863} 2869}
2864 2870
2865static int t3_adapter_error(struct adapter *adapter, int reset) 2871static int t3_adapter_error(struct adapter *adapter, int reset, int on_wq)
2866{ 2872{
2867 int i, ret = 0; 2873 int i, ret = 0;
2868 2874
@@ -2877,7 +2883,7 @@ static int t3_adapter_error(struct adapter *adapter, int reset)
2877 struct net_device *netdev = adapter->port[i]; 2883 struct net_device *netdev = adapter->port[i];
2878 2884
2879 if (netif_running(netdev)) 2885 if (netif_running(netdev))
2880 cxgb_close(netdev); 2886 __cxgb_close(netdev, on_wq);
2881 } 2887 }
2882 2888
2883 /* Stop SGE timers */ 2889 /* Stop SGE timers */
@@ -2948,7 +2954,7 @@ static void fatal_error_task(struct work_struct *work)
2948 int err = 0; 2954 int err = 0;
2949 2955
2950 rtnl_lock(); 2956 rtnl_lock();
2951 err = t3_adapter_error(adapter, 1); 2957 err = t3_adapter_error(adapter, 1, 1);
2952 if (!err) 2958 if (!err)
2953 err = t3_reenable_adapter(adapter); 2959 err = t3_reenable_adapter(adapter);
2954 if (!err) 2960 if (!err)
@@ -2998,7 +3004,7 @@ static pci_ers_result_t t3_io_error_detected(struct pci_dev *pdev,
2998 if (state == pci_channel_io_perm_failure) 3004 if (state == pci_channel_io_perm_failure)
2999 return PCI_ERS_RESULT_DISCONNECT; 3005 return PCI_ERS_RESULT_DISCONNECT;
3000 3006
3001 ret = t3_adapter_error(adapter, 0); 3007 ret = t3_adapter_error(adapter, 0, 0);
3002 3008
3003 /* Request a slot reset. */ 3009 /* Request a slot reset. */
3004 return PCI_ERS_RESULT_NEED_RESET; 3010 return PCI_ERS_RESULT_NEED_RESET;