scsi protocol

37
1 confidential Agenda: SCSI Domain SCSI Bus Phases SCSI Commands SCSI Conditions

Upload: rakesh

Post on 17-Dec-2014

418 views

Category:

Technology


6 download

DESCRIPTION

 

TRANSCRIPT

Page 1: SCSI Protocol

1confidential

Agenda:

SCSI Domain

SCSI Bus Phases

SCSI Commands

SCSI Conditions

Page 2: SCSI Protocol

2confidential

SCSI-2 SCSI-3

I/O Process Task

Queue Task Set

Abort Tag Abort Task

Abort Abort Task Set

Bus Device Reset

Target Reset

Page 3: SCSI Protocol

3confidential

SCSI Standards

Device Specific Command SetsTransportProtocolPhysicalInterface

Shared Command SetArchitectural Model

Page 4: SCSI Protocol

4confidential

Page 5: SCSI Protocol

5confidential

Protocol Service Model

Page 6: SCSI Protocol

6confidential

Initiator & TargetHost Adapter

Main Memory

Host CPU

Peripheral Controller

Initiator TargetSCSI Bus

Logical Units

0 1 2 3 62

63

Host Computer

Host Adapter 0 1 2 3

62

63

Peripheral Controller

Target

Logical Units

0 1 2 362

63

Peripheral Controller

Target

Logical Units

Initiator

Host Computer

Host Adapter 0 1 2 3

62

63

Peripheral Controller

Target

Logical Units

0 1 2 362

63

Peripheral Controller

Target

Logical Units

Host Adapter

Host Computer

Initiator

Initiator

Page 7: SCSI Protocol

7confidential

SCSI Bus Model Analogy

Terry“5”

Tony“1”

Tina“0”

Larry“0”

Lin“3”

Lolly“2”

Lisa“0”

Lilly“0”

Irene“7”

Ian“6”

[Initiators]

[SCSI Bus]

[Targets]

[Logical Units]

Page 8: SCSI Protocol

8confidential

SCSI Parallel Bus Signals 50 Pin Bus (Narrow), 68 Pin Bus (Wide)

DB(0-7,P1) I/T 8 Bit Data Bus with Odd ParityDB(8-15, P2) I/T 2nd 8 Bit Data Bus with Odd Parity (Wide Only)

REQuest T Asking for data byte to be sent/on busACKnowledge I Indicates data byte on bus/read byte

ATtentionN I Indicates pending message for targetSELect I/T Indicates Selection/Reselection in progressBuSY I/T Indicates SCSI Bus in useReSeT I Resets all SCSI devices

MeSsaGe T Indicates Message ByteCmd/Data T Indicates Command/Msg or DataIn/Out T Indicates Data Direction

Page 9: SCSI Protocol

9confidential

Communication on the SCSI bus is allowed between only two SCSI devices at any given time

When two SCSI devices communicate on the SCSI bus, one acts as an initiator and the other acts as a target.

Initiator originates an operation and the target performs the operation.

Each SCSI device has an SCSI ID bit assigned. When a device is initialized, SCSI allows for automatic assignment of device IDs on the bus, which prevents two or more devices from using the same SCSI ID.

.

                                                           

Bus SCSI ID PriorityNarrow 7, 6, 5, 4, 3, 2, 1, 0Wide 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8

Page 10: SCSI Protocol

10confidential

SCSI Domain

Page 11: SCSI Protocol

11confidential

SCSI Domain

Page 12: SCSI Protocol

12confidential

SCSI Bus Phases

BUS FREE phase

ARBITRATION phase

SELECTION phase

RESELECTION phase

COMMAND phase

DATA phase

STATUS phase

MESSAGE phase

Devices use this layer to recognize that the bus is available.

Initiators or Targets use this layer to resolve bus contention.

Initiators use this layer to select the targets to start an I/O process(O)

This phase instructs the target what operation to perform(O).This protocol layer transfers data to or from the device.This protocol layer gives an update of the status of the operation(O)

Targets use this layer to inform initiators to transmit a message.

Page 13: SCSI Protocol

13confidential

SCSI Bus Phases – Flow Chart

Bus Free

Status

Message Out

Arbitration

Selection Command

Data In or Data Out

Message In

Reselection

Waiting Phase Bus Control Phase

Information Xfer Phase

Page 14: SCSI Protocol

14confidential

SCSI Trace

Bus State

Absolute Timings.mmm_uuu_nnn

Bus Phase Transpired I - TData Bus

single values represent SCSI ID's, otherwise values are in hex bytes

Event

1 00.000_000_000 Bus Free Detected     0000

2 26.032_853_700 Arbitration Start   7 0001

2 26.032_856_100 Arb_win 7 0002

