21 #include <asm/unaligned.h>
51 pr_err(
"Unable to locate RefTaskTag: 0x%08x on CID:"
52 " %hu.\n", hdr->
rtt, conn->
cid);
58 pr_err(
"RefCmdSN 0x%08x does not equal"
59 " task's CmdSN 0x%08x. Rejecting ABORT_TASK.\n",
83 pr_err(
"TMR Opcode TARGET_WARM_RESET authorization"
84 " failed for Initiator Node: %s\n",
85 sess->
se_sess->se_node_acl->initiatorname);
103 pr_err(
"TMR Opcode TARGET_COLD_RESET authorization"
104 " failed for Initiator Node: %s\n",
105 sess->
se_sess->se_node_acl->initiatorname);
126 pr_debug(
"Got TASK_REASSIGN TMR ITT: 0x%08x,"
127 " RefTaskTag: 0x%08x, ExpDataSN: 0x%08x, CID: %hu\n",
130 if (conn->
sess->sess_ops->ErrorRecoveryLevel != 2) {
131 pr_err(
"TMR TASK_REASSIGN not supported in ERL<2,"
132 " ignoring request.\n");
138 pr_err(
"Command ITT: 0x%08x is still alligent to CID:"
141 }
else if (ret == -1) {
142 pr_err(
"Unable to locate RefTaskTag: 0x%08x in"
143 " connection recovery command list.\n", hdr->
rtt);
151 conn->
conn_ops->MaxRecvDataSegmentLength) {
152 pr_err(
"Unable to perform connection recovery for"
153 " differing MaxRecvDataSegmentLength, rejecting"
154 " TMR TASK_REASSIGN.\n");
158 conn->
conn_ops->MaxXmitDataSegmentLength) {
159 pr_err(
"Unable to perform connection recovery for"
160 " differing MaxXmitDataSegmentLength, rejecting"
161 " TMR TASK_REASSIGN.\n");
166 if (ref_lun != ref_cmd->
se_cmd.orig_fe_lun) {
167 pr_err(
"Unable to perform connection recovery for"
168 " differing ref_lun: %d ref_cmd orig_fe_lun: %u\n",
169 ref_lun, ref_cmd->
se_cmd.orig_fe_lun);
186 static void iscsit_task_reassign_remove_cmd(
197 pr_debug(
"iSCSI connection recovery successful for CID:"
198 " %hu on SID: %u\n", cr->
cid, sess->
sid);
203 static int iscsit_task_reassign_complete_nop_out(
211 pr_err(
"struct iscsi_conn_recovery pointer for ITT: 0x%08x"
224 iscsit_task_reassign_remove_cmd(cmd, cr, conn->
sess);
235 static int iscsit_task_reassign_complete_write(
239 int no_build_r2ts = 0;
262 pr_debug(
"WRITE ITT: 0x%08x: t_state: %d"
263 " never sent to transport\n",
283 if ((conn->
sess->sess_ops->FirstBurstLength -
offset) >=
284 cmd->
se_cmd.data_length) {
288 length = (conn->
sess->sess_ops->FirstBurstLength -
offset);
307 static int iscsit_task_reassign_complete_read(
313 struct se_cmd *se_cmd = &cmd->
se_cmd;
327 pr_debug(
"READ ITT: 0x%08x: t_state: %d never sent to"
335 pr_err(
"READ ITT: 0x%08x: t_state: %d, never returned"
360 static int iscsit_task_reassign_complete_none(
371 static int iscsit_task_reassign_complete_scsi_cmnd(
379 pr_err(
"struct iscsi_conn_recovery pointer for ITT: 0x%08x"
392 iscsit_task_reassign_remove_cmd(cmd, cr, conn->
sess);
406 return iscsit_task_reassign_complete_write(cmd, tmr_req);
408 return iscsit_task_reassign_complete_read(cmd, tmr_req);
410 return iscsit_task_reassign_complete_none(cmd, tmr_req);
412 pr_err(
"Unknown cmd->data_direction: 0x%02x\n",
420 static int iscsit_task_reassign_complete(
428 pr_err(
"TMR Request is missing a RefCmd struct iscsi_cmd.\n");
437 ret = iscsit_task_reassign_complete_nop_out(tmr_req, conn);
440 ret = iscsit_task_reassign_complete_scsi_cmnd(tmr_req, conn);
443 pr_err(
"Illegal iSCSI Opcode 0x%02x during"
451 pr_debug(
"Completed connection realligence for Opcode: 0x%02x,"
470 return iscsit_task_reassign_complete(tmr_req, conn);
478 static int iscsit_task_reassign_prepare_read(
485 static void iscsit_task_reassign_prepare_unsolicited_dataout(
493 if (conn->
sess->sess_ops->DataSequenceInOrder) {
500 if (conn->
sess->sess_ops->DataPDUInOrder) {
538 if (conn->
sess->sess_ops->DataPDUInOrder)
553 static int iscsit_task_reassign_prepare_write(
560 int first_incomplete_r2t = 1, i = 0;
567 iscsit_task_reassign_prepare_unsolicited_dataout(cmd, conn);
575 goto drop_unacknowledged_r2ts;
643 if (conn->
sess->sess_ops->DataSequenceInOrder) {
644 if (!first_incomplete_r2t) {
649 if (conn->
sess->sess_ops->DataPDUInOrder) {
653 first_incomplete_r2t = 0;
675 first_incomplete_r2t = 0;
695 if (conn->
sess->sess_ops->DataPDUInOrder)
723 drop_unacknowledged_r2ts:
738 pr_err(
"Initiator is requesting R2Ts from"
739 " R2TSN: 0x%08x, but R2TSN: 0x%08x, Offset: %u,"
740 " Length: %u is already complete."
741 " BAD INITIATOR ERL=2 IMPLEMENTATION!\n",
769 if (conn->
sess->sess_ops->DataSequenceInOrder)
810 pr_err(
"Received ExpDataSN: 0x%08x for READ"
811 " in TMR TASK_REASSIGN greater than command's"
818 pr_err(
"Received ExpDataSN: 0x%08x for READ"
819 " in TMR TASK_REASSIGN for previously"
820 " acknowledged DataIN: 0x%08x,"
825 return iscsit_task_reassign_prepare_read(tmr_req, conn);
836 pr_err(
"Received ExpDataSN: 0x%08x for WRITE"
837 " in TMR TASK_REASSIGN greater than command's"
842 return iscsit_task_reassign_prepare_write(tmr_req, conn);
845 pr_err(
"Unknown iSCSI data_direction: 0x%02x\n",