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_init.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_init.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 55540d2d4e38..c3c2c3627a70 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) | |||
117 | 117 | ||
118 | DEBUG2(printk(KERN_WARNING | 118 | DEBUG2(printk(KERN_WARNING |
119 | "scsi(%ld:%x): Async-%s timeout.\n", | 119 | "scsi(%ld:%x): Async-%s timeout.\n", |
120 | fcport->vha->host_no, sp->handle, | 120 | fcport->vha->host_no, sp->handle, lio->ctx.name)); |
121 | lio->ctx.type == SRB_LOGIN_CMD ? "login": "logout")); | ||
122 | 121 | ||
123 | if (lio->ctx.type == SRB_LOGIN_CMD) | 122 | if (lio->ctx.type == SRB_LOGIN_CMD) |
124 | qla2x00_post_async_logout_work(fcport->vha, fcport, NULL); | 123 | qla2x00_post_async_logout_work(fcport->vha, fcport, NULL); |
125 | } | 124 | } |
126 | 125 | ||
126 | static void | ||
127 | qla2x00_async_login_ctx_done(srb_t *sp) | ||
128 | { | ||
129 | struct srb_logio *lio = sp->ctx; | ||
130 | |||
131 | qla2x00_post_async_login_done_work(sp->fcport->vha, sp->fcport, | ||
132 | lio->data); | ||
133 | lio->ctx.free(sp); | ||
134 | } | ||
135 | |||
127 | int | 136 | int |
128 | qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport, | 137 | qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport, |
129 | uint16_t *data) | 138 | uint16_t *data) |
@@ -141,7 +150,9 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport, | |||
141 | 150 | ||
142 | lio = sp->ctx; | 151 | lio = sp->ctx; |
143 | lio->ctx.type = SRB_LOGIN_CMD; | 152 | lio->ctx.type = SRB_LOGIN_CMD; |
153 | lio->ctx.name = "login"; | ||
144 | lio->ctx.timeout = qla2x00_async_logio_timeout; | 154 | lio->ctx.timeout = qla2x00_async_logio_timeout; |
155 | lio->ctx.done = qla2x00_async_login_ctx_done; | ||
145 | lio->flags |= SRB_LOGIN_COND_PLOGI; | 156 | lio->flags |= SRB_LOGIN_COND_PLOGI; |
146 | if (data[1] & QLA_LOGIO_LOGIN_RETRIED) | 157 | if (data[1] & QLA_LOGIO_LOGIN_RETRIED) |
147 | lio->flags |= SRB_LOGIN_RETRIED; | 158 | lio->flags |= SRB_LOGIN_RETRIED; |
@@ -163,6 +174,16 @@ done: | |||
163 | return rval; | 174 | return rval; |
164 | } | 175 | } |
165 | 176 | ||
177 | static void | ||
178 | qla2x00_async_logout_ctx_done(srb_t *sp) | ||
179 | { | ||
180 | struct srb_logio *lio = sp->ctx; | ||
181 | |||
182 | qla2x00_post_async_logout_done_work(sp->fcport->vha, sp->fcport, | ||
183 | lio->data); | ||
184 | lio->ctx.free(sp); | ||
185 | } | ||
186 | |||
166 | int | 187 | int |
167 | qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport) | 188 | qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport) |
168 | { | 189 | { |
@@ -179,7 +200,9 @@ qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport) | |||
179 | 200 | ||
180 | lio = sp->ctx; | 201 | lio = sp->ctx; |
181 | lio->ctx.type = SRB_LOGOUT_CMD; | 202 | lio->ctx.type = SRB_LOGOUT_CMD; |
203 | lio->ctx.name = "logout"; | ||
182 | lio->ctx.timeout = qla2x00_async_logio_timeout; | 204 | lio->ctx.timeout = qla2x00_async_logio_timeout; |
205 | lio->ctx.done = qla2x00_async_logout_ctx_done; | ||
183 | rval = qla2x00_start_sp(sp); | 206 | rval = qla2x00_start_sp(sp); |
184 | if (rval != QLA_SUCCESS) | 207 | if (rval != QLA_SUCCESS) |
185 | goto done_free_sp; | 208 | goto done_free_sp; |
@@ -202,17 +225,17 @@ qla2x00_async_login_done(struct scsi_qla_host *vha, fc_port_t *fcport, | |||
202 | uint16_t *data) | 225 | uint16_t *data) |
203 | { | 226 | { |
204 | int rval; | 227 | int rval; |
205 | uint8_t opts = 0; | ||
206 | 228 | ||
207 | switch (data[0]) { | 229 | switch (data[0]) { |
208 | case MBS_COMMAND_COMPLETE: | 230 | case MBS_COMMAND_COMPLETE: |
209 | if (fcport->flags & FCF_FCP2_DEVICE) | 231 | if (fcport->flags & FCF_FCP2_DEVICE) { |
210 | opts |= BIT_1; | 232 | rval = qla2x00_get_port_database(vha, fcport, BIT_1); |
211 | rval = qla2x00_get_port_database(vha, fcport, opts); | 233 | if (rval != QLA_SUCCESS) { |
212 | if (rval != QLA_SUCCESS) | 234 | qla2x00_mark_device_lost(vha, fcport, 1, 0); |
213 | qla2x00_mark_device_lost(vha, fcport, 1, 0); | 235 | break; |
214 | else | 236 | } |
215 | qla2x00_update_fcport(vha, fcport); | 237 | } |
238 | qla2x00_update_fcport(vha, fcport); | ||
216 | break; | 239 | break; |
217 | case MBS_COMMAND_ERROR: | 240 | case MBS_COMMAND_ERROR: |
218 | if (data[1] & QLA_LOGIO_LOGIN_RETRIED) | 241 | if (data[1] & QLA_LOGIO_LOGIN_RETRIED) |