]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | /* SPDX-License-Identifier: BSD-3-Clause |
2 | * Copyright 2008-2017 Cisco Systems, Inc. All rights reserved. | |
7c673cae | 3 | * Copyright 2007 Nuova Systems, Inc. All rights reserved. |
7c673cae FG |
4 | */ |
5 | ||
6 | #ifndef _VNIC_DEVCMD_H_ | |
7 | #define _VNIC_DEVCMD_H_ | |
8 | ||
9 | #define _CMD_NBITS 14 | |
10 | #define _CMD_VTYPEBITS 10 | |
11 | #define _CMD_FLAGSBITS 6 | |
12 | #define _CMD_DIRBITS 2 | |
13 | ||
14 | #define _CMD_NMASK ((1 << _CMD_NBITS)-1) | |
15 | #define _CMD_VTYPEMASK ((1 << _CMD_VTYPEBITS)-1) | |
16 | #define _CMD_FLAGSMASK ((1 << _CMD_FLAGSBITS)-1) | |
17 | #define _CMD_DIRMASK ((1 << _CMD_DIRBITS)-1) | |
18 | ||
19 | #define _CMD_NSHIFT 0 | |
20 | #define _CMD_VTYPESHIFT (_CMD_NSHIFT+_CMD_NBITS) | |
21 | #define _CMD_FLAGSSHIFT (_CMD_VTYPESHIFT+_CMD_VTYPEBITS) | |
22 | #define _CMD_DIRSHIFT (_CMD_FLAGSSHIFT+_CMD_FLAGSBITS) | |
23 | ||
24 | /* | |
25 | * Direction bits (from host perspective). | |
26 | */ | |
27 | #define _CMD_DIR_NONE 0U | |
28 | #define _CMD_DIR_WRITE 1U | |
29 | #define _CMD_DIR_READ 2U | |
30 | #define _CMD_DIR_RW (_CMD_DIR_WRITE | _CMD_DIR_READ) | |
31 | ||
32 | /* | |
33 | * Flag bits. | |
34 | */ | |
35 | #define _CMD_FLAGS_NONE 0U | |
36 | #define _CMD_FLAGS_NOWAIT 1U | |
37 | ||
38 | /* | |
39 | * vNIC type bits. | |
40 | */ | |
41 | #define _CMD_VTYPE_NONE 0U | |
42 | #define _CMD_VTYPE_ENET 1U | |
43 | #define _CMD_VTYPE_FC 2U | |
44 | #define _CMD_VTYPE_SCSI 4U | |
45 | #define _CMD_VTYPE_ALL (_CMD_VTYPE_ENET | _CMD_VTYPE_FC | _CMD_VTYPE_SCSI) | |
46 | ||
47 | /* | |
48 | * Used to create cmds.. | |
49 | */ | |
50 | #define _CMDCF(dir, flags, vtype, nr) \ | |
51 | (((dir) << _CMD_DIRSHIFT) | \ | |
52 | ((flags) << _CMD_FLAGSSHIFT) | \ | |
53 | ((vtype) << _CMD_VTYPESHIFT) | \ | |
54 | ((nr) << _CMD_NSHIFT)) | |
55 | #define _CMDC(dir, vtype, nr) _CMDCF(dir, 0, vtype, nr) | |
56 | #define _CMDCNW(dir, vtype, nr) _CMDCF(dir, _CMD_FLAGS_NOWAIT, vtype, nr) | |
57 | ||
58 | /* | |
59 | * Used to decode cmds.. | |
60 | */ | |
61 | #define _CMD_DIR(cmd) (((cmd) >> _CMD_DIRSHIFT) & _CMD_DIRMASK) | |
62 | #define _CMD_FLAGS(cmd) (((cmd) >> _CMD_FLAGSSHIFT) & _CMD_FLAGSMASK) | |
63 | #define _CMD_VTYPE(cmd) (((cmd) >> _CMD_VTYPESHIFT) & _CMD_VTYPEMASK) | |
64 | #define _CMD_N(cmd) (((cmd) >> _CMD_NSHIFT) & _CMD_NMASK) | |
65 | ||
11fdf7f2 TL |
66 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
67 | ||
7c673cae FG |
68 | enum vnic_devcmd_cmd { |
69 | CMD_NONE = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_NONE, 0), | |
70 | ||
71 | /* | |
72 | * mcpu fw info in mem: | |
73 | * in: | |
f67539c2 | 74 | * (uint64_t)a0=paddr to struct vnic_devcmd_fw_info |
7c673cae FG |
75 | * action: |
76 | * Fills in struct vnic_devcmd_fw_info (128 bytes) | |
77 | * note: | |
78 | * An old definition of CMD_MCPU_FW_INFO | |
79 | */ | |
80 | CMD_MCPU_FW_INFO_OLD = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 1), | |
81 | ||
82 | /* | |
83 | * mcpu fw info in mem: | |
84 | * in: | |
f67539c2 TL |
85 | * (uint64_t)a0=paddr to struct vnic_devcmd_fw_info |
86 | * (uint16_t)a1=size of the structure | |
7c673cae | 87 | * out: |
f67539c2 | 88 | * (uint16_t)a1=0 for in:a1 = 0, |
7c673cae FG |
89 | * data size actually written for other values. |
90 | * action: | |
91 | * Fills in first 128 bytes of vnic_devcmd_fw_info for in:a1 = 0, | |
92 | * first in:a1 bytes for 0 < in:a1 <= 132, | |
93 | * 132 bytes for other values of in:a1. | |
94 | * note: | |
95 | * CMD_MCPU_FW_INFO and CMD_MCPU_FW_INFO_OLD have the same enum 1 | |
96 | * for source compatibility. | |
97 | */ | |
98 | CMD_MCPU_FW_INFO = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 1), | |
99 | ||
100 | /* dev-specific block member: | |
f67539c2 | 101 | * in: (uint16_t)a0=offset,(uint8_t)a1=size |
7c673cae FG |
102 | * out: a0=value |
103 | */ | |
104 | CMD_DEV_SPEC = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 2), | |
105 | ||
106 | /* stats clear */ | |
107 | CMD_STATS_CLEAR = _CMDCNW(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 3), | |
108 | ||
f67539c2 TL |
109 | /* stats dump in mem: (uint64_t)a0=paddr to stats area, |
110 | * (uint16_t)a1=sizeof stats area | |
111 | */ | |
7c673cae FG |
112 | CMD_STATS_DUMP = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 4), |
113 | ||
f67539c2 | 114 | /* set Rx packet filter: (uint32_t)a0=filters (see CMD_PFILTER_*) */ |
7c673cae FG |
115 | CMD_PACKET_FILTER = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 7), |
116 | ||
f67539c2 TL |
117 | /* set Rx packet filter for all: (uint32_t)a0=filters |
118 | * (see CMD_PFILTER_*) | |
119 | */ | |
7c673cae FG |
120 | CMD_PACKET_FILTER_ALL = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 7), |
121 | ||
122 | /* hang detection notification */ | |
123 | CMD_HANG_NOTIFY = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 8), | |
124 | ||
125 | /* MAC address in (u48)a0 */ | |
126 | CMD_MAC_ADDR = _CMDC(_CMD_DIR_READ, | |
127 | _CMD_VTYPE_ENET | _CMD_VTYPE_FC, 9), | |
128 | #define CMD_GET_MAC_ADDR CMD_MAC_ADDR /* some uses are aliased */ | |
129 | ||
130 | /* add addr from (u48)a0 */ | |
131 | CMD_ADDR_ADD = _CMDCNW(_CMD_DIR_WRITE, | |
132 | _CMD_VTYPE_ENET | _CMD_VTYPE_FC, 12), | |
133 | ||
134 | /* del addr from (u48)a0 */ | |
135 | CMD_ADDR_DEL = _CMDCNW(_CMD_DIR_WRITE, | |
136 | _CMD_VTYPE_ENET | _CMD_VTYPE_FC, 13), | |
137 | ||
f67539c2 | 138 | /* add VLAN id in (uint16_t)a0 */ |
7c673cae FG |
139 | CMD_VLAN_ADD = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 14), |
140 | ||
f67539c2 | 141 | /* del VLAN id in (uint16_t)a0 */ |
7c673cae FG |
142 | CMD_VLAN_DEL = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 15), |
143 | ||
11fdf7f2 | 144 | /* |
f67539c2 | 145 | * nic_cfg in (uint32_t)a0 |
11fdf7f2 TL |
146 | * |
147 | * Capability query: | |
f67539c2 TL |
148 | * out: (uint64_t) a0= 1 if a1 is valid |
149 | * (uint64_t) a1= (NIC_CFG bits supported) | (flags << 32) | |
11fdf7f2 TL |
150 | * (flags are CMD_NIC_CFG_CAPF_xxx) |
151 | */ | |
7c673cae FG |
152 | CMD_NIC_CFG = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 16), |
153 | ||
11fdf7f2 TL |
154 | /* |
155 | * nic_cfg_chk (same as nic_cfg, but may return error) | |
f67539c2 | 156 | * in (uint32_t)a0 |
11fdf7f2 TL |
157 | * |
158 | * Capability query: | |
f67539c2 TL |
159 | * out: (uint64_t) a0= 1 if a1 is valid |
160 | * (uint64_t) a1= (NIC_CFG bits supported) | (flags << 32) | |
11fdf7f2 TL |
161 | * (flags are CMD_NIC_CFG_CAPF_xxx) |
162 | */ | |
163 | CMD_NIC_CFG_CHK = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 16), | |
164 | ||
f67539c2 | 165 | /* union vnic_rss_key in mem: (uint64_t)a0=paddr, (uint16_t)a1=len */ |
7c673cae FG |
166 | CMD_RSS_KEY = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 17), |
167 | ||
f67539c2 | 168 | /* union vnic_rss_cpu in mem: (uint64_t)a0=paddr, (uint16_t)a1=len */ |
7c673cae FG |
169 | CMD_RSS_CPU = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 18), |
170 | ||
171 | /* initiate softreset */ | |
172 | CMD_SOFT_RESET = _CMDCNW(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 19), | |
173 | ||
174 | /* softreset status: | |
175 | * out: a0=0 reset complete, a0=1 reset in progress */ | |
176 | CMD_SOFT_RESET_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 20), | |
177 | ||
178 | /* set struct vnic_devcmd_notify buffer in mem: | |
179 | * in: | |
f67539c2 TL |
180 | * (uint64_t)a0=paddr to notify (set paddr=0 to unset) |
181 | * (uint32_t)a1 & 0x00000000ffffffff=sizeof(struct vnic_devcmd_notify) | |
182 | * (uint16_t)a1 & 0x0000ffff00000000=intr num (-1 for no intr) | |
7c673cae | 183 | * out: |
f67539c2 | 184 | * (uint32_t)a1 = effective size |
7c673cae FG |
185 | */ |
186 | CMD_NOTIFY = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 21), | |
187 | ||
f67539c2 TL |
188 | /* UNDI API: (uint64_t)a0=paddr to s_PXENV_UNDI_ struct, |
189 | * (uint8_t)a1=PXENV_UNDI_xxx | |
190 | */ | |
7c673cae FG |
191 | CMD_UNDI = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 22), |
192 | ||
f67539c2 | 193 | /* initiate open sequence (uint32_t)a0=flags (see CMD_OPENF_*) */ |
7c673cae FG |
194 | CMD_OPEN = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 23), |
195 | ||
196 | /* open status: | |
197 | * out: a0=0 open complete, a0=1 open in progress */ | |
198 | CMD_OPEN_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 24), | |
199 | ||
200 | /* close vnic */ | |
201 | CMD_CLOSE = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 25), | |
202 | ||
f67539c2 | 203 | /* initialize virtual link: (uint32_t)a0=flags (see CMD_INITF_*) */ |
7c673cae FG |
204 | /***** Replaced by CMD_INIT *****/ |
205 | CMD_INIT_v1 = _CMDCNW(_CMD_DIR_READ, _CMD_VTYPE_ALL, 26), | |
206 | ||
207 | /* variant of CMD_INIT, with provisioning info | |
f67539c2 TL |
208 | * (uint64_t)a0=paddr of vnic_devcmd_provinfo |
209 | * (uint32_t)a1=sizeof provision info | |
210 | */ | |
7c673cae FG |
211 | CMD_INIT_PROV_INFO = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 27), |
212 | ||
213 | /* enable virtual link */ | |
214 | CMD_ENABLE = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 28), | |
215 | ||
216 | /* enable virtual link, waiting variant. */ | |
217 | CMD_ENABLE_WAIT = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 28), | |
218 | ||
219 | /* disable virtual link */ | |
220 | CMD_DISABLE = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 29), | |
221 | ||
222 | /* stats dump sum of all vnic stats on same uplink in mem: | |
f67539c2 TL |
223 | * (uint64_t)a0=paddr |
224 | * (uint16_t)a1=sizeof stats area | |
225 | */ | |
7c673cae FG |
226 | CMD_STATS_DUMP_ALL = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 30), |
227 | ||
228 | /* init status: | |
229 | * out: a0=0 init complete, a0=1 init in progress | |
f67539c2 TL |
230 | * if a0=0, a1=errno |
231 | */ | |
7c673cae FG |
232 | CMD_INIT_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 31), |
233 | ||
f67539c2 TL |
234 | /* INT13 API: (uint64_t)a0=paddr to vnic_int13_params struct |
235 | * (uint32_t)a1=INT13_CMD_xxx | |
236 | */ | |
7c673cae FG |
237 | CMD_INT13 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_FC, 32), |
238 | ||
f67539c2 | 239 | /* logical uplink enable/disable: (uint64_t)a0: 0/1=disable/enable */ |
7c673cae FG |
240 | CMD_LOGICAL_UPLINK = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 33), |
241 | ||
242 | /* undo initialize of virtual link */ | |
243 | CMD_DEINIT = _CMDCNW(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 34), | |
244 | ||
f67539c2 | 245 | /* initialize virtual link: (uint32_t)a0=flags (see CMD_INITF_*) */ |
7c673cae FG |
246 | CMD_INIT = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 35), |
247 | ||
248 | /* check fw capability of a cmd: | |
f67539c2 TL |
249 | * in: (uint32_t)a0=cmd |
250 | * out: (uint32_t)a0=errno, 0:valid cmd, a1=supported VNIC_STF_* bits | |
251 | */ | |
7c673cae FG |
252 | CMD_CAPABILITY = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 36), |
253 | ||
254 | /* persistent binding info | |
f67539c2 TL |
255 | * in: (uint64_t)a0=paddr of arg |
256 | * (uint32_t)a1=CMD_PERBI_XXX | |
257 | */ | |
7c673cae FG |
258 | CMD_PERBI = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_FC, 37), |
259 | ||
260 | /* Interrupt Assert Register functionality | |
f67539c2 | 261 | * in: (uint16_t)a0=interrupt number to assert |
7c673cae FG |
262 | */ |
263 | CMD_IAR = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 38), | |
264 | ||
265 | /* initiate hangreset, like softreset after hang detected */ | |
266 | CMD_HANG_RESET = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 39), | |
267 | ||
268 | /* hangreset status: | |
f67539c2 TL |
269 | * out: a0=0 reset complete, a0=1 reset in progress |
270 | */ | |
7c673cae FG |
271 | CMD_HANG_RESET_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 40), |
272 | ||
273 | /* | |
274 | * Set hw ingress packet vlan rewrite mode: | |
f67539c2 TL |
275 | * in: (uint32_t)a0=new vlan rewrite mode |
276 | * out: (uint32_t)a0=old vlan rewrite mode | |
277 | */ | |
7c673cae FG |
278 | CMD_IG_VLAN_REWRITE_MODE = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 41), |
279 | ||
280 | /* | |
f67539c2 TL |
281 | * in: (uint16_t)a0=bdf of target vnic |
282 | * (uint32_t)a1=cmd to proxy | |
7c673cae | 283 | * a2-a15=args to cmd in a1 |
f67539c2 TL |
284 | * out: (uint32_t)a0=status of proxied cmd |
285 | * a1-a15=out args of proxied cmd | |
286 | */ | |
7c673cae FG |
287 | CMD_PROXY_BY_BDF = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 42), |
288 | ||
289 | /* | |
290 | * As for BY_BDF except a0 is index of hvnlink subordinate vnic | |
291 | * or SR-IOV virtual vnic | |
292 | */ | |
293 | CMD_PROXY_BY_INDEX = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 43), | |
294 | ||
295 | /* | |
296 | * For HPP toggle: | |
297 | * adapter-info-get | |
f67539c2 TL |
298 | * in: (uint64_t)a0=phsical address of buffer passed in from caller. |
299 | * (uint16_t)a1=size of buffer specified in a0. | |
300 | * out: (uint64_t)a0=phsical address of buffer passed in from caller. | |
301 | * (uint16_t)a1=actual bytes from VIF-CONFIG-INFO TLV, or | |
302 | * 0 if no VIF-CONFIG-INFO TLV was ever received. | |
303 | */ | |
7c673cae FG |
304 | CMD_CONFIG_INFO_GET = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 44), |
305 | ||
306 | /* | |
f67539c2 TL |
307 | * INT13 API: (uint64_t)a0=paddr to vnic_int13_params struct |
308 | * (uint32_t)a1=INT13_CMD_xxx | |
7c673cae FG |
309 | */ |
310 | CMD_INT13_ALL = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 45), | |
311 | ||
312 | /* | |
313 | * Set default vlan: | |
f67539c2 TL |
314 | * in: (uint16_t)a0=new default vlan |
315 | * (uint16_t)a1=zero for overriding vlan with param a0, | |
7c673cae | 316 | * non-zero for resetting vlan to the default |
f67539c2 | 317 | * out: (uint16_t)a0=old default vlan |
7c673cae FG |
318 | */ |
319 | CMD_SET_DEFAULT_VLAN = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 46), | |
320 | ||
321 | /* init_prov_info2: | |
322 | * Variant of CMD_INIT_PROV_INFO, where it will not try to enable | |
323 | * the vnic until CMD_ENABLE2 is issued. | |
f67539c2 TL |
324 | * (uint64_t)a0=paddr of vnic_devcmd_provinfo |
325 | * (uint32_t)a1=sizeof provision info | |
326 | */ | |
7c673cae FG |
327 | CMD_INIT_PROV_INFO2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 47), |
328 | ||
329 | /* enable2: | |
f67539c2 | 330 | * (uint32_t)a0=0 ==> standby |
7c673cae FG |
331 | * =CMD_ENABLE2_ACTIVE ==> active |
332 | */ | |
333 | CMD_ENABLE2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 48), | |
334 | ||
335 | /* | |
336 | * cmd_status: | |
337 | * Returns the status of the specified command | |
338 | * Input: | |
339 | * a0 = command for which status is being queried. | |
340 | * Possible values are: | |
341 | * CMD_SOFT_RESET | |
342 | * CMD_HANG_RESET | |
343 | * CMD_OPEN | |
344 | * CMD_INIT | |
345 | * CMD_INIT_PROV_INFO | |
346 | * CMD_DEINIT | |
347 | * CMD_INIT_PROV_INFO2 | |
348 | * CMD_ENABLE2 | |
349 | * Output: | |
350 | * if status == STAT_ERROR | |
351 | * a0 = ERR_ENOTSUPPORTED - status for command in a0 is | |
352 | * not supported | |
353 | * if status == STAT_NONE | |
354 | * a0 = status of the devcmd specified in a0 as follows. | |
355 | * ERR_SUCCESS - command in a0 completed successfully | |
356 | * ERR_EINPROGRESS - command in a0 is still in progress | |
357 | */ | |
358 | CMD_STATUS = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 49), | |
359 | ||
360 | /* | |
361 | * Returns interrupt coalescing timer conversion factors. | |
362 | * After calling this devcmd, ENIC driver can convert | |
363 | * interrupt coalescing timer in usec into CPU cycles as follows: | |
364 | * | |
365 | * intr_timer_cycles = intr_timer_usec * multiplier / divisor | |
366 | * | |
367 | * Interrupt coalescing timer in usecs can be be converted/obtained | |
368 | * from CPU cycles as follows: | |
369 | * | |
370 | * intr_timer_usec = intr_timer_cycles * divisor / multiplier | |
371 | * | |
372 | * in: none | |
f67539c2 TL |
373 | * out: (uint32_t)a0 = multiplier |
374 | * (uint32_t)a1 = divisor | |
375 | * (uint32_t)a2 = maximum timer value in usec | |
7c673cae FG |
376 | */ |
377 | CMD_INTR_COAL_CONVERT = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 50), | |
378 | ||
379 | /* | |
380 | * ISCSI DUMP API: | |
f67539c2 TL |
381 | * in: (uint64_t)a0=paddr of the param or param itself |
382 | * (uint32_t)a1=ISCSI_CMD_xxx | |
7c673cae FG |
383 | */ |
384 | CMD_ISCSI_DUMP_REQ = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 51), | |
385 | ||
386 | /* | |
387 | * ISCSI DUMP STATUS API: | |
f67539c2 TL |
388 | * in: (uint32_t)a0=cmd tag |
389 | * in: (uint32_t)a1=ISCSI_CMD_xxx | |
390 | * out: (uint32_t)a0=cmd status | |
7c673cae FG |
391 | */ |
392 | CMD_ISCSI_DUMP_STATUS = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 52), | |
393 | ||
394 | /* | |
395 | * Subvnic migration from MQ <--> VF. | |
396 | * Enable the LIF migration from MQ to VF and vice versa. MQ and VF | |
397 | * indexes are statically bound at the time of initialization. | |
398 | * Based on the direction of migration, the resources of either MQ or | |
399 | * the VF shall be attached to the LIF. | |
f67539c2 | 400 | * in: (uint32_t)a0=Direction of Migration |
7c673cae FG |
401 | * 0=> Migrate to VF |
402 | * 1=> Migrate to MQ | |
f67539c2 | 403 | * (uint32_t)a1=VF index (MQ index) |
7c673cae FG |
404 | */ |
405 | CMD_MIGRATE_SUBVNIC = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 53), | |
406 | ||
407 | /* | |
408 | * Register / Deregister the notification block for MQ subvnics | |
409 | * in: | |
f67539c2 TL |
410 | * (uint64_t)a0=paddr to notify (set paddr=0 to unset) |
411 | * (uint32_t)a1 & 0x00000000ffffffff=sizeof(struct vnic_devcmd_notify) | |
412 | * (uint16_t)a1 & 0x0000ffff00000000=intr num (-1 for no intr) | |
7c673cae | 413 | * out: |
f67539c2 | 414 | * (uint32_t)a1 = effective size |
7c673cae FG |
415 | */ |
416 | CMD_SUBVNIC_NOTIFY = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 54), | |
417 | ||
418 | /* | |
419 | * Set the predefined mac address as default | |
420 | * in: | |
421 | * (u48)a0=mac addr | |
422 | */ | |
423 | CMD_SET_MAC_ADDR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 55), | |
424 | ||
425 | /* Update the provisioning info of the given VIF | |
f67539c2 TL |
426 | * (uint64_t)a0=paddr of vnic_devcmd_provinfo |
427 | * (uint32_t)a1=sizeof provision info | |
428 | */ | |
7c673cae FG |
429 | CMD_PROV_INFO_UPDATE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 56), |
430 | ||
431 | /* | |
432 | * Initialization for the devcmd2 interface. | |
f67539c2 TL |
433 | * in: (uint64_t) a0=host result buffer physical address |
434 | * in: (uint16_t) a1=number of entries in result buffer | |
7c673cae FG |
435 | */ |
436 | CMD_INITIALIZE_DEVCMD2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 57), | |
437 | ||
438 | /* | |
439 | * Add a filter. | |
f67539c2 TL |
440 | * in: (uint64_t) a0= filter address |
441 | * (uint32_t) a1= size of filter | |
442 | * out: (uint32_t) a0=filter identifier | |
7c673cae FG |
443 | * |
444 | * Capability query: | |
f67539c2 TL |
445 | * out: (uint64_t) a0= 1 if capability query supported |
446 | * (uint64_t) a1= MAX filter type supported | |
7c673cae FG |
447 | */ |
448 | CMD_ADD_FILTER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 58), | |
449 | ||
450 | /* | |
451 | * Delete a filter. | |
f67539c2 | 452 | * in: (uint32_t) a0=filter identifier |
7c673cae FG |
453 | */ |
454 | CMD_DEL_FILTER = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 59), | |
455 | ||
456 | /* | |
457 | * Enable a Queue Pair in User space NIC | |
f67539c2 TL |
458 | * in: (uint32_t) a0=Queue Pair number |
459 | * (uint32_t) a1= command | |
7c673cae FG |
460 | */ |
461 | CMD_QP_ENABLE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 60), | |
462 | ||
463 | /* | |
464 | * Disable a Queue Pair in User space NIC | |
f67539c2 TL |
465 | * in: (uint32_t) a0=Queue Pair number |
466 | * (uint32_t) a1= command | |
7c673cae FG |
467 | */ |
468 | CMD_QP_DISABLE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 61), | |
469 | ||
470 | /* | |
471 | * Stats dump Queue Pair in User space NIC | |
f67539c2 TL |
472 | * in: (uint32_t) a0=Queue Pair number |
473 | * (uint64_t) a1=host buffer addr for status dump | |
474 | * (uint32_t) a2=length of the buffer | |
7c673cae FG |
475 | */ |
476 | CMD_QP_STATS_DUMP = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 62), | |
477 | ||
478 | /* | |
479 | * Clear stats for Queue Pair in User space NIC | |
f67539c2 | 480 | * in: (uint32_t) a0=Queue Pair number |
7c673cae FG |
481 | */ |
482 | CMD_QP_STATS_CLEAR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 63), | |
483 | ||
484 | /* | |
f67539c2 | 485 | * UEFI BOOT API: (uint64_t)a0= UEFI FLS_CMD_xxx |
7c673cae FG |
486 | * (ui64)a1= paddr for the info buffer |
487 | */ | |
488 | CMD_FC_REQ = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_FC, 64), | |
489 | ||
490 | /* | |
491 | * Return the iSCSI config details required by the EFI Option ROM | |
f67539c2 TL |
492 | * in: (uint32_t) a0=0 Get Boot Info for PXE eNIC as per |
493 | * pxe_boot_config_t | |
7c673cae FG |
494 | * a0=1 Get Boot info for iSCSI enic as per |
495 | * iscsi_boot_efi_cfg_t | |
f67539c2 | 496 | * in: (uint64_t) a1=Host address where iSCSI config info is returned |
7c673cae FG |
497 | */ |
498 | CMD_VNIC_BOOT_CONFIG_INFO = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 65), | |
499 | ||
500 | /* | |
501 | * Create a Queue Pair (RoCE) | |
f67539c2 TL |
502 | * in: (uint32_t) a0 = Queue Pair number |
503 | * (uint32_t) a1 = Remote QP | |
504 | * (uint32_t) a2 = RDMA-RQ | |
505 | * (uint16_t) a3 = RQ Res Group | |
506 | * (uint16_t) a4 = SQ Res Group | |
507 | * (uint32_t) a5 = Protection Domain | |
508 | * (uint64_t) a6 = Remote MAC | |
509 | * (uint32_t) a7 = start PSN | |
510 | * (uint16_t) a8 = MSS | |
511 | * (uint32_t) a9 = protocol version | |
7c673cae FG |
512 | */ |
513 | CMD_RDMA_QP_CREATE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 66), | |
514 | ||
515 | /* | |
516 | * Delete a Queue Pair (RoCE) | |
f67539c2 | 517 | * in: (uint32_t) a0 = Queue Pair number |
7c673cae FG |
518 | */ |
519 | CMD_RDMA_QP_DELETE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 67), | |
520 | ||
521 | /* | |
522 | * Retrieve a Queue Pair's status information (RoCE) | |
f67539c2 TL |
523 | * in: (uint32_t) a0 = Queue Pair number |
524 | * (uint64_t) a1 = host buffer addr for QP status struct | |
525 | * (uint32_t) a2 = length of the buffer | |
7c673cae FG |
526 | */ |
527 | CMD_RDMA_QP_STATUS = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 68), | |
528 | ||
529 | /* | |
530 | * Use this devcmd for agreeing on the highest common version supported | |
531 | * by both driver and fw for by features who need such a facility. | |
f67539c2 TL |
532 | * in: (uint64_t) a0 = feature (driver requests for the supported |
533 | * versions on this feature) | |
534 | * out: (uint64_t) a0 = bitmap of all supported versions for that | |
535 | * feature | |
7c673cae FG |
536 | */ |
537 | CMD_GET_SUPP_FEATURE_VER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 69), | |
538 | ||
539 | /* | |
540 | * Initialize the RDMA notification work queue | |
f67539c2 TL |
541 | * in: (uint64_t) a0 = host buffer address |
542 | * in: (uint16_t) a1 = number of entries in buffer | |
543 | * in: (uint16_t) a2 = resource group number | |
544 | * in: (uint16_t) a3 = CQ number to post completion | |
7c673cae FG |
545 | */ |
546 | CMD_RDMA_INIT_INFO_BUF = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 70), | |
547 | ||
548 | /* | |
549 | * De-init the RDMA notification work queue | |
f67539c2 | 550 | * in: (uint64_t) a0=resource group number |
7c673cae FG |
551 | */ |
552 | CMD_RDMA_DEINIT_INFO_BUF = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 71), | |
553 | ||
554 | /* | |
555 | * Control (Enable/Disable) overlay offloads on the given vnic | |
f67539c2 | 556 | * in: (uint8_t) a0 = OVERLAY_FEATURE_NVGRE : NVGRE |
7c673cae | 557 | * a0 = OVERLAY_FEATURE_VXLAN : VxLAN |
f67539c2 TL |
558 | * a0 = OVERLAY_FEATURE_GENEVE : Geneve |
559 | * in: (uint8_t) a1 = OVERLAY_OFFLOAD_ENABLE : Enable or | |
7c673cae FG |
560 | * a1 = OVERLAY_OFFLOAD_DISABLE : Disable or |
561 | * a1 = OVERLAY_OFFLOAD_ENABLE_V2 : Enable with version 2 | |
562 | */ | |
563 | CMD_OVERLAY_OFFLOAD_CTRL = | |
564 | _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 72), | |
565 | ||
566 | /* | |
567 | * Configuration of overlay offloads feature on a given vNIC | |
f67539c2 TL |
568 | * in: (uint8_t) a0 = OVERLAY_CFG_VXLAN_PORT_UPDATE : VxLAN |
569 | * OVERLAY_CFG_GENEVE_PORT_UPDATE : Geneve | |
570 | * in: (uint16_t) a1 = unsigned short int port information | |
7c673cae FG |
571 | */ |
572 | CMD_OVERLAY_OFFLOAD_CFG = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 73), | |
573 | ||
574 | /* | |
575 | * Return the configured name for the device | |
f67539c2 TL |
576 | * in: (uint64_t) a0=Host address where the name is copied |
577 | * (uint32_t) a1=Size of the buffer | |
7c673cae FG |
578 | */ |
579 | CMD_GET_CONFIG_NAME = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 74), | |
580 | ||
581 | /* | |
582 | * Enable group interrupt for the VF | |
f67539c2 | 583 | * in: (uint32_t) a0 = GRPINTR_ENABLE : enable |
7c673cae FG |
584 | * a0 = GRPINTR_DISABLE : disable |
585 | * a0 = GRPINTR_UPD_VECT: update group vector addr | |
f67539c2 TL |
586 | * in: (uint32_t) a1 = interrupt group count |
587 | * in: (uint64_t) a2 = Start of host buffer address for DMAing group | |
7c673cae | 588 | * vector bitmap |
f67539c2 | 589 | * in: (uint64_t) a3 = Stride between group vectors |
7c673cae FG |
590 | */ |
591 | CMD_CONFIG_GRPINTR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 75), | |
592 | ||
593 | /* | |
594 | * Set cq arrary base and size in a list of consective wqs and | |
595 | * rqs for a device | |
f67539c2 | 596 | * in: (uint16_t) a0 = the wq relative index in the device. |
7c673cae | 597 | * -1 indicates skipping wq configuration |
f67539c2 TL |
598 | * in: (uint16_t) a1 = the wcq relative index in the device |
599 | * in: (uint16_t) a2 = the rq relative index in the device | |
7c673cae | 600 | * -1 indicates skipping rq configuration |
f67539c2 | 601 | * in: (uint16_t) a3 = the rcq relative index in the device |
7c673cae FG |
602 | */ |
603 | CMD_CONFIG_CQ_ARRAY = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 76), | |
604 | ||
605 | /* | |
606 | * Add an advanced filter. | |
f67539c2 TL |
607 | * in: (uint64_t) a0= filter address |
608 | * (uint32_t) a1= size of filter | |
609 | * out: (uint32_t) a0=filter identifier | |
7c673cae FG |
610 | * |
611 | * Capability query: | |
f67539c2 TL |
612 | * in: (uint64_t) a1= supported filter capability exchange modes |
613 | * out: (uint64_t) a0= 1 if capability query supported | |
614 | * if (uint64_t) a1 = 0: a1 = MAX filter type supported | |
615 | * if (uint64_t) a1 & FILTER_CAP_MODE_V1_FLAG: | |
11fdf7f2 TL |
616 | * a1 = bitmask of supported filters |
617 | * a2 = FILTER_CAP_MODE_V1 | |
618 | * a3 = bitmask of supported actions | |
7c673cae FG |
619 | */ |
620 | CMD_ADD_ADV_FILTER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 77), | |
9f95a23c TL |
621 | |
622 | /* | |
f67539c2 TL |
623 | * Perform a Flow Manager Operation (see flowman_api.h) |
624 | * in: (uint32_t) a0 = sub-command | |
625 | * (uint64_t) a1..15 = (sub-command specific) | |
626 | * | |
627 | * All arguments that have not been assigned a meaning should be | |
628 | * initialized to 0 to allow for better driver forward compatibility. | |
9f95a23c | 629 | */ |
f67539c2 | 630 | CMD_FLOW_MANAGER_OP = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 88), |
7c673cae FG |
631 | }; |
632 | ||
11fdf7f2 TL |
633 | /* Modes for exchanging advanced filter capabilities. The modes supported by |
634 | * the driver are passed in the CMD_ADD_ADV_FILTER capability command and the | |
635 | * mode selected is returned. | |
636 | * V0: the maximum filter type supported is returned | |
637 | * V1: bitmasks of supported filters and actions are returned | |
638 | */ | |
639 | enum filter_cap_mode { | |
640 | FILTER_CAP_MODE_V0 = 0, /* Must always be 0 for legacy drivers */ | |
641 | FILTER_CAP_MODE_V1 = 1, | |
642 | }; | |
643 | #define FILTER_CAP_MODE_V1_FLAG (1 << FILTER_CAP_MODE_V1) | |
644 | ||
7c673cae FG |
645 | /* CMD_ENABLE2 flags */ |
646 | #define CMD_ENABLE2_STANDBY 0x0 | |
647 | #define CMD_ENABLE2_ACTIVE 0x1 | |
648 | ||
649 | /* flags for CMD_OPEN */ | |
650 | #define CMD_OPENF_OPROM 0x1 /* open coming from option rom */ | |
11fdf7f2 | 651 | #define CMD_OPENF_IG_DESCCACHE 0x2 /* Do not flush IG DESC cache */ |
7c673cae FG |
652 | |
653 | /* flags for CMD_INIT */ | |
654 | #define CMD_INITF_DEFAULT_MAC 0x1 /* init with default mac addr */ | |
655 | ||
11fdf7f2 TL |
656 | /* flags for CMD_NIC_CFG */ |
657 | #define CMD_NIC_CFG_CAPF_UDP_WEAK (1ULL << 0) /* Bodega-style UDP RSS */ | |
658 | ||
7c673cae FG |
659 | /* flags for CMD_PACKET_FILTER */ |
660 | #define CMD_PFILTER_DIRECTED 0x01 | |
661 | #define CMD_PFILTER_MULTICAST 0x02 | |
662 | #define CMD_PFILTER_BROADCAST 0x04 | |
663 | #define CMD_PFILTER_PROMISCUOUS 0x08 | |
664 | #define CMD_PFILTER_ALL_MULTICAST 0x10 | |
665 | ||
666 | /* Commands for CMD_QP_ENABLE/CM_QP_DISABLE */ | |
667 | #define CMD_QP_RQWQ 0x0 | |
668 | ||
669 | /* rewrite modes for CMD_IG_VLAN_REWRITE_MODE */ | |
670 | #define IG_VLAN_REWRITE_MODE_DEFAULT_TRUNK 0 | |
671 | #define IG_VLAN_REWRITE_MODE_UNTAG_DEFAULT_VLAN 1 | |
672 | #define IG_VLAN_REWRITE_MODE_PRIORITY_TAG_DEFAULT_VLAN 2 | |
673 | #define IG_VLAN_REWRITE_MODE_PASS_THRU 3 | |
674 | ||
675 | enum vnic_devcmd_status { | |
676 | STAT_NONE = 0, | |
677 | STAT_BUSY = 1 << 0, /* cmd in progress */ | |
678 | STAT_ERROR = 1 << 1, /* last cmd caused error (code in a0) */ | |
679 | STAT_FAILOVER = 1 << 2, /* always set on vnics in pci standby state | |
680 | * if seen a failover to the standby happened | |
681 | */ | |
682 | }; | |
683 | ||
684 | enum vnic_devcmd_error { | |
685 | ERR_SUCCESS = 0, | |
686 | ERR_EINVAL = 1, | |
687 | ERR_EFAULT = 2, | |
688 | ERR_EPERM = 3, | |
689 | ERR_EBUSY = 4, | |
690 | ERR_ECMDUNKNOWN = 5, | |
691 | ERR_EBADSTATE = 6, | |
692 | ERR_ENOMEM = 7, | |
693 | ERR_ETIMEDOUT = 8, | |
694 | ERR_ELINKDOWN = 9, | |
695 | ERR_EMAXRES = 10, | |
696 | ERR_ENOTSUPPORTED = 11, | |
697 | ERR_EINPROGRESS = 12, | |
698 | ERR_MAX | |
699 | }; | |
700 | ||
701 | /* | |
702 | * note: hw_version and asic_rev refer to the same thing, | |
703 | * but have different formats. hw_version is | |
704 | * a 32-byte string (e.g. "A2") and asic_rev is | |
705 | * a 16-bit integer (e.g. 0xA2). | |
706 | */ | |
707 | struct vnic_devcmd_fw_info { | |
708 | char fw_version[32]; | |
709 | char fw_build[32]; | |
710 | char hw_version[32]; | |
711 | char hw_serial_number[32]; | |
f67539c2 TL |
712 | uint16_t asic_type; |
713 | uint16_t asic_rev; | |
7c673cae FG |
714 | }; |
715 | ||
716 | enum fwinfo_asic_type { | |
717 | FWINFO_ASIC_TYPE_UNKNOWN, | |
718 | FWINFO_ASIC_TYPE_PALO, | |
719 | FWINFO_ASIC_TYPE_SERENO, | |
720 | FWINFO_ASIC_TYPE_CRUZ, | |
721 | }; | |
722 | ||
723 | struct vnic_devcmd_notify { | |
f67539c2 TL |
724 | uint32_t csum; /* checksum over following words */ |
725 | ||
726 | uint32_t link_state; /* link up == 1 */ | |
727 | uint32_t port_speed; /* effective port speed (rate limit) */ | |
728 | uint32_t mtu; /* MTU */ | |
729 | uint32_t msglvl; /* requested driver msg lvl */ | |
730 | uint32_t uif; /* uplink interface */ | |
731 | uint32_t status; /* status bits (see VNIC_STF_*) */ | |
732 | uint32_t error; /* error code (see ERR_*) for 1st ERR */ | |
733 | uint32_t link_down_cnt; /* running count of link down | |
734 | * transitions | |
735 | */ | |
736 | uint32_t perbi_rebuild_cnt; /* running count of perbi rebuilds */ | |
7c673cae FG |
737 | }; |
738 | #define VNIC_STF_FATAL_ERR 0x0001 /* fatal fw error */ | |
739 | #define VNIC_STF_STD_PAUSE 0x0002 /* standard link-level pause on */ | |
740 | #define VNIC_STF_PFC_PAUSE 0x0004 /* priority flow control pause on */ | |
741 | /* all supported status flags */ | |
742 | #define VNIC_STF_ALL (VNIC_STF_FATAL_ERR |\ | |
743 | VNIC_STF_STD_PAUSE |\ | |
744 | VNIC_STF_PFC_PAUSE |\ | |
745 | 0) | |
746 | ||
747 | struct vnic_devcmd_provinfo { | |
f67539c2 TL |
748 | uint8_t oui[3]; |
749 | uint8_t type; | |
750 | uint8_t data[0]; | |
7c673cae FG |
751 | }; |
752 | ||
753 | /* | |
754 | * These are used in flags field of different filters to denote | |
755 | * valid fields used. | |
756 | */ | |
757 | #define FILTER_FIELD_VALID(fld) (1 << (fld - 1)) | |
758 | ||
759 | #define FILTER_FIELD_USNIC_VLAN FILTER_FIELD_VALID(1) | |
760 | #define FILTER_FIELD_USNIC_ETHTYPE FILTER_FIELD_VALID(2) | |
761 | #define FILTER_FIELD_USNIC_PROTO FILTER_FIELD_VALID(3) | |
762 | #define FILTER_FIELD_USNIC_ID FILTER_FIELD_VALID(4) | |
763 | ||
764 | #define FILTER_FIELDS_USNIC (FILTER_FIELD_USNIC_VLAN | \ | |
765 | FILTER_FIELD_USNIC_ETHTYPE | \ | |
766 | FILTER_FIELD_USNIC_PROTO | \ | |
767 | FILTER_FIELD_USNIC_ID) | |
768 | ||
769 | struct filter_usnic_id { | |
f67539c2 TL |
770 | uint32_t flags; |
771 | uint16_t vlan; | |
772 | uint16_t ethtype; | |
773 | uint8_t proto_version; | |
774 | uint32_t usnic_id; | |
775 | } __rte_packed; | |
7c673cae FG |
776 | |
777 | #define FILTER_FIELD_5TUP_PROTO FILTER_FIELD_VALID(1) | |
778 | #define FILTER_FIELD_5TUP_SRC_AD FILTER_FIELD_VALID(2) | |
779 | #define FILTER_FIELD_5TUP_DST_AD FILTER_FIELD_VALID(3) | |
780 | #define FILTER_FIELD_5TUP_SRC_PT FILTER_FIELD_VALID(4) | |
781 | #define FILTER_FIELD_5TUP_DST_PT FILTER_FIELD_VALID(5) | |
782 | ||
783 | #define FILTER_FIELDS_IPV4_5TUPLE (FILTER_FIELD_5TUP_PROTO | \ | |
784 | FILTER_FIELD_5TUP_SRC_AD | \ | |
785 | FILTER_FIELD_5TUP_DST_AD | \ | |
786 | FILTER_FIELD_5TUP_SRC_PT | \ | |
787 | FILTER_FIELD_5TUP_DST_PT) | |
788 | ||
789 | /* Enums for the protocol field. */ | |
790 | enum protocol_e { | |
791 | PROTO_UDP = 0, | |
792 | PROTO_TCP = 1, | |
793 | PROTO_IPV4 = 2, | |
794 | PROTO_IPV6 = 3 | |
795 | }; | |
796 | ||
797 | struct filter_ipv4_5tuple { | |
f67539c2 TL |
798 | uint32_t flags; |
799 | uint32_t protocol; | |
800 | uint32_t src_addr; | |
801 | uint32_t dst_addr; | |
802 | uint16_t src_port; | |
803 | uint16_t dst_port; | |
804 | } __rte_packed; | |
7c673cae FG |
805 | |
806 | #define FILTER_FIELD_VMQ_VLAN FILTER_FIELD_VALID(1) | |
807 | #define FILTER_FIELD_VMQ_MAC FILTER_FIELD_VALID(2) | |
808 | ||
809 | #define FILTER_FIELDS_MAC_VLAN (FILTER_FIELD_VMQ_VLAN | \ | |
810 | FILTER_FIELD_VMQ_MAC) | |
811 | ||
812 | #define FILTER_FIELDS_NVGRE FILTER_FIELD_VMQ_MAC | |
813 | ||
814 | struct filter_mac_vlan { | |
f67539c2 TL |
815 | uint32_t flags; |
816 | uint16_t vlan; | |
817 | uint8_t mac_addr[6]; | |
818 | } __rte_packed; | |
7c673cae FG |
819 | |
820 | #define FILTER_FIELD_VLAN_IP_3TUP_VLAN FILTER_FIELD_VALID(1) | |
821 | #define FILTER_FIELD_VLAN_IP_3TUP_L3_PROTO FILTER_FIELD_VALID(2) | |
822 | #define FILTER_FIELD_VLAN_IP_3TUP_DST_AD FILTER_FIELD_VALID(3) | |
823 | #define FILTER_FIELD_VLAN_IP_3TUP_L4_PROTO FILTER_FIELD_VALID(4) | |
824 | #define FILTER_FIELD_VLAN_IP_3TUP_DST_PT FILTER_FIELD_VALID(5) | |
825 | ||
826 | #define FILTER_FIELDS_VLAN_IP_3TUP (FILTER_FIELD_VLAN_IP_3TUP_VLAN | \ | |
827 | FILTER_FIELD_VLAN_IP_3TUP_L3_PROTO | \ | |
828 | FILTER_FIELD_VLAN_IP_3TUP_DST_AD | \ | |
829 | FILTER_FIELD_VLAN_IP_3TUP_L4_PROTO | \ | |
830 | FILTER_FIELD_VLAN_IP_3TUP_DST_PT) | |
831 | ||
832 | struct filter_vlan_ip_3tuple { | |
f67539c2 TL |
833 | uint32_t flags; |
834 | uint16_t vlan; | |
835 | uint16_t l3_protocol; | |
7c673cae | 836 | union { |
f67539c2 TL |
837 | uint32_t dst_addr_v4; |
838 | uint8_t dst_addr_v6[16]; | |
7c673cae | 839 | } u; |
f67539c2 TL |
840 | uint32_t l4_protocol; |
841 | uint16_t dst_port; | |
842 | } __rte_packed; | |
7c673cae FG |
843 | |
844 | #define FILTER_GENERIC_1_BYTES 64 | |
845 | ||
846 | enum filter_generic_1_layer { | |
847 | FILTER_GENERIC_1_L2, | |
848 | FILTER_GENERIC_1_L3, | |
849 | FILTER_GENERIC_1_L4, | |
850 | FILTER_GENERIC_1_L5, | |
851 | FILTER_GENERIC_1_NUM_LAYERS | |
852 | }; | |
853 | ||
854 | #define FILTER_GENERIC_1_IPV4 (1 << 0) | |
855 | #define FILTER_GENERIC_1_IPV6 (1 << 1) | |
856 | #define FILTER_GENERIC_1_UDP (1 << 2) | |
857 | #define FILTER_GENERIC_1_TCP (1 << 3) | |
858 | #define FILTER_GENERIC_1_TCP_OR_UDP (1 << 4) | |
859 | #define FILTER_GENERIC_1_IP4SUM_OK (1 << 5) | |
860 | #define FILTER_GENERIC_1_L4SUM_OK (1 << 6) | |
861 | #define FILTER_GENERIC_1_IPFRAG (1 << 7) | |
862 | ||
863 | #define FILTER_GENERIC_1_KEY_LEN 64 | |
864 | ||
865 | /* | |
866 | * Version 1 of generic filter specification | |
867 | * position is only 16 bits, reserving positions > 64k to be used by firmware | |
868 | */ | |
869 | struct filter_generic_1 { | |
f67539c2 TL |
870 | uint16_t position; /* lower position comes first */ |
871 | uint32_t mask_flags; | |
872 | uint32_t val_flags; | |
873 | uint16_t mask_vlan; | |
874 | uint16_t val_vlan; | |
7c673cae | 875 | struct { |
f67539c2 TL |
876 | uint8_t mask[FILTER_GENERIC_1_KEY_LEN]; /* 0 bit means |
877 | * " don't care" | |
878 | */ | |
879 | uint8_t val[FILTER_GENERIC_1_KEY_LEN]; | |
880 | } __rte_packed layer[FILTER_GENERIC_1_NUM_LAYERS]; | |
881 | } __rte_packed; | |
7c673cae FG |
882 | |
883 | /* Specifies the filter_action type. */ | |
884 | enum { | |
885 | FILTER_ACTION_RQ_STEERING = 0, | |
11fdf7f2 | 886 | FILTER_ACTION_V2 = 1, |
7c673cae FG |
887 | FILTER_ACTION_MAX |
888 | }; | |
889 | ||
890 | struct filter_action { | |
f67539c2 | 891 | uint32_t type; |
7c673cae | 892 | union { |
f67539c2 | 893 | uint32_t rq_idx; |
7c673cae | 894 | } u; |
f67539c2 | 895 | } __rte_packed; |
7c673cae | 896 | |
11fdf7f2 TL |
897 | #define FILTER_ACTION_RQ_STEERING_FLAG (1 << 0) |
898 | #define FILTER_ACTION_FILTER_ID_FLAG (1 << 1) | |
899 | #define FILTER_ACTION_DROP_FLAG (1 << 2) | |
f67539c2 | 900 | #define FILTER_ACTION_COUNTER_FLAG (1 << 3) |
11fdf7f2 TL |
901 | #define FILTER_ACTION_V2_ALL (FILTER_ACTION_RQ_STEERING_FLAG \ |
902 | | FILTER_ACTION_DROP_FLAG \ | |
f67539c2 | 903 | | FILTER_ACTION_FILTER_ID_FLAG) |
11fdf7f2 | 904 | |
f67539c2 TL |
905 | /* Version 2 of filter action must be a strict extension of struct |
906 | * filter_action where the first fields exactly match in size and meaning. | |
11fdf7f2 TL |
907 | */ |
908 | struct filter_action_v2 { | |
f67539c2 TL |
909 | uint32_t type; |
910 | uint32_t rq_idx; | |
911 | uint32_t flags; /* use FILTER_ACTION_XXX_FLAG defines */ | |
912 | uint16_t filter_id; | |
913 | uint8_t reserved[32]; /* for future expansion */ | |
914 | } __rte_packed; | |
11fdf7f2 | 915 | |
7c673cae FG |
916 | /* Specifies the filter type. */ |
917 | enum filter_type { | |
918 | FILTER_USNIC_ID = 0, | |
919 | FILTER_IPV4_5TUPLE = 1, | |
920 | FILTER_MAC_VLAN = 2, | |
921 | FILTER_VLAN_IP_3TUPLE = 3, | |
922 | FILTER_NVGRE_VMQ = 4, | |
923 | FILTER_USNIC_IP = 5, | |
924 | FILTER_DPDK_1 = 6, | |
f67539c2 | 925 | FILTER_FLOWMAN = 7, |
7c673cae FG |
926 | FILTER_MAX |
927 | }; | |
928 | ||
11fdf7f2 TL |
929 | #define FILTER_USNIC_ID_FLAG (1 << FILTER_USNIC_ID) |
930 | #define FILTER_IPV4_5TUPLE_FLAG (1 << FILTER_IPV4_5TUPLE) | |
931 | #define FILTER_MAC_VLAN_FLAG (1 << FILTER_MAC_VLAN) | |
932 | #define FILTER_VLAN_IP_3TUPLE_FLAG (1 << FILTER_VLAN_IP_3TUPLE) | |
933 | #define FILTER_NVGRE_VMQ_FLAG (1 << FILTER_NVGRE_VMQ) | |
934 | #define FILTER_USNIC_IP_FLAG (1 << FILTER_USNIC_IP) | |
935 | #define FILTER_DPDK_1_FLAG (1 << FILTER_DPDK_1) | |
936 | #define FILTER_V1_ALL (FILTER_USNIC_ID_FLAG | \ | |
937 | FILTER_IPV4_5TUPLE_FLAG | \ | |
938 | FILTER_MAC_VLAN_FLAG | \ | |
939 | FILTER_VLAN_IP_3TUPLE_FLAG | \ | |
940 | FILTER_NVGRE_VMQ_FLAG | \ | |
941 | FILTER_USNIC_IP_FLAG | \ | |
942 | FILTER_DPDK_1_FLAG) | |
943 | ||
7c673cae | 944 | struct filter { |
f67539c2 | 945 | uint32_t type; |
7c673cae FG |
946 | union { |
947 | struct filter_usnic_id usnic; | |
948 | struct filter_ipv4_5tuple ipv4; | |
949 | struct filter_mac_vlan mac_vlan; | |
950 | struct filter_vlan_ip_3tuple vlan_3tuple; | |
951 | } u; | |
f67539c2 | 952 | } __rte_packed; |
7c673cae FG |
953 | |
954 | /* | |
955 | * This is a strict superset of "struct filter" and exists only | |
956 | * because many drivers use "sizeof (struct filter)" in deciding TLV size. | |
957 | * This new, larger struct filter would cause any code that uses that method | |
958 | * to not work with older firmware, so we add filter_v2 to hold the | |
959 | * new filter types. Drivers should use vnic_filter_size() to determine | |
960 | * the TLV size instead of sizeof (struct fiter_v2) to guard against future | |
961 | * growth. | |
962 | */ | |
963 | struct filter_v2 { | |
f67539c2 | 964 | uint32_t type; |
7c673cae FG |
965 | union { |
966 | struct filter_usnic_id usnic; | |
967 | struct filter_ipv4_5tuple ipv4; | |
968 | struct filter_mac_vlan mac_vlan; | |
969 | struct filter_vlan_ip_3tuple vlan_3tuple; | |
970 | struct filter_generic_1 generic_1; | |
971 | } u; | |
f67539c2 | 972 | } __rte_packed; |
7c673cae FG |
973 | |
974 | enum { | |
975 | CLSF_TLV_FILTER = 0, | |
976 | CLSF_TLV_ACTION = 1, | |
977 | }; | |
978 | ||
979 | struct filter_tlv { | |
9f95a23c TL |
980 | uint32_t type; |
981 | uint32_t length; | |
982 | uint32_t val[0]; | |
7c673cae FG |
983 | }; |
984 | ||
985 | /* Data for CMD_ADD_FILTER is 2 TLV and filter + action structs */ | |
986 | #define FILTER_MAX_BUF_SIZE 100 | |
987 | #define FILTER_V2_MAX_BUF_SIZE (sizeof(struct filter_v2) + \ | |
11fdf7f2 | 988 | sizeof(struct filter_action_v2) + \ |
7c673cae FG |
989 | (2 * sizeof(struct filter_tlv))) |
990 | ||
991 | /* | |
992 | * Compute actual structure size given filter type. To be "future-proof," | |
993 | * drivers should use this instead of "sizeof (struct filter_v2)" when | |
994 | * computing length for TLV. | |
995 | */ | |
9f95a23c | 996 | static inline uint32_t |
7c673cae FG |
997 | vnic_filter_size(struct filter_v2 *fp) |
998 | { | |
9f95a23c | 999 | uint32_t size; |
7c673cae FG |
1000 | |
1001 | switch (fp->type) { | |
1002 | case FILTER_USNIC_ID: | |
1003 | size = sizeof(fp->u.usnic); | |
1004 | break; | |
1005 | case FILTER_IPV4_5TUPLE: | |
1006 | size = sizeof(fp->u.ipv4); | |
1007 | break; | |
1008 | case FILTER_MAC_VLAN: | |
1009 | case FILTER_NVGRE_VMQ: | |
1010 | size = sizeof(fp->u.mac_vlan); | |
1011 | break; | |
1012 | case FILTER_VLAN_IP_3TUPLE: | |
1013 | size = sizeof(fp->u.vlan_3tuple); | |
1014 | break; | |
1015 | case FILTER_USNIC_IP: | |
1016 | case FILTER_DPDK_1: | |
1017 | size = sizeof(fp->u.generic_1); | |
1018 | break; | |
1019 | default: | |
1020 | size = sizeof(fp->u); | |
1021 | break; | |
1022 | } | |
1023 | size += sizeof(fp->type); | |
1024 | return size; | |
1025 | } | |
1026 | ||
1027 | ||
1028 | enum { | |
1029 | CLSF_ADD = 0, | |
1030 | CLSF_DEL = 1, | |
1031 | }; | |
1032 | ||
11fdf7f2 TL |
1033 | /* |
1034 | * Get the action structure size given action type. To be "future-proof," | |
1035 | * drivers should use this instead of "sizeof (struct filter_action_v2)" | |
1036 | * when computing length for TLV. | |
1037 | */ | |
9f95a23c | 1038 | static inline uint32_t |
11fdf7f2 TL |
1039 | vnic_action_size(struct filter_action_v2 *fap) |
1040 | { | |
9f95a23c | 1041 | uint32_t size; |
11fdf7f2 TL |
1042 | |
1043 | switch (fap->type) { | |
1044 | case FILTER_ACTION_RQ_STEERING: | |
1045 | size = sizeof(struct filter_action); | |
1046 | break; | |
1047 | case FILTER_ACTION_V2: | |
1048 | size = sizeof(struct filter_action_v2); | |
1049 | break; | |
1050 | default: | |
1051 | size = sizeof(struct filter_action); | |
1052 | break; | |
1053 | } | |
1054 | return size; | |
1055 | } | |
1056 | ||
7c673cae FG |
1057 | /* |
1058 | * Writing cmd register causes STAT_BUSY to get set in status register. | |
1059 | * When cmd completes, STAT_BUSY will be cleared. | |
1060 | * | |
1061 | * If cmd completed successfully STAT_ERROR will be clear | |
1062 | * and args registers contain cmd-specific results. | |
1063 | * | |
1064 | * If cmd error, STAT_ERROR will be set and args[0] contains error code. | |
1065 | * | |
1066 | * status register is read-only. While STAT_BUSY is set, | |
1067 | * all other register contents are read-only. | |
1068 | */ | |
1069 | ||
1070 | /* Make sizeof(vnic_devcmd) a power-of-2 for I/O BAR. */ | |
1071 | #define VNIC_DEVCMD_NARGS 15 | |
1072 | struct vnic_devcmd { | |
f67539c2 TL |
1073 | uint32_t status; /* RO */ |
1074 | uint32_t cmd; /* RW */ | |
1075 | uint64_t args[VNIC_DEVCMD_NARGS]; /* RW cmd args (little-endian)*/ | |
7c673cae FG |
1076 | }; |
1077 | ||
1078 | /* | |
1079 | * Version 2 of the interface. | |
1080 | * | |
1081 | * Some things are carried over, notably the vnic_devcmd_cmd enum. | |
1082 | */ | |
1083 | ||
1084 | /* | |
1085 | * Flags for vnic_devcmd2.flags | |
1086 | */ | |
1087 | ||
1088 | #define DEVCMD2_FNORESULT 0x1 /* Don't copy result to host */ | |
1089 | ||
1090 | #define VNIC_DEVCMD2_NARGS VNIC_DEVCMD_NARGS | |
1091 | struct vnic_devcmd2 { | |
f67539c2 TL |
1092 | uint16_t pad; |
1093 | uint16_t flags; | |
1094 | uint32_t cmd; /* same command #defines as original */ | |
1095 | uint64_t args[VNIC_DEVCMD2_NARGS]; | |
7c673cae FG |
1096 | }; |
1097 | ||
1098 | #define VNIC_DEVCMD2_NRESULTS VNIC_DEVCMD_NARGS | |
1099 | struct devcmd2_result { | |
f67539c2 TL |
1100 | uint64_t results[VNIC_DEVCMD2_NRESULTS]; |
1101 | uint32_t pad; | |
1102 | uint16_t completed_index; /* into copy WQ */ | |
1103 | uint8_t error; /* same error codes as original */ | |
1104 | uint8_t color; /* 0 or 1 as with completion queues */ | |
7c673cae FG |
1105 | }; |
1106 | ||
1107 | #define DEVCMD2_RING_SIZE 32 | |
1108 | #define DEVCMD2_DESC_SIZE 128 | |
1109 | ||
1110 | #define DEVCMD2_RESULTS_SIZE_MAX ((1 << 16) - 1) | |
1111 | ||
1112 | /* Overlay related definitions */ | |
1113 | ||
1114 | /* | |
1115 | * This enum lists the flag associated with each of the overlay features | |
1116 | */ | |
1117 | typedef enum { | |
1118 | OVERLAY_FEATURE_NVGRE = 1, | |
1119 | OVERLAY_FEATURE_VXLAN, | |
f67539c2 | 1120 | OVERLAY_FEATURE_GENEVE, |
7c673cae FG |
1121 | OVERLAY_FEATURE_MAX, |
1122 | } overlay_feature_t; | |
1123 | ||
1124 | #define OVERLAY_OFFLOAD_ENABLE 0 | |
1125 | #define OVERLAY_OFFLOAD_DISABLE 1 | |
1126 | #define OVERLAY_OFFLOAD_ENABLE_V2 2 | |
1127 | ||
1128 | #define OVERLAY_CFG_VXLAN_PORT_UPDATE 0 | |
f67539c2 | 1129 | #define OVERLAY_CFG_GENEVE_PORT_UPDATE 1 |
7c673cae FG |
1130 | |
1131 | /* | |
1132 | * Use this enum to get the supported versions for each of these features | |
1133 | * If you need to use the devcmd_get_supported_feature_version(), add | |
1134 | * the new feature into this enum and install function handler in devcmd.c | |
1135 | */ | |
1136 | typedef enum { | |
1137 | VIC_FEATURE_VXLAN, | |
1138 | VIC_FEATURE_RDMA, | |
f67539c2 | 1139 | VIC_FEATURE_GENEVE, |
7c673cae FG |
1140 | VIC_FEATURE_MAX, |
1141 | } vic_feature_t; | |
1142 | ||
11fdf7f2 TL |
1143 | /* |
1144 | * These flags are used in args[1] of devcmd CMD_GET_SUPP_FEATURE_VER | |
1145 | * to indicate the host driver about the VxLAN and Multi WQ features | |
1146 | * supported | |
1147 | */ | |
1148 | #define FEATURE_VXLAN_IPV6_INNER (1 << 0) | |
1149 | #define FEATURE_VXLAN_IPV6_OUTER (1 << 1) | |
1150 | #define FEATURE_VXLAN_MULTI_WQ (1 << 2) | |
1151 | ||
1152 | #define FEATURE_VXLAN_IPV6 (FEATURE_VXLAN_IPV6_INNER | \ | |
1153 | FEATURE_VXLAN_IPV6_OUTER) | |
f67539c2 TL |
1154 | /* Support Geneve option bytes */ |
1155 | #define FEATURE_GENEVE_OPTIONS (1 << 0) | |
11fdf7f2 | 1156 | |
7c673cae FG |
1157 | /* |
1158 | * CMD_CONFIG_GRPINTR subcommands | |
1159 | */ | |
1160 | typedef enum { | |
1161 | GRPINTR_ENABLE = 1, | |
1162 | GRPINTR_DISABLE, | |
1163 | GRPINTR_UPD_VECT, | |
1164 | } grpintr_subcmd_t; | |
1165 | ||
1166 | #endif /* _VNIC_DEVCMD_H_ */ |