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};
72
73enum {
74 SRP_TSK_ABORT_TASK = 0x01,
75 SRP_TSK_ABORT_TASK_SET = 0x02,
76 SRP_TSK_CLEAR_TASK_SET = 0x04,
77 SRP_TSK_LUN_RESET = 0x08,
78 SRP_TSK_CLEAR_ACA = 0x40
79};
80
81enum srp_login_rej_reason {
82 SRP_LOGIN_REJ_UNABLE_ESTABLISH_CHANNEL = 0x00010000,
83 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES = 0x00010001,
84 SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE = 0x00010002,
85 SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL = 0x00010003,
86 SRP_LOGIN_REJ_UNSUPPORTED_DESCRIPTOR_FMT = 0x00010004,
87 SRP_LOGIN_REJ_MULTI_CHANNEL_UNSUPPORTED = 0x00010005,
88 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED = 0x00010006
89};
90
91enum {
92 SRP_REV10_IB_IO_CLASS = 0xff00,
93 SRP_REV16A_IB_IO_CLASS = 0x0100
94};
95
96struct srp_direct_buf {
97 __be64 va;
98 __be32 key;
99 __be32 len;
100};
101
102
103
104
105
106
107
108struct srp_indirect_buf {
109 struct srp_direct_buf table_desc;
110 __be32 len;
111 struct srp_direct_buf desc_list[0];
112} __attribute__((packed));
113
114enum {
115 SRP_MULTICHAN_SINGLE = 0,
116 SRP_MULTICHAN_MULTI = 1
117};
118
119struct srp_login_req {
120 u8 opcode;
121 u8 reserved1[7];
122 u64 tag;
123 __be32 req_it_iu_len;
124 u8 reserved2[4];
125 __be16 req_buf_fmt;
126 u8 req_flags;
127 u8 reserved3[5];
128 u8 initiator_port_id[16];
129 u8 target_port_id[16];
130};
131
132
133
134
135
136
137
138
139struct srp_login_req_rdma {
140 u64 tag;
141 __be16 req_buf_fmt;
142 u8 req_flags;
143 u8 opcode;
144 __be32 req_it_iu_len;
145 u8 initiator_port_id[16];
146 u8 target_port_id[16];
147};
148
149
150
151
152
153
154struct srp_login_rsp {
155 u8 opcode;
156 u8 reserved1[3];
157 __be32 req_lim_delta;
158 u64 tag;
159 __be32 max_it_iu_len;
160 __be32 max_ti_iu_len;
161 __be16 buf_fmt;
162 u8 rsp_flags;
163 u8 reserved2[25];
164} __attribute__((packed));
165
166struct srp_login_rej {
167 u8 opcode;
168 u8 reserved1[3];
169 __be32 reason;
170 u64 tag;
171 u8 reserved2[8];
172 __be16 buf_fmt;
173 u8 reserved3[6];
174};
175
176struct srp_i_logout {
177 u8 opcode;
178 u8 reserved[7];
179 u64 tag;
180};
181
182struct srp_t_logout {
183 u8 opcode;
184 u8 sol_not;
185 u8 reserved[2];
186 __be32 reason;
187 u64 tag;
188};
189
190
191
192
193
194struct srp_tsk_mgmt {
195 u8 opcode;
196 u8 sol_not;
197 u8 reserved1[6];
198 u64 tag;
199 u8 reserved2[4];
200 struct scsi_lun lun;
201 u8 reserved3[2];
202 u8 tsk_mgmt_func;
203 u8 reserved4;
204 u64 task_tag;
205 u8 reserved5[8];
206};
207
208
209
210
211
212struct srp_cmd {
213 u8 opcode;
214 u8 sol_not;
215 u8 reserved1[3];
216 u8 buf_fmt;
217 u8 data_out_desc_cnt;
218 u8 data_in_desc_cnt;
219 u64 tag;
220 u8 reserved2[4];
221 struct scsi_lun lun;
222 u8 reserved3;
223 u8 task_attr;
224 u8 reserved4;
225 u8 add_cdb_len;
226 u8 cdb[16];
227 u8 add_data[0];
228};
229
230enum {
231 SRP_RSP_FLAG_RSPVALID = 1 << 0,
232 SRP_RSP_FLAG_SNSVALID = 1 << 1,
233 SRP_RSP_FLAG_DOOVER = 1 << 2,
234 SRP_RSP_FLAG_DOUNDER = 1 << 3,
235 SRP_RSP_FLAG_DIOVER = 1 << 4,
236 SRP_RSP_FLAG_DIUNDER = 1 << 5
237};
238
239
240
241
242
243
244struct srp_rsp {
245 u8 opcode;
246 u8 sol_not;
247 u8 reserved1[2];
248 __be32 req_lim_delta;
249 u64 tag;
250 u8 reserved2[2];
251 u8 flags;
252 u8 status;
253 __be32 data_out_res_cnt;
254 __be32 data_in_res_cnt;
255 __be32 sense_data_len;
256 __be32 resp_data_len;
257 u8 data[0];
258} __attribute__((packed));
259
260struct srp_cred_req {
261 u8 opcode;
262 u8 sol_not;
263 u8 reserved[2];
264 __be32 req_lim_delta;
265 u64 tag;
266};
267
268struct srp_cred_rsp {
269 u8 opcode;
270 u8 reserved[7];
271 u64 tag;
272};
273
274
275
276
277
278
279struct srp_aer_req {
280 u8 opcode;
281 u8 sol_not;
282 u8 reserved[2];
283 __be32 req_lim_delta;
284 u64 tag;
285 u32 reserved2;
286 struct scsi_lun lun;
287 __be32 sense_data_len;
288 u32 reserved3;
289 u8 sense_data[0];
290} __attribute__((packed));
291
292struct srp_aer_rsp {
293 u8 opcode;
294 u8 reserved[7];
295 u64 tag;
296};
297
298#endif
299