This source file includes following definitions.
- fcnvme_lsdesc_len
1
2
3
4
5
6
7
8
9
10
11 #ifndef _NVME_FC_H
12 #define _NVME_FC_H 1
13
14
15 #define NVME_CMD_SCSI_ID 0xFD
16 #define NVME_CMD_FC_ID FC_TYPE_NVME
17
18
19 #define FCNVME_CMD_FLAGS_DIRMASK 0x03
20 #define FCNVME_CMD_FLAGS_WRITE 0x01
21 #define FCNVME_CMD_FLAGS_READ 0x02
22
23 struct nvme_fc_cmd_iu {
24 __u8 scsi_id;
25 __u8 fc_id;
26 __be16 iu_len;
27 __u8 rsvd4[3];
28 __u8 flags;
29 __be64 connection_id;
30 __be32 csn;
31 __be32 data_len;
32 struct nvme_command sqe;
33 __be32 rsvd88[2];
34 };
35
36 #define NVME_FC_SIZEOF_ZEROS_RSP 12
37
38 enum {
39 FCNVME_SC_SUCCESS = 0,
40 FCNVME_SC_INVALID_FIELD = 1,
41 FCNVME_SC_INVALID_CONNID = 2,
42 };
43
44 struct nvme_fc_ersp_iu {
45 __u8 status_code;
46 __u8 rsvd1;
47 __be16 iu_len;
48 __be32 rsn;
49 __be32 xfrd_len;
50 __be32 rsvd12;
51 struct nvme_completion cqe;
52
53 };
54
55
56
57 enum {
58 FCNVME_LS_RSVD = 0,
59 FCNVME_LS_RJT = 1,
60 FCNVME_LS_ACC = 2,
61 FCNVME_LS_CREATE_ASSOCIATION = 3,
62 FCNVME_LS_CREATE_CONNECTION = 4,
63 FCNVME_LS_DISCONNECT = 5,
64 };
65
66
67 enum {
68 FCNVME_LSDESC_RSVD = 0x0,
69 FCNVME_LSDESC_RQST = 0x1,
70 FCNVME_LSDESC_RJT = 0x2,
71 FCNVME_LSDESC_CREATE_ASSOC_CMD = 0x3,
72 FCNVME_LSDESC_CREATE_CONN_CMD = 0x4,
73 FCNVME_LSDESC_DISCONN_CMD = 0x5,
74 FCNVME_LSDESC_CONN_ID = 0x6,
75 FCNVME_LSDESC_ASSOC_ID = 0x7,
76 };
77
78
79
80
81
82
83
84
85 static inline __be32 fcnvme_lsdesc_len(size_t sz)
86 {
87 return cpu_to_be32(sz - (2 * sizeof(u32)));
88 }
89
90 struct fcnvme_ls_rqst_w0 {
91 u8 ls_cmd;
92 u8 zeros[3];
93 };
94
95
96 struct fcnvme_lsdesc_rqst {
97 __be32 desc_tag;
98 __be32 desc_len;
99 struct fcnvme_ls_rqst_w0 w0;
100 __be32 rsvd12;
101 };
102
103
104 enum fcnvme_ls_rjt_reason {
105 FCNVME_RJT_RC_NONE = 0,
106
107
108 FCNVME_RJT_RC_INVAL = 0x01,
109
110
111 FCNVME_RJT_RC_LOGIC = 0x03,
112
113
114 FCNVME_RJT_RC_UNAB = 0x09,
115
116
117 FCNVME_RJT_RC_UNSUP = 0x0b,
118
119
120 FCNVME_RJT_RC_INPROG = 0x0e,
121
122
123 FCNVME_RJT_RC_INV_ASSOC = 0x40,
124
125
126 FCNVME_RJT_RC_INV_CONN = 0x41,
127
128
129 FCNVME_RJT_RC_VENDOR = 0xff,
130
131 };
132
133
134 enum fcnvme_ls_rjt_explan {
135 FCNVME_RJT_EXP_NONE = 0x00,
136
137
138 FCNVME_RJT_EXP_OXID_RXID = 0x17,
139
140
141 FCNVME_RJT_EXP_INSUF_RES = 0x29,
142
143
144 FCNVME_RJT_EXP_UNAB_DATA = 0x2a,
145
146
147 FCNVME_RJT_EXP_INV_LEN = 0x2d,
148
149 };
150
151
152 struct fcnvme_lsdesc_rjt {
153 __be32 desc_tag;
154 __be32 desc_len;
155 u8 rsvd8;
156
157
158
159
160
161 u8 reason_code;
162 u8 reason_explanation;
163
164 u8 vendor;
165 __be32 rsvd12;
166 };
167
168
169 #define FCNVME_ASSOC_HOSTNQN_LEN 256
170 #define FCNVME_ASSOC_SUBNQN_LEN 256
171
172
173 struct fcnvme_lsdesc_cr_assoc_cmd {
174 __be32 desc_tag;
175 __be32 desc_len;
176 __be16 ersp_ratio;
177 __be16 rsvd10;
178 __be32 rsvd12[9];
179 __be16 cntlid;
180 __be16 sqsize;
181 __be32 rsvd52;
182 uuid_t hostid;
183 u8 hostnqn[FCNVME_ASSOC_HOSTNQN_LEN];
184 u8 subnqn[FCNVME_ASSOC_SUBNQN_LEN];
185 __be32 rsvd584[108];
186
187
188
189 };
190
191 #define FCNVME_LSDESC_CRA_CMD_DESC_MINLEN \
192 offsetof(struct fcnvme_lsdesc_cr_assoc_cmd, rsvd584)
193
194 #define FCNVME_LSDESC_CRA_CMD_DESC_MIN_DESCLEN \
195 (FCNVME_LSDESC_CRA_CMD_DESC_MINLEN - \
196 offsetof(struct fcnvme_lsdesc_cr_assoc_cmd, ersp_ratio))
197
198
199
200
201 struct fcnvme_lsdesc_cr_conn_cmd {
202 __be32 desc_tag;
203 __be32 desc_len;
204 __be16 ersp_ratio;
205 __be16 rsvd10;
206 __be32 rsvd12[9];
207 __be16 qid;
208 __be16 sqsize;
209 __be32 rsvd52;
210 };
211
212
213 enum {
214 FCNVME_DISCONN_ASSOCIATION = 0,
215 FCNVME_DISCONN_CONNECTION = 1,
216 };
217
218
219 struct fcnvme_lsdesc_disconn_cmd {
220 __be32 desc_tag;
221 __be32 desc_len;
222 u8 rsvd8[3];
223
224 u8 scope;
225 __be32 rsvd12;
226 __be64 id;
227 };
228
229
230 struct fcnvme_lsdesc_conn_id {
231 __be32 desc_tag;
232 __be32 desc_len;
233 __be64 connection_id;
234 };
235
236
237 struct fcnvme_lsdesc_assoc_id {
238 __be32 desc_tag;
239 __be32 desc_len;
240 __be64 association_id;
241 };
242
243
244 enum {
245 FCNVME_RS_RCTL_DATA = 1,
246 FCNVME_RS_RCTL_XFER_RDY = 5,
247 FCNVME_RS_RCTL_RSP = 8,
248 };
249
250
251
252
253
254
255 struct fcnvme_ls_rjt {
256 struct fcnvme_ls_rqst_w0 w0;
257 __be32 desc_list_len;
258 struct fcnvme_lsdesc_rqst rqst;
259 struct fcnvme_lsdesc_rjt rjt;
260 };
261
262
263 struct fcnvme_ls_acc_hdr {
264 struct fcnvme_ls_rqst_w0 w0;
265 __be32 desc_list_len;
266 struct fcnvme_lsdesc_rqst rqst;
267
268 };
269
270
271 struct fcnvme_ls_cr_assoc_rqst {
272 struct fcnvme_ls_rqst_w0 w0;
273 __be32 desc_list_len;
274 struct fcnvme_lsdesc_cr_assoc_cmd assoc_cmd;
275 };
276
277 #define FCNVME_LSDESC_CRA_RQST_MINLEN \
278 (offsetof(struct fcnvme_ls_cr_assoc_rqst, assoc_cmd) + \
279 FCNVME_LSDESC_CRA_CMD_DESC_MINLEN)
280
281 #define FCNVME_LSDESC_CRA_RQST_MIN_LISTLEN \
282 FCNVME_LSDESC_CRA_CMD_DESC_MINLEN
283
284
285 struct fcnvme_ls_cr_assoc_acc {
286 struct fcnvme_ls_acc_hdr hdr;
287 struct fcnvme_lsdesc_assoc_id associd;
288 struct fcnvme_lsdesc_conn_id connectid;
289 };
290
291
292
293 struct fcnvme_ls_cr_conn_rqst {
294 struct fcnvme_ls_rqst_w0 w0;
295 __be32 desc_list_len;
296 struct fcnvme_lsdesc_assoc_id associd;
297 struct fcnvme_lsdesc_cr_conn_cmd connect_cmd;
298 };
299
300 struct fcnvme_ls_cr_conn_acc {
301 struct fcnvme_ls_acc_hdr hdr;
302 struct fcnvme_lsdesc_conn_id connectid;
303 };
304
305
306 struct fcnvme_ls_disconnect_rqst {
307 struct fcnvme_ls_rqst_w0 w0;
308 __be32 desc_list_len;
309 struct fcnvme_lsdesc_assoc_id associd;
310 struct fcnvme_lsdesc_disconn_cmd discon_cmd;
311 };
312
313 struct fcnvme_ls_disconnect_acc {
314 struct fcnvme_ls_acc_hdr hdr;
315 };
316
317
318
319
320
321 #define NVME_FC_CONNECT_TIMEOUT_SEC 2
322 #define NVME_FC_LS_TIMEOUT_SEC 2
323 #define NVME_FC_TGTOP_TIMEOUT_SEC 2
324
325
326
327
328
329
330
331
332 #define NVME_FC_TRADDR_NNLEN 3
333 #define NVME_FC_TRADDR_OXNNLEN 5
334 #define NVME_FC_TRADDR_HEXNAMELEN 16
335 #define NVME_FC_TRADDR_MINLENGTH \
336 (2 * (NVME_FC_TRADDR_NNLEN + NVME_FC_TRADDR_HEXNAMELEN) + 1)
337 #define NVME_FC_TRADDR_MAXLENGTH \
338 (2 * (NVME_FC_TRADDR_OXNNLEN + NVME_FC_TRADDR_HEXNAMELEN) + 1)
339 #define NVME_FC_TRADDR_MIN_PN_OFFSET \
340 (NVME_FC_TRADDR_NNLEN + NVME_FC_TRADDR_HEXNAMELEN + 1)
341 #define NVME_FC_TRADDR_MAX_PN_OFFSET \
342 (NVME_FC_TRADDR_OXNNLEN + NVME_FC_TRADDR_HEXNAMELEN + 1)
343
344
345 #endif