diff options
author | Madhuranath Iyengar <madhuranath.iyengar@qlogic.com> | 2010-05-04 18:01:28 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-05-16 18:21:56 -0400 |
commit | 4916392b56921b4aaaeaca3ef492135f42fbb5f2 (patch) | |
tree | 6f3a209b1386b74009c197978e677afa04f0d651 /drivers/scsi/qla2xxx/qla_isr.c | |
parent | b7d2280c153b33fc60f1a89406d2329137a8b61c (diff) |
[SCSI] qla2xxx: Provide common framework for BSG and IOCB commands.
Currently, BSG and IOCB/Logio commands have a different
framework (srb structs). The purpose of this effort is to
consolidate them into a generalized framework for these
as well as other asynchronous operations in the future.
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 | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index b92f9a6ee4fb..166bb2045fd4 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -897,7 +897,8 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
897 | const char *type; | 897 | const char *type; |
898 | fc_port_t *fcport; | 898 | fc_port_t *fcport; |
899 | srb_t *sp; | 899 | srb_t *sp; |
900 | struct srb_logio *lio; | 900 | struct srb_iocb *lio; |
901 | struct srb_ctx *ctx; | ||
901 | uint16_t *data; | 902 | uint16_t *data; |
902 | uint16_t status; | 903 | uint16_t status; |
903 | 904 | ||
@@ -905,14 +906,14 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
905 | if (!sp) | 906 | if (!sp) |
906 | return; | 907 | return; |
907 | 908 | ||
908 | lio = sp->ctx; | 909 | ctx = sp->ctx; |
909 | del_timer(&lio->ctx.timer); | 910 | lio = ctx->u.iocb_cmd; |
910 | type = lio->ctx.name; | 911 | type = ctx->name; |
911 | fcport = sp->fcport; | 912 | fcport = sp->fcport; |
912 | data = lio->data; | 913 | data = lio->u.logio.data; |
913 | 914 | ||
914 | data[0] = MBS_COMMAND_ERROR; | 915 | data[0] = MBS_COMMAND_ERROR; |
915 | data[1] = lio->flags & SRB_LOGIN_RETRIED ? | 916 | data[1] = lio->u.logio.flags & SRB_LOGIN_RETRIED ? |
916 | QLA_LOGIO_LOGIN_RETRIED : 0; | 917 | QLA_LOGIO_LOGIN_RETRIED : 0; |
917 | if (mbx->entry_status) { | 918 | if (mbx->entry_status) { |
918 | DEBUG2(printk(KERN_WARNING | 919 | DEBUG2(printk(KERN_WARNING |
@@ -928,7 +929,7 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
928 | } | 929 | } |
929 | 930 | ||
930 | status = le16_to_cpu(mbx->status); | 931 | status = le16_to_cpu(mbx->status); |
931 | if (status == 0x30 && lio->ctx.type == SRB_LOGIN_CMD && | 932 | if (status == 0x30 && ctx->type == SRB_LOGIN_CMD && |
932 | le16_to_cpu(mbx->mb0) == MBS_COMMAND_COMPLETE) | 933 | le16_to_cpu(mbx->mb0) == MBS_COMMAND_COMPLETE) |
933 | status = 0; | 934 | status = 0; |
934 | if (!status && le16_to_cpu(mbx->mb0) == MBS_COMMAND_COMPLETE) { | 935 | if (!status && le16_to_cpu(mbx->mb0) == MBS_COMMAND_COMPLETE) { |
@@ -938,7 +939,7 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
938 | le16_to_cpu(mbx->mb1))); | 939 | le16_to_cpu(mbx->mb1))); |
939 | 940 | ||
940 | data[0] = MBS_COMMAND_COMPLETE; | 941 | data[0] = MBS_COMMAND_COMPLETE; |
941 | if (lio->ctx.type == SRB_LOGIN_CMD) { | 942 | if (ctx->type == SRB_LOGIN_CMD) { |
942 | fcport->port_type = FCT_TARGET; | 943 | fcport->port_type = FCT_TARGET; |
943 | if (le16_to_cpu(mbx->mb1) & BIT_0) | 944 | if (le16_to_cpu(mbx->mb1) & BIT_0) |
944 | fcport->port_type = FCT_INITIATOR; | 945 | fcport->port_type = FCT_INITIATOR; |
@@ -969,7 +970,7 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
969 | le16_to_cpu(mbx->mb7))); | 970 | le16_to_cpu(mbx->mb7))); |
970 | 971 | ||
971 | logio_done: | 972 | logio_done: |
972 | lio->ctx.done(sp); | 973 | lio->done(sp); |
973 | } | 974 | } |
974 | 975 | ||
975 | static void | 976 | static void |
@@ -980,7 +981,7 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
980 | const char *type; | 981 | const char *type; |
981 | struct qla_hw_data *ha = vha->hw; | 982 | struct qla_hw_data *ha = vha->hw; |
982 | srb_t *sp; | 983 | srb_t *sp; |
983 | struct srb_bsg *sp_bsg; | 984 | struct srb_ctx *sp_bsg; |
984 | struct fc_bsg_job *bsg_job; | 985 | struct fc_bsg_job *bsg_job; |
985 | uint16_t comp_status; | 986 | uint16_t comp_status; |
986 | uint32_t fw_status[3]; | 987 | uint32_t fw_status[3]; |
@@ -989,11 +990,11 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
989 | sp = qla2x00_get_sp_from_handle(vha, func, req, pkt); | 990 | sp = qla2x00_get_sp_from_handle(vha, func, req, pkt); |
990 | if (!sp) | 991 | if (!sp) |
991 | return; | 992 | return; |
992 | sp_bsg = (struct srb_bsg*)sp->ctx; | 993 | sp_bsg = sp->ctx; |
993 | bsg_job = sp_bsg->bsg_job; | 994 | bsg_job = sp_bsg->u.bsg_job; |
994 | 995 | ||
995 | type = NULL; | 996 | type = NULL; |
996 | switch (sp_bsg->ctx.type) { | 997 | switch (sp_bsg->type) { |
997 | case SRB_ELS_CMD_RPT: | 998 | case SRB_ELS_CMD_RPT: |
998 | case SRB_ELS_CMD_HST: | 999 | case SRB_ELS_CMD_HST: |
999 | type = "els"; | 1000 | type = "els"; |
@@ -1004,7 +1005,7 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
1004 | default: | 1005 | default: |
1005 | qla_printk(KERN_WARNING, ha, | 1006 | qla_printk(KERN_WARNING, ha, |
1006 | "%s: Unrecognized SRB: (%p) type=%d.\n", func, sp, | 1007 | "%s: Unrecognized SRB: (%p) type=%d.\n", func, sp, |
1007 | sp_bsg->ctx.type); | 1008 | sp_bsg->type); |
1008 | return; | 1009 | return; |
1009 | } | 1010 | } |
1010 | 1011 | ||
@@ -1058,8 +1059,8 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
1058 | dma_unmap_sg(&ha->pdev->dev, | 1059 | dma_unmap_sg(&ha->pdev->dev, |
1059 | bsg_job->reply_payload.sg_list, | 1060 | bsg_job->reply_payload.sg_list, |
1060 | bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); | 1061 | bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); |
1061 | if ((sp_bsg->ctx.type == SRB_ELS_CMD_HST) || | 1062 | if ((sp_bsg->type == SRB_ELS_CMD_HST) || |
1062 | (sp_bsg->ctx.type == SRB_CT_CMD)) | 1063 | (sp_bsg->type == SRB_CT_CMD)) |
1063 | kfree(sp->fcport); | 1064 | kfree(sp->fcport); |
1064 | kfree(sp->ctx); | 1065 | kfree(sp->ctx); |
1065 | mempool_free(sp, ha->srb_mempool); | 1066 | mempool_free(sp, ha->srb_mempool); |
@@ -1074,7 +1075,8 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
1074 | const char *type; | 1075 | const char *type; |
1075 | fc_port_t *fcport; | 1076 | fc_port_t *fcport; |
1076 | srb_t *sp; | 1077 | srb_t *sp; |
1077 | struct srb_logio *lio; | 1078 | struct srb_iocb *lio; |
1079 | struct srb_ctx *ctx; | ||
1078 | uint16_t *data; | 1080 | uint16_t *data; |
1079 | uint32_t iop[2]; | 1081 | uint32_t iop[2]; |
1080 | 1082 | ||
@@ -1082,14 +1084,14 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
1082 | if (!sp) | 1084 | if (!sp) |
1083 | return; | 1085 | return; |
1084 | 1086 | ||
1085 | lio = sp->ctx; | 1087 | ctx = sp->ctx; |
1086 | del_timer(&lio->ctx.timer); | 1088 | lio = ctx->u.iocb_cmd; |
1087 | type = lio->ctx.name; | 1089 | type = ctx->name; |
1088 | fcport = sp->fcport; | 1090 | fcport = sp->fcport; |
1089 | data = lio->data; | 1091 | data = lio->u.logio.data; |
1090 | 1092 | ||
1091 | data[0] = MBS_COMMAND_ERROR; | 1093 | data[0] = MBS_COMMAND_ERROR; |
1092 | data[1] = lio->flags & SRB_LOGIN_RETRIED ? | 1094 | data[1] = lio->u.logio.flags & SRB_LOGIN_RETRIED ? |
1093 | QLA_LOGIO_LOGIN_RETRIED : 0; | 1095 | QLA_LOGIO_LOGIN_RETRIED : 0; |
1094 | if (logio->entry_status) { | 1096 | if (logio->entry_status) { |
1095 | DEBUG2(printk(KERN_WARNING | 1097 | DEBUG2(printk(KERN_WARNING |
@@ -1108,7 +1110,7 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
1108 | le32_to_cpu(logio->io_parameter[0]))); | 1110 | le32_to_cpu(logio->io_parameter[0]))); |
1109 | 1111 | ||
1110 | data[0] = MBS_COMMAND_COMPLETE; | 1112 | data[0] = MBS_COMMAND_COMPLETE; |
1111 | if (lio->ctx.type != SRB_LOGIN_CMD) | 1113 | if (ctx->type != SRB_LOGIN_CMD) |
1112 | goto logio_done; | 1114 | goto logio_done; |
1113 | 1115 | ||
1114 | iop[0] = le32_to_cpu(logio->io_parameter[0]); | 1116 | iop[0] = le32_to_cpu(logio->io_parameter[0]); |
@@ -1156,7 +1158,7 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
1156 | le32_to_cpu(logio->io_parameter[1]))); | 1158 | le32_to_cpu(logio->io_parameter[1]))); |
1157 | 1159 | ||
1158 | logio_done: | 1160 | logio_done: |
1159 | lio->ctx.done(sp); | 1161 | lio->done(sp); |
1160 | } | 1162 | } |
1161 | 1163 | ||
1162 | /** | 1164 | /** |