You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

iscsi.h 17KB

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