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