Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Mike Christie and committed by
James Bottomley
0f9c7449 577577da

+27 -26
+25 -23
drivers/infiniband/ulp/iser/iscsi_iser.c
··· 119 119 iscsi_conn_failure(conn, rc); 120 120 } 121 121 122 + static 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 132 * iscsi_iser_task_init - Initialize task ··· 188 180 iscsi_iser_task_xmit_unsol_data(struct iscsi_conn *conn, 189 181 struct iscsi_task *task) 190 182 { 191 - struct iscsi_data hdr; 183 + struct iscsi_r2t_info *r2t = &task->unsol_r2t; 184 + struct iscsi_data hdr; 192 185 int error = 0; 193 186 194 187 /* Send data-out PDUs while there's still unsolicited data to send */ 195 - while (task->unsol_count > 0) { 196 - iscsi_prep_unsolicit_data_pdu(task, &hdr); 188 + while (iscsi_task_has_unsol_data(task)) { 189 + iscsi_prep_data_out_pdu(task, r2t, &hdr); 197 190 debug_scsi("Sending data-out: itt 0x%x, data count %d\n", 198 - hdr.itt, task->data_count); 191 + hdr.itt, r2t->data_count); 199 192 200 193 /* the buffer description has been passed with the command */ 201 194 /* Send the command */ 202 195 error = iser_send_data_out(conn, task, &hdr); 203 196 if (error) { 204 - task->unsol_datasn--; 197 + r2t->datasn--; 205 198 goto iscsi_iser_task_xmit_unsol_data_exit; 206 199 } 207 - task->unsol_count -= task->data_count; 200 + r2t->sent += r2t->data_count; 208 201 debug_scsi("Need to send %d more as data-out PDUs\n", 209 - task->unsol_count); 202 + r2t->data_length - r2t->sent); 210 203 } 211 204 212 205 iscsi_iser_task_xmit_unsol_data_exit: ··· 229 220 230 221 debug_scsi("cmd [itt %x total %d imm %d unsol_data %d\n", 231 222 task->itt, scsi_bufflen(task->sc), 232 - task->imm_count, task->unsol_count); 223 + task->imm_count, task->unsol_r2t.data_length); 233 224 } 234 225 235 226 debug_scsi("task deq [cid %d itt 0x%x]\n", ··· 244 235 } 245 236 246 237 /* Send unsolicited data-out PDU(s) if necessary */ 247 - if (task->unsol_count) 238 + if (iscsi_task_has_unsol_data(task)) 248 239 error = iscsi_iser_task_xmit_unsol_data(conn, task); 249 240 250 241 iscsi_iser_task_xmit_exit: ··· 253 244 return error; 254 245 } 255 246 256 - static void 257 - iscsi_iser_cleanup_task(struct iscsi_conn *conn, struct iscsi_task *task) 247 + static void iscsi_iser_cleanup_task(struct iscsi_task *task) 258 248 { 259 249 struct iscsi_iser_task *iser_task = task->dd_data; 260 250 261 - /* mgmt tasks do not need special cleanup */ 262 - if (!task->sc) 251 + /* 252 + * mgmt tasks do not need special cleanup and we do not 253 + * allocate anything in the init task callout 254 + */ 255 + if (!task->sc || task->state == ISCSI_TASK_PENDING) 263 256 return; 264 257 265 258 if (iser_task->status == ISER_TASK_STATUS_STARTED) { ··· 402 391 struct iscsi_cls_session *cls_session; 403 392 struct iscsi_session *session; 404 393 struct Scsi_Host *shost; 405 - int i; 406 - struct iscsi_task *task; 407 - struct iscsi_iser_task *iser_task; 408 394 struct iser_conn *ib_conn; 409 395 410 396 shost = iscsi_host_alloc(&iscsi_iser_sht, 0, ISCSI_MAX_CMD_PER_LUN); ··· 438 430 session = cls_session->dd_data; 439 431 440 432 shost->can_queue = session->scsi_cmds_max; 441 - /* libiscsi setup itts, data and pool so just set desc fields */ 442 - for (i = 0; i < session->cmds_max; i++) { 443 - task = session->cmds[i]; 444 - iser_task = task->dd_data; 445 - task->hdr = (struct iscsi_cmd *)&iser_task->desc.iscsi_header; 446 - task->hdr_max = sizeof(iser_task->desc.iscsi_header); 447 - } 448 433 return cls_session; 449 434 450 435 remove_host: ··· 653 652 .init_task = iscsi_iser_task_init, 654 653 .xmit_task = iscsi_iser_task_xmit, 655 654 .cleanup_task = iscsi_iser_cleanup_task, 655 + .alloc_pdu = iscsi_iser_pdu_alloc, 656 656 /* recovery */ 657 657 .session_recovery_timedout = iscsi_session_recovery_timedout, 658 658
+2 -3
drivers/infiniband/ulp/iser/iser_initiator.c
··· 353 353 unsigned long edtl; 354 354 int err = 0; 355 355 struct iser_data_buf *data_buf; 356 - 357 - struct iscsi_cmd *hdr = task->hdr; 356 + struct iscsi_cmd *hdr = (struct iscsi_cmd *)task->hdr; 358 357 struct scsi_cmnd *sc = task->sc; 359 358 360 359 if (!iser_conn_state_comp(iser_conn->ib_conn, ISER_CONN_UP)) { ··· 392 393 err = iser_prepare_write_cmd(task, 393 394 task->imm_count, 394 395 task->imm_count + 395 - task->unsol_count, 396 + task->unsol_r2t.data_length, 396 397 edtl); 397 398 if (err) 398 399 goto send_command_error;