diff options
author | Amit Kumar Salecha <amit.salecha@qlogic.com> | 2010-08-19 01:08:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-19 19:52:41 -0400 |
commit | 21854f029da525b5bef1dbd63c622e16a2eb2f90 (patch) | |
tree | 5649a330f47e05066eb3f93f7d5d2eec78605231 /drivers | |
parent | 78f84e1a7028a77b72aebc769642a5e93d32b4f9 (diff) |
qlcnic: mark device state as failed
Mark device state failed in error path.
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index 6a8e9702c7b7..6e246c819204 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
@@ -94,7 +94,7 @@ static void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter); | |||
94 | static void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter); | 94 | static void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter); |
95 | 95 | ||
96 | static void qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding); | 96 | static void qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding); |
97 | static void qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter); | 97 | static void qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter, u8); |
98 | static int qlcnic_can_start_firmware(struct qlcnic_adapter *adapter); | 98 | static int qlcnic_can_start_firmware(struct qlcnic_adapter *adapter); |
99 | 99 | ||
100 | static irqreturn_t qlcnic_tmp_intr(int irq, void *data); | 100 | static irqreturn_t qlcnic_tmp_intr(int irq, void *data); |
@@ -1561,7 +1561,7 @@ err_out_disable_msi: | |||
1561 | qlcnic_teardown_intr(adapter); | 1561 | qlcnic_teardown_intr(adapter); |
1562 | 1562 | ||
1563 | err_out_decr_ref: | 1563 | err_out_decr_ref: |
1564 | qlcnic_clr_all_drv_state(adapter); | 1564 | qlcnic_clr_all_drv_state(adapter, 0); |
1565 | 1565 | ||
1566 | err_out_iounmap: | 1566 | err_out_iounmap: |
1567 | qlcnic_cleanup_pci_map(adapter); | 1567 | qlcnic_cleanup_pci_map(adapter); |
@@ -1600,7 +1600,7 @@ static void __devexit qlcnic_remove(struct pci_dev *pdev) | |||
1600 | if (adapter->eswitch != NULL) | 1600 | if (adapter->eswitch != NULL) |
1601 | kfree(adapter->eswitch); | 1601 | kfree(adapter->eswitch); |
1602 | 1602 | ||
1603 | qlcnic_clr_all_drv_state(adapter); | 1603 | qlcnic_clr_all_drv_state(adapter, 0); |
1604 | 1604 | ||
1605 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | 1605 | clear_bit(__QLCNIC_RESETTING, &adapter->state); |
1606 | 1606 | ||
@@ -1632,7 +1632,7 @@ static int __qlcnic_shutdown(struct pci_dev *pdev) | |||
1632 | if (netif_running(netdev)) | 1632 | if (netif_running(netdev)) |
1633 | qlcnic_down(adapter, netdev); | 1633 | qlcnic_down(adapter, netdev); |
1634 | 1634 | ||
1635 | qlcnic_clr_all_drv_state(adapter); | 1635 | qlcnic_clr_all_drv_state(adapter, 0); |
1636 | 1636 | ||
1637 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | 1637 | clear_bit(__QLCNIC_RESETTING, &adapter->state); |
1638 | 1638 | ||
@@ -2379,7 +2379,7 @@ qlcnic_clr_drv_state(struct qlcnic_adapter *adapter) | |||
2379 | } | 2379 | } |
2380 | 2380 | ||
2381 | static void | 2381 | static void |
2382 | qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter) | 2382 | qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter, u8 failed) |
2383 | { | 2383 | { |
2384 | u32 val; | 2384 | u32 val; |
2385 | 2385 | ||
@@ -2390,7 +2390,11 @@ qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter) | |||
2390 | QLC_DEV_CLR_REF_CNT(val, adapter->portnum); | 2390 | QLC_DEV_CLR_REF_CNT(val, adapter->portnum); |
2391 | QLCWR32(adapter, QLCNIC_CRB_DEV_REF_COUNT, val); | 2391 | QLCWR32(adapter, QLCNIC_CRB_DEV_REF_COUNT, val); |
2392 | 2392 | ||
2393 | if (!(val & 0x11111111)) | 2393 | if (failed) { |
2394 | QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_FAILED); | ||
2395 | dev_info(&adapter->pdev->dev, | ||
2396 | "Device state set to Failed. Please Reboot\n"); | ||
2397 | } else if (!(val & 0x11111111)) | ||
2394 | QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_COLD); | 2398 | QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_COLD); |
2395 | 2399 | ||
2396 | val = QLCRD32(adapter, QLCNIC_CRB_DRV_STATE); | 2400 | val = QLCRD32(adapter, QLCNIC_CRB_DRV_STATE); |
@@ -2605,7 +2609,7 @@ err_ret: | |||
2605 | dev_err(&adapter->pdev->dev, "Fwinit work failed state=%u " | 2609 | dev_err(&adapter->pdev->dev, "Fwinit work failed state=%u " |
2606 | "fw_wait_cnt=%u\n", dev_state, adapter->fw_wait_cnt); | 2610 | "fw_wait_cnt=%u\n", dev_state, adapter->fw_wait_cnt); |
2607 | netif_device_attach(adapter->netdev); | 2611 | netif_device_attach(adapter->netdev); |
2608 | qlcnic_clr_all_drv_state(adapter); | 2612 | qlcnic_clr_all_drv_state(adapter, 0); |
2609 | } | 2613 | } |
2610 | 2614 | ||
2611 | static void | 2615 | static void |
@@ -2641,8 +2645,7 @@ err_ret: | |||
2641 | dev_err(&adapter->pdev->dev, "detach failed; status=%d temp=%d\n", | 2645 | dev_err(&adapter->pdev->dev, "detach failed; status=%d temp=%d\n", |
2642 | status, adapter->temp); | 2646 | status, adapter->temp); |
2643 | netif_device_attach(netdev); | 2647 | netif_device_attach(netdev); |
2644 | qlcnic_clr_all_drv_state(adapter); | 2648 | qlcnic_clr_all_drv_state(adapter, 1); |
2645 | |||
2646 | } | 2649 | } |
2647 | 2650 | ||
2648 | /*Transit NPAR state to NON Operational */ | 2651 | /*Transit NPAR state to NON Operational */ |
@@ -2879,7 +2882,7 @@ static int qlcnic_attach_func(struct pci_dev *pdev) | |||
2879 | if (netif_running(netdev)) { | 2882 | if (netif_running(netdev)) { |
2880 | err = qlcnic_attach(adapter); | 2883 | err = qlcnic_attach(adapter); |
2881 | if (err) { | 2884 | if (err) { |
2882 | qlcnic_clr_all_drv_state(adapter); | 2885 | qlcnic_clr_all_drv_state(adapter, 1); |
2883 | clear_bit(__QLCNIC_AER, &adapter->state); | 2886 | clear_bit(__QLCNIC_AER, &adapter->state); |
2884 | netif_device_attach(netdev); | 2887 | netif_device_attach(netdev); |
2885 | return err; | 2888 | return err; |