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
47 enum {
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
62 enum {
63 SRP_BUF_FORMAT_DIRECT = 1 << 1,
64 SRP_BUF_FORMAT_INDIRECT = 1 << 2
65 };
66
67 enum {
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
74 enum {
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
82 enum 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
92 enum {
93 SRP_REV10_IB_IO_CLASS = 0xff00,
94 SRP_REV16A_IB_IO_CLASS = 0x0100
95 };
96
97 struct srp_direct_buf {
98 __be64 va;
99 __be32 key;
100 __be32 len;
101 };
102
103
104
105
106
107
108
109 struct srp_indirect_buf {
110 struct srp_direct_buf table_desc;
111 __be32 len;
112 struct srp_direct_buf desc_list[0];
113 } __attribute__((packed));
114
115
116 struct srp_imm_buf {
117 __be32 len;
118 };
119
120
121 enum {
122 SRP_MULTICHAN_SINGLE = 0,
123 SRP_MULTICHAN_MULTI = 1,
124 SRP_IMMED_REQUESTED = 0x80,
125 };
126
127 struct 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
149 struct 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
162 enum {
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
174 struct srp_login_rsp {
175 u8 opcode;
176 u8 reserved1[3];
177 __be32 req_lim_delta;
178 u64 tag;
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 } __attribute__((packed));
185
186 struct 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
196 struct srp_i_logout {
197 u8 opcode;
198 u8 reserved[7];
199 u64 tag;
200 };
201
202 struct srp_t_logout {
203 u8 opcode;
204 u8 sol_not;
205 u8 reserved[2];
206 __be32 reason;
207 u64 tag;
208 };
209
210
211
212
213
214 struct srp_tsk_mgmt {
215 u8 opcode;
216 u8 sol_not;
217 u8 reserved1[6];
218 u64 tag;
219 u8 reserved2[4];
220 struct scsi_lun lun;
221 u8 reserved3[2];
222 u8 tsk_mgmt_func;
223 u8 reserved4;
224 u64 task_tag;
225 u8 reserved5[8];
226 };
227
228
229
230
231
232 struct srp_cmd {
233 u8 opcode;
234 u8 sol_not;
235 u8 reserved1[3];
236 u8 buf_fmt;
237 u8 data_out_desc_cnt;
238 u8 data_in_desc_cnt;
239 u64 tag;
240 u8 reserved2[4];
241 struct scsi_lun lun;
242 u8 reserved3;
243 u8 task_attr;
244 u8 reserved4;
245 u8 add_cdb_len;
246 u8 cdb[16];
247 u8 add_data[0];
248 };
249
250 enum {
251 SRP_RSP_FLAG_RSPVALID = 1 << 0,
252 SRP_RSP_FLAG_SNSVALID = 1 << 1,
253 SRP_RSP_FLAG_DOOVER = 1 << 2,
254 SRP_RSP_FLAG_DOUNDER = 1 << 3,
255 SRP_RSP_FLAG_DIOVER = 1 << 4,
256 SRP_RSP_FLAG_DIUNDER = 1 << 5
257 };
258
259
260
261
262
263
264 struct srp_rsp {
265 u8 opcode;
266 u8 sol_not;
267 u8 reserved1[2];
268 __be32 req_lim_delta;
269 u64 tag;
270 u8 reserved2[2];
271 u8 flags;
272 u8 status;
273 __be32 data_out_res_cnt;
274 __be32 data_in_res_cnt;
275 __be32 sense_data_len;
276 __be32 resp_data_len;
277 u8 data[0];
278 } __attribute__((packed));
279
280 struct srp_cred_req {
281 u8 opcode;
282 u8 sol_not;
283 u8 reserved[2];
284 __be32 req_lim_delta;
285 u64 tag;
286 };
287
288 struct srp_cred_rsp {
289 u8 opcode;
290 u8 reserved[7];
291 u64 tag;
292 };
293
294
295
296
297
298
299 struct srp_aer_req {
300 u8 opcode;
301 u8 sol_not;
302 u8 reserved[2];
303 __be32 req_lim_delta;
304 u64 tag;
305 u32 reserved2;
306 struct scsi_lun lun;
307 __be32 sense_data_len;
308 u32 reserved3;
309 u8 sense_data[0];
310 } __attribute__((packed));
311
312 struct srp_aer_rsp {
313 u8 opcode;
314 u8 reserved[7];
315 u64 tag;
316 };
317
318 #endif