iscsi_proto.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  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. #ifndef ISCSI_PROTO_H
  21. #define ISCSI_PROTO_H
  22. #define ISCSI_VERSION_STR "0.3"
  23. #define ISCSI_DATE_STR "22-Apr-2005"
  24. #define ISCSI_DRAFT20_VERSION 0x00
  25. /* default iSCSI listen port for incoming connections */
  26. #define ISCSI_LISTEN_PORT 3260
  27. /* Padding word length */
  28. #define PAD_WORD_LEN 4
  29. /*
  30. * useful common(control and data pathes) macro
  31. */
  32. #define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2]))
  33. #define hton24(p, v) { \
  34. p[0] = (((v) >> 16) & 0xFF); \
  35. p[1] = (((v) >> 8) & 0xFF); \
  36. p[2] = ((v) & 0xFF); \
  37. }
  38. #define zero_data(p) {p[0]=0;p[1]=0;p[2]=0;}
  39. /*
  40. * iSCSI Template Message Header
  41. */
  42. struct iscsi_hdr {
  43. uint8_t opcode;
  44. uint8_t flags; /* Final bit */
  45. uint8_t rsvd2[2];
  46. uint8_t hlength; /* AHSs total length */
  47. uint8_t dlength[3]; /* Data length */
  48. uint8_t lun[8];
  49. __be32 itt; /* Initiator Task Tag */
  50. __be32 ttt; /* Target Task Tag */
  51. __be32 statsn;
  52. __be32 exp_statsn;
  53. __be32 max_statsn;
  54. uint8_t other[12];
  55. };
  56. /************************* RFC 3720 Begin *****************************/
  57. #define ISCSI_RESERVED_TAG 0xffffffff
  58. /* Opcode encoding bits */
  59. #define ISCSI_OP_RETRY 0x80
  60. #define ISCSI_OP_IMMEDIATE 0x40
  61. #define ISCSI_OPCODE_MASK 0x3F
  62. /* Initiator Opcode values */
  63. #define ISCSI_OP_NOOP_OUT 0x00
  64. #define ISCSI_OP_SCSI_CMD 0x01
  65. #define ISCSI_OP_SCSI_TMFUNC 0x02
  66. #define ISCSI_OP_LOGIN 0x03
  67. #define ISCSI_OP_TEXT 0x04
  68. #define ISCSI_OP_SCSI_DATA_OUT 0x05
  69. #define ISCSI_OP_LOGOUT 0x06
  70. #define ISCSI_OP_SNACK 0x10
  71. #define ISCSI_OP_VENDOR1_CMD 0x1c
  72. #define ISCSI_OP_VENDOR2_CMD 0x1d
  73. #define ISCSI_OP_VENDOR3_CMD 0x1e
  74. #define ISCSI_OP_VENDOR4_CMD 0x1f
  75. /* Target Opcode values */
  76. #define ISCSI_OP_NOOP_IN 0x20
  77. #define ISCSI_OP_SCSI_CMD_RSP 0x21
  78. #define ISCSI_OP_SCSI_TMFUNC_RSP 0x22
  79. #define ISCSI_OP_LOGIN_RSP 0x23
  80. #define ISCSI_OP_TEXT_RSP 0x24
  81. #define ISCSI_OP_SCSI_DATA_IN 0x25
  82. #define ISCSI_OP_LOGOUT_RSP 0x26
  83. #define ISCSI_OP_R2T 0x31
  84. #define ISCSI_OP_ASYNC_EVENT 0x32
  85. #define ISCSI_OP_REJECT 0x3f
  86. struct iscsi_ahs_hdr {
  87. __be16 ahslength;
  88. uint8_t ahstype;
  89. uint8_t ahspec[5];
  90. };
  91. #define ISCSI_AHSTYPE_CDB 1
  92. #define ISCSI_AHSTYPE_RLENGTH 2
  93. /* iSCSI PDU Header */
  94. struct iscsi_cmd {
  95. uint8_t opcode;
  96. uint8_t flags;
  97. __be16 rsvd2;
  98. uint8_t hlength;
  99. uint8_t dlength[3];
  100. uint8_t lun[8];
  101. __be32 itt; /* Initiator Task Tag */
  102. __be32 data_length;
  103. __be32 cmdsn;
  104. __be32 exp_statsn;
  105. uint8_t cdb[16]; /* SCSI Command Block */
  106. /* Additional Data (Command Dependent) */
  107. };
  108. /* Command PDU flags */
  109. #define ISCSI_FLAG_CMD_FINAL 0x80
  110. #define ISCSI_FLAG_CMD_READ 0x40
  111. #define ISCSI_FLAG_CMD_WRITE 0x20
  112. #define ISCSI_FLAG_CMD_ATTR_MASK 0x07 /* 3 bits */
  113. /* SCSI Command Attribute values */
  114. #define ISCSI_ATTR_UNTAGGED 0
  115. #define ISCSI_ATTR_SIMPLE 1
  116. #define ISCSI_ATTR_ORDERED 2
  117. #define ISCSI_ATTR_HEAD_OF_QUEUE 3
  118. #define ISCSI_ATTR_ACA 4
  119. struct iscsi_rlength_ahdr {
  120. __be16 ahslength;
  121. uint8_t ahstype;
  122. uint8_t reserved;
  123. __be32 read_length;
  124. };
  125. /* SCSI Response Header */
  126. struct iscsi_cmd_rsp {
  127. uint8_t opcode;
  128. uint8_t flags;
  129. uint8_t response;
  130. uint8_t cmd_status;
  131. uint8_t hlength;
  132. uint8_t dlength[3];
  133. uint8_t rsvd[8];
  134. __be32 itt; /* Initiator Task Tag */
  135. __be32 rsvd1;
  136. __be32 statsn;
  137. __be32 exp_cmdsn;
  138. __be32 max_cmdsn;
  139. __be32 exp_datasn;
  140. __be32 bi_residual_count;
  141. __be32 residual_count;
  142. /* Response or Sense Data (optional) */
  143. };
  144. /* Command Response PDU flags */
  145. #define ISCSI_FLAG_CMD_BIDI_OVERFLOW 0x10
  146. #define ISCSI_FLAG_CMD_BIDI_UNDERFLOW 0x08
  147. #define ISCSI_FLAG_CMD_OVERFLOW 0x04
  148. #define ISCSI_FLAG_CMD_UNDERFLOW 0x02
  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. /* Asynchronous Event Header */
  154. struct iscsi_async {
  155. uint8_t opcode;
  156. uint8_t flags;
  157. uint8_t rsvd2[2];
  158. uint8_t rsvd3;
  159. uint8_t dlength[3];
  160. uint8_t lun[8];
  161. uint8_t rsvd4[8];
  162. __be32 statsn;
  163. __be32 exp_cmdsn;
  164. __be32 max_cmdsn;
  165. uint8_t async_event;
  166. uint8_t async_vcode;
  167. __be16 param1;
  168. __be16 param2;
  169. __be16 param3;
  170. uint8_t rsvd5[4];
  171. };
  172. /* iSCSI Event Codes */
  173. #define ISCSI_ASYNC_MSG_SCSI_EVENT 0
  174. #define ISCSI_ASYNC_MSG_REQUEST_LOGOUT 1
  175. #define ISCSI_ASYNC_MSG_DROPPING_CONNECTION 2
  176. #define ISCSI_ASYNC_MSG_DROPPING_ALL_CONNECTIONS 3
  177. #define ISCSI_ASYNC_MSG_PARAM_NEGOTIATION 4
  178. #define ISCSI_ASYNC_MSG_VENDOR_SPECIFIC 255
  179. /* NOP-Out Message */
  180. struct iscsi_nopout {
  181. uint8_t opcode;
  182. uint8_t flags;
  183. __be16 rsvd2;
  184. uint8_t rsvd3;
  185. uint8_t dlength[3];
  186. uint8_t lun[8];
  187. __be32 itt; /* Initiator Task Tag */
  188. __be32 ttt; /* Target Transfer Tag */
  189. __be32 cmdsn;
  190. __be32 exp_statsn;
  191. uint8_t rsvd4[16];
  192. };
  193. /* NOP-In Message */
  194. struct iscsi_nopin {
  195. uint8_t opcode;
  196. uint8_t flags;
  197. __be16 rsvd2;
  198. uint8_t rsvd3;
  199. uint8_t dlength[3];
  200. uint8_t lun[8];
  201. __be32 itt; /* Initiator Task Tag */
  202. __be32 ttt; /* Target Transfer Tag */
  203. __be32 statsn;
  204. __be32 exp_cmdsn;
  205. __be32 max_cmdsn;
  206. uint8_t rsvd4[12];
  207. };
  208. /* SCSI Task Management Message Header */
  209. struct iscsi_tm {
  210. uint8_t opcode;
  211. uint8_t flags;
  212. uint8_t rsvd1[2];
  213. uint8_t hlength;
  214. uint8_t dlength[3];
  215. uint8_t lun[8];
  216. __be32 itt; /* Initiator Task Tag */
  217. __be32 rtt; /* Reference Task Tag */
  218. __be32 cmdsn;
  219. __be32 exp_statsn;
  220. __be32 refcmdsn;
  221. __be32 exp_datasn;
  222. uint8_t rsvd2[8];
  223. };
  224. #define ISCSI_FLAG_TM_FUNC_MASK 0x7F
  225. /* Function values */
  226. #define ISCSI_TM_FUNC_ABORT_TASK 1
  227. #define ISCSI_TM_FUNC_ABORT_TASK_SET 2
  228. #define ISCSI_TM_FUNC_CLEAR_ACA 3
  229. #define ISCSI_TM_FUNC_CLEAR_TASK_SET 4
  230. #define ISCSI_TM_FUNC_LOGICAL_UNIT_RESET 5
  231. #define ISCSI_TM_FUNC_TARGET_WARM_RESET 6
  232. #define ISCSI_TM_FUNC_TARGET_COLD_RESET 7
  233. #define ISCSI_TM_FUNC_TASK_REASSIGN 8
  234. /* SCSI Task Management Response Header */
  235. struct iscsi_tm_rsp {
  236. uint8_t opcode;
  237. uint8_t flags;
  238. uint8_t response; /* see Response values below */
  239. uint8_t qualifier;
  240. uint8_t hlength;
  241. uint8_t dlength[3];
  242. uint8_t rsvd2[8];
  243. __be32 itt; /* Initiator Task Tag */
  244. __be32 rtt; /* Reference Task Tag */
  245. __be32 statsn;
  246. __be32 exp_cmdsn;
  247. __be32 max_cmdsn;
  248. uint8_t rsvd3[12];
  249. };
  250. /* Response values */
  251. #define ISCSI_TMF_RSP_COMPLETE 0x00
  252. #define ISCSI_TMF_RSP_NO_TASK 0x01
  253. #define ISCSI_TMF_RSP_NO_LUN 0x02
  254. #define ISCSI_TMF_RSP_TASK_ALLEGIANT 0x03
  255. #define ISCSI_TMF_RSP_NO_FAILOVER 0x04
  256. #define ISCSI_TMF_RSP_NOT_SUPPORTED 0x05
  257. #define ISCSI_TMF_RSP_AUTH_FAILED 0x06
  258. #define ISCSI_TMF_RSP_REJECTED 0xff
  259. /* Ready To Transfer Header */
  260. struct iscsi_r2t_rsp {
  261. uint8_t opcode;
  262. uint8_t flags;
  263. uint8_t rsvd2[2];
  264. uint8_t hlength;
  265. uint8_t dlength[3];
  266. uint8_t lun[8];
  267. __be32 itt; /* Initiator Task Tag */
  268. __be32 ttt; /* Target Transfer Tag */
  269. __be32 statsn;
  270. __be32 exp_cmdsn;
  271. __be32 max_cmdsn;
  272. __be32 r2tsn;
  273. __be32 data_offset;
  274. __be32 data_length;
  275. };
  276. /* SCSI Data Hdr */
  277. struct iscsi_data {
  278. uint8_t opcode;
  279. uint8_t flags;
  280. uint8_t rsvd2[2];
  281. uint8_t rsvd3;
  282. uint8_t dlength[3];
  283. uint8_t lun[8];
  284. __be32 itt;
  285. __be32 ttt;
  286. __be32 rsvd4;
  287. __be32 exp_statsn;
  288. __be32 rsvd5;
  289. __be32 datasn;
  290. __be32 offset;
  291. __be32 rsvd6;
  292. /* Payload */
  293. };
  294. /* SCSI Data Response Hdr */
  295. struct iscsi_data_rsp {
  296. uint8_t opcode;
  297. uint8_t flags;
  298. uint8_t rsvd2;
  299. uint8_t cmd_status;
  300. uint8_t hlength;
  301. uint8_t dlength[3];
  302. uint8_t lun[8];
  303. __be32 itt;
  304. __be32 ttt;
  305. __be32 statsn;
  306. __be32 exp_cmdsn;
  307. __be32 max_cmdsn;
  308. __be32 datasn;
  309. __be32 offset;
  310. __be32 residual_count;
  311. };
  312. /* Data Response PDU flags */
  313. #define ISCSI_FLAG_DATA_ACK 0x40
  314. #define ISCSI_FLAG_DATA_OVERFLOW 0x04
  315. #define ISCSI_FLAG_DATA_UNDERFLOW 0x02
  316. #define ISCSI_FLAG_DATA_STATUS 0x01
  317. /* Text Header */
  318. struct iscsi_text {
  319. uint8_t opcode;
  320. uint8_t flags;
  321. uint8_t rsvd2[2];
  322. uint8_t hlength;
  323. uint8_t dlength[3];
  324. uint8_t rsvd4[8];
  325. __be32 itt;
  326. __be32 ttt;
  327. __be32 cmdsn;
  328. __be32 exp_statsn;
  329. uint8_t rsvd5[16];
  330. /* Text - key=value pairs */
  331. };
  332. #define ISCSI_FLAG_TEXT_CONTINUE 0x40
  333. /* Text Response Header */
  334. struct iscsi_text_rsp {
  335. uint8_t opcode;
  336. uint8_t flags;
  337. uint8_t rsvd2[2];
  338. uint8_t hlength;
  339. uint8_t dlength[3];
  340. uint8_t rsvd4[8];
  341. __be32 itt;
  342. __be32 ttt;
  343. __be32 statsn;
  344. __be32 exp_cmdsn;
  345. __be32 max_cmdsn;
  346. uint8_t rsvd5[12];
  347. /* Text Response - key:value pairs */
  348. };
  349. /* Login Header */
  350. struct iscsi_login {
  351. uint8_t opcode;
  352. uint8_t flags;
  353. uint8_t max_version; /* Max. version supported */
  354. uint8_t min_version; /* Min. version supported */
  355. uint8_t hlength;
  356. uint8_t dlength[3];
  357. uint8_t isid[6]; /* Initiator Session ID */
  358. __be16 tsih; /* Target Session Handle */
  359. __be32 itt; /* Initiator Task Tag */
  360. __be16 cid;
  361. __be16 rsvd3;
  362. __be32 cmdsn;
  363. __be32 exp_statsn;
  364. uint8_t rsvd5[16];
  365. };
  366. /* Login PDU flags */
  367. #define ISCSI_FLAG_LOGIN_TRANSIT 0x80
  368. #define ISCSI_FLAG_LOGIN_CONTINUE 0x40
  369. #define ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK 0x0C /* 2 bits */
  370. #define ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK 0x03 /* 2 bits */
  371. #define ISCSI_LOGIN_CURRENT_STAGE(flags) \
  372. ((flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2)
  373. #define ISCSI_LOGIN_NEXT_STAGE(flags) \
  374. (flags & ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK)
  375. /* Login Response Header */
  376. struct iscsi_login_rsp {
  377. uint8_t opcode;
  378. uint8_t flags;
  379. uint8_t max_version; /* Max. version supported */
  380. uint8_t active_version; /* Active version */
  381. uint8_t hlength;
  382. uint8_t dlength[3];
  383. uint8_t isid[6]; /* Initiator Session ID */
  384. __be16 tsih; /* Target Session Handle */
  385. __be32 itt; /* Initiator Task Tag */
  386. __be32 rsvd3;
  387. __be32 statsn;
  388. __be32 exp_cmdsn;
  389. __be32 max_cmdsn;
  390. uint8_t status_class; /* see Login RSP ststus classes below */
  391. uint8_t status_detail; /* see Login RSP Status details below */
  392. uint8_t rsvd4[10];
  393. };
  394. /* Login stage (phase) codes for CSG, NSG */
  395. #define ISCSI_INITIAL_LOGIN_STAGE -1
  396. #define ISCSI_SECURITY_NEGOTIATION_STAGE 0
  397. #define ISCSI_OP_PARMS_NEGOTIATION_STAGE 1
  398. #define ISCSI_FULL_FEATURE_PHASE 3
  399. /* Login Status response classes */
  400. #define ISCSI_STATUS_CLS_SUCCESS 0x00
  401. #define ISCSI_STATUS_CLS_REDIRECT 0x01
  402. #define ISCSI_STATUS_CLS_INITIATOR_ERR 0x02
  403. #define ISCSI_STATUS_CLS_TARGET_ERR 0x03
  404. /* Login Status response detail codes */
  405. /* Class-0 (Success) */
  406. #define ISCSI_LOGIN_STATUS_ACCEPT 0x00
  407. /* Class-1 (Redirection) */
  408. #define ISCSI_LOGIN_STATUS_TGT_MOVED_TEMP 0x01
  409. #define ISCSI_LOGIN_STATUS_TGT_MOVED_PERM 0x02
  410. /* Class-2 (Initiator Error) */
  411. #define ISCSI_LOGIN_STATUS_INIT_ERR 0x00
  412. #define ISCSI_LOGIN_STATUS_AUTH_FAILED 0x01
  413. #define ISCSI_LOGIN_STATUS_TGT_FORBIDDEN 0x02
  414. #define ISCSI_LOGIN_STATUS_TGT_NOT_FOUND 0x03
  415. #define ISCSI_LOGIN_STATUS_TGT_REMOVED 0x04
  416. #define ISCSI_LOGIN_STATUS_NO_VERSION 0x05
  417. #define ISCSI_LOGIN_STATUS_ISID_ERROR 0x06
  418. #define ISCSI_LOGIN_STATUS_MISSING_FIELDS 0x07
  419. #define ISCSI_LOGIN_STATUS_CONN_ADD_FAILED 0x08
  420. #define ISCSI_LOGIN_STATUS_NO_SESSION_TYPE 0x09
  421. #define ISCSI_LOGIN_STATUS_NO_SESSION 0x0a
  422. #define ISCSI_LOGIN_STATUS_INVALID_REQUEST 0x0b
  423. /* Class-3 (Target Error) */
  424. #define ISCSI_LOGIN_STATUS_TARGET_ERROR 0x00
  425. #define ISCSI_LOGIN_STATUS_SVC_UNAVAILABLE 0x01
  426. #define ISCSI_LOGIN_STATUS_NO_RESOURCES 0x02
  427. /* Logout Header */
  428. struct iscsi_logout {
  429. uint8_t opcode;
  430. uint8_t flags;
  431. uint8_t rsvd1[2];
  432. uint8_t hlength;
  433. uint8_t dlength[3];
  434. uint8_t rsvd2[8];
  435. __be32 itt; /* Initiator Task Tag */
  436. __be16 cid;
  437. uint8_t rsvd3[2];
  438. __be32 cmdsn;
  439. __be32 exp_statsn;
  440. uint8_t rsvd4[16];
  441. };
  442. /* Logout PDU flags */
  443. #define ISCSI_FLAG_LOGOUT_REASON_MASK 0x7F
  444. /* logout reason_code values */
  445. #define ISCSI_LOGOUT_REASON_CLOSE_SESSION 0
  446. #define ISCSI_LOGOUT_REASON_CLOSE_CONNECTION 1
  447. #define ISCSI_LOGOUT_REASON_RECOVERY 2
  448. #define ISCSI_LOGOUT_REASON_AEN_REQUEST 3
  449. /* Logout Response Header */
  450. struct iscsi_logout_rsp {
  451. uint8_t opcode;
  452. uint8_t flags;
  453. uint8_t response; /* see Logout response values below */
  454. uint8_t rsvd2;
  455. uint8_t hlength;
  456. uint8_t dlength[3];
  457. uint8_t rsvd3[8];
  458. __be32 itt; /* Initiator Task Tag */
  459. __be32 rsvd4;
  460. __be32 statsn;
  461. __be32 exp_cmdsn;
  462. __be32 max_cmdsn;
  463. __be32 rsvd5;
  464. __be16 t2wait;
  465. __be16 t2retain;
  466. __be32 rsvd6;
  467. };
  468. /* logout response status values */
  469. #define ISCSI_LOGOUT_SUCCESS 0
  470. #define ISCSI_LOGOUT_CID_NOT_FOUND 1
  471. #define ISCSI_LOGOUT_RECOVERY_UNSUPPORTED 2
  472. #define ISCSI_LOGOUT_CLEANUP_FAILED 3
  473. /* SNACK Header */
  474. struct iscsi_snack {
  475. uint8_t opcode;
  476. uint8_t flags;
  477. uint8_t rsvd2[14];
  478. __be32 itt;
  479. __be32 begrun;
  480. __be32 runlength;
  481. __be32 exp_statsn;
  482. __be32 rsvd3;
  483. __be32 exp_datasn;
  484. uint8_t rsvd6[8];
  485. };
  486. /* SNACK PDU flags */
  487. #define ISCSI_FLAG_SNACK_TYPE_MASK 0x0F /* 4 bits */
  488. /* Reject Message Header */
  489. struct iscsi_reject {
  490. uint8_t opcode;
  491. uint8_t flags;
  492. uint8_t reason;
  493. uint8_t rsvd2;
  494. uint8_t hlength;
  495. uint8_t dlength[3];
  496. uint8_t rsvd3[8];
  497. __be32 ffffffff;
  498. uint8_t rsvd4[4];
  499. __be32 statsn;
  500. __be32 exp_cmdsn;
  501. __be32 max_cmdsn;
  502. __be32 datasn;
  503. uint8_t rsvd5[8];
  504. /* Text - Rejected hdr */
  505. };
  506. /* Reason for Reject */
  507. #define ISCSI_REASON_CMD_BEFORE_LOGIN 1
  508. #define ISCSI_REASON_DATA_DIGEST_ERROR 2
  509. #define ISCSI_REASON_DATA_SNACK_REJECT 3
  510. #define ISCSI_REASON_PROTOCOL_ERROR 4
  511. #define ISCSI_REASON_CMD_NOT_SUPPORTED 5
  512. #define ISCSI_REASON_IMM_CMD_REJECT 6
  513. #define ISCSI_REASON_TASK_IN_PROGRESS 7
  514. #define ISCSI_REASON_INVALID_SNACK 8
  515. #define ISCSI_REASON_BOOKMARK_INVALID 9
  516. #define ISCSI_REASON_BOOKMARK_NO_RESOURCES 10
  517. #define ISCSI_REASON_NEGOTIATION_RESET 11
  518. /* Max. number of Key=Value pairs in a text message */
  519. #define MAX_KEY_VALUE_PAIRS 8192
  520. /* maximum length for text keys/values */
  521. #define KEY_MAXLEN 64
  522. #define VALUE_MAXLEN 255
  523. #define TARGET_NAME_MAXLEN VALUE_MAXLEN
  524. #define DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH 8192
  525. /************************* RFC 3720 End *****************************/
  526. #endif /* ISCSI_PROTO_H */