aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2008-05-21 16:54:10 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-07-12 09:22:20 -0400
commit135a8ad4e09309d36dcb8b5c7f55db0b6a15b2d6 (patch)
treeaff5478c912bdfb28cd061c63242a6bcbef8bea2
parent9c19a7d0387124a508d2cdb38ebf8cd484631ad0 (diff)
[SCSI] iscsi_tcp: handle iscsi_cmd_task rename
This converts iscsi_tcp to use the iscsi_task name. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--drivers/scsi/iscsi_tcp.c262
-rw-r--r--drivers/scsi/iscsi_tcp.h2
2 files changed, 132 insertions, 132 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 517bad160bea..33cd0ca7cc8d 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -498,43 +498,43 @@ iscsi_tcp_data_recv_prep(struct iscsi_tcp_conn *tcp_conn)
498 * must be called with session lock 498 * must be called with session lock
499 */ 499 */
500static void 500static void
501iscsi_tcp_cleanup_task(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) 501iscsi_tcp_cleanup_task(struct iscsi_conn *conn, struct iscsi_task *task)
502{ 502{
503 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 503 struct iscsi_tcp_task *tcp_task = task->dd_data;
504 struct iscsi_r2t_info *r2t; 504 struct iscsi_r2t_info *r2t;
505 505
506 /* nothing to do for mgmt ctasks */ 506 /* nothing to do for mgmt tasks */
507 if (!ctask->sc) 507 if (!task->sc)
508 return; 508 return;
509 509
510 /* flush ctask's r2t queues */ 510 /* flush task's r2t queues */
511 while (__kfifo_get(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*))) { 511 while (__kfifo_get(tcp_task->r2tqueue, (void*)&r2t, sizeof(void*))) {
512 __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, 512 __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t,
513 sizeof(void*)); 513 sizeof(void*));
514 debug_scsi("iscsi_tcp_cleanup_ctask pending r2t dropped\n"); 514 debug_scsi("iscsi_tcp_cleanup_task pending r2t dropped\n");
515 } 515 }
516 516
517 r2t = tcp_ctask->r2t; 517 r2t = tcp_task->r2t;
518 if (r2t != NULL) { 518 if (r2t != NULL) {
519 __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, 519 __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t,
520 sizeof(void*)); 520 sizeof(void*));
521 tcp_ctask->r2t = NULL; 521 tcp_task->r2t = NULL;
522 } 522 }
523} 523}
524 524
525/** 525/**
526 * iscsi_data_rsp - SCSI Data-In Response processing 526 * iscsi_data_rsp - SCSI Data-In Response processing
527 * @conn: iscsi connection 527 * @conn: iscsi connection
528 * @ctask: scsi command ctask 528 * @task: scsi command task
529 **/ 529 **/
530static int 530static int
531iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) 531iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_task *task)
532{ 532{
533 struct iscsi_tcp_conn *tcp_conn = conn->dd_data; 533 struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
534 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 534 struct iscsi_tcp_task *tcp_task = task->dd_data;
535 struct iscsi_data_rsp *rhdr = (struct iscsi_data_rsp *)tcp_conn->in.hdr; 535 struct iscsi_data_rsp *rhdr = (struct iscsi_data_rsp *)tcp_conn->in.hdr;
536 struct iscsi_session *session = conn->session; 536 struct iscsi_session *session = conn->session;
537 struct scsi_cmnd *sc = ctask->sc; 537 struct scsi_cmnd *sc = task->sc;
538 int datasn = be32_to_cpu(rhdr->datasn); 538 int datasn = be32_to_cpu(rhdr->datasn);
539 unsigned total_in_length = scsi_in(sc)->length; 539 unsigned total_in_length = scsi_in(sc)->length;
540 540
@@ -542,18 +542,18 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
542 if (tcp_conn->in.datalen == 0) 542 if (tcp_conn->in.datalen == 0)
543 return 0; 543 return 0;
544 544
545 if (tcp_ctask->exp_datasn != datasn) { 545 if (tcp_task->exp_datasn != datasn) {
546 debug_tcp("%s: ctask->exp_datasn(%d) != rhdr->datasn(%d)\n", 546 debug_tcp("%s: task->exp_datasn(%d) != rhdr->datasn(%d)\n",
547 __FUNCTION__, tcp_ctask->exp_datasn, datasn); 547 __FUNCTION__, tcp_task->exp_datasn, datasn);
548 return ISCSI_ERR_DATASN; 548 return ISCSI_ERR_DATASN;
549 } 549 }
550 550
551 tcp_ctask->exp_datasn++; 551 tcp_task->exp_datasn++;
552 552
553 tcp_ctask->data_offset = be32_to_cpu(rhdr->offset); 553 tcp_task->data_offset = be32_to_cpu(rhdr->offset);
554 if (tcp_ctask->data_offset + tcp_conn->in.datalen > total_in_length) { 554 if (tcp_task->data_offset + tcp_conn->in.datalen > total_in_length) {
555 debug_tcp("%s: data_offset(%d) + data_len(%d) > total_length_in(%d)\n", 555 debug_tcp("%s: data_offset(%d) + data_len(%d) > total_length_in(%d)\n",
556 __FUNCTION__, tcp_ctask->data_offset, 556 __FUNCTION__, tcp_task->data_offset,
557 tcp_conn->in.datalen, total_in_length); 557 tcp_conn->in.datalen, total_in_length);
558 return ISCSI_ERR_DATA_OFFSET; 558 return ISCSI_ERR_DATA_OFFSET;
559 } 559 }
@@ -582,7 +582,7 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
582/** 582/**
583 * iscsi_solicit_data_init - initialize first Data-Out 583 * iscsi_solicit_data_init - initialize first Data-Out
584 * @conn: iscsi connection 584 * @conn: iscsi connection
585 * @ctask: scsi command ctask 585 * @task: scsi command task
586 * @r2t: R2T info 586 * @r2t: R2T info
587 * 587 *
588 * Notes: 588 * Notes:
@@ -592,7 +592,7 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
592 * This function is called with connection lock taken. 592 * This function is called with connection lock taken.
593 **/ 593 **/
594static void 594static void
595iscsi_solicit_data_init(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask, 595iscsi_solicit_data_init(struct iscsi_conn *conn, struct iscsi_task *task,
596 struct iscsi_r2t_info *r2t) 596 struct iscsi_r2t_info *r2t)
597{ 597{
598 struct iscsi_data *hdr; 598 struct iscsi_data *hdr;
@@ -603,8 +603,8 @@ iscsi_solicit_data_init(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
603 hdr->datasn = cpu_to_be32(r2t->solicit_datasn); 603 hdr->datasn = cpu_to_be32(r2t->solicit_datasn);
604 r2t->solicit_datasn++; 604 r2t->solicit_datasn++;
605 hdr->opcode = ISCSI_OP_SCSI_DATA_OUT; 605 hdr->opcode = ISCSI_OP_SCSI_DATA_OUT;
606 memcpy(hdr->lun, ctask->hdr->lun, sizeof(hdr->lun)); 606 memcpy(hdr->lun, task->hdr->lun, sizeof(hdr->lun));
607 hdr->itt = ctask->hdr->itt; 607 hdr->itt = task->hdr->itt;
608 hdr->exp_statsn = r2t->exp_statsn; 608 hdr->exp_statsn = r2t->exp_statsn;
609 hdr->offset = cpu_to_be32(r2t->data_offset); 609 hdr->offset = cpu_to_be32(r2t->data_offset);
610 if (r2t->data_length > conn->max_xmit_dlength) { 610 if (r2t->data_length > conn->max_xmit_dlength) {
@@ -624,14 +624,14 @@ iscsi_solicit_data_init(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
624/** 624/**
625 * iscsi_r2t_rsp - iSCSI R2T Response processing 625 * iscsi_r2t_rsp - iSCSI R2T Response processing
626 * @conn: iscsi connection 626 * @conn: iscsi connection
627 * @ctask: scsi command ctask 627 * @task: scsi command task
628 **/ 628 **/
629static int 629static int
630iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) 630iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task)
631{ 631{
632 struct iscsi_r2t_info *r2t; 632 struct iscsi_r2t_info *r2t;
633 struct iscsi_session *session = conn->session; 633 struct iscsi_session *session = conn->session;
634 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 634 struct iscsi_tcp_task *tcp_task = task->dd_data;
635 struct iscsi_tcp_conn *tcp_conn = conn->dd_data; 635 struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
636 struct iscsi_r2t_rsp *rhdr = (struct iscsi_r2t_rsp *)tcp_conn->in.hdr; 636 struct iscsi_r2t_rsp *rhdr = (struct iscsi_r2t_rsp *)tcp_conn->in.hdr;
637 int r2tsn = be32_to_cpu(rhdr->r2tsn); 637 int r2tsn = be32_to_cpu(rhdr->r2tsn);
@@ -644,23 +644,23 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
644 return ISCSI_ERR_DATALEN; 644 return ISCSI_ERR_DATALEN;
645 } 645 }
646 646
647 if (tcp_ctask->exp_datasn != r2tsn){ 647 if (tcp_task->exp_datasn != r2tsn){
648 debug_tcp("%s: ctask->exp_datasn(%d) != rhdr->r2tsn(%d)\n", 648 debug_tcp("%s: task->exp_datasn(%d) != rhdr->r2tsn(%d)\n",
649 __FUNCTION__, tcp_ctask->exp_datasn, r2tsn); 649 __FUNCTION__, tcp_task->exp_datasn, r2tsn);
650 return ISCSI_ERR_R2TSN; 650 return ISCSI_ERR_R2TSN;
651 } 651 }
652 652
653 /* fill-in new R2T associated with the ctask */ 653 /* fill-in new R2T associated with the task */
654 iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); 654 iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr);
655 655
656 if (!ctask->sc || session->state != ISCSI_STATE_LOGGED_IN) { 656 if (!task->sc || session->state != ISCSI_STATE_LOGGED_IN) {
657 iscsi_conn_printk(KERN_INFO, conn, 657 iscsi_conn_printk(KERN_INFO, conn,
658 "dropping R2T itt %d in recovery.\n", 658 "dropping R2T itt %d in recovery.\n",
659 ctask->itt); 659 task->itt);
660 return 0; 660 return 0;
661 } 661 }
662 662
663 rc = __kfifo_get(tcp_ctask->r2tpool.queue, (void*)&r2t, sizeof(void*)); 663 rc = __kfifo_get(tcp_task->r2tpool.queue, (void*)&r2t, sizeof(void*));
664 BUG_ON(!rc); 664 BUG_ON(!rc);
665 665
666 r2t->exp_statsn = rhdr->statsn; 666 r2t->exp_statsn = rhdr->statsn;
@@ -668,7 +668,7 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
668 if (r2t->data_length == 0) { 668 if (r2t->data_length == 0) {
669 iscsi_conn_printk(KERN_ERR, conn, 669 iscsi_conn_printk(KERN_ERR, conn,
670 "invalid R2T with zero data len\n"); 670 "invalid R2T with zero data len\n");
671 __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, 671 __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t,
672 sizeof(void*)); 672 sizeof(void*));
673 return ISCSI_ERR_DATALEN; 673 return ISCSI_ERR_DATALEN;
674 } 674 }
@@ -679,12 +679,12 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
679 r2t->data_length, session->max_burst); 679 r2t->data_length, session->max_burst);
680 680
681 r2t->data_offset = be32_to_cpu(rhdr->data_offset); 681 r2t->data_offset = be32_to_cpu(rhdr->data_offset);
682 if (r2t->data_offset + r2t->data_length > scsi_out(ctask->sc)->length) { 682 if (r2t->data_offset + r2t->data_length > scsi_out(task->sc)->length) {
683 iscsi_conn_printk(KERN_ERR, conn, 683 iscsi_conn_printk(KERN_ERR, conn,
684 "invalid R2T with data len %u at offset %u " 684 "invalid R2T with data len %u at offset %u "
685 "and total length %d\n", r2t->data_length, 685 "and total length %d\n", r2t->data_length,
686 r2t->data_offset, scsi_out(ctask->sc)->length); 686 r2t->data_offset, scsi_out(task->sc)->length);
687 __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, 687 __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t,
688 sizeof(void*)); 688 sizeof(void*));
689 return ISCSI_ERR_DATALEN; 689 return ISCSI_ERR_DATALEN;
690 } 690 }
@@ -692,13 +692,13 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
692 r2t->ttt = rhdr->ttt; /* no flip */ 692 r2t->ttt = rhdr->ttt; /* no flip */
693 r2t->solicit_datasn = 0; 693 r2t->solicit_datasn = 0;
694 694
695 iscsi_solicit_data_init(conn, ctask, r2t); 695 iscsi_solicit_data_init(conn, task, r2t);
696 696
697 tcp_ctask->exp_datasn = r2tsn + 1; 697 tcp_task->exp_datasn = r2tsn + 1;
698 __kfifo_put(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*)); 698 __kfifo_put(tcp_task->r2tqueue, (void*)&r2t, sizeof(void*));
699 conn->r2t_pdus_cnt++; 699 conn->r2t_pdus_cnt++;
700 700
701 iscsi_requeue_ctask(ctask); 701 iscsi_requeue_task(task);
702 return 0; 702 return 0;
703} 703}
704 704
@@ -743,7 +743,7 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
743 int rc = 0, opcode, ahslen; 743 int rc = 0, opcode, ahslen;
744 struct iscsi_session *session = conn->session; 744 struct iscsi_session *session = conn->session;
745 struct iscsi_tcp_conn *tcp_conn = conn->dd_data; 745 struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
746 struct iscsi_cmd_task *ctask; 746 struct iscsi_task *task;
747 747
748 /* verify PDU length */ 748 /* verify PDU length */
749 tcp_conn->in.datalen = ntoh24(hdr->dlength); 749 tcp_conn->in.datalen = ntoh24(hdr->dlength);
@@ -770,21 +770,21 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
770 770
771 switch(opcode) { 771 switch(opcode) {
772 case ISCSI_OP_SCSI_DATA_IN: 772 case ISCSI_OP_SCSI_DATA_IN:
773 ctask = iscsi_itt_to_ctask(conn, hdr->itt); 773 task = iscsi_itt_to_ctask(conn, hdr->itt);
774 if (!ctask) 774 if (!task)
775 return ISCSI_ERR_BAD_ITT; 775 return ISCSI_ERR_BAD_ITT;
776 if (!ctask->sc) 776 if (!task->sc)
777 return ISCSI_ERR_NO_SCSI_CMD; 777 return ISCSI_ERR_NO_SCSI_CMD;
778 778
779 spin_lock(&conn->session->lock); 779 spin_lock(&conn->session->lock);
780 rc = iscsi_data_rsp(conn, ctask); 780 rc = iscsi_data_rsp(conn, task);
781 spin_unlock(&conn->session->lock); 781 spin_unlock(&conn->session->lock);
782 if (rc) 782 if (rc)
783 return rc; 783 return rc;
784 if (tcp_conn->in.datalen) { 784 if (tcp_conn->in.datalen) {
785 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 785 struct iscsi_tcp_task *tcp_task = task->dd_data;
786 struct hash_desc *rx_hash = NULL; 786 struct hash_desc *rx_hash = NULL;
787 struct scsi_data_buffer *sdb = scsi_in(ctask->sc); 787 struct scsi_data_buffer *sdb = scsi_in(task->sc);
788 788
789 /* 789 /*
790 * Setup copy of Data-In into the Scsi_Cmnd 790 * Setup copy of Data-In into the Scsi_Cmnd
@@ -799,12 +799,12 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
799 799
800 debug_tcp("iscsi_tcp_begin_data_in(%p, offset=%d, " 800 debug_tcp("iscsi_tcp_begin_data_in(%p, offset=%d, "
801 "datalen=%d)\n", tcp_conn, 801 "datalen=%d)\n", tcp_conn,
802 tcp_ctask->data_offset, 802 tcp_task->data_offset,
803 tcp_conn->in.datalen); 803 tcp_conn->in.datalen);
804 return iscsi_segment_seek_sg(&tcp_conn->in.segment, 804 return iscsi_segment_seek_sg(&tcp_conn->in.segment,
805 sdb->table.sgl, 805 sdb->table.sgl,
806 sdb->table.nents, 806 sdb->table.nents,
807 tcp_ctask->data_offset, 807 tcp_task->data_offset,
808 tcp_conn->in.datalen, 808 tcp_conn->in.datalen,
809 iscsi_tcp_process_data_in, 809 iscsi_tcp_process_data_in,
810 rx_hash); 810 rx_hash);
@@ -818,17 +818,17 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
818 rc = iscsi_complete_pdu(conn, hdr, NULL, 0); 818 rc = iscsi_complete_pdu(conn, hdr, NULL, 0);
819 break; 819 break;
820 case ISCSI_OP_R2T: 820 case ISCSI_OP_R2T:
821 ctask = iscsi_itt_to_ctask(conn, hdr->itt); 821 task = iscsi_itt_to_ctask(conn, hdr->itt);
822 if (!ctask) 822 if (!task)
823 return ISCSI_ERR_BAD_ITT; 823 return ISCSI_ERR_BAD_ITT;
824 if (!ctask->sc) 824 if (!task->sc)
825 return ISCSI_ERR_NO_SCSI_CMD; 825 return ISCSI_ERR_NO_SCSI_CMD;
826 826
827 if (ahslen) 827 if (ahslen)
828 rc = ISCSI_ERR_AHSLEN; 828 rc = ISCSI_ERR_AHSLEN;
829 else if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) { 829 else if (task->sc->sc_data_direction == DMA_TO_DEVICE) {
830 spin_lock(&session->lock); 830 spin_lock(&session->lock);
831 rc = iscsi_r2t_rsp(conn, ctask); 831 rc = iscsi_r2t_rsp(conn, task);
832 spin_unlock(&session->lock); 832 spin_unlock(&session->lock);
833 } else 833 } else
834 rc = ISCSI_ERR_PROTO; 834 rc = ISCSI_ERR_PROTO;
@@ -1202,7 +1202,7 @@ iscsi_tcp_send_hdr_prep(struct iscsi_conn *conn, void *hdr, size_t hdrlen)
1202 1202
1203 /* If header digest is enabled, compute the CRC and 1203 /* If header digest is enabled, compute the CRC and
1204 * place the digest into the same buffer. We make 1204 * place the digest into the same buffer. We make
1205 * sure that both iscsi_tcp_cmd_task and mctask have 1205 * sure that both iscsi_tcp_task and mtask have
1206 * sufficient room. 1206 * sufficient room.
1207 */ 1207 */
1208 if (conn->hdrdgst_en) { 1208 if (conn->hdrdgst_en) {
@@ -1277,7 +1277,7 @@ iscsi_tcp_send_linear_data_prepare(struct iscsi_conn *conn, void *data,
1277/** 1277/**
1278 * iscsi_solicit_data_cont - initialize next Data-Out 1278 * iscsi_solicit_data_cont - initialize next Data-Out
1279 * @conn: iscsi connection 1279 * @conn: iscsi connection
1280 * @ctask: scsi command ctask 1280 * @task: scsi command task
1281 * @r2t: R2T info 1281 * @r2t: R2T info
1282 * @left: bytes left to transfer 1282 * @left: bytes left to transfer
1283 * 1283 *
@@ -1288,7 +1288,7 @@ iscsi_tcp_send_linear_data_prepare(struct iscsi_conn *conn, void *data,
1288 * Called under connection lock. 1288 * Called under connection lock.
1289 **/ 1289 **/
1290static int 1290static int
1291iscsi_solicit_data_cont(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask, 1291iscsi_solicit_data_cont(struct iscsi_conn *conn, struct iscsi_task *task,
1292 struct iscsi_r2t_info *r2t) 1292 struct iscsi_r2t_info *r2t)
1293{ 1293{
1294 struct iscsi_data *hdr; 1294 struct iscsi_data *hdr;
@@ -1305,8 +1305,8 @@ iscsi_solicit_data_cont(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
1305 hdr->datasn = cpu_to_be32(r2t->solicit_datasn); 1305 hdr->datasn = cpu_to_be32(r2t->solicit_datasn);
1306 r2t->solicit_datasn++; 1306 r2t->solicit_datasn++;
1307 hdr->opcode = ISCSI_OP_SCSI_DATA_OUT; 1307 hdr->opcode = ISCSI_OP_SCSI_DATA_OUT;
1308 memcpy(hdr->lun, ctask->hdr->lun, sizeof(hdr->lun)); 1308 memcpy(hdr->lun, task->hdr->lun, sizeof(hdr->lun));
1309 hdr->itt = ctask->hdr->itt; 1309 hdr->itt = task->hdr->itt;
1310 hdr->exp_statsn = r2t->exp_statsn; 1310 hdr->exp_statsn = r2t->exp_statsn;
1311 new_offset = r2t->data_offset + r2t->sent; 1311 new_offset = r2t->data_offset + r2t->sent;
1312 hdr->offset = cpu_to_be32(new_offset); 1312 hdr->offset = cpu_to_be32(new_offset);
@@ -1326,73 +1326,73 @@ iscsi_solicit_data_cont(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
1326/** 1326/**
1327 * iscsi_tcp_task - Initialize iSCSI SCSI_READ or SCSI_WRITE commands 1327 * iscsi_tcp_task - Initialize iSCSI SCSI_READ or SCSI_WRITE commands
1328 * @conn: iscsi connection 1328 * @conn: iscsi connection
1329 * @ctask: scsi command ctask 1329 * @task: scsi command task
1330 * @sc: scsi command 1330 * @sc: scsi command
1331 **/ 1331 **/
1332static int 1332static int
1333iscsi_tcp_task_init(struct iscsi_cmd_task *ctask) 1333iscsi_tcp_task_init(struct iscsi_task *task)
1334{ 1334{
1335 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 1335 struct iscsi_tcp_task *tcp_task = task->dd_data;
1336 struct iscsi_conn *conn = ctask->conn; 1336 struct iscsi_conn *conn = task->conn;
1337 struct scsi_cmnd *sc = ctask->sc; 1337 struct scsi_cmnd *sc = task->sc;
1338 int err; 1338 int err;
1339 1339
1340 if (!sc) { 1340 if (!sc) {
1341 /* 1341 /*
1342 * mgmt ctasks do not have a scatterlist since they come 1342 * mgmt tasks do not have a scatterlist since they come
1343 * in from the iscsi interface. 1343 * in from the iscsi interface.
1344 */ 1344 */
1345 debug_scsi("mctask deq [cid %d itt 0x%x]\n", conn->id, 1345 debug_scsi("mtask deq [cid %d itt 0x%x]\n", conn->id,
1346 ctask->itt); 1346 task->itt);
1347 1347
1348 /* Prepare PDU, optionally w/ immediate data */ 1348 /* Prepare PDU, optionally w/ immediate data */
1349 iscsi_tcp_send_hdr_prep(conn, ctask->hdr, sizeof(*ctask->hdr)); 1349 iscsi_tcp_send_hdr_prep(conn, task->hdr, sizeof(*task->hdr));
1350 1350
1351 /* If we have immediate data, attach a payload */ 1351 /* If we have immediate data, attach a payload */
1352 if (ctask->data_count) 1352 if (task->data_count)
1353 iscsi_tcp_send_linear_data_prepare(conn, ctask->data, 1353 iscsi_tcp_send_linear_data_prepare(conn, task->data,
1354 ctask->data_count); 1354 task->data_count);
1355 return 0; 1355 return 0;
1356 } 1356 }
1357 1357
1358 BUG_ON(__kfifo_len(tcp_ctask->r2tqueue)); 1358 BUG_ON(__kfifo_len(tcp_task->r2tqueue));
1359 tcp_ctask->sent = 0; 1359 tcp_task->sent = 0;
1360 tcp_ctask->exp_datasn = 0; 1360 tcp_task->exp_datasn = 0;
1361 1361
1362 /* Prepare PDU, optionally w/ immediate data */ 1362 /* Prepare PDU, optionally w/ immediate data */
1363 debug_scsi("ctask deq [cid %d itt 0x%x imm %d unsol %d]\n", 1363 debug_scsi("task deq [cid %d itt 0x%x imm %d unsol %d]\n",
1364 conn->id, ctask->itt, ctask->imm_count, 1364 conn->id, task->itt, task->imm_count,
1365 ctask->unsol_count); 1365 task->unsol_count);
1366 iscsi_tcp_send_hdr_prep(conn, ctask->hdr, ctask->hdr_len); 1366 iscsi_tcp_send_hdr_prep(conn, task->hdr, task->hdr_len);
1367 1367
1368 if (!ctask->imm_count) 1368 if (!task->imm_count)
1369 return 0; 1369 return 0;
1370 1370
1371 /* If we have immediate data, attach a payload */ 1371 /* If we have immediate data, attach a payload */
1372 err = iscsi_tcp_send_data_prep(conn, scsi_out(sc)->table.sgl, 1372 err = iscsi_tcp_send_data_prep(conn, scsi_out(sc)->table.sgl,
1373 scsi_out(sc)->table.nents, 1373 scsi_out(sc)->table.nents,
1374 0, ctask->imm_count); 1374 0, task->imm_count);
1375 if (err) 1375 if (err)
1376 return err; 1376 return err;
1377 tcp_ctask->sent += ctask->imm_count; 1377 tcp_task->sent += task->imm_count;
1378 ctask->imm_count = 0; 1378 task->imm_count = 0;
1379 return 0; 1379 return 0;
1380} 1380}
1381 1381
1382/* 1382/*
1383 * iscsi_tcp_task_xmit - xmit normal PDU ctask 1383 * iscsi_tcp_task_xmit - xmit normal PDU task
1384 * @ctask: iscsi command ctask 1384 * @task: iscsi command task
1385 * 1385 *
1386 * We're expected to return 0 when everything was transmitted succesfully, 1386 * We're expected to return 0 when everything was transmitted succesfully,
1387 * -EAGAIN if there's still data in the queue, or != 0 for any other kind 1387 * -EAGAIN if there's still data in the queue, or != 0 for any other kind
1388 * of error. 1388 * of error.
1389 */ 1389 */
1390static int 1390static int
1391iscsi_tcp_task_xmit(struct iscsi_cmd_task *ctask) 1391iscsi_tcp_task_xmit(struct iscsi_task *task)
1392{ 1392{
1393 struct iscsi_conn *conn = ctask->conn; 1393 struct iscsi_conn *conn = task->conn;
1394 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 1394 struct iscsi_tcp_task *tcp_task = task->dd_data;
1395 struct scsi_cmnd *sc = ctask->sc; 1395 struct scsi_cmnd *sc = task->sc;
1396 struct scsi_data_buffer *sdb; 1396 struct scsi_data_buffer *sdb;
1397 int rc = 0; 1397 int rc = 0;
1398 1398
@@ -1404,8 +1404,8 @@ flush:
1404 1404
1405 /* mgmt command */ 1405 /* mgmt command */
1406 if (!sc) { 1406 if (!sc) {
1407 if (ctask->hdr->itt == RESERVED_ITT) 1407 if (task->hdr->itt == RESERVED_ITT)
1408 iscsi_put_ctask(ctask); 1408 iscsi_put_task(task);
1409 return 0; 1409 return 0;
1410 } 1410 }
1411 1411
@@ -1414,27 +1414,27 @@ flush:
1414 return 0; 1414 return 0;
1415 1415
1416 sdb = scsi_out(sc); 1416 sdb = scsi_out(sc);
1417 if (ctask->unsol_count != 0) { 1417 if (task->unsol_count != 0) {
1418 struct iscsi_data *hdr = &tcp_ctask->unsol_dtask.hdr; 1418 struct iscsi_data *hdr = &tcp_task->unsol_dtask.hdr;
1419 1419
1420 /* Prepare a header for the unsolicited PDU. 1420 /* Prepare a header for the unsolicited PDU.
1421 * The amount of data we want to send will be 1421 * The amount of data we want to send will be
1422 * in ctask->data_count. 1422 * in task->data_count.
1423 * FIXME: return the data count instead. 1423 * FIXME: return the data count instead.
1424 */ 1424 */
1425 iscsi_prep_unsolicit_data_pdu(ctask, hdr); 1425 iscsi_prep_unsolicit_data_pdu(task, hdr);
1426 1426
1427 debug_tcp("unsol dout [itt 0x%x doff %d dlen %d]\n", 1427 debug_tcp("unsol dout [itt 0x%x doff %d dlen %d]\n",
1428 ctask->itt, tcp_ctask->sent, ctask->data_count); 1428 task->itt, tcp_task->sent, task->data_count);
1429 1429
1430 iscsi_tcp_send_hdr_prep(conn, hdr, sizeof(*hdr)); 1430 iscsi_tcp_send_hdr_prep(conn, hdr, sizeof(*hdr));
1431 rc = iscsi_tcp_send_data_prep(conn, sdb->table.sgl, 1431 rc = iscsi_tcp_send_data_prep(conn, sdb->table.sgl,
1432 sdb->table.nents, tcp_ctask->sent, 1432 sdb->table.nents, tcp_task->sent,
1433 ctask->data_count); 1433 task->data_count);
1434 if (rc) 1434 if (rc)
1435 goto fail; 1435 goto fail;
1436 tcp_ctask->sent += ctask->data_count; 1436 tcp_task->sent += task->data_count;
1437 ctask->unsol_count -= ctask->data_count; 1437 task->unsol_count -= task->data_count;
1438 goto flush; 1438 goto flush;
1439 } else { 1439 } else {
1440 struct iscsi_session *session = conn->session; 1440 struct iscsi_session *session = conn->session;
@@ -1443,22 +1443,22 @@ flush:
1443 /* All unsolicited PDUs sent. Check for solicited PDUs. 1443 /* All unsolicited PDUs sent. Check for solicited PDUs.
1444 */ 1444 */
1445 spin_lock_bh(&session->lock); 1445 spin_lock_bh(&session->lock);
1446 r2t = tcp_ctask->r2t; 1446 r2t = tcp_task->r2t;
1447 if (r2t != NULL) { 1447 if (r2t != NULL) {
1448 /* Continue with this R2T? */ 1448 /* Continue with this R2T? */
1449 if (!iscsi_solicit_data_cont(conn, ctask, r2t)) { 1449 if (!iscsi_solicit_data_cont(conn, task, r2t)) {
1450 debug_scsi(" done with r2t %p\n", r2t); 1450 debug_scsi(" done with r2t %p\n", r2t);
1451 1451
1452 __kfifo_put(tcp_ctask->r2tpool.queue, 1452 __kfifo_put(tcp_task->r2tpool.queue,
1453 (void*)&r2t, sizeof(void*)); 1453 (void*)&r2t, sizeof(void*));
1454 tcp_ctask->r2t = r2t = NULL; 1454 tcp_task->r2t = r2t = NULL;
1455 } 1455 }
1456 } 1456 }
1457 1457
1458 if (r2t == NULL) { 1458 if (r2t == NULL) {
1459 __kfifo_get(tcp_ctask->r2tqueue, (void*)&tcp_ctask->r2t, 1459 __kfifo_get(tcp_task->r2tqueue, (void*)&tcp_task->r2t,
1460 sizeof(void*)); 1460 sizeof(void*));
1461 r2t = tcp_ctask->r2t; 1461 r2t = tcp_task->r2t;
1462 } 1462 }
1463 spin_unlock_bh(&session->lock); 1463 spin_unlock_bh(&session->lock);
1464 1464
@@ -1469,7 +1469,7 @@ flush:
1469 } 1469 }
1470 1470
1471 debug_scsi("sol dout %p [dsn %d itt 0x%x doff %d dlen %d]\n", 1471 debug_scsi("sol dout %p [dsn %d itt 0x%x doff %d dlen %d]\n",
1472 r2t, r2t->solicit_datasn - 1, ctask->itt, 1472 r2t, r2t->solicit_datasn - 1, task->itt,
1473 r2t->data_offset + r2t->sent, r2t->data_count); 1473 r2t->data_offset + r2t->sent, r2t->data_count);
1474 1474
1475 iscsi_tcp_send_hdr_prep(conn, &r2t->dtask.hdr, 1475 iscsi_tcp_send_hdr_prep(conn, &r2t->dtask.hdr,
@@ -1481,7 +1481,7 @@ flush:
1481 r2t->data_count); 1481 r2t->data_count);
1482 if (rc) 1482 if (rc)
1483 goto fail; 1483 goto fail;
1484 tcp_ctask->sent += r2t->data_count; 1484 tcp_task->sent += r2t->data_count;
1485 r2t->sent += r2t->data_count; 1485 r2t->sent += r2t->data_count;
1486 goto flush; 1486 goto flush;
1487 } 1487 }
@@ -1698,11 +1698,11 @@ iscsi_r2tpool_alloc(struct iscsi_session *session)
1698 int cmd_i; 1698 int cmd_i;
1699 1699
1700 /* 1700 /*
1701 * initialize per-ctask: R2T pool and xmit queue 1701 * initialize per-task: R2T pool and xmit queue
1702 */ 1702 */
1703 for (cmd_i = 0; cmd_i < session->cmds_max; cmd_i++) { 1703 for (cmd_i = 0; cmd_i < session->cmds_max; cmd_i++) {
1704 struct iscsi_cmd_task *ctask = session->cmds[cmd_i]; 1704 struct iscsi_task *task = session->cmds[cmd_i];
1705 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 1705 struct iscsi_tcp_task *tcp_task = task->dd_data;
1706 1706
1707 /* 1707 /*
1708 * pre-allocated x4 as much r2ts to handle race when 1708 * pre-allocated x4 as much r2ts to handle race when
@@ -1711,16 +1711,16 @@ iscsi_r2tpool_alloc(struct iscsi_session *session)
1711 */ 1711 */
1712 1712
1713 /* R2T pool */ 1713 /* R2T pool */
1714 if (iscsi_pool_init(&tcp_ctask->r2tpool, session->max_r2t * 4, NULL, 1714 if (iscsi_pool_init(&tcp_task->r2tpool, session->max_r2t * 4, NULL,
1715 sizeof(struct iscsi_r2t_info))) { 1715 sizeof(struct iscsi_r2t_info))) {
1716 goto r2t_alloc_fail; 1716 goto r2t_alloc_fail;
1717 } 1717 }
1718 1718
1719 /* R2T xmit queue */ 1719 /* R2T xmit queue */
1720 tcp_ctask->r2tqueue = kfifo_alloc( 1720 tcp_task->r2tqueue = kfifo_alloc(
1721 session->max_r2t * 4 * sizeof(void*), GFP_KERNEL, NULL); 1721 session->max_r2t * 4 * sizeof(void*), GFP_KERNEL, NULL);
1722 if (tcp_ctask->r2tqueue == ERR_PTR(-ENOMEM)) { 1722 if (tcp_task->r2tqueue == ERR_PTR(-ENOMEM)) {
1723 iscsi_pool_free(&tcp_ctask->r2tpool); 1723 iscsi_pool_free(&tcp_task->r2tpool);
1724 goto r2t_alloc_fail; 1724 goto r2t_alloc_fail;
1725 } 1725 }
1726 } 1726 }
@@ -1729,11 +1729,11 @@ iscsi_r2tpool_alloc(struct iscsi_session *session)
1729 1729
1730r2t_alloc_fail: 1730r2t_alloc_fail:
1731 for (i = 0; i < cmd_i; i++) { 1731 for (i = 0; i < cmd_i; i++) {
1732 struct iscsi_cmd_task *ctask = session->cmds[i]; 1732 struct iscsi_task *task = session->cmds[i];
1733 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 1733 struct iscsi_tcp_task *tcp_task = task->dd_data;
1734 1734
1735 kfifo_free(tcp_ctask->r2tqueue); 1735 kfifo_free(tcp_task->r2tqueue);
1736 iscsi_pool_free(&tcp_ctask->r2tpool); 1736 iscsi_pool_free(&tcp_task->r2tpool);
1737 } 1737 }
1738 return -ENOMEM; 1738 return -ENOMEM;
1739} 1739}
@@ -1744,11 +1744,11 @@ iscsi_r2tpool_free(struct iscsi_session *session)
1744 int i; 1744 int i;
1745 1745
1746 for (i = 0; i < session->cmds_max; i++) { 1746 for (i = 0; i < session->cmds_max; i++) {
1747 struct iscsi_cmd_task *ctask = session->cmds[i]; 1747 struct iscsi_task *task = session->cmds[i];
1748 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 1748 struct iscsi_tcp_task *tcp_task = task->dd_data;
1749 1749
1750 kfifo_free(tcp_ctask->r2tqueue); 1750 kfifo_free(tcp_task->r2tqueue);
1751 iscsi_pool_free(&tcp_ctask->r2tpool); 1751 iscsi_pool_free(&tcp_task->r2tpool);
1752 } 1752 }
1753} 1753}
1754 1754
@@ -1867,7 +1867,7 @@ iscsi_tcp_session_create(struct Scsi_Host *shost, uint16_t cmds_max,
1867 *hostno = shost->host_no; 1867 *hostno = shost->host_no;
1868 1868
1869 cls_session = iscsi_session_setup(&iscsi_tcp_transport, shost, cmds_max, 1869 cls_session = iscsi_session_setup(&iscsi_tcp_transport, shost, cmds_max,
1870 sizeof(struct iscsi_tcp_cmd_task), 1870 sizeof(struct iscsi_tcp_task),
1871 initial_cmdsn); 1871 initial_cmdsn);
1872 if (!cls_session) 1872 if (!cls_session)
1873 goto remove_host; 1873 goto remove_host;
@@ -1875,11 +1875,11 @@ iscsi_tcp_session_create(struct Scsi_Host *shost, uint16_t cmds_max,
1875 1875
1876 shost->can_queue = session->scsi_cmds_max; 1876 shost->can_queue = session->scsi_cmds_max;
1877 for (cmd_i = 0; cmd_i < session->cmds_max; cmd_i++) { 1877 for (cmd_i = 0; cmd_i < session->cmds_max; cmd_i++) {
1878 struct iscsi_cmd_task *ctask = session->cmds[cmd_i]; 1878 struct iscsi_task *task = session->cmds[cmd_i];
1879 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 1879 struct iscsi_tcp_task *tcp_task = task->dd_data;
1880 1880
1881 ctask->hdr = &tcp_ctask->hdr.cmd_hdr; 1881 task->hdr = &tcp_task->hdr.cmd_hdr;
1882 ctask->hdr_max = sizeof(tcp_ctask->hdr) - ISCSI_DIGEST_SIZE; 1882 task->hdr_max = sizeof(tcp_task->hdr) - ISCSI_DIGEST_SIZE;
1883 } 1883 }
1884 1884
1885 if (iscsi_r2tpool_alloc(session)) 1885 if (iscsi_r2tpool_alloc(session))
diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h
index c9c8633c41a6..498d8ca39848 100644
--- a/drivers/scsi/iscsi_tcp.h
+++ b/drivers/scsi/iscsi_tcp.h
@@ -114,7 +114,7 @@ struct iscsi_r2t_info {
114 struct iscsi_data_task dtask; /* Data-Out header buf */ 114 struct iscsi_data_task dtask; /* Data-Out header buf */
115}; 115};
116 116
117struct iscsi_tcp_cmd_task { 117struct iscsi_tcp_task {
118 struct iscsi_hdr_buff { 118 struct iscsi_hdr_buff {
119 struct iscsi_cmd cmd_hdr; 119 struct iscsi_cmd cmd_hdr;
120 char hdrextbuf[ISCSI_MAX_AHS_SIZE + 120 char hdrextbuf[ISCSI_MAX_AHS_SIZE +