2 26.033_514_100 (Atn Assertion) ATN 0003

2 26.033_521_700 Selection Start I → T 7 4 ATN 0004

2 26.033_522_600 Selection Complete I → T ATN 0005

2 26.034_161_850 I → T (Atn Negation) ATN 0006

2 26.034_833_950 Message Out I → T C0h 0007

2 26.039_035_750 Command Out I → T 08 00 01 00 01 00 0008

3 26.055_860_800 Data In I ← T 00 00 00 00 00 00 0009

3 26.055_862_300 I ← T 00 00 00 00 00 00 0010

3 26.056_494_450   I ← T 00 00 00 00 0011

4 26.056_894_350 Status In I ← T 00 0012

4 26.057_852_350 Message In I ← T 00 0013

1 26.058_426_300 Bus Free Detected     0014

Legend:

1 No One Using Bus

2 Protocol to access peripheral and start process3 Transfer data4 Protocol to complete process

Page 15: SCSI Protocol

15confidential

SCSI Domain

Page 16: SCSI Protocol

16confidential

SCSI Initiator

Page 17: SCSI Protocol

17confidential

SCSI Target

Page 18: SCSI Protocol

18confidential

Logical Unit

Are a physical/virtual peripherial device addressable through a traget.

Are the basic addressable unit on a target. Have a default number of zero. Must be sequentially numbered if there are more than one. Max 8 Lus(64) per target controller in SCSI-2(SCSI-3). One or more LU names A Device Server A Task Manager One or more Task Sets each of which may contain zero or more

untagged tasks or a combination of zero or more tagged tasks and zero or more untagged tasks.

Page 19: SCSI Protocol

19confidential

SCSI Nexus

Page 20: SCSI Protocol

20confidential

SCSI Task Attributes

Page 21: SCSI Protocol

21confidential

SCSI Initiator & Target

Initiator ID

Target ID LUNInitiator ID

SCSI ID/SAS Addr/N_PortID SCSI ID/SAS Addr/N_PortID

Page 22: SCSI Protocol

22confidential

Protocol Services

Page 23: SCSI Protocol

23confidential

SCSI - No Data Xfer Commands

Page 24: SCSI Protocol

24confidential

SCSI – Data Xfer Commands

Page 25: SCSI Protocol

25confidential

SCSI CDBA command is executed by sending a Command Descriptor Block(CDB) to the Target.

For each CDB: The first byte of the CDB is the Operation Code. The last byte of the CDB is the Control Byte. The format of the Operation Code and Control Byte is identical for

every SCSI Command is the SCSI Universe. CDBs come in various sizes, typically 6, 10, 12, or 16 bytes total. 

Where to begin the operation

How many blocks

What command

10-byte READ command.  This command, if successful, will move one block (512 bytes) of

data to the host computer system, from logical block address 100h (hex).

NACA, Linked

Page 26: SCSI Protocol

26confidential

SCSI Status Byte

Hex Status

00 GOOD

02 CHECK CONDITION

04 CONDITION MET

08 BUSY

10 INTERMEDIATE

14 INTERMEDIATE-CON MET

18 RESERVATION CONFLICT

28 TASK SET FULL

30 ACA ACTIVE

Any time a SCSI command is sent to a Target The Initiator expect a completion

Status This status can reflect successful

or un successful completion of the command.

Sent during Status Phase, prior to Command Complete Message, to indicate success or failure of the command sequence

Page 27: SCSI Protocol

27confidential

SCSI Sense Data

A special data packet specifying error status and location(s)

Separate copy maintained by Target for each Initiator

Retrieved by Request Sense command

Must be retrieved immediately after a CHECK CONDITION, or sense data is lost

All queued commands are suspended after CHECK CONDITION,

until Sense Data is retrieved (Contingent Allegiance)

Page 28: SCSI Protocol

28confidential

SCSI Sense Data Format SENSE KEYS

00 No Sense

01 Recovered Error

02 Not Ready

03 Medium Error

04 Hardware Error

05 Illegal Request

06 Unit Attention

07 Data Protect

08 Blank Check

09 Vendor Specific

0A Copy Abort

0B Aborted Cmd

0C Obsolete

0D Vol OverFlow

0E Miscompare

0F Reserved

Event Description: Unexpected sense: PD 04(e0xfc/s4) Path 4433221107000000, CDB: a1 08 0b d0 00 00 4f c2 00 b0 00 ff, Sense: 5/24/00

Sense key

ASC

ASCQ

Page 29: SCSI Protocol

29confidential

Message System

The message system allows communication between an I and T for the purpose of INTERFACE management.

Messages are xfered during MESSAGE IN and MESSAGE OUT phases.

One or more messages may be sent during a single MESSAGE phase, but a message may not be split between multiple MESSAGE phases.

