diff options
author | Alex Aizman <itn780@yahoo.com> | 2005-08-04 22:31:00 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-08-06 10:33:41 -0400 |
commit | 39e84790d3b65a4af1ea1fb0d8f06c3ad75304b3 (patch) | |
tree | 9b2be0119cb4020adccaf2ff959fc8cbbf3e2711 /include/scsi/iscsi_proto.h | |
parent | 885ececaa9e20750d147557fa7f39dbcdac77daa (diff) |
[SCSI] open-iscsi/linux-iscsi-5 Initiator: Header files
open-iscsi-headers.patch - common header files:
- iscsi_if.h (user/kernel #defines and user/kernel events);
- iscsi_proto.h (RFC3720 #defines and types);
- scsi_transport_iscsi.h (transport API, transport #defines and types).
Signed-off-by: Alex Aizman <itn780@yahoo.com>
Signed-off-by: Dmitry Yusupov <dmitry_yus@yahoo.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'include/scsi/iscsi_proto.h')
-rw-r--r-- | include/scsi/iscsi_proto.h | 566 |
1 files changed, 566 insertions, 0 deletions
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h new file mode 100644 index 000000000000..6c08551c79f5 --- /dev/null +++ b/include/scsi/iscsi_proto.h | |||
@@ -0,0 +1,566 @@ | |||
1 | /* | ||
2 | * RFC 3720 (iSCSI) protocol data types | ||
3 | * | ||
4 | * Copyright (C) 2005 Dmitry Yusupov | ||
5 | * Copyright (C) 2005 Alex Aizman | ||
6 | * maintained by open-iscsi@googlegroups.com | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published | ||
10 | * by the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * See the file COPYING included with this distribution for more details. | ||
19 | */ | ||
20 | |||
21 | #ifndef ISCSI_PROTO_H | ||
22 | #define ISCSI_PROTO_H | ||
23 | |||
24 | #define ISCSI_VERSION_STR "0.3" | ||
25 | #define ISCSI_DATE_STR "22-Apr-2005" | ||
26 | #define ISCSI_DRAFT20_VERSION 0x00 | ||
27 | |||
28 | /* default iSCSI listen port for incoming connections */ | ||
29 | #define ISCSI_LISTEN_PORT 3260 | ||
30 | |||
31 | /* Padding word length */ | ||
32 | #define PAD_WORD_LEN 4 | ||
33 | |||
34 | /* | ||
35 | * useful common(control and data pathes) macro | ||
36 | */ | ||
37 | #define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2])) | ||
38 | #define hton24(p, v) { \ | ||
39 | p[0] = (((v) >> 16) & 0xFF); \ | ||
40 | p[1] = (((v) >> 8) & 0xFF); \ | ||
41 | p[2] = ((v) & 0xFF); \ | ||
42 | } | ||
43 | #define zero_data(p) {p[0]=0;p[1]=0;p[2]=0;} | ||
44 | |||
45 | /* | ||
46 | * iSCSI Template Message Header | ||
47 | */ | ||
48 | struct iscsi_hdr { | ||
49 | uint8_t opcode; | ||
50 | uint8_t flags; /* Final bit */ | ||
51 | uint8_t rsvd2[2]; | ||
52 | uint8_t hlength; /* AHSs total length */ | ||
53 | uint8_t dlength[3]; /* Data length */ | ||
54 | uint8_t lun[8]; | ||
55 | __be32 itt; /* Initiator Task Tag */ | ||
56 | __be32 ttt; /* Target Task Tag */ | ||
57 | __be32 statsn; | ||
58 | __be32 exp_statsn; | ||
59 | uint8_t other[16]; | ||
60 | }; | ||
61 | |||
62 | /************************* RFC 3720 Begin *****************************/ | ||
63 | |||
64 | #define ISCSI_RESERVED_TAG 0xffffffff | ||
65 | |||
66 | /* Opcode encoding bits */ | ||
67 | #define ISCSI_OP_RETRY 0x80 | ||
68 | #define ISCSI_OP_IMMEDIATE 0x40 | ||
69 | #define ISCSI_OPCODE_MASK 0x3F | ||
70 | |||
71 | /* Initiator Opcode values */ | ||
72 | #define ISCSI_OP_NOOP_OUT 0x00 | ||
73 | #define ISCSI_OP_SCSI_CMD 0x01 | ||
74 | #define ISCSI_OP_SCSI_TMFUNC 0x02 | ||
75 | #define ISCSI_OP_LOGIN 0x03 | ||
76 | #define ISCSI_OP_TEXT 0x04 | ||
77 | #define ISCSI_OP_SCSI_DATA_OUT 0x05 | ||
78 | #define ISCSI_OP_LOGOUT 0x06 | ||
79 | #define ISCSI_OP_SNACK 0x10 | ||
80 | |||
81 | /* Target Opcode values */ | ||
82 | #define ISCSI_OP_NOOP_IN 0x20 | ||
83 | #define ISCSI_OP_SCSI_CMD_RSP 0x21 | ||
84 | #define ISCSI_OP_SCSI_TMFUNC_RSP 0x22 | ||
85 | #define ISCSI_OP_LOGIN_RSP 0x23 | ||
86 | #define ISCSI_OP_TEXT_RSP 0x24 | ||
87 | #define ISCSI_OP_SCSI_DATA_IN 0x25 | ||
88 | #define ISCSI_OP_LOGOUT_RSP 0x26 | ||
89 | #define ISCSI_OP_R2T 0x31 | ||
90 | #define ISCSI_OP_ASYNC_EVENT 0x32 | ||
91 | #define ISCSI_OP_REJECT 0x3f | ||
92 | |||
93 | /* iSCSI PDU Header */ | ||
94 | struct iscsi_cmd { | ||
95 | uint8_t opcode; | ||
96 | uint8_t flags; | ||
97 | uint8_t rsvd2; | ||
98 | uint8_t cmdrn; | ||
99 | uint8_t hlength; | ||
100 | uint8_t dlength[3]; | ||
101 | uint8_t lun[8]; | ||
102 | __be32 itt; /* Initiator Task Tag */ | ||
103 | __be32 data_length; | ||
104 | __be32 cmdsn; | ||
105 | __be32 exp_statsn; | ||
106 | uint8_t cdb[16]; /* SCSI Command Block */ | ||
107 | /* Additional Data (Command Dependent) */ | ||
108 | }; | ||
109 | |||
110 | /* Command PDU flags */ | ||
111 | #define ISCSI_FLAG_CMD_FINAL 0x80 | ||
112 | #define ISCSI_FLAG_CMD_READ 0x40 | ||
113 | #define ISCSI_FLAG_CMD_WRITE 0x20 | ||
114 | #define ISCSI_FLAG_CMD_ATTR_MASK 0x07 /* 3 bits */ | ||
115 | |||
116 | /* SCSI Command Attribute values */ | ||
117 | #define ISCSI_ATTR_UNTAGGED 0 | ||
118 | #define ISCSI_ATTR_SIMPLE 1 | ||
119 | #define ISCSI_ATTR_ORDERED 2 | ||
120 | #define ISCSI_ATTR_HEAD_OF_QUEUE 3 | ||
121 | #define ISCSI_ATTR_ACA 4 | ||
122 | |||
123 | /* SCSI Response Header */ | ||
124 | struct iscsi_cmd_rsp { | ||
125 | uint8_t opcode; | ||
126 | uint8_t flags; | ||
127 | uint8_t response; | ||
128 | uint8_t cmd_status; | ||
129 | uint8_t hlength; | ||
130 | uint8_t dlength[3]; | ||
131 | uint8_t rsvd[8]; | ||
132 | __be32 itt; /* Initiator Task Tag */ | ||
133 | __be32 rsvd1; | ||
134 | __be32 statsn; | ||
135 | __be32 exp_cmdsn; | ||
136 | __be32 max_cmdsn; | ||
137 | __be32 exp_datasn; | ||
138 | __be32 bi_residual_count; | ||
139 | __be32 residual_count; | ||
140 | /* Response or Sense Data (optional) */ | ||
141 | }; | ||
142 | |||
143 | /* Command Response PDU flags */ | ||
144 | #define ISCSI_FLAG_CMD_BIDI_OVERFLOW 0x10 | ||
145 | #define ISCSI_FLAG_CMD_BIDI_UNDERFLOW 0x08 | ||
146 | #define ISCSI_FLAG_CMD_OVERFLOW 0x04 | ||
147 | #define ISCSI_FLAG_CMD_UNDERFLOW 0x02 | ||
148 | |||
149 | /* iSCSI Status values. Valid if Rsp Selector bit is not set */ | ||
150 | #define ISCSI_STATUS_CMD_COMPLETED 0 | ||
151 | #define ISCSI_STATUS_TARGET_FAILURE 1 | ||
152 | #define ISCSI_STATUS_SUBSYS_FAILURE 2 | ||
153 | |||
154 | /* Asynchronous Event Header */ | ||
155 | struct iscsi_async { | ||
156 | uint8_t opcode; | ||
157 | uint8_t flags; | ||
158 | uint8_t rsvd2[2]; | ||
159 | uint8_t rsvd3; | ||
160 | uint8_t dlength[3]; | ||
161 | uint8_t lun[8]; | ||
162 | uint8_t rsvd4[8]; | ||
163 | __be32 statsn; | ||
164 | __be32 exp_cmdsn; | ||
165 | __be32 max_cmdsn; | ||
166 | uint8_t async_event; | ||
167 | uint8_t async_vcode; | ||
168 | __be16 param1; | ||
169 | __be16 param2; | ||
170 | __be16 param3; | ||
171 | uint8_t rsvd5[4]; | ||
172 | }; | ||
173 | |||
174 | /* iSCSI Event Codes */ | ||
175 | #define ISCSI_ASYNC_MSG_SCSI_EVENT 0 | ||
176 | #define ISCSI_ASYNC_MSG_REQUEST_LOGOUT 1 | ||
177 | #define ISCSI_ASYNC_MSG_DROPPING_CONNECTION 2 | ||
178 | #define ISCSI_ASYNC_MSG_DROPPING_ALL_CONNECTIONS 3 | ||
179 | #define ISCSI_ASYNC_MSG_PARAM_NEGOTIATION 4 | ||
180 | #define ISCSI_ASYNC_MSG_VENDOR_SPECIFIC 255 | ||
181 | |||
182 | /* NOP-Out Message */ | ||
183 | struct iscsi_nopout { | ||
184 | uint8_t opcode; | ||
185 | uint8_t flags; | ||
186 | __be16 rsvd2; | ||
187 | uint8_t rsvd3; | ||
188 | uint8_t dlength[3]; | ||
189 | uint8_t lun[8]; | ||
190 | __be32 itt; /* Initiator Task Tag */ | ||
191 | __be32 ttt; /* Target Transfer Tag */ | ||
192 | __be32 cmdsn; | ||
193 | __be32 exp_statsn; | ||
194 | uint8_t rsvd4[16]; | ||
195 | }; | ||
196 | |||
197 | /* NOP-In Message */ | ||
198 | struct iscsi_nopin { | ||
199 | uint8_t opcode; | ||
200 | uint8_t flags; | ||
201 | __be16 rsvd2; | ||
202 | uint8_t rsvd3; | ||
203 | uint8_t dlength[3]; | ||
204 | uint8_t lun[8]; | ||
205 | __be32 itt; /* Initiator Task Tag */ | ||
206 | __be32 ttt; /* Target Transfer Tag */ | ||
207 | __be32 statsn; | ||
208 | __be32 exp_cmdsn; | ||
209 | __be32 max_cmdsn; | ||
210 | uint8_t rsvd4[12]; | ||
211 | }; | ||
212 | |||
213 | /* SCSI Task Management Message Header */ | ||
214 | struct iscsi_tm { | ||
215 | uint8_t opcode; | ||
216 | uint8_t flags; | ||
217 | uint8_t rsvd1[2]; | ||
218 | uint8_t hlength; | ||
219 | uint8_t dlength[3]; | ||
220 | uint8_t lun[8]; | ||
221 | __be32 itt; /* Initiator Task Tag */ | ||
222 | __be32 rtt; /* Reference Task Tag */ | ||
223 | __be32 cmdsn; | ||
224 | __be32 exp_statsn; | ||
225 | __be32 refcmdsn; | ||
226 | __be32 exp_datasn; | ||
227 | uint8_t rsvd2[8]; | ||
228 | }; | ||
229 | |||
230 | #define ISCSI_FLAG_TASK_MGMT_FUNCTION_MASK 0x7F | ||
231 | |||
232 | /* Function values */ | ||
233 | #define ISCSI_TM_FUNC_ABORT_TASK 1 | ||
234 | #define ISCSI_TM_FUNC_ABORT_TASK_SET 2 | ||
235 | #define ISCSI_TM_FUNC_CLEAR_ACA 3 | ||
236 | #define ISCSI_TM_FUNC_CLEAR_TASK_SET 4 | ||
237 | #define ISCSI_TM_FUNC_LOGICAL_UNIT_RESET 5 | ||
238 | #define ISCSI_TM_FUNC_TARGET_WARM_RESET 6 | ||
239 | #define ISCSI_TM_FUNC_TARGET_COLD_RESET 7 | ||
240 | #define ISCSI_TM_FUNC_TASK_REASSIGN 8 | ||
241 | |||
242 | /* SCSI Task Management Response Header */ | ||
243 | struct iscsi_tm_rsp { | ||
244 | uint8_t opcode; | ||
245 | uint8_t flags; | ||
246 | uint8_t response; /* see Response values below */ | ||
247 | uint8_t qualifier; | ||
248 | uint8_t hlength; | ||
249 | uint8_t dlength[3]; | ||
250 | uint8_t rsvd2[8]; | ||
251 | __be32 itt; /* Initiator Task Tag */ | ||
252 | __be32 rtt; /* Reference Task Tag */ | ||
253 | __be32 statsn; | ||
254 | __be32 exp_cmdsn; | ||
255 | __be32 max_cmdsn; | ||
256 | uint8_t rsvd3[12]; | ||
257 | }; | ||
258 | |||
259 | /* Response values */ | ||
260 | #define SCSI_TCP_TM_RESP_COMPLETE 0x00 | ||
261 | #define SCSI_TCP_TM_RESP_NO_TASK 0x01 | ||
262 | #define SCSI_TCP_TM_RESP_NO_LUN 0x02 | ||
263 | #define SCSI_TCP_TM_RESP_TASK_ALLEGIANT 0x03 | ||
264 | #define SCSI_TCP_TM_RESP_NO_FAILOVER 0x04 | ||
265 | #define SCSI_TCP_TM_RESP_NOT_SUPPORTED 0x05 | ||
266 | #define SCSI_TCP_TM_RESP_AUTH_FAILED 0x06 | ||
267 | #define SCSI_TCP_TM_RESP_REJECTED 0xff | ||
268 | |||
269 | /* Ready To Transfer Header */ | ||
270 | struct iscsi_r2t_rsp { | ||
271 | uint8_t opcode; | ||
272 | uint8_t flags; | ||
273 | uint8_t rsvd2[2]; | ||
274 | uint8_t hlength; | ||
275 | uint8_t dlength[3]; | ||
276 | uint8_t lun[8]; | ||
277 | __be32 itt; /* Initiator Task Tag */ | ||
278 | __be32 ttt; /* Target Transfer Tag */ | ||
279 | __be32 statsn; | ||
280 | __be32 exp_cmdsn; | ||
281 | __be32 max_cmdsn; | ||
282 | __be32 r2tsn; | ||
283 | __be32 data_offset; | ||
284 | __be32 data_length; | ||
285 | }; | ||
286 | |||
287 | /* SCSI Data Hdr */ | ||
288 | struct iscsi_data { | ||
289 | uint8_t opcode; | ||
290 | uint8_t flags; | ||
291 | uint8_t rsvd2[2]; | ||
292 | uint8_t rsvd3; | ||
293 | uint8_t dlength[3]; | ||
294 | uint8_t lun[8]; | ||
295 | __be32 itt; | ||
296 | __be32 ttt; | ||
297 | __be32 rsvd4; | ||
298 | __be32 exp_statsn; | ||
299 | __be32 rsvd5; | ||
300 | __be32 datasn; | ||
301 | __be32 offset; | ||
302 | __be32 rsvd6; | ||
303 | /* Payload */ | ||
304 | }; | ||
305 | |||
306 | /* SCSI Data Response Hdr */ | ||
307 | struct iscsi_data_rsp { | ||
308 | uint8_t opcode; | ||
309 | uint8_t flags; | ||
310 | uint8_t rsvd2; | ||
311 | uint8_t cmd_status; | ||
312 | uint8_t hlength; | ||
313 | uint8_t dlength[3]; | ||
314 | uint8_t lun[8]; | ||
315 | __be32 itt; | ||
316 | __be32 ttt; | ||
317 | __be32 statsn; | ||
318 | __be32 exp_cmdsn; | ||
319 | __be32 max_cmdsn; | ||
320 | __be32 datasn; | ||
321 | __be32 offset; | ||
322 | __be32 residual_count; | ||
323 | }; | ||
324 | |||
325 | /* Data Response PDU flags */ | ||
326 | #define ISCSI_FLAG_DATA_ACK 0x40 | ||
327 | #define ISCSI_FLAG_DATA_OVERFLOW 0x04 | ||
328 | #define ISCSI_FLAG_DATA_UNDERFLOW 0x02 | ||
329 | #define ISCSI_FLAG_DATA_STATUS 0x01 | ||
330 | |||
331 | /* Text Header */ | ||
332 | struct iscsi_text { | ||
333 | uint8_t opcode; | ||
334 | uint8_t flags; | ||
335 | uint8_t rsvd2[2]; | ||
336 | uint8_t hlength; | ||
337 | uint8_t dlength[3]; | ||
338 | uint8_t rsvd4[8]; | ||
339 | __be32 itt; | ||
340 | __be32 ttt; | ||
341 | __be32 cmdsn; | ||
342 | __be32 exp_statsn; | ||
343 | uint8_t rsvd5[16]; | ||
344 | /* Text - key=value pairs */ | ||
345 | }; | ||
346 | |||
347 | #define ISCSI_FLAG_TEXT_CONTINUE 0x40 | ||
348 | |||
349 | /* Text Response Header */ | ||
350 | struct iscsi_text_rsp { | ||
351 | uint8_t opcode; | ||
352 | uint8_t flags; | ||
353 | uint8_t rsvd2[2]; | ||
354 | uint8_t hlength; | ||
355 | uint8_t dlength[3]; | ||
356 | uint8_t rsvd4[8]; | ||
357 | __be32 itt; | ||
358 | __be32 ttt; | ||
359 | __be32 statsn; | ||
360 | __be32 exp_cmdsn; | ||
361 | __be32 max_cmdsn; | ||
362 | uint8_t rsvd5[12]; | ||
363 | /* Text Response - key:value pairs */ | ||
364 | }; | ||
365 | |||
366 | /* Login Header */ | ||
367 | struct iscsi_login { | ||
368 | uint8_t opcode; | ||
369 | uint8_t flags; | ||
370 | uint8_t max_version; /* Max. version supported */ | ||
371 | uint8_t min_version; /* Min. version supported */ | ||
372 | uint8_t hlength; | ||
373 | uint8_t dlength[3]; | ||
374 | uint8_t isid[6]; /* Initiator Session ID */ | ||
375 | __be16 tsih; /* Target Session Handle */ | ||
376 | __be32 itt; /* Initiator Task Tag */ | ||
377 | __be16 cid; | ||
378 | __be16 rsvd3; | ||
379 | __be32 cmdsn; | ||
380 | __be32 exp_statsn; | ||
381 | uint8_t rsvd5[16]; | ||
382 | }; | ||
383 | |||
384 | /* Login PDU flags */ | ||
385 | #define ISCSI_FLAG_LOGIN_TRANSIT 0x80 | ||
386 | #define ISCSI_FLAG_LOGIN_CONTINUE 0x40 | ||
387 | #define ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK 0x0C /* 2 bits */ | ||
388 | #define ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK 0x03 /* 2 bits */ | ||
389 | |||
390 | #define ISCSI_LOGIN_CURRENT_STAGE(flags) \ | ||
391 | ((flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2) | ||
392 | #define ISCSI_LOGIN_NEXT_STAGE(flags) \ | ||
393 | (flags & ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK) | ||
394 | |||
395 | /* Login Response Header */ | ||
396 | struct iscsi_login_rsp { | ||
397 | uint8_t opcode; | ||
398 | uint8_t flags; | ||
399 | uint8_t max_version; /* Max. version supported */ | ||
400 | uint8_t active_version; /* Active version */ | ||
401 | uint8_t hlength; | ||
402 | uint8_t dlength[3]; | ||
403 | uint8_t isid[6]; /* Initiator Session ID */ | ||
404 | __be16 tsih; /* Target Session Handle */ | ||
405 | __be32 itt; /* Initiator Task Tag */ | ||
406 | __be32 rsvd3; | ||
407 | __be32 statsn; | ||
408 | __be32 exp_cmdsn; | ||
409 | __be32 max_cmdsn; | ||
410 | uint8_t status_class; /* see Login RSP ststus classes below */ | ||
411 | uint8_t status_detail; /* see Login RSP Status details below */ | ||
412 | uint8_t rsvd4[10]; | ||
413 | }; | ||
414 | |||
415 | /* Login stage (phase) codes for CSG, NSG */ | ||
416 | #define ISCSI_INITIAL_LOGIN_STAGE -1 | ||
417 | #define ISCSI_SECURITY_NEGOTIATION_STAGE 0 | ||
418 | #define ISCSI_OP_PARMS_NEGOTIATION_STAGE 1 | ||
419 | #define ISCSI_FULL_FEATURE_PHASE 3 | ||
420 | |||
421 | /* Login Status response classes */ | ||
422 | #define ISCSI_STATUS_CLS_SUCCESS 0x00 | ||
423 | #define ISCSI_STATUS_CLS_REDIRECT 0x01 | ||
424 | #define ISCSI_STATUS_CLS_INITIATOR_ERR 0x02 | ||
425 | #define ISCSI_STATUS_CLS_TARGET_ERR 0x03 | ||
426 | |||
427 | /* Login Status response detail codes */ | ||
428 | /* Class-0 (Success) */ | ||
429 | #define ISCSI_LOGIN_STATUS_ACCEPT 0x00 | ||
430 | |||
431 | /* Class-1 (Redirection) */ | ||
432 | #define ISCSI_LOGIN_STATUS_TGT_MOVED_TEMP 0x01 | ||
433 | #define ISCSI_LOGIN_STATUS_TGT_MOVED_PERM 0x02 | ||
434 | |||
435 | /* Class-2 (Initiator Error) */ | ||
436 | #define ISCSI_LOGIN_STATUS_INIT_ERR 0x00 | ||
437 | #define ISCSI_LOGIN_STATUS_AUTH_FAILED 0x01 | ||
438 | #define ISCSI_LOGIN_STATUS_TGT_FORBIDDEN 0x02 | ||
439 | #define ISCSI_LOGIN_STATUS_TGT_NOT_FOUND 0x03 | ||
440 | #define ISCSI_LOGIN_STATUS_TGT_REMOVED 0x04 | ||
441 | #define ISCSI_LOGIN_STATUS_NO_VERSION 0x05 | ||
442 | #define ISCSI_LOGIN_STATUS_ISID_ERROR 0x06 | ||
443 | #define ISCSI_LOGIN_STATUS_MISSING_FIELDS 0x07 | ||
444 | #define ISCSI_LOGIN_STATUS_CONN_ADD_FAILED 0x08 | ||
445 | #define ISCSI_LOGIN_STATUS_NO_SESSION_TYPE 0x09 | ||
446 | #define ISCSI_LOGIN_STATUS_NO_SESSION 0x0a | ||
447 | #define ISCSI_LOGIN_STATUS_INVALID_REQUEST 0x0b | ||
448 | |||
449 | /* Class-3 (Target Error) */ | ||
450 | #define ISCSI_LOGIN_STATUS_TARGET_ERROR 0x00 | ||
451 | #define ISCSI_LOGIN_STATUS_SVC_UNAVAILABLE 0x01 | ||
452 | #define ISCSI_LOGIN_STATUS_NO_RESOURCES 0x02 | ||
453 | |||
454 | /* Logout Header */ | ||
455 | struct iscsi_logout { | ||
456 | uint8_t opcode; | ||
457 | uint8_t flags; | ||
458 | uint8_t rsvd1[2]; | ||
459 | uint8_t hlength; | ||
460 | uint8_t dlength[3]; | ||
461 | uint8_t rsvd2[8]; | ||
462 | __be32 itt; /* Initiator Task Tag */ | ||
463 | __be16 cid; | ||
464 | uint8_t rsvd3[2]; | ||
465 | __be32 cmdsn; | ||
466 | __be32 exp_statsn; | ||
467 | uint8_t rsvd4[16]; | ||
468 | }; | ||
469 | |||
470 | /* Logout PDU flags */ | ||
471 | #define ISCSI_FLAG_LOGOUT_REASON_MASK 0x7F | ||
472 | |||
473 | /* logout reason_code values */ | ||
474 | |||
475 | #define ISCSI_LOGOUT_REASON_CLOSE_SESSION 0 | ||
476 | #define ISCSI_LOGOUT_REASON_CLOSE_CONNECTION 1 | ||
477 | #define ISCSI_LOGOUT_REASON_RECOVERY 2 | ||
478 | #define ISCSI_LOGOUT_REASON_AEN_REQUEST 3 | ||
479 | |||
480 | /* Logout Response Header */ | ||
481 | struct iscsi_logout_rsp { | ||
482 | uint8_t opcode; | ||
483 | uint8_t flags; | ||
484 | uint8_t response; /* see Logout response values below */ | ||
485 | uint8_t rsvd2; | ||
486 | uint8_t hlength; | ||
487 | uint8_t dlength[3]; | ||
488 | uint8_t rsvd3[8]; | ||
489 | __be32 itt; /* Initiator Task Tag */ | ||
490 | __be32 rsvd4; | ||
491 | __be32 statsn; | ||
492 | __be32 exp_cmdsn; | ||
493 | __be32 max_cmdsn; | ||
494 | __be32 rsvd5; | ||
495 | __be16 t2wait; | ||
496 | __be16 t2retain; | ||
497 | __be32 rsvd6; | ||
498 | }; | ||
499 | |||
500 | /* logout response status values */ | ||
501 | |||
502 | #define ISCSI_LOGOUT_SUCCESS 0 | ||
503 | #define ISCSI_LOGOUT_CID_NOT_FOUND 1 | ||
504 | #define ISCSI_LOGOUT_RECOVERY_UNSUPPORTED 2 | ||
505 | #define ISCSI_LOGOUT_CLEANUP_FAILED 3 | ||
506 | |||
507 | /* SNACK Header */ | ||
508 | struct iscsi_snack { | ||
509 | uint8_t opcode; | ||
510 | uint8_t flags; | ||
511 | uint8_t rsvd2[14]; | ||
512 | __be32 itt; | ||
513 | __be32 begrun; | ||
514 | __be32 runlength; | ||
515 | __be32 exp_statsn; | ||
516 | __be32 rsvd3; | ||
517 | __be32 exp_datasn; | ||
518 | uint8_t rsvd6[8]; | ||
519 | }; | ||
520 | |||
521 | /* SNACK PDU flags */ | ||
522 | #define ISCSI_FLAG_SNACK_TYPE_MASK 0x0F /* 4 bits */ | ||
523 | |||
524 | /* Reject Message Header */ | ||
525 | struct iscsi_reject { | ||
526 | uint8_t opcode; | ||
527 | uint8_t flags; | ||
528 | uint8_t reason; | ||
529 | uint8_t rsvd2; | ||
530 | uint8_t rsvd3; | ||
531 | uint8_t dlength[3]; | ||
532 | uint8_t rsvd4[16]; | ||
533 | __be32 statsn; | ||
534 | __be32 exp_cmdsn; | ||
535 | __be32 max_cmdsn; | ||
536 | __be32 datasn; | ||
537 | uint8_t rsvd5[8]; | ||
538 | /* Text - Rejected hdr */ | ||
539 | }; | ||
540 | |||
541 | /* Reason for Reject */ | ||
542 | #define CMD_BEFORE_LOGIN 1 | ||
543 | #define DATA_DIGEST_ERROR 2 | ||
544 | #define DATA_SNACK_REJECT 3 | ||
545 | #define ISCSI_PROTOCOL_ERROR 4 | ||
546 | #define CMD_NOT_SUPPORTED 5 | ||
547 | #define IMM_CMD_REJECT 6 | ||
548 | #define TASK_IN_PROGRESS 7 | ||
549 | #define INVALID_SNACK 8 | ||
550 | #define BOOKMARK_REJECTED 9 | ||
551 | #define BOOKMARK_NO_RESOURCES 10 | ||
552 | #define NEGOTIATION_RESET 11 | ||
553 | |||
554 | /* Max. number of Key=Value pairs in a text message */ | ||
555 | #define MAX_KEY_VALUE_PAIRS 8192 | ||
556 | |||
557 | /* maximum length for text keys/values */ | ||
558 | #define KEY_MAXLEN 64 | ||
559 | #define VALUE_MAXLEN 255 | ||
560 | #define TARGET_NAME_MAXLEN VALUE_MAXLEN | ||
561 | |||
562 | #define DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH 8192 | ||
563 | |||
564 | /************************* RFC 3720 End *****************************/ | ||
565 | |||
566 | #endif /* ISCSI_PROTO_H */ | ||