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 /drivers/scsi/qla2xxx/qla_os.c | |
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>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 41 |
1 files changed, 7 insertions, 34 deletions
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 | ||