Subject: iSCSI - last change for 2001!

From: "Julian Satran" <[email-masked]>
Date: Mon, 31 Dec 2001 17:29:41 +0200

Dear colleagues,

According to the agreement reached in SLC here is the new text for the 
Task Management Request/Response (with all synchronization functions 
delegated to the target). The impementer's notes - subsection 4 is out.

Task Management Function Request
Byte /    0       |       1       |       2       |       3       |
   /              |               |               |               |
  |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|
  +---------------+---------------+---------------+---------------+
 0|0|I| x02       |0| Function    | Reserved                      |
  +---------------+---------------+---------------+---------------+
 4| Reserved                                                      |
  +---------------+---------------+---------------+---------------+
 8| Logical Unit Number (LUN) or Reserved                         |
  +                                                               +
12|                                                               |
  +---------------+---------------+---------------+---------------+
16| Initiator Task Tag                                            |
  +---------------+---------------+---------------+---------------+
20| Referenced Task Tag or 0xffffffff                             |
  +---------------+---------------+---------------+---------------+
24| CmdSN                                                         |
  +---------------+---------------+---------------+---------------+
28| ExpStatSN                                                     |
  +---------------+---------------+---------------+---------------+
32| RefCmdSN or ExpDataSN                                         |
  +---------------+---------------+---------------+---------------+
36/ Reserved                                                      /
 +/                                                               /
  +---------------+---------------+---------------+---------------+
48

Function
The Task Management functions provide an initiator with a way to 
explicitly control the execution of one or more Tasks (SCSI and iSCSI 
tasks). The Task Management functions are listed below. For a more 
detailed description of SCSI task management, see [SAM2].

1    ABORT TASK - aborts the task identified by the Referenced       Task 
Tag field.

2    ABORT TASK SET - aborts all Tasks issued via this session on the 
logical unit.
3    CLEAR ACA - clears the Auto Contingent Allegiance condi-tion.

4    CLEAR TASK SET - aborts all Tasks for the Logical Unit.

5    LOGICAL UNIT RESET

6    TARGET WARM RESET

7                   TARGET COLD RESET

8    TASK REASSIGN - reassigns connection allegiance for the task 
identified by the Initiator Task Tag field on this con-nection, thus 
resuming the iSCSI exchanges for the task.

For all these functions, if executed, the Task Management Function 
Response MUST be returned using the Initiator Task Tag to identify the 
operation for which it is responding. All these functions apply to the 
referenced tasks regardless of whether they are proper SCSI tasks or 
tagged iSCSI operations.  Task management commands must be executed as if 
all the commands having a CmdSN lower or equal to the task manage-ment 
CmdSN have been received by the target (i.e., have to be executed as if 
received for ordered delivery even when marked for immediate delivery). 
For all the tasks covered by the task management response (i.e., with 
CmdSN not higher than the task management command CmdSN), additional 
responses MUST NOT be delivered to the SCSI layer after the task 
management response. The iSCSI initiator MAY deliver to the SCSI layer all 
responses received before the task management response (i.e., it is a 
matter of implementation if the SCSI responses received before the task 
mangement response but after the task management request are delivered to 
the SCSI layer by the iSCSI layer in the ini-tiator). The iSCSI target 
MUST ensure that no responses for the tasks covered by a task management 
function are delivered to the iSCSI ini-tiator after the task management 
response. 

If the connection is still active (it is not undergoing an implicit or 
explicit logout), ABORT TASK MUST be issued on the same connection to 
which the task to be aborted is allegiant at the time the Task Manage-ment 
Request is issued. If the connection is being implicitly or explicitly 
logged out (i.e., no other request will be issued on the failing 
connection and no other response will be received on the fail-ing 
connection), then an ABORT TASK function request may be issued on another 
connection. This Task Management request will then establish a new 
allegiance for the command to be aborted as well as abort it (i.e., the 
task to be aborted will not have to be retried or reas-signed, and its 
status, if issued, but not acknowledged will be reis-sued). For the 
LOGICAL UNIT RESET function, the target MUST behave as dictated by the 
Logical Unit Reset function in [SAM2]. 

The TARGET RESET function (WARM and COLD) implementation is OPTIONAL and 
when implemented, should act as described below. Target Reset MAY also be 
subject to SCSI access controls for the requesting initiator. When not 
implemented or when authorization fails at target, Target Reset functions 
should end as if the function was executed success-fully and the response 
qualifier will detail what was executed.

For the TARGET WARM RESET and TARGET COLD RESET functions, the target 
cancels all pending operations. Both functions are equivalent to the 
Target Reset function specified by [SAM2]. They can affect many other 
initiators.
 
