diff options
author | Nilesh Javali <nilesh.javali@qlogic.com> | 2013-12-16 06:49:31 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2014-03-15 13:19:11 -0400 |
commit | 37418cc61d0d71fc576bb49694d978c8e94e6e23 (patch) | |
tree | 4961b97feadfbc093e287d8b5acb898935c348ad /drivers/scsi/qla4xxx | |
parent | 864cb48d1a91e2e4fa3260514f5a19c3356fb8fe (diff) |
[SCSI] qla4xxx: ISP8xxx: Correct retry of adapter initialization
Issue:
For ISP8xxx, adapter initialization is not retried if
qla4xxx_initialize_adapter fails.
Fix:
If qla4xxx_initialize_adapter fails, first check if failure is due to IRQs not
attached in order to skip retrial, then free the IRQs and then retry
initializing the adapter.
Signed-off-by: Nilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/qla4xxx')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_glbl.h | 1 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_init.c | 7 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_nx.c | 21 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_os.c | 27 |
4 files changed, 45 insertions, 11 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h index d67c50e0b896..6d72e1dde19f 100644 --- a/drivers/scsi/qla4xxx/ql4_glbl.h +++ b/drivers/scsi/qla4xxx/ql4_glbl.h | |||
@@ -279,6 +279,7 @@ int qla4_83xx_ms_mem_write_128b(struct scsi_qla_host *ha, | |||
279 | uint8_t qla4xxx_set_ipaddr_state(uint8_t fw_ipaddr_state); | 279 | uint8_t qla4xxx_set_ipaddr_state(uint8_t fw_ipaddr_state); |
280 | int qla4_83xx_get_port_config(struct scsi_qla_host *ha, uint32_t *config); | 280 | int qla4_83xx_get_port_config(struct scsi_qla_host *ha, uint32_t *config); |
281 | int qla4_83xx_set_port_config(struct scsi_qla_host *ha, uint32_t *config); | 281 | int qla4_83xx_set_port_config(struct scsi_qla_host *ha, uint32_t *config); |
282 | int qla4_8xxx_check_init_adapter_retry(struct scsi_qla_host *ha); | ||
282 | 283 | ||
283 | extern int ql4xextended_error_logging; | 284 | extern int ql4xextended_error_logging; |
284 | extern int ql4xdontresethba; | 285 | extern int ql4xdontresethba; |
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c index 7456eeb2e58a..28fbece7e08f 100644 --- a/drivers/scsi/qla4xxx/ql4_init.c +++ b/drivers/scsi/qla4xxx/ql4_init.c | |||
@@ -959,13 +959,8 @@ int qla4xxx_initialize_adapter(struct scsi_qla_host *ha, int is_reset) | |||
959 | qla4xxx_build_ddb_list(ha, is_reset); | 959 | qla4xxx_build_ddb_list(ha, is_reset); |
960 | 960 | ||
961 | set_bit(AF_ONLINE, &ha->flags); | 961 | set_bit(AF_ONLINE, &ha->flags); |
962 | exit_init_hba: | ||
963 | if (is_qla80XX(ha) && (status == QLA_ERROR)) { | ||
964 | /* Since interrupts are registered in start_firmware for | ||
965 | * 80XX, release them here if initialize_adapter fails */ | ||
966 | qla4xxx_free_irqs(ha); | ||
967 | } | ||
968 | 962 | ||
963 | exit_init_hba: | ||
969 | DEBUG2(printk("scsi%ld: initialize adapter: %s\n", ha->host_no, | 964 | DEBUG2(printk("scsi%ld: initialize adapter: %s\n", ha->host_no, |
970 | status == QLA_ERROR ? "FAILED" : "SUCCEEDED")); | 965 | status == QLA_ERROR ? "FAILED" : "SUCCEEDED")); |
971 | return status; | 966 | return status; |
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c index d001202d3565..bbe836146837 100644 --- a/drivers/scsi/qla4xxx/ql4_nx.c +++ b/drivers/scsi/qla4xxx/ql4_nx.c | |||
@@ -3836,3 +3836,24 @@ qla4_8xxx_enable_msix(struct scsi_qla_host *ha) | |||
3836 | msix_out: | 3836 | msix_out: |
3837 | return ret; | 3837 | return ret; |
3838 | } | 3838 | } |
3839 | |||
3840 | int qla4_8xxx_check_init_adapter_retry(struct scsi_qla_host *ha) | ||
3841 | { | ||
3842 | int status = QLA_SUCCESS; | ||
3843 | |||
3844 | /* Dont retry adapter initialization if IRQ allocation failed */ | ||
3845 | if (!test_bit(AF_IRQ_ATTACHED, &ha->flags)) { | ||
3846 | ql4_printk(KERN_WARNING, ha, "%s: Skipping retry of adapter initialization as IRQs are not attached\n", | ||
3847 | __func__); | ||
3848 | status = QLA_ERROR; | ||
3849 | goto exit_init_adapter_failure; | ||
3850 | } | ||
3851 | |||
3852 | /* Since interrupts are registered in start_firmware for | ||
3853 | * 8xxx, release them here if initialize_adapter fails | ||
3854 | * and retry adapter initialization */ | ||
3855 | qla4xxx_free_irqs(ha); | ||
3856 | |||
3857 | exit_init_adapter_failure: | ||
3858 | return status; | ||
3859 | } | ||
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index c21adc338cf1..9803c9e3bc39 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -4881,8 +4881,21 @@ recover_ha_init_adapter: | |||
4881 | ssleep(6); | 4881 | ssleep(6); |
4882 | 4882 | ||
4883 | /* NOTE: AF_ONLINE flag set upon successful completion of | 4883 | /* NOTE: AF_ONLINE flag set upon successful completion of |
4884 | * qla4xxx_initialize_adapter */ | 4884 | * qla4xxx_initialize_adapter */ |
4885 | status = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); | 4885 | status = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); |
4886 | if (is_qla80XX(ha) && (status == QLA_ERROR)) { | ||
4887 | status = qla4_8xxx_check_init_adapter_retry(ha); | ||
4888 | if (status == QLA_ERROR) { | ||
4889 | ql4_printk(KERN_INFO, ha, "scsi%ld: %s: Don't retry recover adapter\n", | ||
4890 | ha->host_no, __func__); | ||
4891 | qla4xxx_dead_adapter_cleanup(ha); | ||
4892 | clear_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags); | ||
4893 | clear_bit(DPC_RESET_HA, &ha->dpc_flags); | ||
4894 | clear_bit(DPC_RESET_HA_FW_CONTEXT, | ||
4895 | &ha->dpc_flags); | ||
4896 | goto exit_recover; | ||
4897 | } | ||
4898 | } | ||
4886 | } | 4899 | } |
4887 | 4900 | ||
4888 | /* Retry failed adapter initialization, if necessary | 4901 | /* Retry failed adapter initialization, if necessary |
@@ -8681,11 +8694,8 @@ static int qla4xxx_probe_adapter(struct pci_dev *pdev, | |||
8681 | status = qla4xxx_initialize_adapter(ha, INIT_ADAPTER); | 8694 | status = qla4xxx_initialize_adapter(ha, INIT_ADAPTER); |
8682 | 8695 | ||
8683 | /* Dont retry adapter initialization if IRQ allocation failed */ | 8696 | /* Dont retry adapter initialization if IRQ allocation failed */ |
8684 | if (is_qla80XX(ha) && !test_bit(AF_IRQ_ATTACHED, &ha->flags)) { | 8697 | if (is_qla80XX(ha) && (status == QLA_ERROR)) |
8685 | ql4_printk(KERN_WARNING, ha, "%s: Skipping retry of adapter initialization\n", | ||
8686 | __func__); | ||
8687 | goto skip_retry_init; | 8698 | goto skip_retry_init; |
8688 | } | ||
8689 | 8699 | ||
8690 | while ((!test_bit(AF_ONLINE, &ha->flags)) && | 8700 | while ((!test_bit(AF_ONLINE, &ha->flags)) && |
8691 | init_retry_count++ < MAX_INIT_RETRIES) { | 8701 | init_retry_count++ < MAX_INIT_RETRIES) { |
@@ -8709,6 +8719,10 @@ static int qla4xxx_probe_adapter(struct pci_dev *pdev, | |||
8709 | continue; | 8719 | continue; |
8710 | 8720 | ||
8711 | status = qla4xxx_initialize_adapter(ha, INIT_ADAPTER); | 8721 | status = qla4xxx_initialize_adapter(ha, INIT_ADAPTER); |
8722 | if (is_qla80XX(ha) && (status == QLA_ERROR)) { | ||
8723 | if (qla4_8xxx_check_init_adapter_retry(ha) == QLA_ERROR) | ||
8724 | goto skip_retry_init; | ||
8725 | } | ||
8712 | } | 8726 | } |
8713 | 8727 | ||
8714 | skip_retry_init: | 8728 | skip_retry_init: |
@@ -9615,6 +9629,7 @@ static uint32_t qla4_8xxx_error_recovery(struct scsi_qla_host *ha) | |||
9615 | if (rval != QLA_SUCCESS) { | 9629 | if (rval != QLA_SUCCESS) { |
9616 | ql4_printk(KERN_INFO, ha, "scsi%ld: %s: HW State: " | 9630 | ql4_printk(KERN_INFO, ha, "scsi%ld: %s: HW State: " |
9617 | "FAILED\n", ha->host_no, __func__); | 9631 | "FAILED\n", ha->host_no, __func__); |
9632 | qla4xxx_free_irqs(ha); | ||
9618 | ha->isp_ops->idc_lock(ha); | 9633 | ha->isp_ops->idc_lock(ha); |
9619 | qla4_8xxx_clear_drv_active(ha); | 9634 | qla4_8xxx_clear_drv_active(ha); |
9620 | qla4_8xxx_wr_direct(ha, QLA8XXX_CRB_DEV_STATE, | 9635 | qla4_8xxx_wr_direct(ha, QLA8XXX_CRB_DEV_STATE, |
@@ -9642,6 +9657,8 @@ static uint32_t qla4_8xxx_error_recovery(struct scsi_qla_host *ha) | |||
9642 | rval = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); | 9657 | rval = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); |
9643 | if (rval == QLA_SUCCESS) | 9658 | if (rval == QLA_SUCCESS) |
9644 | ha->isp_ops->enable_intrs(ha); | 9659 | ha->isp_ops->enable_intrs(ha); |
9660 | else | ||
9661 | qla4xxx_free_irqs(ha); | ||
9645 | 9662 | ||
9646 | ha->isp_ops->idc_lock(ha); | 9663 | ha->isp_ops->idc_lock(ha); |
9647 | qla4_8xxx_set_drv_active(ha); | 9664 | qla4_8xxx_set_drv_active(ha); |