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:29 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-05-16 18:21:57 -0400
commit3822263eb1e74821ad1ae886ddd2184ae9395ff7 (patch)
tree7b8ff05127a579bb0c3de9c8848f4052c0604d60 /drivers/scsi/qla2xxx/qla_iocb.c
parent4916392b56921b4aaaeaca3ef492135f42fbb5f2 (diff)
[SCSI] qla2xxx: Support for asynchronous TM and Marker IOCBs.
Currently we can only issue the task management (TM) commands via the mailbox mechanism. This is a limitation, since only one mailbox command can be issued at a time. The purpose of this effort is to provide support for issuing and processing the respose to TM and Marker IOCBs asynchronously. Towards achieving this, the consolidated srb architecture that is currently used for BSG and IOCB/Logio commands has been enhanced and used. 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.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 8861b88319fb..d7a9fff15ad5 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -1086,6 +1086,64 @@ qla2x00_adisc_iocb(srb_t *sp, struct mbx_entry *mbx)
1086} 1086}
1087 1087
1088static void 1088static void
1089qla24xx_tm_iocb(srb_t *sp, struct tsk_mgmt_entry *tsk)
1090{
1091 uint32_t flags;
1092 unsigned int lun;
1093 struct fc_port *fcport = sp->fcport;
1094 scsi_qla_host_t *vha = fcport->vha;
1095 struct qla_hw_data *ha = vha->hw;
1096 struct srb_ctx *ctx = sp->ctx;
1097 struct srb_iocb *iocb = ctx->u.iocb_cmd;
1098 struct req_que *req = vha->req;
1099
1100 flags = iocb->u.tmf.flags;
1101 lun = iocb->u.tmf.lun;
1102
1103 tsk->entry_type = TSK_MGMT_IOCB_TYPE;
1104 tsk->entry_count = 1;
1105 tsk->handle = MAKE_HANDLE(req->id, tsk->handle);
1106 tsk->nport_handle = cpu_to_le16(fcport->loop_id);
1107 tsk->timeout = cpu_to_le16(ha->r_a_tov / 10 * 2);
1108 tsk->control_flags = cpu_to_le32(flags);
1109 tsk->port_id[0] = fcport->d_id.b.al_pa;
1110 tsk->port_id[1] = fcport->d_id.b.area;
1111 tsk->port_id[2] = fcport->d_id.b.domain;
1112 tsk->vp_index = fcport->vp_idx;
1113
1114 if (flags == TCF_LUN_RESET) {
1115 int_to_scsilun(lun, &tsk->lun);
1116 host_to_fcp_swap((uint8_t *)&tsk->lun,
1117 sizeof(tsk->lun));
1118 }
1119}
1120
1121static void
1122qla24xx_marker_iocb(srb_t *sp, struct mrk_entry_24xx *mrk)
1123{
1124 uint16_t lun;
1125 uint8_t modif;
1126 struct fc_port *fcport = sp->fcport;
1127 scsi_qla_host_t *vha = fcport->vha;
1128 struct srb_ctx *ctx = sp->ctx;
1129 struct srb_iocb *iocb = ctx->u.iocb_cmd;
1130 struct req_que *req = vha->req;
1131
1132 lun = iocb->u.marker.lun;
1133 modif = iocb->u.marker.modif;
1134 mrk->entry_type = MARKER_TYPE;
1135 mrk->modifier = modif;
1136 if (modif != MK_SYNC_ALL) {
1137 mrk->nport_handle = cpu_to_le16(fcport->loop_id);
1138 mrk->lun[1] = LSB(lun);
1139 mrk->lun[2] = MSB(lun);
1140 host_to_fcp_swap(mrk->lun, sizeof(mrk->lun));
1141 mrk->vp_index = vha->vp_idx;
1142 mrk->handle = MAKE_HANDLE(req->id, mrk->handle);
1143 }
1144}
1145
1146static void
1089qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) 1147qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
1090{ 1148{
1091 struct fc_bsg_job *bsg_job = ((struct srb_ctx *)sp->ctx)->u.bsg_job; 1149 struct fc_bsg_job *bsg_job = ((struct srb_ctx *)sp->ctx)->u.bsg_job;
@@ -1239,6 +1297,12 @@ qla2x00_start_sp(srb_t *sp)
1239 qla24xx_adisc_iocb(sp, pkt) : 1297 qla24xx_adisc_iocb(sp, pkt) :
1240 qla2x00_adisc_iocb(sp, pkt); 1298 qla2x00_adisc_iocb(sp, pkt);
1241 break; 1299 break;
1300 case SRB_TM_CMD:
1301 qla24xx_tm_iocb(sp, pkt);
1302 break;
1303 case SRB_MARKER_CMD:
1304 qla24xx_marker_iocb(sp, pkt);
1305 break;
1242 default: 1306 default:
1243 break; 1307 break;
1244 } 1308 }