diff options
Diffstat (limited to 'include/scsi/iscsi_if.h')
-rw-r--r-- | include/scsi/iscsi_if.h | 127 |
1 files changed, 95 insertions, 32 deletions
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index e5618b90996e..253797c60095 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h | |||
@@ -43,6 +43,10 @@ enum iscsi_uevent_e { | |||
43 | ISCSI_UEVENT_GET_STATS = UEVENT_BASE + 10, | 43 | ISCSI_UEVENT_GET_STATS = UEVENT_BASE + 10, |
44 | ISCSI_UEVENT_GET_PARAM = UEVENT_BASE + 11, | 44 | ISCSI_UEVENT_GET_PARAM = UEVENT_BASE + 11, |
45 | 45 | ||
46 | ISCSI_UEVENT_TRANSPORT_EP_CONNECT = UEVENT_BASE + 12, | ||
47 | ISCSI_UEVENT_TRANSPORT_EP_POLL = UEVENT_BASE + 13, | ||
48 | ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT = UEVENT_BASE + 14, | ||
49 | |||
46 | /* up events */ | 50 | /* up events */ |
47 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, | 51 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, |
48 | ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2, | 52 | ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2, |
@@ -60,61 +64,83 @@ struct iscsi_uevent { | |||
60 | uint32_t initial_cmdsn; | 64 | uint32_t initial_cmdsn; |
61 | } c_session; | 65 | } c_session; |
62 | struct msg_destroy_session { | 66 | struct msg_destroy_session { |
63 | uint64_t session_handle; | ||
64 | uint32_t sid; | 67 | uint32_t sid; |
65 | } d_session; | 68 | } d_session; |
66 | struct msg_create_conn { | 69 | struct msg_create_conn { |
67 | uint64_t session_handle; | ||
68 | uint32_t cid; | ||
69 | uint32_t sid; | 70 | uint32_t sid; |
71 | uint32_t cid; | ||
70 | } c_conn; | 72 | } c_conn; |
71 | struct msg_bind_conn { | 73 | struct msg_bind_conn { |
72 | uint64_t session_handle; | 74 | uint32_t sid; |
73 | uint64_t conn_handle; | 75 | uint32_t cid; |
74 | uint32_t transport_fd; | 76 | uint64_t transport_eph; |
75 | uint32_t is_leading; | 77 | uint32_t is_leading; |
76 | } b_conn; | 78 | } b_conn; |
77 | struct msg_destroy_conn { | 79 | struct msg_destroy_conn { |
78 | uint64_t conn_handle; | 80 | uint32_t sid; |
79 | uint32_t cid; | 81 | uint32_t cid; |
80 | } d_conn; | 82 | } d_conn; |
81 | struct msg_send_pdu { | 83 | struct msg_send_pdu { |
84 | uint32_t sid; | ||
85 | uint32_t cid; | ||
82 | uint32_t hdr_size; | 86 | uint32_t hdr_size; |
83 | uint32_t data_size; | 87 | uint32_t data_size; |
84 | uint64_t conn_handle; | ||
85 | } send_pdu; | 88 | } send_pdu; |
86 | struct msg_set_param { | 89 | struct msg_set_param { |
87 | uint64_t conn_handle; | 90 | uint32_t sid; |
91 | uint32_t cid; | ||
88 | uint32_t param; /* enum iscsi_param */ | 92 | uint32_t param; /* enum iscsi_param */ |
89 | uint32_t value; | 93 | uint32_t len; |
90 | } set_param; | 94 | } set_param; |
91 | struct msg_start_conn { | 95 | struct msg_start_conn { |
92 | uint64_t conn_handle; | 96 | uint32_t sid; |
97 | uint32_t cid; | ||
93 | } start_conn; | 98 | } start_conn; |
94 | struct msg_stop_conn { | 99 | struct msg_stop_conn { |
100 | uint32_t sid; | ||
101 | uint32_t cid; | ||
95 | uint64_t conn_handle; | 102 | uint64_t conn_handle; |
96 | uint32_t flag; | 103 | uint32_t flag; |
97 | } stop_conn; | 104 | } stop_conn; |
98 | struct msg_get_stats { | 105 | struct msg_get_stats { |
99 | uint64_t conn_handle; | 106 | uint32_t sid; |
107 | uint32_t cid; | ||
100 | } get_stats; | 108 | } get_stats; |
109 | struct msg_transport_connect { | ||
110 | uint32_t non_blocking; | ||
111 | } ep_connect; | ||
112 | struct msg_transport_poll { | ||
113 | uint64_t ep_handle; | ||
114 | uint32_t timeout_ms; | ||
115 | } ep_poll; | ||
116 | struct msg_transport_disconnect { | ||
117 | uint64_t ep_handle; | ||
118 | } ep_disconnect; | ||
101 | } u; | 119 | } u; |
102 | union { | 120 | union { |
103 | /* messages k -> u */ | 121 | /* messages k -> u */ |
104 | uint64_t handle; | ||
105 | int retcode; | 122 | int retcode; |
106 | struct msg_create_session_ret { | 123 | struct msg_create_session_ret { |
107 | uint64_t session_handle; | ||
108 | uint32_t sid; | 124 | uint32_t sid; |
125 | uint32_t host_no; | ||
109 | } c_session_ret; | 126 | } c_session_ret; |
127 | struct msg_create_conn_ret { | ||
128 | uint32_t sid; | ||
129 | uint32_t cid; | ||
130 | } c_conn_ret; | ||
110 | struct msg_recv_req { | 131 | struct msg_recv_req { |
132 | uint32_t sid; | ||
133 | uint32_t cid; | ||
111 | uint64_t recv_handle; | 134 | uint64_t recv_handle; |
112 | uint64_t conn_handle; | ||
113 | } recv_req; | 135 | } recv_req; |
114 | struct msg_conn_error { | 136 | struct msg_conn_error { |
115 | uint64_t conn_handle; | 137 | uint32_t sid; |
138 | uint32_t cid; | ||
116 | uint32_t error; /* enum iscsi_err */ | 139 | uint32_t error; /* enum iscsi_err */ |
117 | } connerror; | 140 | } connerror; |
141 | struct msg_transport_connect_ret { | ||
142 | uint64_t handle; | ||
143 | } ep_connect_ret; | ||
118 | } r; | 144 | } r; |
119 | } __attribute__ ((aligned (sizeof(uint64_t)))); | 145 | } __attribute__ ((aligned (sizeof(uint64_t)))); |
120 | 146 | ||
@@ -139,29 +165,66 @@ enum iscsi_err { | |||
139 | ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13, | 165 | ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13, |
140 | ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14, | 166 | ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14, |
141 | ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15, | 167 | ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15, |
142 | ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16 | 168 | ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16, |
169 | ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17, | ||
143 | }; | 170 | }; |
144 | 171 | ||
145 | /* | 172 | /* |
146 | * iSCSI Parameters (RFC3720) | 173 | * iSCSI Parameters (RFC3720) |
147 | */ | 174 | */ |
148 | enum iscsi_param { | 175 | enum iscsi_param { |
149 | ISCSI_PARAM_MAX_RECV_DLENGTH = 0, | 176 | /* passed in using netlink set param */ |
150 | ISCSI_PARAM_MAX_XMIT_DLENGTH = 1, | 177 | ISCSI_PARAM_MAX_RECV_DLENGTH, |
151 | ISCSI_PARAM_HDRDGST_EN = 2, | 178 | ISCSI_PARAM_MAX_XMIT_DLENGTH, |
152 | ISCSI_PARAM_DATADGST_EN = 3, | 179 | ISCSI_PARAM_HDRDGST_EN, |
153 | ISCSI_PARAM_INITIAL_R2T_EN = 4, | 180 | ISCSI_PARAM_DATADGST_EN, |
154 | ISCSI_PARAM_MAX_R2T = 5, | 181 | ISCSI_PARAM_INITIAL_R2T_EN, |
155 | ISCSI_PARAM_IMM_DATA_EN = 6, | 182 | ISCSI_PARAM_MAX_R2T, |
156 | ISCSI_PARAM_FIRST_BURST = 7, | 183 | ISCSI_PARAM_IMM_DATA_EN, |
157 | ISCSI_PARAM_MAX_BURST = 8, | 184 | ISCSI_PARAM_FIRST_BURST, |
158 | ISCSI_PARAM_PDU_INORDER_EN = 9, | 185 | ISCSI_PARAM_MAX_BURST, |
159 | ISCSI_PARAM_DATASEQ_INORDER_EN = 10, | 186 | ISCSI_PARAM_PDU_INORDER_EN, |
160 | ISCSI_PARAM_ERL = 11, | 187 | ISCSI_PARAM_DATASEQ_INORDER_EN, |
161 | ISCSI_PARAM_IFMARKER_EN = 12, | 188 | ISCSI_PARAM_ERL, |
162 | ISCSI_PARAM_OFMARKER_EN = 13, | 189 | ISCSI_PARAM_IFMARKER_EN, |
190 | ISCSI_PARAM_OFMARKER_EN, | ||
191 | ISCSI_PARAM_EXP_STATSN, | ||
192 | ISCSI_PARAM_TARGET_NAME, | ||
193 | ISCSI_PARAM_TPGT, | ||
194 | ISCSI_PARAM_PERSISTENT_ADDRESS, | ||
195 | ISCSI_PARAM_PERSISTENT_PORT, | ||
196 | ISCSI_PARAM_SESS_RECOVERY_TMO, | ||
197 | |||
198 | /* pased in through bind conn using transport_fd */ | ||
199 | ISCSI_PARAM_CONN_PORT, | ||
200 | ISCSI_PARAM_CONN_ADDRESS, | ||
201 | |||
202 | /* must always be last */ | ||
203 | ISCSI_PARAM_MAX, | ||
163 | }; | 204 | }; |
164 | #define ISCSI_PARAM_MAX 14 | 205 | |
206 | #define ISCSI_MAX_RECV_DLENGTH (1 << ISCSI_PARAM_MAX_RECV_DLENGTH) | ||
207 | #define ISCSI_MAX_XMIT_DLENGTH (1 << ISCSI_PARAM_MAX_XMIT_DLENGTH) | ||
208 | #define ISCSI_HDRDGST_EN (1 << ISCSI_PARAM_HDRDGST_EN) | ||
209 | #define ISCSI_DATADGST_EN (1 << ISCSI_PARAM_DATADGST_EN) | ||
210 | #define ISCSI_INITIAL_R2T_EN (1 << ISCSI_PARAM_INITIAL_R2T_EN) | ||
211 | #define ISCSI_MAX_R2T (1 << ISCSI_PARAM_MAX_R2T) | ||
212 | #define ISCSI_IMM_DATA_EN (1 << ISCSI_PARAM_IMM_DATA_EN) | ||
213 | #define ISCSI_FIRST_BURST (1 << ISCSI_PARAM_FIRST_BURST) | ||
214 | #define ISCSI_MAX_BURST (1 << ISCSI_PARAM_MAX_BURST) | ||
215 | #define ISCSI_PDU_INORDER_EN (1 << ISCSI_PARAM_PDU_INORDER_EN) | ||
216 | #define ISCSI_DATASEQ_INORDER_EN (1 << ISCSI_PARAM_DATASEQ_INORDER_EN) | ||
217 | #define ISCSI_ERL (1 << ISCSI_PARAM_ERL) | ||
218 | #define ISCSI_IFMARKER_EN (1 << ISCSI_PARAM_IFMARKER_EN) | ||
219 | #define ISCSI_OFMARKER_EN (1 << ISCSI_PARAM_OFMARKER_EN) | ||
220 | #define ISCSI_EXP_STATSN (1 << ISCSI_PARAM_EXP_STATSN) | ||
221 | #define ISCSI_TARGET_NAME (1 << ISCSI_PARAM_TARGET_NAME) | ||
222 | #define ISCSI_TPGT (1 << ISCSI_PARAM_TPGT) | ||
223 | #define ISCSI_PERSISTENT_ADDRESS (1 << ISCSI_PARAM_PERSISTENT_ADDRESS) | ||
224 | #define ISCSI_PERSISTENT_PORT (1 << ISCSI_PARAM_PERSISTENT_PORT) | ||
225 | #define ISCSI_SESS_RECOVERY_TMO (1 << ISCSI_PARAM_SESS_RECOVERY_TMO) | ||
226 | #define ISCSI_CONN_PORT (1 << ISCSI_PARAM_CONN_PORT) | ||
227 | #define ISCSI_CONN_ADDRESS (1 << ISCSI_PARAM_CONN_ADDRESS) | ||
165 | 228 | ||
166 | #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) | 229 | #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) |
167 | #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) | 230 | #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) |