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 | |
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>
-rw-r--r-- | drivers/scsi/qla2xxx/qla_bsg.c | 28 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_def.h | 48 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_gbl.h | 6 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 135 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_iocb.c | 24 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_isr.c | 50 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 13 |
7 files changed, 162 insertions, 142 deletions
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index 21e5bcd4bb51..951db816ee45 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c | |||
@@ -16,7 +16,7 @@ qla2x00_get_ctx_bsg_sp(scsi_qla_host_t *vha, fc_port_t *fcport, size_t size) | |||
16 | { | 16 | { |
17 | srb_t *sp; | 17 | srb_t *sp; |
18 | struct qla_hw_data *ha = vha->hw; | 18 | struct qla_hw_data *ha = vha->hw; |
19 | struct srb_bsg_ctx *ctx; | 19 | struct srb_ctx *ctx; |
20 | 20 | ||
21 | sp = mempool_alloc(ha->srb_mempool, GFP_KERNEL); | 21 | sp = mempool_alloc(ha->srb_mempool, GFP_KERNEL); |
22 | if (!sp) | 22 | if (!sp) |
@@ -208,7 +208,7 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) | |||
208 | int req_sg_cnt, rsp_sg_cnt; | 208 | int req_sg_cnt, rsp_sg_cnt; |
209 | int rval = (DRIVER_ERROR << 16); | 209 | int rval = (DRIVER_ERROR << 16); |
210 | uint16_t nextlid = 0; | 210 | uint16_t nextlid = 0; |
211 | struct srb_bsg *els; | 211 | struct srb_ctx *els; |
212 | 212 | ||
213 | /* Multiple SG's are not supported for ELS requests */ | 213 | /* Multiple SG's are not supported for ELS requests */ |
214 | if (bsg_job->request_payload.sg_cnt > 1 || | 214 | if (bsg_job->request_payload.sg_cnt > 1 || |
@@ -307,17 +307,17 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) | |||
307 | } | 307 | } |
308 | 308 | ||
309 | /* Alloc SRB structure */ | 309 | /* Alloc SRB structure */ |
310 | sp = qla2x00_get_ctx_bsg_sp(vha, fcport, sizeof(struct srb_bsg)); | 310 | sp = qla2x00_get_ctx_bsg_sp(vha, fcport, sizeof(struct srb_ctx)); |
311 | if (!sp) { | 311 | if (!sp) { |
312 | rval = -ENOMEM; | 312 | rval = -ENOMEM; |
313 | goto done_unmap_sg; | 313 | goto done_unmap_sg; |
314 | } | 314 | } |
315 | 315 | ||
316 | els = sp->ctx; | 316 | els = sp->ctx; |
317 | els->ctx.type = | 317 | els->type = |
318 | (bsg_job->request->msgcode == FC_BSG_RPT_ELS ? | 318 | (bsg_job->request->msgcode == FC_BSG_RPT_ELS ? |
319 | SRB_ELS_CMD_RPT : SRB_ELS_CMD_HST); | 319 | SRB_ELS_CMD_RPT : SRB_ELS_CMD_HST); |
320 | els->bsg_job = bsg_job; | 320 | els->u.bsg_job = bsg_job; |
321 | 321 | ||
322 | DEBUG2(qla_printk(KERN_INFO, ha, | 322 | DEBUG2(qla_printk(KERN_INFO, ha, |
323 | "scsi(%ld:%x): bsg rqst type: %s els type: %x - loop-id=%x " | 323 | "scsi(%ld:%x): bsg rqst type: %s els type: %x - loop-id=%x " |
@@ -361,7 +361,7 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job) | |||
361 | uint16_t loop_id; | 361 | uint16_t loop_id; |
362 | struct fc_port *fcport; | 362 | struct fc_port *fcport; |
363 | char *type = "FC_BSG_HST_CT"; | 363 | char *type = "FC_BSG_HST_CT"; |
364 | struct srb_bsg *ct; | 364 | struct srb_ctx *ct; |
365 | 365 | ||
366 | /* pass through is supported only for ISP 4Gb or higher */ | 366 | /* pass through is supported only for ISP 4Gb or higher */ |
367 | if (!IS_FWI2_CAPABLE(ha)) { | 367 | if (!IS_FWI2_CAPABLE(ha)) { |
@@ -442,15 +442,15 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job) | |||
442 | fcport->loop_id = loop_id; | 442 | fcport->loop_id = loop_id; |
443 | 443 | ||
444 | /* Alloc SRB structure */ | 444 | /* Alloc SRB structure */ |
445 | sp = qla2x00_get_ctx_bsg_sp(vha, fcport, sizeof(struct srb_bsg)); | 445 | sp = qla2x00_get_ctx_bsg_sp(vha, fcport, sizeof(struct srb_ctx)); |
446 | if (!sp) { | 446 | if (!sp) { |
447 | rval = -ENOMEM; | 447 | rval = -ENOMEM; |
448 | goto done_free_fcport; | 448 | goto done_free_fcport; |
449 | } | 449 | } |
450 | 450 | ||
451 | ct = sp->ctx; | 451 | ct = sp->ctx; |
452 | ct->ctx.type = SRB_CT_CMD; | 452 | ct->type = SRB_CT_CMD; |
453 | ct->bsg_job = bsg_job; | 453 | ct->u.bsg_job = bsg_job; |
454 | 454 | ||
455 | DEBUG2(qla_printk(KERN_INFO, ha, | 455 | DEBUG2(qla_printk(KERN_INFO, ha, |
456 | "scsi(%ld:%x): bsg rqst type: %s els type: %x - loop-id=%x " | 456 | "scsi(%ld:%x): bsg rqst type: %s els type: %x - loop-id=%x " |
@@ -1155,7 +1155,7 @@ qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job) | |||
1155 | int cnt, que; | 1155 | int cnt, que; |
1156 | unsigned long flags; | 1156 | unsigned long flags; |
1157 | struct req_que *req; | 1157 | struct req_que *req; |
1158 | struct srb_bsg *sp_bsg; | 1158 | struct srb_ctx *sp_bsg; |
1159 | 1159 | ||
1160 | /* find the bsg job from the active list of commands */ | 1160 | /* find the bsg job from the active list of commands */ |
1161 | spin_lock_irqsave(&ha->hardware_lock, flags); | 1161 | spin_lock_irqsave(&ha->hardware_lock, flags); |
@@ -1167,11 +1167,11 @@ qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job) | |||
1167 | for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { | 1167 | for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { |
1168 | sp = req->outstanding_cmds[cnt]; | 1168 | sp = req->outstanding_cmds[cnt]; |
1169 | if (sp) { | 1169 | if (sp) { |
1170 | sp_bsg = (struct srb_bsg *)sp->ctx; | 1170 | sp_bsg = sp->ctx; |
1171 | 1171 | ||
1172 | if (((sp_bsg->ctx.type == SRB_CT_CMD) || | 1172 | if (((sp_bsg->type == SRB_CT_CMD) || |
1173 | (sp_bsg->ctx.type == SRB_ELS_CMD_HST)) | 1173 | (sp_bsg->type == SRB_ELS_CMD_HST)) |
1174 | && (sp_bsg->bsg_job == bsg_job)) { | 1174 | && (sp_bsg->u.bsg_job == bsg_job)) { |
1175 | if (ha->isp_ops->abort_command(sp)) { | 1175 | if (ha->isp_ops->abort_command(sp)) { |
1176 | DEBUG2(qla_printk(KERN_INFO, ha, | 1176 | DEBUG2(qla_printk(KERN_INFO, ha, |
1177 | "scsi(%ld): mbx " | 1177 | "scsi(%ld): mbx " |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index a491338e1bfe..08f5fd5359dd 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -214,16 +214,16 @@ typedef struct srb { | |||
214 | /* | 214 | /* |
215 | * SRB extensions. | 215 | * SRB extensions. |
216 | */ | 216 | */ |
217 | #define SRB_LOGIN_CMD 1 | 217 | struct srb_iocb { |
218 | #define SRB_LOGOUT_CMD 2 | 218 | union { |
219 | #define SRB_ELS_CMD_RPT 3 | 219 | struct { |
220 | #define SRB_ELS_CMD_HST 4 | 220 | uint16_t flags; |
221 | #define SRB_CT_CMD 5 | 221 | #define SRB_LOGIN_RETRIED BIT_0 |
222 | #define SRB_ADISC_CMD 6 | 222 | #define SRB_LOGIN_COND_PLOGI BIT_1 |
223 | 223 | #define SRB_LOGIN_SKIP_PRLI BIT_2 | |
224 | struct srb_ctx { | 224 | uint16_t data[2]; |
225 | uint16_t type; | 225 | } logio; |
226 | char *name; | 226 | } u; |
227 | 227 | ||
228 | struct timer_list timer; | 228 | struct timer_list timer; |
229 | 229 | ||
@@ -232,23 +232,21 @@ struct srb_ctx { | |||
232 | void (*timeout)(srb_t *); | 232 | void (*timeout)(srb_t *); |
233 | }; | 233 | }; |
234 | 234 | ||
235 | struct srb_logio { | 235 | /* Values for srb_ctx type */ |
236 | struct srb_ctx ctx; | 236 | #define SRB_LOGIN_CMD 1 |
237 | 237 | #define SRB_LOGOUT_CMD 2 | |
238 | #define SRB_LOGIN_RETRIED BIT_0 | 238 | #define SRB_ELS_CMD_RPT 3 |
239 | #define SRB_LOGIN_COND_PLOGI BIT_1 | 239 | #define SRB_ELS_CMD_HST 4 |
240 | #define SRB_LOGIN_SKIP_PRLI BIT_2 | 240 | #define SRB_CT_CMD 5 |
241 | uint16_t flags; | 241 | #define SRB_ADISC_CMD 6 |
242 | uint16_t data[2]; | ||
243 | }; | ||
244 | 242 | ||
245 | struct srb_bsg_ctx { | 243 | struct srb_ctx { |
246 | uint16_t type; | 244 | uint16_t type; |
247 | }; | 245 | char *name; |
248 | 246 | union { | |
249 | struct srb_bsg { | 247 | struct srb_iocb *iocb_cmd; |
250 | struct srb_bsg_ctx ctx; | 248 | struct fc_bsg_job *bsg_job; |
251 | struct fc_bsg_job *bsg_job; | 249 | } u; |
252 | }; | 250 | }; |
253 | 251 | ||
254 | struct msg_echo_lb { | 252 | struct msg_echo_lb { |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 03be29841902..408e5f0a53c1 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -58,11 +58,11 @@ extern int qla2x00_async_login(struct scsi_qla_host *, fc_port_t *, | |||
58 | extern int qla2x00_async_logout(struct scsi_qla_host *, fc_port_t *); | 58 | extern int qla2x00_async_logout(struct scsi_qla_host *, fc_port_t *); |
59 | extern int qla2x00_async_adisc(struct scsi_qla_host *, fc_port_t *, | 59 | extern int qla2x00_async_adisc(struct scsi_qla_host *, fc_port_t *, |
60 | uint16_t *); | 60 | uint16_t *); |
61 | extern int qla2x00_async_login_done(struct scsi_qla_host *, fc_port_t *, | 61 | extern void qla2x00_async_login_done(struct scsi_qla_host *, fc_port_t *, |
62 | uint16_t *); | 62 | uint16_t *); |
63 | extern int qla2x00_async_logout_done(struct scsi_qla_host *, fc_port_t *, | 63 | extern void qla2x00_async_logout_done(struct scsi_qla_host *, fc_port_t *, |
64 | uint16_t *); | 64 | uint16_t *); |
65 | extern int qla2x00_async_adisc_done(struct scsi_qla_host *, fc_port_t *, | 65 | extern void qla2x00_async_adisc_done(struct scsi_qla_host *, fc_port_t *, |
66 | uint16_t *); | 66 | uint16_t *); |
67 | 67 | ||
68 | extern fc_port_t * | 68 | extern fc_port_t * |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 4e7a3d5493e6..72b4ef270158 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -48,6 +48,7 @@ qla2x00_ctx_sp_timeout(unsigned long __data) | |||
48 | { | 48 | { |
49 | srb_t *sp = (srb_t *)__data; | 49 | srb_t *sp = (srb_t *)__data; |
50 | struct srb_ctx *ctx; | 50 | struct srb_ctx *ctx; |
51 | struct srb_iocb *iocb; | ||
51 | fc_port_t *fcport = sp->fcport; | 52 | fc_port_t *fcport = sp->fcport; |
52 | struct qla_hw_data *ha = fcport->vha->hw; | 53 | struct qla_hw_data *ha = fcport->vha->hw; |
53 | struct req_que *req; | 54 | struct req_que *req; |
@@ -57,17 +58,21 @@ qla2x00_ctx_sp_timeout(unsigned long __data) | |||
57 | req = ha->req_q_map[0]; | 58 | req = ha->req_q_map[0]; |
58 | req->outstanding_cmds[sp->handle] = NULL; | 59 | req->outstanding_cmds[sp->handle] = NULL; |
59 | ctx = sp->ctx; | 60 | ctx = sp->ctx; |
60 | ctx->timeout(sp); | 61 | iocb = ctx->u.iocb_cmd; |
62 | iocb->timeout(sp); | ||
61 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 63 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
62 | 64 | ||
63 | ctx->free(sp); | 65 | iocb->free(sp); |
64 | } | 66 | } |
65 | 67 | ||
66 | void | 68 | void |
67 | qla2x00_ctx_sp_free(srb_t *sp) | 69 | qla2x00_ctx_sp_free(srb_t *sp) |
68 | { | 70 | { |
69 | struct srb_ctx *ctx = sp->ctx; | 71 | struct srb_ctx *ctx = sp->ctx; |
72 | struct srb_iocb *iocb = ctx->u.iocb_cmd; | ||
70 | 73 | ||
74 | del_timer_sync(&iocb->timer); | ||
75 | kfree(iocb); | ||
71 | kfree(ctx); | 76 | kfree(ctx); |
72 | mempool_free(sp, sp->fcport->vha->hw->srb_mempool); | 77 | mempool_free(sp, sp->fcport->vha->hw->srb_mempool); |
73 | } | 78 | } |
@@ -79,6 +84,7 @@ qla2x00_get_ctx_sp(scsi_qla_host_t *vha, fc_port_t *fcport, size_t size, | |||
79 | srb_t *sp; | 84 | srb_t *sp; |
80 | struct qla_hw_data *ha = vha->hw; | 85 | struct qla_hw_data *ha = vha->hw; |
81 | struct srb_ctx *ctx; | 86 | struct srb_ctx *ctx; |
87 | struct srb_iocb *iocb; | ||
82 | 88 | ||
83 | sp = mempool_alloc(ha->srb_mempool, GFP_KERNEL); | 89 | sp = mempool_alloc(ha->srb_mempool, GFP_KERNEL); |
84 | if (!sp) | 90 | if (!sp) |
@@ -86,21 +92,30 @@ qla2x00_get_ctx_sp(scsi_qla_host_t *vha, fc_port_t *fcport, size_t size, | |||
86 | ctx = kzalloc(size, GFP_KERNEL); | 92 | ctx = kzalloc(size, GFP_KERNEL); |
87 | if (!ctx) { | 93 | if (!ctx) { |
88 | mempool_free(sp, ha->srb_mempool); | 94 | mempool_free(sp, ha->srb_mempool); |
95 | sp = NULL; | ||
96 | goto done; | ||
97 | } | ||
98 | iocb = kzalloc(sizeof(struct srb_iocb), GFP_KERNEL); | ||
99 | if (!iocb) { | ||
100 | mempool_free(sp, ha->srb_mempool); | ||
101 | sp = NULL; | ||
102 | kfree(ctx); | ||
89 | goto done; | 103 | goto done; |
90 | } | 104 | } |
91 | 105 | ||
92 | memset(sp, 0, sizeof(*sp)); | 106 | memset(sp, 0, sizeof(*sp)); |
93 | sp->fcport = fcport; | 107 | sp->fcport = fcport; |
94 | sp->ctx = ctx; | 108 | sp->ctx = ctx; |
95 | ctx->free = qla2x00_ctx_sp_free; | 109 | ctx->u.iocb_cmd = iocb; |
110 | iocb->free = qla2x00_ctx_sp_free; | ||
96 | 111 | ||
97 | init_timer(&ctx->timer); | 112 | init_timer(&iocb->timer); |
98 | if (!tmo) | 113 | if (!tmo) |
99 | goto done; | 114 | goto done; |
100 | ctx->timer.expires = jiffies + tmo * HZ; | 115 | iocb->timer.expires = jiffies + tmo * HZ; |
101 | ctx->timer.data = (unsigned long)sp; | 116 | iocb->timer.data = (unsigned long)sp; |
102 | ctx->timer.function = qla2x00_ctx_sp_timeout; | 117 | iocb->timer.function = qla2x00_ctx_sp_timeout; |
103 | add_timer(&ctx->timer); | 118 | add_timer(&iocb->timer); |
104 | done: | 119 | done: |
105 | return sp; | 120 | return sp; |
106 | } | 121 | } |
@@ -113,25 +128,26 @@ static void | |||
113 | qla2x00_async_logio_timeout(srb_t *sp) | 128 | qla2x00_async_logio_timeout(srb_t *sp) |
114 | { | 129 | { |
115 | fc_port_t *fcport = sp->fcport; | 130 | fc_port_t *fcport = sp->fcport; |
116 | struct srb_logio *lio = sp->ctx; | 131 | struct srb_ctx *ctx = sp->ctx; |
117 | 132 | ||
118 | DEBUG2(printk(KERN_WARNING | 133 | DEBUG2(printk(KERN_WARNING |
119 | "scsi(%ld:%x): Async-%s timeout.\n", | 134 | "scsi(%ld:%x): Async-%s timeout.\n", |
120 | fcport->vha->host_no, sp->handle, lio->ctx.name)); | 135 | fcport->vha->host_no, sp->handle, ctx->name)); |
121 | 136 | ||
122 | fcport->flags &= ~FCF_ASYNC_SENT; | 137 | fcport->flags &= ~FCF_ASYNC_SENT; |
123 | if (lio->ctx.type == SRB_LOGIN_CMD) | 138 | if (ctx->type == SRB_LOGIN_CMD) |
124 | qla2x00_post_async_logout_work(fcport->vha, fcport, NULL); | 139 | qla2x00_post_async_logout_work(fcport->vha, fcport, NULL); |
125 | } | 140 | } |
126 | 141 | ||
127 | static void | 142 | static void |
128 | qla2x00_async_login_ctx_done(srb_t *sp) | 143 | qla2x00_async_login_ctx_done(srb_t *sp) |
129 | { | 144 | { |
130 | struct srb_logio *lio = sp->ctx; | 145 | struct srb_ctx *ctx = sp->ctx; |
146 | struct srb_iocb *lio = ctx->u.iocb_cmd; | ||
131 | 147 | ||
132 | qla2x00_post_async_login_done_work(sp->fcport->vha, sp->fcport, | 148 | qla2x00_post_async_login_done_work(sp->fcport->vha, sp->fcport, |
133 | lio->data); | 149 | lio->u.logio.data); |
134 | lio->ctx.free(sp); | 150 | lio->free(sp); |
135 | } | 151 | } |
136 | 152 | ||
137 | int | 153 | int |
@@ -140,23 +156,25 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport, | |||
140 | { | 156 | { |
141 | struct qla_hw_data *ha = vha->hw; | 157 | struct qla_hw_data *ha = vha->hw; |
142 | srb_t *sp; | 158 | srb_t *sp; |
143 | struct srb_logio *lio; | 159 | struct srb_ctx *ctx; |
160 | struct srb_iocb *lio; | ||
144 | int rval; | 161 | int rval; |
145 | 162 | ||
146 | rval = QLA_FUNCTION_FAILED; | 163 | rval = QLA_FUNCTION_FAILED; |
147 | sp = qla2x00_get_ctx_sp(vha, fcport, sizeof(struct srb_logio), | 164 | sp = qla2x00_get_ctx_sp(vha, fcport, sizeof(struct srb_ctx), |
148 | ELS_TMO_2_RATOV(ha) + 2); | 165 | ELS_TMO_2_RATOV(ha) + 2); |
149 | if (!sp) | 166 | if (!sp) |
150 | goto done; | 167 | goto done; |
151 | 168 | ||
152 | lio = sp->ctx; | 169 | ctx = sp->ctx; |
153 | lio->ctx.type = SRB_LOGIN_CMD; | 170 | ctx->type = SRB_LOGIN_CMD; |
154 | lio->ctx.name = "login"; | 171 | ctx->name = "login"; |
155 | lio->ctx.timeout = qla2x00_async_logio_timeout; | 172 | lio = ctx->u.iocb_cmd; |
156 | lio->ctx.done = qla2x00_async_login_ctx_done; | 173 | lio->timeout = qla2x00_async_logio_timeout; |
157 | lio->flags |= SRB_LOGIN_COND_PLOGI; | 174 | lio->done = qla2x00_async_login_ctx_done; |
175 | lio->u.logio.flags |= SRB_LOGIN_COND_PLOGI; | ||
158 | if (data[1] & QLA_LOGIO_LOGIN_RETRIED) | 176 | if (data[1] & QLA_LOGIO_LOGIN_RETRIED) |
159 | lio->flags |= SRB_LOGIN_RETRIED; | 177 | lio->u.logio.flags |= SRB_LOGIN_RETRIED; |
160 | rval = qla2x00_start_sp(sp); | 178 | rval = qla2x00_start_sp(sp); |
161 | if (rval != QLA_SUCCESS) | 179 | if (rval != QLA_SUCCESS) |
162 | goto done_free_sp; | 180 | goto done_free_sp; |
@@ -169,8 +187,7 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport, | |||
169 | return rval; | 187 | return rval; |
170 | 188 | ||
171 | done_free_sp: | 189 | done_free_sp: |
172 | del_timer_sync(&lio->ctx.timer); | 190 | lio->free(sp); |
173 | lio->ctx.free(sp); | ||
174 | done: | 191 | done: |
175 | return rval; | 192 | return rval; |
176 | } | 193 | } |
@@ -178,11 +195,12 @@ done: | |||
178 | static void | 195 | static void |
179 | qla2x00_async_logout_ctx_done(srb_t *sp) | 196 | qla2x00_async_logout_ctx_done(srb_t *sp) |
180 | { | 197 | { |
181 | struct srb_logio *lio = sp->ctx; | 198 | struct srb_ctx *ctx = sp->ctx; |
199 | struct srb_iocb *lio = ctx->u.iocb_cmd; | ||
182 | 200 | ||
183 | qla2x00_post_async_logout_done_work(sp->fcport->vha, sp->fcport, | 201 | qla2x00_post_async_logout_done_work(sp->fcport->vha, sp->fcport, |
184 | lio->data); | 202 | lio->u.logio.data); |
185 | lio->ctx.free(sp); | 203 | lio->free(sp); |
186 | } | 204 | } |
187 | 205 | ||
188 | int | 206 | int |
@@ -190,20 +208,22 @@ qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport) | |||
190 | { | 208 | { |
191 | struct qla_hw_data *ha = vha->hw; | 209 | struct qla_hw_data *ha = vha->hw; |
192 | srb_t *sp; | 210 | srb_t *sp; |
193 | struct srb_logio *lio; | 211 | struct srb_ctx *ctx; |
212 | struct srb_iocb *lio; | ||
194 | int rval; | 213 | int rval; |
195 | 214 | ||
196 | rval = QLA_FUNCTION_FAILED; | 215 | rval = QLA_FUNCTION_FAILED; |
197 | sp = qla2x00_get_ctx_sp(vha, fcport, sizeof(struct srb_logio), | 216 | sp = qla2x00_get_ctx_sp(vha, fcport, sizeof(struct srb_ctx), |
198 | ELS_TMO_2_RATOV(ha) + 2); | 217 | ELS_TMO_2_RATOV(ha) + 2); |
199 | if (!sp) | 218 | if (!sp) |
200 | goto done; | 219 | goto done; |
201 | 220 | ||
202 | lio = sp->ctx; | 221 | ctx = sp->ctx; |
203 | lio->ctx.type = SRB_LOGOUT_CMD; | 222 | ctx->type = SRB_LOGOUT_CMD; |
204 | lio->ctx.name = "logout"; | 223 | ctx->name = "logout"; |
205 | lio->ctx.timeout = qla2x00_async_logio_timeout; | 224 | lio = ctx->u.iocb_cmd; |
206 | lio->ctx.done = qla2x00_async_logout_ctx_done; | 225 | lio->timeout = qla2x00_async_logio_timeout; |
226 | lio->done = qla2x00_async_logout_ctx_done; | ||
207 | rval = qla2x00_start_sp(sp); | 227 | rval = qla2x00_start_sp(sp); |
208 | if (rval != QLA_SUCCESS) | 228 | if (rval != QLA_SUCCESS) |
209 | goto done_free_sp; | 229 | goto done_free_sp; |
@@ -215,8 +235,7 @@ qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport) | |||
215 | return rval; | 235 | return rval; |
216 | 236 | ||
217 | done_free_sp: | 237 | done_free_sp: |
218 | del_timer_sync(&lio->ctx.timer); | 238 | lio->free(sp); |
219 | lio->ctx.free(sp); | ||
220 | done: | 239 | done: |
221 | return rval; | 240 | return rval; |
222 | } | 241 | } |
@@ -224,11 +243,12 @@ done: | |||
224 | static void | 243 | static void |
225 | qla2x00_async_adisc_ctx_done(srb_t *sp) | 244 | qla2x00_async_adisc_ctx_done(srb_t *sp) |
226 | { | 245 | { |
227 | struct srb_logio *lio = sp->ctx; | 246 | struct srb_ctx *ctx = sp->ctx; |
247 | struct srb_iocb *lio = ctx->u.iocb_cmd; | ||
228 | 248 | ||
229 | qla2x00_post_async_adisc_done_work(sp->fcport->vha, sp->fcport, | 249 | qla2x00_post_async_adisc_done_work(sp->fcport->vha, sp->fcport, |
230 | lio->data); | 250 | lio->u.logio.data); |
231 | lio->ctx.free(sp); | 251 | lio->free(sp); |
232 | } | 252 | } |
233 | 253 | ||
234 | int | 254 | int |
@@ -237,22 +257,24 @@ qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport, | |||
237 | { | 257 | { |
238 | struct qla_hw_data *ha = vha->hw; | 258 | struct qla_hw_data *ha = vha->hw; |
239 | srb_t *sp; | 259 | srb_t *sp; |
240 | struct srb_logio *lio; | 260 | struct srb_ctx *ctx; |
261 | struct srb_iocb *lio; | ||
241 | int rval; | 262 | int rval; |
242 | 263 | ||
243 | rval = QLA_FUNCTION_FAILED; | 264 | rval = QLA_FUNCTION_FAILED; |
244 | sp = qla2x00_get_ctx_sp(vha, fcport, sizeof(struct srb_logio), | 265 | sp = qla2x00_get_ctx_sp(vha, fcport, sizeof(struct srb_ctx), |
245 | ELS_TMO_2_RATOV(ha) + 2); | 266 | ELS_TMO_2_RATOV(ha) + 2); |
246 | if (!sp) | 267 | if (!sp) |
247 | goto done; | 268 | goto done; |
248 | 269 | ||
249 | lio = sp->ctx; | 270 | ctx = sp->ctx; |
250 | lio->ctx.type = SRB_ADISC_CMD; | 271 | ctx->type = SRB_ADISC_CMD; |
251 | lio->ctx.name = "adisc"; | 272 | ctx->name = "adisc"; |
252 | lio->ctx.timeout = qla2x00_async_logio_timeout; | 273 | lio = ctx->u.iocb_cmd; |
253 | lio->ctx.done = qla2x00_async_adisc_ctx_done; | 274 | lio->timeout = qla2x00_async_logio_timeout; |
275 | lio->done = qla2x00_async_adisc_ctx_done; | ||
254 | if (data[1] & QLA_LOGIO_LOGIN_RETRIED) | 276 | if (data[1] & QLA_LOGIO_LOGIN_RETRIED) |
255 | lio->flags |= SRB_LOGIN_RETRIED; | 277 | lio->u.logio.flags |= SRB_LOGIN_RETRIED; |
256 | rval = qla2x00_start_sp(sp); | 278 | rval = qla2x00_start_sp(sp); |
257 | if (rval != QLA_SUCCESS) | 279 | if (rval != QLA_SUCCESS) |
258 | goto done_free_sp; | 280 | goto done_free_sp; |
@@ -265,13 +287,12 @@ qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport, | |||
265 | return rval; | 287 | return rval; |
266 | 288 | ||
267 | done_free_sp: | 289 | done_free_sp: |
268 | del_timer_sync(&lio->ctx.timer); | 290 | lio->free(sp); |
269 | lio->ctx.free(sp); | ||
270 | done: | 291 | done: |
271 | return rval; | 292 | return rval; |
272 | } | 293 | } |
273 | 294 | ||
274 | int | 295 | void |
275 | qla2x00_async_login_done(struct scsi_qla_host *vha, fc_port_t *fcport, | 296 | qla2x00_async_login_done(struct scsi_qla_host *vha, fc_port_t *fcport, |
276 | uint16_t *data) | 297 | uint16_t *data) |
277 | { | 298 | { |
@@ -308,25 +329,25 @@ qla2x00_async_login_done(struct scsi_qla_host *vha, fc_port_t *fcport, | |||
308 | qla2x00_post_async_login_work(vha, fcport, NULL); | 329 | qla2x00_post_async_login_work(vha, fcport, NULL); |
309 | break; | 330 | break; |
310 | } | 331 | } |
311 | return QLA_SUCCESS; | 332 | return; |
312 | } | 333 | } |
313 | 334 | ||
314 | int | 335 | void |
315 | qla2x00_async_logout_done(struct scsi_qla_host *vha, fc_port_t *fcport, | 336 | qla2x00_async_logout_done(struct scsi_qla_host *vha, fc_port_t *fcport, |
316 | uint16_t *data) | 337 | uint16_t *data) |
317 | { | 338 | { |
318 | qla2x00_mark_device_lost(vha, fcport, 1, 0); | 339 | qla2x00_mark_device_lost(vha, fcport, 1, 0); |
319 | return QLA_SUCCESS; | 340 | return; |
320 | } | 341 | } |
321 | 342 | ||
322 | int | 343 | void |
323 | qla2x00_async_adisc_done(struct scsi_qla_host *vha, fc_port_t *fcport, | 344 | qla2x00_async_adisc_done(struct scsi_qla_host *vha, fc_port_t *fcport, |
324 | uint16_t *data) | 345 | uint16_t *data) |
325 | { | 346 | { |
326 | if (data[0] == MBS_COMMAND_COMPLETE) { | 347 | if (data[0] == MBS_COMMAND_COMPLETE) { |
327 | qla2x00_update_fcport(vha, fcport); | 348 | qla2x00_update_fcport(vha, fcport); |
328 | 349 | ||
329 | return QLA_SUCCESS; | 350 | return; |
330 | } | 351 | } |
331 | 352 | ||
332 | /* Retry login. */ | 353 | /* Retry login. */ |
@@ -336,7 +357,7 @@ qla2x00_async_adisc_done(struct scsi_qla_host *vha, fc_port_t *fcport, | |||
336 | else | 357 | else |
337 | qla2x00_mark_device_lost(vha, fcport, 1, 0); | 358 | qla2x00_mark_device_lost(vha, fcport, 1, 0); |
338 | 359 | ||
339 | return QLA_SUCCESS; | 360 | return; |
340 | } | 361 | } |
341 | 362 | ||
342 | /****************************************************************************/ | 363 | /****************************************************************************/ |
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 8112e41065f2..8861b88319fb 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) | |||
983 | static void | 983 | static void |
984 | qla24xx_login_iocb(srb_t *sp, struct logio_entry_24xx *logio) | 984 | qla24xx_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 | |||
1002 | qla2x00_login_iocb(srb_t *sp, struct mbx_entry *mbx) | 1003 | qla2x00_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) | |||
1086 | static void | 1088 | static void |
1087 | qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) | 1089 | qla24xx_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; |
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 | /** |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 2e083c0d9215..70651f9fa653 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -1191,24 +1191,19 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) | |||
1191 | ctx = sp->ctx; | 1191 | ctx = sp->ctx; |
1192 | if (ctx->type == SRB_LOGIN_CMD || | 1192 | if (ctx->type == SRB_LOGIN_CMD || |
1193 | ctx->type == SRB_LOGOUT_CMD) { | 1193 | ctx->type == SRB_LOGOUT_CMD) { |
1194 | del_timer_sync(&ctx->timer); | 1194 | ctx->u.iocb_cmd->free(sp); |
1195 | ctx->free(sp); | ||
1196 | } else { | 1195 | } else { |
1197 | struct srb_bsg *sp_bsg = | ||
1198 | (struct srb_bsg *)sp->ctx; | ||
1199 | struct fc_bsg_job *bsg_job = | 1196 | struct fc_bsg_job *bsg_job = |
1200 | sp_bsg->bsg_job; | 1197 | ctx->u.bsg_job; |
1201 | |||
1202 | if (bsg_job->request->msgcode | 1198 | if (bsg_job->request->msgcode |
1203 | == FC_BSG_HST_CT) | 1199 | == FC_BSG_HST_CT) |
1204 | kfree(sp->fcport); | 1200 | kfree(sp->fcport); |
1205 | bsg_job->req->errors = 0; | 1201 | bsg_job->req->errors = 0; |
1206 | bsg_job->reply->result = res; | 1202 | bsg_job->reply->result = res; |
1207 | bsg_job->job_done( | 1203 | bsg_job->job_done(bsg_job); |
1208 | sp_bsg->bsg_job); | ||
1209 | kfree(sp->ctx); | 1204 | kfree(sp->ctx); |
1210 | mempool_free(sp, | 1205 | mempool_free(sp, |
1211 | ha->srb_mempool); | 1206 | ha->srb_mempool); |
1212 | } | 1207 | } |
1213 | } | 1208 | } |
1214 | } | 1209 | } |