aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-09-26 08:00:39 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-10-03 17:21:50 -0400
commit66c7db687631247b7a3493322b9aedeef3c6c7b5 (patch)
tree97584e963d8572fe7b0a8c0bd94bad29880bb6c4 /drivers/target
parentcea0b4ceec5d09330fd80c0185532a502db9c2b7 (diff)
iscsit: use the itt_t abstract type
Use the special itt_t type defined by the iscsi headers and the initiator to make sure it's an opaque value. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/iscsi/iscsi_target.c36
-rw-r--r--drivers/target/iscsi/iscsi_target_configfs.c3
-rw-r--r--drivers/target/iscsi/iscsi_target_core.h8
-rw-r--r--drivers/target/iscsi/iscsi_target_erl1.c4
-rw-r--r--drivers/target/iscsi/iscsi_target_erl1.h4
-rw-r--r--drivers/target/iscsi/iscsi_target_login.c2
-rw-r--r--drivers/target/iscsi/iscsi_target_nego.c6
-rw-r--r--drivers/target/iscsi/iscsi_target_tmr.c4
-rw-r--r--drivers/target/iscsi/iscsi_target_util.c10
-rw-r--r--drivers/target/iscsi/iscsi_target_util.h6
10 files changed, 37 insertions, 46 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 2e7bf7a51e7f..1c843b51f261 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -785,7 +785,6 @@ static int iscsit_handle_scsi_cmd(
785 785
786 hdr = (struct iscsi_scsi_req *) buf; 786 hdr = (struct iscsi_scsi_req *) buf;
787 payload_length = ntoh24(hdr->dlength); 787 payload_length = ntoh24(hdr->dlength);
788 hdr->itt = be32_to_cpu(hdr->itt);
789 hdr->data_length = be32_to_cpu(hdr->data_length); 788 hdr->data_length = be32_to_cpu(hdr->data_length);
790 hdr->cmdsn = be32_to_cpu(hdr->cmdsn); 789 hdr->cmdsn = be32_to_cpu(hdr->cmdsn);
791 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn); 790 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn);
@@ -1194,7 +1193,6 @@ static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf)
1194 1193
1195 hdr = (struct iscsi_data *) buf; 1194 hdr = (struct iscsi_data *) buf;
1196 payload_length = ntoh24(hdr->dlength); 1195 payload_length = ntoh24(hdr->dlength);
1197 hdr->itt = be32_to_cpu(hdr->itt);
1198 hdr->ttt = be32_to_cpu(hdr->ttt); 1196 hdr->ttt = be32_to_cpu(hdr->ttt);
1199 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn); 1197 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn);
1200 hdr->datasn = be32_to_cpu(hdr->datasn); 1198 hdr->datasn = be32_to_cpu(hdr->datasn);
@@ -1425,12 +1423,11 @@ static int iscsit_handle_nop_out(
1425 1423
1426 hdr = (struct iscsi_nopout *) buf; 1424 hdr = (struct iscsi_nopout *) buf;
1427 payload_length = ntoh24(hdr->dlength); 1425 payload_length = ntoh24(hdr->dlength);
1428 hdr->itt = be32_to_cpu(hdr->itt);
1429 hdr->ttt = be32_to_cpu(hdr->ttt); 1426 hdr->ttt = be32_to_cpu(hdr->ttt);
1430 hdr->cmdsn = be32_to_cpu(hdr->cmdsn); 1427 hdr->cmdsn = be32_to_cpu(hdr->cmdsn);
1431 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn); 1428 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn);
1432 1429
1433 if ((hdr->itt == 0xFFFFFFFF) && !(hdr->opcode & ISCSI_OP_IMMEDIATE)) { 1430 if (hdr->itt == RESERVED_ITT && !(hdr->opcode & ISCSI_OP_IMMEDIATE)) {
1434 pr_err("NOPOUT ITT is reserved, but Immediate Bit is" 1431 pr_err("NOPOUT ITT is reserved, but Immediate Bit is"
1435 " not set, protocol error.\n"); 1432 " not set, protocol error.\n");
1436 return iscsit_add_reject(ISCSI_REASON_PROTOCOL_ERROR, 1, 1433 return iscsit_add_reject(ISCSI_REASON_PROTOCOL_ERROR, 1,
@@ -1448,7 +1445,7 @@ static int iscsit_handle_nop_out(
1448 1445
1449 pr_debug("Got NOPOUT Ping %s ITT: 0x%08x, TTT: 0x%09x," 1446 pr_debug("Got NOPOUT Ping %s ITT: 0x%08x, TTT: 0x%09x,"
1450 " CmdSN: 0x%08x, ExpStatSN: 0x%08x, Length: %u\n", 1447 " CmdSN: 0x%08x, ExpStatSN: 0x%08x, Length: %u\n",
1451 (hdr->itt == 0xFFFFFFFF) ? "Response" : "Request", 1448 hdr->itt == RESERVED_ITT ? "Response" : "Request",
1452 hdr->itt, hdr->ttt, hdr->cmdsn, hdr->exp_statsn, 1449 hdr->itt, hdr->ttt, hdr->cmdsn, hdr->exp_statsn,
1453 payload_length); 1450 payload_length);
1454 /* 1451 /*
@@ -1556,7 +1553,7 @@ static int iscsit_handle_nop_out(
1556 pr_debug("Ping Data: \"%s\"\n", ping_data); 1553 pr_debug("Ping Data: \"%s\"\n", ping_data);
1557 } 1554 }
1558 1555
1559 if (hdr->itt != 0xFFFFFFFF) { 1556 if (hdr->itt != RESERVED_ITT) {
1560 if (!cmd) { 1557 if (!cmd) {
1561 pr_err("Checking CmdSN for NOPOUT," 1558 pr_err("Checking CmdSN for NOPOUT,"
1562 " but cmd is NULL!\n"); 1559 " but cmd is NULL!\n");
@@ -1639,8 +1636,6 @@ static int iscsit_handle_task_mgt_cmd(
1639 u8 function; 1636 u8 function;
1640 1637
1641 hdr = (struct iscsi_tm *) buf; 1638 hdr = (struct iscsi_tm *) buf;
1642 hdr->itt = be32_to_cpu(hdr->itt);
1643 hdr->rtt = be32_to_cpu(hdr->rtt);
1644 hdr->cmdsn = be32_to_cpu(hdr->cmdsn); 1639 hdr->cmdsn = be32_to_cpu(hdr->cmdsn);
1645 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn); 1640 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn);
1646 hdr->refcmdsn = be32_to_cpu(hdr->refcmdsn); 1641 hdr->refcmdsn = be32_to_cpu(hdr->refcmdsn);
@@ -1655,9 +1650,9 @@ static int iscsit_handle_task_mgt_cmd(
1655 1650
1656 if ((function != ISCSI_TM_FUNC_ABORT_TASK) && 1651 if ((function != ISCSI_TM_FUNC_ABORT_TASK) &&
1657 ((function != ISCSI_TM_FUNC_TASK_REASSIGN) && 1652 ((function != ISCSI_TM_FUNC_TASK_REASSIGN) &&
1658 (hdr->rtt != ISCSI_RESERVED_TAG))) { 1653 hdr->rtt != RESERVED_ITT)) {
1659 pr_err("RefTaskTag should be set to 0xFFFFFFFF.\n"); 1654 pr_err("RefTaskTag should be set to 0xFFFFFFFF.\n");
1660 hdr->rtt = ISCSI_RESERVED_TAG; 1655 hdr->rtt = RESERVED_ITT;
1661 } 1656 }
1662 1657
1663 if ((function == ISCSI_TM_FUNC_TASK_REASSIGN) && 1658 if ((function == ISCSI_TM_FUNC_TASK_REASSIGN) &&
@@ -1869,7 +1864,6 @@ static int iscsit_handle_text_cmd(
1869 1864
1870 hdr = (struct iscsi_text *) buf; 1865 hdr = (struct iscsi_text *) buf;
1871 payload_length = ntoh24(hdr->dlength); 1866 payload_length = ntoh24(hdr->dlength);
1872 hdr->itt = be32_to_cpu(hdr->itt);
1873 hdr->ttt = be32_to_cpu(hdr->ttt); 1867 hdr->ttt = be32_to_cpu(hdr->ttt);
1874 hdr->cmdsn = be32_to_cpu(hdr->cmdsn); 1868 hdr->cmdsn = be32_to_cpu(hdr->cmdsn);
1875 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn); 1869 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn);
@@ -2131,7 +2125,6 @@ static int iscsit_handle_logout_cmd(
2131 2125
2132 hdr = (struct iscsi_logout *) buf; 2126 hdr = (struct iscsi_logout *) buf;
2133 reason_code = (hdr->flags & 0x7f); 2127 reason_code = (hdr->flags & 0x7f);
2134 hdr->itt = be32_to_cpu(hdr->itt);
2135 hdr->cid = be16_to_cpu(hdr->cid); 2128 hdr->cid = be16_to_cpu(hdr->cid);
2136 hdr->cmdsn = be32_to_cpu(hdr->cmdsn); 2129 hdr->cmdsn = be32_to_cpu(hdr->cmdsn);
2137 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn); 2130 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn);
@@ -2219,7 +2212,6 @@ static int iscsit_handle_snack(
2219 2212
2220 hdr = (struct iscsi_snack *) buf; 2213 hdr = (struct iscsi_snack *) buf;
2221 hdr->flags &= ~ISCSI_FLAG_CMD_FINAL; 2214 hdr->flags &= ~ISCSI_FLAG_CMD_FINAL;
2222 hdr->itt = be32_to_cpu(hdr->itt);
2223 hdr->ttt = be32_to_cpu(hdr->ttt); 2215 hdr->ttt = be32_to_cpu(hdr->ttt);
2224 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn); 2216 hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn);
2225 hdr->begrun = be32_to_cpu(hdr->begrun); 2217 hdr->begrun = be32_to_cpu(hdr->begrun);
@@ -2414,7 +2406,7 @@ static int iscsit_send_conn_drop_async_message(
2414 hdr = (struct iscsi_async *) cmd->pdu; 2406 hdr = (struct iscsi_async *) cmd->pdu;
2415 hdr->opcode = ISCSI_OP_ASYNC_EVENT; 2407 hdr->opcode = ISCSI_OP_ASYNC_EVENT;
2416 hdr->flags = ISCSI_FLAG_CMD_FINAL; 2408 hdr->flags = ISCSI_FLAG_CMD_FINAL;
2417 cmd->init_task_tag = 0xFFFFFFFF; 2409 cmd->init_task_tag = RESERVED_ITT;
2418 cmd->targ_xfer_tag = 0xFFFFFFFF; 2410 cmd->targ_xfer_tag = 0xFFFFFFFF;
2419 put_unaligned_be64(0xFFFFFFFFFFFFFFFFULL, &hdr->rsvd4[0]); 2411 put_unaligned_be64(0xFFFFFFFFFFFFFFFFULL, &hdr->rsvd4[0]);
2420 cmd->stat_sn = conn->stat_sn++; 2412 cmd->stat_sn = conn->stat_sn++;
@@ -2536,7 +2528,7 @@ static int iscsit_send_data_in(
2536 else 2528 else
2537 put_unaligned_le64(0xFFFFFFFFFFFFFFFFULL, &hdr->lun); 2529 put_unaligned_le64(0xFFFFFFFFFFFFFFFFULL, &hdr->lun);
2538 2530
2539 hdr->itt = cpu_to_be32(cmd->init_task_tag); 2531 hdr->itt = cmd->init_task_tag;
2540 hdr->ttt = (hdr->flags & ISCSI_FLAG_DATA_ACK) ? 2532 hdr->ttt = (hdr->flags & ISCSI_FLAG_DATA_ACK) ?
2541 cpu_to_be32(cmd->targ_xfer_tag) : 2533 cpu_to_be32(cmd->targ_xfer_tag) :
2542 0xFFFFFFFF; 2534 0xFFFFFFFF;
@@ -2708,7 +2700,7 @@ static int iscsit_send_logout_response(
2708 hdr->opcode = ISCSI_OP_LOGOUT_RSP; 2700 hdr->opcode = ISCSI_OP_LOGOUT_RSP;
2709 hdr->flags |= ISCSI_FLAG_CMD_FINAL; 2701 hdr->flags |= ISCSI_FLAG_CMD_FINAL;
2710 hdr->response = cmd->logout_response; 2702 hdr->response = cmd->logout_response;
2711 hdr->itt = cpu_to_be32(cmd->init_task_tag); 2703 hdr->itt = cmd->init_task_tag;
2712 cmd->stat_sn = conn->stat_sn++; 2704 cmd->stat_sn = conn->stat_sn++;
2713 hdr->statsn = cpu_to_be32(cmd->stat_sn); 2705 hdr->statsn = cpu_to_be32(cmd->stat_sn);
2714 2706
@@ -2759,7 +2751,7 @@ static int iscsit_send_unsolicited_nopin(
2759 memset(hdr, 0, ISCSI_HDR_LEN); 2751 memset(hdr, 0, ISCSI_HDR_LEN);
2760 hdr->opcode = ISCSI_OP_NOOP_IN; 2752 hdr->opcode = ISCSI_OP_NOOP_IN;
2761 hdr->flags |= ISCSI_FLAG_CMD_FINAL; 2753 hdr->flags |= ISCSI_FLAG_CMD_FINAL;
2762 hdr->itt = cpu_to_be32(cmd->init_task_tag); 2754 hdr->itt = cmd->init_task_tag;
2763 hdr->ttt = cpu_to_be32(cmd->targ_xfer_tag); 2755 hdr->ttt = cpu_to_be32(cmd->targ_xfer_tag);
2764 cmd->stat_sn = conn->stat_sn; 2756 cmd->stat_sn = conn->stat_sn;
2765 hdr->statsn = cpu_to_be32(cmd->stat_sn); 2757 hdr->statsn = cpu_to_be32(cmd->stat_sn);
@@ -2816,7 +2808,7 @@ static int iscsit_send_nopin_response(
2816 hdr->flags |= ISCSI_FLAG_CMD_FINAL; 2808 hdr->flags |= ISCSI_FLAG_CMD_FINAL;
2817 hton24(hdr->dlength, cmd->buf_ptr_size); 2809 hton24(hdr->dlength, cmd->buf_ptr_size);
2818 put_unaligned_le64(0xFFFFFFFFFFFFFFFFULL, &hdr->lun); 2810 put_unaligned_le64(0xFFFFFFFFFFFFFFFFULL, &hdr->lun);
2819 hdr->itt = cpu_to_be32(cmd->init_task_tag); 2811 hdr->itt = cmd->init_task_tag;
2820 hdr->ttt = cpu_to_be32(cmd->targ_xfer_tag); 2812 hdr->ttt = cpu_to_be32(cmd->targ_xfer_tag);
2821 cmd->stat_sn = conn->stat_sn++; 2813 cmd->stat_sn = conn->stat_sn++;
2822 hdr->statsn = cpu_to_be32(cmd->stat_sn); 2814 hdr->statsn = cpu_to_be32(cmd->stat_sn);
@@ -2906,7 +2898,7 @@ static int iscsit_send_r2t(
2906 hdr->flags |= ISCSI_FLAG_CMD_FINAL; 2898 hdr->flags |= ISCSI_FLAG_CMD_FINAL;
2907 int_to_scsilun(cmd->se_cmd.orig_fe_lun, 2899 int_to_scsilun(cmd->se_cmd.orig_fe_lun,
2908 (struct scsi_lun *)&hdr->lun); 2900 (struct scsi_lun *)&hdr->lun);
2909 hdr->itt = cpu_to_be32(cmd->init_task_tag); 2901 hdr->itt = cmd->init_task_tag;
2910 spin_lock_bh(&conn->sess->ttt_lock); 2902 spin_lock_bh(&conn->sess->ttt_lock);
2911 r2t->targ_xfer_tag = conn->sess->targ_xfer_tag++; 2903 r2t->targ_xfer_tag = conn->sess->targ_xfer_tag++;
2912 if (r2t->targ_xfer_tag == 0xFFFFFFFF) 2904 if (r2t->targ_xfer_tag == 0xFFFFFFFF)
@@ -3074,7 +3066,7 @@ static int iscsit_send_status(
3074 } 3066 }
3075 hdr->response = cmd->iscsi_response; 3067 hdr->response = cmd->iscsi_response;
3076 hdr->cmd_status = cmd->se_cmd.scsi_status; 3068 hdr->cmd_status = cmd->se_cmd.scsi_status;
3077 hdr->itt = cpu_to_be32(cmd->init_task_tag); 3069 hdr->itt = cmd->init_task_tag;
3078 hdr->statsn = cpu_to_be32(cmd->stat_sn); 3070 hdr->statsn = cpu_to_be32(cmd->stat_sn);
3079 3071
3080 iscsit_increment_maxcmdsn(cmd, conn->sess); 3072 iscsit_increment_maxcmdsn(cmd, conn->sess);
@@ -3187,7 +3179,7 @@ static int iscsit_send_task_mgt_rsp(
3187 hdr->opcode = ISCSI_OP_SCSI_TMFUNC_RSP; 3179 hdr->opcode = ISCSI_OP_SCSI_TMFUNC_RSP;
3188 hdr->flags = ISCSI_FLAG_CMD_FINAL; 3180 hdr->flags = ISCSI_FLAG_CMD_FINAL;
3189 hdr->response = iscsit_convert_tcm_tmr_rsp(se_tmr); 3181 hdr->response = iscsit_convert_tcm_tmr_rsp(se_tmr);
3190 hdr->itt = cpu_to_be32(cmd->init_task_tag); 3182 hdr->itt = cmd->init_task_tag;
3191 cmd->stat_sn = conn->stat_sn++; 3183 cmd->stat_sn = conn->stat_sn++;
3192 hdr->statsn = cpu_to_be32(cmd->stat_sn); 3184 hdr->statsn = cpu_to_be32(cmd->stat_sn);
3193 3185
@@ -3360,7 +3352,7 @@ static int iscsit_send_text_rsp(
3360 hdr->opcode = ISCSI_OP_TEXT_RSP; 3352 hdr->opcode = ISCSI_OP_TEXT_RSP;
3361 hdr->flags |= ISCSI_FLAG_CMD_FINAL; 3353 hdr->flags |= ISCSI_FLAG_CMD_FINAL;
3362 hton24(hdr->dlength, text_length); 3354 hton24(hdr->dlength, text_length);
3363 hdr->itt = cpu_to_be32(cmd->init_task_tag); 3355 hdr->itt = cmd->init_task_tag;
3364 hdr->ttt = cpu_to_be32(cmd->targ_xfer_tag); 3356 hdr->ttt = cpu_to_be32(cmd->targ_xfer_tag);
3365 cmd->stat_sn = conn->stat_sn++; 3357 cmd->stat_sn = conn->stat_sn++;
3366 hdr->statsn = cpu_to_be32(cmd->stat_sn); 3358 hdr->statsn = cpu_to_be32(cmd->stat_sn);
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index 8c9955f51c5d..ff6fd4fb624d 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -1475,7 +1475,8 @@ static u32 iscsi_get_task_tag(struct se_cmd *se_cmd)
1475{ 1475{
1476 struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); 1476 struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
1477 1477
1478 return cmd->init_task_tag; 1478 /* only used for printks or comparism with ->ref_task_tag */
1479 return (__force u32)cmd->init_task_tag;
1479} 1480}
1480 1481
1481static int iscsi_get_cmd_state(struct se_cmd *se_cmd) 1482static int iscsi_get_cmd_state(struct se_cmd *se_cmd)
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h
index e6a830545c89..226fe62d4e61 100644
--- a/drivers/target/iscsi/iscsi_target_core.h
+++ b/drivers/target/iscsi/iscsi_target_core.h
@@ -361,7 +361,7 @@ struct iscsi_cmd {
361 /* Command flags */ 361 /* Command flags */
362 enum cmd_flags_table cmd_flags; 362 enum cmd_flags_table cmd_flags;
363 /* Initiator Task Tag assigned from Initiator */ 363 /* Initiator Task Tag assigned from Initiator */
364 u32 init_task_tag; 364 itt_t init_task_tag;
365 /* Target Transfer Tag assigned from Target */ 365 /* Target Transfer Tag assigned from Target */
366 u32 targ_xfer_tag; 366 u32 targ_xfer_tag;
367 /* CmdSN assigned from Initiator */ 367 /* CmdSN assigned from Initiator */
@@ -506,7 +506,7 @@ struct iscsi_conn {
506 u32 auth_id; 506 u32 auth_id;
507 u32 conn_flags; 507 u32 conn_flags;
508 /* Used for iscsi_tx_login_rsp() */ 508 /* Used for iscsi_tx_login_rsp() */
509 u32 login_itt; 509 itt_t login_itt;
510 u32 exp_statsn; 510 u32 exp_statsn;
511 /* Per connection status sequence number */ 511 /* Per connection status sequence number */
512 u32 stat_sn; 512 u32 stat_sn;
@@ -599,7 +599,7 @@ struct iscsi_session {
599 /* state session is currently in */ 599 /* state session is currently in */
600 u32 session_state; 600 u32 session_state;
601 /* session wide counter: initiator assigned task tag */ 601 /* session wide counter: initiator assigned task tag */
602 u32 init_task_tag; 602 itt_t init_task_tag;
603 /* session wide counter: target assigned task tag */ 603 /* session wide counter: target assigned task tag */
604 u32 targ_xfer_tag; 604 u32 targ_xfer_tag;
605 u32 cmdsn_window; 605 u32 cmdsn_window;
@@ -665,7 +665,7 @@ struct iscsi_login {
665 u8 version_max; 665 u8 version_max;
666 char isid[6]; 666 char isid[6];
667 u32 cmd_sn; 667 u32 cmd_sn;
668 u32 init_task_tag; 668 itt_t init_task_tag;
669 u32 initial_exp_statsn; 669 u32 initial_exp_statsn;
670 u32 rsp_length; 670 u32 rsp_length;
671 u16 cid; 671 u16 cid;
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c
index 3df8a2cef86f..21f29d91a8cb 100644
--- a/drivers/target/iscsi/iscsi_target_erl1.c
+++ b/drivers/target/iscsi/iscsi_target_erl1.c
@@ -466,7 +466,7 @@ static int iscsit_handle_recovery_datain(
466int iscsit_handle_recovery_datain_or_r2t( 466int iscsit_handle_recovery_datain_or_r2t(
467 struct iscsi_conn *conn, 467 struct iscsi_conn *conn,
468 unsigned char *buf, 468 unsigned char *buf,
469 u32 init_task_tag, 469 itt_t init_task_tag,
470 u32 targ_xfer_tag, 470 u32 targ_xfer_tag,
471 u32 begrun, 471 u32 begrun,
472 u32 runlength) 472 u32 runlength)
@@ -498,7 +498,7 @@ int iscsit_handle_recovery_datain_or_r2t(
498/* #warning FIXME: Status SNACK needs to be dependent on OPCODE!!! */ 498/* #warning FIXME: Status SNACK needs to be dependent on OPCODE!!! */
499int iscsit_handle_status_snack( 499int iscsit_handle_status_snack(
500 struct iscsi_conn *conn, 500 struct iscsi_conn *conn,
501 u32 init_task_tag, 501 itt_t init_task_tag,
502 u32 targ_xfer_tag, 502 u32 targ_xfer_tag,
503 u32 begrun, 503 u32 begrun,
504 u32 runlength) 504 u32 runlength)
diff --git a/drivers/target/iscsi/iscsi_target_erl1.h b/drivers/target/iscsi/iscsi_target_erl1.h
index 85e67e29de6b..2a3ebf118a34 100644
--- a/drivers/target/iscsi/iscsi_target_erl1.h
+++ b/drivers/target/iscsi/iscsi_target_erl1.h
@@ -7,8 +7,8 @@ extern int iscsit_create_recovery_datain_values_datasequenceinorder_yes(
7extern int iscsit_create_recovery_datain_values_datasequenceinorder_no( 7extern int iscsit_create_recovery_datain_values_datasequenceinorder_no(
8 struct iscsi_cmd *, struct iscsi_datain_req *); 8 struct iscsi_cmd *, struct iscsi_datain_req *);
9extern int iscsit_handle_recovery_datain_or_r2t(struct iscsi_conn *, unsigned char *, 9extern int iscsit_handle_recovery_datain_or_r2t(struct iscsi_conn *, unsigned char *,
10 u32, u32, u32, u32); 10 itt_t, u32, u32, u32);
11extern int iscsit_handle_status_snack(struct iscsi_conn *, u32, u32, 11extern int iscsit_handle_status_snack(struct iscsi_conn *, itt_t, u32,
12 u32, u32); 12 u32, u32);
13extern int iscsit_handle_data_ack(struct iscsi_conn *, u32, u32, u32); 13extern int iscsit_handle_data_ack(struct iscsi_conn *, u32, u32, u32);
14extern int iscsit_dataout_datapduinorder_no_fbit(struct iscsi_cmd *, struct iscsi_pdu *); 14extern int iscsit_dataout_datapduinorder_no_fbit(struct iscsi_cmd *, struct iscsi_pdu *);
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
index 1e5d05011915..4c83d7a39bf3 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -953,9 +953,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
953 pdu = (struct iscsi_login_req *) buffer; 953 pdu = (struct iscsi_login_req *) buffer;
954 pdu->cid = be16_to_cpu(pdu->cid); 954 pdu->cid = be16_to_cpu(pdu->cid);
955 pdu->tsih = be16_to_cpu(pdu->tsih); 955 pdu->tsih = be16_to_cpu(pdu->tsih);
956 pdu->itt = be32_to_cpu(pdu->itt);
957 pdu->cmdsn = be32_to_cpu(pdu->cmdsn); 956 pdu->cmdsn = be32_to_cpu(pdu->cmdsn);
958 pdu->exp_statsn = be32_to_cpu(pdu->exp_statsn); 957 pdu->exp_statsn = be32_to_cpu(pdu->exp_statsn);
958
959 /* 959 /*
960 * Used by iscsit_tx_login_rsp() for Login Resonses PDUs 960 * Used by iscsit_tx_login_rsp() for Login Resonses PDUs
961 * when Status-Class != 0. 961 * when Status-Class != 0.
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index 42b1c50d296a..33ed9b5209cd 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -339,14 +339,14 @@ static int iscsi_target_do_tx_login_io(struct iscsi_conn *conn, struct iscsi_log
339 hton24(login_rsp->dlength, login->rsp_length); 339 hton24(login_rsp->dlength, login->rsp_length);
340 memcpy(login_rsp->isid, login->isid, 6); 340 memcpy(login_rsp->isid, login->isid, 6);
341 login_rsp->tsih = cpu_to_be16(login->tsih); 341 login_rsp->tsih = cpu_to_be16(login->tsih);
342 login_rsp->itt = cpu_to_be32(login->init_task_tag); 342 login_rsp->itt = login->init_task_tag;
343 login_rsp->statsn = cpu_to_be32(conn->stat_sn++); 343 login_rsp->statsn = cpu_to_be32(conn->stat_sn++);
344 login_rsp->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); 344 login_rsp->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn);
345 login_rsp->max_cmdsn = cpu_to_be32(conn->sess->max_cmd_sn); 345 login_rsp->max_cmdsn = cpu_to_be32(conn->sess->max_cmd_sn);
346 346
347 pr_debug("Sending Login Response, Flags: 0x%02x, ITT: 0x%08x," 347 pr_debug("Sending Login Response, Flags: 0x%02x, ITT: 0x%08x,"
348 " ExpCmdSN; 0x%08x, MaxCmdSN: 0x%08x, StatSN: 0x%08x, Length:" 348 " ExpCmdSN; 0x%08x, MaxCmdSN: 0x%08x, StatSN: 0x%08x, Length:"
349 " %u\n", login_rsp->flags, ntohl(login_rsp->itt), 349 " %u\n", login_rsp->flags, (__force u32)login_rsp->itt,
350 ntohl(login_rsp->exp_cmdsn), ntohl(login_rsp->max_cmdsn), 350 ntohl(login_rsp->exp_cmdsn), ntohl(login_rsp->max_cmdsn),
351 ntohl(login_rsp->statsn), login->rsp_length); 351 ntohl(login_rsp->statsn), login->rsp_length);
352 352
@@ -361,7 +361,6 @@ static int iscsi_target_do_tx_login_io(struct iscsi_conn *conn, struct iscsi_log
361 361
362 login->rsp_length = 0; 362 login->rsp_length = 0;
363 login_rsp->tsih = be16_to_cpu(login_rsp->tsih); 363 login_rsp->tsih = be16_to_cpu(login_rsp->tsih);
364 login_rsp->itt = be32_to_cpu(login_rsp->itt);
365 login_rsp->statsn = be32_to_cpu(login_rsp->statsn); 364 login_rsp->statsn = be32_to_cpu(login_rsp->statsn);
366 mutex_lock(&sess->cmdsn_mutex); 365 mutex_lock(&sess->cmdsn_mutex);
367 login_rsp->exp_cmdsn = be32_to_cpu(sess->exp_cmd_sn); 366 login_rsp->exp_cmdsn = be32_to_cpu(sess->exp_cmd_sn);
@@ -382,7 +381,6 @@ static int iscsi_target_do_rx_login_io(struct iscsi_conn *conn, struct iscsi_log
382 login_req = (struct iscsi_login_req *) login->req; 381 login_req = (struct iscsi_login_req *) login->req;
383 payload_length = ntoh24(login_req->dlength); 382 payload_length = ntoh24(login_req->dlength);
384 login_req->tsih = be16_to_cpu(login_req->tsih); 383 login_req->tsih = be16_to_cpu(login_req->tsih);
385 login_req->itt = be32_to_cpu(login_req->itt);
386 login_req->cid = be16_to_cpu(login_req->cid); 384 login_req->cid = be16_to_cpu(login_req->cid);
387 login_req->cmdsn = be32_to_cpu(login_req->cmdsn); 385 login_req->cmdsn = be32_to_cpu(login_req->cmdsn);
388 login_req->exp_statsn = be32_to_cpu(login_req->exp_statsn); 386 login_req->exp_statsn = be32_to_cpu(login_req->exp_statsn);
diff --git a/drivers/target/iscsi/iscsi_target_tmr.c b/drivers/target/iscsi/iscsi_target_tmr.c
index f15462bfafd2..925f829a3704 100644
--- a/drivers/target/iscsi/iscsi_target_tmr.c
+++ b/drivers/target/iscsi/iscsi_target_tmr.c
@@ -61,7 +61,7 @@ u8 iscsit_tmr_abort_task(
61 return ISCSI_TMF_RSP_REJECTED; 61 return ISCSI_TMF_RSP_REJECTED;
62 } 62 }
63 63
64 se_tmr->ref_task_tag = hdr->rtt; 64 se_tmr->ref_task_tag = (__force u32)hdr->rtt;
65 tmr_req->ref_cmd = ref_cmd; 65 tmr_req->ref_cmd = ref_cmd;
66 tmr_req->ref_cmd_sn = hdr->refcmdsn; 66 tmr_req->ref_cmd_sn = hdr->refcmdsn;
67 tmr_req->exp_data_sn = hdr->exp_datasn; 67 tmr_req->exp_data_sn = hdr->exp_datasn;
@@ -171,7 +171,7 @@ u8 iscsit_tmr_task_reassign(
171 return ISCSI_TMF_RSP_REJECTED; 171 return ISCSI_TMF_RSP_REJECTED;
172 } 172 }
173 173
174 se_tmr->ref_task_tag = hdr->rtt; 174 se_tmr->ref_task_tag = (__force u32)hdr->rtt;
175 tmr_req->ref_cmd = ref_cmd; 175 tmr_req->ref_cmd = ref_cmd;
176 tmr_req->ref_cmd_sn = hdr->refcmdsn; 176 tmr_req->ref_cmd_sn = hdr->refcmdsn;
177 tmr_req->exp_data_sn = hdr->exp_datasn; 177 tmr_req->exp_data_sn = hdr->exp_datasn;
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
index b42cdeb153df..22bec9e899c0 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -351,7 +351,7 @@ int iscsit_check_unsolicited_dataout(struct iscsi_cmd *cmd, unsigned char *buf)
351 351
352struct iscsi_cmd *iscsit_find_cmd_from_itt( 352struct iscsi_cmd *iscsit_find_cmd_from_itt(
353 struct iscsi_conn *conn, 353 struct iscsi_conn *conn,
354 u32 init_task_tag) 354 itt_t init_task_tag)
355{ 355{
356 struct iscsi_cmd *cmd; 356 struct iscsi_cmd *cmd;
357 357
@@ -371,7 +371,7 @@ struct iscsi_cmd *iscsit_find_cmd_from_itt(
371 371
372struct iscsi_cmd *iscsit_find_cmd_from_itt_or_dump( 372struct iscsi_cmd *iscsit_find_cmd_from_itt_or_dump(
373 struct iscsi_conn *conn, 373 struct iscsi_conn *conn,
374 u32 init_task_tag, 374 itt_t init_task_tag,
375 u32 length) 375 u32 length)
376{ 376{
377 struct iscsi_cmd *cmd; 377 struct iscsi_cmd *cmd;
@@ -417,7 +417,7 @@ int iscsit_find_cmd_for_recovery(
417 struct iscsi_session *sess, 417 struct iscsi_session *sess,
418 struct iscsi_cmd **cmd_ptr, 418 struct iscsi_cmd **cmd_ptr,
419 struct iscsi_conn_recovery **cr_ptr, 419 struct iscsi_conn_recovery **cr_ptr,
420 u32 init_task_tag) 420 itt_t init_task_tag)
421{ 421{
422 struct iscsi_cmd *cmd = NULL; 422 struct iscsi_cmd *cmd = NULL;
423 struct iscsi_conn_recovery *cr; 423 struct iscsi_conn_recovery *cr;
@@ -855,7 +855,7 @@ static int iscsit_add_nopin(struct iscsi_conn *conn, int want_response)
855 cmd->iscsi_opcode = ISCSI_OP_NOOP_IN; 855 cmd->iscsi_opcode = ISCSI_OP_NOOP_IN;
856 state = (want_response) ? ISTATE_SEND_NOPIN_WANT_RESPONSE : 856 state = (want_response) ? ISTATE_SEND_NOPIN_WANT_RESPONSE :
857 ISTATE_SEND_NOPIN_NO_RESPONSE; 857 ISTATE_SEND_NOPIN_NO_RESPONSE;
858 cmd->init_task_tag = 0xFFFFFFFF; 858 cmd->init_task_tag = RESERVED_ITT;
859 spin_lock_bh(&conn->sess->ttt_lock); 859 spin_lock_bh(&conn->sess->ttt_lock);
860 cmd->targ_xfer_tag = (want_response) ? conn->sess->targ_xfer_tag++ : 860 cmd->targ_xfer_tag = (want_response) ? conn->sess->targ_xfer_tag++ :
861 0xFFFFFFFF; 861 0xFFFFFFFF;
@@ -1222,7 +1222,7 @@ int iscsit_tx_login_rsp(struct iscsi_conn *conn, u8 status_class, u8 status_deta
1222 hdr->opcode = ISCSI_OP_LOGIN_RSP; 1222 hdr->opcode = ISCSI_OP_LOGIN_RSP;
1223 hdr->status_class = status_class; 1223 hdr->status_class = status_class;
1224 hdr->status_detail = status_detail; 1224 hdr->status_detail = status_detail;
1225 hdr->itt = cpu_to_be32(conn->login_itt); 1225 hdr->itt = conn->login_itt;
1226 1226
1227 iov.iov_base = &iscsi_hdr; 1227 iov.iov_base = &iscsi_hdr;
1228 iov.iov_len = ISCSI_HDR_LEN; 1228 iov.iov_len = ISCSI_HDR_LEN;
diff --git a/drivers/target/iscsi/iscsi_target_util.h b/drivers/target/iscsi/iscsi_target_util.h
index e1c729b8a1c5..09e2f9f563a7 100644
--- a/drivers/target/iscsi/iscsi_target_util.h
+++ b/drivers/target/iscsi/iscsi_target_util.h
@@ -14,12 +14,12 @@ extern struct iscsi_seq *iscsit_get_seq_holder_for_r2t(struct iscsi_cmd *);
14extern struct iscsi_r2t *iscsit_get_holder_for_r2tsn(struct iscsi_cmd *, u32); 14extern struct iscsi_r2t *iscsit_get_holder_for_r2tsn(struct iscsi_cmd *, u32);
15int iscsit_sequence_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, u32 cmdsn); 15int iscsit_sequence_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, u32 cmdsn);
16extern int iscsit_check_unsolicited_dataout(struct iscsi_cmd *, unsigned char *); 16extern int iscsit_check_unsolicited_dataout(struct iscsi_cmd *, unsigned char *);
17extern struct iscsi_cmd *iscsit_find_cmd_from_itt(struct iscsi_conn *, u32); 17extern struct iscsi_cmd *iscsit_find_cmd_from_itt(struct iscsi_conn *, itt_t);
18extern struct iscsi_cmd *iscsit_find_cmd_from_itt_or_dump(struct iscsi_conn *, 18extern struct iscsi_cmd *iscsit_find_cmd_from_itt_or_dump(struct iscsi_conn *,
19 u32, u32); 19 itt_t, u32);
20extern struct iscsi_cmd *iscsit_find_cmd_from_ttt(struct iscsi_conn *, u32); 20extern struct iscsi_cmd *iscsit_find_cmd_from_ttt(struct iscsi_conn *, u32);
21extern int iscsit_find_cmd_for_recovery(struct iscsi_session *, struct iscsi_cmd **, 21extern int iscsit_find_cmd_for_recovery(struct iscsi_session *, struct iscsi_cmd **,
22 struct iscsi_conn_recovery **, u32); 22 struct iscsi_conn_recovery **, itt_t);
23extern void iscsit_add_cmd_to_immediate_queue(struct iscsi_cmd *, struct iscsi_conn *, u8); 23extern void iscsit_add_cmd_to_immediate_queue(struct iscsi_cmd *, struct iscsi_conn *, u8);
24extern struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *); 24extern struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *);
25extern void iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8); 25extern void iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8);