Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_iscsi_spec.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2015, Emulex
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 
33 /**
34  * @file
35  * Defines the iSCSI (HAL) interface functions to the os specific code
36  * This code should be OS independant.
37  */
38 
39 #ifndef _OCS_ISCSI_SPEC_H
40 #define _OCS_ISCSI_SPEC_H
41 
42 // --- TMF_TASKS ---
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
52 
53 // --- ISCSI_VERSION ---
54 // iSCSI version parameter in login pdu.
55 #define ISCSI_VERSION_MAX (0)
56 #define ISCSI_VERSION_MIN (0)
57 
58 // --- ISCSI_LOGIN_STAGES ---
59 // iSCSI Login Negotiation Stages.
60 #define LOGIN_STAGE_NEGOTIATE_SECURITY (0)
61 #define LOGIN_STAGE_NEGOTIATE_OPERATIONAL (1)
62 #define LOGIN_STAGE_FULL_FEATURE (3)
63 
64 // --- ISCSI_CMD_OPCODES ---
65 // iSCSI Command Opcodes.
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)
74 
75 // --- ISCSI_RESPONSE_OPCODES ---
76 // iSCSI Response Opcodes.
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)
87 
88 // --- ISCSI_CMD_TAGS ---
89 // iSCSI Command Tags.
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)
95 
96 // --- ISCSI_RESERVED_FIELDS ---
97 // Logout Response Codes
98 #define ISCSI_RESERVED_TTT (4294967295)
99 
100 // --- ISCSI_STATUS_CODES ---
101 // iSCSI Cmd Status Codes sent in status and datain.
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)
109 
110 // --- ISCSI_STATUS_PDU_RESP_CODES ---
111 // iSCSI Status PDU response codes. other iSCSI status response codes are assigned by SCSI
112 // layer
113 #define ISCSI_RESPONSE_CMD_COMPLETED (0)
114 #define ISCSI_RESPONSE_TARGET_FAILURE (1)
115 
116 // --- ISCSI_REJECT_PDU_REASON_CODES ---
117 // Reject PDU reason codes
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)
129 
130 // --- ISCSI_PARAMS_DEFAULT_VALUES ---
131 // iSCSI parameters default values
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)
139 
140 // --- ISCSI_PARAM_LIMITS ---
141 // ISCSI parameters limits
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)
147 
148 // --- ISCSI_TASK_MGMT_RESP_CODES ---
149 // ISCSI Task Mgmt Response Opcodes
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)
158 
159 // --- ISCSI_SESSION_STATES ---
160 // iSCSI Session States
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)
167 
168 // --- ISCSI_CONN_STATES ---
169 // iSCSI Connection States
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)
178 
179 // --- ISCSI_ASYNC_EVENT_TYPES ---
180 // iSCSI Async Event Types in Async PDU
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)
187 
188 // --- ISCSI_LOGIN_STATUS_TYPES ---
189 // iSCSI Login status Types in login response PDU
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)
194 
195 // --- ISCSI_LOGIN_STATUS_DETAIL_TYPES ---
196 // iSCSI Initiator Login status detail Type in login response PDU
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)
209 
210 // --- ISCSI_LOGIN_STATUS_DETAIL_TYPES ---
211 // iSCSI Target Login status detail Type in login response PDU
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)
215 
216 // --- ISCSI_LOGOUT_REASON_CODES ---
217 // iSCSI Logout Reason Codes
218 #define LOGOUT_REASON_CLOSE_SESS (0)
219 #define LOGOUT_REASON_CLOSE_CONN (1)
220 #define LOGOUT_REASON_CLOSE_CONN_FOR_RECOVERY (2)
221 
222 // --- ISCSI_LOGOUT_RESP_CODES ---
223 // iSCSI Logout Response Codes
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)
228 
229 // --- ISCSI_SESSION_TYPES ---
230 // iSCSI Session Types
231 #define SESSION_TYPE_NORMAL (1)
232 #define SESSION_TYPE_DISCOVERY (2)
233 
234 /**
235  * @brief Defines the iSCSI initiator and target session IDs in the PDU header.
236  */
237 typedef struct {
238  uint16_t isid0;
239  uint16_t isid1;
240  uint16_t isid2;
241  uint16_t tsid;
243 
244 /**
245  * @brief Defines the iSCSI AHS and data segment length in the PDU header.
246  */
247 typedef struct {
248  uint8_t totalAHSLength;
249  uint8_t data_segment_length[3];
251 
252 /**
253  * @brief Defines a union to decode the SCSI LUN field in various ways.
254  */
255 typedef union {
256  uint64_t lun_64;
257  uint32_t lun_32[2];
258  uint8_t lun_8[8];
259 } iscsi_lun_t;
260 
261 /**
262  * @brief Defines the generic iSCSI basic header segment.
263  */
264 #if BYTE_ORDER == LITTLE_ENDIAN
265 // The iSCSI basic header segment.
266 typedef struct {
267  uint32_t opcode : 6; // DWORD 0
268  uint32_t immediate : 1; // DWORD 0
269  uint32_t rsvd0 : 1; // DWORD 0
270  uint32_t f : 1; // DWORD 0
271  uint32_t rsvd1 : 23; // DWORD 0
274  uint32_t itt; // DWORD 4
275 } iscsi_bhs_t;
276 #else
277 #endif
278 
279 
280 /**
281  * @brief Defines the iSCSI login PDU header.
282  */
283 #if BYTE_ORDER == LITTLE_ENDIAN
284 // The iSCSI login cmd header format.
285 typedef struct {
286  uint32_t opcode : 6; // DWORD 0
287  uint32_t immediate : 1; // DWORD 0
288  uint32_t rsvd0 : 1; // DWORD 0
289  uint32_t nsg : 2; // DWORD 0
290  uint32_t csg : 2; // DWORD 0
291  uint32_t rsvd1 : 2; // DWORD 0
292  uint32_t c : 1; // DWORD 0
293  uint32_t t : 1; // DWORD 0
294  uint32_t version_max : 8; // DWORD 0
295  uint32_t version_min : 8; // DWORD 0
298  uint32_t itt; // DWORD 4
299  uint32_t cid : 16; // DWORD 5
300  uint32_t rsvd2 : 16; // DWORD 5
301  uint32_t cmd_sn; // DWORD 6
302  uint32_t exp_stat_sn; // DWORD 7
303  uint32_t field_rsvd4; // DWORD 8
304  uint32_t field_rsvd5; // DWORD 9
305  uint32_t rsvd3[1]; // DWORDS 10 to 10
306  uint32_t rsvd4[1]; // DWORDS 11 to 11
308 #else
309 // The iSCSI login cmd header format.
310 typedef struct {
311  uint32_t version_min : 8; // DWORD 0
312  uint32_t version_max : 8; // DWORD 0
313  uint32_t t : 1; // DWORD 0
314  uint32_t c : 1; // DWORD 0
315  uint32_t rsvd1 : 2; // DWORD 0
316  uint32_t csg : 2; // DWORD 0
317  uint32_t nsg : 2; // DWORD 0
318  uint32_t rsvd0 : 1; // DWORD 0
319  uint32_t immediate : 1; // DWORD 0
320  uint32_t opcode : 6; // DWORD 0
321  iscsi_hdr_dw2_t dw2;
322  iscsi_isid_tsid_t isid_tsid_ptr;
323  uint32_t itt; // DWORD 4
324  uint32_t rsvd2 : 16; // DWORD 5
325  uint32_t cid : 16; // DWORD 5
326  uint32_t cmd_sn; // DWORD 6
327  uint32_t exp_stat_sn; // DWORD 7
328  uint32_t field_rsvd4; // DWORD 8
329  uint32_t field_rsvd5; // DWORD 9
330  uint32_t rsvd3[1]; // DWORDS 10 to 10
331  uint32_t rsvd4[1]; // DWORDS 11 to 11
333 #endif
334 
335 /**
336  * @brief Defines the iSCSI login response PDU header.
337  */
338 #if BYTE_ORDER == LITTLE_ENDIAN
339 // The iSCSI login response header format.
340 typedef struct {
341  uint32_t opcode : 6; // DWORD 0
342  uint32_t rsvd0 : 2; // DWORD 0
343  uint32_t nsg : 2; // DWORD 0
344  uint32_t csg : 2; // DWORD 0
345  uint32_t rsvd1 : 2; // DWORD 0
346  uint32_t c : 1; // DWORD 0
347  uint32_t t : 1; // DWORD 0
348  uint32_t version_max : 8; // DWORD 0
349  uint32_t version_active : 8; // DWORD 0
352  uint32_t itt; // DWORD 4
353  uint32_t rsvd2[1]; // DWORDS 5 to 5
354  uint32_t stat_sn; // DWORD 6
355  uint32_t exp_cmd_sn; // DWORD 7
356  uint32_t max_cmd_sn; // DWORD 8
357  uint32_t status : 8; // DWORD 9
358  uint32_t status_detail : 8; // DWORD 9
359  uint32_t rsvd3 : 16; // DWORD 9
360  uint32_t rsvd4[1]; // DWORDS 10 to 10
361  uint32_t rsvd5[1]; // DWORDS 11 to 11
363 #else
364 // The iSCSI login response header format.
365 typedef struct {
366  uint32_t version_active : 8; // DWORD 0
367  uint32_t version_max : 8; // DWORD 0
368  uint32_t t : 1; // DWORD 0
369  uint32_t c : 1; // DWORD 0
370  uint32_t rsvd1 : 2; // DWORD 0
371  uint32_t csg : 2; // DWORD 0
372  uint32_t nsg : 2; // DWORD 0
373  uint32_t rsvd0 : 2; // DWORD 0
374  uint32_t opcode : 6; // DWORD 0
375  iscsi_hdr_dw2_t dw2;
376  iscsi_isid_tsid_t isid_tsid_ptr;
377  uint32_t itt; // DWORD 4
378  uint32_t rsvd2[1]; // DWORDS 5 to 5
379  uint32_t stat_sn; // DWORD 6
380  uint32_t exp_cmd_sn; // DWORD 7
381  uint32_t max_cmd_sn; // DWORD 8
382  uint32_t rsvd3 : 16; // DWORD 9
383  uint32_t status_detail : 8; // DWORD 9
384  uint32_t status : 8; // DWORD 9
385  uint32_t rsvd4[1]; // DWORDS 10 to 10
386  uint32_t rsvd5[1]; // DWORDS 11 to 11
388 #endif
389 
390 /**
391  * @brief Defines the iSCSI logout PDU header.
392  */
393 #if BYTE_ORDER == LITTLE_ENDIAN
394 // The iSCSI logout cmd header format.
395 typedef struct {
396  uint32_t opcode : 6; // DWORD 0
397  uint32_t immediate : 1; // DWORD 0
398  uint32_t rsvd0 : 1; // DWORD 0
399  uint32_t reason_code : 7; // DWORD 0
400  uint32_t final : 1; // DWORD 0
401  uint32_t rsvd1 : 16; // DWORD 0
403  uint32_t rsvd2[1]; // DWORDS 2 to 2
404  uint32_t rsvd3[1]; // DWORDS 3 to 3
405  uint32_t itt; // DWORD 4
406  uint32_t cid : 16; // DWORD 5
407  uint32_t rsvd4 : 16; // DWORD 5
408  uint32_t cmd_sn; // DWORD 6
409  uint32_t exp_stat_sn; // DWORD 7
410  uint32_t rsvd5[1]; // DWORDS 8 to 8
411  uint32_t rsvd6[1]; // DWORDS 9 to 9
412  uint32_t rsvd7[1]; // DWORDS 10 to 10
413  uint32_t rsvd8[1]; // DWORDS 11 to 11
415 #else
416 // The iSCSI logout cmd header format.
417 typedef struct {
418  uint32_t rsvd1 : 16; // DWORD 0
419  uint32_t final : 1; // DWORD 0
420  uint32_t reason_code : 7; // DWORD 0
421  uint32_t rsvd0 : 1; // DWORD 0
422  uint32_t immediate : 1; // DWORD 0
423  uint32_t opcode : 6; // DWORD 0
424  iscsi_hdr_dw2_t dw2;
425  uint32_t rsvd2[1]; // DWORDS 2 to 2
426  uint32_t rsvd3[1]; // DWORDS 3 to 3
427  uint32_t itt; // DWORD 4
428  uint32_t rsvd4 : 16; // DWORD 5
429  uint32_t cid : 16; // DWORD 5
430  uint32_t cmd_sn; // DWORD 6
431  uint32_t exp_stat_sn; // DWORD 7
432  uint32_t rsvd5[1]; // DWORDS 8 to 8
433  uint32_t rsvd6[1]; // DWORDS 9 to 9
434  uint32_t rsvd7[1]; // DWORDS 10 to 10
435  uint32_t rsvd8[1]; // DWORDS 11 to 11
437 #endif
438 
439 /**
440  * @brief Defines the iSCSI logout response PDU header.
441  */
442 #if BYTE_ORDER == LITTLE_ENDIAN
443 // The iSCSI logout response header format.
444 typedef struct {
445  uint32_t opcode : 6; // DWORD 0
446  uint32_t rsvd0 : 2; // DWORD 0
447  uint32_t rsvd1 : 7; // DWORD 0
448  uint32_t final : 1; // DWORD 0
449  uint32_t response : 8; // DWORD 0
450  uint32_t rsvd2 : 8; // DWORD 0
452  uint32_t rsvd3[1]; // DWORDS 2 to 2
453  uint32_t rsvd4[1]; // DWORDS 3 to 3
454  uint32_t itt; // DWORD 4
455  uint32_t rsvd5[1]; // DWORDS 5 to 5
456  uint32_t stat_sn; // DWORD 6
457  uint32_t exp_cmd_sn; // DWORD 7
458  uint32_t max_cmd_sn; // DWORD 8
459  uint32_t rsvd6[1]; // DWORDS 9 to 9
460  uint32_t time2wait : 16; // DWORD 10
461  uint32_t time2retain : 16; // DWORD 10
462  uint32_t rsvd7[1]; // DWORDS 11 to 11
464 #else
465 // The iSCSI logout response header format.
466 typedef struct {
467  uint32_t rsvd2 : 8; // DWORD 0
468  uint32_t response : 8; // DWORD 0
469  uint32_t final : 1; // DWORD 0
470  uint32_t rsvd1 : 7; // DWORD 0
471  uint32_t rsvd0 : 2; // DWORD 0
472  uint32_t opcode : 6; // DWORD 0
473  iscsi_hdr_dw2_t dw2;
474  uint32_t rsvd3[1]; // DWORDS 2 to 2
475  uint32_t rsvd4[1]; // DWORDS 3 to 3
476  uint32_t itt; // DWORD 4
477  uint32_t rsvd5[1]; // DWORDS 5 to 5
478  uint32_t stat_sn; // DWORD 6
479  uint32_t exp_cmd_sn; // DWORD 7
480  uint32_t max_cmd_sn; // DWORD 8
481  uint32_t rsvd6[1]; // DWORDS 9 to 9
482  uint32_t time2retain : 16; // DWORD 10
483  uint32_t time2wait : 16; // DWORD 10
484  uint32_t rsvd7[1]; // DWORDS 11 to 11
486 #endif
487 
488 /**
489  * @brief Defines the iSCSI text command PDU header.
490  */
491 #if BYTE_ORDER == LITTLE_ENDIAN
492 // The iSCSI text cmd header format.
493 typedef struct {
494  uint32_t opcode : 6; // DWORD 0
495  uint32_t immediate : 1; // DWORD 0
496  uint32_t rsvd0 : 1; // DWORD 0
497  uint32_t rsvd1 : 6; // DWORD 0
498  uint32_t c : 1; // DWORD 0
499  uint32_t f : 1; // DWORD 0
500  uint32_t rsvd2 : 16; // DWORD 0
503  uint32_t itt; // DWORD 4
504  uint32_t target_transfer_tag; // DWORD 5
505  uint32_t cmd_sn; // DWORD 6
506  uint32_t exp_stat_sn; // DWORD 7
507  uint32_t fld_rsvd4; // DWORD 8
508  uint32_t fld_rsvd5; // DWORD 9
509  uint32_t fld_rsvd6; // DWORD 10
510  uint32_t fld_rsvd7; // DWORD 11
512 #else
513 // The iSCSI text cmd header format.
514 typedef struct {
515  uint32_t rsvd2 : 16; // DWORD 0
516  uint32_t f : 1; // DWORD 0
517  uint32_t c : 1; // DWORD 0
518  uint32_t rsvd1 : 6; // DWORD 0
519  uint32_t rsvd0 : 1; // DWORD 0
520  uint32_t immediate : 1; // DWORD 0
521  uint32_t opcode : 6; // DWORD 0
522  iscsi_hdr_dw2_t dw2;
523  iscsi_lun_t lun;
524  uint32_t itt; // DWORD 4
525  uint32_t target_transfer_tag; // DWORD 5
526  uint32_t cmd_sn; // DWORD 6
527  uint32_t exp_stat_sn; // DWORD 7
528  uint32_t fld_rsvd4; // DWORD 8
529  uint32_t fld_rsvd5; // DWORD 9
530  uint32_t fld_rsvd6; // DWORD 10
531  uint32_t fld_rsvd7; // DWORD 11
533 #endif
534 
535 /**
536  * @brief Defines the iSCSI text response PDU header.
537  */
538 #if BYTE_ORDER == LITTLE_ENDIAN
539 // The iSCSI text response header format.
540 typedef struct {
541  uint32_t opcode : 6; // DWORD 0
542  uint32_t rsvd0 : 2; // DWORD 0
543  uint32_t rsvd1 : 6; // DWORD 0
544  uint32_t c : 1; // DWORD 0
545  uint32_t f : 1; // DWORD 0
546  uint32_t rsvd2 : 16; // DWORD 0
549  uint32_t itt; // DWORD 4
550  uint32_t target_transfer_tag; // DWORD 5
551  uint32_t stat_sn; // DWORD 6
552  uint32_t exp_cmd_sn; // DWORD 7
553  uint32_t max_cmd_sn; // DWORD 8
554  uint32_t fld_rsvd4; // DWORD 9
555  uint32_t fld_rsvd5; // DWORD 10
556  uint32_t fld_rsvd6; // DWORD 11
558 #else
559 // The iSCSI text response header format.
560 typedef struct {
561  uint32_t rsvd2 : 16; // DWORD 0
562  uint32_t f : 1; // DWORD 0
563  uint32_t c : 1; // DWORD 0
564  uint32_t rsvd1 : 6; // DWORD 0
565  uint32_t rsvd0 : 2; // DWORD 0
566  uint32_t opcode : 6; // DWORD 0
567  iscsi_hdr_dw2_t dw2;
568  iscsi_lun_t lun;
569  uint32_t itt; // DWORD 4
570  uint32_t target_transfer_tag; // DWORD 5
571  uint32_t stat_sn; // DWORD 6
572  uint32_t exp_cmd_sn; // DWORD 7
573  uint32_t max_cmd_sn; // DWORD 8
574  uint32_t fld_rsvd4; // DWORD 9
575  uint32_t fld_rsvd5; // DWORD 10
576  uint32_t fld_rsvd6; // DWORD 11
578 #endif
579 
580 /**
581  * @brief Defines the iSCSI command PDU header.
582  */
583 #if BYTE_ORDER == LITTLE_ENDIAN
584 // The iSCSI command header format.
585 typedef struct {
586  uint32_t opcode : 6; // DWORD 0
587  uint32_t immediate : 1; // DWORD 0
588  uint32_t rsvd0 : 1; // DWORD 0
589  uint32_t attributes : 3; // DWORD 0
590  uint32_t rsvd1 : 2; // DWORD 0
591  uint32_t wr : 1; // DWORD 0
592  uint32_t rd : 1; // DWORD 0
593  uint32_t final : 1; // DWORD 0
594  uint32_t rsvd2 : 16; // DWORD 0
597  uint32_t itt; // DWORD 4
598  uint32_t ExpectedDataTransferLength; // DWORD 5
599  uint32_t CmdSN; // DWORD 6
600  uint32_t ExpStatSN; // DWORD 7
601  uint8_t cdb[16];
603 #else
604 // The iSCSI command header format.
605 typedef struct {
606  uint32_t rsvd2 : 16; // DWORD 0
607  uint32_t final : 1; // DWORD 0
608  uint32_t rd : 1; // DWORD 0
609  uint32_t wr : 1; // DWORD 0
610  uint32_t rsvd1 : 2; // DWORD 0
611  uint32_t attributes : 3; // DWORD 0
612  uint32_t rsvd0 : 1; // DWORD 0
613  uint32_t immediate : 1; // DWORD 0
614  uint32_t opcode : 6; // DWORD 0
615  iscsi_hdr_dw2_t dw2;
616  iscsi_lun_t lun;
617  uint32_t itt; // DWORD 4
618  uint32_t ExpectedDataTransferLength; // DWORD 5
619  uint32_t CmdSN; // DWORD 6
620  uint32_t ExpStatSN; // DWORD 7
621  uint8_t cdb[16];
623 #endif
624 
625 /**
626  * @brief Defines the iSCSI R2T PDU header.
627  */
628 #if BYTE_ORDER == LITTLE_ENDIAN
629 // The iSCSI R2T header format.
630 typedef struct {
631  uint32_t opcode : 6; // DWORD 0
632  uint32_t rsvd0 : 2; // DWORD 0
633  uint32_t rsvd1 : 7; // DWORD 0
634  uint32_t final : 1; // DWORD 0
635  uint32_t rsvd2 : 16; // DWORD 0
638  uint32_t itt; // DWORD 4
639  uint32_t ttt; // DWORD 5
640  uint32_t StatSN; // DWORD 6
641  uint32_t ExpCmdSN; // DWORD 7
642  uint32_t MaxCmdSN; // DWORD 8
643  uint32_t R2TSN; // DWORD 9
644  uint32_t bufferOffset; // DWORD 10
645  uint32_t desiredDataTransferLength; // DWORD 11
647 #else
648 // The iSCSI R2T header format.
649 typedef struct {
650  uint32_t rsvd2 : 16; // DWORD 0
651  uint32_t final : 1; // DWORD 0
652  uint32_t rsvd1 : 7; // DWORD 0
653  uint32_t rsvd0 : 2; // DWORD 0
654  uint32_t opcode : 6; // DWORD 0
655  iscsi_hdr_dw2_t dw2;
656  iscsi_lun_t lun;
657  uint32_t itt; // DWORD 4
658  uint32_t ttt; // DWORD 5
659  uint32_t StatSN; // DWORD 6
660  uint32_t ExpCmdSN; // DWORD 7
661  uint32_t MaxCmdSN; // DWORD 8
662  uint32_t R2TSN; // DWORD 9
663  uint32_t bufferOffset; // DWORD 10
664  uint32_t desiredDataTransferLength; // DWORD 11
666 #endif
667 
668 /**
669  * @brief Defines the iSCSI data-in PDU header.
670  */
671 #if BYTE_ORDER == LITTLE_ENDIAN
672 // The iSCSI data in header format.
673 typedef struct {
674  uint32_t opcode : 6; // DWORD 0
675  uint32_t rsvd0 : 2; // DWORD 0
676  uint32_t S : 1; // DWORD 0
677  uint32_t U : 1; // DWORD 0
678  uint32_t O : 1; // DWORD 0
679  uint32_t rsvd1 : 3; // DWORD 0
680  uint32_t A : 1; // DWORD 0
681  uint32_t F : 1; // DWORD 0
682  uint32_t rsvd2 : 8; // DWORD 0
683  uint32_t status : 8; // DWORD 0
686  uint32_t itt; // DWORD 4
687  uint32_t ttt; // DWORD 5
688  uint32_t statSN; // DWORD 6
689  uint32_t expCmdSN; // DWORD 7
690  uint32_t maxCmdSN; // DWORD 8
691  uint32_t dataSN; // DWORD 9
692  uint32_t bufferOffset; // DWORD 10
693  uint32_t residualCount; // DWORD 11
695 #else
696 // The iSCSI data in header format.
697 typedef struct {
698  uint32_t status : 8; // DWORD 0
699  uint32_t rsvd2 : 8; // DWORD 0
700  uint32_t F : 1; // DWORD 0
701  uint32_t A : 1; // DWORD 0
702  uint32_t rsvd1 : 3; // DWORD 0
703  uint32_t O : 1; // DWORD 0
704  uint32_t U : 1; // DWORD 0
705  uint32_t S : 1; // DWORD 0
706  uint32_t rsvd0 : 2; // DWORD 0
707  uint32_t opcode : 6; // DWORD 0
708  iscsi_hdr_dw2_t dw2;
709  iscsi_lun_t lun;
710  uint32_t itt; // DWORD 4
711  uint32_t ttt; // DWORD 5
712  uint32_t statSN; // DWORD 6
713  uint32_t expCmdSN; // DWORD 7
714  uint32_t maxCmdSN; // DWORD 8
715  uint32_t dataSN; // DWORD 9
716  uint32_t bufferOffset; // DWORD 10
717  uint32_t residualCount; // DWORD 11
719 #endif
720 
721 /**
722  * @brief Defines the iSCSI data-out PDU header.
723  */
724 #if BYTE_ORDER == LITTLE_ENDIAN
725 // The iSCSI data in header format.
726 typedef struct {
727  uint32_t opcode : 6; // DWORD 0
728  uint32_t rsvd0 : 2; // DWORD 0
729  uint32_t rsvd1 : 7; // DWORD 0
730  uint32_t final : 1; // DWORD 0
731  uint32_t rsvd2 : 16; // DWORD 0
734  uint32_t itt; // DWORD 4
735  uint32_t ttt; // DWORD 5
736  uint32_t rsvd3[1]; // DWORDS 6 to 6
737  uint32_t exp_status_sn; // DWORD 7
738  uint32_t rsvd4[1]; // DWORDS 8 to 8
739  uint32_t data_sn; // DWORD 9
740  uint32_t buffer_offset; // DWORD 10
741  uint32_t rsvd5[1]; // DWORDS 11 to 11
743 #else
744 // The iSCSI data in header format.
745 typedef struct {
746  uint32_t rsvd2 : 16; // DWORD 0
747  uint32_t final : 1; // DWORD 0
748  uint32_t rsvd1 : 7; // DWORD 0
749  uint32_t rsvd0 : 2; // DWORD 0
750  uint32_t opcode : 6; // DWORD 0
751  iscsi_hdr_dw2_t dw2;
752  iscsi_lun_t lun;
753  uint32_t itt; // DWORD 4
754  uint32_t ttt; // DWORD 5
755  uint32_t rsvd3[1]; // DWORDS 6 to 6
756  uint32_t exp_status_sn; // DWORD 7
757  uint32_t rsvd4[1]; // DWORDS 8 to 8
758  uint32_t data_sn; // DWORD 9
759  uint32_t buffer_offset; // DWORD 10
760  uint32_t rsvd5[1]; // DWORDS 11 to 11
762 #endif
763 
764 /**
765  * @brief Defines the iSCSI response PDU header.
766  */
767 #if BYTE_ORDER == LITTLE_ENDIAN
768 // The iSCSI response header format.
769 typedef struct {
770  uint32_t opcode : 6; // DWORD 0
771  uint32_t rsvd0 : 2; // DWORD 0
772  uint32_t rsvd1 : 1; // DWORD 0
773  uint32_t underflow : 1; // DWORD 0
774  uint32_t overflow : 1; // DWORD 0
775  uint32_t bdUnderflow : 1; // DWORD 0
776  uint32_t bdOverflow : 1; // DWORD 0
777  uint32_t rsvd2 : 2; // DWORD 0
778  uint32_t final : 1; // DWORD 0
779  uint32_t response : 8; // DWORD 0
780  uint32_t status : 8; // DWORD 0
782  uint32_t rsvd3[1]; // DWORDS 2 to 2
783  uint32_t rsvd4[1]; // DWORDS 3 to 3
784  uint32_t itt; // DWORD 4
785  uint32_t snackTag; // DWORD 5
786  uint32_t StatSN; // DWORD 6
787  uint32_t ExpCmdSN; // DWORD 7
788  uint32_t MaxCmdSN; // DWORD 8
789  uint32_t ExpDataSN; // DWORD 9
790  uint32_t BidirReadResdiualCnt; // DWORD 10
791  uint32_t ResidualCnt; // DWORD 11
793 #else
794 // The iSCSI response header format.
795 typedef struct {
796  uint32_t status : 8; // DWORD 0
797  uint32_t response : 8; // DWORD 0
798  uint32_t final : 1; // DWORD 0
799  uint32_t rsvd2 : 2; // DWORD 0
800  uint32_t bdOverflow : 1; // DWORD 0
801  uint32_t bdUnderflow : 1; // DWORD 0
802  uint32_t overflow : 1; // DWORD 0
803  uint32_t underflow : 1; // DWORD 0
804  uint32_t rsvd1 : 1; // DWORD 0
805  uint32_t rsvd0 : 2; // DWORD 0
806  uint32_t opcode : 6; // DWORD 0
807  iscsi_hdr_dw2_t dw2;
808  uint32_t rsvd3[1]; // DWORDS 2 to 2
809  uint32_t rsvd4[1]; // DWORDS 3 to 3
810  uint32_t itt; // DWORD 4
811  uint32_t snackTag; // DWORD 5
812  uint32_t StatSN; // DWORD 6
813  uint32_t ExpCmdSN; // DWORD 7
814  uint32_t MaxCmdSN; // DWORD 8
815  uint32_t ExpDataSN; // DWORD 9
816  uint32_t BidirReadResdiualCnt; // DWORD 10
817  uint32_t ResidualCnt; // DWORD 11
819 #endif
820 
821 /**
822  * @brief Defines the iSCSI header for the async PDU.
823  */
824 #if BYTE_ORDER == LITTLE_ENDIAN
825 // The iSCSI target async header format.
826 typedef struct {
827  uint32_t opcode : 6; // DWORD 0
828  uint32_t rsvd0 : 2; // DWORD 0
829  uint32_t rsvd1 : 7; // DWORD 0
830  uint32_t final : 1; // DWORD 0
831  uint32_t rsvd2 : 16; // DWORD 0
834  uint32_t rsvd3[2]; // DWORDS 4 to 5
835  uint32_t statSN; // DWORD 6
836  uint32_t expCmdSN; // DWORD 7
837  uint32_t maxCmdSN; // DWORD 8
838  uint32_t async_event : 8; // DWORD 9
839  uint32_t async_vcode : 8; // DWORD 9
840  uint32_t param1 : 16; // DWORD 9
841  uint32_t param2 : 16; // DWORD 10
842  uint32_t param3 : 16; // DWORD 10
843  uint32_t rsvd4[1]; // DWORDS 11 to 11
845 #else
846 // The iSCSI target async header format.
847 typedef struct {
848  uint32_t rsvd2 : 16; // DWORD 0
849  uint32_t final : 1; // DWORD 0
850  uint32_t rsvd1 : 7; // DWORD 0
851  uint32_t rsvd0 : 2; // DWORD 0
852  uint32_t opcode : 6; // DWORD 0
853  iscsi_hdr_dw2_t dw2;
854  iscsi_lun_t lun;
855  uint32_t rsvd3[2]; // DWORDS 4 to 5
856  uint32_t statSN; // DWORD 6
857  uint32_t expCmdSN; // DWORD 7
858  uint32_t maxCmdSN; // DWORD 8
859  uint32_t param1 : 16; // DWORD 9
860  uint32_t async_vcode : 8; // DWORD 9
861  uint32_t async_event : 8; // DWORD 9
862  uint32_t param3 : 16; // DWORD 10
863  uint32_t param2 : 16; // DWORD 10
864  uint32_t rsvd4[1]; // DWORDS 11 to 11
866 #endif
867 
868 /**
869  * @brief Defines the iSCSI nop-out PDU header.
870  */
871 #if BYTE_ORDER == LITTLE_ENDIAN
872 // The iSCSI target nop-out header format.
873 typedef struct {
874  uint32_t opcode : 6; // DWORD 0
875  uint32_t immediate : 1; // DWORD 0
876  uint32_t rsvd0 : 1; // DWORD 0
877  uint32_t rsvd1 : 7; // DWORD 0
878  uint32_t final : 1; // DWORD 0
879  uint32_t rsvd2 : 16; // DWORD 0
882  uint32_t itt; // DWORD 4
883  uint32_t ttt; // DWORD 5
884  uint32_t cmd_sn; // DWORD 6
885  uint32_t exp_stat_sn; // DWORD 7
886  uint32_t rsvd3[1]; // DWORDS 8 to 8
887  uint32_t rsvd4[1]; // DWORDS 9 to 9
888  uint32_t rsvd5[1]; // DWORDS 10 to 10
889  uint32_t rsvd6[1]; // DWORDS 11 to 11
891 #else
892 // The iSCSI target nop-out header format.
893 typedef struct {
894  uint32_t rsvd2 : 16; // DWORD 0
895  uint32_t final : 1; // DWORD 0
896  uint32_t rsvd1 : 7; // DWORD 0
897  uint32_t rsvd0 : 1; // DWORD 0
898  uint32_t immediate : 1; // DWORD 0
899  uint32_t opcode : 6; // DWORD 0
900  iscsi_hdr_dw2_t dw2;
901  iscsi_lun_t lun;
902  uint32_t itt; // DWORD 4
903  uint32_t ttt; // DWORD 5
904  uint32_t cmd_sn; // DWORD 6
905  uint32_t exp_stat_sn; // DWORD 7
906  uint32_t rsvd3[1]; // DWORDS 8 to 8
907  uint32_t rsvd4[1]; // DWORDS 9 to 9
908  uint32_t rsvd5[1]; // DWORDS 10 to 10
909  uint32_t rsvd6[1]; // DWORDS 11 to 11
911 #endif
912 
913 /**
914  * @brief Defines the iSCSI nop-in PDU header.
915  */
916 #if BYTE_ORDER == LITTLE_ENDIAN
917 // The iSCSI target nop-in header format.
918 typedef struct {
919  uint32_t opcode : 6; // DWORD 0
920  uint32_t rsvd0 : 2; // DWORD 0
921  uint32_t rsvd1 : 7; // DWORD 0
922  uint32_t final : 1; // DWORD 0
923  uint32_t rsvd2 : 16; // DWORD 0
926  uint32_t itt; // DWORD 4
927  uint32_t ttt; // DWORD 5
928  uint32_t statSN; // DWORD 6
929  uint32_t expCmdSN; // DWORD 7
930  uint32_t maxCmdSN; // DWORD 8
931  uint32_t rsvd3[1]; // DWORDS 9 to 9
932  uint32_t rsvd4[1]; // DWORDS 10 to 10
933  uint32_t rsvd5[1]; // DWORDS 11 to 11
935 #else
936 // The iSCSI target nop-in header format.
937 typedef struct {
938  uint32_t rsvd2 : 16; // DWORD 0
939  uint32_t final : 1; // DWORD 0
940  uint32_t rsvd1 : 7; // DWORD 0
941  uint32_t rsvd0 : 2; // DWORD 0
942  uint32_t opcode : 6; // DWORD 0
943  iscsi_hdr_dw2_t dw2;
944  iscsi_lun_t lun;
945  uint32_t itt; // DWORD 4
946  uint32_t ttt; // DWORD 5
947  uint32_t statSN; // DWORD 6
948  uint32_t expCmdSN; // DWORD 7
949  uint32_t maxCmdSN; // DWORD 8
950  uint32_t rsvd3[1]; // DWORDS 9 to 9
951  uint32_t rsvd4[1]; // DWORDS 10 to 10
952  uint32_t rsvd5[1]; // DWORDS 11 to 11
954 #endif
955 
956 /**
957  * @brief Defines the iSCSI reject PDU header.
958  */
959 #if BYTE_ORDER == LITTLE_ENDIAN
960 // The iSCSI target reject header format.
961 typedef struct {
962  uint32_t opcode : 6; // DWORD 0
963  uint32_t rsvd0 : 2; // DWORD 0
964  uint32_t rsvd1 : 7; // DWORD 0
965  uint32_t final : 1; // DWORD 0
966  uint32_t reason : 8; // DWORD 0
967  uint32_t rsvd2 : 8; // DWORD 0
969  uint32_t rsvd3[1]; // DWORDS 2 to 2
970  uint32_t rsvd4[1]; // DWORDS 3 to 3
971  uint32_t itt; // DWORD 4
972  uint32_t rsvd5[1]; // DWORDS 5 to 5
973  uint32_t status_sn; // DWORD 6
974  uint32_t exp_cmd_sn; // DWORD 7
975  uint32_t max_cmd_sn; // DWORD 8
976  uint32_t data_r2t_sn; // DWORD 9
977  uint32_t rsvd6[1]; // DWORDS 10 to 10
978  uint32_t rsvd7[1]; // DWORDS 11 to 11
980 #else
981 // The iSCSI target reject header format.
982 typedef struct {
983  uint32_t rsvd2 : 8; // DWORD 0
984  uint32_t reason : 8; // DWORD 0
985  uint32_t final : 1; // DWORD 0
986  uint32_t rsvd1 : 7; // DWORD 0
987  uint32_t rsvd0 : 2; // DWORD 0
988  uint32_t opcode : 6; // DWORD 0
989  iscsi_hdr_dw2_t dw2;
990  uint32_t rsvd3[1]; // DWORDS 2 to 2
991  uint32_t rsvd4[1]; // DWORDS 3 to 3
992  uint32_t itt; // DWORD 4
993  uint32_t rsvd5[1]; // DWORDS 5 to 5
994  uint32_t status_sn; // DWORD 6
995  uint32_t exp_cmd_sn; // DWORD 7
996  uint32_t max_cmd_sn; // DWORD 8
997  uint32_t data_r2t_sn; // DWORD 9
998  uint32_t rsvd6[1]; // DWORDS 10 to 10
999  uint32_t rsvd7[1]; // DWORDS 11 to 11
1001 #endif
1002 
1003 /**
1004  * @brief Defines the iSCSI task management PDU header.
1005  */
1006 #if BYTE_ORDER == LITTLE_ENDIAN
1007 // The iSCSI task mgmt cmd header format.
1008 typedef struct {
1009  uint32_t opcode : 6; // DWORD 0
1010  uint32_t immediate : 1; // DWORD 0
1011  uint32_t rsvd0 : 1; // DWORD 0
1012  uint32_t function : 7; // DWORD 0
1013  uint32_t final : 1; // DWORD 0
1014  uint32_t rsvd1 : 16; // DWORD 0
1017  uint32_t itt; // DWORD 4
1018  uint32_t ref_task_tag; // DWORD 5
1019  uint32_t cmd_sn; // DWORD 6
1020  uint32_t exp_status_sn; // DWORD 7
1021  uint32_t ref_cmd_sn; // DWORD 8
1022  uint32_t exp_data_sn; // DWORD 9
1023  uint32_t rsvd2[1]; // DWORDS 10 to 10
1024  uint32_t rsvd3[1]; // DWORDS 11 to 11
1026 #else
1027 // The iSCSI task mgmt cmd header format.
1028 typedef struct {
1029  uint32_t rsvd1 : 16; // DWORD 0
1030  uint32_t final : 1; // DWORD 0
1031  uint32_t function : 7; // DWORD 0
1032  uint32_t rsvd0 : 1; // DWORD 0
1033  uint32_t immediate : 1; // DWORD 0
1034  uint32_t opcode : 6; // DWORD 0
1035  iscsi_hdr_dw2_t dw2;
1036  iscsi_lun_t lun;
1037  uint32_t itt; // DWORD 4
1038  uint32_t ref_task_tag; // DWORD 5
1039  uint32_t cmd_sn; // DWORD 6
1040  uint32_t exp_status_sn; // DWORD 7
1041  uint32_t ref_cmd_sn; // DWORD 8
1042  uint32_t exp_data_sn; // DWORD 9
1043  uint32_t rsvd2[1]; // DWORDS 10 to 10
1044  uint32_t rsvd3[1]; // DWORDS 11 to 11
1046 #endif
1047 
1048 /**
1049  * @brief Defines the iSCSI task management response PDU header.
1050  */
1051 #if BYTE_ORDER == LITTLE_ENDIAN
1052 // The iSCSI TM response format.
1053 typedef struct {
1054  uint32_t opcode : 6; // DWORD 0
1055  uint32_t rsvd0 : 2; // DWORD 0
1056  uint32_t rsvd1 : 7; // DWORD 0
1057  uint32_t final : 1; // DWORD 0
1058  uint32_t response : 8; // DWORD 0
1059  uint32_t rsvd2 : 8; // DWORD 0
1061  uint32_t rsvd3[1]; // DWORDS 2 to 2
1062  uint32_t rsvd4[1]; // DWORDS 3 to 3
1063  uint32_t itt; // DWORD 4
1064  uint32_t rsvd5[1]; // DWORDS 5 to 5
1065  uint32_t StatSN; // DWORD 6
1066  uint32_t ExpCmdSN; // DWORD 7
1067  uint32_t MaxCmdSN; // DWORD 8
1068  uint32_t rsvd6[1]; // DWORDS 9 to 9
1069  uint32_t rsvd7[1]; // DWORDS 10 to 10
1070  uint32_t rsvd8[1]; // DWORDS 11 to 11
1072 #else
1073 // The iSCSI TM response format.
1074 typedef struct {
1075  uint32_t rsvd2 : 8; // DWORD 0
1076  uint32_t response : 8; // DWORD 0
1077  uint32_t final : 1; // DWORD 0
1078  uint32_t rsvd1 : 7; // DWORD 0
1079  uint32_t rsvd0 : 2; // DWORD 0
1080  uint32_t opcode : 6; // DWORD 0
1081  iscsi_hdr_dw2_t dw2;
1082  uint32_t rsvd3[1]; // DWORDS 2 to 2
1083  uint32_t rsvd4[1]; // DWORDS 3 to 3
1084  uint32_t itt; // DWORD 4
1085  uint32_t rsvd5[1]; // DWORDS 5 to 5
1086  uint32_t StatSN; // DWORD 6
1087  uint32_t ExpCmdSN; // DWORD 7
1088  uint32_t MaxCmdSN; // DWORD 8
1089  uint32_t rsvd6[1]; // DWORDS 9 to 9
1090  uint32_t rsvd7[1]; // DWORDS 10 to 10
1091  uint32_t rsvd8[1]; // DWORDS 11 to 11
1093 #endif
1094 
1095 #endif /* !_OCS_ISCSI_SPEC_H */
1096 
1097 /* vim: set noexpandtab textwidth=120: */
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.
iscsi_lun_t lun
Defines the generic iSCSI basic header segment.
Defines the iSCSI task management PDU header.
iscsi_hdr_dw2_t dw2
uint32_t desiredDataTransferLength
iscsi_hdr_dw2_t dw2
iscsi_hdr_dw2_t dw2
Defines the iSCSI logout PDU header.
iscsi_hdr_dw2_t dw2
Defines the iSCSI login response PDU header.
iscsi_hdr_dw2_t dw2
iscsi_lun_t lun
iscsi_hdr_dw2_t dw2
Defines the iSCSI task management response PDU header.
Defines the iSCSI header for the async PDU.
Defines the iSCSI data-in PDU header.
uint32_t itt
iscsi_isid_tsid_t isid_tsid_ptr
iscsi_hdr_dw2_t dw2
Defines the iSCSI AHS and data segment length in the PDU header.
uint8_t totalAHSLength
iscsi_hdr_dw2_t dw2
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.
iscsi_hdr_dw2_t dw2
iscsi_hdr_dw2_t dw2
Defines the iSCSI data-out PDU header.
Defines the iSCSI initiator and target session IDs in the PDU header.
iscsi_lun_t lun
iscsi_hdr_dw2_t dw2
uint32_t bufferOffset
iscsi_hdr_dw2_t dw2
uint64_t lun_64
Defines the iSCSI nop-in PDU header.
Defines the iSCSI login PDU header.