diff options
Diffstat (limited to 'include/scsi/iscsi_proto.h')
-rw-r--r-- | include/scsi/iscsi_proto.h | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h index 02f6e4b9e693..4a44278ed768 100644 --- a/include/scsi/iscsi_proto.h +++ b/include/scsi/iscsi_proto.h | |||
@@ -40,6 +40,14 @@ | |||
40 | } | 40 | } |
41 | #define zero_data(p) {p[0]=0;p[1]=0;p[2]=0;} | 41 | #define zero_data(p) {p[0]=0;p[1]=0;p[2]=0;} |
42 | 42 | ||
43 | /* initiator tags; opaque for target */ | ||
44 | typedef uint32_t __bitwise__ itt_t; | ||
45 | /* below makes sense only for initiator that created this tag */ | ||
46 | #define build_itt(itt, id, age) ((__force itt_t)\ | ||
47 | ((itt) | ((id) << ISCSI_CID_SHIFT) | ((age) << ISCSI_AGE_SHIFT))) | ||
48 | #define get_itt(itt) ((__force uint32_t)(itt_t)(itt) & ISCSI_ITT_MASK) | ||
49 | #define RESERVED_ITT ((__force itt_t)0xffffffff) | ||
50 | |||
43 | /* | 51 | /* |
44 | * iSCSI Template Message Header | 52 | * iSCSI Template Message Header |
45 | */ | 53 | */ |
@@ -50,7 +58,7 @@ struct iscsi_hdr { | |||
50 | uint8_t hlength; /* AHSs total length */ | 58 | uint8_t hlength; /* AHSs total length */ |
51 | uint8_t dlength[3]; /* Data length */ | 59 | uint8_t dlength[3]; /* Data length */ |
52 | uint8_t lun[8]; | 60 | uint8_t lun[8]; |
53 | __be32 itt; /* Initiator Task Tag */ | 61 | itt_t itt; /* Initiator Task Tag, opaque for target */ |
54 | __be32 ttt; /* Target Task Tag */ | 62 | __be32 ttt; /* Target Task Tag */ |
55 | __be32 statsn; | 63 | __be32 statsn; |
56 | __be32 exp_statsn; | 64 | __be32 exp_statsn; |
@@ -111,7 +119,7 @@ struct iscsi_cmd { | |||
111 | uint8_t hlength; | 119 | uint8_t hlength; |
112 | uint8_t dlength[3]; | 120 | uint8_t dlength[3]; |
113 | uint8_t lun[8]; | 121 | uint8_t lun[8]; |
114 | __be32 itt; /* Initiator Task Tag */ | 122 | itt_t itt; /* Initiator Task Tag */ |
115 | __be32 data_length; | 123 | __be32 data_length; |
116 | __be32 cmdsn; | 124 | __be32 cmdsn; |
117 | __be32 exp_statsn; | 125 | __be32 exp_statsn; |
@@ -148,7 +156,7 @@ struct iscsi_cmd_rsp { | |||
148 | uint8_t hlength; | 156 | uint8_t hlength; |
149 | uint8_t dlength[3]; | 157 | uint8_t dlength[3]; |
150 | uint8_t rsvd[8]; | 158 | uint8_t rsvd[8]; |
151 | __be32 itt; /* Initiator Task Tag */ | 159 | itt_t itt; /* Initiator Task Tag */ |
152 | __be32 rsvd1; | 160 | __be32 rsvd1; |
153 | __be32 statsn; | 161 | __be32 statsn; |
154 | __be32 exp_cmdsn; | 162 | __be32 exp_cmdsn; |
@@ -206,7 +214,7 @@ struct iscsi_nopout { | |||
206 | uint8_t rsvd3; | 214 | uint8_t rsvd3; |
207 | uint8_t dlength[3]; | 215 | uint8_t dlength[3]; |
208 | uint8_t lun[8]; | 216 | uint8_t lun[8]; |
209 | __be32 itt; /* Initiator Task Tag */ | 217 | itt_t itt; /* Initiator Task Tag */ |
210 | __be32 ttt; /* Target Transfer Tag */ | 218 | __be32 ttt; /* Target Transfer Tag */ |
211 | __be32 cmdsn; | 219 | __be32 cmdsn; |
212 | __be32 exp_statsn; | 220 | __be32 exp_statsn; |
@@ -221,7 +229,7 @@ struct iscsi_nopin { | |||
221 | uint8_t rsvd3; | 229 | uint8_t rsvd3; |
222 | uint8_t dlength[3]; | 230 | uint8_t dlength[3]; |
223 | uint8_t lun[8]; | 231 | uint8_t lun[8]; |
224 | __be32 itt; /* Initiator Task Tag */ | 232 | itt_t itt; /* Initiator Task Tag */ |
225 | __be32 ttt; /* Target Transfer Tag */ | 233 | __be32 ttt; /* Target Transfer Tag */ |
226 | __be32 statsn; | 234 | __be32 statsn; |
227 | __be32 exp_cmdsn; | 235 | __be32 exp_cmdsn; |
@@ -237,8 +245,8 @@ struct iscsi_tm { | |||
237 | uint8_t hlength; | 245 | uint8_t hlength; |
238 | uint8_t dlength[3]; | 246 | uint8_t dlength[3]; |
239 | uint8_t lun[8]; | 247 | uint8_t lun[8]; |
240 | __be32 itt; /* Initiator Task Tag */ | 248 | itt_t itt; /* Initiator Task Tag */ |
241 | __be32 rtt; /* Reference Task Tag */ | 249 | itt_t rtt; /* Reference Task Tag */ |
242 | __be32 cmdsn; | 250 | __be32 cmdsn; |
243 | __be32 exp_statsn; | 251 | __be32 exp_statsn; |
244 | __be32 refcmdsn; | 252 | __be32 refcmdsn; |
@@ -267,8 +275,8 @@ struct iscsi_tm_rsp { | |||
267 | uint8_t hlength; | 275 | uint8_t hlength; |
268 | uint8_t dlength[3]; | 276 | uint8_t dlength[3]; |
269 | uint8_t rsvd2[8]; | 277 | uint8_t rsvd2[8]; |
270 | __be32 itt; /* Initiator Task Tag */ | 278 | itt_t itt; /* Initiator Task Tag */ |
271 | __be32 rtt; /* Reference Task Tag */ | 279 | itt_t rtt; /* Reference Task Tag */ |
272 | __be32 statsn; | 280 | __be32 statsn; |
273 | __be32 exp_cmdsn; | 281 | __be32 exp_cmdsn; |
274 | __be32 max_cmdsn; | 282 | __be32 max_cmdsn; |
@@ -293,7 +301,7 @@ struct iscsi_r2t_rsp { | |||
293 | uint8_t hlength; | 301 | uint8_t hlength; |
294 | uint8_t dlength[3]; | 302 | uint8_t dlength[3]; |
295 | uint8_t lun[8]; | 303 | uint8_t lun[8]; |
296 | __be32 itt; /* Initiator Task Tag */ | 304 | itt_t itt; /* Initiator Task Tag */ |
297 | __be32 ttt; /* Target Transfer Tag */ | 305 | __be32 ttt; /* Target Transfer Tag */ |
298 | __be32 statsn; | 306 | __be32 statsn; |
299 | __be32 exp_cmdsn; | 307 | __be32 exp_cmdsn; |
@@ -311,7 +319,7 @@ struct iscsi_data { | |||
311 | uint8_t rsvd3; | 319 | uint8_t rsvd3; |
312 | uint8_t dlength[3]; | 320 | uint8_t dlength[3]; |
313 | uint8_t lun[8]; | 321 | uint8_t lun[8]; |
314 | __be32 itt; | 322 | itt_t itt; |
315 | __be32 ttt; | 323 | __be32 ttt; |
316 | __be32 rsvd4; | 324 | __be32 rsvd4; |
317 | __be32 exp_statsn; | 325 | __be32 exp_statsn; |
@@ -331,7 +339,7 @@ struct iscsi_data_rsp { | |||
331 | uint8_t hlength; | 339 | uint8_t hlength; |
332 | uint8_t dlength[3]; | 340 | uint8_t dlength[3]; |
333 | uint8_t lun[8]; | 341 | uint8_t lun[8]; |
334 | __be32 itt; | 342 | itt_t itt; |
335 | __be32 ttt; | 343 | __be32 ttt; |
336 | __be32 statsn; | 344 | __be32 statsn; |
337 | __be32 exp_cmdsn; | 345 | __be32 exp_cmdsn; |
@@ -355,7 +363,7 @@ struct iscsi_text { | |||
355 | uint8_t hlength; | 363 | uint8_t hlength; |
356 | uint8_t dlength[3]; | 364 | uint8_t dlength[3]; |
357 | uint8_t rsvd4[8]; | 365 | uint8_t rsvd4[8]; |
358 | __be32 itt; | 366 | itt_t itt; |
359 | __be32 ttt; | 367 | __be32 ttt; |
360 | __be32 cmdsn; | 368 | __be32 cmdsn; |
361 | __be32 exp_statsn; | 369 | __be32 exp_statsn; |
@@ -373,7 +381,7 @@ struct iscsi_text_rsp { | |||
373 | uint8_t hlength; | 381 | uint8_t hlength; |
374 | uint8_t dlength[3]; | 382 | uint8_t dlength[3]; |
375 | uint8_t rsvd4[8]; | 383 | uint8_t rsvd4[8]; |
376 | __be32 itt; | 384 | itt_t itt; |
377 | __be32 ttt; | 385 | __be32 ttt; |
378 | __be32 statsn; | 386 | __be32 statsn; |
379 | __be32 exp_cmdsn; | 387 | __be32 exp_cmdsn; |
@@ -392,7 +400,7 @@ struct iscsi_login { | |||
392 | uint8_t dlength[3]; | 400 | uint8_t dlength[3]; |
393 | uint8_t isid[6]; /* Initiator Session ID */ | 401 | uint8_t isid[6]; /* Initiator Session ID */ |
394 | __be16 tsih; /* Target Session Handle */ | 402 | __be16 tsih; /* Target Session Handle */ |
395 | __be32 itt; /* Initiator Task Tag */ | 403 | itt_t itt; /* Initiator Task Tag */ |
396 | __be16 cid; | 404 | __be16 cid; |
397 | __be16 rsvd3; | 405 | __be16 rsvd3; |
398 | __be32 cmdsn; | 406 | __be32 cmdsn; |
@@ -421,7 +429,7 @@ struct iscsi_login_rsp { | |||
421 | uint8_t dlength[3]; | 429 | uint8_t dlength[3]; |
422 | uint8_t isid[6]; /* Initiator Session ID */ | 430 | uint8_t isid[6]; /* Initiator Session ID */ |
423 | __be16 tsih; /* Target Session Handle */ | 431 | __be16 tsih; /* Target Session Handle */ |
424 | __be32 itt; /* Initiator Task Tag */ | 432 | itt_t itt; /* Initiator Task Tag */ |
425 | __be32 rsvd3; | 433 | __be32 rsvd3; |
426 | __be32 statsn; | 434 | __be32 statsn; |
427 | __be32 exp_cmdsn; | 435 | __be32 exp_cmdsn; |
@@ -478,7 +486,7 @@ struct iscsi_logout { | |||
478 | uint8_t hlength; | 486 | uint8_t hlength; |
479 | uint8_t dlength[3]; | 487 | uint8_t dlength[3]; |
480 | uint8_t rsvd2[8]; | 488 | uint8_t rsvd2[8]; |
481 | __be32 itt; /* Initiator Task Tag */ | 489 | itt_t itt; /* Initiator Task Tag */ |
482 | __be16 cid; | 490 | __be16 cid; |
483 | uint8_t rsvd3[2]; | 491 | uint8_t rsvd3[2]; |
484 | __be32 cmdsn; | 492 | __be32 cmdsn; |
@@ -505,7 +513,7 @@ struct iscsi_logout_rsp { | |||
505 | uint8_t hlength; | 513 | uint8_t hlength; |
506 | uint8_t dlength[3]; | 514 | uint8_t dlength[3]; |
507 | uint8_t rsvd3[8]; | 515 | uint8_t rsvd3[8]; |
508 | __be32 itt; /* Initiator Task Tag */ | 516 | itt_t itt; /* Initiator Task Tag */ |
509 | __be32 rsvd4; | 517 | __be32 rsvd4; |
510 | __be32 statsn; | 518 | __be32 statsn; |
511 | __be32 exp_cmdsn; | 519 | __be32 exp_cmdsn; |
@@ -528,7 +536,7 @@ struct iscsi_snack { | |||
528 | uint8_t opcode; | 536 | uint8_t opcode; |
529 | uint8_t flags; | 537 | uint8_t flags; |
530 | uint8_t rsvd2[14]; | 538 | uint8_t rsvd2[14]; |
531 | __be32 itt; | 539 | itt_t itt; |
532 | __be32 begrun; | 540 | __be32 begrun; |
533 | __be32 runlength; | 541 | __be32 runlength; |
534 | __be32 exp_statsn; | 542 | __be32 exp_statsn; |