說明:這一部分主要是工作中的需要而所寫的,源於個人的理解,主要是用於記錄便於以後自己的深化。
SCSI Primary Commands - 4 (SPC-4)中我主要關注的是通訊中使用的命令,即第六章所定義的命令。
為什麼要介紹這倆個命令?因為這倆個命令在資料的控制和資料資訊的擷取中常常被使用。理解了此命令能更好的理解協議,能更好的處理常式的命令的解析過程、
1:RECEIVE DIAGNOSTIC 和 SEND DIAGNOSTIC概述
其用以定義為:
The RECEIVE DIAGNOSTIC RESULTS command (see table 224) requests that data be sent to the application
client Data-In Buffer. The data is either data based on the most recent SEND DIAGNOSTIC command (see 6.32)
or is a diagnostic page specified by the PAGE CODE field.主要用來接收element的status 資訊,讀請求。
The SEND DIAGNOSTIC command (see table 266) requests the device server to perform diagnostic operations on
the SCSI target device, on the logical unit, or on both. Logical units that support this command shall implement, at
a minimum。主要用來對控制對elements進行控制,寫操作。
主要是請求或控制page code所定義的資料報文,此處的page code包括如下:
page code在 01h to 2h 範圍內所定義的page code,是在"SCSI Enclosure Services - 3 (SES-3)"中定義的,ses中主要是用來對enclosure進行管理的,
包括enclosure本身和自身所包含的各種elements,命令定義可以參見ses3中的第6章。elemes的定義可參見ses中的第7章 Element definitions。
Supported Diagnostic Pages所定義的表示:
定義其使用說明。
This clause defines the diagnostic page structure and the diagnostic pages that are applicable to enclosure services devices and other device types that provide communications access to an enclosure services process. Control pages are accessed with the SEND
DIAGNOSTIC command. Status pages are accessed with the RECEIVE DIAGNOSTIC RESULTS command.The diagnostic page format is specified in SPC-4. All diagnostic pages have the diagnostic page header defined in SPC-4, including the PAGE CODE and PAGE LENGTH fields.
無論是spc還是ses中的命令都是用來在target和initiator之間資料同,其實target和initiator的定義也比較抽象,我個人理解還不是很透徹。
同時從上面的定義可以看處,ses中定義的命令的頭部定義在spc中,即send diagnostic和receive diagnostic的資料包中包含中ses中的定義的命名格式。
在進行命令處理的時候,我們收到SPL(SAS Protocol Layer (SPL)) 第8章Transport layer所定義的SSP frame format格式之後,對相應的欄位進行解析之後,最後就會處理到
send diagnostic 和receive diagnostic 對應的OPERATION CODE(1DH和1CH),send diagnostic和receive diagnostic根據框架格式中的page code來判斷是Status pages 還是Control pages ,即從initiator擷取資料資訊還是向initiator發送控制資訊。
2: SPC命令之 send diagnostic
其實這個send diagnostic命令有點複雜,在資訊的控制方面,不是顯而易見的。即有不確定性,根據具體的參數不同就形成了不同的命令解析及處理方式。
主要是請求服務,在target上面執行diagnostic操作,用於發送控制命名。對target中的elements進行控制、
3: SPC命令之 receive diagnostic
上面的圖中:A page code valid (PCV) bit set to one specifies that the device server return the diagnostic page specified in the PAGE CODE field。及pcv等於1,target將返回
page code 對於的資料項目。