diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2008-05-21 16:54:08 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-07-12 09:22:19 -0400 |
commit | 2747fdb25726caa1a89229f43d99ca50af72576a (patch) | |
tree | 77e2da2ba710cb09f8e9ee4564a75ba6bb17bd5e /drivers/infiniband | |
parent | fbc514b4e262bc0596faae8640ebc0b9142a1cdd (diff) |
[SCSI] iser: convert ib_iser to support merged tasks
Convert ib_iser to support merged tasks.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.c | 82 | ||||
-rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.h | 14 | ||||
-rw-r--r-- | drivers/infiniband/ulp/iser/iser_initiator.c | 42 |
3 files changed, 68 insertions, 70 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 7b1468869066..baecca1ed42a 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
@@ -124,15 +124,23 @@ error: | |||
124 | 124 | ||
125 | 125 | ||
126 | /** | 126 | /** |
127 | * iscsi_iser_cmd_init - Initialize iSCSI SCSI_READ or SCSI_WRITE commands | 127 | * iscsi_iser_task_init - Initialize ctask |
128 | * @ctask: iscsi ctask | ||
128 | * | 129 | * |
129 | **/ | 130 | * Initialize the ctask for the scsi command or mgmt command. |
131 | */ | ||
130 | static int | 132 | static int |
131 | iscsi_iser_cmd_init(struct iscsi_cmd_task *ctask) | 133 | iscsi_iser_task_init(struct iscsi_cmd_task *ctask) |
132 | { | 134 | { |
133 | struct iscsi_iser_conn *iser_conn = ctask->conn->dd_data; | 135 | struct iscsi_iser_conn *iser_conn = ctask->conn->dd_data; |
134 | struct iscsi_iser_cmd_task *iser_ctask = ctask->dd_data; | 136 | struct iscsi_iser_cmd_task *iser_ctask = ctask->dd_data; |
135 | 137 | ||
138 | /* mgmt ctask */ | ||
139 | if (!ctask->sc) { | ||
140 | iser_ctask->desc.data = ctask->data; | ||
141 | return 0; | ||
142 | } | ||
143 | |||
136 | iser_ctask->command_sent = 0; | 144 | iser_ctask->command_sent = 0; |
137 | iser_ctask->iser_conn = iser_conn; | 145 | iser_ctask->iser_conn = iser_conn; |
138 | iser_ctask_rdma_init(iser_ctask); | 146 | iser_ctask_rdma_init(iser_ctask); |
@@ -140,9 +148,9 @@ iscsi_iser_cmd_init(struct iscsi_cmd_task *ctask) | |||
140 | } | 148 | } |
141 | 149 | ||
142 | /** | 150 | /** |
143 | * iscsi_mtask_xmit - xmit management(immediate) task | 151 | * iscsi_iser_mtask_xmit - xmit management(immediate) ctask |
144 | * @conn: iscsi connection | 152 | * @conn: iscsi connection |
145 | * @mtask: task management task | 153 | * @ctask: ctask management ctask |
146 | * | 154 | * |
147 | * Notes: | 155 | * Notes: |
148 | * The function can return -EAGAIN in which case caller must | 156 | * The function can return -EAGAIN in which case caller must |
@@ -151,20 +159,19 @@ iscsi_iser_cmd_init(struct iscsi_cmd_task *ctask) | |||
151 | * | 159 | * |
152 | **/ | 160 | **/ |
153 | static int | 161 | static int |
154 | iscsi_iser_mtask_xmit(struct iscsi_conn *conn, | 162 | iscsi_iser_mtask_xmit(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) |
155 | struct iscsi_mgmt_task *mtask) | ||
156 | { | 163 | { |
157 | int error = 0; | 164 | int error = 0; |
158 | 165 | ||
159 | debug_scsi("mtask deq [cid %d itt 0x%x]\n", conn->id, mtask->itt); | 166 | debug_scsi("ctask deq [cid %d itt 0x%x]\n", conn->id, ctask->itt); |
160 | 167 | ||
161 | error = iser_send_control(conn, mtask); | 168 | error = iser_send_control(conn, ctask); |
162 | 169 | ||
163 | /* since iser xmits control with zero copy, mtasks can not be recycled | 170 | /* since iser xmits control with zero copy, ctasks can not be recycled |
164 | * right after sending them. | 171 | * right after sending them. |
165 | * The recycling scheme is based on whether a response is expected | 172 | * The recycling scheme is based on whether a response is expected |
166 | * - if yes, the mtask is recycled at iscsi_complete_pdu | 173 | * - if yes, the ctask is recycled at iscsi_complete_pdu |
167 | * - if no, the mtask is recycled at iser_snd_completion | 174 | * - if no, the ctask is recycled at iser_snd_completion |
168 | */ | 175 | */ |
169 | if (error && error != -ENOBUFS) | 176 | if (error && error != -ENOBUFS) |
170 | iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); | 177 | iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); |
@@ -173,7 +180,7 @@ iscsi_iser_mtask_xmit(struct iscsi_conn *conn, | |||
173 | } | 180 | } |
174 | 181 | ||
175 | static int | 182 | static int |
176 | iscsi_iser_ctask_xmit_unsol_data(struct iscsi_conn *conn, | 183 | iscsi_iser_task_xmit_unsol_data(struct iscsi_conn *conn, |
177 | struct iscsi_cmd_task *ctask) | 184 | struct iscsi_cmd_task *ctask) |
178 | { | 185 | { |
179 | struct iscsi_data hdr; | 186 | struct iscsi_data hdr; |
@@ -190,24 +197,27 @@ iscsi_iser_ctask_xmit_unsol_data(struct iscsi_conn *conn, | |||
190 | error = iser_send_data_out(conn, ctask, &hdr); | 197 | error = iser_send_data_out(conn, ctask, &hdr); |
191 | if (error) { | 198 | if (error) { |
192 | ctask->unsol_datasn--; | 199 | ctask->unsol_datasn--; |
193 | goto iscsi_iser_ctask_xmit_unsol_data_exit; | 200 | goto iscsi_iser_task_xmit_unsol_data_exit; |
194 | } | 201 | } |
195 | ctask->unsol_count -= ctask->data_count; | 202 | ctask->unsol_count -= ctask->data_count; |
196 | debug_scsi("Need to send %d more as data-out PDUs\n", | 203 | debug_scsi("Need to send %d more as data-out PDUs\n", |
197 | ctask->unsol_count); | 204 | ctask->unsol_count); |
198 | } | 205 | } |
199 | 206 | ||
200 | iscsi_iser_ctask_xmit_unsol_data_exit: | 207 | iscsi_iser_task_xmit_unsol_data_exit: |
201 | return error; | 208 | return error; |
202 | } | 209 | } |
203 | 210 | ||
204 | static int | 211 | static int |
205 | iscsi_iser_ctask_xmit(struct iscsi_conn *conn, | 212 | iscsi_iser_task_xmit(struct iscsi_cmd_task *ctask) |
206 | struct iscsi_cmd_task *ctask) | ||
207 | { | 213 | { |
214 | struct iscsi_conn *conn = ctask->conn; | ||
208 | struct iscsi_iser_cmd_task *iser_ctask = ctask->dd_data; | 215 | struct iscsi_iser_cmd_task *iser_ctask = ctask->dd_data; |
209 | int error = 0; | 216 | int error = 0; |
210 | 217 | ||
218 | if (!ctask->sc) | ||
219 | return iscsi_iser_mtask_xmit(conn, ctask); | ||
220 | |||
211 | if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) { | 221 | if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) { |
212 | BUG_ON(scsi_bufflen(ctask->sc) == 0); | 222 | BUG_ON(scsi_bufflen(ctask->sc) == 0); |
213 | 223 | ||
@@ -223,25 +233,29 @@ iscsi_iser_ctask_xmit(struct iscsi_conn *conn, | |||
223 | if (!iser_ctask->command_sent) { | 233 | if (!iser_ctask->command_sent) { |
224 | error = iser_send_command(conn, ctask); | 234 | error = iser_send_command(conn, ctask); |
225 | if (error) | 235 | if (error) |
226 | goto iscsi_iser_ctask_xmit_exit; | 236 | goto iscsi_iser_task_xmit_exit; |
227 | iser_ctask->command_sent = 1; | 237 | iser_ctask->command_sent = 1; |
228 | } | 238 | } |
229 | 239 | ||
230 | /* Send unsolicited data-out PDU(s) if necessary */ | 240 | /* Send unsolicited data-out PDU(s) if necessary */ |
231 | if (ctask->unsol_count) | 241 | if (ctask->unsol_count) |
232 | error = iscsi_iser_ctask_xmit_unsol_data(conn, ctask); | 242 | error = iscsi_iser_task_xmit_unsol_data(conn, ctask); |
233 | 243 | ||
234 | iscsi_iser_ctask_xmit_exit: | 244 | iscsi_iser_task_xmit_exit: |
235 | if (error && error != -ENOBUFS) | 245 | if (error && error != -ENOBUFS) |
236 | iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); | 246 | iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); |
237 | return error; | 247 | return error; |
238 | } | 248 | } |
239 | 249 | ||
240 | static void | 250 | static void |
241 | iscsi_iser_cleanup_ctask(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | 251 | iscsi_iser_cleanup_task(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) |
242 | { | 252 | { |
243 | struct iscsi_iser_cmd_task *iser_ctask = ctask->dd_data; | 253 | struct iscsi_iser_cmd_task *iser_ctask = ctask->dd_data; |
244 | 254 | ||
255 | /* mgmt tasks do not need special cleanup */ | ||
256 | if (!ctask->sc) | ||
257 | return; | ||
258 | |||
245 | if (iser_ctask->status == ISER_TASK_STATUS_STARTED) { | 259 | if (iser_ctask->status == ISER_TASK_STATUS_STARTED) { |
246 | iser_ctask->status = ISER_TASK_STATUS_COMPLETED; | 260 | iser_ctask->status = ISER_TASK_STATUS_COMPLETED; |
247 | iser_ctask_rdma_finalize(iser_ctask); | 261 | iser_ctask_rdma_finalize(iser_ctask); |
@@ -394,10 +408,8 @@ iscsi_iser_session_create(struct Scsi_Host *shost, | |||
394 | struct iscsi_cls_session *cls_session; | 408 | struct iscsi_cls_session *cls_session; |
395 | struct iscsi_session *session; | 409 | struct iscsi_session *session; |
396 | int i; | 410 | int i; |
397 | struct iscsi_cmd_task *ctask; | 411 | struct iscsi_cmd_task *ctask; |
398 | struct iscsi_mgmt_task *mtask; | ||
399 | struct iscsi_iser_cmd_task *iser_ctask; | 412 | struct iscsi_iser_cmd_task *iser_ctask; |
400 | struct iser_desc *desc; | ||
401 | 413 | ||
402 | if (shost) { | 414 | if (shost) { |
403 | printk(KERN_ERR "iscsi_tcp: invalid shost %d.\n", | 415 | printk(KERN_ERR "iscsi_tcp: invalid shost %d.\n", |
@@ -425,28 +437,19 @@ iscsi_iser_session_create(struct Scsi_Host *shost, | |||
425 | cls_session = iscsi_session_setup(&iscsi_iser_transport, shost, | 437 | cls_session = iscsi_session_setup(&iscsi_iser_transport, shost, |
426 | ISCSI_DEF_XMIT_CMDS_MAX, | 438 | ISCSI_DEF_XMIT_CMDS_MAX, |
427 | sizeof(struct iscsi_iser_cmd_task), | 439 | sizeof(struct iscsi_iser_cmd_task), |
428 | sizeof(struct iser_desc), | ||
429 | initial_cmdsn); | 440 | initial_cmdsn); |
430 | if (!cls_session) | 441 | if (!cls_session) |
431 | goto remove_host; | 442 | goto remove_host; |
432 | session = cls_session->dd_data; | 443 | session = cls_session->dd_data; |
433 | 444 | ||
434 | shost->can_queue = session->cmds_max; | 445 | shost->can_queue = session->scsi_cmds_max; |
435 | /* libiscsi setup itts, data and pool so just set desc fields */ | 446 | /* libiscsi setup itts, data and pool so just set desc fields */ |
436 | for (i = 0; i < session->cmds_max; i++) { | 447 | for (i = 0; i < session->cmds_max; i++) { |
437 | ctask = session->cmds[i]; | 448 | ctask = session->cmds[i]; |
438 | iser_ctask = ctask->dd_data; | 449 | iser_ctask = ctask->dd_data; |
439 | ctask->hdr = (struct iscsi_cmd *)&iser_ctask->desc.iscsi_header; | 450 | ctask->hdr = (struct iscsi_cmd *)&iser_ctask->desc.iscsi_header; |
440 | ctask->hdr_max = sizeof(iser_ctask->desc.iscsi_header); | 451 | ctask->hdr_max = sizeof(iser_ctask->desc.iscsi_header); |
441 | } | 452 | } |
442 | |||
443 | for (i = 0; i < session->mgmtpool_max; i++) { | ||
444 | mtask = session->mgmt_cmds[i]; | ||
445 | desc = mtask->dd_data; | ||
446 | mtask->hdr = &desc->iscsi_header; | ||
447 | desc->data = mtask->data; | ||
448 | } | ||
449 | |||
450 | return cls_session; | 453 | return cls_session; |
451 | 454 | ||
452 | remove_host: | 455 | remove_host: |
@@ -659,10 +662,9 @@ static struct iscsi_transport iscsi_iser_transport = { | |||
659 | /* IO */ | 662 | /* IO */ |
660 | .send_pdu = iscsi_conn_send_pdu, | 663 | .send_pdu = iscsi_conn_send_pdu, |
661 | .get_stats = iscsi_iser_conn_get_stats, | 664 | .get_stats = iscsi_iser_conn_get_stats, |
662 | .init_cmd_task = iscsi_iser_cmd_init, | 665 | .init_task = iscsi_iser_task_init, |
663 | .xmit_cmd_task = iscsi_iser_ctask_xmit, | 666 | .xmit_task = iscsi_iser_task_xmit, |
664 | .xmit_mgmt_task = iscsi_iser_mtask_xmit, | 667 | .cleanup_task = iscsi_iser_cleanup_task, |
665 | .cleanup_cmd_task = iscsi_iser_cleanup_ctask, | ||
666 | /* recovery */ | 668 | /* recovery */ |
667 | .session_recovery_timedout = iscsi_session_recovery_timedout, | 669 | .session_recovery_timedout = iscsi_session_recovery_timedout, |
668 | 670 | ||
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h index bd5c1a554ea6..96a600f127c8 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.h +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h | |||
@@ -298,15 +298,15 @@ extern int iser_debug_level; | |||
298 | /* allocate connection resources needed for rdma functionality */ | 298 | /* allocate connection resources needed for rdma functionality */ |
299 | int iser_conn_set_full_featured_mode(struct iscsi_conn *conn); | 299 | int iser_conn_set_full_featured_mode(struct iscsi_conn *conn); |
300 | 300 | ||
301 | int iser_send_control(struct iscsi_conn *conn, | 301 | int iser_send_control(struct iscsi_conn *conn, |
302 | struct iscsi_mgmt_task *mtask); | 302 | struct iscsi_cmd_task *ctask); |
303 | 303 | ||
304 | int iser_send_command(struct iscsi_conn *conn, | 304 | int iser_send_command(struct iscsi_conn *conn, |
305 | struct iscsi_cmd_task *ctask); | 305 | struct iscsi_cmd_task *ctask); |
306 | 306 | ||
307 | int iser_send_data_out(struct iscsi_conn *conn, | 307 | int iser_send_data_out(struct iscsi_conn *conn, |
308 | struct iscsi_cmd_task *ctask, | 308 | struct iscsi_cmd_task *ctask, |
309 | struct iscsi_data *hdr); | 309 | struct iscsi_data *hdr); |
310 | 310 | ||
311 | void iscsi_iser_recv(struct iscsi_conn *conn, | 311 | void iscsi_iser_recv(struct iscsi_conn *conn, |
312 | struct iscsi_hdr *hdr, | 312 | struct iscsi_hdr *hdr, |
@@ -326,7 +326,7 @@ void iser_rcv_completion(struct iser_desc *desc, | |||
326 | 326 | ||
327 | void iser_snd_completion(struct iser_desc *desc); | 327 | void iser_snd_completion(struct iser_desc *desc); |
328 | 328 | ||
329 | void iser_ctask_rdma_init(struct iscsi_iser_cmd_task *ctask); | 329 | void iser_ctask_rdma_init(struct iscsi_iser_cmd_task *ctask); |
330 | 330 | ||
331 | void iser_ctask_rdma_finalize(struct iscsi_iser_cmd_task *ctask); | 331 | void iser_ctask_rdma_finalize(struct iscsi_iser_cmd_task *ctask); |
332 | 332 | ||
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index b82a5f2d4d37..4ea78fbeee95 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c | |||
@@ -300,13 +300,13 @@ int iser_conn_set_full_featured_mode(struct iscsi_conn *conn) | |||
300 | } | 300 | } |
301 | 301 | ||
302 | static int | 302 | static int |
303 | iser_check_xmit(struct iscsi_conn *conn, void *task) | 303 | iser_check_xmit(struct iscsi_conn *conn, void *ctask) |
304 | { | 304 | { |
305 | struct iscsi_iser_conn *iser_conn = conn->dd_data; | 305 | struct iscsi_iser_conn *iser_conn = conn->dd_data; |
306 | 306 | ||
307 | if (atomic_read(&iser_conn->ib_conn->post_send_buf_count) == | 307 | if (atomic_read(&iser_conn->ib_conn->post_send_buf_count) == |
308 | ISER_QP_MAX_REQ_DTOS) { | 308 | ISER_QP_MAX_REQ_DTOS) { |
309 | iser_dbg("%ld can't xmit task %p\n",jiffies,task); | 309 | iser_dbg("%ld can't xmit ctask %p\n",jiffies,ctask); |
310 | return -ENOBUFS; | 310 | return -ENOBUFS; |
311 | } | 311 | } |
312 | return 0; | 312 | return 0; |
@@ -316,7 +316,7 @@ iser_check_xmit(struct iscsi_conn *conn, void *task) | |||
316 | /** | 316 | /** |
317 | * iser_send_command - send command PDU | 317 | * iser_send_command - send command PDU |
318 | */ | 318 | */ |
319 | int iser_send_command(struct iscsi_conn *conn, | 319 | int iser_send_command(struct iscsi_conn *conn, |
320 | struct iscsi_cmd_task *ctask) | 320 | struct iscsi_cmd_task *ctask) |
321 | { | 321 | { |
322 | struct iscsi_iser_conn *iser_conn = conn->dd_data; | 322 | struct iscsi_iser_conn *iser_conn = conn->dd_data; |
@@ -395,7 +395,7 @@ send_command_error: | |||
395 | /** | 395 | /** |
396 | * iser_send_data_out - send data out PDU | 396 | * iser_send_data_out - send data out PDU |
397 | */ | 397 | */ |
398 | int iser_send_data_out(struct iscsi_conn *conn, | 398 | int iser_send_data_out(struct iscsi_conn *conn, |
399 | struct iscsi_cmd_task *ctask, | 399 | struct iscsi_cmd_task *ctask, |
400 | struct iscsi_data *hdr) | 400 | struct iscsi_data *hdr) |
401 | { | 401 | { |
@@ -470,10 +470,11 @@ send_data_out_error: | |||
470 | } | 470 | } |
471 | 471 | ||
472 | int iser_send_control(struct iscsi_conn *conn, | 472 | int iser_send_control(struct iscsi_conn *conn, |
473 | struct iscsi_mgmt_task *mtask) | 473 | struct iscsi_cmd_task *ctask) |
474 | { | 474 | { |
475 | struct iscsi_iser_conn *iser_conn = conn->dd_data; | 475 | struct iscsi_iser_conn *iser_conn = conn->dd_data; |
476 | struct iser_desc *mdesc = mtask->dd_data; | 476 | struct iscsi_iser_cmd_task *iser_ctask = ctask->dd_data; |
477 | struct iser_desc *mdesc = &iser_ctask->desc; | ||
477 | struct iser_dto *send_dto = NULL; | 478 | struct iser_dto *send_dto = NULL; |
478 | unsigned long data_seg_len; | 479 | unsigned long data_seg_len; |
479 | int err = 0; | 480 | int err = 0; |
@@ -485,7 +486,7 @@ int iser_send_control(struct iscsi_conn *conn, | |||
485 | return -EPERM; | 486 | return -EPERM; |
486 | } | 487 | } |
487 | 488 | ||
488 | if (iser_check_xmit(conn,mtask)) | 489 | if (iser_check_xmit(conn, ctask)) |
489 | return -ENOBUFS; | 490 | return -ENOBUFS; |
490 | 491 | ||
491 | /* build the tx desc regd header and add it to the tx desc dto */ | 492 | /* build the tx desc regd header and add it to the tx desc dto */ |
@@ -498,14 +499,14 @@ int iser_send_control(struct iscsi_conn *conn, | |||
498 | 499 | ||
499 | iser_reg_single(device, send_dto->regd[0], DMA_TO_DEVICE); | 500 | iser_reg_single(device, send_dto->regd[0], DMA_TO_DEVICE); |
500 | 501 | ||
501 | data_seg_len = ntoh24(mtask->hdr->dlength); | 502 | data_seg_len = ntoh24(ctask->hdr->dlength); |
502 | 503 | ||
503 | if (data_seg_len > 0) { | 504 | if (data_seg_len > 0) { |
504 | regd_buf = &mdesc->data_regd_buf; | 505 | regd_buf = &mdesc->data_regd_buf; |
505 | memset(regd_buf, 0, sizeof(struct iser_regd_buf)); | 506 | memset(regd_buf, 0, sizeof(struct iser_regd_buf)); |
506 | regd_buf->device = device; | 507 | regd_buf->device = device; |
507 | regd_buf->virt_addr = mtask->data; | 508 | regd_buf->virt_addr = ctask->data; |
508 | regd_buf->data_size = mtask->data_count; | 509 | regd_buf->data_size = ctask->data_count; |
509 | iser_reg_single(device, regd_buf, | 510 | iser_reg_single(device, regd_buf, |
510 | DMA_TO_DEVICE); | 511 | DMA_TO_DEVICE); |
511 | iser_dto_add_regd_buff(send_dto, regd_buf, | 512 | iser_dto_add_regd_buff(send_dto, regd_buf, |
@@ -535,7 +536,7 @@ send_control_error: | |||
535 | void iser_rcv_completion(struct iser_desc *rx_desc, | 536 | void iser_rcv_completion(struct iser_desc *rx_desc, |
536 | unsigned long dto_xfer_len) | 537 | unsigned long dto_xfer_len) |
537 | { | 538 | { |
538 | struct iser_dto *dto = &rx_desc->dto; | 539 | struct iser_dto *dto = &rx_desc->dto; |
539 | struct iscsi_iser_conn *conn = dto->ib_conn->iser_conn; | 540 | struct iscsi_iser_conn *conn = dto->ib_conn->iser_conn; |
540 | struct iscsi_cmd_task *ctask; | 541 | struct iscsi_cmd_task *ctask; |
541 | struct iscsi_iser_cmd_task *iser_ctask; | 542 | struct iscsi_iser_cmd_task *iser_ctask; |
@@ -559,7 +560,7 @@ void iser_rcv_completion(struct iser_desc *rx_desc, | |||
559 | if (opcode == ISCSI_OP_SCSI_CMD_RSP) { | 560 | if (opcode == ISCSI_OP_SCSI_CMD_RSP) { |
560 | ctask = iscsi_itt_to_ctask(conn->iscsi_conn, hdr->itt); | 561 | ctask = iscsi_itt_to_ctask(conn->iscsi_conn, hdr->itt); |
561 | if (!ctask) | 562 | if (!ctask) |
562 | iser_err("itt can't be matched to task!!! " | 563 | iser_err("itt can't be matched to ctask!!! " |
563 | "conn %p opcode %d itt %d\n", | 564 | "conn %p opcode %d itt %d\n", |
564 | conn->iscsi_conn, opcode, hdr->itt); | 565 | conn->iscsi_conn, opcode, hdr->itt); |
565 | else { | 566 | else { |
@@ -577,7 +578,7 @@ void iser_rcv_completion(struct iser_desc *rx_desc, | |||
577 | kmem_cache_free(ig.desc_cache, rx_desc); | 578 | kmem_cache_free(ig.desc_cache, rx_desc); |
578 | 579 | ||
579 | /* decrementing conn->post_recv_buf_count only --after-- freeing the * | 580 | /* decrementing conn->post_recv_buf_count only --after-- freeing the * |
580 | * task eliminates the need to worry on tasks which are completed in * | 581 | * ctask eliminates the need to worry on ctasks which are completed in * |
581 | * parallel to the execution of iser_conn_term. So the code that waits * | 582 | * parallel to the execution of iser_conn_term. So the code that waits * |
582 | * for the posted rx bufs refcount to become zero handles everything */ | 583 | * for the posted rx bufs refcount to become zero handles everything */ |
583 | atomic_dec(&conn->ib_conn->post_recv_buf_count); | 584 | atomic_dec(&conn->ib_conn->post_recv_buf_count); |
@@ -589,7 +590,7 @@ void iser_snd_completion(struct iser_desc *tx_desc) | |||
589 | struct iser_conn *ib_conn = dto->ib_conn; | 590 | struct iser_conn *ib_conn = dto->ib_conn; |
590 | struct iscsi_iser_conn *iser_conn = ib_conn->iser_conn; | 591 | struct iscsi_iser_conn *iser_conn = ib_conn->iser_conn; |
591 | struct iscsi_conn *conn = iser_conn->iscsi_conn; | 592 | struct iscsi_conn *conn = iser_conn->iscsi_conn; |
592 | struct iscsi_mgmt_task *mtask; | 593 | struct iscsi_cmd_task *ctask; |
593 | int resume_tx = 0; | 594 | int resume_tx = 0; |
594 | 595 | ||
595 | iser_dbg("Initiator, Data sent dto=0x%p\n", dto); | 596 | iser_dbg("Initiator, Data sent dto=0x%p\n", dto); |
@@ -612,15 +613,10 @@ void iser_snd_completion(struct iser_desc *tx_desc) | |||
612 | 613 | ||
613 | if (tx_desc->type == ISCSI_TX_CONTROL) { | 614 | if (tx_desc->type == ISCSI_TX_CONTROL) { |
614 | /* this arithmetic is legal by libiscsi dd_data allocation */ | 615 | /* this arithmetic is legal by libiscsi dd_data allocation */ |
615 | mtask = (void *) ((long)(void *)tx_desc - | 616 | ctask = (void *) ((long)(void *)tx_desc - |
616 | sizeof(struct iscsi_mgmt_task)); | 617 | sizeof(struct iscsi_cmd_task)); |
617 | if (mtask->hdr->itt == RESERVED_ITT) { | 618 | if (ctask->hdr->itt == RESERVED_ITT) |
618 | struct iscsi_session *session = conn->session; | 619 | iscsi_put_ctask(ctask); |
619 | |||
620 | spin_lock(&conn->session->lock); | ||
621 | iscsi_free_mgmt_task(conn, mtask); | ||
622 | spin_unlock(&session->lock); | ||
623 | } | ||
624 | } | 620 | } |
625 | } | 621 | } |
626 | 622 | ||