Date: Aug 23, 1993 X3T9.2/92-141 Rev 8 To: X3T9.2 Committee (SCSI) From: George Penokie (IBM) Subject: SCSI-3 Queuing Model 0.0 Queue A list of tasks that have not completed. 0.1 Suspended Information Information stored within a logical unit that is not available to any pending Tasks. Task Management Functions shall not be suspended. 0.2 SCSI Device Anything that is connected to a SCSI physical transport system and supports the SCSI protocol. 0.3 Logical Unit An addressable entity within a target that implements a device model. 0.4 Completion The response that a task has ended. The actual events that indicate completion are protocol specific. 0.5 Task Set Zero or more Tasks that have not completed that are grouped so that their interaction is dependent on the rules for task management and Auto Contingent Allegiance. 1. Task Management 1.1 Task Set Management A target that can accept more than one Task is capable of queuing. The number of Tasks that may exist in a task set is vendor specific. The target shall manage all the Tasks from all initiators on all ports accepted for each logical unit as a single task set. Each task set shall be managed independent of all other task sets. The target shall allow tagged and untagged Tasks to be contained within a single task set. The target has the freedom to optimize the sequence of Task completion within a task set unless the initiator chooses to override the optimization. If an initiator requests the creation of more Tasks than can be managed by a target, each such request is rejected with a status of Queue Full. Several commands may be linked together to form a single Task. 1.2 Untagged Queueing Untagged queuing allows a target to accept one untagged Task at a time per task set from each Initiator. 1.3 Untagged Tasks Untagged Tasks shall be treated by the target as simple Tasks. 1.4 Tagged Queueing An initiator may have more than one Tagged Task within each task set under control of the target. 2. Exception Handling 2.1 Auto Contingent Allegiance Condition (ACA) The rules for handling exception conditions with Auto Contingent Allegiance shall only apply to SCSI devices that allow the ACA field in the CDB to be set to one. The Auto Contingent Allegiance Condition rules listed in the following clauses shall only apply when the ACA field is set one. If the ACA field is set to zero the SCSI-2 rules for handling exception conditions shall be used by the target. 2.1.1 Auto Contingent Allegiance Condition (ACA) The Auto Contingent Allegiance Condition shall exist within the task set when the target reports an error condition to the initiator through the successful transfer of a Check Condition or Command Terminated status. The Auto Contingent Allegiance Condition shall not cross task set boundaries and shall be preserved within the task set until it is cleared. If a condition that would create an Auto Contingent Allegiance Condition occurs during an Auto Contingent Allegiance Condition, the original Auto Contingent Allegiance Condition shall remain. Sense data shall be available for the new Auto Contingent Allegiance Condition per the rules in clause 2.1.2. Implementors Note: There are issues outside the scope of this standard that occur in multi-initiator systems that should be considered when error recovery is needed. 2.1.2 Response to Auto Contingent Allegiance Condition While the Auto Contingent Allegiance exists, the target shall only allow one ACA Task per task set. The target shall respond to any other Task that attempts to become the current task for that ACAed task set with an ACA Active status. The target shall not allow any Pending non-ACA Tasks within the task set to become current Tasks until the Auto Contingent Allegiance is cleared. If a Task becomes a current task because of a previous request for information that information shall be suspended until the ACA is cleared. 2.1.3 Auto Contingent Allegiance Processing Only one ACA Task at a time within a task set that has an Auto Contingent Allegiance Condition shall become a pending Task. All SCSI operations are permitted while processing an ACA Task. 2.1.3.1 Acquiring Sense Data The sense data for a task set shall be cleared after completion of the first command of an ACA Task for the task set which contains the Auto Contingent Allegiance Condition. 2.1.4 Clear Auto Contingent Allegiance Task Management Function The initiator invokes Clear Auto Contingent Allegiance Task Management Function to clear an auto contingent condition allegiance from the specified task set. The target shall clear the Auto Contingent Allegiance and complete the current Task on acceptance of this task management function. If the target accepts a Clear Auto Contingent Allegiance Task Management Function and no Auto Contingent Allegiance Condition is in effect for that initiator on that task set, then the target shall complete the current Task. If a Clear Auto Contingent Allegiance Task Management Function occurs when an ACA Task is pending then the ACA Task shall be aborted and the auto contingent allegiance shall be cleared. 2.1.5 Clearing Auto Contingent Allegiance Condition (ACA) The Auto Contingent Allegiance Condition shall be cleared after: -a power on condition, -a Clear Auto Contingent Allegiance Task Management request issued to the logical unit by the initiator receiving the Check Condition or Command Terminated status error. -a Target Reset Task Management request The Auto Contingent Allegiance shall not be cleared for any reason other than those listed above. After the target clears an Auto Contingent Allegiance any Pending Task within the task set may become a Current Task, subject to the ordering rules. 2.2 Duplicate Tag Handling When issuing a tagged task the initiator shall not reuse the tag to create a new task until: -A service response of Command Complete is received with a status other than INTERMEDIATE or INTERMEDIATE-CONDITION MET. -A service response of Service Delivery or Target Failure is received. In this case, system implementations shall guarantee that the task associated with that command has been terminated. -A power on condition occurs. -A Target Reset Task Management request occurs. -An Abort Task Management request occurs. -An Abort Task Set Management request occurs. -A Clear Task Set Management request occurs. -A unit attention of TASKS CLEARED BY ANOTHER INITIATOR is reported. -A unit attention of POWER ON, RESET or TARGET RESET is reported. If a Task has a duplicate task an error condition shall be created for the task set with a key of Illegal Request, an ASC of Tagged Overlapped Tasks, and an ASCQ that contains the value of the queue tag of the duplicate tag. If the tag value is greater than FFh then an ASC of Overlapped Commands Attempted shall be used. The target shall abort all Tasks within the task set for the Initiator that sent the duplicate task. The target shall create a single error condition for that initiator regardless of how many Tasks are aborted. 3. Current Task 3.1 Current Task A Current Task is a Task that has information being sent or accepted on a physical transport system. - More than one Current Task may exist at a time on a physical transport system(e.g. multiport systems). - A SCSI device on a physical transport system may have a Current Task that is not the same Current Task as another SCSI device on the same physical transport system. - A SCSI device may simultaneously send information for one or more Tasks and accept information for one or more Tasks. 4. Pending Task A Task that is not a Current Task and has not yet completed. 5. Simple Task When a task is a Simple Task and a task set only contains Simple Tasks, then any Simple Task may become a Current Task at any time, depending on the setting of queue algorithm mode as specified in the control mode page. Additional requirements for managing simple tasks are found in clauses 6, 7, and 8. 6. Ordered Task When a Task is an Ordered Task any information the target has or accepts for the Ordered Task shall be suspended and the Ordered Task shall not complete until all Simple and Ordered Tasks that were accepted into the task set before the Ordered Task have completed. If Simple or Ordered Tasks are accepted into the task set after an Ordered Task the target shall suspend any information accepted for the new Task and shall not complete any of the new Tasks before the Ordered Task completes. Additional requirements for managing ordered tasks are found in clauses 7 and 8. 7. Head Of Queue Task When a Task is a Head Of Queue Task the target shall suspend any information accepted for any simple or ordered tasks accepted into the task set after the Head Of Queue Task. The target shall not complete any of the new simple or ordered tasks before the most recent Head Of Queue Task completes. Any Task that was accepted into the task set before a Head Of Queue Task may complete before the Head Of Queue Task completes. Additional requirements for managing ordered tasks are found in clause 8. 8. ACA Task An ACA Task is a task identified as being a response to an ACA condition. An ACA Task is not associated with the Task that caused an Auto Contingent Allegiance Condition. The ACA Task shall complete before any other Tasks within the task set. If an ACA Task is accepted for a task set that does not have an Auto Contingent Allegiance Condition the target shall return a Check Condition status with a sense key of Illegal Request and an additional sense code of Invalid Message Error. 9. Task Ordering Boundaries A Task ordering boundary defines the scope over which a group of simple Tasks within a task set may be reordered. Table 1 shows how task sets are managed in a target with three logical units (i.e. task sets) attached to three initiators. Table 1 - Per logical unit ordering boundaries ------------ ------------ ------------ | L U N 0 | | L U N 1 | | L U N 2 | ------------ ------------ ------------ ******************* ******************* ******************* ----------I1L0H---- * | | | | * * | | | | * * | | | | * ----I3L1H---------- * | | | | * * | | | | * * | | | | * ----I2L2H---------- *I1L0S | | | * * | | | | * * | | | | * * | I2L0S| | * * | | | | * * | | | | * ------------|I3L0O- * | | | | * * | | | | * * | | | | * * | | | I3L1S* * | | | | * * | | | | * * | |I2L1S | * * | | | | * * | | | | * *I1L1S| | | * * | | | | * * | | | | * * | | | | * * | |I2L2S | * * | | | | * * | | | | * * | | | I3L2S* * | | | | * * | | | | * *I1L2S| | | * ------------|I3L0O- * | | | | * * | | | | * * | | | | * ------|I2L1O------- * | | | | * *I1L0S | | | * * | | | | * * | | | | * * | | | | * * | | | I3L1S* * | | | | * * | I2L0S| | * * | | | | * * | | | | * * | | | | * * | | | | * * | |I2L2S | * * | | | | * * | | | | * *I1L2S| | | * * | | | | * *I1L1S| | | * * | | | | * * | | | | * * | | | | * ------|------I3L2O- -------I2L0O|------ * | | | | * * | | | | * * | I2L0S| | * * | | | | * * | | | | * * | | | | * *I1L1S| | | * * | | | | * * | | | | * -I1L1O|------------ * | | | | * * | | | | * *I1L1S| | | * * | | | | * * | | | | * * | | | | * * | | | I3L2S* * | | | | * * | | | | * * | | | I3L2S* * | | | | * ------|------I3L1O- * | | | | * *I1L0S | | | * * | | | | * * | | | | * ************|****** ******|************ ******|************ I1L0H-- | | |I2L2H --------------- ---------------------I3L1H ------------------------------------------------------- | T A R G E T | ------------------------------------------------------- ------------ ------------ ------------ |INITIATOR1| |INITIATOR2| |INITIATOR3| ------------ ------------ ------------ ***** * * - Task Set Boundary ***** ----- - Ordered Task Blocking Boundary 10. New ASC/ASCQ code BYTE 12 13 DTLPWRSOMC DESCRIPTION -- -- -------------------------- 4D NN DTLPWRSOMC Tagged Overlapped Tasks (NN = Queue Tag) 13. New Status code Code Description ---- ----------- 30h Auto Contingent Allegiance Active AUTO CONTINGENT ALLEGIANCE ACTIVE. This status shall be returned when an Auto Contingent Allegiance exists and an initiator issues a command while one or more or the following conditions are true: -There is another Auto Contingent Allegiance task in the task set or -The initiator issuing the command did not cause the Auto Contingent Allegiance condition. Appendix A - Ordering Boundaries A.1. Ordering Boundary Disclaimer This appendix recognizes that there are other ways to order boundaries than the one chosen by the Standards Committee. Described below are four different ordering boundaries. Any of these ordering boundaries could be implemented by a SCSI device using the rules for task sets as defined throughout this standard. The standard, however, requires that SCSI devices use the per logical unit ordering boundary. A.2 Per Initiator/Logical Unit Ordering Boundaries When the ordering boundary is per initiator/logical unit the target manages all the Tasks accepted from a initiator/logical unit combination on all ports as a single task set. Each task set of Tasks shall be independent of all other task sets. Table 2 - Per initiator/logical unit ordering boundaries ------------ ------------ ------------ | L U N 0 | | L U N 1 | | L U N 2 | ------------ ------------ ------------ ******** ******* ******* ******* ******* ******** ******* ******** ******* -I1L0H-- * | * * | * * | * * | * *| | * * | * *| | * * | * *| | * * | * * | * * | * * | * -I3L1H-- * | * *| | * * | * *| | * * | * * | * * | * * | * *| | * * | * -I2L2H-- * | * *|I1L0S* * | * * | * * | * * | * *| | * * | * *| | * * | * *| | * *I2L0S* * | * * | * * | * *| | * * | * *| | * * | * *| | * * | * -I3L0O- * | * * | * *| | * * | * *| | * * | * *| | * * | * * | * * | * * | * *|I3L1S* * | * *| | * * | * *| | * * | * * | * * | * *I2L1S* *| | * * | * *| | * * | * *| | * * | * * | * *I1L1S* * | * *| | * * | * *| | * * | * *| | * * | * * | * * | * * | * *| | * * | * *|I2L2S* * | * *| | * * | * * | * * | * * | * *| | * * | * *| | * *I3L2S* *| | * * | * * | * * | * * | * *| | * *I1L2S* *| | * * | * *| | * * | * -I3L0O- * | * * | * *| | * * | * *| | * * | * *| | * * | * * | * * | * -I2L1O- *| | * * | * *| | * * | * *|I1L0S* * | * * | * * | * * | * *| | * * | * *| | * * | * *| | * * | * * | * * | * * | * *|I3L1S* * | * *| | * * | * *| | * *I2L0S* * | * * | * * | * *| | * * | * *| | * * | * *| | * * | * * | * * | * * | * *| | * * | * *|I2L2S* * | * *| | * * | * * | * * | * * | * *| | * *I1L2S* *| | * * | * *| | * * | * * | * *I1L1S* * | * *| | * * | * *| | * * | * *| | * * | * * | * * | * * | * *| | * * | * *| | * -I3L2O- *| | * -I2L0O- * | * * | * * | * *| | * * | * *| | * * | * *| | * *I2L0S* * | * * | * * | * *| | * * | * *| | * * | * *| | * * | * * | * *I1L1S* * | * *| | * * | * *| | * * | * *| | * * | * * | * -I1L1O- * | * *| | * * | * *| | * * | * *| | * * | * * | * *I1L1S* * | * *| | * * | * *| | * * | * *| | * * | * * | * * | * * | * *| | * * | * *| | * *I3L2S* *| | * * | * * | * * | * * | * *| | * * | * *| | * *I3L2S* *| | * * | * * | * * | * * | * -|I3L1O- * | * *| | * * | * *|I1L0S* * | * * | * * | * * | * *| | * * | * *| | * * | * *|****** ******* ******* ******* ******* *|****** ******* *|****** ******* ---- I1L0H | | ------I3L1H | I2L2H -------------------------- -------------------------------------------------------------------------- | T A R G E T | -------------------------------------------------------------------------- ------------ ------------ ------------ |INITIATOR1| |INITIATOR2| |INITIATOR3| ------------ ------------ ------------ ***** * * - Task Set Boundary ***** ----- - Ordered Blocking Boundary A.3 Per Target Ordering Boundaries When the ordering boundary is per target the target manages all the Tasks from all initiators on all ports as a single task set. Table 3 - Per target ordering boundaries ------------ ------------ ------------ | L U N 0 | | L U N 1 | | L U N 2 | ------------ ------------ ------------ ************************************************** ------|--------------------|-------------I3L1H---- ------|------------------I2L2H-------------|------ ----I1L0H------------------|---------------------- *I1L0S| | | | | | | | | | | * * | |I2L0S | | | | | | | | | * ------|-----I3L0O----------|---------------|------ * | | | | | | |I3L1S | | | | * * | | | | | I2L1S| | | | | | * * | | | | I1L1S | | | | | | | * * | | | | | | | | | I2L2S| | * * | | | | | | | | | | |I3L2S* * | | | | | | | | I1L2S | | | * ------|-----I3L0O----------|---------------|------ ------|---------------I2L1O|---------------|------ *I1L0S| | | | | | | | | | | * * | | | | | | |I3L1S | | | | * * | |I2L0S | | | | | | | | | * * | | | | | | | | | I2L2S| | * * | | | | | | | | I1L2S | | | * * | | | | I1L1S | | | | | | | * ------|--------------------|---------------|I3L2O- ------|I2L0O---------------|---------------|------ * | |I2L0S | | | | | | | | | * * | | | | I1L1S | | | | | | | * ------|----------I1L1O-----|---------------|------ * | | | | I1L1S | | | | | | | * * | | | | | | | | | | |I3L2S* * | | | | | | | | | | |I3L2S* ------|--------------------|I3L1O----------|------ *I1L0S| | | | | | | | | | | * ******|********************|***************|****** ----I1L0H | | I2L2H | I3L1H ---------------------------------------------------- | T A R G E T | ---------------------------------------------------- ------------ ------------ ------------ |INITIATOR1| |INITIATOR2| |INITIATOR3| ------------ ------------ ------------ ***** * * - Task Set Boundary ***** ----- - Ordered Blocking Boundary A.4 Per Initiator Ordering Boundaries The target manages all the Tasks from each initiator, on all ports, as a single task set. Each task set of Tasks shall be independent of all other task sets. Table 4 - Per initiator ordering boundaries ------------ ------------ ------------ | L U N 0 | | L U N 1 | | L U N 2 | ------------ ------------ ------------ ****************** ****************** ****************** ----I1L0H--------- * | | | | * * | | | | * * | | | | * ----I2L2H--------- * | | | | * * | | | | * * | | | | * ----I3L1H--------- *I1L0S| | | * * | | | | * * | | | | * * | | | | * *I2L0S| | | * * | | | | * * | | | | * * | | | | * -I3L0O------------ * | | | | * * | | | | * * | |I3L1S | * * | | | | * * | |I2L1S | * * | | | | * * | |I1L1S | * * | | | | * * | | | | * * | | | | * * | | | I2L2S* * | | | | * * | | | | * * | | | | * * | | | I3L2S* * | | | I1L2S* * | | | | * * | | | | * * | | | | * * | | | | * -I3L0O------------ * | | | | * -------I2L1O------ * | | | | * *I1L0S| | | * * | | | | * * | | | | * * | | | | * * | | | | * * | |I3L1S | * * | | | | * *I2L0S| | | * * | | | | * * | | | | * * | | | I2L2S* * | | | | * * | | | I1L2S* * | | | | * * | | | | * * | |I1L1S | * * | | | | * * | | | | * * | | | | * * | | | | * ------------I3L2O- * | | | | * -I2L0O------------ * | | | | * * | | | | * *I2L0S| | | * * | | | | * * | |I1L1S | * * | | | | * * | | | | * -------I1L1O------ * | | | | * * | | | | * * | |I1L1S | * * | | | | * * | | | | * * | | | | * * | | | | * * | | | I3L2S* * | | | | * * | | | | * * | | | I3L2S* * | | | | * * | | | | * -------I3L1O------ *I1L0S| | | * * | | | | * * | | | | * * | | | | * * | | | | * * | | | | * ******|*********** ******|*********** ******|*********** -I1L0H | | -I2L2H | -I3L1H ------------------------------------------------------- | T A R G E T | ------------------------------------------------------- ------------ ------------ ------------ |INITIATOR1| |INITIATOR2| |INITIATOR3| ------------ ------------ ------------ ***** * * - Task Set Boundary ***** ----- - Ordered Blocking Boundary