aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_init.c
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2010-05-04 15:01:25 -0700
committerJames Bottomley <James.Bottomley@suse.de>2010-05-16 18:21:44 -0400
commit99b0bec7bbf3350d1a920a7138fa62c456a8ecf1 (patch)
tree89e2265ec02f650e11a3ae8c53bcba295f9b3f76 /drivers/scsi/qla2xxx/qla_init.c
parent6a03b4cd78f3f2695a2d0e6343d555b3de0e67c1 (diff)
downloadkernel_samsung_smdk4412-99b0bec7bbf3350d1a920a7138fa62c456a8ecf1.zip
kernel_samsung_smdk4412-99b0bec7bbf3350d1a920a7138fa62c456a8ecf1.tar.gz
kernel_samsung_smdk4412-99b0bec7bbf3350d1a920a7138fa62c456a8ecf1.tar.bz2
[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_init.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c43
1 files changed, 33 insertions, 10 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 55540d2..c3c2c36 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -117,13 +117,22 @@ qla2x00_async_logio_timeout(srb_t *sp)
DEBUG2(printk(KERN_WARNING
"scsi(%ld:%x): Async-%s timeout.\n",
- fcport->vha->host_no, sp->handle,
- lio->ctx.type == SRB_LOGIN_CMD ? "login": "logout"));
+ fcport->vha->host_no, sp->handle, lio->ctx.name));
if (lio->ctx.type == SRB_LOGIN_CMD)
qla2x00_post_async_logout_work(fcport->vha, fcport, NULL);
}
+static void
+qla2x00_async_login_ctx_done(srb_t *sp)
+{
+ struct srb_logio *lio = sp->ctx;
+
+ qla2x00_post_async_login_done_work(sp->fcport->vha, sp->fcport,
+ lio->data);
+ lio->ctx.free(sp);
+}
+
int
qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport,
uint16_t *data)
@@ -141,7 +150,9 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport,
lio = sp->ctx;
lio->ctx.type = SRB_LOGIN_CMD;
+ lio->ctx.name = "login";
lio->ctx.timeout = qla2x00_async_logio_timeout;
+ lio->ctx.done = qla2x00_async_login_ctx_done;
lio->flags |= SRB_LOGIN_COND_PLOGI;
if (data[1] & QLA_LOGIO_LOGIN_RETRIED)
lio->flags |= SRB_LOGIN_RETRIED;
@@ -163,6 +174,16 @@ done:
return rval;
}
+static void
+qla2x00_async_logout_ctx_done(srb_t *sp)
+{
+ struct srb_logio *lio = sp->ctx;
+
+ qla2x00_post_async_logout_done_work(sp->fcport->vha, sp->fcport,
+ lio->data);
+ lio->ctx.free(sp);
+}
+
int
qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport)
{
@@ -179,7 +200,9 @@ qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport)
lio = sp->ctx;
lio->ctx.type = SRB_LOGOUT_CMD;
+ lio->ctx.name = "logout";
lio->ctx.timeout = qla2x00_async_logio_timeout;
+ lio->ctx.done = qla2x00_async_logout_ctx_done;
rval = qla2x00_start_sp(sp);
if (rval != QLA_SUCCESS)
goto done_free_sp;
@@ -202,17 +225,17 @@ qla2x00_async_login_done(struct scsi_qla_host *vha, fc_port_t *fcport,
uint16_t *data)
{
int rval;
- uint8_t opts = 0;
switch (data[0]) {
case MBS_COMMAND_COMPLETE:
- if (fcport->flags & FCF_FCP2_DEVICE)
- opts |= BIT_1;
- rval = qla2x00_get_port_database(vha, fcport, opts);
- if (rval != QLA_SUCCESS)
- qla2x00_mark_device_lost(vha, fcport, 1, 0);
- else
- qla2x00_update_fcport(vha, fcport);
+ if (fcport->flags & FCF_FCP2_DEVICE) {
+ rval = qla2x00_get_port_database(vha, fcport, BIT_1);
+ if (rval != QLA_SUCCESS) {
+ qla2x00_mark_device_lost(vha, fcport, 1, 0);
+ break;
+ }
+ }
+ qla2x00_update_fcport(vha, fcport);
break;
case MBS_COMMAND_ERROR:
if (data[1] & QLA_LOGIO_LOGIN_RETRIED)