The first msg byte after SELECTION phase shall be an IDENTIFY, ABORT, or BUS DEVICE RESET msg. If T receives any other msg then bus will go to BUS FREE state.

The IDENTIFY msg establishes a logical connection, or nexus between the I and the specified LU, I_T_L nexus, within the target.

06h - ABORT 0Dh - ABORT TAG 24h - ACA QUEUE TAG OCh - BUS DEVICE RESET 16h - CLEAR ACA 0Eh - CLEAR QUEUE 00h - COMMAND COMPLETES

Page 30: SCSI Protocol

30confidential

SCSI Task Management Functions

Abort Task : Abort the specific task(ITLQ or ITL).

Abort Task Set : Abort all tasks for the issuing initiator(ITL).

Clear Task Set : Abort all tasks for the issuing initiator(TL).

Target Reset : Resets the specific target. All tasks in all the logical units are reset and Unit Attention is set.

Logical Unit Reset : Reset the logical unit. All tasks in the specified logical unit are reset and Unit Attention is set.

Clear ACA: Clears ACA condition at the specified logical unit.

Because SCSI Task management functions are not commands, the request is not sent by using a CDB and the response is not indicated by SCSI status.

Page 31: SCSI Protocol

31confidential

Contingent Allegiance Condition (CAC)A Contingent Allegiance Condition is:  a Condition (state) that is Contingent (dependent) upon the Allegiance (connection) between two entities, or components, in a SCSI-based system.

1. Make a connection (establish a Nexus)2. Issue a command (from initiator to target)3. Process the command (Target moves data to or from storage, if

needed)4. Receive GOOD status (00h code)5. Close the connection (Nexus “goes away”)

What if we do not get GOOD status?When something goes wrong, then you do NOT receive GOOD status – you most often get back a CHECK CONDITION status (02h code) from the target.  This is how the initiator is informed that an error occurred.

Page 32: SCSI Protocol

32confidential

SAM Error Recovery

NACANormal Auto Contingent Allegiance

=0

=1

CAC Contingent Allegiance Condition

ACAC Auto Contingent Allegiance Condition

Page 33: SCSI Protocol

33confidential

Contingent Allegiance Condition(SCSI-2)

Initiator 7

Initiator 6

Initiator n

Target xLogical Unit 0

76543210

Ian asked Tom to get a file from Larry, but Larry can’t find it. Tom must inform Ian that the request has a CAC by returning a CC (02H) code during the STATUS IN phase. Then Tom will set an internal CAC flag (per LUN)associated with Ian’s SCSI ID and preserve it until it is cleared by Ian.

CAC shall be preserved for I_T_L nexus untill it is cleared. a hard reset condition an ABORT message a BUS DEVICE RESET message any subsequent commands for the I_T_L nexus, mostly

command will be REQUEST SENSE

Logical Unit 1

76543210

Logical Unit n

76543210

Page 34: SCSI Protocol

34confidential

Auto Contingent Allegiance Condition (SCSI-3)

The ACA (NACA=1) condition shall exist within the task set when the logical unit completes a command by returning a CHECK CONDITION status. Task set boundary. Preserved untill it is cleared. Sense data shall be returned using the “Autosense” feature.

Page 35: SCSI Protocol

35confidential

Reset Condition

Logical Unit Reset

Response toa) LOGICAL UNIT RESET task management requestb) any logical unit reset event (ex: target hard reset)

1) Abort all tasks in the task set.2) Clear -- ACA(NACA=1 i.e SCSI-3 ) or Contingent Allegiance(NACA=0 i.e SCSI-2)3) Clear -- Disk Reservation4) Data Xfer mode  -- default async5) Mode parameters -- restore last saved values6) Unit Attention -- UA condition shall be set for all other devices.

Page 36: SCSI Protocol

36confidential

Unit Attention Condition

Reports to I that operating mode of the T has changed from the last cmd sent to the T.Reported on all SCSI cmds except INQURY.Cmd it is reported with is not executed.

Each LU shall generated a UA condition, for each I, whenever the LU has been reset by:

1. a hard reset condition2. by a power-on reset.3. or a BUS DEVICE RESET message

LU shall also generate a UA condition for each I whenever one of the following

events occurs:1. A removable medium may have been changed.2. The mode parameters in effect for this I have been changed by another initiator.3. The level or version of microcode has changed.4. Tagged commands queued for the I were cleared by another I.5. INQURY data has been changed.6. The LU inventory has been changed.7. A removable medium may have been changed.8. The mode parameters in effect for this I have been changed by another initiator.9. Tagged commands queued for this I were cleared by another I.10. The version or level of microcode has been changed.

Page 37: SCSI Protocol

37confidential

Do u want to initiate a

Task ?