In addition, for the TARGET COLD RESET, the target MUST then terminate all 
of its TCP connections to all initiators (all sessions are termi-nated). 
 
For the TASK REASSIGN function, the target should reassign the connec-tion 
allegiance to this new connection (and thus resume iSCSI exchanges for the 
task). TASK REASSIGN MUST be received by the target ONLY after the 
connection on which the command was previously execut-ing has been 
successfully logged-out. For additional usage semantics see Section 7.1 
Retry and Reassign in Recovery.

TASK REASSIGN MUST be issued as an immediate command.

LUN
This field is required for functions that address a specific LU (ABORT 
TASK, CLEAR TASK SET, ABORT TASK SET, CLEAR ACA, LOGICAL UNIT RESET) and 
is reserved in all others.

Referenced Task Tag 
The Initiator Task Tag of the task to be aborted or reassigned.

RefCmdSN or ExpDataSN
For ABORT TASK, the task CmdSN to enable task removal. If RefCmdSN does 
not match the CmdSN of the command to be aborted at the target,
the abort action MUST NOT be performed and the response MUST be func-tion 
rejected.

If the function is TASK REASSIGN, which establishes a new connection 
allegiance for a previously issued Read or Bidirectional command, this 
field will contain the next consecutive input DataSN number expected by 
the initiator (no gaps) for the referenced command in a previous 
execution.

Otherwise, this field is reserved.

Task Management Function Response

Byte /    0       |       1       |       2       |       3       |
   /              |               |               |               |
  |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|
  +---------------+---------------+---------------+---------------+
 0|0|1| 0x22      |1| Reserved    | Response      | Qualifier     |
  +---------------+---------------+---------------+---------------+
 4/ Reserved                                                      /
  /                                                               /
  +---------------+---------------+---------------+---------------+
16| Initiator Task Tag                                            |
  +---------------+---------------+---------------+---------------+
20| Referenced Task Tag or 0xffffffff                             |
  +---------------+---------------+---------------+---------------+
24| StatSN                                                        |
  +---------------+---------------+---------------+---------------+
28| ExpCmdSN                                                      |
  +---------------+---------------+---------------+---------------+
32| MaxCmdSN                                                      |
  +---------------+---------------+---------------+---------------+
36/ Reserved                                                      /
 +/                                                               /
  +---------------+---------------+---------------+---------------+
48| Digest (if any)                                               |
  +---------------------------------------------------------------+

For the functions ABORT TASK, ABORT TASK SET, CLEAR ACA, CLEAR TASK SET, 
LOGICAL UNIT RESET, and TARGET WARM RESET, the target performs the 
requested Task Management function and sends a Task Management Response 
back to the initiator. 

Response and Qualifier
The target provides a Response, which may take on the following val-ues:

0 - Function Complete
1 - Task specified in the Referenced Task Tag field was not in task set.
2 - LUN does not exist.
3 - Task still allegiant.
4 - Task failover not supported.
5 - Task management function not supported.
255   Function Rejected

All other values are reserved.

The Qualifier field provides additional information about the Response.

For a Response of "Function Complete" the valid Qualifiers are:

0 - Function Executed
1 - Not Authorized

For a discussion on usage of response codes 3 and 4, see Section 7.1.2 
Allegiance Reassignment.

For the TARGET COLD RESET and TARGET WARM RESET functions, the target 
cancels all pending operations.  For the TARGET COLD RESET function, the 
target MUST then close all of its TCP connections to all initia-tors 
(terminates all sessions).

The mapping of the response code into a SCSI service response code, if 
needed, is outside the scope of this document. 

The response to ABORT TASK SET and CLEAR TASK SET MUST be issued by the 
target only after all the commands affected have been received by the 
target the corresponding task management functions functions have been 
executed by the SCSI target and the delivery of all previous responses has 
been confirmed (acknowledged through ExpStatSN) by the initiator on all 
connections of this session.

Referenced Task Tag 
If the Request was ABORT TASK and the Response is "task not found", THE 
Referenced Task Tag contains the Initiator Task Tag of the task that had 
to be aborted. In other cases, it MUST be set to 0xffffffff. 

Your comments please.

Julo

---

From: Eddy Quicksall <[email-masked]>
Date: Mon, 31 Dec 2001 15:24:32 -0500

For ABORT TASK, the task CmdSN to enable task removal.
 
I assume "the CmdSN to enable task removal" is the CmdSN of the command
corresponding to the "Referenced Task Tag" and not some other concept that I
missed.
 
Is that correct?
 
Eddy
 
