aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_iocb.c
diff options
context:
space:
mode:
authorMadhuranath Iyengar <madhuranath.iyengar@qlogic.com>2010-05-04 18:01:28 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-05-16 18:21:56 -0400
commit4916392b56921b4aaaeaca3ef492135f42fbb5f2 (patch)
tree6f3a209b1386b74009c197978e677afa04f0d651 /drivers/scsi/qla2xxx/qla_iocb.c
parentb7d2280c153b33fc60f1a89406d2329137a8b61c (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_iocb.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_iocb.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 8112e41065f..8861b88319f 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -983,13 +983,14 @@ qla2x00_start_iocbs(srb_t *sp)
983static void 983static void
984qla24xx_login_iocb(srb_t *sp, struct logio_entry_24xx *logio) 984qla24xx_login_iocb(srb_t *sp, struct logio_entry_24xx *logio)
985{ 985{
986 struct srb_logio *lio = sp->ctx; 986 struct srb_ctx *ctx = sp->ctx;
987 struct srb_iocb *lio = ctx->u.iocb_cmd;
987 988
988 logio->entry_type = LOGINOUT_PORT_IOCB_TYPE; 989 logio->entry_type = LOGINOUT_PORT_IOCB_TYPE;
989 logio->control_flags = cpu_to_le16(LCF_COMMAND_PLOGI); 990 logio->control_flags = cpu_to_le16(LCF_COMMAND_PLOGI);
990 if (lio->flags & SRB_LOGIN_COND_PLOGI) 991 if (lio->u.logio.flags & SRB_LOGIN_COND_PLOGI)
991 logio->control_flags |= cpu_to_le16(LCF_COND_PLOGI); 992 logio->control_flags |= cpu_to_le16(LCF_COND_PLOGI);
992 if (lio->flags & SRB_LOGIN_SKIP_PRLI) 993 if (lio->u.logio.flags & SRB_LOGIN_SKIP_PRLI)
993 logio->control_flags |= cpu_to_le16(LCF_SKIP_PRLI); 994 logio->control_flags |= cpu_to_le16(LCF_SKIP_PRLI);
994 logio->nport_handle = cpu_to_le16(sp->fcport->loop_id); 995 logio->nport_handle = cpu_to_le16(sp->fcport->loop_id);
995 logio->port_id[0] = sp->fcport->d_id.b.al_pa; 996 logio->port_id[0] = sp->fcport->d_id.b.al_pa;
@@ -1002,14 +1003,15 @@ static void
1002qla2x00_login_iocb(srb_t *sp, struct mbx_entry *mbx) 1003qla2x00_login_iocb(srb_t *sp, struct mbx_entry *mbx)
1003{ 1004{
1004 struct qla_hw_data *ha = sp->fcport->vha->hw; 1005 struct qla_hw_data *ha = sp->fcport->vha->hw;
1005 struct srb_logio *lio = sp->ctx; 1006 struct srb_ctx *ctx = sp->ctx;
1007 struct srb_iocb *lio = ctx->u.iocb_cmd;
1006 uint16_t opts; 1008 uint16_t opts;
1007 1009
1008 mbx->entry_type = MBX_IOCB_TYPE;; 1010 mbx->entry_type = MBX_IOCB_TYPE;;
1009 SET_TARGET_ID(ha, mbx->loop_id, sp->fcport->loop_id); 1011 SET_TARGET_ID(ha, mbx->loop_id, sp->fcport->loop_id);
1010 mbx->mb0 = cpu_to_le16(MBC_LOGIN_FABRIC_PORT); 1012 mbx->mb0 = cpu_to_le16(MBC_LOGIN_FABRIC_PORT);
1011 opts = lio->flags & SRB_LOGIN_COND_PLOGI ? BIT_0: 0; 1013 opts = lio->u.logio.flags & SRB_LOGIN_COND_PLOGI ? BIT_0 : 0;
1012 opts |= lio->flags & SRB_LOGIN_SKIP_PRLI ? BIT_1: 0; 1014 opts |= lio->u.logio.flags & SRB_LOGIN_SKIP_PRLI ? BIT_1 : 0;
1013 if (HAS_EXTENDED_IDS(ha)) { 1015 if (HAS_EXTENDED_IDS(ha)) {
1014 mbx->mb1 = cpu_to_le16(sp->fcport->loop_id); 1016 mbx->mb1 = cpu_to_le16(sp->fcport->loop_id);
1015 mbx->mb10 = cpu_to_le16(opts); 1017 mbx->mb10 = cpu_to_le16(opts);
@@ -1086,7 +1088,7 @@ qla2x00_adisc_iocb(srb_t *sp, struct mbx_entry *mbx)
1086static void 1088static void
1087qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) 1089qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
1088{ 1090{
1089 struct fc_bsg_job *bsg_job = ((struct srb_bsg*)sp->ctx)->bsg_job; 1091 struct fc_bsg_job *bsg_job = ((struct srb_ctx *)sp->ctx)->u.bsg_job;
1090 1092
1091 els_iocb->entry_type = ELS_IOCB_TYPE; 1093 els_iocb->entry_type = ELS_IOCB_TYPE;
1092 els_iocb->entry_count = 1; 1094 els_iocb->entry_count = 1;
@@ -1099,8 +1101,10 @@ qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
1099 els_iocb->sof_type = EST_SOFI3; 1101 els_iocb->sof_type = EST_SOFI3;
1100 els_iocb->rx_dsd_count = __constant_cpu_to_le16(bsg_job->reply_payload.sg_cnt); 1102 els_iocb->rx_dsd_count = __constant_cpu_to_le16(bsg_job->reply_payload.sg_cnt);
1101 1103
1102 els_iocb->opcode =(((struct srb_bsg*)sp->ctx)->ctx.type == SRB_ELS_CMD_RPT) ? 1104 els_iocb->opcode =
1103 bsg_job->request->rqst_data.r_els.els_code : bsg_job->request->rqst_data.h_els.command_code; 1105 (((struct srb_ctx *)sp->ctx)->type == SRB_ELS_CMD_RPT) ?
1106 bsg_job->request->rqst_data.r_els.els_code :
1107 bsg_job->request->rqst_data.h_els.command_code;
1104 els_iocb->port_id[0] = sp->fcport->d_id.b.al_pa; 1108 els_iocb->port_id[0] = sp->fcport->d_id.b.al_pa;
1105 els_iocb->port_id[1] = sp->fcport->d_id.b.area; 1109 els_iocb->port_id[1] = sp->fcport->d_id.b.area;
1106 els_iocb->port_id[2] = sp->fcport->d_id.b.domain; 1110 els_iocb->port_id[2] = sp->fcport->d_id.b.domain;
@@ -1134,7 +1138,7 @@ qla24xx_ct_iocb(srb_t *sp, struct ct_entry_24xx *ct_iocb)
1134 int index; 1138 int index;
1135 uint16_t tot_dsds; 1139 uint16_t tot_dsds;
1136 scsi_qla_host_t *vha = sp->fcport->vha; 1140 scsi_qla_host_t *vha = sp->fcport->vha;
1137 struct fc_bsg_job *bsg_job = ((struct srb_bsg*)sp->ctx)->bsg_job; 1141 struct fc_bsg_job *bsg_job = ((struct srb_ctx *)sp->ctx)->u.bsg_job;
1138 int loop_iterartion = 0; 1142 int loop_iterartion = 0;
1139 int cont_iocb_prsnt = 0; 1143 int cont_iocb_prsnt = 0;
1140 int entry_count = 1; 1144 int entry_count = 1;