Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright 2008-2017 Cisco Systems, Inc. All rights reserved.
3 : : * Copyright 2007 Nuova Systems, Inc. All rights reserved.
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 : :
66 : : #define ARRAY_SIZE(x) RTE_DIM(x)
67 : :
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:
74 : : * (uint64_t)a0=paddr to struct vnic_devcmd_fw_info
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:
85 : : * (uint64_t)a0=paddr to struct vnic_devcmd_fw_info
86 : : * (uint16_t)a1=size of the structure
87 : : * out:
88 : : * (uint16_t)a1=0 for in:a1 = 0,
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:
101 : : * in: (uint16_t)a0=offset,(uint8_t)a1=size
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 : :
109 : : /* stats dump in mem: (uint64_t)a0=paddr to stats area,
110 : : * (uint16_t)a1=sizeof stats area
111 : : */
112 : : CMD_STATS_DUMP = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 4),
113 : :
114 : : /* set Rx packet filter: (uint32_t)a0=filters (see CMD_PFILTER_*) */
115 : : CMD_PACKET_FILTER = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 7),
116 : :
117 : : /* set Rx packet filter for all: (uint32_t)a0=filters
118 : : * (see CMD_PFILTER_*)
119 : : */
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 : :
138 : : /* add VLAN id in (uint16_t)a0 */
139 : : CMD_VLAN_ADD = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 14),
140 : :
141 : : /* del VLAN id in (uint16_t)a0 */
142 : : CMD_VLAN_DEL = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 15),
143 : :
144 : : /*
145 : : * nic_cfg in (uint32_t)a0
146 : : *
147 : : * Capability query:
148 : : * out: (uint64_t) a0= 1 if a1 is valid
149 : : * (uint64_t) a1= (NIC_CFG bits supported) | (flags << 32)
150 : : * (flags are CMD_NIC_CFG_CAPF_xxx)
151 : : */
152 : : CMD_NIC_CFG = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 16),
153 : :
154 : : /*
155 : : * nic_cfg_chk (same as nic_cfg, but may return error)
156 : : * in (uint32_t)a0
157 : : *
158 : : * Capability query:
159 : : * out: (uint64_t) a0= 1 if a1 is valid
160 : : * (uint64_t) a1= (NIC_CFG bits supported) | (flags << 32)
161 : : * (flags are CMD_NIC_CFG_CAPF_xxx)
162 : : */
163 : : CMD_NIC_CFG_CHK = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 16),
164 : :
165 : : /* union vnic_rss_key in mem: (uint64_t)a0=paddr, (uint16_t)a1=len */
166 : : CMD_RSS_KEY = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 17),
167 : :
168 : : /* union vnic_rss_cpu in mem: (uint64_t)a0=paddr, (uint16_t)a1=len */
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:
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)
183 : : * out:
184 : : * (uint32_t)a1 = effective size
185 : : */
186 : : CMD_NOTIFY = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 21),
187 : :
188 : : /* UNDI API: (uint64_t)a0=paddr to s_PXENV_UNDI_ struct,
189 : : * (uint8_t)a1=PXENV_UNDI_xxx
190 : : */
191 : : CMD_UNDI = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 22),
192 : :
193 : : /* initiate open sequence (uint32_t)a0=flags (see CMD_OPENF_*) */
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 : :
203 : : /* initialize virtual link: (uint32_t)a0=flags (see CMD_INITF_*) */
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
208 : : * (uint64_t)a0=paddr of vnic_devcmd_provinfo
209 : : * (uint32_t)a1=sizeof provision info
210 : : */
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:
223 : : * (uint64_t)a0=paddr
224 : : * (uint16_t)a1=sizeof stats area
225 : : */
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
230 : : * if a0=0, a1=errno
231 : : */
232 : : CMD_INIT_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 31),
233 : :
234 : : /* INT13 API: (uint64_t)a0=paddr to vnic_int13_params struct
235 : : * (uint32_t)a1=INT13_CMD_xxx
236 : : */
237 : : CMD_INT13 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_FC, 32),
238 : :
239 : : /* logical uplink enable/disable: (uint64_t)a0: 0/1=disable/enable */
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 : :
245 : : /* initialize virtual link: (uint32_t)a0=flags (see CMD_INITF_*) */
246 : : CMD_INIT = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 35),
247 : :
248 : : /* check fw capability of a cmd:
249 : : * in: (uint32_t)a0=cmd
250 : : * out: (uint32_t)a0=errno, 0:valid cmd, a1=supported VNIC_STF_* bits
251 : : */
252 : : CMD_CAPABILITY = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 36),
253 : :
254 : : /* persistent binding info
255 : : * in: (uint64_t)a0=paddr of arg
256 : : * (uint32_t)a1=CMD_PERBI_XXX
257 : : */
258 : : CMD_PERBI = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_FC, 37),
259 : :
260 : : /* Interrupt Assert Register functionality
261 : : * in: (uint16_t)a0=interrupt number to assert
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:
269 : : * out: a0=0 reset complete, a0=1 reset in progress
270 : : */
271 : : CMD_HANG_RESET_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 40),
272 : :
273 : : /*
274 : : * Set hw ingress packet vlan rewrite mode:
275 : : * in: (uint32_t)a0=new vlan rewrite mode
276 : : * out: (uint32_t)a0=old vlan rewrite mode
277 : : */
278 : : CMD_IG_VLAN_REWRITE_MODE = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 41),
279 : :
280 : : /*
281 : : * in: (uint16_t)a0=bdf of target vnic
282 : : * (uint32_t)a1=cmd to proxy
283 : : * a2-a15=args to cmd in a1
284 : : * out: (uint32_t)a0=status of proxied cmd
285 : : * a1-a15=out args of proxied cmd
286 : : */
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
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 : : */
304 : : CMD_CONFIG_INFO_GET = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 44),
305 : :
306 : : /*
307 : : * INT13 API: (uint64_t)a0=paddr to vnic_int13_params struct
308 : : * (uint32_t)a1=INT13_CMD_xxx
309 : : */
310 : : CMD_INT13_ALL = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 45),
311 : :
312 : : /*
313 : : * Set default vlan:
314 : : * in: (uint16_t)a0=new default vlan
315 : : * (uint16_t)a1=zero for overriding vlan with param a0,
316 : : * non-zero for resetting vlan to the default
317 : : * out: (uint16_t)a0=old default vlan
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.
324 : : * (uint64_t)a0=paddr of vnic_devcmd_provinfo
325 : : * (uint32_t)a1=sizeof provision info
326 : : */
327 : : CMD_INIT_PROV_INFO2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 47),
328 : :
329 : : /* enable2:
330 : : * (uint32_t)a0=0 ==> standby
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
373 : : * out: (uint32_t)a0 = multiplier
374 : : * (uint32_t)a1 = divisor
375 : : * (uint32_t)a2 = maximum timer value in usec
376 : : */
377 : : CMD_INTR_COAL_CONVERT = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 50),
378 : :
379 : : /*
380 : : * ISCSI DUMP API:
381 : : * in: (uint64_t)a0=paddr of the param or param itself
382 : : * (uint32_t)a1=ISCSI_CMD_xxx
383 : : */
384 : : CMD_ISCSI_DUMP_REQ = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 51),
385 : :
386 : : /*
387 : : * ISCSI DUMP STATUS API:
388 : : * in: (uint32_t)a0=cmd tag
389 : : * in: (uint32_t)a1=ISCSI_CMD_xxx
390 : : * out: (uint32_t)a0=cmd status
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.
400 : : * in: (uint32_t)a0=Direction of Migration
401 : : * 0=> Migrate to VF
402 : : * 1=> Migrate to MQ
403 : : * (uint32_t)a1=VF index (MQ index)
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:
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)
413 : : * out:
414 : : * (uint32_t)a1 = effective size
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
426 : : * (uint64_t)a0=paddr of vnic_devcmd_provinfo
427 : : * (uint32_t)a1=sizeof provision info
428 : : */
429 : : CMD_PROV_INFO_UPDATE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 56),
430 : :
431 : : /*
432 : : * Initialization for the devcmd2 interface.
433 : : * in: (uint64_t) a0=host result buffer physical address
434 : : * in: (uint16_t) a1=number of entries in result buffer
435 : : */
436 : : CMD_INITIALIZE_DEVCMD2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 57),
437 : :
438 : : /*
439 : : * Add a filter.
440 : : * in: (uint64_t) a0= filter address
441 : : * (uint32_t) a1= size of filter
442 : : * out: (uint32_t) a0=filter identifier
443 : : *
444 : : * Capability query:
445 : : * out: (uint64_t) a0= 1 if capability query supported
446 : : * (uint64_t) a1= MAX filter type supported
447 : : */
448 : : CMD_ADD_FILTER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 58),
449 : :
450 : : /*
451 : : * Delete a filter.
452 : : * in: (uint32_t) a0=filter identifier
453 : : */
454 : : CMD_DEL_FILTER = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 59),
455 : :
456 : : /*
457 : : * Enable a Queue Pair in User space NIC
458 : : * in: (uint32_t) a0=Queue Pair number
459 : : * (uint32_t) a1= command
460 : : */
461 : : CMD_QP_ENABLE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 60),
462 : :
463 : : /*
464 : : * Disable a Queue Pair in User space NIC
465 : : * in: (uint32_t) a0=Queue Pair number
466 : : * (uint32_t) a1= command
467 : : */
468 : : CMD_QP_DISABLE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 61),
469 : :
470 : : /*
471 : : * Stats dump Queue Pair in User space NIC
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
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
480 : : * in: (uint32_t) a0=Queue Pair number
481 : : */
482 : : CMD_QP_STATS_CLEAR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 63),
483 : :
484 : : /*
485 : : * UEFI BOOT API: (uint64_t)a0= UEFI FLS_CMD_xxx
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
492 : : * in: (uint32_t) a0=0 Get Boot Info for PXE eNIC as per
493 : : * pxe_boot_config_t
494 : : * a0=1 Get Boot info for iSCSI enic as per
495 : : * iscsi_boot_efi_cfg_t
496 : : * in: (uint64_t) a1=Host address where iSCSI config info is returned
497 : : */
498 : : CMD_VNIC_BOOT_CONFIG_INFO = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 65),
499 : :
500 : : /*
501 : : * Create a Queue Pair (RoCE)
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
512 : : */
513 : : CMD_RDMA_QP_CREATE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 66),
514 : :
515 : : /*
516 : : * Delete a Queue Pair (RoCE)
517 : : * in: (uint32_t) a0 = Queue Pair number
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)
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
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.
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
536 : : */
537 : : CMD_GET_SUPP_FEATURE_VER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 69),
538 : :
539 : : /*
540 : : * Initialize the RDMA notification work queue
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
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
550 : : * in: (uint64_t) a0=resource group number
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
556 : : * in: (uint8_t) a0 = OVERLAY_FEATURE_NVGRE : NVGRE
557 : : * a0 = OVERLAY_FEATURE_VXLAN : VxLAN
558 : : * a0 = OVERLAY_FEATURE_GENEVE : Geneve
559 : : * in: (uint8_t) a1 = OVERLAY_OFFLOAD_ENABLE : Enable or
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
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
571 : : */
572 : : CMD_OVERLAY_OFFLOAD_CFG = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 73),
573 : :
574 : : /*
575 : : * Return the configured name for the device
576 : : * in: (uint64_t) a0=Host address where the name is copied
577 : : * (uint32_t) a1=Size of the buffer
578 : : */
579 : : CMD_GET_CONFIG_NAME = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 74),
580 : :
581 : : /*
582 : : * Enable group interrupt for the VF
583 : : * in: (uint32_t) a0 = GRPINTR_ENABLE : enable
584 : : * a0 = GRPINTR_DISABLE : disable
585 : : * a0 = GRPINTR_UPD_VECT: update group vector addr
586 : : * in: (uint32_t) a1 = interrupt group count
587 : : * in: (uint64_t) a2 = Start of host buffer address for DMAing group
588 : : * vector bitmap
589 : : * in: (uint64_t) a3 = Stride between group vectors
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
596 : : * in: (uint16_t) a0 = the wq relative index in the device.
597 : : * -1 indicates skipping wq configuration
598 : : * in: (uint16_t) a1 = the wcq relative index in the device
599 : : * in: (uint16_t) a2 = the rq relative index in the device
600 : : * -1 indicates skipping rq configuration
601 : : * in: (uint16_t) a3 = the rcq relative index in the device
602 : : */
603 : : CMD_CONFIG_CQ_ARRAY = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 76),
604 : :
605 : : /*
606 : : * Add an advanced filter.
607 : : * in: (uint64_t) a0= filter address
608 : : * (uint32_t) a1= size of filter
609 : : * out: (uint32_t) a0=filter identifier
610 : : *
611 : : * Capability query:
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:
616 : : * a1 = bitmask of supported filters
617 : : * a2 = FILTER_CAP_MODE_V1
618 : : * a3 = bitmask of supported actions
619 : : */
620 : : CMD_ADD_ADV_FILTER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 77),
621 : :
622 : : /*
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.
629 : : */
630 : : CMD_FLOW_MANAGER_OP = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 88),
631 : :
632 : : /*
633 : : * Set extended CQ field in MREGS of RQ (or all RQs)
634 : : * for given vNIC
635 : : * in: (u64) a0 = RQ selection (VNIC_RQ_ALL for all RQs)
636 : : * (u32) a1 = CQ entry size
637 : : * VNIC_RQ_CQ_ENTRY_SIZE_16 --> 16 bytes
638 : : * VNIC_RQ_CQ_ENTRY_SIZE_32 --> 32 bytes
639 : : * VNIC_RQ_CQ_ENTRY_SIZE_64 --> 64 bytes
640 : : *
641 : : * Capability query:
642 : : * out: (u32) a0 = errno, 0:valid cmd
643 : : * (u32) a1 = value consisting of supported entries
644 : : * bit 0: 16 bytes
645 : : * bit 1: 32 bytes
646 : : * bit 2: 64 bytes
647 : : */
648 : : CMD_CQ_ENTRY_SIZE_SET = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 90),
649 : :
650 : : /*
651 : : * enable/disable wq/rq queue pair of qp_type on a PF/VF.
652 : : * in: (u32) a0 = wq/rq qp_type
653 : : * in: (u32) a0 = enable(1)/disable(0)
654 : : */
655 : : CMD_QP_TYPE_SET = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 97),
656 : :
657 : : /*
658 : : * SRIOV vic stats get
659 : : * in: (u64) a0 = host buffer addr for stats dump
660 : : * in (u32) a1 = length of the buffer
661 : : */
662 : : CMD_SRIOV_STATS_GET = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 98),
663 : : };
664 : :
665 : : /* Modes for exchanging advanced filter capabilities. The modes supported by
666 : : * the driver are passed in the CMD_ADD_ADV_FILTER capability command and the
667 : : * mode selected is returned.
668 : : * V0: the maximum filter type supported is returned
669 : : * V1: bitmasks of supported filters and actions are returned
670 : : */
671 : : enum filter_cap_mode {
672 : : FILTER_CAP_MODE_V0 = 0, /* Must always be 0 for legacy drivers */
673 : : FILTER_CAP_MODE_V1 = 1,
674 : : };
675 : : #define FILTER_CAP_MODE_V1_FLAG (1 << FILTER_CAP_MODE_V1)
676 : :
677 : : /* CMD_ENABLE2 flags */
678 : : #define CMD_ENABLE2_STANDBY 0x0
679 : : #define CMD_ENABLE2_ACTIVE 0x1
680 : :
681 : : /* flags for CMD_OPEN */
682 : : #define CMD_OPENF_OPROM 0x1 /* open coming from option rom */
683 : : #define CMD_OPENF_IG_DESCCACHE 0x2 /* Do not flush IG DESC cache */
684 : :
685 : : /* flags for CMD_INIT */
686 : : #define CMD_INITF_DEFAULT_MAC 0x1 /* init with default mac addr */
687 : :
688 : : /* flags for CMD_NIC_CFG */
689 : : #define CMD_NIC_CFG_CAPF_UDP_WEAK (1ULL << 0) /* Bodega-style UDP RSS */
690 : :
691 : : /* flags for CMD_PACKET_FILTER */
692 : : #define CMD_PFILTER_DIRECTED 0x01
693 : : #define CMD_PFILTER_MULTICAST 0x02
694 : : #define CMD_PFILTER_BROADCAST 0x04
695 : : #define CMD_PFILTER_PROMISCUOUS 0x08
696 : : #define CMD_PFILTER_ALL_MULTICAST 0x10
697 : :
698 : : /* Commands for CMD_QP_ENABLE/CM_QP_DISABLE */
699 : : #define CMD_QP_RQWQ 0x0
700 : :
701 : : /* rewrite modes for CMD_IG_VLAN_REWRITE_MODE */
702 : : #define IG_VLAN_REWRITE_MODE_DEFAULT_TRUNK 0
703 : : #define IG_VLAN_REWRITE_MODE_UNTAG_DEFAULT_VLAN 1
704 : : #define IG_VLAN_REWRITE_MODE_PRIORITY_TAG_DEFAULT_VLAN 2
705 : : #define IG_VLAN_REWRITE_MODE_PASS_THRU 3
706 : :
707 : : enum vnic_devcmd_status {
708 : : STAT_NONE = 0,
709 : : STAT_BUSY = 1 << 0, /* cmd in progress */
710 : : STAT_ERROR = 1 << 1, /* last cmd caused error (code in a0) */
711 : : STAT_FAILOVER = 1 << 2, /* always set on vnics in pci standby state
712 : : * if seen a failover to the standby happened
713 : : */
714 : : };
715 : :
716 : : enum vnic_devcmd_error {
717 : : ERR_SUCCESS = 0,
718 : : ERR_EINVAL = 1,
719 : : ERR_EFAULT = 2,
720 : : ERR_EPERM = 3,
721 : : ERR_EBUSY = 4,
722 : : ERR_ECMDUNKNOWN = 5,
723 : : ERR_EBADSTATE = 6,
724 : : ERR_ENOMEM = 7,
725 : : ERR_ETIMEDOUT = 8,
726 : : ERR_ELINKDOWN = 9,
727 : : ERR_EMAXRES = 10,
728 : : ERR_ENOTSUPPORTED = 11,
729 : : ERR_EINPROGRESS = 12,
730 : : ERR_MAX
731 : : };
732 : :
733 : : /*
734 : : * note: hw_version and asic_rev refer to the same thing,
735 : : * but have different formats. hw_version is
736 : : * a 32-byte string (e.g. "A2") and asic_rev is
737 : : * a 16-bit integer (e.g. 0xA2).
738 : : */
739 : : struct vnic_devcmd_fw_info {
740 : : char fw_version[32];
741 : : char fw_build[32];
742 : : char hw_version[32];
743 : : char hw_serial_number[32];
744 : : uint16_t asic_type;
745 : : uint16_t asic_rev;
746 : : };
747 : :
748 : : enum fwinfo_asic_type {
749 : : FWINFO_ASIC_TYPE_UNKNOWN,
750 : : FWINFO_ASIC_TYPE_PALO,
751 : : FWINFO_ASIC_TYPE_SERENO,
752 : : FWINFO_ASIC_TYPE_CRUZ,
753 : : };
754 : :
755 : : struct vnic_devcmd_notify {
756 : : uint32_t csum; /* checksum over following words */
757 : :
758 : : uint32_t link_state; /* link up == 1 */
759 : : uint32_t port_speed; /* effective port speed (rate limit) */
760 : : uint32_t mtu; /* MTU */
761 : : uint32_t msglvl; /* requested driver msg lvl */
762 : : uint32_t uif; /* uplink interface */
763 : : uint32_t status; /* status bits (see VNIC_STF_*) */
764 : : uint32_t error; /* error code (see ERR_*) for 1st ERR */
765 : : uint32_t link_down_cnt; /* running count of link down
766 : : * transitions
767 : : */
768 : : uint32_t perbi_rebuild_cnt; /* running count of perbi rebuilds */
769 : : };
770 : : #define VNIC_STF_FATAL_ERR 0x0001 /* fatal fw error */
771 : : #define VNIC_STF_STD_PAUSE 0x0002 /* standard link-level pause on */
772 : : #define VNIC_STF_PFC_PAUSE 0x0004 /* priority flow control pause on */
773 : : /* all supported status flags */
774 : : #define VNIC_STF_ALL (VNIC_STF_FATAL_ERR |\
775 : : VNIC_STF_STD_PAUSE |\
776 : : VNIC_STF_PFC_PAUSE |\
777 : : 0)
778 : :
779 : : struct vnic_devcmd_provinfo {
780 : : uint8_t oui[3];
781 : : uint8_t type;
782 : : uint8_t data[];
783 : : };
784 : :
785 : : /*
786 : : * These are used in flags field of different filters to denote
787 : : * valid fields used.
788 : : */
789 : : #define FILTER_FIELD_VALID(fld) (1 << (fld - 1))
790 : :
791 : : #define FILTER_FIELD_USNIC_VLAN FILTER_FIELD_VALID(1)
792 : : #define FILTER_FIELD_USNIC_ETHTYPE FILTER_FIELD_VALID(2)
793 : : #define FILTER_FIELD_USNIC_PROTO FILTER_FIELD_VALID(3)
794 : : #define FILTER_FIELD_USNIC_ID FILTER_FIELD_VALID(4)
795 : :
796 : : #define FILTER_FIELDS_USNIC (FILTER_FIELD_USNIC_VLAN | \
797 : : FILTER_FIELD_USNIC_ETHTYPE | \
798 : : FILTER_FIELD_USNIC_PROTO | \
799 : : FILTER_FIELD_USNIC_ID)
800 : :
801 : : struct filter_usnic_id {
802 : : uint32_t flags;
803 : : uint16_t vlan;
804 : : uint16_t ethtype;
805 : : uint8_t proto_version;
806 : : uint32_t usnic_id;
807 : : } __rte_packed;
808 : :
809 : : #define FILTER_FIELD_5TUP_PROTO FILTER_FIELD_VALID(1)
810 : : #define FILTER_FIELD_5TUP_SRC_AD FILTER_FIELD_VALID(2)
811 : : #define FILTER_FIELD_5TUP_DST_AD FILTER_FIELD_VALID(3)
812 : : #define FILTER_FIELD_5TUP_SRC_PT FILTER_FIELD_VALID(4)
813 : : #define FILTER_FIELD_5TUP_DST_PT FILTER_FIELD_VALID(5)
814 : :
815 : : #define FILTER_FIELDS_IPV4_5TUPLE (FILTER_FIELD_5TUP_PROTO | \
816 : : FILTER_FIELD_5TUP_SRC_AD | \
817 : : FILTER_FIELD_5TUP_DST_AD | \
818 : : FILTER_FIELD_5TUP_SRC_PT | \
819 : : FILTER_FIELD_5TUP_DST_PT)
820 : :
821 : : /* Enums for the protocol field. */
822 : : enum protocol_e {
823 : : PROTO_UDP = 0,
824 : : PROTO_TCP = 1,
825 : : PROTO_IPV4 = 2,
826 : : PROTO_IPV6 = 3
827 : : };
828 : :
829 : : struct filter_ipv4_5tuple {
830 : : uint32_t flags;
831 : : uint32_t protocol;
832 : : uint32_t src_addr;
833 : : uint32_t dst_addr;
834 : : uint16_t src_port;
835 : : uint16_t dst_port;
836 : : } __rte_packed;
837 : :
838 : : #define FILTER_FIELD_VMQ_VLAN FILTER_FIELD_VALID(1)
839 : : #define FILTER_FIELD_VMQ_MAC FILTER_FIELD_VALID(2)
840 : :
841 : : #define FILTER_FIELDS_MAC_VLAN (FILTER_FIELD_VMQ_VLAN | \
842 : : FILTER_FIELD_VMQ_MAC)
843 : :
844 : : #define FILTER_FIELDS_NVGRE FILTER_FIELD_VMQ_MAC
845 : :
846 : : struct filter_mac_vlan {
847 : : uint32_t flags;
848 : : uint16_t vlan;
849 : : uint8_t mac_addr[6];
850 : : } __rte_packed;
851 : :
852 : : #define FILTER_FIELD_VLAN_IP_3TUP_VLAN FILTER_FIELD_VALID(1)
853 : : #define FILTER_FIELD_VLAN_IP_3TUP_L3_PROTO FILTER_FIELD_VALID(2)
854 : : #define FILTER_FIELD_VLAN_IP_3TUP_DST_AD FILTER_FIELD_VALID(3)
855 : : #define FILTER_FIELD_VLAN_IP_3TUP_L4_PROTO FILTER_FIELD_VALID(4)
856 : : #define FILTER_FIELD_VLAN_IP_3TUP_DST_PT FILTER_FIELD_VALID(5)
857 : :
858 : : #define FILTER_FIELDS_VLAN_IP_3TUP (FILTER_FIELD_VLAN_IP_3TUP_VLAN | \
859 : : FILTER_FIELD_VLAN_IP_3TUP_L3_PROTO | \
860 : : FILTER_FIELD_VLAN_IP_3TUP_DST_AD | \
861 : : FILTER_FIELD_VLAN_IP_3TUP_L4_PROTO | \
862 : : FILTER_FIELD_VLAN_IP_3TUP_DST_PT)
863 : :
864 : : struct filter_vlan_ip_3tuple {
865 : : uint32_t flags;
866 : : uint16_t vlan;
867 : : uint16_t l3_protocol;
868 : : union {
869 : : uint32_t dst_addr_v4;
870 : : uint8_t dst_addr_v6[16];
871 : : } u;
872 : : uint32_t l4_protocol;
873 : : uint16_t dst_port;
874 : : } __rte_packed;
875 : :
876 : : #define FILTER_GENERIC_1_BYTES 64
877 : :
878 : : enum filter_generic_1_layer {
879 : : FILTER_GENERIC_1_L2,
880 : : FILTER_GENERIC_1_L3,
881 : : FILTER_GENERIC_1_L4,
882 : : FILTER_GENERIC_1_L5,
883 : : FILTER_GENERIC_1_NUM_LAYERS
884 : : };
885 : :
886 : : #define FILTER_GENERIC_1_IPV4 (1 << 0)
887 : : #define FILTER_GENERIC_1_IPV6 (1 << 1)
888 : : #define FILTER_GENERIC_1_UDP (1 << 2)
889 : : #define FILTER_GENERIC_1_TCP (1 << 3)
890 : : #define FILTER_GENERIC_1_TCP_OR_UDP (1 << 4)
891 : : #define FILTER_GENERIC_1_IP4SUM_OK (1 << 5)
892 : : #define FILTER_GENERIC_1_L4SUM_OK (1 << 6)
893 : : #define FILTER_GENERIC_1_IPFRAG (1 << 7)
894 : :
895 : : #define FILTER_GENERIC_1_KEY_LEN 64
896 : :
897 : : /*
898 : : * Version 1 of generic filter specification
899 : : * position is only 16 bits, reserving positions > 64k to be used by firmware
900 : : */
901 : : struct filter_generic_1 {
902 : : uint16_t position; /* lower position comes first */
903 : : uint32_t mask_flags;
904 : : uint32_t val_flags;
905 : : uint16_t mask_vlan;
906 : : uint16_t val_vlan;
907 : : struct {
908 : : uint8_t mask[FILTER_GENERIC_1_KEY_LEN]; /* 0 bit means
909 : : * " don't care"
910 : : */
911 : : uint8_t val[FILTER_GENERIC_1_KEY_LEN];
912 : : } __rte_packed layer[FILTER_GENERIC_1_NUM_LAYERS];
913 : : } __rte_packed;
914 : :
915 : : /* Specifies the filter_action type. */
916 : : enum {
917 : : FILTER_ACTION_RQ_STEERING = 0,
918 : : FILTER_ACTION_V2 = 1,
919 : : FILTER_ACTION_MAX
920 : : };
921 : :
922 : : struct filter_action {
923 : : uint32_t type;
924 : : union {
925 : : uint32_t rq_idx;
926 : : } u;
927 : : } __rte_packed;
928 : :
929 : : #define FILTER_ACTION_RQ_STEERING_FLAG (1 << 0)
930 : : #define FILTER_ACTION_FILTER_ID_FLAG (1 << 1)
931 : : #define FILTER_ACTION_DROP_FLAG (1 << 2)
932 : : #define FILTER_ACTION_COUNTER_FLAG (1 << 3)
933 : : #define FILTER_ACTION_V2_ALL (FILTER_ACTION_RQ_STEERING_FLAG \
934 : : | FILTER_ACTION_DROP_FLAG \
935 : : | FILTER_ACTION_FILTER_ID_FLAG)
936 : :
937 : : /* Version 2 of filter action must be a strict extension of struct
938 : : * filter_action where the first fields exactly match in size and meaning.
939 : : */
940 : : struct filter_action_v2 {
941 : : uint32_t type;
942 : : uint32_t rq_idx;
943 : : uint32_t flags; /* use FILTER_ACTION_XXX_FLAG defines */
944 : : uint16_t filter_id;
945 : : uint8_t reserved[32]; /* for future expansion */
946 : : } __rte_packed;
947 : :
948 : : /* Specifies the filter type. */
949 : : enum filter_type {
950 : : FILTER_USNIC_ID = 0,
951 : : FILTER_IPV4_5TUPLE = 1,
952 : : FILTER_MAC_VLAN = 2,
953 : : FILTER_VLAN_IP_3TUPLE = 3,
954 : : FILTER_NVGRE_VMQ = 4,
955 : : FILTER_USNIC_IP = 5,
956 : : FILTER_DPDK_1 = 6,
957 : : FILTER_FLOWMAN = 7,
958 : : FILTER_MAX
959 : : };
960 : :
961 : : #define FILTER_USNIC_ID_FLAG (1 << FILTER_USNIC_ID)
962 : : #define FILTER_IPV4_5TUPLE_FLAG (1 << FILTER_IPV4_5TUPLE)
963 : : #define FILTER_MAC_VLAN_FLAG (1 << FILTER_MAC_VLAN)
964 : : #define FILTER_VLAN_IP_3TUPLE_FLAG (1 << FILTER_VLAN_IP_3TUPLE)
965 : : #define FILTER_NVGRE_VMQ_FLAG (1 << FILTER_NVGRE_VMQ)
966 : : #define FILTER_USNIC_IP_FLAG (1 << FILTER_USNIC_IP)
967 : : #define FILTER_DPDK_1_FLAG (1 << FILTER_DPDK_1)
968 : : #define FILTER_V1_ALL (FILTER_USNIC_ID_FLAG | \
969 : : FILTER_IPV4_5TUPLE_FLAG | \
970 : : FILTER_MAC_VLAN_FLAG | \
971 : : FILTER_VLAN_IP_3TUPLE_FLAG | \
972 : : FILTER_NVGRE_VMQ_FLAG | \
973 : : FILTER_USNIC_IP_FLAG | \
974 : : FILTER_DPDK_1_FLAG)
975 : :
976 : : struct filter {
977 : : uint32_t type;
978 : : union {
979 : : struct filter_usnic_id usnic;
980 : : struct filter_ipv4_5tuple ipv4;
981 : : struct filter_mac_vlan mac_vlan;
982 : : struct filter_vlan_ip_3tuple vlan_3tuple;
983 : : } u;
984 : : } __rte_packed;
985 : :
986 : : /*
987 : : * This is a strict superset of "struct filter" and exists only
988 : : * because many drivers use "sizeof (struct filter)" in deciding TLV size.
989 : : * This new, larger struct filter would cause any code that uses that method
990 : : * to not work with older firmware, so we add filter_v2 to hold the
991 : : * new filter types. Drivers should use vnic_filter_size() to determine
992 : : * the TLV size instead of sizeof (struct fiter_v2) to guard against future
993 : : * growth.
994 : : */
995 : : struct filter_v2 {
996 : : uint32_t type;
997 : : union {
998 : : struct filter_usnic_id usnic;
999 : : struct filter_ipv4_5tuple ipv4;
1000 : : struct filter_mac_vlan mac_vlan;
1001 : : struct filter_vlan_ip_3tuple vlan_3tuple;
1002 : : struct filter_generic_1 generic_1;
1003 : : } u;
1004 : : } __rte_packed;
1005 : :
1006 : : enum {
1007 : : CLSF_TLV_FILTER = 0,
1008 : : CLSF_TLV_ACTION = 1,
1009 : : };
1010 : :
1011 : : struct filter_tlv {
1012 : : uint32_t type;
1013 : : uint32_t length;
1014 : : uint32_t val[];
1015 : : };
1016 : :
1017 : : /* Data for CMD_ADD_FILTER is 2 TLV and filter + action structs */
1018 : : #define FILTER_MAX_BUF_SIZE 100
1019 : : #define FILTER_V2_MAX_BUF_SIZE (sizeof(struct filter_v2) + \
1020 : : sizeof(struct filter_action_v2) + \
1021 : : (2 * sizeof(struct filter_tlv)))
1022 : :
1023 : : /*
1024 : : * Compute actual structure size given filter type. To be "future-proof,"
1025 : : * drivers should use this instead of "sizeof (struct filter_v2)" when
1026 : : * computing length for TLV.
1027 : : */
1028 : : static inline uint32_t
1029 : : vnic_filter_size(struct filter_v2 *fp)
1030 : : {
1031 : : uint32_t size;
1032 : :
1033 : : switch (fp->type) {
1034 : : case FILTER_USNIC_ID:
1035 : : size = sizeof(fp->u.usnic);
1036 : : break;
1037 : : case FILTER_IPV4_5TUPLE:
1038 : : size = sizeof(fp->u.ipv4);
1039 : : break;
1040 : : case FILTER_MAC_VLAN:
1041 : : case FILTER_NVGRE_VMQ:
1042 : : size = sizeof(fp->u.mac_vlan);
1043 : : break;
1044 : : case FILTER_VLAN_IP_3TUPLE:
1045 : : size = sizeof(fp->u.vlan_3tuple);
1046 : : break;
1047 : : case FILTER_USNIC_IP:
1048 : : case FILTER_DPDK_1:
1049 : : size = sizeof(fp->u.generic_1);
1050 : : break;
1051 : : default:
1052 : : size = sizeof(fp->u);
1053 : : break;
1054 : : }
1055 : 0 : size += sizeof(fp->type);
1056 : : return size;
1057 : : }
1058 : :
1059 : :
1060 : : enum {
1061 : : CLSF_ADD = 0,
1062 : : CLSF_DEL = 1,
1063 : : };
1064 : :
1065 : : /*
1066 : : * Get the action structure size given action type. To be "future-proof,"
1067 : : * drivers should use this instead of "sizeof (struct filter_action_v2)"
1068 : : * when computing length for TLV.
1069 : : */
1070 : : static inline uint32_t
1071 : : vnic_action_size(struct filter_action_v2 *fap)
1072 : : {
1073 : : uint32_t size;
1074 : :
1075 [ # # ]: 0 : switch (fap->type) {
1076 : : case FILTER_ACTION_RQ_STEERING:
1077 : : size = sizeof(struct filter_action);
1078 : : break;
1079 : 0 : case FILTER_ACTION_V2:
1080 : : size = sizeof(struct filter_action_v2);
1081 : 0 : break;
1082 : : default:
1083 : : size = sizeof(struct filter_action);
1084 : : break;
1085 : : }
1086 : : return size;
1087 : : }
1088 : :
1089 : : /*
1090 : : * Writing cmd register causes STAT_BUSY to get set in status register.
1091 : : * When cmd completes, STAT_BUSY will be cleared.
1092 : : *
1093 : : * If cmd completed successfully STAT_ERROR will be clear
1094 : : * and args registers contain cmd-specific results.
1095 : : *
1096 : : * If cmd error, STAT_ERROR will be set and args[0] contains error code.
1097 : : *
1098 : : * status register is read-only. While STAT_BUSY is set,
1099 : : * all other register contents are read-only.
1100 : : */
1101 : :
1102 : : /* Make sizeof(vnic_devcmd) a power-of-2 for I/O BAR. */
1103 : : #define VNIC_DEVCMD_NARGS 15
1104 : : struct vnic_devcmd {
1105 : : uint32_t status; /* RO */
1106 : : uint32_t cmd; /* RW */
1107 : : uint64_t args[VNIC_DEVCMD_NARGS]; /* RW cmd args (little-endian)*/
1108 : : };
1109 : :
1110 : : /*
1111 : : * Version 2 of the interface.
1112 : : *
1113 : : * Some things are carried over, notably the vnic_devcmd_cmd enum.
1114 : : */
1115 : :
1116 : : /*
1117 : : * Flags for vnic_devcmd2.flags
1118 : : */
1119 : :
1120 : : #define DEVCMD2_FNORESULT 0x1 /* Don't copy result to host */
1121 : :
1122 : : #define VNIC_DEVCMD2_NARGS VNIC_DEVCMD_NARGS
1123 : : struct vnic_devcmd2 {
1124 : : uint16_t pad;
1125 : : uint16_t flags;
1126 : : uint32_t cmd; /* same command #defines as original */
1127 : : uint64_t args[VNIC_DEVCMD2_NARGS];
1128 : : };
1129 : :
1130 : : #define VNIC_DEVCMD2_NRESULTS VNIC_DEVCMD_NARGS
1131 : : struct devcmd2_result {
1132 : : uint64_t results[VNIC_DEVCMD2_NRESULTS];
1133 : : uint32_t pad;
1134 : : uint16_t completed_index; /* into copy WQ */
1135 : : uint8_t error; /* same error codes as original */
1136 : : uint8_t color; /* 0 or 1 as with completion queues */
1137 : : };
1138 : :
1139 : : #define DEVCMD2_RING_SIZE 32
1140 : : #define DEVCMD2_DESC_SIZE 128
1141 : :
1142 : : #define DEVCMD2_RESULTS_SIZE_MAX ((1 << 16) - 1)
1143 : :
1144 : : /* Overlay related definitions */
1145 : :
1146 : : /*
1147 : : * This enum lists the flag associated with each of the overlay features
1148 : : */
1149 : : typedef enum {
1150 : : OVERLAY_FEATURE_NVGRE = 1,
1151 : : OVERLAY_FEATURE_VXLAN,
1152 : : OVERLAY_FEATURE_GENEVE,
1153 : : OVERLAY_FEATURE_MAX,
1154 : : } overlay_feature_t;
1155 : :
1156 : : #define OVERLAY_OFFLOAD_ENABLE 0
1157 : : #define OVERLAY_OFFLOAD_DISABLE 1
1158 : : #define OVERLAY_OFFLOAD_ENABLE_V2 2
1159 : :
1160 : : #define OVERLAY_CFG_VXLAN_PORT_UPDATE 0
1161 : : #define OVERLAY_CFG_GENEVE_PORT_UPDATE 1
1162 : :
1163 : : /*
1164 : : * Use this enum to get the supported versions for each of these features
1165 : : * If you need to use the devcmd_get_supported_feature_version(), add
1166 : : * the new feature into this enum and install function handler in devcmd.c
1167 : : */
1168 : : typedef enum {
1169 : : VIC_FEATURE_VXLAN,
1170 : : VIC_FEATURE_RDMA,
1171 : : VIC_FEATURE_GENEVE,
1172 : : VIC_FEATURE_MAX,
1173 : : } vic_feature_t;
1174 : :
1175 : : /*
1176 : : * These flags are used in args[1] of devcmd CMD_GET_SUPP_FEATURE_VER
1177 : : * to indicate the host driver about the VxLAN and Multi WQ features
1178 : : * supported
1179 : : */
1180 : : #define FEATURE_VXLAN_IPV6_INNER (1 << 0)
1181 : : #define FEATURE_VXLAN_IPV6_OUTER (1 << 1)
1182 : : #define FEATURE_VXLAN_MULTI_WQ (1 << 2)
1183 : :
1184 : : #define FEATURE_VXLAN_IPV6 (FEATURE_VXLAN_IPV6_INNER | \
1185 : : FEATURE_VXLAN_IPV6_OUTER)
1186 : : /* Support Geneve option bytes */
1187 : : #define FEATURE_GENEVE_OPTIONS (1 << 0)
1188 : :
1189 : : /*
1190 : : * CMD_CONFIG_GRPINTR subcommands
1191 : : */
1192 : : typedef enum {
1193 : : GRPINTR_ENABLE = 1,
1194 : : GRPINTR_DISABLE,
1195 : : GRPINTR_UPD_VECT,
1196 : : } grpintr_subcmd_t;
1197 : :
1198 : : /*
1199 : : * Defines and Capabilities for CMD_CQ_ENTRY_SIZE_SET
1200 : : */
1201 : : #define VNIC_RQ_ALL (~0ULL)
1202 : :
1203 : : #define VNIC_RQ_CQ_ENTRY_SIZE_16 0
1204 : : #define VNIC_RQ_CQ_ENTRY_SIZE_32 1
1205 : : #define VNIC_RQ_CQ_ENTRY_SIZE_64 2
1206 : :
1207 : : #define VNIC_RQ_CQ_ENTRY_SIZE_16_CAPABLE (1 << VNIC_RQ_CQ_ENTRY_SIZE_16)
1208 : : #define VNIC_RQ_CQ_ENTRY_SIZE_32_CAPABLE (1 << VNIC_RQ_CQ_ENTRY_SIZE_32)
1209 : : #define VNIC_RQ_CQ_ENTRY_SIZE_64_CAPABLE (1 << VNIC_RQ_CQ_ENTRY_SIZE_64)
1210 : :
1211 : : /* CMD_QP_TYPE_SET */
1212 : : #define QP_TYPE_ADMIN 0
1213 : :
1214 : : struct vnic_sriov_stats {
1215 : : uint32_t ver;
1216 : : uint8_t sriov_vlan_membership_cap; /* sriov support vlan-membership */
1217 : : uint8_t sriov_vlan_membership_enabled; /* Default is disabled (0) */
1218 : : uint8_t sriov_rss_vf_full_cap; /* sriov VFs support full rss */
1219 : : uint8_t sriov_host_rx_stats; /* host does rx stats */
1220 : :
1221 : : /* IGx/EGx classifier TCAM
1222 : : */
1223 : : uint32_t ig_classifier0_tcam_cfg; /* IG0 TCAM config entries */
1224 : : uint32_t ig_classifier0_tcam_free; /* IG0 TCAM free count */
1225 : : uint32_t eg_classifier0_tcam_cfg; /* EG0 TCAM config entries */
1226 : : uint32_t eg_classifier0_tcam_free; /* EG0 TCAM free count */
1227 : :
1228 : : uint32_t ig_classifier1_tcam_cfg; /* IG1 TCAM config entries */
1229 : : uint32_t ig_classifier1_tcam_free; /* IG1 TCAM free count */
1230 : : uint32_t eg_classifier1_tcam_cfg; /* EG1 TCAM config entries */
1231 : : uint32_t eg_classifier1_tcam_free; /* EG1 TCAM free count */
1232 : :
1233 : : /* IGx/EGx flow table entries
1234 : : */
1235 : : uint32_t sriov_ig_flow_table_cfg; /* sriov IG FTE config */
1236 : : uint32_t sriov_ig_flow_table_free; /* sriov IG FTE free */
1237 : : uint32_t sriov_eg_flow_table_cfg; /* sriov EG FTE config */
1238 : : uint32_t sriov_eg_flow_table_free; /* sriov EG FTE free */
1239 : :
1240 : : uint8_t admin_qp_ready[32]; /* admin_qp ready bits (256) */
1241 : : uint16_t vf_index; /* VF index or SRIOV_PF_IDX */
1242 : : uint16_t reserved1;
1243 : : uint32_t reserved2[256 - 23];
1244 : : };
1245 : :
1246 : : #endif /* _VNIC_DEVCMD_H_ */
|