xref: /titanic_52/usr/src/uts/common/io/bnxe/577xx/drivers/common/lm/fw/57xx_iscsi_rfc_constants.h (revision d14abf155341d55053c76eeec58b787a456b753b)
1 #ifndef __57XX_ISCSI_RFC_CONSTANTS_H_
2 #define __57XX_ISCSI_RFC_CONSTANTS_H_
3 
4 /**
5 * This file defines SCSI/iSCSI RFC constants
6 */
7 
8 /* iSCSI request op codes */
9 #define ISCSI_OPCODE_NOP_OUT        (0 | 0x40)
10 #define ISCSI_OPCODE_SCSI_CMD       (1)
11 #define ISCSI_OPCODE_TMF_REQUEST    (2 | 0x40)
12 #define ISCSI_OPCODE_LOGIN_REQUEST  (3 | 0x40)
13 #define ISCSI_OPCODE_TEXT_REQUEST   (4 | 0x40)
14 #define ISCSI_OPCODE_DATA_OUT       (5)
15 #define ISCSI_OPCODE_LOGOUT_REQUEST (6 | 0x00)
16 
17 /* iSCSI response/messages op codes */
18 #define ISCSI_OPCODE_NOP_IN             (0x20)
19 #define ISCSI_OPCODE_SCSI_RESPONSE      (0x21)
20 #define ISCSI_OPCODE_TMF_RESPONSE       (0x22)
21 #define ISCSI_OPCODE_LOGIN_RESPONSE     (0x23)
22 #define ISCSI_OPCODE_TEXT_RESPONSE      (0x24)
23 #define ISCSI_OPCODE_DATA_IN            (0x25)
24 #define ISCSI_OPCODE_LOGOUT_RESPONSE    (0x26)
25 #define ISCSI_OPCODE_R2T                (0x31)
26 #define ISCSI_OPCODE_ASYNC_MSG          (0x32)
27 #define ISCSI_OPCODE_REJECT             (0x3f)
28 
29 /* iSCSI stages */
30 #define ISCSI_STAGE_SECURITY_NEGOTIATION            (0)
31 #define ISCSI_STAGE_LOGIN_OPERATIONAL_NEGOTIATION   (1)
32 #define ISCSI_STAGE_FULL_FEATURE_PHASE              (3)
33 
34 /* SCSI command response codes */
35 #define ISCSI_SCSI_CMD_RESPONSE_CMD_COMPLETED   (0x00)
36 #define ISCSI_SCSI_CMD_RESPONSE_TARGET_FAILURE  (0x01)
37 
38 /* SCSI command status codes */
39 #define ISCSI_SCSI_CMD_STATUS_GOOD              (0x00)
40 #define ISCSI_SCSI_CMD_STATUS_CHECK_CONDITION   (0x02)
41 #define ISCSI_SCSI_CMD_STATUS_INTERMIDIATE      (0x10)
42 #define ISCSI_SCSI_CMD_STATUS_ACA_ACTIVE		(0x30)
43 
44 /* TMF codes */
45 #define ISCSI_TMF_ABORT_TASK            (1)
46 #define ISCSI_TMF_LOGICAL_UNIT_RESET    (5)
47 #define ISCSI_TMF_FUNCTION_MASK         (0x7F)
48 
49 /* TMF response codes */
50 #define ISCSI_TMF_RESPONSE_FUNCTION_COMPLETE                (0x00)
51 #define ISCSI_TMF_RESPONSE_TASK_DOESNT_EXIST                (0x01)
52 #define ISCSI_TMF_RESPONSE_LUN_DOESNT_EXIST                 (0x02)
53 #define ISCSI_TMF_RESPONSE_TASK_STILL_ALLEGIANT	            (0x03)
54 #define ISCSI_TMF_RESPONSE_FUNCTION_NOT_SUPPORTED           (0x05)
55 #define ISCSI_TMF_RESPONSE_FUNCTION_AUTHORIZATION_FAILED    (0x06)
56 #define ISCSI_TMF_RESPONSE_FUNCTION_REJECTED                (0xff)
57 
58 /* Logout reason codes */
59 #define ISCSI_LOGOUT_REASON_CLOSE_CONNECTION    (1)
60 
61 /* Logout response codes */
62 #define ISCSI_LOGOUT_RESPONSE_CONNECTION_CLOSED (0)
63 #define ISCSI_LOGOUT_RESPONSE_CID_NOT_FOUND     (1)
64 #define ISCSI_LOGOUT_RESPONSE_CLEANUP_FAILED    (3)
65 
66 /* iSCSI parameter defaults */
67 #define ISCSI_DEFAULT_HEADER_DIGEST         (0)
68 #define ISCSI_DEFAULT_DATA_DIGEST           (0)
69 #define ISCSI_DEFAULT_INITIAL_R2T           (1)
70 #define ISCSI_DEFAULT_IMMEDIATE_DATA        (1)
71 #define ISCSI_DEFAULT_MAX_PDU_LENGTH        (0x2000)
72 #define ISCSI_DEFAULT_FIRST_BURST_LENGTH    (0x10000)
73 #define ISCSI_DEFAULT_MAX_BURST_LENGTH      (0x40000)
74 #define ISCSI_DEFAULT_MAX_OUTSTANDING_R2T   (1)
75 
76 /* iSCSI parameter limits */
77 #define ISCSI_MIN_VAL_MAX_PDU_LENGTH        (0x200)
78 #define ISCSI_MAX_VAL_MAX_PDU_LENGTH        (0xffffff)
79 #define ISCSI_MIN_VAL_BURST_LENGTH          (0x200)
80 #define ISCSI_MAX_VAL_BURST_LENGTH          (0xffffff)
81 #define ISCSI_MIN_VAL_MAX_OUTSTANDING_R2T   (1)
82 #define ISCSI_MAX_VAL_MAX_OUTSTANDING_R2T   (0xff) // 0x10000 according to RFC
83 
84 #endif /*__57XX_ISCSI_RFC_CONSTANTS_H_ */
85