diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2012-02-09 14:14:05 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-02-18 09:43:26 -0500 |
commit | d051a5aa1c234c8de01fc0a488b1a18d65246150 (patch) | |
tree | 14e7e4e863383e8268c4a8d33749942ee47d37f0 /drivers/scsi | |
parent | aa651be83dfec5587dabce0a9d471c1e2095c33e (diff) |
[SCSI] qla2xxx: Add an "is reset active" helper.
Many locations within the driver would use an inconsistent set of
checks to determine ISP-reset state. Consolidate the checks into
this inline-helper.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 13 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_bsg.c | 50 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_dbg.c | 3 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_inline.h | 13 |
4 files changed, 28 insertions, 51 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index a2f1b3043dfb..9f41b3b4358f 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -1036,8 +1036,7 @@ qla2x00_link_state_show(struct device *dev, struct device_attribute *attr, | |||
1036 | vha->device_flags & DFLG_NO_CABLE) | 1036 | vha->device_flags & DFLG_NO_CABLE) |
1037 | len = snprintf(buf, PAGE_SIZE, "Link Down\n"); | 1037 | len = snprintf(buf, PAGE_SIZE, "Link Down\n"); |
1038 | else if (atomic_read(&vha->loop_state) != LOOP_READY || | 1038 | else if (atomic_read(&vha->loop_state) != LOOP_READY || |
1039 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | 1039 | qla2x00_reset_active(vha)) |
1040 | test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) | ||
1041 | len = snprintf(buf, PAGE_SIZE, "Unknown Link State\n"); | 1040 | len = snprintf(buf, PAGE_SIZE, "Unknown Link State\n"); |
1042 | else { | 1041 | else { |
1043 | len = snprintf(buf, PAGE_SIZE, "Link Up - "); | 1042 | len = snprintf(buf, PAGE_SIZE, "Link Up - "); |
@@ -1359,8 +1358,7 @@ qla2x00_thermal_temp_show(struct device *dev, | |||
1359 | return snprintf(buf, PAGE_SIZE, "\n"); | 1358 | return snprintf(buf, PAGE_SIZE, "\n"); |
1360 | 1359 | ||
1361 | temp = frac = 0; | 1360 | temp = frac = 0; |
1362 | if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | 1361 | if (qla2x00_reset_active(vha)) |
1363 | test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) | ||
1364 | ql_log(ql_log_warn, vha, 0x707b, | 1362 | ql_log(ql_log_warn, vha, 0x707b, |
1365 | "ISP reset active.\n"); | 1363 | "ISP reset active.\n"); |
1366 | else if (!vha->hw->flags.eeh_busy) | 1364 | else if (!vha->hw->flags.eeh_busy) |
@@ -1379,8 +1377,7 @@ qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr, | |||
1379 | int rval = QLA_FUNCTION_FAILED; | 1377 | int rval = QLA_FUNCTION_FAILED; |
1380 | uint16_t state[5]; | 1378 | uint16_t state[5]; |
1381 | 1379 | ||
1382 | if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | 1380 | if (qla2x00_reset_active(vha)) |
1383 | test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) | ||
1384 | ql_log(ql_log_warn, vha, 0x707c, | 1381 | ql_log(ql_log_warn, vha, 0x707c, |
1385 | "ISP reset active.\n"); | 1382 | "ISP reset active.\n"); |
1386 | else if (!vha->hw->flags.eeh_busy) | 1383 | else if (!vha->hw->flags.eeh_busy) |
@@ -1693,9 +1690,7 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) | |||
1693 | if (IS_FWI2_CAPABLE(ha)) { | 1690 | if (IS_FWI2_CAPABLE(ha)) { |
1694 | rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma); | 1691 | rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma); |
1695 | } else if (atomic_read(&base_vha->loop_state) == LOOP_READY && | 1692 | } else if (atomic_read(&base_vha->loop_state) == LOOP_READY && |
1696 | !test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) && | 1693 | !qla2x00_reset_active(vha) && !ha->dpc_active) { |
1697 | !test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) && | ||
1698 | !ha->dpc_active) { | ||
1699 | /* Must be in a 'READY' state for statistics retrieval. */ | 1694 | /* Must be in a 'READY' state for statistics retrieval. */ |
1700 | rval = qla2x00_get_link_status(base_vha, base_vha->loop_id, | 1695 | rval = qla2x00_get_link_status(base_vha, base_vha->loop_id, |
1701 | stats, stats_dma); | 1696 | stats, stats_dma); |
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index b1d0f936bf2d..1682e2e4201d 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c | |||
@@ -108,13 +108,6 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) | |||
108 | goto exit_fcp_prio_cfg; | 108 | goto exit_fcp_prio_cfg; |
109 | } | 109 | } |
110 | 110 | ||
111 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
112 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | ||
113 | test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | ||
114 | ret = -EBUSY; | ||
115 | goto exit_fcp_prio_cfg; | ||
116 | } | ||
117 | |||
118 | /* Get the sub command */ | 111 | /* Get the sub command */ |
119 | oper = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; | 112 | oper = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; |
120 | 113 | ||
@@ -646,13 +639,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
646 | dma_addr_t rsp_data_dma; | 639 | dma_addr_t rsp_data_dma; |
647 | uint32_t rsp_data_len; | 640 | uint32_t rsp_data_len; |
648 | 641 | ||
649 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
650 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | ||
651 | test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | ||
652 | ql_log(ql_log_warn, vha, 0x7018, "Abort active or needed.\n"); | ||
653 | return -EBUSY; | ||
654 | } | ||
655 | |||
656 | if (!vha->flags.online) { | 642 | if (!vha->flags.online) { |
657 | ql_log(ql_log_warn, vha, 0x7019, "Host is not online.\n"); | 643 | ql_log(ql_log_warn, vha, 0x7019, "Host is not online.\n"); |
658 | return -EIO; | 644 | return -EIO; |
@@ -874,13 +860,6 @@ qla84xx_reset(struct fc_bsg_job *bsg_job) | |||
874 | int rval = 0; | 860 | int rval = 0; |
875 | uint32_t flag; | 861 | uint32_t flag; |
876 | 862 | ||
877 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
878 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | ||
879 | test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | ||
880 | ql_log(ql_log_warn, vha, 0x702e, "Abort active or needed.\n"); | ||
881 | return -EBUSY; | ||
882 | } | ||
883 | |||
884 | if (!IS_QLA84XX(ha)) { | 863 | if (!IS_QLA84XX(ha)) { |
885 | ql_dbg(ql_dbg_user, vha, 0x702f, "Not 84xx, exiting.\n"); | 864 | ql_dbg(ql_dbg_user, vha, 0x702f, "Not 84xx, exiting.\n"); |
886 | return -EINVAL; | 865 | return -EINVAL; |
@@ -922,11 +901,6 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job) | |||
922 | uint32_t flag; | 901 | uint32_t flag; |
923 | uint32_t fw_ver; | 902 | uint32_t fw_ver; |
924 | 903 | ||
925 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
926 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | ||
927 | test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) | ||
928 | return -EBUSY; | ||
929 | |||
930 | if (!IS_QLA84XX(ha)) { | 904 | if (!IS_QLA84XX(ha)) { |
931 | ql_dbg(ql_dbg_user, vha, 0x7032, | 905 | ql_dbg(ql_dbg_user, vha, 0x7032, |
932 | "Not 84xx, exiting.\n"); | 906 | "Not 84xx, exiting.\n"); |
@@ -1036,14 +1010,6 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) | |||
1036 | uint32_t data_len = 0; | 1010 | uint32_t data_len = 0; |
1037 | uint32_t dma_direction = DMA_NONE; | 1011 | uint32_t dma_direction = DMA_NONE; |
1038 | 1012 | ||
1039 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
1040 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | ||
1041 | test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | ||
1042 | ql_log(ql_log_warn, vha, 0x7039, | ||
1043 | "Abort active or needed.\n"); | ||
1044 | return -EBUSY; | ||
1045 | } | ||
1046 | |||
1047 | if (!IS_QLA84XX(ha)) { | 1013 | if (!IS_QLA84XX(ha)) { |
1048 | ql_log(ql_log_warn, vha, 0x703a, | 1014 | ql_log(ql_log_warn, vha, 0x703a, |
1049 | "Not 84xx, exiting.\n"); | 1015 | "Not 84xx, exiting.\n"); |
@@ -1246,13 +1212,6 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job) | |||
1246 | 1212 | ||
1247 | bsg_job->reply->reply_payload_rcv_len = 0; | 1213 | bsg_job->reply->reply_payload_rcv_len = 0; |
1248 | 1214 | ||
1249 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
1250 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | ||
1251 | test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | ||
1252 | ql_log(ql_log_warn, vha, 0x7045, "abort active or needed.\n"); | ||
1253 | return -EBUSY; | ||
1254 | } | ||
1255 | |||
1256 | if (!IS_IIDMA_CAPABLE(vha->hw)) { | 1215 | if (!IS_IIDMA_CAPABLE(vha->hw)) { |
1257 | ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n"); | 1216 | ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n"); |
1258 | return -EINVAL; | 1217 | return -EINVAL; |
@@ -1668,6 +1627,15 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job) | |||
1668 | vha = shost_priv(host); | 1627 | vha = shost_priv(host); |
1669 | } | 1628 | } |
1670 | 1629 | ||
1630 | if (qla2x00_reset_active(vha)) { | ||
1631 | ql_dbg(ql_dbg_user, vha, 0x709f, | ||
1632 | "BSG: ISP abort active/needed -- cmd=%d.\n", | ||
1633 | bsg_job->request->msgcode); | ||
1634 | bsg_job->reply->result = (DID_ERROR << 16); | ||
1635 | bsg_job->job_done(bsg_job); | ||
1636 | return -EBUSY; | ||
1637 | } | ||
1638 | |||
1671 | ql_dbg(ql_dbg_user, vha, 0x7000, | 1639 | ql_dbg(ql_dbg_user, vha, 0x7000, |
1672 | "Entered %s msgcode=0x%x.\n", __func__, bsg_job->request->msgcode); | 1640 | "Entered %s msgcode=0x%x.\n", __func__, bsg_job->request->msgcode); |
1673 | 1641 | ||
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 7c54624b5b13..45cbf0ba624d 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c | |||
@@ -19,7 +19,8 @@ | |||
19 | * | DPC Thread | 0x401c | | | 19 | * | DPC Thread | 0x401c | | |
20 | * | Async Events | 0x5057 | 0x5052 | | 20 | * | Async Events | 0x5057 | 0x5052 | |
21 | * | Timer Routines | 0x6011 | 0x600e,0x600f | | 21 | * | Timer Routines | 0x6011 | 0x600e,0x600f | |
22 | * | User Space Interactions | 0x709e | | | 22 | * | User Space Interactions | 0x709e | 0x7018,0x702e | |
23 | * | | | 0x7039,0x7045 | | ||
23 | * | Task Management | 0x803c | 0x8025-0x8026 | | 24 | * | Task Management | 0x803c | 0x8025-0x8026 | |
24 | * | | | 0x800b,0x8039 | | 25 | * | | | 0x800b,0x8039 | |
25 | * | AER/EEH | 0x900f | | | 26 | * | AER/EEH | 0x900f | | |
diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index 9902834e0b74..7cc4f36cd539 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h | |||
@@ -131,3 +131,16 @@ qla2x00_hba_err_chk_enabled(srb_t *sp) | |||
131 | } | 131 | } |
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | |||
135 | static inline int | ||
136 | qla2x00_reset_active(scsi_qla_host_t *vha) | ||
137 | { | ||
138 | scsi_qla_host_t *base_vha = pci_get_drvdata(vha->hw->pdev); | ||
139 | |||
140 | /* Test appropriate base-vha and vha flags. */ | ||
141 | return test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) || | ||
142 | test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || | ||
143 | test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || | ||
144 | test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
145 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); | ||
146 | } | ||