aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2008-12-02 01:32:06 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-12-29 12:24:20 -0500
commit0f9c7449ce050759d10424048b96d1bd0d59dcc1 (patch)
tree24fa0c3f3e06df01a1fe4b52e82bee411074478c /drivers/infiniband
parent577577da6d197ea3dcf3ee19c4f902fbd3a9390a (diff)
[SCSI] iser: convert iser to new alloc_pdu api
This just converts iser to new alloc_pdu api. It still preallocates the pdu, so there is no difference. 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.c48
-rw-r--r--drivers/infiniband/ulp/iser/iser_initiator.c5
2 files changed, 27 insertions, 26 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 1e5b6446231d..78bf5e4538cb 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -119,6 +119,14 @@ error:
119 iscsi_conn_failure(conn, rc); 119 iscsi_conn_failure(conn, rc);
120} 120}
121 121
122static int iscsi_iser_pdu_alloc(struct iscsi_task *task)
123{
124 struct iscsi_iser_task *iser_task = task->dd_data;
125
126 task->hdr = (struct iscsi_hdr *)&iser_task->desc.iscsi_header;
127 task->hdr_max = sizeof(iser_task->desc.iscsi_header);
128 return 0;
129}
122 130
123/** 131/**
124 * iscsi_iser_task_init - Initialize task 132 * iscsi_iser_task_init - Initialize task
@@ -180,25 +188,26 @@ static int
180iscsi_iser_task_xmit_unsol_data(struct iscsi_conn *conn, 188iscsi_iser_task_xmit_unsol_data(struct iscsi_conn *conn,
181 struct iscsi_task *task) 189 struct iscsi_task *task)
182{ 190{
183 struct iscsi_data hdr; 191 struct iscsi_r2t_info *r2t = &task->unsol_r2t;
192 struct iscsi_data hdr;
184 int error = 0; 193 int error = 0;
185 194
186 /* Send data-out PDUs while there's still unsolicited data to send */ 195 /* Send data-out PDUs while there's still unsolicited data to send */
187 while (task->unsol_count > 0) { 196 while (iscsi_task_has_unsol_data(task)) {
188 iscsi_prep_unsolicit_data_pdu(task, &hdr); 197 iscsi_prep_data_out_pdu(task, r2t, &hdr);
189 debug_scsi("Sending data-out: itt 0x%x, data count %d\n", 198 debug_scsi("Sending data-out: itt 0x%x, data count %d\n",
190 hdr.itt, task->data_count); 199 hdr.itt, r2t->data_count);
191 200
192 /* the buffer description has been passed with the command */ 201 /* the buffer description has been passed with the command */
193 /* Send the command */ 202 /* Send the command */
194 error = iser_send_data_out(conn, task, &hdr); 203 error = iser_send_data_out(conn, task, &hdr);
195 if (error) { 204 if (error) {
196 task->unsol_datasn--; 205 r2t->datasn--;
197 goto iscsi_iser_task_xmit_unsol_data_exit; 206 goto iscsi_iser_task_xmit_unsol_data_exit;
198 } 207 }
199 task->unsol_count -= task->data_count; 208 r2t->sent += r2t->data_count;
200 debug_scsi("Need to send %d more as data-out PDUs\n", 209 debug_scsi("Need to send %d more as data-out PDUs\n",
201 task->unsol_count); 210 r2t->data_length - r2t->sent);
202 } 211 }
203 212
204iscsi_iser_task_xmit_unsol_data_exit: 213iscsi_iser_task_xmit_unsol_data_exit:
@@ -220,7 +229,7 @@ iscsi_iser_task_xmit(struct iscsi_task *task)
220 229
221 debug_scsi("cmd [itt %x total %d imm %d unsol_data %d\n", 230 debug_scsi("cmd [itt %x total %d imm %d unsol_data %d\n",
222 task->itt, scsi_bufflen(task->sc), 231 task->itt, scsi_bufflen(task->sc),
223 task->imm_count, task->unsol_count); 232 task->imm_count, task->unsol_r2t.data_length);
224 } 233 }
225 234
226 debug_scsi("task deq [cid %d itt 0x%x]\n", 235 debug_scsi("task deq [cid %d itt 0x%x]\n",
@@ -235,7 +244,7 @@ iscsi_iser_task_xmit(struct iscsi_task *task)
235 } 244 }
236 245
237 /* Send unsolicited data-out PDU(s) if necessary */ 246 /* Send unsolicited data-out PDU(s) if necessary */
238 if (task->unsol_count) 247 if (iscsi_task_has_unsol_data(task))
239 error = iscsi_iser_task_xmit_unsol_data(conn, task); 248 error = iscsi_iser_task_xmit_unsol_data(conn, task);
240 249
241 iscsi_iser_task_xmit_exit: 250 iscsi_iser_task_xmit_exit:
@@ -244,13 +253,15 @@ iscsi_iser_task_xmit(struct iscsi_task *task)
244 return error; 253 return error;
245} 254}
246 255
247static void 256static void iscsi_iser_cleanup_task(struct iscsi_task *task)
248iscsi_iser_cleanup_task(struct iscsi_conn *conn, struct iscsi_task *task)
249{ 257{
250 struct iscsi_iser_task *iser_task = task->dd_data; 258 struct iscsi_iser_task *iser_task = task->dd_data;
251 259
252 /* mgmt tasks do not need special cleanup */ 260 /*
253 if (!task->sc) 261 * mgmt tasks do not need special cleanup and we do not
262 * allocate anything in the init task callout
263 */
264 if (!task->sc || task->state == ISCSI_TASK_PENDING)
254 return; 265 return;
255 266
256 if (iser_task->status == ISER_TASK_STATUS_STARTED) { 267 if (iser_task->status == ISER_TASK_STATUS_STARTED) {
@@ -391,9 +402,6 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
391 struct iscsi_cls_session *cls_session; 402 struct iscsi_cls_session *cls_session;
392 struct iscsi_session *session; 403 struct iscsi_session *session;
393 struct Scsi_Host *shost; 404 struct Scsi_Host *shost;
394 int i;
395 struct iscsi_task *task;
396 struct iscsi_iser_task *iser_task;
397 struct iser_conn *ib_conn; 405 struct iser_conn *ib_conn;
398 406
399 shost = iscsi_host_alloc(&iscsi_iser_sht, 0, ISCSI_MAX_CMD_PER_LUN); 407 shost = iscsi_host_alloc(&iscsi_iser_sht, 0, ISCSI_MAX_CMD_PER_LUN);
@@ -430,13 +438,6 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
430 session = cls_session->dd_data; 438 session = cls_session->dd_data;
431 439
432 shost->can_queue = session->scsi_cmds_max; 440 shost->can_queue = session->scsi_cmds_max;
433 /* libiscsi setup itts, data and pool so just set desc fields */
434 for (i = 0; i < session->cmds_max; i++) {
435 task = session->cmds[i];
436 iser_task = task->dd_data;
437 task->hdr = (struct iscsi_cmd *)&iser_task->desc.iscsi_header;
438 task->hdr_max = sizeof(iser_task->desc.iscsi_header);
439 }
440 return cls_session; 441 return cls_session;
441 442
442remove_host: 443remove_host:
@@ -652,6 +653,7 @@ static struct iscsi_transport iscsi_iser_transport = {
652 .init_task = iscsi_iser_task_init, 653 .init_task = iscsi_iser_task_init,
653 .xmit_task = iscsi_iser_task_xmit, 654 .xmit_task = iscsi_iser_task_xmit,
654 .cleanup_task = iscsi_iser_cleanup_task, 655 .cleanup_task = iscsi_iser_cleanup_task,
656 .alloc_pdu = iscsi_iser_pdu_alloc,
655 /* recovery */ 657 /* recovery */
656 .session_recovery_timedout = iscsi_session_recovery_timedout, 658 .session_recovery_timedout = iscsi_session_recovery_timedout,
657 659
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index ed1aff21b7ea..e209cb8dd948 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -353,8 +353,7 @@ int iser_send_command(struct iscsi_conn *conn,
353 unsigned long edtl; 353 unsigned long edtl;
354 int err = 0; 354 int err = 0;
355 struct iser_data_buf *data_buf; 355 struct iser_data_buf *data_buf;
356 356 struct iscsi_cmd *hdr = (struct iscsi_cmd *)task->hdr;
357 struct iscsi_cmd *hdr = task->hdr;
358 struct scsi_cmnd *sc = task->sc; 357 struct scsi_cmnd *sc = task->sc;
359 358
360 if (!iser_conn_state_comp(iser_conn->ib_conn, ISER_CONN_UP)) { 359 if (!iser_conn_state_comp(iser_conn->ib_conn, ISER_CONN_UP)) {
@@ -393,7 +392,7 @@ int iser_send_command(struct iscsi_conn *conn,
393 err = iser_prepare_write_cmd(task, 392 err = iser_prepare_write_cmd(task,
394 task->imm_count, 393 task->imm_count,
395 task->imm_count + 394 task->imm_count +
396 task->unsol_count, 395 task->unsol_r2t.data_length,
397 edtl); 396 edtl);
398 if (err) 397 if (err)
399 goto send_command_error; 398 goto send_command_error;