1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35#ifndef SCSI_SRP_H
36#define SCSI_SRP_H
37
38
39
40
41
42
43
44#include <linux/types.h>
45#include <scsi/scsi.h>
46
47enum {
48 SRP_LOGIN_REQ = 0x00,
49 SRP_TSK_MGMT = 0x01,
50 SRP_CMD = 0x02,
51 SRP_I_LOGOUT = 0x03,
52 SRP_LOGIN_RSP = 0xc0,
53 SRP_RSP = 0xc1,
54 SRP_LOGIN_REJ = 0xc2,
55 SRP_T_LOGOUT = 0x80,
56 SRP_CRED_REQ = 0x81,
57 SRP_AER_REQ = 0x82,
58 SRP_CRED_RSP = 0x41,
59 SRP_AER_RSP = 0x42
60};
61
62enum {
63 SRP_BUF_FORMAT_DIRECT = 1 << 1,
64 SRP_BUF_FORMAT_INDIRECT = 1 << 2
65};
66
67enum {
68 SRP_NO_DATA_DESC = 0,
69 SRP_DATA_DESC_DIRECT = 1,
70 SRP_DATA_DESC_INDIRECT = 2,
71 SRP_DATA_DESC_IMM = 3,
72};
73
74enum {
75 SRP_TSK_ABORT_TASK = 0x01,
76 SRP_TSK_ABORT_TASK_SET = 0x02,
77 SRP_TSK_CLEAR_TASK_SET = 0x04,
78 SRP_TSK_LUN_RESET = 0x08,
79 SRP_TSK_CLEAR_ACA = 0x40
80};
81
82enum srp_login_rej_reason {
83 SRP_LOGIN_REJ_UNABLE_ESTABLISH_CHANNEL = 0x00010000,
84 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES = 0x00010001,
85 SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE = 0x00010002,
86 SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL = 0x00010003,
87 SRP_LOGIN_REJ_UNSUPPORTED_DESCRIPTOR_FMT = 0x00010004,
88 SRP_LOGIN_REJ_MULTI_CHANNEL_UNSUPPORTED = 0x00010005,
89 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED = 0x00010006
90};
91
92enum {
93 SRP_REV10_IB_IO_CLASS = 0xff00,
94 SRP_REV16A_IB_IO_CLASS = 0x0100
95};
96
97struct srp_direct_buf {
98 __be64 va;
99 __be32 key;
100 __be32 len;
101};
102
103
104
105
106
107
108
109struct srp_indirect_buf {
110 struct srp_direct_buf table_desc __packed __aligned(4);
111 __be32 len;
112 struct srp_direct_buf desc_list[] __packed __aligned(4);
113};
114
115
116struct srp_imm_buf {
117 __be32 len;
118};
119
120
121enum {
122 SRP_MULTICHAN_SINGLE = 0,
123 SRP_MULTICHAN_MULTI = 1,
124 SRP_IMMED_REQUESTED = 0x80,
125};
126
127struct srp_login_req {
128 u8 opcode;
129 u8 reserved1[7];
130 u64 tag;
131 __be32 req_it_iu_len;
132 u8 reserved2[4];
133 __be16 req_buf_fmt;
134 u8 req_flags;
135 u8 reserved3[1];
136 __be16 imm_data_offset;
137 u8 reserved4[2];
138 u8 initiator_port_id[16];
139 u8 target_port_id[16];
140};
141
142
143
144
145
146
147
148
149struct srp_login_req_rdma {
150 u64 tag;
151 __be16 req_buf_fmt;
152 u8 req_flags;
153 u8 opcode;
154 __be32 req_it_iu_len;
155 u8 initiator_port_id[16];
156 u8 target_port_id[16];
157 __be16 imm_data_offset;
158 u8 reserved[6];
159};
160
161
162enum {
163 SRP_LOGIN_RSP_MULTICHAN_NO_CHAN = 0x0,
164 SRP_LOGIN_RSP_MULTICHAN_TERMINATED = 0x1,
165 SRP_LOGIN_RSP_MULTICHAN_MAINTAINED = 0x2,
166 SRP_LOGIN_RSP_IMMED_SUPP = 0x80,
167};
168
169
170
171
172
173
174struct srp_login_rsp {
175 u8 opcode;
176 u8 reserved1[3];
177 __be32 req_lim_delta;
178 u64 tag __packed __aligned(4);
179 __be32 max_it_iu_len;
180 __be32 max_ti_iu_len;
181 __be16 buf_fmt;
182 u8 rsp_flags;
183 u8 reserved2[25];
184};
185
186struct srp_login_rej {
187 u8 opcode;
188 u8 reserved1[3];
189 __be32 reason;
190 u64 tag;
191 u8 reserved2[8];
192 __be16 buf_fmt;
193 u8 reserved3[6];
194};
195
196struct srp_i_logout {
197 u8 opcode;
198 u8 reserved[7];
199 u64 tag;
200};
201
202struct srp_t_logout {
203 u8 opcode;
204 u8 sol_not;
205 u8 reserved[2];
206 __be32 reason;
207 u64 tag;
208};
209
210struct srp_tsk_mgmt {
211 u8 opcode;
212 u8 sol_not;
213 u8 reserved1[6];
214 u64 tag;
215 u8 reserved2[4];
216 struct scsi_lun lun;
217 u8 reserved3[2];
218 u8 tsk_mgmt_func;
219 u8 reserved4;
220 u64 task_tag;
221 u8 reserved5[8];
222};
223
224struct srp_cmd {
225 u8 opcode;
226 u8 sol_not;
227 u8 reserved1[3];
228 u8 buf_fmt;
229 u8 data_out_desc_cnt;
230 u8 data_in_desc_cnt;
231 u64 tag;
232 u8 reserved2[4];
233 struct scsi_lun lun;
234 u8 reserved3;
235 u8 task_attr;
236 u8 reserved4;
237 u8 add_cdb_len;
238 u8 cdb[16];
239 u8 add_data[];
240};
241
242enum {
243 SRP_RSP_FLAG_RSPVALID = 1 << 0,
244 SRP_RSP_FLAG_SNSVALID = 1 << 1,
245 SRP_RSP_FLAG_DOOVER = 1 << 2,
246 SRP_RSP_FLAG_DOUNDER = 1 << 3,
247 SRP_RSP_FLAG_DIOVER = 1 << 4,
248 SRP_RSP_FLAG_DIUNDER = 1 << 5
249};
250
251
252
253
254
255
256struct srp_rsp {
257 u8 opcode;
258 u8 sol_not;
259 u8 reserved1[2];
260 __be32 req_lim_delta;
261 u64 tag __packed __aligned(4);
262 u8 reserved2[2];
263 u8 flags;
264 u8 status;
265 __be32 data_out_res_cnt;
266 __be32 data_in_res_cnt;
267 __be32 sense_data_len;
268 __be32 resp_data_len;
269 u8 data[];
270};
271
272struct srp_cred_req {
273 u8 opcode;
274 u8 sol_not;
275 u8 reserved[2];
276 __be32 req_lim_delta;
277 u64 tag;
278};
279
280struct srp_cred_rsp {
281 u8 opcode;
282 u8 reserved[7];
283 u64 tag;
284};
285
286
287
288
289
290
291struct srp_aer_req {
292 u8 opcode;
293 u8 sol_not;
294 u8 reserved[2];
295 __be32 req_lim_delta;
296 u64 tag __packed __aligned(4);
297 u32 reserved2;
298 struct scsi_lun lun;
299 __be32 sense_data_len;
300 u32 reserved3;
301 u8 sense_data[];
302};
303
304struct srp_aer_rsp {
305 u8 opcode;
306 u8 reserved[7];
307 u64 tag;
308};
309
310#endif
311