iPXE
iscsi.h
Go to the documentation of this file.
1#ifndef _IPXE_ISCSI_H
2#define _IPXE_ISCSI_H
3
4/** @file
5 *
6 * iSCSI protocol
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stdint.h>
14#include <ipxe/socket.h>
15#include <ipxe/scsi.h>
16#include <ipxe/chap.h>
17#include <ipxe/refcnt.h>
18#include <ipxe/xfer.h>
19#include <ipxe/process.h>
20#include <ipxe/acpi.h>
21#include <ipxe/settings.h>
22
23/** Default iSCSI port */
24#define ISCSI_PORT 3260
25
26/** Default iSCSI first burst length */
27#define ISCSI_FIRST_BURST_LEN 65536
28
29/** Default iSCSI maximum burst length */
30#define ISCSI_MAX_BURST_LEN 262144
31
32/** Default iSCSI maximum receive data segment length */
33#define ISCSI_MAX_RECV_DATA_SEG_LEN 8192
34
35/**
36 * iSCSI segment lengths
37 *
38 * iSCSI uses an icky structure with one one-byte field (a dword
39 * count) and one three-byte field (a byte count). This structure,
40 * and the accompanying macros, relieve some of the pain.
41 */
43 struct {
44 /** The AHS length (measured in dwords) */
46 /** The data length (measured in bytes), in network
47 * byte order
48 */
51 /** The data length (measured in bytes), in network byte
52 * order, with ahs_len as the first byte.
53 */
55};
56
57/** The length of the additional header segment, in dwords */
58#define ISCSI_AHS_LEN( segment_lengths ) \
59 ( (segment_lengths).bytes.ahs_len )
60
61/** The length of the data segment, in bytes, excluding any padding */
62#define ISCSI_DATA_LEN( segment_lengths ) \
63 ( ntohl ( (segment_lengths).ahs_and_data_len ) & 0xffffff )
64
65/** The padding of the data segment, in bytes */
66#define ISCSI_DATA_PAD_LEN( segment_lengths ) \
67 ( ( 0 - (segment_lengths).bytes.data_len[2] ) & 0x03 )
68
69/** Set additional header and data segment lengths */
70#define ISCSI_SET_LENGTHS( segment_lengths, ahs_len, data_len ) do { \
71 (segment_lengths).ahs_and_data_len = \
72 htonl ( data_len | ( ahs_len << 24 ) ); \
73 } while ( 0 )
74
75/**
76 * iSCSI basic header segment common fields
77 *
78 */
80 /** Opcode */
82 /** Flags */
84 /** Fields specific to the PDU type */
86 /** Segment lengths */
88 /** Fields specific to the PDU type */
90 /** Initiator Task Tag */
92 /** Fields specific to the PDU type */
94};
95
96/** Opcode mask */
97#define ISCSI_OPCODE_MASK 0x3f
98
99/** Immediate delivery */
100#define ISCSI_FLAG_IMMEDIATE 0x40
101
102/** Final PDU of a sequence */
103#define ISCSI_FLAG_FINAL 0x80
104
105/** iSCSI tag magic marker */
106#define ISCSI_TAG_MAGIC 0x18ae0000
107
108/** iSCSI reserved tag value */
109#define ISCSI_TAG_RESERVED 0xffffffff
110
111/**
112 * iSCSI basic header segment common request fields
113 *
114 */
116 /** Opcode */
118 /** Flags */
120 /** Fields specific to the PDU type */
122 /** Segment lengths */
124 /** Fields specific to the PDU type */
126 /** Initiator Task Tag */
128 /** Fields specific to the PDU type */
130 /** Status sequence number */
132 /** Expected command sequence number */
134 /** Fields specific to the PDU type */
136};
137
138/**
139 * iSCSI login request basic header segment
140 *
141 */
143 /** Opcode */
145 /** Flags */
147 /** Maximum supported version number */
149 /** Minimum supported version number */
151 /** Segment lengths */
153 /** Initiator session ID (IANA format) enterprise number and flags */
155 /** Initiator session ID (IANA format) qualifier */
157 /** Target session identifying handle */
159 /** Initiator Task Tag */
161 /** Connection ID */
163 /** Reserved */
165 /** Command sequence number */
167 /** Expected status sequence number */
169 /** Reserved */
171};
172
173/** Login request opcode */
174#define ISCSI_OPCODE_LOGIN_REQUEST 0x03
175
176/** Willingness to transition to next stage */
177#define ISCSI_LOGIN_FLAG_TRANSITION 0x80
178
179/** Key=value pairs continued in subsequent request */
180#define ISCSI_LOGIN_FLAG_CONTINUE 0x40
181
182/* Current stage values and mask */
183#define ISCSI_LOGIN_CSG_MASK 0x0c
184#define ISCSI_LOGIN_CSG_SECURITY_NEGOTIATION 0x00
185#define ISCSI_LOGIN_CSG_OPERATIONAL_NEGOTIATION 0x04
186#define ISCSI_LOGIN_CSG_FULL_FEATURE_PHASE 0x0c
187
188/* Next stage values and mask */
189#define ISCSI_LOGIN_NSG_MASK 0x03
190#define ISCSI_LOGIN_NSG_SECURITY_NEGOTIATION 0x00
191#define ISCSI_LOGIN_NSG_OPERATIONAL_NEGOTIATION 0x01
192#define ISCSI_LOGIN_NSG_FULL_FEATURE_PHASE 0x03
193
194/** ISID IANA format marker */
195#define ISCSI_ISID_IANA 0x40000000
196
197/** Fen Systems Ltd. IANA enterprise number
198 *
199 * Permission is hereby granted to use Fen Systems Ltd.'s IANA
200 * enterprise number with this iSCSI implementation.
201 */
202#define IANA_EN_FEN_SYSTEMS 10019
203
204/**
205 * iSCSI login response basic header segment
206 *
207 */
209 /** Opcode */
211 /** Flags */
213 /** Maximum supported version number */
215 /** Minimum supported version number */
217 /** Segment lengths */
219 /** Initiator session ID (IANA format) enterprise number and flags */
221 /** Initiator session ID (IANA format) qualifier */
223 /** Target session identifying handle */
225 /** Initiator Task Tag */
227 /** Reserved */
229 /** Status sequence number */
231 /** Expected command sequence number */
233 /** Maximum command sequence number */
235 /** Status class */
237 /** Status detail */
239 /** Reserved */
241};
242
243/** Login response opcode */
244#define ISCSI_OPCODE_LOGIN_RESPONSE 0x23
245
246/* Login response status codes */
247#define ISCSI_STATUS_SUCCESS 0x00
248#define ISCSI_STATUS_REDIRECT 0x01
249#define ISCSI_STATUS_INITIATOR_ERROR 0x02
250#define ISCSI_STATUS_INITIATOR_ERROR_AUTHENTICATION 0x01
251#define ISCSI_STATUS_INITIATOR_ERROR_AUTHORISATION 0x02
252#define ISCSI_STATUS_INITIATOR_ERROR_NOT_FOUND 0x03
253#define ISCSI_STATUS_INITIATOR_ERROR_REMOVED 0x04
254#define ISCSI_STATUS_TARGET_ERROR 0x03
255#define ISCSI_STATUS_TARGET_ERROR_UNAVAILABLE 0x01
256#define ISCSI_STATUS_TARGET_ERROR_NO_RESOURCES 0x02
257
258/**
259 * iSCSI SCSI command basic header segment
260 *
261 */
263 /** Opcode */
265 /** Flags */
267 /** Reserved */
269 /** Segment lengths */
271 /** SCSI Logical Unit Number */
272 struct scsi_lun lun;
273 /** Initiator Task Tag */
275 /** Expected data transfer length */
277 /** Command sequence number */
279 /** Expected status sequence number */
281 /** SCSI Command Descriptor Block (CDB) */
283};
284
285/** SCSI command opcode */
286#define ISCSI_OPCODE_SCSI_COMMAND 0x01
287
288/** Command will read data */
289#define ISCSI_COMMAND_FLAG_READ 0x40
290
291/** Command will write data */
292#define ISCSI_COMMAND_FLAG_WRITE 0x20
293
294/* Task attributes */
295#define ISCSI_COMMAND_ATTR_UNTAGGED 0x00
296#define ISCSI_COMMAND_ATTR_SIMPLE 0x01
297#define ISCSI_COMMAND_ATTR_ORDERED 0x02
298#define ISCSI_COMMAND_ATTR_HEAD_OF_QUEUE 0x03
299#define ISCSI_COMMAND_ATTR_ACA 0x04
300
301/**
302 * iSCSI SCSI response basic header segment
303 *
304 */
306 /** Opcode */
308 /** Flags */
310 /** Response code */
312 /** SCSI status code */
314 /** Segment lengths */
316 /** Reserved */
318 /** Initiator Task Tag */
320 /** SNACK tag */
322 /** Status sequence number */
324 /** Expected command sequence number */
326 /** Maximum command sequence number */
328 /** Expected data sequence number */
330 /** Bidirectional read residual count */
332 /** Residual count */
334};
335
336/** SCSI response opcode */
337#define ISCSI_OPCODE_SCSI_RESPONSE 0x21
338
339/** SCSI command completed at target */
340#define ISCSI_RESPONSE_COMMAND_COMPLETE 0x00
341
342/** SCSI target failure */
343#define ISCSI_RESPONSE_TARGET_FAILURE 0x01
344
345/** Data overflow occurred */
346#define ISCSI_RESPONSE_FLAG_OVERFLOW 0x20
347
348/** Data underflow occurred */
349#define ISCSI_RESPONSE_FLAG_UNDERFLOW 0x40
350
351/**
352 * iSCSI data-in basic header segment
353 *
354 */
356 /** Opcode */
358 /** Flags */
360 /** Reserved */
362 /** SCSI status code */
364 /** Segment lengths */
366 /** Logical Unit Number */
367 struct scsi_lun lun;
368 /** Initiator Task Tag */
370 /** Target Transfer Tag */
372 /** Status sequence number */
374 /** Expected command sequence number */
376 /** Maximum command sequence number */
378 /** Data sequence number */
380 /** Buffer offset */
382 /** Residual count */
384};
385
386/** Data-in opcode */
387#define ISCSI_OPCODE_DATA_IN 0x25
388
389/** Data requires acknowledgement */
390#define ISCSI_DATA_FLAG_ACKNOWLEDGE 0x40
391
392/** Data overflow occurred */
393#define ISCSI_DATA_FLAG_OVERFLOW 0x04
394
395/** Data underflow occurred */
396#define ISCSI_DATA_FLAG_UNDERFLOW 0x02
397
398/** SCSI status code and overflow/underflow flags are valid */
399#define ISCSI_DATA_FLAG_STATUS 0x01
400
401/**
402 * iSCSI data-out basic header segment
403 *
404 */
406 /** Opcode */
408 /** Flags */
410 /** Reserved */
412 /** Segment lengths */
414 /** Logical Unit Number */
415 struct scsi_lun lun;
416 /** Initiator Task Tag */
418 /** Target Transfer Tag */
420 /** Reserved */
422 /** Expected status sequence number */
424 /** Reserved */
426 /** Data sequence number */
428 /** Buffer offset */
430 /** Reserved */
432};
433
434/** Data-out opcode */
435#define ISCSI_OPCODE_DATA_OUT 0x05
436
437/**
438 * iSCSI request to transfer basic header segment
439 *
440 */
442 /** Opcode */
444 /** Flags */
446 /** Reserved */
448 /** Segment lengths */
450 /** Logical Unit Number */
451 struct scsi_lun lun;
452 /** Initiator Task Tag */
454 /** Target Transfer Tag */
456 /** Status sequence number */
458 /** Expected command sequence number */
460 /** Maximum command sequence number */
462 /** R2T sequence number */
464 /** Buffer offset */
466 /** Desired data transfer length */
468};
469
470/** R2T opcode */
471#define ISCSI_OPCODE_R2T 0x31
472
473/**
474 * iSCSI NOP-In basic header segment
475 *
476 */
478 /** Opcode */
480 /** Reserved */
482 /** Segment lengths */
484 /** Logical Unit Number */
485 struct scsi_lun lun;
486 /** Initiator Task Tag */
488 /** Target Transfer Tag */
490 /** Status sequence number */
492 /** Expected command sequence number */
494 /** Maximum command sequence number */
496 /** Reserved */
498};
499
500/** NOP-In opcode */
501#define ISCSI_OPCODE_NOP_IN 0x20
502
503/**
504 * An iSCSI basic header segment
505 */
519
520/** State of an iSCSI TX engine */
522 /** Nothing to send */
524 /** Sending the basic header segment */
526 /** Sending the additional header segment */
528 /** Sending the data segment */
530};
531
532/** State of an iSCSI RX engine */
534 /** Receiving the basic header segment */
536 /** Receiving the additional header segment */
538 /** Receiving the data segment */
540 /** Receiving the data segment padding */
542};
543
544/** An iSCSI session */
546 /** Reference counter */
548
549 /** SCSI command-issuing interface */
551 /** SCSI command interface */
553 /** Transport-layer socket */
555
556 /** Initiator IQN */
558 /** Target address */
560 /** Target port */
561 unsigned int target_port;
562 /** Target IQN */
564
565 /** Session status
566 *
567 * This is the bitwise-OR of zero or more ISCSI_STATUS_XXX
568 * constants.
569 */
571
572 /** Initiator username (if any) */
574 /** Initiator password (if any) */
576 /** Target username (if any) */
578 /** Target password (if any) */
580 /** CHAP challenge (for target auth only)
581 *
582 * This is a block of random data; the first byte is used as
583 * the CHAP identifier (CHAP_I) and the remainder as the CHAP
584 * challenge (CHAP_C).
585 */
586 unsigned char chap_challenge[17];
587 /** CHAP response (used for both initiator and target auth) */
589
590 /** Maximum burst length */
592
593 /** Initiator session ID (IANA format) qualifier
594 *
595 * This is part of the ISID. It is generated randomly
596 * whenever a new connection is opened.
597 */
599 /** Initiator task tag
600 *
601 * This is the tag of the current command. It is incremented
602 * whenever a new command is started.
603 */
605 /** Target transfer tag
606 *
607 * This is the tag attached to a sequence of data-out PDUs in
608 * response to an R2T.
609 */
611 /** Transfer offset
612 *
613 * This is the offset for an in-progress sequence of data-out
614 * PDUs in response to an R2T.
615 */
617 /** Transfer length
618 *
619 * This is the length for an in-progress sequence of data-out
620 * PDUs in response to an R2T.
621 */
623 /** Command sequence number
624 *
625 * This is the sequence number of the current command, used to
626 * fill out the CmdSN field in iSCSI request PDUs. It is
627 * updated with the value of the ExpCmdSN field whenever we
628 * receive an iSCSI response PDU containing such a field.
629 */
631 /** Status sequence number
632 *
633 * This is the most recent status sequence number present in
634 * the StatSN field of an iSCSI response PDU containing such a
635 * field. Whenever we send an iSCSI request PDU, we fill out
636 * the ExpStatSN field with this value plus one.
637 */
639
640 /** Basic header segment for current TX PDU */
642 /** State of the TX engine */
644 /** TX process */
646
647 /** Basic header segment for current RX PDU */
649 /** State of the RX engine */
651 /** Byte offset within the current RX state */
652 size_t rx_offset;
653 /** Length of the current RX state */
654 size_t rx_len;
655 /** Buffer for received data (not always used) */
657
658 /** Current SCSI command, if any */
660
661 /** Target socket address (for boot firmware table) */
663 /** SCSI LUN (for boot firmware table) */
664 struct scsi_lun lun;
665 /** ACPI descriptor */
667};
668
669/** iSCSI session is currently in the security negotiation phase */
670#define ISCSI_STATUS_SECURITY_NEGOTIATION_PHASE \
671 ( ISCSI_LOGIN_CSG_SECURITY_NEGOTIATION | \
672 ISCSI_LOGIN_NSG_OPERATIONAL_NEGOTIATION )
673
674/** iSCSI session is currently in the operational parameter
675 * negotiation phase
676 */
677#define ISCSI_STATUS_OPERATIONAL_NEGOTIATION_PHASE \
678 ( ISCSI_LOGIN_CSG_OPERATIONAL_NEGOTIATION | \
679 ISCSI_LOGIN_NSG_FULL_FEATURE_PHASE )
680
681/** iSCSI session is currently in the full feature phase */
682#define ISCSI_STATUS_FULL_FEATURE_PHASE ISCSI_LOGIN_CSG_FULL_FEATURE_PHASE
683
684/** Mask for all iSCSI session phases */
685#define ISCSI_STATUS_PHASE_MASK ( ISCSI_LOGIN_CSG_MASK | ISCSI_LOGIN_NSG_MASK )
686
687/** iSCSI session needs to send the initial security negotiation strings */
688#define ISCSI_STATUS_STRINGS_SECURITY 0x0100
689
690/** iSCSI session needs to send the CHAP_A string */
691#define ISCSI_STATUS_STRINGS_CHAP_ALGORITHM 0x0200
692
693/** iSCSI session needs to send the CHAP response */
694#define ISCSI_STATUS_STRINGS_CHAP_RESPONSE 0x0400
695
696/** iSCSI session needs to send the mutual CHAP challenge */
697#define ISCSI_STATUS_STRINGS_CHAP_CHALLENGE 0x0800
698
699/** iSCSI session needs to send the operational negotiation strings */
700#define ISCSI_STATUS_STRINGS_OPERATIONAL 0x1000
701
702/** Mask for all iSCSI "needs to send" flags */
703#define ISCSI_STATUS_STRINGS_MASK 0xff00
704
705/** Target has requested forward (initiator) authentication */
706#define ISCSI_STATUS_AUTH_FORWARD_REQUIRED 0x00010000
707
708/** Initiator requires target (reverse) authentication */
709#define ISCSI_STATUS_AUTH_REVERSE_REQUIRED 0x00020000
710
711/** Target authenticated itself correctly */
712#define ISCSI_STATUS_AUTH_REVERSE_OK 0x00040000
713
714/** Default initiator IQN prefix */
715#define ISCSI_DEFAULT_IQN_PREFIX "iqn.2010-04.org.ipxe"
716
717extern const struct setting
718initiator_iqn_setting __setting ( SETTING_SANBOOT_EXTRA, initiator-iqn );
719
720#endif /* _IPXE_ISCSI_H */
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
unsigned char uint8_t
Definition stdint.h:10
CHAP protocol.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define SETTING_SANBOOT_EXTRA
SAN boot additional settings.
Definition settings.h:75
uint8_t bytes[64]
Definition ib_mad.h:5
ACPI data structures.
Configuration settings.
#define __setting(setting_order, name)
Declare a configuration setting.
Definition settings.h:57
iscsi_rx_state
State of an iSCSI RX engine.
Definition iscsi.h:533
@ ISCSI_RX_AHS
Receiving the additional header segment.
Definition iscsi.h:537
@ ISCSI_RX_DATA
Receiving the data segment.
Definition iscsi.h:539
@ ISCSI_RX_BHS
Receiving the basic header segment.
Definition iscsi.h:535
@ ISCSI_RX_DATA_PADDING
Receiving the data segment padding.
Definition iscsi.h:541
iscsi_tx_state
State of an iSCSI TX engine.
Definition iscsi.h:521
@ ISCSI_TX_BHS
Sending the basic header segment.
Definition iscsi.h:525
@ ISCSI_TX_AHS
Sending the additional header segment.
Definition iscsi.h:527
@ ISCSI_TX_DATA
Sending the data segment.
Definition iscsi.h:529
@ ISCSI_TX_IDLE
Nothing to send.
Definition iscsi.h:523
Processes.
Reference counting.
SCSI devices.
Socket addresses.
An ACPI descriptor (used to construct ACPI tables)
Definition acpi.h:295
A CHAP response.
Definition chap.h:19
An object interface.
Definition interface.h:125
iSCSI basic header segment common request fields
Definition iscsi.h:115
uint8_t other_b[8]
Fields specific to the PDU type.
Definition iscsi.h:125
union iscsi_segment_lengths lengths
Segment lengths.
Definition iscsi.h:123
uint32_t itt
Initiator Task Tag.
Definition iscsi.h:127
uint8_t flags
Flags.
Definition iscsi.h:119
uint32_t expcmdsn
Expected command sequence number.
Definition iscsi.h:133
uint8_t other_d[16]
Fields specific to the PDU type.
Definition iscsi.h:135
uint8_t other_c[4]
Fields specific to the PDU type.
Definition iscsi.h:129
uint8_t opcode
Opcode.
Definition iscsi.h:117
uint32_t statsn
Status sequence number.
Definition iscsi.h:131
uint8_t other_a[2]
Fields specific to the PDU type.
Definition iscsi.h:121
iSCSI basic header segment common fields
Definition iscsi.h:79
uint8_t other_b[8]
Fields specific to the PDU type.
Definition iscsi.h:89
uint8_t other_a[2]
Fields specific to the PDU type.
Definition iscsi.h:85
uint8_t opcode
Opcode.
Definition iscsi.h:81
union iscsi_segment_lengths lengths
Segment lengths.
Definition iscsi.h:87
uint32_t itt
Initiator Task Tag.
Definition iscsi.h:91
uint8_t flags
Flags.
Definition iscsi.h:83
uint8_t other_c[28]
Fields specific to the PDU type.
Definition iscsi.h:93
iSCSI data-in basic header segment
Definition iscsi.h:355
struct scsi_lun lun
Logical Unit Number.
Definition iscsi.h:367
uint32_t maxcmdsn
Maximum command sequence number.
Definition iscsi.h:377
uint32_t ttt
Target Transfer Tag.
Definition iscsi.h:371
uint32_t expcmdsn
Expected command sequence number.
Definition iscsi.h:375
uint8_t opcode
Opcode.
Definition iscsi.h:357
uint8_t reserved_a
Reserved.
Definition iscsi.h:361
uint32_t itt
Initiator Task Tag.
Definition iscsi.h:369
uint32_t offset
Buffer offset.
Definition iscsi.h:381
uint32_t datasn
Data sequence number.
Definition iscsi.h:379
uint32_t statsn
Status sequence number.
Definition iscsi.h:373
uint8_t status
SCSI status code.
Definition iscsi.h:363
uint8_t flags
Flags.
Definition iscsi.h:359
union iscsi_segment_lengths lengths
Segment lengths.
Definition iscsi.h:365
uint32_t residual_count
Residual count.
Definition iscsi.h:383
iSCSI data-out basic header segment
Definition iscsi.h:405
uint8_t opcode
Opcode.
Definition iscsi.h:407
uint32_t reserved_b
Reserved.
Definition iscsi.h:421
uint32_t reserved_c
Reserved.
Definition iscsi.h:425
union iscsi_segment_lengths lengths
Segment lengths.
Definition iscsi.h:413
uint32_t datasn
Data sequence number.
Definition iscsi.h:427
struct scsi_lun lun
Logical Unit Number.
Definition iscsi.h:415
uint32_t itt
Initiator Task Tag.
Definition iscsi.h:417
uint32_t expstatsn
Expected status sequence number.
Definition iscsi.h:423
uint32_t reserved_d
Reserved.
Definition iscsi.h:431
uint32_t ttt
Target Transfer Tag.
Definition iscsi.h:419
uint32_t offset
Buffer offset.
Definition iscsi.h:429
uint16_t reserved_a
Reserved.
Definition iscsi.h:411
uint8_t flags
Flags.
Definition iscsi.h:409
iSCSI login request basic header segment
Definition iscsi.h:142
uint8_t reserved_b[16]
Reserved.
Definition iscsi.h:170
uint32_t cmdsn
Command sequence number.
Definition iscsi.h:166
uint16_t reserved_a
Reserved.
Definition iscsi.h:164
uint8_t version_max
Maximum supported version number.
Definition iscsi.h:148
uint8_t version_min
Minimum supported version number.
Definition iscsi.h:150
uint32_t expstatsn
Expected status sequence number.
Definition iscsi.h:168
uint8_t opcode
Opcode.
Definition iscsi.h:144
uint32_t itt
Initiator Task Tag.
Definition iscsi.h:160
union iscsi_segment_lengths lengths
Segment lengths.
Definition iscsi.h:152
uint16_t isid_iana_qual
Initiator session ID (IANA format) qualifier.
Definition iscsi.h:156
uint32_t isid_iana_en
Initiator session ID (IANA format) enterprise number and flags.
Definition iscsi.h:154
uint16_t cid
Connection ID.
Definition iscsi.h:162
uint16_t tsih
Target session identifying handle.
Definition iscsi.h:158
uint8_t flags
Flags.
Definition iscsi.h:146
iSCSI login response basic header segment
Definition iscsi.h:208
uint8_t version_min
Minimum supported version number.
Definition iscsi.h:216
uint8_t opcode
Opcode.
Definition iscsi.h:210
uint32_t statsn
Status sequence number.
Definition iscsi.h:230
uint8_t version_max
Maximum supported version number.
Definition iscsi.h:214
uint32_t expcmdsn
Expected command sequence number.
Definition iscsi.h:232
uint8_t status_detail
Status detail.
Definition iscsi.h:238
uint16_t isid_iana_qual
Initiator session ID (IANA format) qualifier.
Definition iscsi.h:222
uint8_t status_class
Status class.
Definition iscsi.h:236
union iscsi_segment_lengths lengths
Segment lengths.
Definition iscsi.h:218
uint8_t flags
Flags.
Definition iscsi.h:212
uint32_t maxcmdsn
Maximum command sequence number.
Definition iscsi.h:234
uint16_t tsih
Target session identifying handle.
Definition iscsi.h:224
uint32_t isid_iana_en
Initiator session ID (IANA format) enterprise number and flags.
Definition iscsi.h:220
uint8_t reserved_b[10]
Reserved.
Definition iscsi.h:240
uint32_t itt
Initiator Task Tag.
Definition iscsi.h:226
uint32_t reserved_a
Reserved.
Definition iscsi.h:228
iSCSI request to transfer basic header segment
Definition iscsi.h:441
uint32_t maxcmdsn
Maximum command sequence number.
Definition iscsi.h:461
union iscsi_segment_lengths lengths
Segment lengths.
Definition iscsi.h:449
struct scsi_lun lun
Logical Unit Number.
Definition iscsi.h:451
uint32_t statsn
Status sequence number.
Definition iscsi.h:457
uint16_t reserved_a
Reserved.
Definition iscsi.h:447
uint32_t itt
Initiator Task Tag.
Definition iscsi.h:453
uint32_t ttt
Target Transfer Tag.
Definition iscsi.h:455
uint32_t len
Desired data transfer length.
Definition iscsi.h:467
uint32_t expcmdsn
Expected command sequence number.
Definition iscsi.h:459
uint8_t flags
Flags.
Definition iscsi.h:445
uint8_t opcode
Opcode.
Definition iscsi.h:443
uint32_t offset
Buffer offset.
Definition iscsi.h:465
uint32_t r2tsn
R2T sequence number.
Definition iscsi.h:463
iSCSI SCSI command basic header segment
Definition iscsi.h:262
union scsi_cdb cdb
SCSI Command Descriptor Block (CDB)
Definition iscsi.h:282
uint8_t opcode
Opcode.
Definition iscsi.h:264
uint16_t reserved_a
Reserved.
Definition iscsi.h:268
uint32_t exp_len
Expected data transfer length.
Definition iscsi.h:276
struct scsi_lun lun
SCSI Logical Unit Number.
Definition iscsi.h:272
uint32_t expstatsn
Expected status sequence number.
Definition iscsi.h:280
union iscsi_segment_lengths lengths
Segment lengths.
Definition iscsi.h:270
uint32_t cmdsn
Command sequence number.
Definition iscsi.h:278
uint32_t itt
Initiator Task Tag.
Definition iscsi.h:274
uint8_t flags
Flags.
Definition iscsi.h:266
iSCSI SCSI response basic header segment
Definition iscsi.h:305
uint32_t itt
Initiator Task Tag.
Definition iscsi.h:319
uint32_t bidi_residual_count
Bidirectional read residual count.
Definition iscsi.h:331
uint8_t opcode
Opcode.
Definition iscsi.h:307
uint32_t snack
SNACK tag.
Definition iscsi.h:321
uint8_t status
SCSI status code.
Definition iscsi.h:313
uint32_t residual_count
Residual count.
Definition iscsi.h:333
uint8_t response
Response code.
Definition iscsi.h:311
uint32_t expcmdsn
Expected command sequence number.
Definition iscsi.h:325
uint32_t maxcmdsn
Maximum command sequence number.
Definition iscsi.h:327
uint32_t expdatasn
Expected data sequence number.
Definition iscsi.h:329
uint8_t flags
Flags.
Definition iscsi.h:309
uint8_t reserved_a[8]
Reserved.
Definition iscsi.h:317
union iscsi_segment_lengths lengths
Segment lengths.
Definition iscsi.h:315
uint32_t statsn
Status sequence number.
Definition iscsi.h:323
iSCSI NOP-In basic header segment
Definition iscsi.h:477
uint32_t expcmdsn
Expected command sequence number.
Definition iscsi.h:493
uint8_t opcode
Opcode.
Definition iscsi.h:479
uint8_t reserved_b[12]
Reserved.
Definition iscsi.h:497
uint32_t maxcmdsn
Maximum command sequence number.
Definition iscsi.h:495
struct scsi_lun lun
Logical Unit Number.
Definition iscsi.h:485
uint32_t statsn
Status sequence number.
Definition iscsi.h:491
uint8_t reserved_a[3]
Reserved.
Definition iscsi.h:481
uint32_t ttt
Target Transfer Tag.
Definition iscsi.h:489
union iscsi_segment_lengths lengths
Segment lengths.
Definition iscsi.h:483
uint32_t itt
Initiator Task Tag.
Definition iscsi.h:487
An iSCSI session.
Definition iscsi.h:545
void * rx_buffer
Buffer for received data (not always used)
Definition iscsi.h:656
char * target_iqn
Target IQN.
Definition iscsi.h:563
char * initiator_password
Initiator password (if any)
Definition iscsi.h:575
union iscsi_bhs tx_bhs
Basic header segment for current TX PDU.
Definition iscsi.h:641
uint32_t cmdsn
Command sequence number.
Definition iscsi.h:630
uint32_t ttt
Target transfer tag.
Definition iscsi.h:610
enum iscsi_rx_state rx_state
State of the RX engine.
Definition iscsi.h:650
struct scsi_lun lun
SCSI LUN (for boot firmware table)
Definition iscsi.h:664
uint32_t transfer_len
Transfer length.
Definition iscsi.h:622
char * target_password
Target password (if any)
Definition iscsi.h:579
unsigned char chap_challenge[17]
CHAP challenge (for target auth only)
Definition iscsi.h:586
uint32_t transfer_offset
Transfer offset.
Definition iscsi.h:616
union iscsi_bhs rx_bhs
Basic header segment for current RX PDU.
Definition iscsi.h:648
struct refcnt refcnt
Reference counter.
Definition iscsi.h:547
struct sockaddr target_sockaddr
Target socket address (for boot firmware table)
Definition iscsi.h:662
size_t max_burst_len
Maximum burst length.
Definition iscsi.h:591
size_t rx_offset
Byte offset within the current RX state.
Definition iscsi.h:652
char * initiator_username
Initiator username (if any)
Definition iscsi.h:573
char * initiator_iqn
Initiator IQN.
Definition iscsi.h:557
struct interface control
SCSI command-issuing interface.
Definition iscsi.h:550
enum iscsi_tx_state tx_state
State of the TX engine.
Definition iscsi.h:643
char * target_username
Target username (if any)
Definition iscsi.h:577
uint32_t itt
Initiator task tag.
Definition iscsi.h:604
struct chap_response chap
CHAP response (used for both initiator and target auth)
Definition iscsi.h:588
uint16_t isid_iana_qual
Initiator session ID (IANA format) qualifier.
Definition iscsi.h:598
int status
Session status.
Definition iscsi.h:570
uint32_t statsn
Status sequence number.
Definition iscsi.h:638
unsigned int target_port
Target port.
Definition iscsi.h:561
struct interface data
SCSI command interface.
Definition iscsi.h:552
size_t rx_len
Length of the current RX state.
Definition iscsi.h:654
struct process process
TX process.
Definition iscsi.h:645
struct scsi_cmd * command
Current SCSI command, if any.
Definition iscsi.h:659
struct acpi_descriptor desc
ACPI descriptor.
Definition iscsi.h:666
char * target_address
Target address.
Definition iscsi.h:559
struct interface socket
Transport-layer socket.
Definition iscsi.h:554
A SCSI command information unit.
Definition scsi.h:249
A SCSI LUN.
Definition scsi.h:236
A setting.
Definition settings.h:24
Generalized socket address structure.
Definition socket.h:97
An iSCSI basic header segment.
Definition iscsi.h:506
struct iscsi_bhs_r2t r2t
Definition iscsi.h:515
struct iscsi_bhs_data_in data_in
Definition iscsi.h:513
unsigned char bytes[sizeof(struct iscsi_bhs_common)]
Definition iscsi.h:517
struct iscsi_bhs_login_request login_request
Definition iscsi.h:509
struct iscsi_bhs_common common
Definition iscsi.h:507
struct iscsi_bhs_scsi_response scsi_response
Definition iscsi.h:512
struct iscsi_bhs_scsi_command scsi_command
Definition iscsi.h:511
struct iscsi_bhs_common_response common_response
Definition iscsi.h:508
struct iscsi_nop_in nop_in
Definition iscsi.h:516
struct iscsi_bhs_login_response login_response
Definition iscsi.h:510
struct iscsi_bhs_data_out data_out
Definition iscsi.h:514
iSCSI segment lengths
Definition iscsi.h:42
uint32_t ahs_and_data_len
The data length (measured in bytes), in network byte order, with ahs_len as the first byte.
Definition iscsi.h:54
uint8_t data_len[3]
The data length (measured in bytes), in network byte order.
Definition iscsi.h:49
uint8_t ahs_len
The AHS length (measured in dwords)
Definition iscsi.h:45
A SCSI Command Data Block.
Definition scsi.h:207
Data transfer interfaces.