Commit 21854f02 authored by Amit Kumar Salecha's avatar Amit Kumar Salecha Committed by David S. Miller

qlcnic: mark device state as failed

Mark device state failed in error path.
Signed-off-by: default avatarAmit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 78f84e1a
...@@ -94,7 +94,7 @@ static void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter); ...@@ -94,7 +94,7 @@ static void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter);
static void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter); static void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter);
static void qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding); static void qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding);
static void qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter); static void qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter, u8);
static int qlcnic_can_start_firmware(struct qlcnic_adapter *adapter); static int qlcnic_can_start_firmware(struct qlcnic_adapter *adapter);
static irqreturn_t qlcnic_tmp_intr(int irq, void *data); static irqreturn_t qlcnic_tmp_intr(int irq, void *data);
...@@ -1561,7 +1561,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1561,7 +1561,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
qlcnic_teardown_intr(adapter); qlcnic_teardown_intr(adapter);
err_out_decr_ref: err_out_decr_ref:
qlcnic_clr_all_drv_state(adapter); qlcnic_clr_all_drv_state(adapter, 0);
err_out_iounmap: err_out_iounmap:
qlcnic_cleanup_pci_map(adapter); qlcnic_cleanup_pci_map(adapter);
...@@ -1600,7 +1600,7 @@ static void __devexit qlcnic_remove(struct pci_dev *pdev) ...@@ -1600,7 +1600,7 @@ static void __devexit qlcnic_remove(struct pci_dev *pdev)
if (adapter->eswitch != NULL) if (adapter->eswitch != NULL)
kfree(adapter->eswitch); kfree(adapter->eswitch);
qlcnic_clr_all_drv_state(adapter); qlcnic_clr_all_drv_state(adapter, 0);
clear_bit(__QLCNIC_RESETTING, &adapter->state); clear_bit(__QLCNIC_RESETTING, &adapter->state);
...@@ -1632,7 +1632,7 @@ static int __qlcnic_shutdown(struct pci_dev *pdev) ...@@ -1632,7 +1632,7 @@ static int __qlcnic_shutdown(struct pci_dev *pdev)
if (netif_running(netdev)) if (netif_running(netdev))
qlcnic_down(adapter, netdev); qlcnic_down(adapter, netdev);
qlcnic_clr_all_drv_state(adapter); qlcnic_clr_all_drv_state(adapter, 0);
clear_bit(__QLCNIC_RESETTING, &adapter->state); clear_bit(__QLCNIC_RESETTING, &adapter->state);
...@@ -2379,7 +2379,7 @@ qlcnic_clr_drv_state(struct qlcnic_adapter *adapter) ...@@ -2379,7 +2379,7 @@ qlcnic_clr_drv_state(struct qlcnic_adapter *adapter)
} }
static void static void
qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter) qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter, u8 failed)
{ {
u32 val; u32 val;
...@@ -2390,7 +2390,11 @@ qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter) ...@@ -2390,7 +2390,11 @@ qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter)
QLC_DEV_CLR_REF_CNT(val, adapter->portnum); QLC_DEV_CLR_REF_CNT(val, adapter->portnum);
QLCWR32(adapter, QLCNIC_CRB_DEV_REF_COUNT, val); QLCWR32(adapter, QLCNIC_CRB_DEV_REF_COUNT, val);
if (!(val & 0x11111111)) if (failed) {
QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_FAILED);
dev_info(&adapter->pdev->dev,
"Device state set to Failed. Please Reboot\n");
} else if (!(val & 0x11111111))
QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_COLD); QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_COLD);
val = QLCRD32(adapter, QLCNIC_CRB_DRV_STATE); val = QLCRD32(adapter, QLCNIC_CRB_DRV_STATE);
...@@ -2605,7 +2609,7 @@ qlcnic_fwinit_work(struct work_struct *work) ...@@ -2605,7 +2609,7 @@ qlcnic_fwinit_work(struct work_struct *work)
dev_err(&adapter->pdev->dev, "Fwinit work failed state=%u " dev_err(&adapter->pdev->dev, "Fwinit work failed state=%u "
"fw_wait_cnt=%u\n", dev_state, adapter->fw_wait_cnt); "fw_wait_cnt=%u\n", dev_state, adapter->fw_wait_cnt);
netif_device_attach(adapter->netdev); netif_device_attach(adapter->netdev);
qlcnic_clr_all_drv_state(adapter); qlcnic_clr_all_drv_state(adapter, 0);
} }
static void static void
...@@ -2641,8 +2645,7 @@ qlcnic_detach_work(struct work_struct *work) ...@@ -2641,8 +2645,7 @@ qlcnic_detach_work(struct work_struct *work)
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); netif_device_attach(netdev);
qlcnic_clr_all_drv_state(adapter); qlcnic_clr_all_drv_state(adapter, 1);
} }
/*Transit NPAR state to NON Operational */ /*Transit NPAR state to NON Operational */
...@@ -2879,7 +2882,7 @@ static int qlcnic_attach_func(struct pci_dev *pdev) ...@@ -2879,7 +2882,7 @@ static int qlcnic_attach_func(struct pci_dev *pdev)
if (netif_running(netdev)) { if (netif_running(netdev)) {
err = qlcnic_attach(adapter); err = qlcnic_attach(adapter);
if (err) { if (err) {
qlcnic_clr_all_drv_state(adapter); qlcnic_clr_all_drv_state(adapter, 1);
clear_bit(__QLCNIC_AER, &adapter->state); clear_bit(__QLCNIC_AER, &adapter->state);
netif_device_attach(netdev); netif_device_attach(netdev);
return err; return err;
......
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