39 #ifndef _OCS_ISCSI_SPEC_H
40 #define _OCS_ISCSI_SPEC_H
43 #define ISCSI_ABORT_TASK (1) // Abort Task
44 #define ISCSI_ABORT_TASK_SET (2) // Abort task set
45 #define ISCSI_CLEAR_ACA (3) // Clear ACA
46 #define ISCSI_CLEAR_TASK_SET (4) // Clear task set
47 #define ISCSI_LUN_RESET (5) // Reset LUN
48 #define ISCSI_TARGET_WARM_RESET (6) // Target warm reset
49 #define ISCSI_TARGET_COLD_RESET (7) // Target cold reset
50 #define ISCSI_TASK_REASSIGN (8) // Task reassign
51 #define ISCSI_MAX_TMF_OPCODE (9) // Max opcode, always add befo
55 #define ISCSI_VERSION_MAX (0)
56 #define ISCSI_VERSION_MIN (0)
60 #define LOGIN_STAGE_NEGOTIATE_SECURITY (0)
61 #define LOGIN_STAGE_NEGOTIATE_OPERATIONAL (1)
62 #define LOGIN_STAGE_FULL_FEATURE (3)
66 #define ISCSI_CMD_NOOP (0)
67 #define ISCSI_CMD_CMD (1)
68 #define ISCSI_CMD_TASK (2)
69 #define ISCSI_CMD_LOGIN (3)
70 #define ISCSI_CMD_TEXT (4)
71 #define ISCSI_CMD_DATA_OUT (5)
72 #define ISCSI_CMD_LOGOUT (6)
73 #define ISCSI_CMD_SNACK (16)
77 #define ISCSI_RESP_NOOP (32)
78 #define ISCSI_RESP_RESP (33)
79 #define ISCSI_RESP_TASK (34)
80 #define ISCSI_RESP_LOGIN (35)
81 #define ISCSI_RESP_TEXT (36)
82 #define ISCSI_RESP_DATAIN (37)
83 #define ISCSI_RESP_LOGOUT (38)
84 #define ISCSI_RESP_R2T (49)
85 #define ISCSI_RESP_ASYNC (50)
86 #define ISCSI_RESP_REJECT (63)
90 #define ISCSI_UNTAGGED_TAG (0)
91 #define ISCSI_SIMPLE_TAG (1)
92 #define ISCSI_ORDERED_QUEUE_TAG (2)
93 #define ISCSI_HEAD_OF_QUEUE_TAG (3)
94 #define ISCSI_ACA_TAG (4)
98 #define ISCSI_RESERVED_TTT (4294967295)
102 #define ISCSI_STATUS_GOOD (0)
103 #define ISCSI_STATUS_CHECK (2)
104 #define ISCSI_STATUS_BUSY (8)
105 #define ISCSI_STATUS_RESERVATION_CONFLICT (24)
106 #define ISCSI_STATUS_TASKSET_FULL (40)
107 #define ISCSI_STATUS_ACA_ACTIVE (48)
108 #define ISCSI_STATUS_TASK_ABORTED (64)
113 #define ISCSI_RESPONSE_CMD_COMPLETED (0)
114 #define ISCSI_RESPONSE_TARGET_FAILURE (1)
118 #define ISCSI_REJECT_REASON_DATA_DIGEST_ERR (2)
119 #define ISCSI_REJECT_REASON_SNACK_REJECT (3)
120 #define ISCSI_REJECT_REASON_PROTOCOL_ERR (4)
121 #define ISCSI_REJECT_REASON_CMD_NOT_SUPPORTED (5)
122 #define ISCSI_REJECT_REASON_IMM_CMD_REJECT (6)
123 #define ISCSI_REJECT_REASON_TASK_IN_PROGRESS (7)
124 #define ISCSI_REJECT_REASON_INVALID_DATA_ACK (8)
125 #define ISCSI_REJECT_REASON_INVALID_PDU_FIELD (9)
126 #define ISCSI_REJECT_REASON_LONG_OPERATION (10)
127 #define ISCSI_REJECT_REASON_NEG_RESET (11)
128 #define ISCSI_REJECT_REASON_WAITING_FOR_LOGOUT (12)
132 #define ISCSI_MAXCONNECTIONS_DEFAULT (1)
133 #define ISCSI_DEFAULT_TIME2WAIT (2)
134 #define ISCSI_DEFAULT_TIME2RETAIN (20)
135 #define ISCSI_FIRSTBURSTSIZE_DEFAULT (8192)
136 #define ISCSI_MAXRXDATALENGTH_DEFAULT (8192)
137 #define ISCSI_MAXTXDATALENGTH_DEFAULT (8192)
138 #define ISCSI_MAXBURSTSIZE_DEFAULT (65536)
142 #define ISCSI_MAXCONNECTIONS_MIN (1)
143 #define ISCSI_MAXBURSTSIZE_MIN (512)
144 #define ISCSI_FIRSTBURSTSIZE_MIN (512)
145 #define ISCSI_MAXRXDATALENGTH_MIN (512)
146 #define ISCSI_MAXTXDATALENGTH_MIN (512)
150 #define ISCSI_TASK_MGMT_FUNCTION_COMPLETE (0)
151 #define ISCSI_TASK_MGMT_TASK_DOES_NOT_EXIST (1)
152 #define ISCSI_TASK_MGMT_LUN_DOES_NOT_EXIST (2)
153 #define ISCSI_TASK_MGMT_TASK_STILL_ALLEGIANT (3)
154 #define ISCSI_TASK_MGMT_TASK_REASSIGN_NOT_SUPPORTED (4)
155 #define ISCSI_TASK_MGMT_NOT_SUPPORTED (5)
156 #define ISCSI_TASK_MGMT_FUNCTION_AUTHORIZATION_FAILED (6)
157 #define ISCSI_TASK_MGMT_FUNCTION_REJECTED (255)
161 #define SESS_STATE_FREE (1)
162 #define SESS_STATE_ACTIVE (2)
163 #define SESS_STATE_LOGGED_IN (3)
164 #define SESS_STATE_IN_CLEANUP (4)
165 #define SESS_STATE_FAILED (5)
166 #define SESS_STATE_IN_CONTINUE (6)
170 #define CONN_STATE_FREE (1)
171 #define CONN_STATE_NEW_CONN (2)
172 #define CONN_STATE_LOGIN_PROGRESS (3)
173 #define CONN_STATE_LOGIN_FAILED (4)
174 #define CONN_STATE_FULL_FEATURE (5)
175 #define CONN_STATE_IN_LOGOUT (6)
176 #define CONN_STATE_LOGOUT_REQUESTED (7)
177 #define CONN_STATE_CLEANUP (8)
181 #define ASYNC_EVENT_SENSE_DATA (0)
182 #define ASYNC_EVENT_LOGOUT (1)
183 #define ASYNC_EVENT_CONN_CLOSE (2)
184 #define ASYNC_EVENT_SESS_CLOSE (3)
185 #define ASYNC_EVENT_PARAM_NEGOTIATE (4)
186 #define ASYNC_EVENT_VENDOR_SPECIFIC (255)
190 #define LOGIN_STATUS_SUCCESS (0)
191 #define LOGIN_STATUS_REDIRECTION (1)
192 #define LOGIN_STATUS_INI_ERROR (2)
193 #define LOGIN_STATUS_TGT_ERROR (3)
197 #define LOGIN_STATUS_DETAIL_INI_MISC (0)
198 #define LOGIN_STATUS_DETAIL_INI_AUTHENTICATION (1)
199 #define LOGIN_STATUS_DETAIL_INI_AUTHORIZATION (2)
200 #define LOGIN_STATUS_DETAIL_INI_NOT_FOUND (3)
201 #define LOGIN_STATUS_DETAIL_INI_TGT_REMOVED (4)
202 #define LOGIN_STATUS_DETAIL_INI_UNSUPPORTED_VERSION (5)
203 #define LOGIN_STATUS_DETAIL_INI_TOO_MANY_CXN (6)
204 #define LOGIN_STATUS_DETAIL_INI_MISSING_PARAM (7)
205 #define LOGIN_STATUS_DETAIL_INI_CANT_INCL_SESSION (8)
206 #define LOGIN_STATUS_DETAIL_INI_SESSION_TYPE_NOT_SUP (9)
207 #define LOGIN_STATUS_DETAIL_INI_SESSION_NOT_EXIST (0xA)
208 #define LOGIN_STATUS_DETAIL_INI_INVALID_DURING_LGN (0xB)
212 #define LOGIN_STATUS_DETAIL_TGT_MISC (0)
213 #define LOGIN_STATUS_DETAIL_TGT_SERVICE_UNAVAILABLE (1)
214 #define LOGIN_STATUS_DETAIL_TGT_OUT_OF_RSRC (2)
218 #define LOGOUT_REASON_CLOSE_SESS (0)
219 #define LOGOUT_REASON_CLOSE_CONN (1)
220 #define LOGOUT_REASON_CLOSE_CONN_FOR_RECOVERY (2)
224 #define LOGOUT_RESP_CONN_SESS_CLOSE_SUCCESS (0)
225 #define LOGOUT_RESP_CID_NOT_FOUND (1)
226 #define LOGOUT_RESP_CONN_RECOVERY_NOT_SUPPORTED (2)
227 #define LOGOUT_RESP_LOGOUT_FAILED (3)
231 #define SESSION_TYPE_NORMAL (1)
232 #define SESSION_TYPE_DISCOVERY (2)
249 uint8_t data_segment_length[3];
264 #if BYTE_ORDER == LITTLE_ENDIAN
268 uint32_t immediate : 1;
283 #if BYTE_ORDER == LITTLE_ENDIAN
287 uint32_t immediate : 1;
294 uint32_t version_max : 8;
295 uint32_t version_min : 8;
311 uint32_t version_min : 8;
312 uint32_t version_max : 8;
319 uint32_t immediate : 1;
327 uint32_t exp_stat_sn;
328 uint32_t field_rsvd4;
329 uint32_t field_rsvd5;
338 #if BYTE_ORDER == LITTLE_ENDIAN
348 uint32_t version_max : 8;
349 uint32_t version_active : 8;
358 uint32_t status_detail : 8;
366 uint32_t version_active : 8;
367 uint32_t version_max : 8;
383 uint32_t status_detail : 8;
393 #if BYTE_ORDER == LITTLE_ENDIAN
397 uint32_t immediate : 1;
399 uint32_t reason_code : 7;
420 uint32_t reason_code : 7;
422 uint32_t immediate : 1;
431 uint32_t exp_stat_sn;
442 #if BYTE_ORDER == LITTLE_ENDIAN
449 uint32_t response : 8;
460 uint32_t time2wait : 16;
461 uint32_t time2retain : 16;
468 uint32_t response : 8;
482 uint32_t time2retain : 16;
483 uint32_t time2wait : 16;
491 #if BYTE_ORDER == LITTLE_ENDIAN
495 uint32_t immediate : 1;
520 uint32_t immediate : 1;
525 uint32_t target_transfer_tag;
527 uint32_t exp_stat_sn;
538 #if BYTE_ORDER == LITTLE_ENDIAN
570 uint32_t target_transfer_tag;
583 #if BYTE_ORDER == LITTLE_ENDIAN
587 uint32_t immediate : 1;
589 uint32_t attributes : 3;
611 uint32_t attributes : 3;
613 uint32_t immediate : 1;
618 uint32_t ExpectedDataTransferLength;
628 #if BYTE_ORDER == LITTLE_ENDIAN
663 uint32_t bufferOffset;
664 uint32_t desiredDataTransferLength;
671 #if BYTE_ORDER == LITTLE_ENDIAN
716 uint32_t bufferOffset;
717 uint32_t residualCount;
724 #if BYTE_ORDER == LITTLE_ENDIAN
756 uint32_t exp_status_sn;
759 uint32_t buffer_offset;
767 #if BYTE_ORDER == LITTLE_ENDIAN
773 uint32_t underflow : 1;
774 uint32_t overflow : 1;
775 uint32_t bdUnderflow : 1;
776 uint32_t bdOverflow : 1;
779 uint32_t response : 8;
797 uint32_t response : 8;
800 uint32_t bdOverflow : 1;
801 uint32_t bdUnderflow : 1;
802 uint32_t overflow : 1;
803 uint32_t underflow : 1;
816 uint32_t BidirReadResdiualCnt;
817 uint32_t ResidualCnt;
824 #if BYTE_ORDER == LITTLE_ENDIAN
838 uint32_t async_event : 8;
839 uint32_t async_vcode : 8;
840 uint32_t param1 : 16;
841 uint32_t param2 : 16;
842 uint32_t param3 : 16;
859 uint32_t param1 : 16;
860 uint32_t async_vcode : 8;
861 uint32_t async_event : 8;
862 uint32_t param3 : 16;
863 uint32_t param2 : 16;
871 #if BYTE_ORDER == LITTLE_ENDIAN
875 uint32_t immediate : 1;
898 uint32_t immediate : 1;
905 uint32_t exp_stat_sn;
916 #if BYTE_ORDER == LITTLE_ENDIAN
959 #if BYTE_ORDER == LITTLE_ENDIAN
997 uint32_t data_r2t_sn;
1006 #if BYTE_ORDER == LITTLE_ENDIAN
1009 uint32_t opcode : 6;
1010 uint32_t immediate : 1;
1012 uint32_t
function : 7;
1014 uint32_t rsvd1 : 16;
1029 uint32_t rsvd1 : 16;
1031 uint32_t
function : 7;
1033 uint32_t immediate : 1;
1034 uint32_t opcode : 6;
1038 uint32_t ref_task_tag;
1040 uint32_t exp_status_sn;
1041 uint32_t ref_cmd_sn;
1042 uint32_t exp_data_sn;
1051 #if BYTE_ORDER == LITTLE_ENDIAN
1054 uint32_t opcode : 6;
1058 uint32_t response : 8;
1076 uint32_t response : 8;
1080 uint32_t opcode : 6;
uint32_t target_transfer_tag
Defines the iSCSI response PDU header.
Defines the iSCSI command PDU header.
Defines the iSCSI reject PDU header.
Defines the iSCSI text command PDU header.
iscsi_isid_tsid_t isid_tsid_ptr
uint32_t ExpectedDataTransferLength
Defines the iSCSI logout response PDU header.
Defines the generic iSCSI basic header segment.
Defines the iSCSI task management PDU header.
uint32_t desiredDataTransferLength
uint32_t target_transfer_tag
Defines the iSCSI logout PDU header.
Defines the iSCSI login response PDU header.
Defines the iSCSI task management response PDU header.
Defines the iSCSI header for the async PDU.
Defines the iSCSI data-in PDU header.
iscsi_isid_tsid_t isid_tsid_ptr
Defines the iSCSI AHS and data segment length in the PDU header.
Defines the iSCSI nop-out PDU header.
Defines the iSCSI text response PDU header.
Defines a union to decode the SCSI LUN field in various ways.
Defines the iSCSI R2T PDU header.
uint32_t BidirReadResdiualCnt
Defines the iSCSI data-out PDU header.
Defines the iSCSI initiator and target session IDs in the PDU header.
Defines the iSCSI nop-in PDU header.
Defines the iSCSI login PDU header.