diff options
author | Giridhar Malavali <giridhar.malavali@qlogic.com> | 2010-07-23 06:28:35 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-28 10:06:15 -0400 |
commit | 4d78c973ef2d21e90ff55f97489d663a0959a93f (patch) | |
tree | 5d82916649e2578d1baad596a7d20bf951a5ed6f | |
parent | 3711333dfbeec1905c2d3521d1ed2ddcdbdbac04 (diff) |
[SCSI] qla2xxx: Rearranged and cleaned up the code for processing the pending commands.
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r-- | drivers/scsi/qla2xxx/qla_def.h | 10 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_gbl.h | 5 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 9 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 41 |
4 files changed, 25 insertions, 40 deletions
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 7e11ccf0fe81..84e9c6b48ca3 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -2981,9 +2981,15 @@ typedef struct scsi_qla_host { | |||
2981 | 2981 | ||
2982 | #define QLA_DSDS_PER_IOCB 37 | 2982 | #define QLA_DSDS_PER_IOCB 37 |
2983 | 2983 | ||
2984 | #define CMD_SP(Cmnd) ((Cmnd)->SCp.ptr) | ||
2985 | |||
2986 | enum nexus_wait_type { | ||
2987 | WAIT_HOST = 0, | ||
2988 | WAIT_TARGET, | ||
2989 | WAIT_LUN, | ||
2990 | }; | ||
2991 | |||
2984 | #include "qla_gbl.h" | 2992 | #include "qla_gbl.h" |
2985 | #include "qla_dbg.h" | 2993 | #include "qla_dbg.h" |
2986 | #include "qla_inline.h" | 2994 | #include "qla_inline.h" |
2987 | |||
2988 | #define CMD_SP(Cmnd) ((Cmnd)->SCp.ptr) | ||
2989 | #endif | 2995 | #endif |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 8b0a8ca95086..4688ad2a559e 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -292,7 +292,9 @@ extern int | |||
292 | qla24xx_abort_target(struct fc_port *, unsigned int, int); | 292 | qla24xx_abort_target(struct fc_port *, unsigned int, int); |
293 | extern int | 293 | extern int |
294 | qla24xx_lun_reset(struct fc_port *, unsigned int, int); | 294 | qla24xx_lun_reset(struct fc_port *, unsigned int, int); |
295 | 295 | extern int | |
296 | qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *, unsigned int, | ||
297 | unsigned int, enum nexus_wait_type); | ||
296 | extern int | 298 | extern int |
297 | qla2x00_system_error(scsi_qla_host_t *); | 299 | qla2x00_system_error(scsi_qla_host_t *); |
298 | 300 | ||
@@ -569,7 +571,6 @@ extern int qla82xx_mbx_intr_enable(scsi_qla_host_t *); | |||
569 | extern int qla82xx_mbx_intr_disable(scsi_qla_host_t *); | 571 | extern int qla82xx_mbx_intr_disable(scsi_qla_host_t *); |
570 | extern void qla82xx_start_iocbs(srb_t *); | 572 | extern void qla82xx_start_iocbs(srb_t *); |
571 | extern int qla82xx_fcoe_ctx_reset(scsi_qla_host_t *); | 573 | extern int qla82xx_fcoe_ctx_reset(scsi_qla_host_t *); |
572 | extern void qla82xx_wait_for_pending_commands(scsi_qla_host_t *); | ||
573 | 574 | ||
574 | /* BSG related functions */ | 575 | /* BSG related functions */ |
575 | extern int qla24xx_bsg_request(struct fc_bsg_job *); | 576 | extern int qla24xx_bsg_request(struct fc_bsg_job *); |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index f6b1052a3834..9b58a79c4ae5 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -3833,8 +3833,13 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha) | |||
3833 | } | 3833 | } |
3834 | 3834 | ||
3835 | /* Make sure for ISP 82XX IO DMA is complete */ | 3835 | /* Make sure for ISP 82XX IO DMA is complete */ |
3836 | if (IS_QLA82XX(ha)) | 3836 | if (IS_QLA82XX(ha)) { |
3837 | qla82xx_wait_for_pending_commands(vha); | 3837 | if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, |
3838 | WAIT_HOST) == QLA_SUCCESS) { | ||
3839 | DEBUG2(qla_printk(KERN_INFO, ha, | ||
3840 | "Done wait for pending commands\n")); | ||
3841 | } | ||
3842 | } | ||
3838 | 3843 | ||
3839 | /* Requeue all commands in outstanding command list. */ | 3844 | /* Requeue all commands in outstanding command list. */ |
3840 | qla2x00_abort_all_cmds(vha, DID_RESET << 16); | 3845 | qla2x00_abort_all_cmds(vha, DID_RESET << 16); |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index fcdbf7a0be55..86d352ab9c58 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -903,24 +903,17 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
903 | return ret; | 903 | return ret; |
904 | } | 904 | } |
905 | 905 | ||
906 | enum nexus_wait_type { | 906 | int |
907 | WAIT_HOST = 0, | ||
908 | WAIT_TARGET, | ||
909 | WAIT_LUN, | ||
910 | }; | ||
911 | |||
912 | static int | ||
913 | qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t, | 907 | qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t, |
914 | unsigned int l, srb_t *sp, enum nexus_wait_type type) | 908 | unsigned int l, enum nexus_wait_type type) |
915 | { | 909 | { |
916 | int cnt, match, status; | 910 | int cnt, match, status; |
917 | unsigned long flags; | 911 | unsigned long flags; |
918 | struct qla_hw_data *ha = vha->hw; | 912 | struct qla_hw_data *ha = vha->hw; |
919 | struct req_que *req; | 913 | struct req_que *req; |
914 | srb_t *sp; | ||
920 | 915 | ||
921 | status = QLA_SUCCESS; | 916 | status = QLA_SUCCESS; |
922 | if (!sp) | ||
923 | return status; | ||
924 | 917 | ||
925 | spin_lock_irqsave(&ha->hardware_lock, flags); | 918 | spin_lock_irqsave(&ha->hardware_lock, flags); |
926 | req = vha->req; | 919 | req = vha->req; |
@@ -958,24 +951,6 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t, | |||
958 | return status; | 951 | return status; |
959 | } | 952 | } |
960 | 953 | ||
961 | void qla82xx_wait_for_pending_commands(scsi_qla_host_t *vha) | ||
962 | { | ||
963 | int cnt; | ||
964 | srb_t *sp; | ||
965 | struct req_que *req = vha->req; | ||
966 | |||
967 | DEBUG2(qla_printk(KERN_INFO, vha->hw, | ||
968 | "Waiting for pending commands\n")); | ||
969 | for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { | ||
970 | sp = req->outstanding_cmds[cnt]; | ||
971 | if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, | ||
972 | sp, WAIT_HOST) == QLA_SUCCESS) { | ||
973 | DEBUG2(qla_printk(KERN_INFO, vha->hw, | ||
974 | "Done wait for pending commands\n")); | ||
975 | } | ||
976 | } | ||
977 | } | ||
978 | |||
979 | static char *reset_errors[] = { | 954 | static char *reset_errors[] = { |
980 | "HBA not online", | 955 | "HBA not online", |
981 | "HBA not ready", | 956 | "HBA not ready", |
@@ -1011,7 +986,7 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, | |||
1011 | goto eh_reset_failed; | 986 | goto eh_reset_failed; |
1012 | err = 3; | 987 | err = 3; |
1013 | if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id, | 988 | if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id, |
1014 | cmd->device->lun, (srb_t *) CMD_SP(cmd), type) != QLA_SUCCESS) | 989 | cmd->device->lun, type) != QLA_SUCCESS) |
1015 | goto eh_reset_failed; | 990 | goto eh_reset_failed; |
1016 | 991 | ||
1017 | qla_printk(KERN_INFO, vha->hw, "scsi(%ld:%d:%d): %s RESET SUCCEEDED.\n", | 992 | qla_printk(KERN_INFO, vha->hw, "scsi(%ld:%d:%d): %s RESET SUCCEEDED.\n", |
@@ -1019,7 +994,7 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, | |||
1019 | 994 | ||
1020 | return SUCCESS; | 995 | return SUCCESS; |
1021 | 996 | ||
1022 | eh_reset_failed: | 997 | eh_reset_failed: |
1023 | qla_printk(KERN_INFO, vha->hw, "scsi(%ld:%d:%d): %s RESET FAILED: %s.\n" | 998 | qla_printk(KERN_INFO, vha->hw, "scsi(%ld:%d:%d): %s RESET FAILED: %s.\n" |
1024 | , vha->host_no, cmd->device->id, cmd->device->lun, name, | 999 | , vha->host_no, cmd->device->id, cmd->device->lun, name, |
1025 | reset_errors[err]); | 1000 | reset_errors[err]); |
@@ -1069,7 +1044,6 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) | |||
1069 | int ret = FAILED; | 1044 | int ret = FAILED; |
1070 | unsigned int id, lun; | 1045 | unsigned int id, lun; |
1071 | unsigned long serial; | 1046 | unsigned long serial; |
1072 | srb_t *sp = (srb_t *) CMD_SP(cmd); | ||
1073 | 1047 | ||
1074 | fc_block_scsi_eh(cmd); | 1048 | fc_block_scsi_eh(cmd); |
1075 | 1049 | ||
@@ -1096,7 +1070,7 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) | |||
1096 | goto eh_bus_reset_done; | 1070 | goto eh_bus_reset_done; |
1097 | 1071 | ||
1098 | /* Flush outstanding commands. */ | 1072 | /* Flush outstanding commands. */ |
1099 | if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, sp, WAIT_HOST) != | 1073 | if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, WAIT_HOST) != |
1100 | QLA_SUCCESS) | 1074 | QLA_SUCCESS) |
1101 | ret = FAILED; | 1075 | ret = FAILED; |
1102 | 1076 | ||
@@ -1131,7 +1105,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
1131 | int ret = FAILED; | 1105 | int ret = FAILED; |
1132 | unsigned int id, lun; | 1106 | unsigned int id, lun; |
1133 | unsigned long serial; | 1107 | unsigned long serial; |
1134 | srb_t *sp = (srb_t *) CMD_SP(cmd); | ||
1135 | scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); | 1108 | scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); |
1136 | 1109 | ||
1137 | fc_block_scsi_eh(cmd); | 1110 | fc_block_scsi_eh(cmd); |
@@ -1186,7 +1159,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
1186 | } | 1159 | } |
1187 | 1160 | ||
1188 | /* Waiting for command to be returned to OS.*/ | 1161 | /* Waiting for command to be returned to OS.*/ |
1189 | if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, sp, WAIT_HOST) == | 1162 | if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, WAIT_HOST) == |
1190 | QLA_SUCCESS) | 1163 | QLA_SUCCESS) |
1191 | ret = SUCCESS; | 1164 | ret = SUCCESS; |
1192 | 1165 | ||