Commit 34ce3626 authored by Amit Kumar Salecha's avatar Amit Kumar Salecha Committed by David S. Miller

qlcnic: fix interface attach sequence

Interface should be visible even if resource allocation fails.
netif_device_attach should be called for every netif_device_detach.
Signed-off-by: default avatarAmit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 65b5b420
...@@ -952,11 +952,11 @@ void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings) ...@@ -952,11 +952,11 @@ void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings)
adapter->max_sds_rings = max_sds_rings; adapter->max_sds_rings = max_sds_rings;
if (qlcnic_attach(adapter)) if (qlcnic_attach(adapter))
return; goto out;
if (netif_running(netdev)) if (netif_running(netdev))
__qlcnic_up(adapter, netdev); __qlcnic_up(adapter, netdev);
out:
netif_device_attach(netdev); netif_device_attach(netdev);
} }
...@@ -978,8 +978,10 @@ int qlcnic_diag_alloc_res(struct net_device *netdev, int test) ...@@ -978,8 +978,10 @@ int qlcnic_diag_alloc_res(struct net_device *netdev, int test)
adapter->diag_test = test; adapter->diag_test = test;
ret = qlcnic_attach(adapter); ret = qlcnic_attach(adapter);
if (ret) if (ret) {
netif_device_attach(netdev);
return ret; return ret;
}
if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) { if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) {
for (ring = 0; ring < adapter->max_sds_rings; ring++) { for (ring = 0; ring < adapter->max_sds_rings; ring++) {
...@@ -1012,16 +1014,12 @@ qlcnic_reset_context(struct qlcnic_adapter *adapter) ...@@ -1012,16 +1014,12 @@ qlcnic_reset_context(struct qlcnic_adapter *adapter)
if (netif_running(netdev)) { if (netif_running(netdev)) {
err = qlcnic_attach(adapter); err = qlcnic_attach(adapter);
if (!err) if (!err)
err = __qlcnic_up(adapter, netdev); __qlcnic_up(adapter, netdev);
if (err)
goto done;
} }
netif_device_attach(netdev); netif_device_attach(netdev);
} }
done:
clear_bit(__QLCNIC_RESETTING, &adapter->state); clear_bit(__QLCNIC_RESETTING, &adapter->state);
return err; return err;
} }
...@@ -1337,6 +1335,7 @@ qlcnic_resume(struct pci_dev *pdev) ...@@ -1337,6 +1335,7 @@ qlcnic_resume(struct pci_dev *pdev)
qlcnic_detach(adapter); qlcnic_detach(adapter);
err_out: err_out:
qlcnic_clr_all_drv_state(adapter); qlcnic_clr_all_drv_state(adapter);
netif_device_attach(netdev);
return err; return err;
} }
#endif #endif
...@@ -2152,6 +2151,7 @@ qlcnic_fwinit_work(struct work_struct *work) ...@@ -2152,6 +2151,7 @@ qlcnic_fwinit_work(struct work_struct *work)
} }
err_ret: err_ret:
netif_device_attach(adapter->netdev);
qlcnic_clr_all_drv_state(adapter); qlcnic_clr_all_drv_state(adapter);
} }
...@@ -2190,6 +2190,7 @@ qlcnic_detach_work(struct work_struct *work) ...@@ -2190,6 +2190,7 @@ qlcnic_detach_work(struct work_struct *work)
err_ret: err_ret:
dev_err(&adapter->pdev->dev, "detach failed; status=%d temp=%d\n", dev_err(&adapter->pdev->dev, "detach failed; status=%d temp=%d\n",
status, adapter->temp); status, adapter->temp);
netif_device_attach(netdev);
qlcnic_clr_all_drv_state(adapter); qlcnic_clr_all_drv_state(adapter);
} }
...@@ -2252,9 +2253,8 @@ qlcnic_attach_work(struct work_struct *work) ...@@ -2252,9 +2253,8 @@ qlcnic_attach_work(struct work_struct *work)
qlcnic_config_indev_addr(netdev, NETDEV_UP); qlcnic_config_indev_addr(netdev, NETDEV_UP);
} }
netif_device_attach(netdev);
done: done:
netif_device_attach(netdev);
adapter->fw_fail_cnt = 0; adapter->fw_fail_cnt = 0;
clear_bit(__QLCNIC_RESETTING, &adapter->state); clear_bit(__QLCNIC_RESETTING, &adapter->state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment