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
46enum {
47 SRP_LOGIN_REQ = 0x00,
48 SRP_TSK_MGMT = 0x01,
49 SRP_CMD = 0x02,
50 SRP_I_LOGOUT = 0x03,
51 SRP_LOGIN_RSP = 0xc0,
52 SRP_RSP = 0xc1,
53 SRP_LOGIN_REJ = 0xc2,
54 SRP_T_LOGOUT = 0x80,
55 SRP_CRED_REQ = 0x81,
56 SRP_AER_REQ = 0x82,
57 SRP_CRED_RSP = 0x41,
58 SRP_AER_RSP = 0x42
59};
60
61enum {
62 SRP_BUF_FORMAT_DIRECT = 1 << 1,
63 SRP_BUF_FORMAT_INDIRECT = 1 << 2
64};
65
66enum {
67 SRP_NO_DATA_DESC = 0,
68 SRP_DATA_DESC_DIRECT = 1,
69 SRP_DATA_DESC_INDIRECT = 2
70};
71
72enum {
73 SRP_TSK_ABORT_TASK = 0x01,
74 SRP_TSK_ABORT_TASK_SET = 0x02,
75 SRP_TSK_CLEAR_TASK_SET = 0x04,
76 SRP_TSK_LUN_RESET = 0x08,
77 SRP_TSK_CLEAR_ACA = 0x40
78};
79
80enum srp_login_rej_reason {
81 SRP_LOGIN_REJ_UNABLE_ESTABLISH_CHANNEL = 0x00010000,
82 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES = 0x00010001,
83 SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE = 0x00010002,
84 SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL = 0x00010003,
85 SRP_LOGIN_REJ_UNSUPPORTED_DESCRIPTOR_FMT = 0x00010004,
86 SRP_LOGIN_REJ_MULTI_CHANNEL_UNSUPPORTED = 0x00010005,
87 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED = 0x00010006
88};
89
90enum {
91 SRP_REV10_IB_IO_CLASS = 0xff00,
92 SRP_REV16A_IB_IO_CLASS = 0x0100
93};
94
95struct srp_direct_buf {
96 __be64 va;
97 __be32 key;
98 __be32 len;
99};
100
101
102
103
104
105
106
107struct srp_indirect_buf {
108 struct srp_direct_buf table_desc;
109 __be32 len;
110 struct srp_direct_buf desc_list[0];
111} __attribute__((packed));
112
113enum {
114 SRP_MULTICHAN_SINGLE = 0,
115 SRP_MULTICHAN_MULTI = 1
116};
117
118struct srp_login_req {
119 u8 opcode;
120 u8 reserved1[7];
121 u64 tag;
122 __be32 req_it_iu_len;
123 u8 reserved2[4];
124 __be16 req_buf_fmt;
125 u8 req_flags;
126 u8 reserved3[5];
127 u8 initiator_port_id[16];
128 u8 target_port_id[16];
129};
130
131
132
133
134
135
136struct srp_login_rsp {
137 u8 opcode;
138 u8 reserved1[3];
139 __be32 req_lim_delta;
140 u64 tag;
141 __be32 max_it_iu_len;
142 __be32 max_ti_iu_len;
143 __be16 buf_fmt;
144 u8 rsp_flags;
145 u8 reserved2[25];
146} __attribute__((packed));
147
148struct srp_login_rej {
149 u8 opcode;
150 u8 reserved1[3];
151 __be32 reason;
152 u64 tag;
153 u8 reserved2[8];
154 __be16 buf_fmt;
155 u8 reserved3[6];
156};
157
158struct srp_i_logout {
159 u8 opcode;
160 u8 reserved[7];
161 u64 tag;
162};
163
164struct srp_t_logout {
165 u8 opcode;
166 u8 sol_not;
167 u8 reserved[2];
168 __be32 reason;
169 u64 tag;
170};
171
172
173
174
175
176struct srp_tsk_mgmt {
177 u8 opcode;
178 u8 sol_not;
179 u8 reserved1[6];
180 u64 tag;
181 u8 reserved2[4];
182 __be64 lun __attribute__((packed));
183 u8 reserved3[2];
184 u8 tsk_mgmt_func;
185 u8 reserved4;
186 u64 task_tag;
187 u8 reserved5[8];
188};
189
190
191
192
193
194struct srp_cmd {
195 u8 opcode;
196 u8 sol_not;
197 u8 reserved1[3];
198 u8 buf_fmt;
199 u8 data_out_desc_cnt;
200 u8 data_in_desc_cnt;
201 u64 tag;
202 u8 reserved2[4];
203 __be64 lun __attribute__((packed));
204 u8 reserved3;
205 u8 task_attr;
206 u8 reserved4;
207 u8 add_cdb_len;
208 u8 cdb[16];
209 u8 add_data[0];
210};
211
212enum {
213 SRP_RSP_FLAG_RSPVALID = 1 << 0,
214 SRP_RSP_FLAG_SNSVALID = 1 << 1,
215 SRP_RSP_FLAG_DOOVER = 1 << 2,
216 SRP_RSP_FLAG_DOUNDER = 1 << 3,
217 SRP_RSP_FLAG_DIOVER = 1 << 4,
218 SRP_RSP_FLAG_DIUNDER = 1 << 5
219};
220
221
222
223
224
225
226struct srp_rsp {
227 u8 opcode;
228 u8 sol_not;
229 u8 reserved1[2];
230 __be32 req_lim_delta;
231 u64 tag;
232 u8 reserved2[2];
233 u8 flags;
234 u8 status;
235 __be32 data_out_res_cnt;
236 __be32 data_in_res_cnt;
237 __be32 sense_data_len;
238 __be32 resp_data_len;
239 u8 data[0];
240} __attribute__((packed));
241
242#endif
243