diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2010-05-04 18:01:25 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-05-16 18:21:44 -0400 |
commit | 99b0bec7bbf3350d1a920a7138fa62c456a8ecf1 (patch) | |
tree | 89e2265ec02f650e11a3ae8c53bcba295f9b3f76 /drivers/scsi/qla2xxx/qla_isr.c | |
parent | 6a03b4cd78f3f2695a2d0e6343d555b3de0e67c1 (diff) |
[SCSI] qla2xxx: Further generalization of SRB CTX infrastructure.
Prepare CTX infrastructure for additional asynchronous
executions, add generic done() operator, pull CMD definitions.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
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_isr.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_isr.c | 74 |
1 files changed, 21 insertions, 53 deletions
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index f1ac62d505d1..037bc41eef57 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -895,34 +895,20 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
895 | { | 895 | { |
896 | const char func[] = "MBX-IOCB"; | 896 | const char func[] = "MBX-IOCB"; |
897 | const char *type; | 897 | const char *type; |
898 | struct qla_hw_data *ha = vha->hw; | ||
899 | fc_port_t *fcport; | 898 | fc_port_t *fcport; |
900 | srb_t *sp; | 899 | srb_t *sp; |
901 | struct srb_logio *lio; | 900 | struct srb_logio *lio; |
902 | uint16_t data[2]; | 901 | uint16_t *data; |
903 | 902 | ||
904 | sp = qla2x00_get_sp_from_handle(vha, func, req, mbx); | 903 | sp = qla2x00_get_sp_from_handle(vha, func, req, mbx); |
905 | if (!sp) | 904 | if (!sp) |
906 | return; | 905 | return; |
907 | 906 | ||
908 | type = NULL; | ||
909 | lio = sp->ctx; | 907 | lio = sp->ctx; |
910 | switch (lio->ctx.type) { | ||
911 | case SRB_LOGIN_CMD: | ||
912 | type = "login"; | ||
913 | break; | ||
914 | case SRB_LOGOUT_CMD: | ||
915 | type = "logout"; | ||
916 | break; | ||
917 | default: | ||
918 | qla_printk(KERN_WARNING, ha, | ||
919 | "%s: Unrecognized SRB: (%p) type=%d.\n", func, sp, | ||
920 | lio->ctx.type); | ||
921 | return; | ||
922 | } | ||
923 | |||
924 | del_timer(&lio->ctx.timer); | 908 | del_timer(&lio->ctx.timer); |
909 | type = lio->ctx.name; | ||
925 | fcport = sp->fcport; | 910 | fcport = sp->fcport; |
911 | data = lio->data; | ||
926 | 912 | ||
927 | data[0] = data[1] = 0; | 913 | data[0] = data[1] = 0; |
928 | if (mbx->entry_status) { | 914 | if (mbx->entry_status) { |
@@ -938,7 +924,7 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
938 | data[0] = MBS_COMMAND_ERROR; | 924 | data[0] = MBS_COMMAND_ERROR; |
939 | data[1] = lio->flags & SRB_LOGIN_RETRIED ? | 925 | data[1] = lio->flags & SRB_LOGIN_RETRIED ? |
940 | QLA_LOGIO_LOGIN_RETRIED: 0; | 926 | QLA_LOGIO_LOGIN_RETRIED: 0; |
941 | goto done_post_logio_done_work; | 927 | goto logio_done; |
942 | } | 928 | } |
943 | 929 | ||
944 | if (!mbx->status && le16_to_cpu(mbx->mb0) == MBS_COMMAND_COMPLETE) { | 930 | if (!mbx->status && le16_to_cpu(mbx->mb0) == MBS_COMMAND_COMPLETE) { |
@@ -948,10 +934,14 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
948 | le16_to_cpu(mbx->mb1))); | 934 | le16_to_cpu(mbx->mb1))); |
949 | 935 | ||
950 | data[0] = MBS_COMMAND_COMPLETE; | 936 | data[0] = MBS_COMMAND_COMPLETE; |
951 | if (lio->ctx.type == SRB_LOGIN_CMD && le16_to_cpu(mbx->mb1) & BIT_1) | 937 | if (lio->ctx.type == SRB_LOGIN_CMD) |
952 | fcport->flags |= FCF_FCP2_DEVICE; | 938 | fcport->port_type = FCT_TARGET; |
939 | if (le16_to_cpu(mbx->mb1) & BIT_0) | ||
940 | fcport->port_type = FCT_INITIATOR; | ||
941 | if (le16_to_cpu(mbx->mb1) & BIT_1) | ||
942 | fcport->flags |= FCF_FCP2_DEVICE; | ||
953 | 943 | ||
954 | goto done_post_logio_done_work; | 944 | goto logio_done; |
955 | } | 945 | } |
956 | 946 | ||
957 | data[0] = le16_to_cpu(mbx->mb0); | 947 | data[0] = le16_to_cpu(mbx->mb0); |
@@ -976,12 +966,8 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
976 | le16_to_cpu(mbx->mb2), le16_to_cpu(mbx->mb6), | 966 | le16_to_cpu(mbx->mb2), le16_to_cpu(mbx->mb6), |
977 | le16_to_cpu(mbx->mb7))); | 967 | le16_to_cpu(mbx->mb7))); |
978 | 968 | ||
979 | done_post_logio_done_work: | 969 | logio_done: |
980 | lio->ctx.type == SRB_LOGIN_CMD ? | 970 | lio->ctx.done(sp); |
981 | qla2x00_post_async_login_done_work(fcport->vha, fcport, data): | ||
982 | qla2x00_post_async_logout_done_work(fcport->vha, fcport, data); | ||
983 | |||
984 | lio->ctx.free(sp); | ||
985 | } | 971 | } |
986 | 972 | ||
987 | static void | 973 | static void |
@@ -1084,35 +1070,21 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
1084 | { | 1070 | { |
1085 | const char func[] = "LOGIO-IOCB"; | 1071 | const char func[] = "LOGIO-IOCB"; |
1086 | const char *type; | 1072 | const char *type; |
1087 | struct qla_hw_data *ha = vha->hw; | ||
1088 | fc_port_t *fcport; | 1073 | fc_port_t *fcport; |
1089 | srb_t *sp; | 1074 | srb_t *sp; |
1090 | struct srb_logio *lio; | 1075 | struct srb_logio *lio; |
1091 | uint16_t data[2]; | 1076 | uint16_t *data; |
1092 | uint32_t iop[2]; | 1077 | uint32_t iop[2]; |
1093 | 1078 | ||
1094 | sp = qla2x00_get_sp_from_handle(vha, func, req, logio); | 1079 | sp = qla2x00_get_sp_from_handle(vha, func, req, logio); |
1095 | if (!sp) | 1080 | if (!sp) |
1096 | return; | 1081 | return; |
1097 | 1082 | ||
1098 | type = NULL; | ||
1099 | lio = sp->ctx; | 1083 | lio = sp->ctx; |
1100 | switch (lio->ctx.type) { | ||
1101 | case SRB_LOGIN_CMD: | ||
1102 | type = "login"; | ||
1103 | break; | ||
1104 | case SRB_LOGOUT_CMD: | ||
1105 | type = "logout"; | ||
1106 | break; | ||
1107 | default: | ||
1108 | qla_printk(KERN_WARNING, ha, | ||
1109 | "%s: Unrecognized SRB: (%p) type=%d.\n", func, sp, | ||
1110 | lio->ctx.type); | ||
1111 | return; | ||
1112 | } | ||
1113 | |||
1114 | del_timer(&lio->ctx.timer); | 1084 | del_timer(&lio->ctx.timer); |
1085 | type = lio->ctx.name; | ||
1115 | fcport = sp->fcport; | 1086 | fcport = sp->fcport; |
1087 | data = lio->data; | ||
1116 | 1088 | ||
1117 | data[0] = data[1] = 0; | 1089 | data[0] = data[1] = 0; |
1118 | if (logio->entry_status) { | 1090 | if (logio->entry_status) { |
@@ -1125,7 +1097,7 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
1125 | data[0] = MBS_COMMAND_ERROR; | 1097 | data[0] = MBS_COMMAND_ERROR; |
1126 | data[1] = lio->flags & SRB_LOGIN_RETRIED ? | 1098 | data[1] = lio->flags & SRB_LOGIN_RETRIED ? |
1127 | QLA_LOGIO_LOGIN_RETRIED: 0; | 1099 | QLA_LOGIO_LOGIN_RETRIED: 0; |
1128 | goto done_post_logio_done_work; | 1100 | goto logio_done; |
1129 | } | 1101 | } |
1130 | 1102 | ||
1131 | if (le16_to_cpu(logio->comp_status) == CS_COMPLETE) { | 1103 | if (le16_to_cpu(logio->comp_status) == CS_COMPLETE) { |
@@ -1136,7 +1108,7 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
1136 | 1108 | ||
1137 | data[0] = MBS_COMMAND_COMPLETE; | 1109 | data[0] = MBS_COMMAND_COMPLETE; |
1138 | if (lio->ctx.type == SRB_LOGOUT_CMD) | 1110 | if (lio->ctx.type == SRB_LOGOUT_CMD) |
1139 | goto done_post_logio_done_work; | 1111 | goto logio_done; |
1140 | 1112 | ||
1141 | iop[0] = le32_to_cpu(logio->io_parameter[0]); | 1113 | iop[0] = le32_to_cpu(logio->io_parameter[0]); |
1142 | if (iop[0] & BIT_4) { | 1114 | if (iop[0] & BIT_4) { |
@@ -1151,7 +1123,7 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
1151 | if (logio->io_parameter[9] || logio->io_parameter[10]) | 1123 | if (logio->io_parameter[9] || logio->io_parameter[10]) |
1152 | fcport->supported_classes |= FC_COS_CLASS3; | 1124 | fcport->supported_classes |= FC_COS_CLASS3; |
1153 | 1125 | ||
1154 | goto done_post_logio_done_work; | 1126 | goto logio_done; |
1155 | } | 1127 | } |
1156 | 1128 | ||
1157 | iop[0] = le32_to_cpu(logio->io_parameter[0]); | 1129 | iop[0] = le32_to_cpu(logio->io_parameter[0]); |
@@ -1184,12 +1156,8 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
1184 | le32_to_cpu(logio->io_parameter[0]), | 1156 | le32_to_cpu(logio->io_parameter[0]), |
1185 | le32_to_cpu(logio->io_parameter[1]))); | 1157 | le32_to_cpu(logio->io_parameter[1]))); |
1186 | 1158 | ||
1187 | done_post_logio_done_work: | 1159 | logio_done: |
1188 | lio->ctx.type == SRB_LOGIN_CMD ? | 1160 | lio->ctx.done(sp); |
1189 | qla2x00_post_async_login_done_work(fcport->vha, fcport, data): | ||
1190 | qla2x00_post_async_logout_done_work(fcport->vha, fcport, data); | ||
1191 | |||
1192 | lio->ctx.free(sp); | ||
1193 | } | 1161 | } |
1194 | 1162 | ||
1195 | /** | 1163 | /** |