-----Original Message-----
From: Julian Satran [mailto:[email-masked]]
Sent: Monday, December 31, 2001 10:30 AM
To: [email-masked]
Subject: iSCSI - last change for 2001!

Dear colleagues, 

According to the agreement reached in SLC here is the new text for the Task
Management Request/Response (with all synchronization functions delegated to
the target). The impementer's notes - subsection 4 is out. 

Function 
The Task Management functions provide an initiator with a way to explicitly
control the execution of one or more Tasks (SCSI and iSCSI tasks). The Task
Management functions are listed below. For a more detailed description of
SCSI task management, see [SAM2]. 

5    LOGICAL UNIT RESET 

6    TARGET WARM RESET 

7                    TARGET COLD RESET 

8    TASK REASSIGN - reassigns connection allegiance for the task identified
by the Initiator Task Tag field on this con-nection, thus resuming the iSCSI
exchanges for the task. 

For all these functions, if executed, the Task Management Function Response
MUST be returned using the Initiator Task Tag to identify the operation for
which it is responding. All these functions apply to the referenced tasks
regardless of whether they are proper SCSI tasks or tagged iSCSI operations.
Task management commands must be executed as if all the commands having a
CmdSN lower or equal to the task manage-ment CmdSN have been received by the
target (i.e., have to be executed as if received for ordered delivery even
when marked for immediate delivery).  For all the tasks covered by the task
management response (i.e., with CmdSN not higher than the task management
command CmdSN), additional responses MUST NOT be delivered to the SCSI layer
after the task management response. The iSCSI initiator MAY deliver to the
SCSI layer all responses received before the task management response (i.e.,
it is a matter of implementation i! f ! the SCSI responses received before
the task mangement response but after the task management request are
delivered to the SCSI layer by the iSCSI layer in the ini-tiator). The iSCSI
target MUST ensure that no responses for the tasks covered by a task
management function are delivered to the iSCSI ini-tiator after the task
management response. 

If the connection is still active (it is not undergoing an implicit or
explicit logout), ABORT TASK MUST be issued on the same connection to which
the task to be aborted is allegiant at the time the Task Manage-ment Request
is issued. If the connection is being implicitly or explicitly logged out
(i.e., no other request will be issued on the failing connection and no
other response will be received on the fail-ing connection), then an ABORT
TASK function request may be issued on another connection. This Task
Management request will then establish a new allegiance for the command to
be aborted as well as abort it (i.e., the task to be aborted will not have
to be retried or reas-signed, and its status, if issued, but not
acknowledged will be reis-sued). For the LOGICAL UNIT RESET function, the
target MUST behave as dictated by the Logical Unit Reset function in [SAM2].

For the TARGET WARM RESET and TARGET COLD RESET functions, the target
cancels all pending operations. Both functions are equivalent to the Target
Reset function specified by [SAM2]. They can affect many other initiators. 

LUN 
This field is required for functions that address a specific LU (ABORT TASK,
CLEAR TASK SET, ABORT TASK SET, CLEAR ACA, LOGICAL UNIT RESET) and is
reserved in all others. 

Referenced Task Tag 

RefCmdSN or ExpDataSN 
For ABORT TASK, the task CmdSN to enable task removal. If RefCmdSN does not
match the CmdSN of the command to be aborted at the target, 
the abort action MUST NOT be performed and the response MUST be func-tion
rejected. 

If the function is TASK REASSIGN, which establishes a new connection
allegiance for a previously issued Read or Bidirectional command, this field
will contain the next consecutive input DataSN number expected by the
initiator (no gaps) for the referenced command in a previous execution. 

Byte /    0       |       1       |       2       |       3       | 
   /              |               |               |               | 

For the functions ABORT TASK, ABORT TASK SET, CLEAR ACA, CLEAR TASK SET,
LOGICAL UNIT RESET, and TARGET WARM RESET, the target performs the requested
Task Management function and sends a Task Management Response back to the
initiator. 

Response and Qualifier 

0 - Function Complete 

0 - Function Executed 
1 - Not Authorized 

The response to ABORT TASK SET and CLEAR TASK SET MUST be issued by the
target only after all the commands affected have been received by the target
the corresponding task management functions functions have been executed by
the SCSI target and the delivery of all previous responses has been
confirmed (acknowledged through ExpStatSN) by the initiator on all
connections of this session. 

Referenced Task Tag 
If the Request was ABORT TASK and the Response is "task not found", THE
Referenced Task Tag contains the Initiator Task Tag of the task that had to
be aborted. In other cases, it MUST be set to 0xffffffff. 

Your comments please. 

Julo