xref: /dpdk/lib/ethdev/rte_flow.h (revision 96893df75bf50a82cabd8debe3492d564a5d13d5)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2016 6WIND S.A.
3  * Copyright 2016 Mellanox Technologies, Ltd
4  */
5 
6 #ifndef RTE_FLOW_H_
7 #define RTE_FLOW_H_
8 
9 /**
10  * @file
11  * RTE generic flow API
12  *
13  * This interface provides the ability to program packet matching and
14  * associated actions in hardware through flow rules.
15  */
16 
17 #include <stddef.h>
18 #include <stdint.h>
19 
20 #include <rte_compat.h>
21 #include <rte_common.h>
22 #include <rte_ether.h>
23 #include <rte_arp.h>
24 #include <rte_icmp.h>
25 #include <rte_ip.h>
26 #include <rte_sctp.h>
27 #include <rte_tcp.h>
28 #include <rte_udp.h>
29 #include <rte_vxlan.h>
30 #include <rte_esp.h>
31 #include <rte_higig.h>
32 #include <rte_ecpri.h>
33 #include <rte_bitops.h>
34 #include <rte_mbuf_dyn.h>
35 #include <rte_meter.h>
36 #include <rte_gtp.h>
37 #include <rte_l2tpv2.h>
38 #include <rte_ppp.h>
39 #include <rte_gre.h>
40 #include <rte_macsec.h>
41 #include <rte_ib.h>
42 
43 #include "rte_ethdev.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /**
50  * Flow rule attributes.
51  *
52  * Priorities are set on a per rule based within groups.
53  *
54  * Lower values denote higher priority, the highest priority for a flow rule
55  * is 0, so that a flow that matches for than one rule, the rule with the
56  * lowest priority value will always be matched.
57  *
58  * Although optional, applications are encouraged to group similar rules as
59  * much as possible to fully take advantage of hardware capabilities
60  * (e.g. optimized matching) and work around limitations (e.g. a single
61  * pattern type possibly allowed in a given group). Applications should be
62  * aware that groups are not linked by default, and that they must be
63  * explicitly linked by the application using the JUMP action.
64  *
65  * Priority levels are arbitrary and up to the application, they
66  * do not need to be contiguous nor start from 0, however the maximum number
67  * varies between devices and may be affected by existing flow rules.
68  *
69  * If a packet is matched by several rules of a given group for a given
70  * priority level, the outcome is undefined. It can take any path, may be
71  * duplicated or even cause unrecoverable errors.
72  *
73  * Note that support for more than a single group and priority level is not
74  * guaranteed.
75  *
76  * At vNIC / ethdev level, flow rules can apply to inbound and / or outbound
77  * traffic (ingress / egress), with respect to the vNIC / ethdev in question.
78  * At embedded switch level, flow rules apply to all traffic seen by it
79  * unless fitting meta items are used to set concrete traffic source(s).
80  *
81  * Several pattern items and actions are valid and can be used in both
82  * directions. Those valid for only one direction are described as such.
83  *
84  * At least one direction must be specified.
85  *
86  * Specifying both directions at once for a given rule is not recommended
87  * but may be valid in a few cases.
88  */
89 struct rte_flow_attr {
90 	/**
91 	 * A group is a superset of multiple rules.
92 	 * The default group is 0 and is processed for all packets.
93 	 * Rules in other groups are processed only if the group is chained
94 	 * by a jump action from a previously matched rule.
95 	 * It means the group hierarchy is made by the flow rules,
96 	 * and the group 0 is the hierarchy root.
97 	 * Note there is no automatic dead loop protection.
98 	 * @see rte_flow_action_jump
99 	 */
100 	uint32_t group;
101 	uint32_t priority; /**< Rule priority level within group. */
102 	/**
103 	 * The rule in question applies to ingress traffic (non-"transfer").
104 	 */
105 	uint32_t ingress:1;
106 	/**
107 	 * The rule in question applies to egress traffic (non-"transfer").
108 	 */
109 	uint32_t egress:1;
110 	/**
111 	 * Instead of simply matching the properties of traffic as it would
112 	 * appear on a given DPDK port ID, enabling this attribute transfers
113 	 * a flow rule to the lowest possible level of any device endpoints
114 	 * found in the pattern.
115 	 *
116 	 * When supported, this effectively enables an application to
117 	 * re-route traffic not necessarily intended for it (e.g. coming
118 	 * from or addressed to different physical ports, VFs or
119 	 * applications) at the device level.
120 	 *
121 	 * The application should match traffic originating from precise
122 	 * locations. See items PORT_REPRESENTOR and REPRESENTED_PORT.
123 	 *
124 	 * Managing "transfer" flows requires that the user communicate them
125 	 * through a suitable port. @see rte_flow_pick_transfer_proxy().
126 	 */
127 	uint32_t transfer:1;
128 	uint32_t reserved:29; /**< Reserved, must be zero. */
129 };
130 
131 struct rte_flow_group_attr {
132 	uint32_t ingress:1;
133 	uint32_t egress:1;
134 	uint32_t transfer:1;
135 };
136 
137 /**
138  * Matching pattern item types.
139  *
140  * Pattern items fall in two categories:
141  *
142  * - Matching protocol headers and packet data, usually associated with a
143  *   specification structure. These must be stacked in the same order as the
144  *   protocol layers to match inside packets, starting from the lowest.
145  *
146  * - Matching meta-data or affecting pattern processing, often without a
147  *   specification structure. Since they do not match packet contents, their
148  *   position in the list is usually not relevant.
149  *
150  * See the description of individual types for more information. Those
151  * marked with [META] fall into the second category.
152  */
153 enum rte_flow_item_type {
154 	/**
155 	 * [META]
156 	 *
157 	 * End marker for item lists. Prevents further processing of items,
158 	 * thereby ending the pattern.
159 	 *
160 	 * No associated specification structure.
161 	 */
162 	RTE_FLOW_ITEM_TYPE_END,
163 
164 	/**
165 	 * [META]
166 	 *
167 	 * Used as a placeholder for convenience. It is ignored and simply
168 	 * discarded by PMDs.
169 	 *
170 	 * No associated specification structure.
171 	 */
172 	RTE_FLOW_ITEM_TYPE_VOID,
173 
174 	/**
175 	 * [META]
176 	 *
177 	 * Inverted matching, i.e. process packets that do not match the
178 	 * pattern.
179 	 *
180 	 * No associated specification structure.
181 	 */
182 	RTE_FLOW_ITEM_TYPE_INVERT,
183 
184 	/**
185 	 * Matches any protocol in place of the current layer, a single ANY
186 	 * may also stand for several protocol layers.
187 	 *
188 	 * See struct rte_flow_item_any.
189 	 */
190 	RTE_FLOW_ITEM_TYPE_ANY,
191 
192 	/**
193 	 * @deprecated
194 	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
195 	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
196 	 *
197 	 * [META]
198 	 *
199 	 * Matches traffic originating from (ingress) or going to (egress) a
200 	 * given DPDK port ID.
201 	 *
202 	 * See struct rte_flow_item_port_id.
203 	 */
204 	RTE_FLOW_ITEM_TYPE_PORT_ID,
205 
206 	/**
207 	 * Matches a byte string of a given length at a given offset.
208 	 *
209 	 * See struct rte_flow_item_raw.
210 	 */
211 	RTE_FLOW_ITEM_TYPE_RAW,
212 
213 	/**
214 	 * Matches an Ethernet header.
215 	 *
216 	 * See struct rte_flow_item_eth.
217 	 */
218 	RTE_FLOW_ITEM_TYPE_ETH,
219 
220 	/**
221 	 * Matches an 802.1Q/ad VLAN tag.
222 	 *
223 	 * See struct rte_flow_item_vlan.
224 	 */
225 	RTE_FLOW_ITEM_TYPE_VLAN,
226 
227 	/**
228 	 * Matches an IPv4 header.
229 	 *
230 	 * See struct rte_flow_item_ipv4.
231 	 */
232 	RTE_FLOW_ITEM_TYPE_IPV4,
233 
234 	/**
235 	 * Matches an IPv6 header.
236 	 *
237 	 * See struct rte_flow_item_ipv6.
238 	 */
239 	RTE_FLOW_ITEM_TYPE_IPV6,
240 
241 	/**
242 	 * Matches an ICMP header.
243 	 *
244 	 * See struct rte_flow_item_icmp.
245 	 */
246 	RTE_FLOW_ITEM_TYPE_ICMP,
247 
248 	/**
249 	 * Matches a UDP header.
250 	 *
251 	 * See struct rte_flow_item_udp.
252 	 */
253 	RTE_FLOW_ITEM_TYPE_UDP,
254 
255 	/**
256 	 * Matches a TCP header.
257 	 *
258 	 * See struct rte_flow_item_tcp.
259 	 */
260 	RTE_FLOW_ITEM_TYPE_TCP,
261 
262 	/**
263 	 * Matches a SCTP header.
264 	 *
265 	 * See struct rte_flow_item_sctp.
266 	 */
267 	RTE_FLOW_ITEM_TYPE_SCTP,
268 
269 	/**
270 	 * Matches a VXLAN header.
271 	 *
272 	 * See struct rte_flow_item_vxlan.
273 	 */
274 	RTE_FLOW_ITEM_TYPE_VXLAN,
275 
276 	/**
277 	 * Matches a E_TAG header.
278 	 *
279 	 * See struct rte_flow_item_e_tag.
280 	 */
281 	RTE_FLOW_ITEM_TYPE_E_TAG,
282 
283 	/**
284 	 * Matches a NVGRE header.
285 	 *
286 	 * See struct rte_flow_item_nvgre.
287 	 */
288 	RTE_FLOW_ITEM_TYPE_NVGRE,
289 
290 	/**
291 	 * Matches a MPLS header.
292 	 *
293 	 * See struct rte_flow_item_mpls.
294 	 */
295 	RTE_FLOW_ITEM_TYPE_MPLS,
296 
297 	/**
298 	 * Matches a GRE header.
299 	 *
300 	 * See struct rte_flow_item_gre.
301 	 */
302 	RTE_FLOW_ITEM_TYPE_GRE,
303 
304 	/**
305 	 * [META]
306 	 *
307 	 * Fuzzy pattern match, expect faster than default.
308 	 *
309 	 * This is for device that support fuzzy matching option.
310 	 * Usually a fuzzy matching is fast but the cost is accuracy.
311 	 *
312 	 * See struct rte_flow_item_fuzzy.
313 	 */
314 	RTE_FLOW_ITEM_TYPE_FUZZY,
315 
316 	/**
317 	 * Matches a GTP header.
318 	 *
319 	 * Configure flow for GTP packets.
320 	 *
321 	 * See struct rte_flow_item_gtp.
322 	 */
323 	RTE_FLOW_ITEM_TYPE_GTP,
324 
325 	/**
326 	 * Matches a GTP header.
327 	 *
328 	 * Configure flow for GTP-C packets.
329 	 *
330 	 * See struct rte_flow_item_gtp.
331 	 */
332 	RTE_FLOW_ITEM_TYPE_GTPC,
333 
334 	/**
335 	 * Matches a GTP header.
336 	 *
337 	 * Configure flow for GTP-U packets.
338 	 *
339 	 * See struct rte_flow_item_gtp.
340 	 */
341 	RTE_FLOW_ITEM_TYPE_GTPU,
342 
343 	/**
344 	 * Matches a ESP header.
345 	 *
346 	 * See struct rte_flow_item_esp.
347 	 */
348 	RTE_FLOW_ITEM_TYPE_ESP,
349 
350 	/**
351 	 * Matches a GENEVE header.
352 	 *
353 	 * See struct rte_flow_item_geneve.
354 	 */
355 	RTE_FLOW_ITEM_TYPE_GENEVE,
356 
357 	/**
358 	 * Matches a VXLAN-GPE header.
359 	 *
360 	 * See struct rte_flow_item_vxlan_gpe.
361 	 */
362 	RTE_FLOW_ITEM_TYPE_VXLAN_GPE,
363 
364 	/**
365 	 * Matches an ARP header for Ethernet/IPv4.
366 	 *
367 	 * See struct rte_flow_item_arp_eth_ipv4.
368 	 */
369 	RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4,
370 
371 	/**
372 	 * Matches the presence of any IPv6 extension header.
373 	 *
374 	 * See struct rte_flow_item_ipv6_ext.
375 	 */
376 	RTE_FLOW_ITEM_TYPE_IPV6_EXT,
377 
378 	/**
379 	 * Matches any ICMPv6 header.
380 	 *
381 	 * See struct rte_flow_item_icmp6.
382 	 */
383 	RTE_FLOW_ITEM_TYPE_ICMP6,
384 
385 	/**
386 	 * Matches an ICMPv6 neighbor discovery solicitation.
387 	 *
388 	 * See struct rte_flow_item_icmp6_nd_ns.
389 	 */
390 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS,
391 
392 	/**
393 	 * Matches an ICMPv6 neighbor discovery advertisement.
394 	 *
395 	 * See struct rte_flow_item_icmp6_nd_na.
396 	 */
397 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA,
398 
399 	/**
400 	 * Matches the presence of any ICMPv6 neighbor discovery option.
401 	 *
402 	 * See struct rte_flow_item_icmp6_nd_opt.
403 	 */
404 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT,
405 
406 	/**
407 	 * Matches an ICMPv6 neighbor discovery source Ethernet link-layer
408 	 * address option.
409 	 *
410 	 * See struct rte_flow_item_icmp6_nd_opt_sla_eth.
411 	 */
412 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH,
413 
414 	/**
415 	 * Matches an ICMPv6 neighbor discovery target Ethernet link-layer
416 	 * address option.
417 	 *
418 	 * See struct rte_flow_item_icmp6_nd_opt_tla_eth.
419 	 */
420 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH,
421 
422 	/**
423 	 * Matches specified mark field.
424 	 *
425 	 * See struct rte_flow_item_mark.
426 	 */
427 	RTE_FLOW_ITEM_TYPE_MARK,
428 
429 	/**
430 	 * [META]
431 	 *
432 	 * Matches a metadata value.
433 	 *
434 	 * See struct rte_flow_item_meta.
435 	 */
436 	RTE_FLOW_ITEM_TYPE_META,
437 
438 	/**
439 	 * Matches a GRE optional key field.
440 	 *
441 	 * The value should a big-endian 32bit integer.
442 	 *
443 	 * When this item present the K bit is implicitly matched as "1"
444 	 * in the default mask.
445 	 *
446 	 * @p spec/mask type:
447 	 * @code rte_be32_t * @endcode
448 	 */
449 	RTE_FLOW_ITEM_TYPE_GRE_KEY,
450 
451 	/**
452 	 * Matches a GTP extension header: PDU session container.
453 	 *
454 	 * Configure flow for GTP packets with extension header type 0x85.
455 	 *
456 	 * See struct rte_flow_item_gtp_psc.
457 	 */
458 	RTE_FLOW_ITEM_TYPE_GTP_PSC,
459 
460 	/**
461 	 * Matches a PPPoE header.
462 	 *
463 	 * Configure flow for PPPoE session packets.
464 	 *
465 	 * See struct rte_flow_item_pppoe.
466 	 */
467 	RTE_FLOW_ITEM_TYPE_PPPOES,
468 
469 	/**
470 	 * Matches a PPPoE header.
471 	 *
472 	 * Configure flow for PPPoE discovery packets.
473 	 *
474 	 * See struct rte_flow_item_pppoe.
475 	 */
476 	RTE_FLOW_ITEM_TYPE_PPPOED,
477 
478 	/**
479 	 * Matches a PPPoE optional proto_id field.
480 	 *
481 	 * It only applies to PPPoE session packets.
482 	 *
483 	 * See struct rte_flow_item_pppoe_proto_id.
484 	 */
485 	RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID,
486 
487 	/**
488 	 * Matches Network service header (NSH).
489 	 * See struct rte_flow_item_nsh.
490 	 *
491 	 */
492 	RTE_FLOW_ITEM_TYPE_NSH,
493 
494 	/**
495 	 * Matches Internet Group Management Protocol (IGMP).
496 	 * See struct rte_flow_item_igmp.
497 	 *
498 	 */
499 	RTE_FLOW_ITEM_TYPE_IGMP,
500 
501 	/**
502 	 * Matches IP Authentication Header (AH).
503 	 * See struct rte_flow_item_ah.
504 	 *
505 	 */
506 	RTE_FLOW_ITEM_TYPE_AH,
507 
508 	/**
509 	 * Matches a HIGIG header.
510 	 * see struct rte_flow_item_higig2_hdr.
511 	 */
512 	RTE_FLOW_ITEM_TYPE_HIGIG2,
513 
514 	/**
515 	 * [META]
516 	 *
517 	 * Matches a tag value.
518 	 *
519 	 * See struct rte_flow_item_tag.
520 	 */
521 	RTE_FLOW_ITEM_TYPE_TAG,
522 
523 	/**
524 	 * Matches a L2TPv3 over IP header.
525 	 *
526 	 * Configure flow for L2TPv3 over IP packets.
527 	 *
528 	 * See struct rte_flow_item_l2tpv3oip.
529 	 */
530 	RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
531 
532 	/**
533 	 * Matches PFCP Header.
534 	 * See struct rte_flow_item_pfcp.
535 	 *
536 	 */
537 	RTE_FLOW_ITEM_TYPE_PFCP,
538 
539 	/**
540 	 * Matches eCPRI Header.
541 	 *
542 	 * Configure flow for eCPRI over ETH or UDP packets.
543 	 *
544 	 * See struct rte_flow_item_ecpri.
545 	 */
546 	RTE_FLOW_ITEM_TYPE_ECPRI,
547 
548 	/**
549 	 * Matches the presence of IPv6 fragment extension header.
550 	 *
551 	 * See struct rte_flow_item_ipv6_frag_ext.
552 	 */
553 	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
554 
555 	/**
556 	 * Matches Geneve Variable Length Option
557 	 *
558 	 * See struct rte_flow_item_geneve_opt
559 	 */
560 	RTE_FLOW_ITEM_TYPE_GENEVE_OPT,
561 
562 	/**
563 	 * [META]
564 	 *
565 	 * Matches on packet integrity.
566 	 * For some devices application needs to enable integration checks in HW
567 	 * before using this item.
568 	 *
569 	 * @see struct rte_flow_item_integrity.
570 	 */
571 	RTE_FLOW_ITEM_TYPE_INTEGRITY,
572 
573 	/**
574 	 * [META]
575 	 *
576 	 * Matches conntrack state.
577 	 *
578 	 * @see struct rte_flow_item_conntrack.
579 	 */
580 	RTE_FLOW_ITEM_TYPE_CONNTRACK,
581 
582 	/**
583 	 * [META]
584 	 *
585 	 * Matches traffic entering the embedded switch from the given ethdev.
586 	 *
587 	 * @see struct rte_flow_item_ethdev
588 	 */
589 	RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
590 
591 	/**
592 	 * [META]
593 	 *
594 	 * Matches traffic entering the embedded switch from
595 	 * the entity represented by the given ethdev.
596 	 *
597 	 * @see struct rte_flow_item_ethdev
598 	 */
599 	RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT,
600 
601 	/**
602 	 * Matches a configured set of fields at runtime calculated offsets
603 	 * over the generic network header with variable length and
604 	 * flexible pattern
605 	 *
606 	 * @see struct rte_flow_item_flex.
607 	 */
608 	RTE_FLOW_ITEM_TYPE_FLEX,
609 
610 	/**
611 	 * Matches L2TPv2 Header.
612 	 *
613 	 * See struct rte_flow_item_l2tpv2.
614 	 */
615 	RTE_FLOW_ITEM_TYPE_L2TPV2,
616 
617 	/**
618 	 * Matches PPP Header.
619 	 *
620 	 * See struct rte_flow_item_ppp.
621 	 */
622 	RTE_FLOW_ITEM_TYPE_PPP,
623 
624 	/**
625 	 * Matches GRE optional fields.
626 	 *
627 	 * See struct rte_flow_item_gre_opt.
628 	 */
629 	RTE_FLOW_ITEM_TYPE_GRE_OPTION,
630 
631 	/**
632 	 * Matches MACsec Ethernet Header.
633 	 *
634 	 * See struct rte_flow_item_macsec.
635 	 */
636 	RTE_FLOW_ITEM_TYPE_MACSEC,
637 
638 	/**
639 	 * Matches Meter Color Marker.
640 	 *
641 	 * See struct rte_flow_item_meter_color.
642 	 */
643 	RTE_FLOW_ITEM_TYPE_METER_COLOR,
644 
645 	/**
646 	 * Matches the presence of IPv6 routing extension header.
647 	 *
648 	 * @see struct rte_flow_item_ipv6_routing_ext.
649 	 */
650 	RTE_FLOW_ITEM_TYPE_IPV6_ROUTING_EXT,
651 
652 	/**
653 	 * Matches an ICMPv6 echo request.
654 	 *
655 	 * @see struct rte_flow_item_icmp6_echo.
656 	 */
657 	RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST,
658 
659 	/**
660 	 * Matches an ICMPv6 echo reply.
661 	 *
662 	 * @see struct rte_flow_item_icmp6_echo.
663 	 */
664 	RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY,
665 
666 	/**
667 	 * Match Quota state
668 	 *
669 	 * @see struct rte_flow_item_quota
670 	 */
671 	 RTE_FLOW_ITEM_TYPE_QUOTA,
672 
673 	/**
674 	 * Matches on the aggregated port of the received packet.
675 	 * Used in case multiple ports are aggregated to the a DPDK port.
676 	 * First port is number 1.
677 	 *
678 	 * @see struct rte_flow_item_aggr_affinity.
679 	 */
680 	RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY,
681 
682 	/**
683 	 * Match Tx queue number.
684 	 * This is valid only for egress rules.
685 	 *
686 	 * @see struct rte_flow_item_tx_queue
687 	 */
688 	 RTE_FLOW_ITEM_TYPE_TX_QUEUE,
689 
690 	/**
691 	 * Matches an InfiniBand base transport header in RoCE packet.
692 	 *
693 	 * @see struct rte_flow_item_ib_bth.
694 	 */
695 	RTE_FLOW_ITEM_TYPE_IB_BTH,
696 
697 	/**
698 	 * Matches the packet type as defined in rte_mbuf_ptype.
699 	 *
700 	 * See struct rte_flow_item_ptype.
701 	 *
702 	 */
703 	RTE_FLOW_ITEM_TYPE_PTYPE,
704 
705 	/**
706 	 * [META]
707 	 *
708 	 * Matches a random value.
709 	 *
710 	 * This value is not based on the packet data/headers.
711 	 * The application shouldn't assume that this value is kept
712 	 * during the lifetime of the packet.
713 	 *
714 	 * @see struct rte_flow_item_random.
715 	 */
716 	RTE_FLOW_ITEM_TYPE_RANDOM,
717 
718 	/**
719 	 * Match packet with various comparison types.
720 	 *
721 	 * See struct rte_flow_item_compare.
722 	 */
723 	RTE_FLOW_ITEM_TYPE_COMPARE,
724 };
725 
726 /**
727  * @warning
728  * @b EXPERIMENTAL: this API may change without prior notice.
729  *
730  * QUOTA state.
731  *
732  * @see struct rte_flow_item_quota
733  */
734 enum rte_flow_quota_state {
735 	RTE_FLOW_QUOTA_STATE_PASS, /**< PASS quota state */
736 	RTE_FLOW_QUOTA_STATE_BLOCK /**< BLOCK quota state */
737 };
738 
739 /**
740  * RTE_FLOW_ITEM_TYPE_QUOTA
741  *
742  * Matches QUOTA state
743  */
744 struct rte_flow_item_quota {
745 	enum rte_flow_quota_state state;
746 };
747 
748 /**
749  * Default mask for RTE_FLOW_ITEM_TYPE_QUOTA
750  */
751 #ifndef __cplusplus
752 static const struct rte_flow_item_quota rte_flow_item_quota_mask = {
753 	.state = (enum rte_flow_quota_state)0xff
754 };
755 #endif
756 
757 /**
758  *
759  * RTE_FLOW_ITEM_TYPE_HIGIG2
760  * Matches higig2 header
761  */
762 struct rte_flow_item_higig2_hdr {
763 	struct rte_higig2_hdr hdr;
764 };
765 
766 /** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
767 #ifndef __cplusplus
768 static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
769 	.hdr = {
770 		.ppt1 = {
771 			.classification = RTE_BE16(UINT16_MAX),
772 			.vid = RTE_BE16(0xfff),
773 		},
774 	},
775 };
776 #endif
777 
778 /**
779  * RTE_FLOW_ITEM_TYPE_ANY
780  *
781  * Matches any protocol in place of the current layer, a single ANY may also
782  * stand for several protocol layers.
783  *
784  * This is usually specified as the first pattern item when looking for a
785  * protocol anywhere in a packet.
786  *
787  * A zeroed mask stands for any number of layers.
788  */
789 struct rte_flow_item_any {
790 	uint32_t num; /**< Number of layers covered. */
791 };
792 
793 /** Default mask for RTE_FLOW_ITEM_TYPE_ANY. */
794 #ifndef __cplusplus
795 static const struct rte_flow_item_any rte_flow_item_any_mask = {
796 	.num = 0x00000000,
797 };
798 #endif
799 
800 /**
801  * @deprecated
802  * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
803  * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
804  *
805  * RTE_FLOW_ITEM_TYPE_PORT_ID
806  *
807  * Matches traffic originating from (ingress) or going to (egress) a given
808  * DPDK port ID.
809  *
810  * Normally only supported if the port ID in question is known by the
811  * underlying PMD and related to the device the flow rule is created
812  * against.
813  */
814 struct rte_flow_item_port_id {
815 	uint32_t id; /**< DPDK port ID. */
816 };
817 
818 /** Default mask for RTE_FLOW_ITEM_TYPE_PORT_ID. */
819 #ifndef __cplusplus
820 static const struct rte_flow_item_port_id rte_flow_item_port_id_mask = {
821 	.id = 0xffffffff,
822 };
823 #endif
824 
825 /**
826  * RTE_FLOW_ITEM_TYPE_RAW
827  *
828  * Matches a byte string of a given length at a given offset.
829  *
830  * Offset is either absolute (using the start of the packet) or relative to
831  * the end of the previous matched item in the stack, in which case negative
832  * values are allowed.
833  *
834  * If search is enabled, offset is used as the starting point. The search
835  * area can be delimited by setting limit to a nonzero value, which is the
836  * maximum number of bytes after offset where the pattern may start.
837  *
838  * Matching a zero-length pattern is allowed, doing so resets the relative
839  * offset for subsequent items.
840  *
841  * This type does not support ranges (struct rte_flow_item.last).
842  */
843 struct rte_flow_item_raw {
844 	uint32_t relative:1; /**< Look for pattern after the previous item. */
845 	uint32_t search:1; /**< Search pattern from offset (see also limit). */
846 	uint32_t reserved:30; /**< Reserved, must be set to zero. */
847 	int32_t offset; /**< Absolute or relative offset for pattern. */
848 	uint16_t limit; /**< Search area limit for start of pattern. */
849 	uint16_t length; /**< Pattern length. */
850 	const uint8_t *pattern; /**< Byte string to look for. */
851 };
852 
853 /** Default mask for RTE_FLOW_ITEM_TYPE_RAW. */
854 #ifndef __cplusplus
855 static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
856 	.relative = 1,
857 	.search = 1,
858 	.reserved = 0x3fffffff,
859 	.offset = 0xffffffff,
860 	.limit = 0xffff,
861 	.length = 0xffff,
862 	.pattern = NULL,
863 };
864 #endif
865 
866 /**
867  * RTE_FLOW_ITEM_TYPE_ETH
868  *
869  * Matches an Ethernet header.
870  *
871  * Inside @p hdr field, the sub-field @p ether_type stands either for EtherType
872  * or TPID, depending on whether the item is followed by a VLAN item or not. If
873  * two VLAN items follow, the sub-field refers to the outer one, which, in turn,
874  * contains the inner TPID in the similar header field. The innermost VLAN item
875  * contains a layer-3 EtherType. All of that follows the order seen on the wire.
876  *
877  * If the field in question contains a TPID value, only tagged packets with the
878  * specified TPID will match the pattern. Alternatively, it's possible to match
879  * any type of tagged packets by means of the field @p has_vlan rather than use
880  * the EtherType/TPID field. Also, it's possible to leave the two fields unused.
881  * If this is the case, both tagged and untagged packets will match the pattern.
882  */
883 struct rte_flow_item_eth {
884 	union {
885 		struct {
886 			/*
887 			 * These fields are retained for compatibility.
888 			 * Please switch to the new header field below.
889 			 */
890 			struct rte_ether_addr dst; /**< Destination MAC. */
891 			struct rte_ether_addr src; /**< Source MAC. */
892 			rte_be16_t type; /**< EtherType or TPID. */
893 		};
894 		struct rte_ether_hdr hdr;
895 	};
896 	uint32_t has_vlan:1; /**< Packet header contains at least one VLAN. */
897 	uint32_t reserved:31; /**< Reserved, must be zero. */
898 };
899 
900 /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */
901 #ifndef __cplusplus
902 static const struct rte_flow_item_eth rte_flow_item_eth_mask = {
903 	.hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
904 	.hdr.src_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
905 	.hdr.ether_type = RTE_BE16(0x0000),
906 };
907 #endif
908 
909 /**
910  * RTE_FLOW_ITEM_TYPE_VLAN
911  *
912  * Matches an 802.1Q/ad VLAN tag.
913  *
914  * The corresponding standard outer EtherType (TPID) values are
915  * RTE_ETHER_TYPE_VLAN or RTE_ETHER_TYPE_QINQ. It can be overridden by
916  * the preceding pattern item.
917  * If a @p VLAN item is present in the pattern, then only tagged packets will
918  * match the pattern.
919  * The field @p has_more_vlan can be used to match any type of tagged packets,
920  * instead of using the @p eth_proto field of @p hdr.
921  * If the @p eth_proto of @p hdr and @p has_more_vlan fields are not specified,
922  * then any tagged packets will match the pattern.
923  */
924 struct rte_flow_item_vlan {
925 	union {
926 		struct {
927 			/*
928 			 * These fields are retained for compatibility.
929 			 * Please switch to the new header field below.
930 			 */
931 			rte_be16_t tci; /**< Tag control information. */
932 			rte_be16_t inner_type; /**< Inner EtherType or TPID. */
933 		};
934 		struct rte_vlan_hdr hdr;
935 	};
936 	/** Packet header contains at least one more VLAN, after this VLAN. */
937 	uint32_t has_more_vlan:1;
938 	uint32_t reserved:31; /**< Reserved, must be zero. */
939 };
940 
941 /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */
942 #ifndef __cplusplus
943 static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = {
944 	.hdr.vlan_tci = RTE_BE16(0x0fff),
945 	.hdr.eth_proto = RTE_BE16(0x0000),
946 };
947 #endif
948 
949 /**
950  * RTE_FLOW_ITEM_TYPE_IPV4
951  *
952  * Matches an IPv4 header.
953  *
954  * Note: IPv4 options are handled by dedicated pattern items.
955  */
956 struct rte_flow_item_ipv4 {
957 	struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */
958 };
959 
960 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */
961 #ifndef __cplusplus
962 static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = {
963 	.hdr = {
964 		.src_addr = RTE_BE32(0xffffffff),
965 		.dst_addr = RTE_BE32(0xffffffff),
966 	},
967 };
968 #endif
969 
970 /**
971  * RTE_FLOW_ITEM_TYPE_IPV6.
972  *
973  * Matches an IPv6 header.
974  *
975  * Dedicated flags indicate if header contains specific extension headers.
976  */
977 struct rte_flow_item_ipv6 {
978 	struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
979 	/** Header contains Hop-by-Hop Options extension header. */
980 	uint32_t has_hop_ext:1;
981 	/** Header contains Routing extension header. */
982 	uint32_t has_route_ext:1;
983 	/** Header contains Fragment extension header. */
984 	uint32_t has_frag_ext:1;
985 	/** Header contains Authentication extension header. */
986 	uint32_t has_auth_ext:1;
987 	/** Header contains Encapsulation Security Payload extension header. */
988 	uint32_t has_esp_ext:1;
989 	/** Header contains Destination Options extension header. */
990 	uint32_t has_dest_ext:1;
991 	/** Header contains Mobility extension header. */
992 	uint32_t has_mobil_ext:1;
993 	/** Header contains Host Identity Protocol extension header. */
994 	uint32_t has_hip_ext:1;
995 	/** Header contains Shim6 Protocol extension header. */
996 	uint32_t has_shim6_ext:1;
997 	/** Reserved for future extension headers, must be zero. */
998 	uint32_t reserved:23;
999 };
1000 
1001 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
1002 #ifndef __cplusplus
1003 static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
1004 	.hdr = {
1005 		.src_addr =
1006 			"\xff\xff\xff\xff\xff\xff\xff\xff"
1007 			"\xff\xff\xff\xff\xff\xff\xff\xff",
1008 		.dst_addr =
1009 			"\xff\xff\xff\xff\xff\xff\xff\xff"
1010 			"\xff\xff\xff\xff\xff\xff\xff\xff",
1011 	},
1012 };
1013 #endif
1014 
1015 /**
1016  * @warning
1017  * @b EXPERIMENTAL: this structure may change without prior notice.
1018  *
1019  * RTE_FLOW_ITEM_TYPE_IPV6_ROUTING_EXT.
1020  *
1021  * Matches an IPv6 routing extension header.
1022  */
1023 struct rte_flow_item_ipv6_routing_ext {
1024 	struct rte_ipv6_routing_ext hdr;
1025 };
1026 
1027 /**
1028  * RTE_FLOW_ITEM_TYPE_ICMP.
1029  *
1030  * Matches an ICMP header.
1031  */
1032 struct rte_flow_item_icmp {
1033 	struct rte_icmp_hdr hdr; /**< ICMP header definition. */
1034 };
1035 
1036 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */
1037 #ifndef __cplusplus
1038 static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = {
1039 	.hdr = {
1040 		.icmp_type = 0xff,
1041 		.icmp_code = 0xff,
1042 	},
1043 };
1044 #endif
1045 
1046 /**
1047  * RTE_FLOW_ITEM_TYPE_UDP.
1048  *
1049  * Matches a UDP header.
1050  */
1051 struct rte_flow_item_udp {
1052 	struct rte_udp_hdr hdr; /**< UDP header definition. */
1053 };
1054 
1055 /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */
1056 #ifndef __cplusplus
1057 static const struct rte_flow_item_udp rte_flow_item_udp_mask = {
1058 	.hdr = {
1059 		.src_port = RTE_BE16(0xffff),
1060 		.dst_port = RTE_BE16(0xffff),
1061 	},
1062 };
1063 #endif
1064 
1065 /**
1066  * RTE_FLOW_ITEM_TYPE_TCP.
1067  *
1068  * Matches a TCP header.
1069  */
1070 struct rte_flow_item_tcp {
1071 	struct rte_tcp_hdr hdr; /**< TCP header definition. */
1072 };
1073 
1074 /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */
1075 #ifndef __cplusplus
1076 static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = {
1077 	.hdr = {
1078 		.src_port = RTE_BE16(0xffff),
1079 		.dst_port = RTE_BE16(0xffff),
1080 	},
1081 };
1082 #endif
1083 
1084 /**
1085  * RTE_FLOW_ITEM_TYPE_SCTP.
1086  *
1087  * Matches a SCTP header.
1088  */
1089 struct rte_flow_item_sctp {
1090 	struct rte_sctp_hdr hdr; /**< SCTP header definition. */
1091 };
1092 
1093 /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */
1094 #ifndef __cplusplus
1095 static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = {
1096 	.hdr = {
1097 		.src_port = RTE_BE16(0xffff),
1098 		.dst_port = RTE_BE16(0xffff),
1099 	},
1100 };
1101 #endif
1102 
1103 /**
1104  * RTE_FLOW_ITEM_TYPE_VXLAN.
1105  *
1106  * Matches a VXLAN header (RFC 7348).
1107  */
1108 struct rte_flow_item_vxlan {
1109 	union {
1110 		struct {
1111 			/*
1112 			 * These fields are retained for compatibility.
1113 			 * Please switch to the new header field below.
1114 			 */
1115 			uint8_t flags; /**< Normally 0x08 (I flag). */
1116 			uint8_t rsvd0[3]; /**< Reserved, normally 0x000000. */
1117 			uint8_t vni[3]; /**< VXLAN identifier. */
1118 			uint8_t rsvd1; /**< Reserved, normally 0x00. */
1119 		};
1120 		struct rte_vxlan_hdr hdr;
1121 	};
1122 };
1123 
1124 /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */
1125 #ifndef __cplusplus
1126 static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
1127 	.hdr.vni = "\xff\xff\xff",
1128 };
1129 #endif
1130 
1131 /**
1132  * RTE_FLOW_ITEM_TYPE_E_TAG.
1133  *
1134  * Matches a E-tag header.
1135  *
1136  * The corresponding standard outer EtherType (TPID) value is
1137  * RTE_ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item.
1138  */
1139 struct rte_flow_item_e_tag {
1140 	/**
1141 	 * E-Tag control information (E-TCI).
1142 	 * E-PCP (3b), E-DEI (1b), ingress E-CID base (12b).
1143 	 */
1144 	rte_be16_t epcp_edei_in_ecid_b;
1145 	/** Reserved (2b), GRP (2b), E-CID base (12b). */
1146 	rte_be16_t rsvd_grp_ecid_b;
1147 	uint8_t in_ecid_e; /**< Ingress E-CID ext. */
1148 	uint8_t ecid_e; /**< E-CID ext. */
1149 	rte_be16_t inner_type; /**< Inner EtherType or TPID. */
1150 };
1151 
1152 /** Default mask for RTE_FLOW_ITEM_TYPE_E_TAG. */
1153 #ifndef __cplusplus
1154 static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask = {
1155 	.rsvd_grp_ecid_b = RTE_BE16(0x3fff),
1156 };
1157 #endif
1158 
1159 /**
1160  * RTE_FLOW_ITEM_TYPE_NVGRE.
1161  *
1162  * Matches a NVGRE header.
1163  */
1164 struct rte_flow_item_nvgre {
1165 	/**
1166 	 * Checksum (1b), undefined (1b), key bit (1b), sequence number (1b),
1167 	 * reserved 0 (9b), version (3b).
1168 	 *
1169 	 * c_k_s_rsvd0_ver must have value 0x2000 according to RFC 7637.
1170 	 */
1171 	rte_be16_t c_k_s_rsvd0_ver;
1172 	rte_be16_t protocol; /**< Protocol type (0x6558). */
1173 	uint8_t tni[3]; /**< Virtual subnet ID. */
1174 	uint8_t flow_id; /**< Flow ID. */
1175 };
1176 
1177 /** Default mask for RTE_FLOW_ITEM_TYPE_NVGRE. */
1178 #ifndef __cplusplus
1179 static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask = {
1180 	.tni = "\xff\xff\xff",
1181 };
1182 #endif
1183 
1184 /**
1185  * RTE_FLOW_ITEM_TYPE_MPLS.
1186  *
1187  * Matches a MPLS header.
1188  */
1189 struct rte_flow_item_mpls {
1190 	/**
1191 	 * Label (20b), TC (3b), Bottom of Stack (1b).
1192 	 */
1193 	uint8_t label_tc_s[3];
1194 	uint8_t ttl; /** Time-to-Live. */
1195 };
1196 
1197 /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */
1198 #ifndef __cplusplus
1199 static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
1200 	.label_tc_s = "\xff\xff\xf0",
1201 };
1202 #endif
1203 
1204 /**
1205  * RTE_FLOW_ITEM_TYPE_GRE.
1206  *
1207  * Matches a GRE header.
1208  */
1209 struct rte_flow_item_gre {
1210 	/**
1211 	 * Checksum (1b), reserved 0 (12b), version (3b).
1212 	 * Refer to RFC 2784.
1213 	 */
1214 	rte_be16_t c_rsvd0_ver;
1215 	rte_be16_t protocol; /**< Protocol type. */
1216 };
1217 
1218 /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
1219 #ifndef __cplusplus
1220 static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
1221 	.protocol = RTE_BE16(0xffff),
1222 };
1223 #endif
1224 
1225 /**
1226  * RTE_FLOW_ITEM_TYPE_GRE_OPTION.
1227  *
1228  * Matches GRE optional fields in header.
1229  */
1230 struct rte_flow_item_gre_opt {
1231 	struct rte_gre_hdr_opt_checksum_rsvd checksum_rsvd;
1232 	struct rte_gre_hdr_opt_key key;
1233 	struct rte_gre_hdr_opt_sequence sequence;
1234 };
1235 
1236 /**
1237  * RTE_FLOW_ITEM_TYPE_MACSEC.
1238  *
1239  * Matches MACsec header.
1240  */
1241 struct rte_flow_item_macsec {
1242 	struct rte_macsec_hdr macsec_hdr;
1243 };
1244 
1245 /**
1246  * RTE_FLOW_ITEM_TYPE_FUZZY
1247  *
1248  * Fuzzy pattern match, expect faster than default.
1249  *
1250  * This is for device that support fuzzy match option.
1251  * Usually a fuzzy match is fast but the cost is accuracy.
1252  * i.e. Signature Match only match pattern's hash value, but it is
1253  * possible two different patterns have the same hash value.
1254  *
1255  * Matching accuracy level can be configure by threshold.
1256  * Driver can divide the range of threshold and map to different
1257  * accuracy levels that device support.
1258  *
1259  * Threshold 0 means perfect match (no fuzziness), while threshold
1260  * 0xffffffff means fuzziest match.
1261  */
1262 struct rte_flow_item_fuzzy {
1263 	uint32_t thresh; /**< Accuracy threshold. */
1264 };
1265 
1266 /** Default mask for RTE_FLOW_ITEM_TYPE_FUZZY. */
1267 #ifndef __cplusplus
1268 static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask = {
1269 	.thresh = 0xffffffff,
1270 };
1271 #endif
1272 
1273 /**
1274  * RTE_FLOW_ITEM_TYPE_GTP.
1275  *
1276  * Matches a GTPv1 header.
1277  */
1278 struct rte_flow_item_gtp {
1279 	union {
1280 		struct {
1281 			/*
1282 			 * These are old fields kept for compatibility.
1283 			 * Please prefer hdr field below.
1284 			 */
1285 			/**
1286 			 * Version (3b), protocol type (1b), reserved (1b),
1287 			 * Extension header flag (1b),
1288 			 * Sequence number flag (1b),
1289 			 * N-PDU number flag (1b).
1290 			 */
1291 			uint8_t v_pt_rsv_flags;
1292 			uint8_t msg_type; /**< Message type. */
1293 			rte_be16_t msg_len; /**< Message length. */
1294 			rte_be32_t teid; /**< Tunnel endpoint identifier. */
1295 		};
1296 		struct rte_gtp_hdr hdr; /**< GTP header definition. */
1297 	};
1298 };
1299 
1300 /** Default mask for RTE_FLOW_ITEM_TYPE_GTP. */
1301 #ifndef __cplusplus
1302 static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = {
1303 	.hdr.teid = RTE_BE32(UINT32_MAX),
1304 };
1305 #endif
1306 
1307 /**
1308  * RTE_FLOW_ITEM_TYPE_ESP
1309  *
1310  * Matches an ESP header.
1311  */
1312 struct rte_flow_item_esp {
1313 	struct rte_esp_hdr hdr; /**< ESP header definition. */
1314 };
1315 
1316 /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */
1317 #ifndef __cplusplus
1318 static const struct rte_flow_item_esp rte_flow_item_esp_mask = {
1319 	.hdr = {
1320 		.spi = RTE_BE32(0xffffffff),
1321 	},
1322 };
1323 #endif
1324 
1325 /**
1326  * RTE_FLOW_ITEM_TYPE_GENEVE.
1327  *
1328  * Matches a GENEVE header.
1329  */
1330 struct rte_flow_item_geneve {
1331 	/**
1332 	 * Version (2b), length of the options fields (6b), OAM packet (1b),
1333 	 * critical options present (1b), reserved 0 (6b).
1334 	 */
1335 	rte_be16_t ver_opt_len_o_c_rsvd0;
1336 	rte_be16_t protocol; /**< Protocol type. */
1337 	uint8_t vni[3]; /**< Virtual Network Identifier. */
1338 	uint8_t rsvd1; /**< Reserved, normally 0x00. */
1339 };
1340 
1341 /** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE. */
1342 #ifndef __cplusplus
1343 static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = {
1344 	.vni = "\xff\xff\xff",
1345 };
1346 #endif
1347 
1348 /**
1349  * RTE_FLOW_ITEM_TYPE_VXLAN_GPE (draft-ietf-nvo3-vxlan-gpe-05).
1350  *
1351  * Matches a VXLAN-GPE header.
1352  */
1353 struct rte_flow_item_vxlan_gpe {
1354 	union {
1355 		struct {
1356 			/*
1357 			 * These are old fields kept for compatibility.
1358 			 * Please prefer hdr field below.
1359 			 */
1360 			uint8_t flags; /**< Normally 0x0c (I and P flags). */
1361 			uint8_t rsvd0[2]; /**< Reserved, normally 0x0000. */
1362 			uint8_t protocol; /**< Protocol type. */
1363 			uint8_t vni[3]; /**< VXLAN identifier. */
1364 			uint8_t rsvd1; /**< Reserved, normally 0x00. */
1365 		};
1366 		struct rte_vxlan_gpe_hdr hdr;
1367 	};
1368 };
1369 
1370 /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */
1371 #ifndef __cplusplus
1372 static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = {
1373 	.hdr.vni = "\xff\xff\xff",
1374 };
1375 #endif
1376 
1377 /**
1378  * RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4
1379  *
1380  * Matches an ARP header for Ethernet/IPv4.
1381  */
1382 struct rte_flow_item_arp_eth_ipv4 {
1383 	union {
1384 		struct {
1385 			/*
1386 			 * These are old fields kept for compatibility.
1387 			 * Please prefer hdr field below.
1388 			 */
1389 			rte_be16_t hrd; /**< Hardware type, normally 1. */
1390 			rte_be16_t pro; /**< Protocol type, normally 0x0800. */
1391 			uint8_t hln; /**< Hardware address length, normally 6. */
1392 			uint8_t pln; /**< Protocol address length, normally 4. */
1393 			rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */
1394 			struct rte_ether_addr sha; /**< Sender hardware address. */
1395 			rte_be32_t spa; /**< Sender IPv4 address. */
1396 			struct rte_ether_addr tha; /**< Target hardware address. */
1397 			rte_be32_t tpa; /**< Target IPv4 address. */
1398 		};
1399 		struct rte_arp_hdr hdr; /**< ARP header definition. */
1400 	};
1401 };
1402 
1403 /** Default mask for RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4. */
1404 #ifndef __cplusplus
1405 static const struct rte_flow_item_arp_eth_ipv4
1406 rte_flow_item_arp_eth_ipv4_mask = {
1407 	.hdr.arp_data.arp_sha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1408 	.hdr.arp_data.arp_sip = RTE_BE32(UINT32_MAX),
1409 	.hdr.arp_data.arp_tha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1410 	.hdr.arp_data.arp_tip = RTE_BE32(UINT32_MAX),
1411 };
1412 #endif
1413 
1414 /**
1415  * RTE_FLOW_ITEM_TYPE_IPV6_EXT
1416  *
1417  * Matches the presence of any IPv6 extension header.
1418  *
1419  * Normally preceded by any of:
1420  *
1421  * - RTE_FLOW_ITEM_TYPE_IPV6
1422  * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
1423  */
1424 struct rte_flow_item_ipv6_ext {
1425 	uint8_t next_hdr; /**< Next header. */
1426 };
1427 
1428 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6_EXT. */
1429 #ifndef __cplusplus
1430 static const
1431 struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
1432 	.next_hdr = 0xff,
1433 };
1434 #endif
1435 
1436 /**
1437  * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
1438  *
1439  * Matches the presence of IPv6 fragment extension header.
1440  *
1441  * Preceded by any of:
1442  *
1443  * - RTE_FLOW_ITEM_TYPE_IPV6
1444  * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
1445  */
1446 struct rte_flow_item_ipv6_frag_ext {
1447 	struct rte_ipv6_fragment_ext hdr;
1448 };
1449 
1450 /**
1451  * RTE_FLOW_ITEM_TYPE_ICMP6
1452  *
1453  * Matches any ICMPv6 header.
1454  */
1455 struct rte_flow_item_icmp6 {
1456 	uint8_t type; /**< ICMPv6 type. */
1457 	uint8_t code; /**< ICMPv6 code. */
1458 	uint16_t checksum; /**< ICMPv6 checksum. */
1459 };
1460 
1461 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6. */
1462 #ifndef __cplusplus
1463 static const struct rte_flow_item_icmp6 rte_flow_item_icmp6_mask = {
1464 	.type = 0xff,
1465 	.code = 0xff,
1466 };
1467 #endif
1468 
1469 /**
1470  * RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
1471  * RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
1472  *
1473  * Matches an ICMPv6 echo request or reply.
1474  */
1475 struct rte_flow_item_icmp6_echo {
1476 	struct rte_icmp_echo_hdr hdr;
1477 };
1478 
1479 /**
1480  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1481  *
1482  * Matches an ICMPv6 neighbor discovery solicitation.
1483  */
1484 struct rte_flow_item_icmp6_nd_ns {
1485 	uint8_t type; /**< ICMPv6 type, normally 135. */
1486 	uint8_t code; /**< ICMPv6 code, normally 0. */
1487 	rte_be16_t checksum; /**< ICMPv6 checksum. */
1488 	rte_be32_t reserved; /**< Reserved, normally 0. */
1489 	uint8_t target_addr[16]; /**< Target address. */
1490 };
1491 
1492 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS. */
1493 #ifndef __cplusplus
1494 static const
1495 struct rte_flow_item_icmp6_nd_ns rte_flow_item_icmp6_nd_ns_mask = {
1496 	.target_addr =
1497 		"\xff\xff\xff\xff\xff\xff\xff\xff"
1498 		"\xff\xff\xff\xff\xff\xff\xff\xff",
1499 };
1500 #endif
1501 
1502 /**
1503  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1504  *
1505  * Matches an ICMPv6 neighbor discovery advertisement.
1506  */
1507 struct rte_flow_item_icmp6_nd_na {
1508 	uint8_t type; /**< ICMPv6 type, normally 136. */
1509 	uint8_t code; /**< ICMPv6 code, normally 0. */
1510 	rte_be16_t checksum; /**< ICMPv6 checksum. */
1511 	/**
1512 	 * Route flag (1b), solicited flag (1b), override flag (1b),
1513 	 * reserved (29b).
1514 	 */
1515 	rte_be32_t rso_reserved;
1516 	uint8_t target_addr[16]; /**< Target address. */
1517 };
1518 
1519 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA. */
1520 #ifndef __cplusplus
1521 static const
1522 struct rte_flow_item_icmp6_nd_na rte_flow_item_icmp6_nd_na_mask = {
1523 	.target_addr =
1524 		"\xff\xff\xff\xff\xff\xff\xff\xff"
1525 		"\xff\xff\xff\xff\xff\xff\xff\xff",
1526 };
1527 #endif
1528 
1529 /**
1530  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1531  *
1532  * Matches the presence of any ICMPv6 neighbor discovery option.
1533  *
1534  * Normally preceded by any of:
1535  *
1536  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1537  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1538  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1539  */
1540 struct rte_flow_item_icmp6_nd_opt {
1541 	uint8_t type; /**< ND option type. */
1542 	uint8_t length; /**< ND option length. */
1543 };
1544 
1545 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT. */
1546 #ifndef __cplusplus
1547 static const struct rte_flow_item_icmp6_nd_opt
1548 rte_flow_item_icmp6_nd_opt_mask = {
1549 	.type = 0xff,
1550 };
1551 #endif
1552 
1553 /**
1554  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH
1555  *
1556  * Matches an ICMPv6 neighbor discovery source Ethernet link-layer address
1557  * option.
1558  *
1559  * Normally preceded by any of:
1560  *
1561  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1562  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1563  */
1564 struct rte_flow_item_icmp6_nd_opt_sla_eth {
1565 	uint8_t type; /**< ND option type, normally 1. */
1566 	uint8_t length; /**< ND option length, normally 1. */
1567 	struct rte_ether_addr sla; /**< Source Ethernet LLA. */
1568 };
1569 
1570 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */
1571 #ifndef __cplusplus
1572 static const struct rte_flow_item_icmp6_nd_opt_sla_eth
1573 rte_flow_item_icmp6_nd_opt_sla_eth_mask = {
1574 	.sla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1575 };
1576 #endif
1577 
1578 /**
1579  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH
1580  *
1581  * Matches an ICMPv6 neighbor discovery target Ethernet link-layer address
1582  * option.
1583  *
1584  * Normally preceded by any of:
1585  *
1586  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1587  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1588  */
1589 struct rte_flow_item_icmp6_nd_opt_tla_eth {
1590 	uint8_t type; /**< ND option type, normally 2. */
1591 	uint8_t length; /**< ND option length, normally 1. */
1592 	struct rte_ether_addr tla; /**< Target Ethernet LLA. */
1593 };
1594 
1595 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */
1596 #ifndef __cplusplus
1597 static const struct rte_flow_item_icmp6_nd_opt_tla_eth
1598 rte_flow_item_icmp6_nd_opt_tla_eth_mask = {
1599 	.tla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1600 };
1601 #endif
1602 
1603 /**
1604  * RTE_FLOW_ITEM_TYPE_META
1605  *
1606  * Matches a specified metadata value. On egress, metadata can be set
1607  * either by mbuf dynamic metadata field with RTE_MBUF_DYNFLAG_TX_METADATA flag
1608  * or RTE_FLOW_ACTION_TYPE_SET_META. On ingress, RTE_FLOW_ACTION_TYPE_SET_META
1609  * sets metadata for a packet and the metadata will be reported via mbuf
1610  * metadata dynamic field with RTE_MBUF_DYNFLAG_RX_METADATA flag. The dynamic
1611  * mbuf field must be registered in advance by
1612  * rte_flow_dynf_metadata_register().
1613  */
1614 struct rte_flow_item_meta {
1615 	uint32_t data;
1616 };
1617 
1618 /** Default mask for RTE_FLOW_ITEM_TYPE_META. */
1619 #ifndef __cplusplus
1620 static const struct rte_flow_item_meta rte_flow_item_meta_mask = {
1621 	.data = UINT32_MAX,
1622 };
1623 #endif
1624 
1625 /**
1626  * RTE_FLOW_ITEM_TYPE_GTP_PSC.
1627  *
1628  * Matches a GTP PDU extension header with type 0x85.
1629  */
1630 struct rte_flow_item_gtp_psc {
1631 	struct rte_gtp_psc_generic_hdr hdr; /**< gtp psc generic hdr. */
1632 };
1633 
1634 /** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */
1635 #ifndef __cplusplus
1636 static const struct rte_flow_item_gtp_psc
1637 rte_flow_item_gtp_psc_mask = {
1638 	.hdr.qfi = 0x3f,
1639 };
1640 #endif
1641 
1642 /**
1643  * RTE_FLOW_ITEM_TYPE_PPPOE.
1644  *
1645  * Matches a PPPoE header.
1646  */
1647 struct rte_flow_item_pppoe {
1648 	/**
1649 	 * Version (4b), type (4b).
1650 	 */
1651 	uint8_t version_type;
1652 	uint8_t code; /**< Message type. */
1653 	rte_be16_t session_id; /**< Session identifier. */
1654 	rte_be16_t length; /**< Payload length. */
1655 };
1656 
1657 /**
1658  * RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID.
1659  *
1660  * Matches a PPPoE optional proto_id field.
1661  *
1662  * It only applies to PPPoE session packets.
1663  *
1664  * Normally preceded by any of:
1665  *
1666  * - RTE_FLOW_ITEM_TYPE_PPPOE
1667  * - RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID
1668  */
1669 struct rte_flow_item_pppoe_proto_id {
1670 	rte_be16_t proto_id; /**< PPP protocol identifier. */
1671 };
1672 
1673 /** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID. */
1674 #ifndef __cplusplus
1675 static const struct rte_flow_item_pppoe_proto_id
1676 rte_flow_item_pppoe_proto_id_mask = {
1677 	.proto_id = RTE_BE16(0xffff),
1678 };
1679 #endif
1680 
1681 /**
1682  * @warning
1683  * @b EXPERIMENTAL: this structure may change without prior notice
1684  *
1685  * RTE_FLOW_ITEM_TYPE_TAG
1686  *
1687  * Matches a specified tag value at the specified index.
1688  */
1689 struct rte_flow_item_tag {
1690 	uint32_t data;
1691 	uint8_t index;
1692 };
1693 
1694 /** Default mask for RTE_FLOW_ITEM_TYPE_TAG. */
1695 #ifndef __cplusplus
1696 static const struct rte_flow_item_tag rte_flow_item_tag_mask = {
1697 	.data = 0xffffffff,
1698 	.index = 0xff,
1699 };
1700 #endif
1701 
1702 /**
1703  * RTE_FLOW_ITEM_TYPE_L2TPV3OIP.
1704  *
1705  * Matches a L2TPv3 over IP header.
1706  */
1707 struct rte_flow_item_l2tpv3oip {
1708 	rte_be32_t session_id; /**< Session ID. */
1709 };
1710 
1711 /** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV3OIP. */
1712 #ifndef __cplusplus
1713 static const struct rte_flow_item_l2tpv3oip rte_flow_item_l2tpv3oip_mask = {
1714 	.session_id = RTE_BE32(UINT32_MAX),
1715 };
1716 #endif
1717 
1718 
1719 /**
1720  * @warning
1721  * @b EXPERIMENTAL: this structure may change without prior notice
1722  *
1723  * RTE_FLOW_ITEM_TYPE_MARK
1724  *
1725  * Matches an arbitrary integer value which was set using the ``MARK`` action
1726  * in a previously matched rule.
1727  *
1728  * This item can only be specified once as a match criteria as the ``MARK``
1729  * action can only be specified once in a flow action.
1730  *
1731  * This value is arbitrary and application-defined. Maximum allowed value
1732  * depends on the underlying implementation.
1733  *
1734  * Depending on the underlying implementation the MARK item may be supported on
1735  * the physical device, with virtual groups in the PMD or not at all.
1736  */
1737 struct rte_flow_item_mark {
1738 	uint32_t id; /**< Integer value to match against. */
1739 };
1740 
1741 /** Default mask for RTE_FLOW_ITEM_TYPE_MARK. */
1742 #ifndef __cplusplus
1743 static const struct rte_flow_item_mark rte_flow_item_mark_mask = {
1744 	.id = 0xffffffff,
1745 };
1746 #endif
1747 
1748 /**
1749  * @warning
1750  * @b EXPERIMENTAL: this structure may change without prior notice
1751  *
1752  * RTE_FLOW_ITEM_TYPE_NSH
1753  *
1754  * Match network service header (NSH), RFC 8300
1755  */
1756 struct rte_flow_item_nsh {
1757 	uint32_t version:2;
1758 	uint32_t oam_pkt:1;
1759 	uint32_t reserved:1;
1760 	uint32_t ttl:6;
1761 	uint32_t length:6;
1762 	uint32_t reserved1:4;
1763 	uint32_t mdtype:4;
1764 	uint32_t next_proto:8;
1765 	uint32_t spi:24;
1766 	uint32_t sindex:8;
1767 };
1768 
1769 /** Default mask for RTE_FLOW_ITEM_TYPE_NSH. */
1770 #ifndef __cplusplus
1771 static const struct rte_flow_item_nsh rte_flow_item_nsh_mask = {
1772 	.mdtype = 0xf,
1773 	.next_proto = 0xff,
1774 	.spi = 0xffffff,
1775 	.sindex = 0xff,
1776 };
1777 #endif
1778 
1779 /**
1780  * @warning
1781  * @b EXPERIMENTAL: this structure may change without prior notice
1782  *
1783  * RTE_FLOW_ITEM_TYPE_IGMP
1784  *
1785  * Match Internet Group Management Protocol (IGMP), RFC 2236
1786  */
1787 struct rte_flow_item_igmp {
1788 	uint32_t type:8;
1789 	uint32_t max_resp_time:8;
1790 	uint32_t checksum:16;
1791 	uint32_t group_addr;
1792 };
1793 
1794 /** Default mask for RTE_FLOW_ITEM_TYPE_IGMP. */
1795 #ifndef __cplusplus
1796 static const struct rte_flow_item_igmp rte_flow_item_igmp_mask = {
1797 	.group_addr = 0xffffffff,
1798 };
1799 #endif
1800 
1801 /**
1802  * @warning
1803  * @b EXPERIMENTAL: this structure may change without prior notice
1804  *
1805  * RTE_FLOW_ITEM_TYPE_AH
1806  *
1807  * Match IP Authentication Header (AH), RFC 4302
1808  */
1809 struct rte_flow_item_ah {
1810 	uint32_t next_hdr:8;
1811 	uint32_t payload_len:8;
1812 	uint32_t reserved:16;
1813 	uint32_t spi;
1814 	uint32_t seq_num;
1815 };
1816 
1817 /** Default mask for RTE_FLOW_ITEM_TYPE_AH. */
1818 #ifndef __cplusplus
1819 static const struct rte_flow_item_ah rte_flow_item_ah_mask = {
1820 	.spi = 0xffffffff,
1821 };
1822 #endif
1823 
1824 /**
1825  * @warning
1826  * @b EXPERIMENTAL: this structure may change without prior notice
1827  *
1828  * RTE_FLOW_ITEM_TYPE_PFCP
1829  *
1830  * Match PFCP Header
1831  */
1832 struct rte_flow_item_pfcp {
1833 	uint8_t s_field;
1834 	uint8_t msg_type;
1835 	rte_be16_t msg_len;
1836 	rte_be64_t seid;
1837 };
1838 
1839 /** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */
1840 #ifndef __cplusplus
1841 static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
1842 	.s_field = 0x01,
1843 	.seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
1844 };
1845 #endif
1846 
1847 /**
1848  * @warning
1849  * @b EXPERIMENTAL: this structure may change without prior notice
1850  *
1851  * RTE_FLOW_ITEM_TYPE_ECPRI
1852  *
1853  * Match eCPRI Header
1854  */
1855 struct rte_flow_item_ecpri {
1856 	struct rte_ecpri_combined_msg_hdr hdr;
1857 };
1858 
1859 /** Default mask for RTE_FLOW_ITEM_TYPE_ECPRI. */
1860 #ifndef __cplusplus
1861 static const struct rte_flow_item_ecpri rte_flow_item_ecpri_mask = {
1862 	.hdr = {
1863 		.common = {
1864 			.u32 = 0x0,
1865 		},
1866 	},
1867 };
1868 #endif
1869 
1870 /**
1871  * RTE_FLOW_ITEM_TYPE_GENEVE_OPT
1872  *
1873  * Matches a GENEVE Variable Length Option
1874  */
1875 struct rte_flow_item_geneve_opt {
1876 	rte_be16_t option_class;
1877 	uint8_t option_type;
1878 	uint8_t option_len;
1879 	uint32_t *data;
1880 };
1881 
1882 /** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE_OPT. */
1883 #ifndef __cplusplus
1884 static const struct rte_flow_item_geneve_opt
1885 rte_flow_item_geneve_opt_mask = {
1886 	.option_type = 0xff,
1887 };
1888 #endif
1889 
1890 /**
1891  * @warning
1892  * @b EXPERIMENTAL: this structure may change without prior notice
1893  *
1894  * RTE_FLOW_ITEM_TYPE_INTEGRITY
1895  *
1896  * Match on packet integrity check result.
1897  */
1898 struct rte_flow_item_integrity {
1899 	/** Tunnel encapsulation level the item should apply to.
1900 	 * @see rte_flow_action_rss
1901 	 */
1902 	uint32_t level;
1903 	union {
1904 		__extension__
1905 		struct {
1906 			/** The packet is valid after passing all HW checks. */
1907 			uint64_t packet_ok:1;
1908 			/** L2 layer is valid after passing all HW checks. */
1909 			uint64_t l2_ok:1;
1910 			/** L3 layer is valid after passing all HW checks. */
1911 			uint64_t l3_ok:1;
1912 			/** L4 layer is valid after passing all HW checks. */
1913 			uint64_t l4_ok:1;
1914 			/** L2 layer CRC is valid. */
1915 			uint64_t l2_crc_ok:1;
1916 			/** IPv4 layer checksum is valid. */
1917 			uint64_t ipv4_csum_ok:1;
1918 			/** L4 layer checksum is valid. */
1919 			uint64_t l4_csum_ok:1;
1920 			/** L3 length is smaller than frame length. */
1921 			uint64_t l3_len_ok:1;
1922 			uint64_t reserved:56;
1923 		};
1924 		uint64_t value;
1925 	};
1926 };
1927 
1928 #ifndef __cplusplus
1929 static const struct rte_flow_item_integrity
1930 rte_flow_item_integrity_mask = {
1931 	.level = 0,
1932 	.value = 0,
1933 };
1934 #endif
1935 
1936 /**
1937  * The packet is valid after conntrack checking.
1938  */
1939 #define RTE_FLOW_CONNTRACK_PKT_STATE_VALID RTE_BIT32(0)
1940 /**
1941  * The state of the connection is changed.
1942  */
1943 #define RTE_FLOW_CONNTRACK_PKT_STATE_CHANGED RTE_BIT32(1)
1944 /**
1945  * Error is detected on this packet for this connection and
1946  * an invalid state is set.
1947  */
1948 #define RTE_FLOW_CONNTRACK_PKT_STATE_INVALID RTE_BIT32(2)
1949 /**
1950  * The HW connection tracking module is disabled.
1951  * It can be due to application command or an invalid state.
1952  */
1953 #define RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED RTE_BIT32(3)
1954 /**
1955  * The packet contains some bad field(s) and cannot continue
1956  * with the conntrack module checking.
1957  */
1958 #define RTE_FLOW_CONNTRACK_PKT_STATE_BAD RTE_BIT32(4)
1959 
1960 /**
1961  * @warning
1962  * @b EXPERIMENTAL: this structure may change without prior notice
1963  *
1964  * RTE_FLOW_ITEM_TYPE_CONNTRACK
1965  *
1966  * Matches the state of a packet after it passed the connection tracking
1967  * examination. The state is a bitmap of one RTE_FLOW_CONNTRACK_PKT_STATE*
1968  * or a reasonable combination of these bits.
1969  */
1970 struct rte_flow_item_conntrack {
1971 	uint32_t flags;
1972 };
1973 
1974 /** Default mask for RTE_FLOW_ITEM_TYPE_CONNTRACK. */
1975 #ifndef __cplusplus
1976 static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask = {
1977 	.flags = 0xffffffff,
1978 };
1979 #endif
1980 
1981 /**
1982  * Provides an ethdev port ID for use with the following items:
1983  * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
1984  * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT.
1985  */
1986 struct rte_flow_item_ethdev {
1987 	uint16_t port_id; /**< ethdev port ID */
1988 };
1989 
1990 /** Default mask for items based on struct rte_flow_item_ethdev */
1991 #ifndef __cplusplus
1992 static const struct rte_flow_item_ethdev rte_flow_item_ethdev_mask = {
1993 	.port_id = 0xffff,
1994 };
1995 #endif
1996 
1997 /**
1998  * @warning
1999  * @b EXPERIMENTAL: this structure may change without prior notice
2000  *
2001  * RTE_FLOW_ITEM_TYPE_L2TPV2
2002  *
2003  * Matches L2TPv2 Header
2004  */
2005 struct rte_flow_item_l2tpv2 {
2006 	struct rte_l2tpv2_combined_msg_hdr hdr;
2007 };
2008 
2009 /** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV2. */
2010 #ifndef __cplusplus
2011 static const struct rte_flow_item_l2tpv2 rte_flow_item_l2tpv2_mask = {
2012 	/*
2013 	 * flags and version bit mask
2014 	 * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
2015 	 * T L x x S x O P x x x x V V V V
2016 	 */
2017 	.hdr = {
2018 		.common = {
2019 			.flags_version = RTE_BE16(0xcb0f),
2020 		},
2021 	},
2022 };
2023 #endif
2024 
2025 /**
2026  * @warning
2027  * @b EXPERIMENTAL: this structure may change without prior notice
2028  *
2029  * RTE_FLOW_ITEM_TYPE_PPP
2030  *
2031  * Matches PPP Header
2032  */
2033 struct rte_flow_item_ppp {
2034 	struct rte_ppp_hdr hdr;
2035 };
2036 
2037 /** Default mask for RTE_FLOW_ITEM_TYPE_PPP. */
2038 #ifndef __cplusplus
2039 static const struct rte_flow_item_ppp rte_flow_item_ppp_mask = {
2040 	.hdr = {
2041 		.addr = 0xff,
2042 		.ctrl = 0xff,
2043 		.proto_id = RTE_BE16(0xffff),
2044 	}
2045 };
2046 #endif
2047 
2048 /**
2049  * RTE_FLOW_ITEM_TYPE_IB_BTH.
2050  *
2051  * Matches an InfiniBand base transport header in RoCE packet.
2052  */
2053 struct rte_flow_item_ib_bth {
2054 	struct rte_ib_bth hdr; /**< InfiniBand base transport header definition. */
2055 };
2056 
2057 /** Default mask for RTE_FLOW_ITEM_TYPE_IB_BTH. */
2058 #ifndef __cplusplus
2059 static const struct rte_flow_item_ib_bth rte_flow_item_ib_bth_mask = {
2060 	.hdr = {
2061 		.opcode = 0xff,
2062 		.dst_qp = "\xff\xff\xff",
2063 	},
2064 };
2065 #endif
2066 
2067 /**
2068  * @warning
2069  * @b EXPERIMENTAL: this structure may change without prior notice.
2070  *
2071  * RTE_FLOW_ITEM_TYPE_RANDOM
2072  *
2073  * Matches a random value.
2074  */
2075 struct rte_flow_item_random {
2076 	uint32_t value;
2077 };
2078 
2079 /** Default mask for RTE_FLOW_ITEM_TYPE_RANDOM. */
2080 #ifndef __cplusplus
2081 static const struct rte_flow_item_random rte_flow_item_random_mask = {
2082 	.value = UINT32_MAX,
2083 };
2084 #endif
2085 
2086 /**
2087  * Matching pattern item definition.
2088  *
2089  * A pattern is formed by stacking items starting from the lowest protocol
2090  * layer to match. This stacking restriction does not apply to meta items
2091  * which can be placed anywhere in the stack without affecting the meaning
2092  * of the resulting pattern.
2093  *
2094  * Patterns are terminated by END items.
2095  *
2096  * The spec field should be a valid pointer to a structure of the related
2097  * item type. It may remain unspecified (NULL) in many cases to request
2098  * broad (nonspecific) matching. In such cases, last and mask must also be
2099  * set to NULL.
2100  *
2101  * Optionally, last can point to a structure of the same type to define an
2102  * inclusive range. This is mostly supported by integer and address fields,
2103  * may cause errors otherwise. Fields that do not support ranges must be set
2104  * to 0 or to the same value as the corresponding fields in spec.
2105  *
2106  * Only the fields defined to nonzero values in the default masks (see
2107  * rte_flow_item_{name}_mask constants) are considered relevant by
2108  * default. This can be overridden by providing a mask structure of the
2109  * same type with applicable bits set to one. It can also be used to
2110  * partially filter out specific fields (e.g. as an alternate mean to match
2111  * ranges of IP addresses).
2112  *
2113  * Mask is a simple bit-mask applied before interpreting the contents of
2114  * spec and last, which may yield unexpected results if not used
2115  * carefully. For example, if for an IPv4 address field, spec provides
2116  * 10.1.2.3, last provides 10.3.4.5 and mask provides 255.255.0.0, the
2117  * effective range becomes 10.1.0.0 to 10.3.255.255.
2118  */
2119 struct rte_flow_item {
2120 	enum rte_flow_item_type type; /**< Item type. */
2121 	const void *spec; /**< Pointer to item specification structure. */
2122 	const void *last; /**< Defines an inclusive range (spec to last). */
2123 	const void *mask; /**< Bit-mask applied to spec and last. */
2124 };
2125 
2126 /**
2127  * @warning
2128  * @b EXPERIMENTAL: this structure may change without prior notice
2129  *
2130  * RTE_FLOW_ITEM_TYPE_FLEX
2131  *
2132  * Matches a specified set of fields within the network protocol
2133  * header. Each field is presented as set of bits with specified width, and
2134  * bit offset from the header beginning.
2135  *
2136  * The pattern is concatenation of bit fields configured at item creation
2137  * by rte_flow_flex_item_create(). At configuration the fields are presented
2138  * by sample_data array.
2139  *
2140  * This type does not support ranges (struct rte_flow_item.last).
2141  */
2142 struct rte_flow_item_flex {
2143 	struct rte_flow_item_flex_handle *handle; /**< Opaque item handle. */
2144 	uint32_t length; /**< Pattern length in bytes. */
2145 	const uint8_t *pattern; /**< Combined bitfields pattern to match. */
2146 };
2147 /**
2148  * Field bit offset calculation mode.
2149  */
2150 enum rte_flow_item_flex_field_mode {
2151 	/**
2152 	 * Dummy field, used for byte boundary alignment in pattern.
2153 	 * Pattern mask and data are ignored in the match. All configuration
2154 	 * parameters besides field size are ignored.
2155 	 */
2156 	FIELD_MODE_DUMMY = 0,
2157 	/**
2158 	 * Fixed offset field. The bit offset from header beginning
2159 	 * is permanent and defined by field_base parameter.
2160 	 */
2161 	FIELD_MODE_FIXED,
2162 	/**
2163 	 * The field bit offset is extracted from other header field (indirect
2164 	 * offset field). The resulting field offset to match is calculated as:
2165 	 *
2166 	 *    field_base + (*offset_base & offset_mask) << offset_shift
2167 	 */
2168 	FIELD_MODE_OFFSET,
2169 	/**
2170 	 * The field bit offset is extracted from other header field (indirect
2171 	 * offset field), the latter is considered as bitmask containing some
2172 	 * number of one bits, the resulting field offset to match is
2173 	 * calculated as:
2174 	 *
2175 	 *    field_base + bitcount(*offset_base & offset_mask) << offset_shift
2176 	 */
2177 	FIELD_MODE_BITMASK,
2178 };
2179 
2180 /**
2181  * Flex item field tunnel mode
2182  */
2183 enum rte_flow_item_flex_tunnel_mode {
2184 	/**
2185 	 * The protocol header can be present in the packet only once.
2186 	 * No multiple flex item flow inclusions (for inner/outer) are allowed.
2187 	 * No any relations with tunnel protocols are imposed. The drivers
2188 	 * can optimize hardware resource usage to handle match on single flex
2189 	 * item of specific type.
2190 	 */
2191 	FLEX_TUNNEL_MODE_SINGLE = 0,
2192 	/**
2193 	 * Flex item presents outer header only.
2194 	 */
2195 	FLEX_TUNNEL_MODE_OUTER,
2196 	/**
2197 	 * Flex item presents inner header only.
2198 	 */
2199 	FLEX_TUNNEL_MODE_INNER,
2200 	/**
2201 	 * Flex item presents either inner or outer header. The driver
2202 	 * handles as many multiple inners as hardware supports.
2203 	 */
2204 	FLEX_TUNNEL_MODE_MULTI,
2205 	/**
2206 	 * Flex item presents tunnel protocol header.
2207 	 */
2208 	FLEX_TUNNEL_MODE_TUNNEL,
2209 };
2210 
2211 /**
2212  *
2213  * @warning
2214  * @b EXPERIMENTAL: this structure may change without prior notice
2215  */
2216 __extension__
2217 struct rte_flow_item_flex_field {
2218 	/** Defines how match field offset is calculated over the packet. */
2219 	enum rte_flow_item_flex_field_mode field_mode;
2220 	uint32_t field_size; /**< Field size in bits. */
2221 	int32_t field_base; /**< Field offset in bits. */
2222 	uint32_t offset_base; /**< Indirect offset field offset in bits. */
2223 	uint32_t offset_mask; /**< Indirect offset field bit mask. */
2224 	int32_t offset_shift; /**< Indirect offset multiply factor. */
2225 	uint32_t field_id:16; /**< Device hint, for multiple items in flow. */
2226 	uint32_t reserved:16; /**< Reserved field. */
2227 };
2228 
2229 /**
2230  * @warning
2231  * @b EXPERIMENTAL: this structure may change without prior notice
2232  */
2233 struct rte_flow_item_flex_link {
2234 	/**
2235 	 * Preceding/following header. The item type must be always provided.
2236 	 * For preceding one item must specify the header value/mask to match
2237 	 * for the link be taken and start the flex item header parsing.
2238 	 */
2239 	struct rte_flow_item item;
2240 	/**
2241 	 * Next field value to match to continue with one of the configured
2242 	 * next protocols.
2243 	 */
2244 	uint32_t next;
2245 };
2246 
2247 /**
2248  * @warning
2249  * @b EXPERIMENTAL: this structure may change without prior notice
2250  */
2251 struct rte_flow_item_flex_conf {
2252 	/**
2253 	 * Specifies the flex item and tunnel relations and tells the PMD
2254 	 * whether flex item can be used for inner, outer or both headers,
2255 	 * or whether flex item presents the tunnel protocol itself.
2256 	 */
2257 	enum rte_flow_item_flex_tunnel_mode tunnel;
2258 	/**
2259 	 * The next header offset, it presents the network header size covered
2260 	 * by the flex item and can be obtained with all supported offset
2261 	 * calculating methods (fixed, dedicated field, bitmask, etc).
2262 	 */
2263 	struct rte_flow_item_flex_field next_header;
2264 	/**
2265 	 * Specifies the next protocol field to match with link next protocol
2266 	 * values and continue packet parsing with matching link.
2267 	 */
2268 	struct rte_flow_item_flex_field next_protocol;
2269 	/**
2270 	 * The fields will be sampled and presented for explicit match
2271 	 * with pattern in the rte_flow_flex_item. There can be multiple
2272 	 * fields descriptors, the number should be specified by nb_samples.
2273 	 */
2274 	struct rte_flow_item_flex_field *sample_data;
2275 	/** Number of field descriptors in the sample_data array. */
2276 	uint32_t nb_samples;
2277 	/**
2278 	 * Input link defines the flex item relation with preceding
2279 	 * header. It specified the preceding item type and provides pattern
2280 	 * to match. The flex item will continue parsing and will provide the
2281 	 * data to flow match in case if there is the match with one of input
2282 	 * links.
2283 	 */
2284 	struct rte_flow_item_flex_link *input_link;
2285 	/** Number of link descriptors in the input link array. */
2286 	uint32_t nb_inputs;
2287 	/**
2288 	 * Output link defines the next protocol field value to match and
2289 	 * the following protocol header to continue packet parsing. Also
2290 	 * defines the tunnel-related behaviour.
2291 	 */
2292 	struct rte_flow_item_flex_link *output_link;
2293 	/** Number of link descriptors in the output link array. */
2294 	uint32_t nb_outputs;
2295 };
2296 
2297 /**
2298  * RTE_FLOW_ITEM_TYPE_METER_COLOR.
2299  *
2300  * Matches Color Marker set by a Meter.
2301  */
2302 struct rte_flow_item_meter_color {
2303 	enum rte_color color; /**< Meter color marker. */
2304 };
2305 
2306 /** Default mask for RTE_FLOW_ITEM_TYPE_METER_COLOR. */
2307 #ifndef __cplusplus
2308 static const struct rte_flow_item_meter_color rte_flow_item_meter_color_mask = {
2309 	.color = RTE_COLORS,
2310 };
2311 #endif
2312 
2313 /**
2314  * @warning
2315  * @b EXPERIMENTAL: this structure may change without prior notice
2316  *
2317  * RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY
2318  *
2319  * For multiple ports aggregated to a single DPDK port,
2320  * match the aggregated port receiving the packets.
2321  */
2322 struct rte_flow_item_aggr_affinity {
2323 	/**
2324 	 * An aggregated port receiving the packets.
2325 	 * Numbering starts from 1.
2326 	 * Number of aggregated ports is reported by rte_eth_dev_count_aggr_ports().
2327 	 */
2328 	uint8_t affinity;
2329 };
2330 
2331 /** Default mask for RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY. */
2332 #ifndef __cplusplus
2333 static const struct rte_flow_item_aggr_affinity
2334 rte_flow_item_aggr_affinity_mask = {
2335 	.affinity = 0xff,
2336 };
2337 #endif
2338 
2339 /**
2340  * RTE_FLOW_ITEM_TYPE_TX_QUEUE
2341  *
2342  * Tx queue number.
2343  *
2344  * @see struct rte_flow_item_tx_queue
2345  */
2346 struct rte_flow_item_tx_queue {
2347 	/** Tx queue number of packet being transmitted. */
2348 	uint16_t tx_queue;
2349 };
2350 
2351 /** Default mask for RTE_FLOW_ITEM_TX_QUEUE. */
2352 #ifndef __cplusplus
2353 static const struct rte_flow_item_tx_queue rte_flow_item_tx_queue_mask = {
2354 	.tx_queue = 0xffff,
2355 };
2356 #endif
2357 
2358 /**
2359  *
2360  * RTE_FLOW_ITEM_TYPE_PTYPE
2361  *
2362  * Matches the packet type as defined in rte_mbuf_ptype.
2363  */
2364 struct rte_flow_item_ptype {
2365 	uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
2366 };
2367 
2368 /** Default mask for RTE_FLOW_ITEM_TYPE_PTYPE. */
2369 #ifndef __cplusplus
2370 static const struct rte_flow_item_ptype rte_flow_item_ptype_mask = {
2371 	.packet_type = 0xffffffff,
2372 };
2373 #endif
2374 
2375 /**
2376  * Packet header field IDs, used by RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2377  * and RTE_FLOW_ITEM_TYPE_COMPARE.
2378  */
2379 enum rte_flow_field_id {
2380 	RTE_FLOW_FIELD_START = 0,       /**< Start of a packet. */
2381 	RTE_FLOW_FIELD_MAC_DST,         /**< Destination MAC Address. */
2382 	RTE_FLOW_FIELD_MAC_SRC,         /**< Source MAC Address. */
2383 	RTE_FLOW_FIELD_VLAN_TYPE,       /**< VLAN Tag Identifier. */
2384 	RTE_FLOW_FIELD_VLAN_ID,         /**< VLAN Identifier. */
2385 	RTE_FLOW_FIELD_MAC_TYPE,        /**< EtherType. */
2386 	RTE_FLOW_FIELD_IPV4_DSCP,       /**< IPv4 DSCP. */
2387 	RTE_FLOW_FIELD_IPV4_TTL,        /**< IPv4 Time To Live. */
2388 	RTE_FLOW_FIELD_IPV4_SRC,        /**< IPv4 Source Address. */
2389 	RTE_FLOW_FIELD_IPV4_DST,        /**< IPv4 Destination Address. */
2390 	RTE_FLOW_FIELD_IPV6_DSCP,       /**< IPv6 DSCP. */
2391 	RTE_FLOW_FIELD_IPV6_HOPLIMIT,   /**< IPv6 Hop Limit. */
2392 	RTE_FLOW_FIELD_IPV6_SRC,        /**< IPv6 Source Address. */
2393 	RTE_FLOW_FIELD_IPV6_DST,        /**< IPv6 Destination Address. */
2394 	RTE_FLOW_FIELD_TCP_PORT_SRC,    /**< TCP Source Port Number. */
2395 	RTE_FLOW_FIELD_TCP_PORT_DST,    /**< TCP Destination Port Number. */
2396 	RTE_FLOW_FIELD_TCP_SEQ_NUM,     /**< TCP Sequence Number. */
2397 	RTE_FLOW_FIELD_TCP_ACK_NUM,     /**< TCP Acknowledgment Number. */
2398 	RTE_FLOW_FIELD_TCP_FLAGS,       /**< TCP Flags. */
2399 	RTE_FLOW_FIELD_UDP_PORT_SRC,    /**< UDP Source Port Number. */
2400 	RTE_FLOW_FIELD_UDP_PORT_DST,    /**< UDP Destination Port Number. */
2401 	RTE_FLOW_FIELD_VXLAN_VNI,       /**< VXLAN Network Identifier. */
2402 	RTE_FLOW_FIELD_GENEVE_VNI,      /**< GENEVE Network Identifier. */
2403 	RTE_FLOW_FIELD_GTP_TEID,        /**< GTP Tunnel Endpoint Identifier. */
2404 	RTE_FLOW_FIELD_TAG,             /**< Tag value. */
2405 	RTE_FLOW_FIELD_MARK,            /**< Mark value. */
2406 	RTE_FLOW_FIELD_META,            /**< Metadata value. */
2407 	RTE_FLOW_FIELD_POINTER,         /**< Memory pointer. */
2408 	RTE_FLOW_FIELD_VALUE,           /**< Immediate value. */
2409 	RTE_FLOW_FIELD_IPV4_ECN,        /**< IPv4 ECN. */
2410 	RTE_FLOW_FIELD_IPV6_ECN,        /**< IPv6 ECN. */
2411 	RTE_FLOW_FIELD_GTP_PSC_QFI,     /**< GTP QFI. */
2412 	RTE_FLOW_FIELD_METER_COLOR,     /**< Meter color marker. */
2413 	RTE_FLOW_FIELD_IPV6_PROTO,      /**< IPv6 next header. */
2414 	RTE_FLOW_FIELD_FLEX_ITEM,       /**< Flex item. */
2415 	RTE_FLOW_FIELD_HASH_RESULT,     /**< Hash result. */
2416 	RTE_FLOW_FIELD_GENEVE_OPT_TYPE, /**< GENEVE option type. */
2417 	RTE_FLOW_FIELD_GENEVE_OPT_CLASS,/**< GENEVE option class. */
2418 	RTE_FLOW_FIELD_GENEVE_OPT_DATA, /**< GENEVE option data. */
2419 	RTE_FLOW_FIELD_MPLS,            /**< MPLS header. */
2420 	RTE_FLOW_FIELD_TCP_DATA_OFFSET, /**< TCP data offset. */
2421 	RTE_FLOW_FIELD_IPV4_IHL,        /**< IPv4 IHL. */
2422 	RTE_FLOW_FIELD_IPV4_TOTAL_LEN,  /**< IPv4 total length. */
2423 	RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN,/**< IPv6 payload length. */
2424 	RTE_FLOW_FIELD_RANDOM,          /**< Random value. */
2425 };
2426 
2427 /**
2428  * @warning
2429  * @b EXPERIMENTAL: this structure may change without prior notice.
2430  *
2431  * Packet header field descriptions, used by RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2432  * and RTE_FLOW_ITEM_TYPE_COMPARE.
2433  */
2434 struct rte_flow_field_data {
2435 	enum rte_flow_field_id field; /**< Field or memory type ID. */
2436 	union {
2437 		struct {
2438 			/** Encapsulation level and tag index or flex item handle. */
2439 			union {
2440 				struct {
2441 					/**
2442 					 * Packet encapsulation level containing
2443 					 * the field to modify.
2444 					 *
2445 					 * - @p 0 requests the default behavior.
2446 					 *   Depending on the packet type, it
2447 					 *   can mean outermost, innermost or
2448 					 *   anything in between.
2449 					 *
2450 					 *   It basically stands for the
2451 					 *   innermost encapsulation level.
2452 					 *   Modification can be performed
2453 					 *   according to PMD and device
2454 					 *   capabilities.
2455 					 *
2456 					 * - @p 1 requests modification to be
2457 					 *   performed on the outermost packet
2458 					 *   encapsulation level.
2459 					 *
2460 					 * - @p 2 and subsequent values request
2461 					 *   modification to be performed on
2462 					 *   the specified inner packet
2463 					 *   encapsulation level, from
2464 					 *   outermost to innermost (lower to
2465 					 *   higher values).
2466 					 *
2467 					 * Values other than @p 0 are not
2468 					 * necessarily supported.
2469 					 *
2470 					 * @note that for MPLS field,
2471 					 * encapsulation level also include
2472 					 * tunnel since MPLS may appear in
2473 					 * outer, inner or tunnel.
2474 					 */
2475 					uint8_t level;
2476 					union {
2477 						/**
2478 						 * Tag index array inside
2479 						 * encapsulation level.
2480 						 * Used for VLAN, MPLS or TAG types.
2481 						 */
2482 						uint8_t tag_index;
2483 						/**
2484 						 * Geneve option identifier.
2485 						 * Relevant only for
2486 						 * RTE_FLOW_FIELD_GENEVE_OPT_XXXX
2487 						 * modification type.
2488 						 */
2489 						struct {
2490 							/**
2491 							 * Geneve option type.
2492 							 */
2493 							uint8_t type;
2494 							/**
2495 							 * Geneve option class.
2496 							 */
2497 							rte_be16_t class_id;
2498 						};
2499 					};
2500 				};
2501 				struct rte_flow_item_flex_handle *flex_handle;
2502 			};
2503 			/** Number of bits to skip from a field. */
2504 			uint32_t offset;
2505 		};
2506 		/**
2507 		 * Immediate value for RTE_FLOW_FIELD_VALUE, presented in the
2508 		 * same byte order and length as in relevant rte_flow_item_xxx.
2509 		 * The immediate source bitfield offset is inherited from
2510 		 * the destination's one.
2511 		 */
2512 		uint8_t value[16];
2513 		/**
2514 		 * Memory address for RTE_FLOW_FIELD_POINTER, memory layout
2515 		 * should be the same as for relevant field in the
2516 		 * rte_flow_item_xxx structure.
2517 		 */
2518 		void *pvalue;
2519 	};
2520 };
2521 
2522 /**
2523  * Expected operation types for compare item.
2524  */
2525 enum rte_flow_item_compare_op {
2526 	RTE_FLOW_ITEM_COMPARE_EQ,	/* Compare result equal. */
2527 	RTE_FLOW_ITEM_COMPARE_NE,	/* Compare result not equal. */
2528 	RTE_FLOW_ITEM_COMPARE_LT,	/* Compare result less than. */
2529 	RTE_FLOW_ITEM_COMPARE_LE,	/* Compare result less than or equal. */
2530 	RTE_FLOW_ITEM_COMPARE_GT,	/* Compare result great than. */
2531 	RTE_FLOW_ITEM_COMPARE_GE,	/* Compare result great than or equal. */
2532 };
2533 
2534 /**
2535  *
2536  * RTE_FLOW_ITEM_TYPE_COMPARE
2537  *
2538  * Matches the packet with compare result.
2539  *
2540  * The operation means a compare with b result.
2541  */
2542 struct rte_flow_item_compare {
2543 	enum rte_flow_item_compare_op operation; /* The compare operation. */
2544 	struct rte_flow_field_data a;		 /* Field be compared.  */
2545 	struct rte_flow_field_data b;		 /* Field as comparator. */
2546 	uint32_t width;				 /* Compare width. */
2547 };
2548 
2549 /**
2550  * Action types.
2551  *
2552  * Each possible action is represented by a type.
2553  * An action can have an associated configuration object.
2554  * Several actions combined in a list can be assigned
2555  * to a flow rule and are performed in order.
2556  *
2557  * They fall in three categories:
2558  *
2559  * - Actions that modify the fate of matching traffic, for instance by
2560  *   dropping or assigning it a specific destination.
2561  *
2562  * - Actions that modify matching traffic contents or its properties. This
2563  *   includes adding/removing encapsulation, encryption, compression and
2564  *   marks.
2565  *
2566  * - Actions related to the flow rule itself, such as updating counters or
2567  *   making it non-terminating.
2568  *
2569  * Flow rules being terminating by default, not specifying any action of the
2570  * fate kind results in undefined behavior. This applies to both ingress and
2571  * egress.
2572  *
2573  * PASSTHRU, when supported, makes a flow rule non-terminating.
2574  */
2575 enum rte_flow_action_type {
2576 	/**
2577 	 * End marker for action lists. Prevents further processing of
2578 	 * actions, thereby ending the list.
2579 	 *
2580 	 * No associated configuration structure.
2581 	 */
2582 	RTE_FLOW_ACTION_TYPE_END,
2583 
2584 	/**
2585 	 * Used as a placeholder for convenience. It is ignored and simply
2586 	 * discarded by PMDs.
2587 	 *
2588 	 * No associated configuration structure.
2589 	 */
2590 	RTE_FLOW_ACTION_TYPE_VOID,
2591 
2592 	/**
2593 	 * Leaves traffic up for additional processing by subsequent flow
2594 	 * rules; makes a flow rule non-terminating.
2595 	 *
2596 	 * No associated configuration structure.
2597 	 */
2598 	RTE_FLOW_ACTION_TYPE_PASSTHRU,
2599 
2600 	/**
2601 	 * RTE_FLOW_ACTION_TYPE_JUMP
2602 	 *
2603 	 * Redirects packets to a group on the current device.
2604 	 *
2605 	 * See struct rte_flow_action_jump.
2606 	 */
2607 	RTE_FLOW_ACTION_TYPE_JUMP,
2608 
2609 	/**
2610 	 * Attaches an integer value to packets and sets RTE_MBUF_F_RX_FDIR and
2611 	 * RTE_MBUF_F_RX_FDIR_ID mbuf flags.
2612 	 *
2613 	 * See struct rte_flow_action_mark.
2614 	 *
2615 	 * One should negotiate mark delivery from the NIC to the PMD.
2616 	 * @see rte_eth_rx_metadata_negotiate()
2617 	 * @see RTE_ETH_RX_METADATA_USER_MARK
2618 	 */
2619 	RTE_FLOW_ACTION_TYPE_MARK,
2620 
2621 	/**
2622 	 * Flags packets. Similar to MARK without a specific value; only
2623 	 * sets the RTE_MBUF_F_RX_FDIR mbuf flag.
2624 	 *
2625 	 * No associated configuration structure.
2626 	 *
2627 	 * One should negotiate flag delivery from the NIC to the PMD.
2628 	 * @see rte_eth_rx_metadata_negotiate()
2629 	 * @see RTE_ETH_RX_METADATA_USER_FLAG
2630 	 */
2631 	RTE_FLOW_ACTION_TYPE_FLAG,
2632 
2633 	/**
2634 	 * Assigns packets to a given queue index.
2635 	 *
2636 	 * See struct rte_flow_action_queue.
2637 	 */
2638 	RTE_FLOW_ACTION_TYPE_QUEUE,
2639 
2640 	/**
2641 	 * Drops packets.
2642 	 *
2643 	 * PASSTHRU overrides this action if both are specified.
2644 	 *
2645 	 * No associated configuration structure.
2646 	 */
2647 	RTE_FLOW_ACTION_TYPE_DROP,
2648 
2649 	/**
2650 	 * Enables counters for this flow rule.
2651 	 *
2652 	 * These counters can be retrieved and reset through rte_flow_query() or
2653 	 * rte_flow_action_handle_query() if the action provided via handle,
2654 	 * see struct rte_flow_query_count.
2655 	 *
2656 	 * See struct rte_flow_action_count.
2657 	 */
2658 	RTE_FLOW_ACTION_TYPE_COUNT,
2659 
2660 	/**
2661 	 * Similar to QUEUE, except RSS is additionally performed on packets
2662 	 * to spread them among several queues according to the provided
2663 	 * parameters.
2664 	 *
2665 	 * See struct rte_flow_action_rss.
2666 	 */
2667 	RTE_FLOW_ACTION_TYPE_RSS,
2668 
2669 	/**
2670 	 * @deprecated
2671 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2672 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2673 	 *
2674 	 * Directs matching traffic to the physical function (PF) of the
2675 	 * current device.
2676 	 *
2677 	 * No associated configuration structure.
2678 	 */
2679 	RTE_FLOW_ACTION_TYPE_PF,
2680 
2681 	/**
2682 	 * @deprecated
2683 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2684 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2685 	 *
2686 	 * Directs matching traffic to a given virtual function of the
2687 	 * current device.
2688 	 *
2689 	 * See struct rte_flow_action_vf.
2690 	 */
2691 	RTE_FLOW_ACTION_TYPE_VF,
2692 
2693 	/**
2694 	 * @deprecated
2695 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2696 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2697 	 *
2698 	 * Directs matching traffic to a given DPDK port ID.
2699 	 *
2700 	 * See struct rte_flow_action_port_id.
2701 	 */
2702 	RTE_FLOW_ACTION_TYPE_PORT_ID,
2703 
2704 	/**
2705 	 * Traffic metering and policing (MTR).
2706 	 *
2707 	 * See struct rte_flow_action_meter.
2708 	 * See file rte_mtr.h for MTR object configuration.
2709 	 */
2710 	RTE_FLOW_ACTION_TYPE_METER,
2711 
2712 	/**
2713 	 * Redirects packets to security engine of current device for security
2714 	 * processing as specified by security session.
2715 	 *
2716 	 * See struct rte_flow_action_security.
2717 	 */
2718 	RTE_FLOW_ACTION_TYPE_SECURITY,
2719 
2720 	/**
2721 	 * @warning This is a legacy action.
2722 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2723 	 *
2724 	 * Implements OFPAT_DEC_NW_TTL ("decrement IP TTL") as defined by
2725 	 * the OpenFlow Switch Specification.
2726 	 *
2727 	 * No associated configuration structure.
2728 	 */
2729 	RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL,
2730 
2731 	/**
2732 	 * Implements OFPAT_POP_VLAN ("pop the outer VLAN tag") as defined
2733 	 * by the OpenFlow Switch Specification.
2734 	 *
2735 	 * No associated configuration structure.
2736 	 */
2737 	RTE_FLOW_ACTION_TYPE_OF_POP_VLAN,
2738 
2739 	/**
2740 	 * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by
2741 	 * the OpenFlow Switch Specification.
2742 	 *
2743 	 * See struct rte_flow_action_of_push_vlan.
2744 	 */
2745 	RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN,
2746 
2747 	/**
2748 	 * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN ID") as
2749 	 * defined by the OpenFlow Switch Specification.
2750 	 *
2751 	 * See struct rte_flow_action_of_set_vlan_vid.
2752 	 */
2753 	RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID,
2754 
2755 	/**
2756 	 * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as
2757 	 * defined by the OpenFlow Switch Specification.
2758 	 *
2759 	 * See struct rte_flow_action_of_set_vlan_pcp.
2760 	 */
2761 	RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP,
2762 
2763 	/**
2764 	 * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined
2765 	 * by the OpenFlow Switch Specification.
2766 	 *
2767 	 * See struct rte_flow_action_of_pop_mpls.
2768 	 */
2769 	RTE_FLOW_ACTION_TYPE_OF_POP_MPLS,
2770 
2771 	/**
2772 	 * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by
2773 	 * the OpenFlow Switch Specification.
2774 	 *
2775 	 * See struct rte_flow_action_of_push_mpls.
2776 	 */
2777 	RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS,
2778 
2779 	/**
2780 	 * Encapsulate flow in VXLAN tunnel as defined in
2781 	 * rte_flow_action_vxlan_encap action structure.
2782 	 *
2783 	 * See struct rte_flow_action_vxlan_encap.
2784 	 */
2785 	RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP,
2786 
2787 	/**
2788 	 * Decapsulate outer most VXLAN tunnel from matched flow.
2789 	 *
2790 	 * If flow pattern does not define a valid VXLAN tunnel (as specified by
2791 	 * RFC7348) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
2792 	 * error.
2793 	 */
2794 	RTE_FLOW_ACTION_TYPE_VXLAN_DECAP,
2795 
2796 	/**
2797 	 * Encapsulate flow in NVGRE tunnel defined in the
2798 	 * rte_flow_action_nvgre_encap action structure.
2799 	 *
2800 	 * See struct rte_flow_action_nvgre_encap.
2801 	 */
2802 	RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP,
2803 
2804 	/**
2805 	 * Decapsulate outer most NVGRE tunnel from matched flow.
2806 	 *
2807 	 * If flow pattern does not define a valid NVGRE tunnel (as specified by
2808 	 * RFC7637) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
2809 	 * error.
2810 	 */
2811 	RTE_FLOW_ACTION_TYPE_NVGRE_DECAP,
2812 
2813 	/**
2814 	 * Add outer header whose template is provided in its data buffer
2815 	 *
2816 	 * See struct rte_flow_action_raw_encap.
2817 	 */
2818 	RTE_FLOW_ACTION_TYPE_RAW_ENCAP,
2819 
2820 	/**
2821 	 * Remove outer header whose template is provided in its data buffer.
2822 	 *
2823 	 * See struct rte_flow_action_raw_decap
2824 	 */
2825 	RTE_FLOW_ACTION_TYPE_RAW_DECAP,
2826 
2827 	/**
2828 	 * @warning This is a legacy action.
2829 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2830 	 *
2831 	 * Modify IPv4 source address in the outermost IPv4 header.
2832 	 *
2833 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2834 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2835 	 *
2836 	 * See struct rte_flow_action_set_ipv4.
2837 	 */
2838 	RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC,
2839 
2840 	/**
2841 	 * @warning This is a legacy action.
2842 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2843 	 *
2844 	 * Modify IPv4 destination address in the outermost IPv4 header.
2845 	 *
2846 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2847 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2848 	 *
2849 	 * See struct rte_flow_action_set_ipv4.
2850 	 */
2851 	RTE_FLOW_ACTION_TYPE_SET_IPV4_DST,
2852 
2853 	/**
2854 	 * @warning This is a legacy action.
2855 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2856 	 *
2857 	 * Modify IPv6 source address in the outermost IPv6 header.
2858 	 *
2859 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2860 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2861 	 *
2862 	 * See struct rte_flow_action_set_ipv6.
2863 	 */
2864 	RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC,
2865 
2866 	/**
2867 	 * @warning This is a legacy action.
2868 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2869 	 *
2870 	 * Modify IPv6 destination address in the outermost IPv6 header.
2871 	 *
2872 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2873 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2874 	 *
2875 	 * See struct rte_flow_action_set_ipv6.
2876 	 */
2877 	RTE_FLOW_ACTION_TYPE_SET_IPV6_DST,
2878 
2879 	/**
2880 	 * @warning This is a legacy action.
2881 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2882 	 *
2883 	 * Modify source port number in the outermost TCP/UDP header.
2884 	 *
2885 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
2886 	 * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
2887 	 * RTE_FLOW_ERROR_TYPE_ACTION error.
2888 	 *
2889 	 * See struct rte_flow_action_set_tp.
2890 	 */
2891 	RTE_FLOW_ACTION_TYPE_SET_TP_SRC,
2892 
2893 	/**
2894 	 * @warning This is a legacy action.
2895 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2896 	 *
2897 	 * Modify destination port number in the outermost TCP/UDP header.
2898 	 *
2899 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
2900 	 * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
2901 	 * RTE_FLOW_ERROR_TYPE_ACTION error.
2902 	 *
2903 	 * See struct rte_flow_action_set_tp.
2904 	 */
2905 	RTE_FLOW_ACTION_TYPE_SET_TP_DST,
2906 
2907 	/**
2908 	 * Swap the source and destination MAC addresses in the outermost
2909 	 * Ethernet header.
2910 	 *
2911 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2912 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2913 	 *
2914 	 * No associated configuration structure.
2915 	 */
2916 	RTE_FLOW_ACTION_TYPE_MAC_SWAP,
2917 
2918 	/**
2919 	 * @warning This is a legacy action.
2920 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2921 	 *
2922 	 * Decrease TTL value directly
2923 	 *
2924 	 * No associated configuration structure.
2925 	 */
2926 	RTE_FLOW_ACTION_TYPE_DEC_TTL,
2927 
2928 	/**
2929 	 * @warning This is a legacy action.
2930 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2931 	 *
2932 	 * Set TTL value
2933 	 *
2934 	 * See struct rte_flow_action_set_ttl
2935 	 */
2936 	RTE_FLOW_ACTION_TYPE_SET_TTL,
2937 
2938 	/**
2939 	 * @warning This is a legacy action.
2940 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2941 	 *
2942 	 * Set source MAC address from matched flow.
2943 	 *
2944 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2945 	 * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2946 	 *
2947 	 * See struct rte_flow_action_set_mac.
2948 	 */
2949 	RTE_FLOW_ACTION_TYPE_SET_MAC_SRC,
2950 
2951 	/**
2952 	 * @warning This is a legacy action.
2953 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2954 	 *
2955 	 * Set destination MAC address from matched flow.
2956 	 *
2957 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2958 	 * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2959 	 *
2960 	 * See struct rte_flow_action_set_mac.
2961 	 */
2962 	RTE_FLOW_ACTION_TYPE_SET_MAC_DST,
2963 
2964 	/**
2965 	 * @warning This is a legacy action.
2966 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2967 	 *
2968 	 * Increase sequence number in the outermost TCP header.
2969 	 *
2970 	 * Action configuration specifies the value to increase
2971 	 * TCP sequence number as a big-endian 32 bit integer.
2972 	 *
2973 	 * @p conf type:
2974 	 * @code rte_be32_t * @endcode
2975 	 *
2976 	 * Using this action on non-matching traffic will result in
2977 	 * undefined behavior.
2978 	 */
2979 	RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ,
2980 
2981 	/**
2982 	 * @warning This is a legacy action.
2983 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2984 	 *
2985 	 * Decrease sequence number in the outermost TCP header.
2986 	 *
2987 	 * Action configuration specifies the value to decrease
2988 	 * TCP sequence number as a big-endian 32 bit integer.
2989 	 *
2990 	 * @p conf type:
2991 	 * @code rte_be32_t * @endcode
2992 	 *
2993 	 * Using this action on non-matching traffic will result in
2994 	 * undefined behavior.
2995 	 */
2996 	RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ,
2997 
2998 	/**
2999 	 * @warning This is a legacy action.
3000 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3001 	 *
3002 	 * Increase acknowledgment number in the outermost TCP header.
3003 	 *
3004 	 * Action configuration specifies the value to increase
3005 	 * TCP acknowledgment number as a big-endian 32 bit integer.
3006 	 *
3007 	 * @p conf type:
3008 	 * @code rte_be32_t * @endcode
3009 
3010 	 * Using this action on non-matching traffic will result in
3011 	 * undefined behavior.
3012 	 */
3013 	RTE_FLOW_ACTION_TYPE_INC_TCP_ACK,
3014 
3015 	/**
3016 	 * @warning This is a legacy action.
3017 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3018 	 *
3019 	 * Decrease acknowledgment number in the outermost TCP header.
3020 	 *
3021 	 * Action configuration specifies the value to decrease
3022 	 * TCP acknowledgment number as a big-endian 32 bit integer.
3023 	 *
3024 	 * @p conf type:
3025 	 * @code rte_be32_t * @endcode
3026 	 *
3027 	 * Using this action on non-matching traffic will result in
3028 	 * undefined behavior.
3029 	 */
3030 	RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK,
3031 
3032 	/**
3033 	 * @warning This is a legacy action.
3034 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3035 	 *
3036 	 * Set Tag.
3037 	 *
3038 	 * Tag is for internal flow usage only and
3039 	 * is not delivered to the application.
3040 	 *
3041 	 * See struct rte_flow_action_set_tag.
3042 	 */
3043 	RTE_FLOW_ACTION_TYPE_SET_TAG,
3044 
3045 	/**
3046 	 * @warning This is a legacy action.
3047 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3048 	 *
3049 	 * Set metadata on ingress or egress path.
3050 	 *
3051 	 * See struct rte_flow_action_set_meta.
3052 	 */
3053 	RTE_FLOW_ACTION_TYPE_SET_META,
3054 
3055 	/**
3056 	 * @warning This is a legacy action.
3057 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3058 	 *
3059 	 * Modify IPv4 DSCP in the outermost IP header.
3060 	 *
3061 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
3062 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
3063 	 *
3064 	 * See struct rte_flow_action_set_dscp.
3065 	 */
3066 	RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP,
3067 
3068 	/**
3069 	 * @warning This is a legacy action.
3070 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3071 	 *
3072 	 * Modify IPv6 DSCP in the outermost IP header.
3073 	 *
3074 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
3075 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
3076 	 *
3077 	 * See struct rte_flow_action_set_dscp.
3078 	 */
3079 	RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP,
3080 
3081 	/**
3082 	 * Report as aged flow if timeout passed without any matching on the
3083 	 * flow.
3084 	 *
3085 	 * See struct rte_flow_action_age.
3086 	 * See function rte_flow_get_q_aged_flows
3087 	 * See function rte_flow_get_aged_flows
3088 	 * see enum RTE_ETH_EVENT_FLOW_AGED
3089 	 * See struct rte_flow_query_age
3090 	 * See struct rte_flow_update_age
3091 	 */
3092 	RTE_FLOW_ACTION_TYPE_AGE,
3093 
3094 	/**
3095 	 * The matching packets will be duplicated with specified ratio and
3096 	 * applied with own set of actions with a fate action.
3097 	 *
3098 	 * See struct rte_flow_action_sample.
3099 	 */
3100 	RTE_FLOW_ACTION_TYPE_SAMPLE,
3101 
3102 	/**
3103 	 * @deprecated
3104 	 * @see RTE_FLOW_ACTION_TYPE_INDIRECT
3105 	 *
3106 	 * Describe action shared across multiple flow rules.
3107 	 *
3108 	 * Allow multiple rules reference the same action by handle (see
3109 	 * struct rte_flow_shared_action).
3110 	 */
3111 	RTE_FLOW_ACTION_TYPE_SHARED,
3112 
3113 	/**
3114 	 * Modify a packet header field, tag, mark or metadata.
3115 	 *
3116 	 * Allow the modification of an arbitrary header field via
3117 	 * set, add and sub operations or copying its content into
3118 	 * tag, meta or mark for future processing.
3119 	 *
3120 	 * See struct rte_flow_action_modify_field.
3121 	 */
3122 	RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
3123 
3124 	/**
3125 	 * An action handle is referenced in a rule through an indirect action.
3126 	 *
3127 	 * The same action handle may be used in multiple rules for the same
3128 	 * or different ethdev ports.
3129 	 */
3130 	RTE_FLOW_ACTION_TYPE_INDIRECT,
3131 
3132 	/**
3133 	 * [META]
3134 	 *
3135 	 * Enable tracking a TCP connection state.
3136 	 *
3137 	 * @see struct rte_flow_action_conntrack.
3138 	 */
3139 	RTE_FLOW_ACTION_TYPE_CONNTRACK,
3140 
3141 	/**
3142 	 * Color the packet to reflect the meter color result.
3143 	 * Set the meter color in the mbuf to the selected color.
3144 	 *
3145 	 * See struct rte_flow_action_meter_color.
3146 	 */
3147 	RTE_FLOW_ACTION_TYPE_METER_COLOR,
3148 
3149 	/**
3150 	 * At embedded switch level, sends matching traffic to the given ethdev.
3151 	 *
3152 	 * @see struct rte_flow_action_ethdev
3153 	 */
3154 	RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
3155 
3156 	/**
3157 	 * At embedded switch level, send matching traffic to
3158 	 * the entity represented by the given ethdev.
3159 	 *
3160 	 * @see struct rte_flow_action_ethdev
3161 	 */
3162 	RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
3163 
3164 	/**
3165 	 * Traffic metering and marking (MTR).
3166 	 *
3167 	 * @see struct rte_flow_action_meter_mark
3168 	 * See file rte_mtr.h for MTR profile object configuration.
3169 	 */
3170 	RTE_FLOW_ACTION_TYPE_METER_MARK,
3171 
3172 	/**
3173 	 * Send packets to the kernel, without going to userspace at all.
3174 	 * The packets will be received by the kernel driver sharing
3175 	 * the same device as the DPDK port on which this action is configured.
3176 	 * This action mostly suits bifurcated driver model.
3177 	 *
3178 	 * No associated configuration structure.
3179 	 */
3180 	RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL,
3181 
3182 	/**
3183 	 * Apply the quota verdict (PASS or BLOCK) to a flow.
3184 	 *
3185 	 * @see struct rte_flow_action_quota
3186 	 * @see struct rte_flow_query_quota
3187 	 * @see struct rte_flow_update_quota
3188 	 */
3189 	 RTE_FLOW_ACTION_TYPE_QUOTA,
3190 
3191 	/**
3192 	 * Skip congestion management configuration.
3193 	 *
3194 	 * Using rte_eth_cman_config_set(), the application
3195 	 * can configure ethdev Rx queue's congestion mechanism.
3196 	 * This flow action allows to skip the congestion configuration
3197 	 * applied to the given ethdev Rx queue.
3198 	 */
3199 	RTE_FLOW_ACTION_TYPE_SKIP_CMAN,
3200 
3201 	/**
3202 	 * RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH
3203 	 *
3204 	 * Push IPv6 extension into IPv6 packet.
3205 	 *
3206 	 * @see struct rte_flow_action_ipv6_ext_push.
3207 	 */
3208 	RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH,
3209 
3210 	/**
3211 	 * RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE
3212 	 *
3213 	 * Remove IPv6 extension from IPv6 packet whose type
3214 	 * is provided in its configuration buffer.
3215 	 *
3216 	 * @see struct rte_flow_action_ipv6_ext_remove.
3217 	 */
3218 	RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE,
3219 
3220 	/**
3221 	 * Action handle to reference flow actions list.
3222 	 *
3223 	 * @see struct rte_flow_action_indirect_list
3224 	 */
3225 	RTE_FLOW_ACTION_TYPE_INDIRECT_LIST,
3226 
3227 	/**
3228 	 * Program action. These actions are defined by the program currently
3229 	 * loaded on the device. For example, these actions are applicable to
3230 	 * devices that can be programmed through the P4 language.
3231 	 *
3232 	 * @see struct rte_flow_action_prog.
3233 	 */
3234 	RTE_FLOW_ACTION_TYPE_PROG,
3235 
3236 	/**
3237 	 * NAT64 translation of IPv4/IPv6 headers.
3238 	 *
3239 	 * @see struct rte_flow_action_nat64
3240 	 */
3241 	RTE_FLOW_ACTION_TYPE_NAT64,
3242 };
3243 
3244 /**
3245  * @warning
3246  * @b EXPERIMENTAL: this API may change without prior notice.
3247  *
3248  * QUOTA operational mode.
3249  *
3250  * @see struct rte_flow_action_quota
3251  */
3252 enum rte_flow_quota_mode {
3253 	RTE_FLOW_QUOTA_MODE_PACKET = 1, /**< Count packets. */
3254 	RTE_FLOW_QUOTA_MODE_L2 = 2, /**< Count packet bytes starting from L2. */
3255 	RTE_FLOW_QUOTA_MODE_L3 = 3, /**< Count packet bytes starting from L3. */
3256 };
3257 
3258 /**
3259  * @warning
3260  * @b EXPERIMENTAL: this API may change without prior notice.
3261  *
3262  * Create QUOTA action.
3263  *
3264  * @see RTE_FLOW_ACTION_TYPE_QUOTA
3265  */
3266 struct rte_flow_action_quota {
3267 	enum rte_flow_quota_mode mode; /**< Quota operational mode. */
3268 	int64_t quota;                 /**< Quota value. */
3269 };
3270 
3271 /**
3272  * @warning
3273  * @b EXPERIMENTAL: this API may change without prior notice.
3274  *
3275  * Query indirect QUOTA action.
3276  *
3277  * @see RTE_FLOW_ACTION_TYPE_QUOTA
3278  */
3279 struct rte_flow_query_quota {
3280 	int64_t quota; /**< Quota value. */
3281 };
3282 
3283 /**
3284  * @warning
3285  * @b EXPERIMENTAL: this API may change without prior notice.
3286  *
3287  * Indirect QUOTA update operations.
3288  *
3289  * @see struct rte_flow_update_quota
3290  */
3291 enum rte_flow_update_quota_op {
3292 	RTE_FLOW_UPDATE_QUOTA_SET, /**< Set new quota value. */
3293 	RTE_FLOW_UPDATE_QUOTA_ADD, /**< Increase quota value. */
3294 };
3295 
3296 /**
3297  * @warning
3298  * @b EXPERIMENTAL: this API may change without prior notice.
3299  *
3300  * @see RTE_FLOW_ACTION_TYPE_QUOTA
3301  *
3302  * Update indirect QUOTA action.
3303  */
3304 struct rte_flow_update_quota {
3305 	enum rte_flow_update_quota_op op; /**< Update operation. */
3306 	int64_t quota;                    /**< Quota value. */
3307 };
3308 
3309 /**
3310  * RTE_FLOW_ACTION_TYPE_MARK
3311  *
3312  * Attaches an integer value to packets and sets RTE_MBUF_F_RX_FDIR and
3313  * RTE_MBUF_F_RX_FDIR_ID mbuf flags.
3314  *
3315  * This value is arbitrary and application-defined. Maximum allowed value
3316  * depends on the underlying implementation. It is returned in the
3317  * hash.fdir.hi mbuf field.
3318  */
3319 struct rte_flow_action_mark {
3320 	uint32_t id; /**< Integer value to return with packets. */
3321 };
3322 
3323 /**
3324  * @warning
3325  * @b EXPERIMENTAL: this structure may change without prior notice
3326  *
3327  * RTE_FLOW_ACTION_TYPE_JUMP
3328  *
3329  * Redirects packets to a group on the current device.
3330  *
3331  * In a hierarchy of groups, which can be used to represent physical or logical
3332  * flow tables on the device, this action allows the action to be a redirect to
3333  * a group on that device.
3334  */
3335 struct rte_flow_action_jump {
3336 	uint32_t group;
3337 };
3338 
3339 /**
3340  * RTE_FLOW_ACTION_TYPE_QUEUE
3341  *
3342  * Assign packets to a given queue index.
3343  */
3344 struct rte_flow_action_queue {
3345 	uint16_t index; /**< Queue index to use. */
3346 };
3347 
3348 /**
3349  * @warning
3350  * @b EXPERIMENTAL: this structure may change without prior notice
3351  *
3352  * RTE_FLOW_ACTION_TYPE_AGE
3353  *
3354  * Report flow as aged-out if timeout passed without any matching
3355  * on the flow. RTE_ETH_EVENT_FLOW_AGED event is triggered when a
3356  * port detects new aged-out flows.
3357  *
3358  * The flow context and the flow handle will be reported by the either
3359  * rte_flow_get_aged_flows or rte_flow_get_q_aged_flows APIs.
3360  */
3361 struct rte_flow_action_age {
3362 	uint32_t timeout:24; /**< Time in seconds. */
3363 	uint32_t reserved:8; /**< Reserved, must be zero. */
3364 	/** The user flow context, NULL means the rte_flow pointer. */
3365 	void *context;
3366 };
3367 
3368 /**
3369  * RTE_FLOW_ACTION_TYPE_AGE (query)
3370  *
3371  * Query structure to retrieve the aging status information of a
3372  * shared AGE action, or a flow rule using the AGE action.
3373  */
3374 struct rte_flow_query_age {
3375 	uint32_t reserved:6; /**< Reserved, must be zero. */
3376 	uint32_t aged:1; /**< 1 if aging timeout expired, 0 otherwise. */
3377 	/** sec_since_last_hit value is valid. */
3378 	uint32_t sec_since_last_hit_valid:1;
3379 	uint32_t sec_since_last_hit:24; /**< Seconds since last traffic hit. */
3380 };
3381 
3382 /**
3383  * @warning
3384  * @b EXPERIMENTAL: this structure may change without prior notice
3385  *
3386  * RTE_FLOW_ACTION_TYPE_AGE
3387  *
3388  * Update indirect AGE action attributes:
3389  *  - Timeout can be updated including stop/start action:
3390  *     +-------------+-------------+------------------------------+
3391  *     | Old Timeout | New Timeout | Updating                     |
3392  *     +=============+=============+==============================+
3393  *     | 0           | positive    | Start aging with new value   |
3394  *     +-------------+-------------+------------------------------+
3395  *     | positive    | 0           | Stop aging			  |
3396  *     +-------------+-------------+------------------------------+
3397  *     | positive    | positive    | Change timeout to new value  |
3398  *     +-------------+-------------+------------------------------+
3399  *  - sec_since_last_hit can be reset.
3400  */
3401 struct rte_flow_update_age {
3402 	uint32_t reserved:6; /**< Reserved, must be zero. */
3403 	uint32_t timeout_valid:1; /**< The timeout is valid for update. */
3404 	uint32_t timeout:24; /**< Time in seconds. */
3405 	/** Means that aging should assume packet passed the aging. */
3406 	uint32_t touch:1;
3407 };
3408 
3409 /**
3410  * @warning
3411  * @b EXPERIMENTAL: this structure may change without prior notice
3412  *
3413  * RTE_FLOW_ACTION_TYPE_COUNT
3414  *
3415  * Adds a counter action to a matched flow.
3416  *
3417  * If more than one count action is specified in a single flow rule, then each
3418  * action must specify a unique ID.
3419  *
3420  * Counters can be retrieved and reset through ``rte_flow_query()``, see
3421  * ``struct rte_flow_query_count``.
3422  *
3423  * For ports within the same switch domain then the counter ID namespace extends
3424  * to all ports within that switch domain.
3425  */
3426 struct rte_flow_action_count {
3427 	uint32_t id; /**< Counter ID. */
3428 };
3429 
3430 /**
3431  * RTE_FLOW_ACTION_TYPE_COUNT (query)
3432  *
3433  * Query structure to retrieve and reset flow rule counters.
3434  */
3435 struct rte_flow_query_count {
3436 	uint32_t reset:1; /**< Reset counters after query [in]. */
3437 	uint32_t hits_set:1; /**< hits field is set [out]. */
3438 	uint32_t bytes_set:1; /**< bytes field is set [out]. */
3439 	uint32_t reserved:29; /**< Reserved, must be zero [in, out]. */
3440 	uint64_t hits; /**< Number of hits for this rule [out]. */
3441 	uint64_t bytes; /**< Number of bytes through this rule [out]. */
3442 };
3443 
3444 /**
3445  * RTE_FLOW_ACTION_TYPE_RSS
3446  *
3447  * Similar to QUEUE, except RSS is additionally performed on packets to
3448  * spread them among several queues according to the provided parameters.
3449  *
3450  * Unlike global RSS settings used by other DPDK APIs, unsetting the
3451  * @p types field does not disable RSS in a flow rule. Doing so instead
3452  * requests safe unspecified "best-effort" settings from the underlying PMD,
3453  * which depending on the flow rule, may result in anything ranging from
3454  * empty (single queue) to all-inclusive RSS.
3455  *
3456  * Note: RSS hash result is stored in the hash.rss mbuf field which overlaps
3457  * hash.fdir.lo. Since the MARK action sets the hash.fdir.hi field only,
3458  * both can be requested simultaneously.
3459  */
3460 struct rte_flow_action_rss {
3461 	enum rte_eth_hash_function func; /**< RSS hash function to apply. */
3462 	/**
3463 	 * Packet encapsulation level RSS hash @p types apply to.
3464 	 *
3465 	 * - @p 0 requests the default behavior. Depending on the packet
3466 	 *   type, it can mean outermost, innermost, anything in between or
3467 	 *   even no RSS.
3468 	 *
3469 	 *   It basically stands for the innermost encapsulation level RSS
3470 	 *   can be performed on according to PMD and device capabilities.
3471 	 *
3472 	 * - @p 1 requests RSS to be performed on the outermost packet
3473 	 *   encapsulation level.
3474 	 *
3475 	 * - @p 2 and subsequent values request RSS to be performed on the
3476 	 *   specified inner packet encapsulation level, from outermost to
3477 	 *   innermost (lower to higher values).
3478 	 *
3479 	 * Values other than @p 0 are not necessarily supported.
3480 	 *
3481 	 * Requesting a specific RSS level on unrecognized traffic results
3482 	 * in undefined behavior. For predictable results, it is recommended
3483 	 * to make the flow rule pattern match packet headers up to the
3484 	 * requested encapsulation level so that only matching traffic goes
3485 	 * through.
3486 	 */
3487 	uint32_t level;
3488 	uint64_t types; /**< Specific RSS hash types (see RTE_ETH_RSS_*). */
3489 	uint32_t key_len; /**< Hash key length in bytes. */
3490 	uint32_t queue_num; /**< Number of entries in @p queue. */
3491 	const uint8_t *key; /**< Hash key. */
3492 	const uint16_t *queue; /**< Queue indices to use. */
3493 };
3494 
3495 /**
3496  * @deprecated
3497  * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
3498  * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
3499  *
3500  * RTE_FLOW_ACTION_TYPE_VF
3501  *
3502  * Directs matching traffic to a given virtual function of the current
3503  * device.
3504  *
3505  * Packets matched by a VF pattern item can be redirected to their original
3506  * VF ID instead of the specified one. This parameter may not be available
3507  * and is not guaranteed to work properly if the VF part is matched by a
3508  * prior flow rule or if packets are not addressed to a VF in the first
3509  * place.
3510  */
3511 struct rte_flow_action_vf {
3512 	uint32_t original:1; /**< Use original VF ID if possible. */
3513 	uint32_t reserved:31; /**< Reserved, must be zero. */
3514 	uint32_t id; /**< VF ID. */
3515 };
3516 
3517 /**
3518  * @deprecated
3519  * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
3520  * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
3521  *
3522  * RTE_FLOW_ACTION_TYPE_PORT_ID
3523  *
3524  * Directs matching traffic to a given DPDK port ID.
3525  *
3526  * @see RTE_FLOW_ITEM_TYPE_PORT_ID
3527  */
3528 struct rte_flow_action_port_id {
3529 	uint32_t original:1; /**< Use original DPDK port ID if possible. */
3530 	uint32_t reserved:31; /**< Reserved, must be zero. */
3531 	uint32_t id; /**< DPDK port ID. */
3532 };
3533 
3534 /**
3535  * RTE_FLOW_ACTION_TYPE_METER
3536  *
3537  * Traffic metering and policing (MTR).
3538  *
3539  * Packets matched by items of this type can be either dropped or passed to the
3540  * next item with their color set by the MTR object.
3541  */
3542 struct rte_flow_action_meter {
3543 	uint32_t mtr_id; /**< MTR object ID created with rte_mtr_create(). */
3544 };
3545 
3546 /**
3547  * RTE_FLOW_ACTION_TYPE_SECURITY
3548  *
3549  * Perform the security action on flows matched by the pattern items
3550  * according to the configuration of the security session.
3551  *
3552  * This action modifies the payload of matched flows. For INLINE_CRYPTO, the
3553  * security protocol headers and IV are fully provided by the application as
3554  * specified in the flow pattern. The payload of matching packets is
3555  * encrypted on egress, and decrypted and authenticated on ingress.
3556  * For INLINE_PROTOCOL, the security protocol is fully offloaded to HW,
3557  * providing full encapsulation and decapsulation of packets in security
3558  * protocols. The flow pattern specifies both the outer security header fields
3559  * and the inner packet fields. The security session specified in the action
3560  * must match the pattern parameters.
3561  *
3562  * The security session specified in the action must be created on the same
3563  * port as the flow action that is being specified.
3564  *
3565  * The ingress/egress flow attribute should match that specified in the
3566  * security session if the security session supports the definition of the
3567  * direction.
3568  *
3569  * Multiple flows can be configured to use the same security session.
3570  *
3571  * The NULL value is allowed for security session. If security session is NULL,
3572  * then SPI field in ESP flow item and IP addresses in flow items 'IPv4' and
3573  * 'IPv6' will be allowed to be a range. The rule thus created can enable
3574  * security processing on multiple flows.
3575  */
3576 struct rte_flow_action_security {
3577 	void *security_session; /**< Pointer to security session structure. */
3578 };
3579 
3580 /**
3581  * NAT64 translation type for IP headers.
3582  */
3583 enum rte_flow_nat64_type {
3584 	RTE_FLOW_NAT64_6TO4 = 0, /**< IPv6 to IPv4 headers translation. */
3585 	RTE_FLOW_NAT64_4TO6 = 1, /**< IPv4 to IPv6 headers translation. */
3586 };
3587 
3588 /**
3589  * @warning
3590  * @b EXPERIMENTAL: this structure may change without prior notice.
3591  *
3592  * RTE_FLOW_ACTION_TYPE_NAT64
3593  *
3594  * Specify the NAT64 translation type.
3595  */
3596 struct rte_flow_action_nat64 {
3597 	enum rte_flow_nat64_type type;
3598 };
3599 
3600 /**
3601  * RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN
3602  *
3603  * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by the
3604  * OpenFlow Switch Specification.
3605  */
3606 struct rte_flow_action_of_push_vlan {
3607 	rte_be16_t ethertype; /**< EtherType. */
3608 };
3609 
3610 /**
3611  * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID
3612  *
3613  * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN ID") as defined by
3614  * the OpenFlow Switch Specification.
3615  */
3616 struct rte_flow_action_of_set_vlan_vid {
3617 	rte_be16_t vlan_vid; /**< VLAN ID. */
3618 };
3619 
3620 /**
3621  * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP
3622  *
3623  * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as defined by
3624  * the OpenFlow Switch Specification.
3625  */
3626 struct rte_flow_action_of_set_vlan_pcp {
3627 	uint8_t vlan_pcp; /**< VLAN priority. */
3628 };
3629 
3630 /**
3631  * RTE_FLOW_ACTION_TYPE_OF_POP_MPLS
3632  *
3633  * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined by the
3634  * OpenFlow Switch Specification.
3635  */
3636 struct rte_flow_action_of_pop_mpls {
3637 	rte_be16_t ethertype; /**< EtherType. */
3638 };
3639 
3640 /**
3641  * RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS
3642  *
3643  * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by the
3644  * OpenFlow Switch Specification.
3645  */
3646 struct rte_flow_action_of_push_mpls {
3647 	rte_be16_t ethertype; /**< EtherType. */
3648 };
3649 
3650 /**
3651  * @warning
3652  * @b EXPERIMENTAL: this structure may change without prior notice
3653  *
3654  * RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP
3655  *
3656  * VXLAN tunnel end-point encapsulation data definition
3657  *
3658  * The tunnel definition is provided through the flow item pattern, the
3659  * provided pattern must conform to RFC7348 for the tunnel specified. The flow
3660  * definition must be provided in order from the RTE_FLOW_ITEM_TYPE_ETH
3661  * definition up the end item which is specified by RTE_FLOW_ITEM_TYPE_END.
3662  *
3663  * The mask field allows user to specify which fields in the flow item
3664  * definitions can be ignored and which have valid data and can be used
3665  * verbatim.
3666  *
3667  * Note: the last field is not used in the definition of a tunnel and can be
3668  * ignored.
3669  *
3670  * Valid flow definition for RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP include:
3671  *
3672  * - ETH / IPV4 / UDP / VXLAN / END
3673  * - ETH / IPV6 / UDP / VXLAN / END
3674  * - ETH / VLAN / IPV4 / UDP / VXLAN / END
3675  */
3676 struct rte_flow_action_vxlan_encap {
3677 	/**
3678 	 * Encapsulating vxlan tunnel definition
3679 	 * (terminated by the END pattern item).
3680 	 */
3681 	struct rte_flow_item *definition;
3682 };
3683 
3684 /**
3685  * @warning
3686  * @b EXPERIMENTAL: this structure may change without prior notice
3687  *
3688  * RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP
3689  *
3690  * NVGRE tunnel end-point encapsulation data definition
3691  *
3692  * The tunnel definition is provided through the flow item pattern  the
3693  * provided pattern must conform with RFC7637. The flow definition must be
3694  * provided in order from the RTE_FLOW_ITEM_TYPE_ETH definition up the end item
3695  * which is specified by RTE_FLOW_ITEM_TYPE_END.
3696  *
3697  * The mask field allows user to specify which fields in the flow item
3698  * definitions can be ignored and which have valid data and can be used
3699  * verbatim.
3700  *
3701  * Note: the last field is not used in the definition of a tunnel and can be
3702  * ignored.
3703  *
3704  * Valid flow definition for RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP include:
3705  *
3706  * - ETH / IPV4 / NVGRE / END
3707  * - ETH / VLAN / IPV6 / NVGRE / END
3708  */
3709 struct rte_flow_action_nvgre_encap {
3710 	/**
3711 	 * Encapsulating nvgre tunnel definition
3712 	 * (terminated by the END pattern item).
3713 	 */
3714 	struct rte_flow_item *definition;
3715 };
3716 
3717 /**
3718  * @warning
3719  * @b EXPERIMENTAL: this structure may change without prior notice
3720  *
3721  * RTE_FLOW_ACTION_TYPE_RAW_ENCAP
3722  *
3723  * Raw tunnel end-point encapsulation data definition.
3724  *
3725  * The data holds the headers definitions to be applied on the packet.
3726  * The data must start with ETH header up to the tunnel item header itself.
3727  * When used right after RAW_DECAP (for decapsulating L3 tunnel type for
3728  * example MPLSoGRE) the data will just hold layer 2 header.
3729  *
3730  * The preserve parameter holds which bits in the packet the PMD is not allowed
3731  * to change, this parameter can also be NULL and then the PMD is allowed
3732  * to update any field.
3733  *
3734  * size holds the number of bytes in @p data and @p preserve.
3735  */
3736 struct rte_flow_action_raw_encap {
3737 	uint8_t *data; /**< Encapsulation data. */
3738 	uint8_t *preserve; /**< Bit-mask of @p data to preserve on output. */
3739 	size_t size; /**< Size of @p data and @p preserve. */
3740 };
3741 
3742 /**
3743  * @warning
3744  * @b EXPERIMENTAL: this structure may change without prior notice
3745  *
3746  * RTE_FLOW_ACTION_TYPE_RAW_DECAP
3747  *
3748  * Raw tunnel end-point decapsulation data definition.
3749  *
3750  * The data holds the headers definitions to be removed from the packet.
3751  * The data must start with ETH header up to the tunnel item header itself.
3752  * When used right before RAW_DECAP (for encapsulating L3 tunnel type for
3753  * example MPLSoGRE) the data will just hold layer 2 header.
3754  *
3755  * size holds the number of bytes in @p data.
3756  */
3757 struct rte_flow_action_raw_decap {
3758 	uint8_t *data; /**< Encapsulation data. */
3759 	size_t size; /**< Size of @p data and @p preserve. */
3760 };
3761 
3762 /**
3763  * @warning
3764  * @b EXPERIMENTAL: this structure may change without prior notice
3765  *
3766  * RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC
3767  * RTE_FLOW_ACTION_TYPE_SET_IPV4_DST
3768  *
3769  * Allows modification of IPv4 source (RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC)
3770  * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV4_DST) in the
3771  * specified outermost IPv4 header.
3772  */
3773 struct rte_flow_action_set_ipv4 {
3774 	rte_be32_t ipv4_addr;
3775 };
3776 
3777 /**
3778  * @warning
3779  * @b EXPERIMENTAL: this structure may change without prior notice
3780  *
3781  * RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC
3782  * RTE_FLOW_ACTION_TYPE_SET_IPV6_DST
3783  *
3784  * Allows modification of IPv6 source (RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC)
3785  * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) in the
3786  * specified outermost IPv6 header.
3787  */
3788 struct rte_flow_action_set_ipv6 {
3789 	uint8_t ipv6_addr[16];
3790 };
3791 
3792 /**
3793  * @warning
3794  * @b EXPERIMENTAL: this structure may change without prior notice.
3795  *
3796  * RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH
3797  *
3798  * Valid flow definition for RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH include:
3799  *
3800  * - IPV6_EXT TYPE / IPV6_EXT_HEADER_IN_TYPE / END
3801  *
3802  * The data must be added as the last IPv6 extension.
3803  */
3804 struct rte_flow_action_ipv6_ext_push {
3805 	uint8_t *data; /**< IPv6 extension header data. */
3806 	size_t size; /**< Size (in bytes) of @p data. */
3807 	uint8_t type; /**< Type of IPv6 extension. */
3808 };
3809 
3810 /**
3811  * @warning
3812  * @b EXPERIMENTAL: this structure may change without prior notice.
3813  *
3814  * RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE
3815  *
3816  * Valid flow definition for RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE include:
3817  *
3818  * - IPV6_EXT TYPE / END
3819  */
3820 struct rte_flow_action_ipv6_ext_remove {
3821 	uint8_t type; /**< Type of IPv6 extension. */
3822 };
3823 
3824 /**
3825  * @warning
3826  * @b EXPERIMENTAL: this structure may change without prior notice
3827  *
3828  * RTE_FLOW_ACTION_TYPE_SET_TP_SRC
3829  * RTE_FLOW_ACTION_TYPE_SET_TP_DST
3830  *
3831  * Allows modification of source (RTE_FLOW_ACTION_TYPE_SET_TP_SRC)
3832  * and destination (RTE_FLOW_ACTION_TYPE_SET_TP_DST) port numbers
3833  * in the specified outermost TCP/UDP header.
3834  */
3835 struct rte_flow_action_set_tp {
3836 	rte_be16_t port;
3837 };
3838 
3839 /**
3840  * RTE_FLOW_ACTION_TYPE_SET_TTL
3841  *
3842  * Set the TTL value directly for IPv4 or IPv6
3843  */
3844 struct rte_flow_action_set_ttl {
3845 	uint8_t ttl_value;
3846 };
3847 
3848 /**
3849  * RTE_FLOW_ACTION_TYPE_SET_MAC
3850  *
3851  * Set MAC address from the matched flow
3852  */
3853 struct rte_flow_action_set_mac {
3854 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
3855 };
3856 
3857 /**
3858  * @warning
3859  * @b EXPERIMENTAL: this structure may change without prior notice
3860  *
3861  * RTE_FLOW_ACTION_TYPE_SET_TAG
3862  *
3863  * Set a tag which is a transient data used during flow matching. This is not
3864  * delivered to application. Multiple tags are supported by specifying index.
3865  */
3866 struct rte_flow_action_set_tag {
3867 	uint32_t data;
3868 	uint32_t mask;
3869 	uint8_t index;
3870 };
3871 
3872 /**
3873  * @warning
3874  * @b EXPERIMENTAL: this structure may change without prior notice
3875  *
3876  * RTE_FLOW_ACTION_TYPE_SET_META
3877  *
3878  * Set metadata. Metadata set by mbuf metadata dynamic field with
3879  * RTE_MBUF_DYNFLAG_TX_METADATA flag on egress will be overridden by this
3880  * action. On ingress, the metadata will be carried by mbuf metadata dynamic
3881  * field with RTE_MBUF_DYNFLAG_RX_METADATA flag if set.  The dynamic mbuf field
3882  * must be registered in advance by rte_flow_dynf_metadata_register().
3883  *
3884  * Altering partial bits is supported with mask. For bits which have never
3885  * been set, unpredictable value will be seen depending on driver
3886  * implementation. For loopback/hairpin packet, metadata set on Rx/Tx may
3887  * or may not be propagated to the other path depending on HW capability.
3888  *
3889  * RTE_FLOW_ITEM_TYPE_META matches metadata.
3890  */
3891 struct rte_flow_action_set_meta {
3892 	uint32_t data;
3893 	uint32_t mask;
3894 };
3895 
3896 /**
3897  * RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP
3898  * RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP
3899  *
3900  * Set the DSCP value for IPv4/IPv6 header.
3901  * DSCP in low 6 bits, rest ignored.
3902  */
3903 struct rte_flow_action_set_dscp {
3904 	uint8_t dscp;
3905 };
3906 
3907 /**
3908  * @warning
3909  * @b EXPERIMENTAL: this structure may change without prior notice
3910  *
3911  * RTE_FLOW_ACTION_TYPE_INDIRECT
3912  *
3913  * Opaque type returned after successfully creating an indirect action object.
3914  * The definition of the object handle is different per driver or
3915  * per direct action type.
3916  *
3917  * This handle can be used to manage and query the related direct action:
3918  * - referenced in single flow rule or across multiple flow rules
3919  *   over multiple ports
3920  * - update action object configuration
3921  * - query action object data
3922  * - destroy action object
3923  */
3924 struct rte_flow_action_handle;
3925 
3926 /**
3927  * The state of a TCP connection.
3928  */
3929 enum rte_flow_conntrack_state {
3930 	/** SYN-ACK packet was seen. */
3931 	RTE_FLOW_CONNTRACK_STATE_SYN_RECV,
3932 	/** 3-way handshake was done. */
3933 	RTE_FLOW_CONNTRACK_STATE_ESTABLISHED,
3934 	/** First FIN packet was received to close the connection. */
3935 	RTE_FLOW_CONNTRACK_STATE_FIN_WAIT,
3936 	/** First FIN was ACKed. */
3937 	RTE_FLOW_CONNTRACK_STATE_CLOSE_WAIT,
3938 	/** Second FIN was received, waiting for the last ACK. */
3939 	RTE_FLOW_CONNTRACK_STATE_LAST_ACK,
3940 	/** Second FIN was ACKed, connection was closed. */
3941 	RTE_FLOW_CONNTRACK_STATE_TIME_WAIT,
3942 };
3943 
3944 /**
3945  * The last passed TCP packet flags of a connection.
3946  */
3947 enum rte_flow_conntrack_tcp_last_index {
3948 	RTE_FLOW_CONNTRACK_FLAG_NONE = 0, /**< No Flag. */
3949 	RTE_FLOW_CONNTRACK_FLAG_SYN = RTE_BIT32(0), /**< With SYN flag. */
3950 	RTE_FLOW_CONNTRACK_FLAG_SYNACK = RTE_BIT32(1), /**< With SYNACK flag. */
3951 	RTE_FLOW_CONNTRACK_FLAG_FIN = RTE_BIT32(2), /**< With FIN flag. */
3952 	RTE_FLOW_CONNTRACK_FLAG_ACK = RTE_BIT32(3), /**< With ACK flag. */
3953 	RTE_FLOW_CONNTRACK_FLAG_RST = RTE_BIT32(4), /**< With RST flag. */
3954 };
3955 
3956 /**
3957  * @warning
3958  * @b EXPERIMENTAL: this structure may change without prior notice
3959  *
3960  * Configuration parameters for each direction of a TCP connection.
3961  * All fields should be in host byte order.
3962  * If needed, driver should convert all fields to network byte order
3963  * if HW needs them in that way.
3964  */
3965 struct rte_flow_tcp_dir_param {
3966 	/** TCP window scaling factor, 0xF to disable. */
3967 	uint32_t scale:4;
3968 	/** The FIN was sent by this direction. */
3969 	uint32_t close_initiated:1;
3970 	/** An ACK packet has been received by this side. */
3971 	uint32_t last_ack_seen:1;
3972 	/**
3973 	 * If set, it indicates that there is unacknowledged data for the
3974 	 * packets sent from this direction.
3975 	 */
3976 	uint32_t data_unacked:1;
3977 	/**
3978 	 * Maximal value of sequence + payload length in sent
3979 	 * packets (next ACK from the opposite direction).
3980 	 */
3981 	uint32_t sent_end;
3982 	/**
3983 	 * Maximal value of (ACK + window size) in received packet + length
3984 	 * over sent packet (maximal sequence could be sent).
3985 	 */
3986 	uint32_t reply_end;
3987 	/** Maximal value of actual window size in sent packets. */
3988 	uint32_t max_win;
3989 	/** Maximal value of ACK in sent packets. */
3990 	uint32_t max_ack;
3991 };
3992 
3993 /**
3994  * @warning
3995  * @b EXPERIMENTAL: this structure may change without prior notice
3996  *
3997  * RTE_FLOW_ACTION_TYPE_CONNTRACK
3998  *
3999  * Configuration and initial state for the connection tracking module.
4000  * This structure could be used for both setting and query.
4001  * All fields should be in host byte order.
4002  */
4003 struct rte_flow_action_conntrack {
4004 	/** The peer port number, can be the same port. */
4005 	uint16_t peer_port;
4006 	/**
4007 	 * Direction of this connection when creating a flow rule, the
4008 	 * value only affects the creation of subsequent flow rules.
4009 	 */
4010 	uint32_t is_original_dir:1;
4011 	/**
4012 	 * Enable / disable the conntrack HW module. When disabled, the
4013 	 * result will always be RTE_FLOW_CONNTRACK_FLAG_DISABLED.
4014 	 * In this state the HW will act as passthrough.
4015 	 * It only affects this conntrack object in the HW without any effect
4016 	 * to the other objects.
4017 	 */
4018 	uint32_t enable:1;
4019 	/** At least one ack was seen after the connection was established. */
4020 	uint32_t live_connection:1;
4021 	/** Enable selective ACK on this connection. */
4022 	uint32_t selective_ack:1;
4023 	/** A challenge ack has passed. */
4024 	uint32_t challenge_ack_passed:1;
4025 	/**
4026 	 * 1: The last packet is seen from the original direction.
4027 	 * 0: The last packet is seen from the reply direction.
4028 	 */
4029 	uint32_t last_direction:1;
4030 	/** No TCP check will be done except the state change. */
4031 	uint32_t liberal_mode:1;
4032 	/** The current state of this connection. */
4033 	enum rte_flow_conntrack_state state;
4034 	/** Scaling factor for maximal allowed ACK window. */
4035 	uint8_t max_ack_window;
4036 	/** Maximal allowed number of retransmission times. */
4037 	uint8_t retransmission_limit;
4038 	/** TCP parameters of the original direction. */
4039 	struct rte_flow_tcp_dir_param original_dir;
4040 	/** TCP parameters of the reply direction. */
4041 	struct rte_flow_tcp_dir_param reply_dir;
4042 	/** The window value of the last packet passed this conntrack. */
4043 	uint16_t last_window;
4044 	enum rte_flow_conntrack_tcp_last_index last_index;
4045 	/** The sequence of the last packet passed this conntrack. */
4046 	uint32_t last_seq;
4047 	/** The acknowledgment of the last packet passed this conntrack. */
4048 	uint32_t last_ack;
4049 	/**
4050 	 * The total value ACK + payload length of the last packet
4051 	 * passed this conntrack.
4052 	 */
4053 	uint32_t last_end;
4054 };
4055 
4056 /**
4057  * RTE_FLOW_ACTION_TYPE_CONNTRACK
4058  *
4059  * Wrapper structure for the context update interface.
4060  * Ports cannot support updating, and the only valid solution is to
4061  * destroy the old context and create a new one instead.
4062  */
4063 struct rte_flow_modify_conntrack {
4064 	/** New connection tracking parameters to be updated. */
4065 	struct rte_flow_action_conntrack new_ct;
4066 	/** The direction field will be updated. */
4067 	uint32_t direction:1;
4068 	/** All the other fields except direction will be updated. */
4069 	uint32_t state:1;
4070 	/** Reserved bits for the future usage. */
4071 	uint32_t reserved:30;
4072 };
4073 
4074 /**
4075  * @warning
4076  * @b EXPERIMENTAL: this structure may change without prior notice
4077  *
4078  * RTE_FLOW_ACTION_TYPE_METER_COLOR
4079  *
4080  * The meter color should be set in the packet meta-data
4081  * (i.e. struct rte_mbuf::sched::color).
4082  */
4083 struct rte_flow_action_meter_color {
4084 	enum rte_color color; /**< Packet color. */
4085 };
4086 
4087 /**
4088  * Provides an ethdev port ID for use with the following actions:
4089  * RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
4090  * RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT.
4091  */
4092 struct rte_flow_action_ethdev {
4093 	uint16_t port_id; /**< ethdev port ID */
4094 };
4095 
4096 /**
4097  * Operation types for MODIFY_FIELD action.
4098  */
4099 enum rte_flow_modify_op {
4100 	RTE_FLOW_MODIFY_SET = 0, /**< Set a new value. */
4101 	RTE_FLOW_MODIFY_ADD,     /**< Add a value to a field.  */
4102 	RTE_FLOW_MODIFY_SUB,     /**< Subtract a value from a field. */
4103 };
4104 
4105 /**
4106  * @warning
4107  * @b EXPERIMENTAL: this structure may change without prior notice
4108  *
4109  * RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
4110  *
4111  * Modify a destination header field according to the specified
4112  * operation. Another field of the packet can be used as a source as well
4113  * as tag, mark, metadata, immediate value or a pointer to it.
4114  */
4115 struct rte_flow_action_modify_field {
4116 	enum rte_flow_modify_op operation; /**< Operation to perform. */
4117 	struct rte_flow_field_data dst; /**< Destination field. */
4118 	struct rte_flow_field_data src; /**< Source field. */
4119 	uint32_t width; /**< Number of bits to use from a source field. */
4120 };
4121 
4122 /**
4123  * RTE_FLOW_ACTION_TYPE_METER_MARK
4124  *
4125  * Traffic metering and marking (MTR).
4126  *
4127  * Meters a packet stream and marks its packets either
4128  * green, yellow, or red according to the specified profile.
4129  * The policy is optional and may be specified for defining
4130  * subsequent actions based on a color assigned by MTR.
4131  * Alternatively, the METER_COLOR item may be used for this.
4132  */
4133 struct rte_flow_action_meter_mark {
4134 
4135 	/**< Profile config retrieved with rte_mtr_profile_get(). */
4136 	struct rte_flow_meter_profile *profile;
4137 	/**< Policy config retrieved with rte_mtr_policy_get(). */
4138 	struct rte_flow_meter_policy *policy;
4139 	/** Metering mode: 0 - Color-Blind, 1 - Color-Aware. */
4140 	int color_mode;
4141 	/** Metering state: 0 - Disabled, 1 - Enabled. */
4142 	int state;
4143 };
4144 
4145 /**
4146  * RTE_FLOW_ACTION_TYPE_METER_MARK
4147  *
4148  * Wrapper structure for the context update interface.
4149  */
4150 struct rte_flow_update_meter_mark {
4151 	/** New meter_mark parameters to be updated. */
4152 	struct rte_flow_action_meter_mark meter_mark;
4153 	/** The profile will be updated. */
4154 	uint32_t profile_valid:1;
4155 	/** The policy will be updated. */
4156 	uint32_t policy_valid:1;
4157 	/** The color mode will be updated. */
4158 	uint32_t color_mode_valid:1;
4159 	/** The meter state will be updated. */
4160 	uint32_t state_valid:1;
4161 	/** Reserved bits for the future usage. */
4162 	uint32_t reserved:28;
4163 };
4164 
4165 /**
4166  * @see RTE_FLOW_ACTION_TYPE_METER_MARK
4167  * @see RTE_FLOW_ACTION_TYPE_INDIRECT_LIST
4168  *
4169  * Update flow mutable context.
4170  */
4171 struct rte_flow_indirect_update_flow_meter_mark {
4172 	/** Updated init color applied to packet */
4173 	enum rte_color init_color;
4174 };
4175 
4176 /**
4177  * @warning
4178  * @b EXPERIMENTAL: this structure may change without prior notice.
4179  *
4180  * Program action argument configuration parameters.
4181  *
4182  * For each action argument, its *size* must be non-zero and its *value* must
4183  * point to a valid array of *size* bytes specified in network byte order.
4184  *
4185  * @see struct rte_flow_action_prog
4186  */
4187 struct rte_flow_action_prog_argument {
4188 	/** Argument name. */
4189 	const char *name;
4190 	/** Argument size in bytes. */
4191 	uint32_t size;
4192 	/** Argument value. */
4193 	const uint8_t *value;
4194 };
4195 
4196 /**
4197  * @warning
4198  * @b EXPERIMENTAL: this structure may change without prior notice.
4199  *
4200  * RTE_FLOW_ACTION_TYPE_PROG
4201  *
4202  * Program action configuration parameters.
4203  *
4204  * Each action can have zero or more arguments. When *args_num* is non-zero, the
4205  * *args* parameter must point to a valid array of *args_num* elements.
4206  *
4207  * @see RTE_FLOW_ACTION_TYPE_PROG
4208  */
4209 struct rte_flow_action_prog {
4210 	/** Action name. */
4211 	const char *name;
4212 	/** Number of action arguments. */
4213 	uint32_t args_num;
4214 	/** Action arguments array. */
4215 	const struct rte_flow_action_prog_argument *args;
4216 };
4217 
4218 /* Mbuf dynamic field offset for metadata. */
4219 extern int32_t rte_flow_dynf_metadata_offs;
4220 
4221 /* Mbuf dynamic field flag mask for metadata. */
4222 extern uint64_t rte_flow_dynf_metadata_mask;
4223 
4224 /* Mbuf dynamic field pointer for metadata. */
4225 #define RTE_FLOW_DYNF_METADATA(m) \
4226 	RTE_MBUF_DYNFIELD((m), rte_flow_dynf_metadata_offs, uint32_t *)
4227 
4228 /* Mbuf dynamic flags for metadata. */
4229 #define RTE_MBUF_DYNFLAG_RX_METADATA (rte_flow_dynf_metadata_mask)
4230 #define RTE_MBUF_DYNFLAG_TX_METADATA (rte_flow_dynf_metadata_mask)
4231 
4232 __rte_experimental
4233 static inline uint32_t
4234 rte_flow_dynf_metadata_get(struct rte_mbuf *m)
4235 {
4236 	return *RTE_FLOW_DYNF_METADATA(m);
4237 }
4238 
4239 __rte_experimental
4240 static inline void
4241 rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v)
4242 {
4243 	*RTE_FLOW_DYNF_METADATA(m) = v;
4244 }
4245 
4246 /**
4247  * Definition of a single action.
4248  *
4249  * A list of actions is terminated by a END action.
4250  *
4251  * For simple actions without a configuration object, conf remains NULL.
4252  */
4253 struct rte_flow_action {
4254 	enum rte_flow_action_type type; /**< Action type. */
4255 	const void *conf; /**< Pointer to action configuration object. */
4256 };
4257 
4258 /**
4259  * Opaque type returned after successfully creating a flow.
4260  *
4261  * This handle can be used to manage and query the related flow (e.g. to
4262  * destroy it or retrieve counters).
4263  */
4264 struct rte_flow;
4265 
4266 /**
4267  * Opaque type for Meter profile object returned by MTR API.
4268  *
4269  * This handle can be used to create Meter actions instead of profile ID.
4270  */
4271 struct rte_flow_meter_profile;
4272 
4273 /**
4274  * Opaque type for Meter policy object returned by MTR API.
4275  *
4276  * This handle can be used to create Meter actions instead of policy ID.
4277  */
4278 struct rte_flow_meter_policy;
4279 
4280 /**
4281  * @warning
4282  * @b EXPERIMENTAL: this structure may change without prior notice
4283  *
4284  * RTE_FLOW_ACTION_TYPE_SAMPLE
4285  *
4286  * Adds a sample action to a matched flow.
4287  *
4288  * The matching packets will be duplicated with specified ratio and applied
4289  * with own set of actions with a fate action, the sampled packet could be
4290  * redirected to queue or port. All the packets continue processing on the
4291  * default flow path.
4292  *
4293  * When the sample ratio is set to 1 then the packets will be 100% mirrored.
4294  * Additional action list be supported to add for sampled or mirrored packets.
4295  */
4296 struct rte_flow_action_sample {
4297 	uint32_t ratio; /**< packets sampled equals to '1/ratio'. */
4298 	/** sub-action list specific for the sampling hit cases. */
4299 	const struct rte_flow_action *actions;
4300 };
4301 
4302 /**
4303  * Verbose error types.
4304  *
4305  * Most of them provide the type of the object referenced by struct
4306  * rte_flow_error.cause.
4307  */
4308 enum rte_flow_error_type {
4309 	RTE_FLOW_ERROR_TYPE_NONE, /**< No error. */
4310 	RTE_FLOW_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
4311 	RTE_FLOW_ERROR_TYPE_HANDLE, /**< Flow rule (handle). */
4312 	RTE_FLOW_ERROR_TYPE_ATTR_GROUP, /**< Group field. */
4313 	RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, /**< Priority field. */
4314 	RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, /**< Ingress field. */
4315 	RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, /**< Egress field. */
4316 	RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, /**< Transfer field. */
4317 	RTE_FLOW_ERROR_TYPE_ATTR, /**< Attributes structure. */
4318 	RTE_FLOW_ERROR_TYPE_ITEM_NUM, /**< Pattern length. */
4319 	RTE_FLOW_ERROR_TYPE_ITEM_SPEC, /**< Item specification. */
4320 	RTE_FLOW_ERROR_TYPE_ITEM_LAST, /**< Item specification range. */
4321 	RTE_FLOW_ERROR_TYPE_ITEM_MASK, /**< Item specification mask. */
4322 	RTE_FLOW_ERROR_TYPE_ITEM, /**< Specific pattern item. */
4323 	RTE_FLOW_ERROR_TYPE_ACTION_NUM, /**< Number of actions. */
4324 	RTE_FLOW_ERROR_TYPE_ACTION_CONF, /**< Action configuration. */
4325 	RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */
4326 	RTE_FLOW_ERROR_TYPE_STATE, /**< Current device state. */
4327 };
4328 
4329 /**
4330  * Verbose error structure definition.
4331  *
4332  * This object is normally allocated by applications and set by PMDs, the
4333  * message points to a constant string which does not need to be freed by
4334  * the application, however its pointer can be considered valid only as long
4335  * as its associated DPDK port remains configured. Closing the underlying
4336  * device or unloading the PMD invalidates it.
4337  *
4338  * Both cause and message may be NULL regardless of the error type.
4339  */
4340 struct rte_flow_error {
4341 	enum rte_flow_error_type type; /**< Cause field and error types. */
4342 	const void *cause; /**< Object responsible for the error. */
4343 	const char *message; /**< Human-readable error message. */
4344 };
4345 
4346 /**
4347  * Complete flow rule description.
4348  *
4349  * This object type is used when converting a flow rule description.
4350  *
4351  * @see RTE_FLOW_CONV_OP_RULE
4352  * @see rte_flow_conv()
4353  */
4354 struct rte_flow_conv_rule {
4355 	union {
4356 		const struct rte_flow_attr *attr_ro; /**< RO attributes. */
4357 		struct rte_flow_attr *attr; /**< Attributes. */
4358 	};
4359 	union {
4360 		const struct rte_flow_item *pattern_ro; /**< RO pattern. */
4361 		struct rte_flow_item *pattern; /**< Pattern items. */
4362 	};
4363 	union {
4364 		const struct rte_flow_action *actions_ro; /**< RO actions. */
4365 		struct rte_flow_action *actions; /**< List of actions. */
4366 	};
4367 };
4368 
4369 /**
4370  * Conversion operations for flow API objects.
4371  *
4372  * @see rte_flow_conv()
4373  */
4374 enum rte_flow_conv_op {
4375 	/**
4376 	 * No operation to perform.
4377 	 *
4378 	 * rte_flow_conv() simply returns 0.
4379 	 */
4380 	RTE_FLOW_CONV_OP_NONE,
4381 
4382 	/**
4383 	 * Convert attributes structure.
4384 	 *
4385 	 * This is a basic copy of an attributes structure.
4386 	 *
4387 	 * - @p src type:
4388 	 *   @code const struct rte_flow_attr * @endcode
4389 	 * - @p dst type:
4390 	 *   @code struct rte_flow_attr * @endcode
4391 	 */
4392 	RTE_FLOW_CONV_OP_ATTR,
4393 
4394 	/**
4395 	 * Convert a single item.
4396 	 *
4397 	 * Duplicates @p spec, @p last and @p mask but not outside objects.
4398 	 *
4399 	 * - @p src type:
4400 	 *   @code const struct rte_flow_item * @endcode
4401 	 * - @p dst type:
4402 	 *   @code struct rte_flow_item * @endcode
4403 	 */
4404 	RTE_FLOW_CONV_OP_ITEM,
4405 
4406 	/**
4407 	 * Convert a single action.
4408 	 *
4409 	 * Duplicates @p conf but not outside objects.
4410 	 *
4411 	 * - @p src type:
4412 	 *   @code const struct rte_flow_action * @endcode
4413 	 * - @p dst type:
4414 	 *   @code struct rte_flow_action * @endcode
4415 	 */
4416 	RTE_FLOW_CONV_OP_ACTION,
4417 
4418 	/**
4419 	 * Convert an entire pattern.
4420 	 *
4421 	 * Duplicates all pattern items at once with the same constraints as
4422 	 * RTE_FLOW_CONV_OP_ITEM.
4423 	 *
4424 	 * - @p src type:
4425 	 *   @code const struct rte_flow_item * @endcode
4426 	 * - @p dst type:
4427 	 *   @code struct rte_flow_item * @endcode
4428 	 */
4429 	RTE_FLOW_CONV_OP_PATTERN,
4430 
4431 	/**
4432 	 * Convert a list of actions.
4433 	 *
4434 	 * Duplicates the entire list of actions at once with the same
4435 	 * constraints as RTE_FLOW_CONV_OP_ACTION.
4436 	 *
4437 	 * - @p src type:
4438 	 *   @code const struct rte_flow_action * @endcode
4439 	 * - @p dst type:
4440 	 *   @code struct rte_flow_action * @endcode
4441 	 */
4442 	RTE_FLOW_CONV_OP_ACTIONS,
4443 
4444 	/**
4445 	 * Convert a complete flow rule description.
4446 	 *
4447 	 * Comprises attributes, pattern and actions together at once with
4448 	 * the usual constraints.
4449 	 *
4450 	 * - @p src type:
4451 	 *   @code const struct rte_flow_conv_rule * @endcode
4452 	 * - @p dst type:
4453 	 *   @code struct rte_flow_conv_rule * @endcode
4454 	 */
4455 	RTE_FLOW_CONV_OP_RULE,
4456 
4457 	/**
4458 	 * Convert item type to its name string.
4459 	 *
4460 	 * Writes a NUL-terminated string to @p dst. Like snprintf(), the
4461 	 * returned value excludes the terminator which is always written
4462 	 * nonetheless.
4463 	 *
4464 	 * - @p src type:
4465 	 *   @code (const void *)enum rte_flow_item_type @endcode
4466 	 * - @p dst type:
4467 	 *   @code char * @endcode
4468 	 */
4469 	RTE_FLOW_CONV_OP_ITEM_NAME,
4470 
4471 	/**
4472 	 * Convert action type to its name string.
4473 	 *
4474 	 * Writes a NUL-terminated string to @p dst. Like snprintf(), the
4475 	 * returned value excludes the terminator which is always written
4476 	 * nonetheless.
4477 	 *
4478 	 * - @p src type:
4479 	 *   @code (const void *)enum rte_flow_action_type @endcode
4480 	 * - @p dst type:
4481 	 *   @code char * @endcode
4482 	 */
4483 	RTE_FLOW_CONV_OP_ACTION_NAME,
4484 
4485 	/**
4486 	 * Convert item type to pointer to item name.
4487 	 *
4488 	 * Retrieves item name pointer from its type. The string itself is
4489 	 * not copied; instead, a unique pointer to an internal static
4490 	 * constant storage is written to @p dst.
4491 	 *
4492 	 * - @p src type:
4493 	 *   @code (const void *)enum rte_flow_item_type @endcode
4494 	 * - @p dst type:
4495 	 *   @code const char ** @endcode
4496 	 */
4497 	RTE_FLOW_CONV_OP_ITEM_NAME_PTR,
4498 
4499 	/**
4500 	 * Convert action type to pointer to action name.
4501 	 *
4502 	 * Retrieves action name pointer from its type. The string itself is
4503 	 * not copied; instead, a unique pointer to an internal static
4504 	 * constant storage is written to @p dst.
4505 	 *
4506 	 * - @p src type:
4507 	 *   @code (const void *)enum rte_flow_action_type @endcode
4508 	 * - @p dst type:
4509 	 *   @code const char ** @endcode
4510 	 */
4511 	RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
4512 };
4513 
4514 /**
4515  * @warning
4516  * @b EXPERIMENTAL: this API may change without prior notice.
4517  *
4518  * Dump hardware internal representation information of
4519  * rte flow to file.
4520  *
4521  * @param[in] port_id
4522  *    The port identifier of the Ethernet device.
4523  * @param[in] flow
4524  *   The pointer of flow rule to dump. Dump all rules if NULL.
4525  * @param[in] file
4526  *   A pointer to a file for output.
4527  * @param[out] error
4528  *   Perform verbose error reporting if not NULL. PMDs initialize this
4529  *   structure in case of error only.
4530  * @return
4531  *   0 on success, a negative value otherwise.
4532  */
4533 __rte_experimental
4534 int
4535 rte_flow_dev_dump(uint16_t port_id, struct rte_flow *flow,
4536 		FILE *file, struct rte_flow_error *error);
4537 
4538 /**
4539  * Check if mbuf dynamic field for metadata is registered.
4540  *
4541  * @return
4542  *   True if registered, false otherwise.
4543  */
4544 __rte_experimental
4545 static inline int
4546 rte_flow_dynf_metadata_avail(void)
4547 {
4548 	return !!rte_flow_dynf_metadata_mask;
4549 }
4550 
4551 /**
4552  * Register mbuf dynamic field and flag for metadata.
4553  *
4554  * This function must be called prior to use SET_META action in order to
4555  * register the dynamic mbuf field. Otherwise, the data cannot be delivered to
4556  * application.
4557  *
4558  * @return
4559  *   0 on success, a negative errno value otherwise and rte_errno is set.
4560  */
4561 __rte_experimental
4562 int
4563 rte_flow_dynf_metadata_register(void);
4564 
4565 /**
4566  * Check whether a flow rule can be created on a given port.
4567  *
4568  * The flow rule is validated for correctness and whether it could be accepted
4569  * by the device given sufficient resources. The rule is checked against the
4570  * current device mode and queue configuration. The flow rule may also
4571  * optionally be validated against existing flow rules and device resources.
4572  * This function has no effect on the target device.
4573  *
4574  * The returned value is guaranteed to remain valid only as long as no
4575  * successful calls to rte_flow_create() or rte_flow_destroy() are made in
4576  * the meantime and no device parameter affecting flow rules in any way are
4577  * modified, due to possible collisions or resource limitations (although in
4578  * such cases EINVAL should not be returned).
4579  *
4580  * @param port_id
4581  *   Port identifier of Ethernet device.
4582  * @param[in] attr
4583  *   Flow rule attributes.
4584  * @param[in] pattern
4585  *   Pattern specification (list terminated by the END pattern item).
4586  * @param[in] actions
4587  *   Associated actions (list terminated by the END action).
4588  * @param[out] error
4589  *   Perform verbose error reporting if not NULL. PMDs initialize this
4590  *   structure in case of error only.
4591  *
4592  * @return
4593  *   0 if flow rule is valid and can be created. A negative errno value
4594  *   otherwise (rte_errno is also set), the following errors are defined:
4595  *
4596  *   -ENOSYS: underlying device does not support this functionality.
4597  *
4598  *   -EIO: underlying device is removed.
4599  *
4600  *   -EINVAL: unknown or invalid rule specification.
4601  *
4602  *   -ENOTSUP: valid but unsupported rule specification (e.g. partial
4603  *   bit-masks are unsupported).
4604  *
4605  *   -EEXIST: collision with an existing rule. Only returned if device
4606  *   supports flow rule collision checking and there was a flow rule
4607  *   collision. Not receiving this return code is no guarantee that creating
4608  *   the rule will not fail due to a collision.
4609  *
4610  *   -ENOMEM: not enough memory to execute the function, or if the device
4611  *   supports resource validation, resource limitation on the device.
4612  *
4613  *   -EBUSY: action cannot be performed due to busy device resources, may
4614  *   succeed if the affected queues or even the entire port are in a stopped
4615  *   state (see rte_eth_dev_rx_queue_stop() and rte_eth_dev_stop()).
4616  */
4617 int
4618 rte_flow_validate(uint16_t port_id,
4619 		  const struct rte_flow_attr *attr,
4620 		  const struct rte_flow_item pattern[],
4621 		  const struct rte_flow_action actions[],
4622 		  struct rte_flow_error *error);
4623 
4624 /**
4625  * Create a flow rule on a given port.
4626  *
4627  * @param port_id
4628  *   Port identifier of Ethernet device.
4629  * @param[in] attr
4630  *   Flow rule attributes.
4631  * @param[in] pattern
4632  *   Pattern specification (list terminated by the END pattern item).
4633  * @param[in] actions
4634  *   Associated actions (list terminated by the END action).
4635  * @param[out] error
4636  *   Perform verbose error reporting if not NULL. PMDs initialize this
4637  *   structure in case of error only.
4638  *
4639  * @return
4640  *   A valid handle in case of success, NULL otherwise and rte_errno is set
4641  *   to the positive version of one of the error codes defined for
4642  *   rte_flow_validate().
4643  */
4644 struct rte_flow *
4645 rte_flow_create(uint16_t port_id,
4646 		const struct rte_flow_attr *attr,
4647 		const struct rte_flow_item pattern[],
4648 		const struct rte_flow_action actions[],
4649 		struct rte_flow_error *error);
4650 
4651 /**
4652  * Destroy a flow rule on a given port.
4653  *
4654  * Failure to destroy a flow rule handle may occur when other flow rules
4655  * depend on it, and destroying it would result in an inconsistent state.
4656  *
4657  * This function is only guaranteed to succeed if handles are destroyed in
4658  * reverse order of their creation.
4659  *
4660  * @param port_id
4661  *   Port identifier of Ethernet device.
4662  * @param flow
4663  *   Flow rule handle to destroy.
4664  * @param[out] error
4665  *   Perform verbose error reporting if not NULL. PMDs initialize this
4666  *   structure in case of error only.
4667  *
4668  * @return
4669  *   0 on success, a negative errno value otherwise and rte_errno is set.
4670  */
4671 int
4672 rte_flow_destroy(uint16_t port_id,
4673 		 struct rte_flow *flow,
4674 		 struct rte_flow_error *error);
4675 
4676 /**
4677  * Update a flow rule with new actions on a given port.
4678  *
4679  * @param port_id
4680  *   Port identifier of Ethernet device.
4681  * @param flow
4682  *   Flow rule handle to update.
4683  * @param[in] actions
4684  *   Associated actions (list terminated by the END action).
4685  * @param[out] error
4686  *   Perform verbose error reporting if not NULL. PMDs initialize this
4687  *   structure in case of error only.
4688  *
4689  * @return
4690  *   0 on success, a negative errno value otherwise and rte_errno is set.
4691  */
4692 __rte_experimental
4693 int
4694 rte_flow_actions_update(uint16_t port_id,
4695 			struct rte_flow *flow,
4696 			const struct rte_flow_action actions[],
4697 			struct rte_flow_error *error);
4698 
4699 /**
4700  * Destroy all flow rules associated with a port.
4701  *
4702  * In the unlikely event of failure, handles are still considered destroyed
4703  * and no longer valid but the port must be assumed to be in an inconsistent
4704  * state.
4705  *
4706  * @param port_id
4707  *   Port identifier of Ethernet device.
4708  * @param[out] error
4709  *   Perform verbose error reporting if not NULL. PMDs initialize this
4710  *   structure in case of error only.
4711  *
4712  * @return
4713  *   0 on success, a negative errno value otherwise and rte_errno is set.
4714  */
4715 int
4716 rte_flow_flush(uint16_t port_id,
4717 	       struct rte_flow_error *error);
4718 
4719 /**
4720  * Query an existing flow rule.
4721  *
4722  * This function allows retrieving flow-specific data such as counters.
4723  * Data is gathered by special actions which must be present in the flow
4724  * rule definition.
4725  *
4726  * \see RTE_FLOW_ACTION_TYPE_COUNT
4727  *
4728  * @param port_id
4729  *   Port identifier of Ethernet device.
4730  * @param flow
4731  *   Flow rule handle to query.
4732  * @param action
4733  *   Action definition as defined in original flow rule.
4734  * @param[in, out] data
4735  *   Pointer to storage for the associated query data type.
4736  * @param[out] error
4737  *   Perform verbose error reporting if not NULL. PMDs initialize this
4738  *   structure in case of error only.
4739  *
4740  * @return
4741  *   0 on success, a negative errno value otherwise and rte_errno is set.
4742  */
4743 int
4744 rte_flow_query(uint16_t port_id,
4745 	       struct rte_flow *flow,
4746 	       const struct rte_flow_action *action,
4747 	       void *data,
4748 	       struct rte_flow_error *error);
4749 
4750 /**
4751  * Restrict ingress traffic to the defined flow rules.
4752  *
4753  * Isolated mode guarantees that all ingress traffic comes from defined flow
4754  * rules only (current and future).
4755  * When enabled with a bifurcated driver,
4756  * non-matched packets are routed to the kernel driver interface.
4757  * When disabled (the default),
4758  * there may be some default rules routing traffic to the DPDK port.
4759  *
4760  * Besides making ingress more deterministic, it allows PMDs to safely reuse
4761  * resources otherwise assigned to handle the remaining traffic, such as
4762  * global RSS configuration settings, VLAN filters, MAC address entries,
4763  * legacy filter API rules and so on in order to expand the set of possible
4764  * flow rule types.
4765  *
4766  * Calling this function as soon as possible after device initialization,
4767  * ideally before the first call to rte_eth_dev_configure(), is recommended
4768  * to avoid possible failures due to conflicting settings.
4769  *
4770  * Once effective, leaving isolated mode may not be possible depending on
4771  * PMD implementation.
4772  *
4773  * Additionally, the following functionality has no effect on the underlying
4774  * port and may return errors such as ENOTSUP ("not supported"):
4775  *
4776  * - Toggling promiscuous mode.
4777  * - Toggling allmulticast mode.
4778  * - Configuring MAC addresses.
4779  * - Configuring multicast addresses.
4780  * - Configuring VLAN filters.
4781  * - Configuring Rx filters through the legacy API (e.g. FDIR).
4782  * - Configuring global RSS settings.
4783  *
4784  * @param port_id
4785  *   Port identifier of Ethernet device.
4786  * @param set
4787  *   Nonzero to enter isolated mode, attempt to leave it otherwise.
4788  * @param[out] error
4789  *   Perform verbose error reporting if not NULL. PMDs initialize this
4790  *   structure in case of error only.
4791  *
4792  * @return
4793  *   0 on success, a negative errno value otherwise and rte_errno is set.
4794  */
4795 int
4796 rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
4797 
4798 /**
4799  * Initialize flow error structure.
4800  *
4801  * @param[out] error
4802  *   Pointer to flow error structure (may be NULL).
4803  * @param code
4804  *   Related error code (rte_errno).
4805  * @param type
4806  *   Cause field and error types.
4807  * @param cause
4808  *   Object responsible for the error.
4809  * @param message
4810  *   Human-readable error message.
4811  *
4812  * @return
4813  *   Negative error code (errno value) and rte_errno is set.
4814  */
4815 int
4816 rte_flow_error_set(struct rte_flow_error *error,
4817 		   int code,
4818 		   enum rte_flow_error_type type,
4819 		   const void *cause,
4820 		   const char *message);
4821 
4822 /**
4823  * @deprecated
4824  * @see rte_flow_copy()
4825  */
4826 struct rte_flow_desc {
4827 	size_t size; /**< Allocated space including data[]. */
4828 	struct rte_flow_attr attr; /**< Attributes. */
4829 	struct rte_flow_item *items; /**< Items. */
4830 	struct rte_flow_action *actions; /**< Actions. */
4831 	uint8_t data[]; /**< Storage for items/actions. */
4832 };
4833 
4834 /**
4835  * @deprecated
4836  * Copy an rte_flow rule description.
4837  *
4838  * This interface is kept for compatibility with older applications but is
4839  * implemented as a wrapper to rte_flow_conv(). It is deprecated due to its
4840  * lack of flexibility and reliance on a type unusable with C++ programs
4841  * (struct rte_flow_desc).
4842  *
4843  * @param[in] fd
4844  *   Flow rule description.
4845  * @param[in] len
4846  *   Total size of allocated data for the flow description.
4847  * @param[in] attr
4848  *   Flow rule attributes.
4849  * @param[in] items
4850  *   Pattern specification (list terminated by the END pattern item).
4851  * @param[in] actions
4852  *   Associated actions (list terminated by the END action).
4853  *
4854  * @return
4855  *   If len is greater or equal to the size of the flow, the total size of the
4856  *   flow description and its data.
4857  *   If len is lower than the size of the flow, the number of bytes that would
4858  *   have been written to desc had it been sufficient. Nothing is written.
4859  */
4860 __rte_deprecated
4861 size_t
4862 rte_flow_copy(struct rte_flow_desc *fd, size_t len,
4863 	      const struct rte_flow_attr *attr,
4864 	      const struct rte_flow_item *items,
4865 	      const struct rte_flow_action *actions);
4866 
4867 /**
4868  * Flow object conversion helper.
4869  *
4870  * This function performs conversion of various flow API objects to a
4871  * pre-allocated destination buffer. See enum rte_flow_conv_op for possible
4872  * operations and details about each of them.
4873  *
4874  * Since destination buffer must be large enough, it works in a manner
4875  * reminiscent of snprintf():
4876  *
4877  * - If @p size is 0, @p dst may be a NULL pointer, otherwise @p dst must be
4878  *   non-NULL.
4879  * - If positive, the returned value represents the number of bytes needed
4880  *   to store the conversion of @p src to @p dst according to @p op
4881  *   regardless of the @p size parameter.
4882  * - Since no more than @p size bytes can be written to @p dst, output is
4883  *   truncated and may be inconsistent when the returned value is larger
4884  *   than that.
4885  * - In case of conversion error, a negative error code is returned and
4886  *   @p dst contents are unspecified.
4887  *
4888  * @param op
4889  *   Operation to perform, related to the object type of @p dst.
4890  * @param[out] dst
4891  *   Destination buffer address. Must be suitably aligned by the caller.
4892  * @param size
4893  *   Destination buffer size in bytes.
4894  * @param[in] src
4895  *   Source object to copy. Depending on @p op, its type may differ from
4896  *   that of @p dst.
4897  * @param[out] error
4898  *   Perform verbose error reporting if not NULL. Initialized in case of
4899  *   error only.
4900  *
4901  * @return
4902  *   The number of bytes required to convert @p src to @p dst on success, a
4903  *   negative errno value otherwise and rte_errno is set.
4904  *
4905  * @see rte_flow_conv_op
4906  */
4907 __rte_experimental
4908 int
4909 rte_flow_conv(enum rte_flow_conv_op op,
4910 	      void *dst,
4911 	      size_t size,
4912 	      const void *src,
4913 	      struct rte_flow_error *error);
4914 
4915 /**
4916  * Get aged-out flows of a given port.
4917  *
4918  * RTE_ETH_EVENT_FLOW_AGED event will be triggered when at least one new aged
4919  * out flow was detected after the last call to rte_flow_get_aged_flows.
4920  * This function can be called to get the aged flows asynchronously from the
4921  * event callback or synchronously regardless the event.
4922  * This is not safe to call rte_flow_get_aged_flows function with other flow
4923  * functions from multiple threads simultaneously.
4924  *
4925  * @param port_id
4926  *   Port identifier of Ethernet device.
4927  * @param[in, out] contexts
4928  *   The address of an array of pointers to the aged-out flows contexts.
4929  * @param[in] nb_contexts
4930  *   The length of context array pointers.
4931  * @param[out] error
4932  *   Perform verbose error reporting if not NULL. Initialized in case of
4933  *   error only.
4934  *
4935  * @return
4936  *   if nb_contexts is 0, return the amount of all aged contexts.
4937  *   if nb_contexts is not 0 , return the amount of aged flows reported
4938  *   in the context array, otherwise negative errno value.
4939  *
4940  * @see rte_flow_action_age
4941  * @see RTE_ETH_EVENT_FLOW_AGED
4942  */
4943 __rte_experimental
4944 int
4945 rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
4946 			uint32_t nb_contexts, struct rte_flow_error *error);
4947 
4948 /**
4949  * @warning
4950  * @b EXPERIMENTAL: this API may change without prior notice.
4951  *
4952  * Get aged-out flows of a given port on the given flow queue.
4953  *
4954  * If application configure port attribute with RTE_FLOW_PORT_FLAG_STRICT_QUEUE,
4955  * there is no RTE_ETH_EVENT_FLOW_AGED event and this function must be called to
4956  * get the aged flows synchronously.
4957  *
4958  * If application configure port attribute without
4959  * RTE_FLOW_PORT_FLAG_STRICT_QUEUE, RTE_ETH_EVENT_FLOW_AGED event will be
4960  * triggered at least one new aged out flow was detected on any flow queue after
4961  * the last call to rte_flow_get_q_aged_flows.
4962  * In addition, the @p queue_id will be ignored.
4963  * This function can be called to get the aged flows asynchronously from the
4964  * event callback or synchronously regardless the event.
4965  *
4966  * @param[in] port_id
4967  *   Port identifier of Ethernet device.
4968  * @param[in] queue_id
4969  *   Flow queue to query. Ignored when RTE_FLOW_PORT_FLAG_STRICT_QUEUE not set.
4970  * @param[in, out] contexts
4971  *   The address of an array of pointers to the aged-out flows contexts.
4972  * @param[in] nb_contexts
4973  *   The length of context array pointers.
4974  * @param[out] error
4975  *   Perform verbose error reporting if not NULL. Initialized in case of
4976  *   error only.
4977  *
4978  * @return
4979  *   if nb_contexts is 0, return the amount of all aged contexts.
4980  *   if nb_contexts is not 0 , return the amount of aged flows reported
4981  *   in the context array, otherwise negative errno value.
4982  *
4983  * @see rte_flow_action_age
4984  * @see RTE_ETH_EVENT_FLOW_AGED
4985  * @see rte_flow_port_flag
4986  */
4987 __rte_experimental
4988 int
4989 rte_flow_get_q_aged_flows(uint16_t port_id, uint32_t queue_id, void **contexts,
4990 			  uint32_t nb_contexts, struct rte_flow_error *error);
4991 
4992 /**
4993  * Specify indirect action object configuration
4994  */
4995 struct rte_flow_indir_action_conf {
4996 	/**
4997 	 * Flow direction for the indirect action configuration.
4998 	 *
4999 	 * Action should be valid at least for one flow direction,
5000 	 * otherwise it is invalid for both ingress and egress rules.
5001 	 */
5002 	/** Action valid for rules applied to ingress traffic. */
5003 	uint32_t ingress:1;
5004 	/** Action valid for rules applied to egress traffic. */
5005 	uint32_t egress:1;
5006 	/**
5007 	 * When set to 1, indicates that the action is valid for
5008 	 * transfer traffic; otherwise, for non-transfer traffic.
5009 	 */
5010 	uint32_t transfer:1;
5011 };
5012 
5013 /**
5014  * @warning
5015  * @b EXPERIMENTAL: this API may change without prior notice.
5016  *
5017  * Create an indirect action object that can be used in flow rules
5018  * via its handle.
5019  * The created object handle has single state and configuration
5020  * across all the flow rules using it.
5021  *
5022  * @param[in] port_id
5023  *    The port identifier of the Ethernet device.
5024  * @param[in] conf
5025  *   Action configuration for the indirect action object creation.
5026  * @param[in] action
5027  *   Specific configuration of the indirect action object.
5028  * @param[out] error
5029  *   Perform verbose error reporting if not NULL. PMDs initialize this
5030  *   structure in case of error only.
5031  * @return
5032  *   A valid handle in case of success, NULL otherwise and rte_errno is set
5033  *   to one of the error codes defined:
5034  *   - (ENODEV) if *port_id* invalid.
5035  *   - (ENOSYS) if underlying device does not support this functionality.
5036  *   - (EIO) if underlying device is removed.
5037  *   - (EINVAL) if *action* invalid.
5038  *   - (ENOTSUP) if *action* valid but unsupported.
5039  */
5040 __rte_experimental
5041 struct rte_flow_action_handle *
5042 rte_flow_action_handle_create(uint16_t port_id,
5043 			      const struct rte_flow_indir_action_conf *conf,
5044 			      const struct rte_flow_action *action,
5045 			      struct rte_flow_error *error);
5046 
5047 /**
5048  * @warning
5049  * @b EXPERIMENTAL: this API may change without prior notice.
5050  *
5051  * Destroy indirect action by handle.
5052  *
5053  * @param[in] port_id
5054  *    The port identifier of the Ethernet device.
5055  * @param[in] handle
5056  *   Handle for the indirect action object to be destroyed.
5057  * @param[out] error
5058  *   Perform verbose error reporting if not NULL. PMDs initialize this
5059  *   structure in case of error only.
5060  * @return
5061  *   - (0) if success.
5062  *   - (-ENODEV) if *port_id* invalid.
5063  *   - (-ENOSYS) if underlying device does not support this functionality.
5064  *   - (-EIO) if underlying device is removed.
5065  *   - (-ENOENT) if action pointed by *action* handle was not found.
5066  *   - (-EBUSY) if action pointed by *action* handle still used by some rules
5067  *   rte_errno is also set.
5068  */
5069 __rte_experimental
5070 int
5071 rte_flow_action_handle_destroy(uint16_t port_id,
5072 			       struct rte_flow_action_handle *handle,
5073 			       struct rte_flow_error *error);
5074 
5075 /**
5076  * @warning
5077  * @b EXPERIMENTAL: this API may change without prior notice.
5078  *
5079  * Update in-place the action configuration and / or state pointed
5080  * by action *handle* with the configuration provided as *update* argument.
5081  * The update of the action configuration effects all flow rules reusing
5082  * the action via *handle*.
5083  * The update general pointer provides the ability of partial updating.
5084  *
5085  * @param[in] port_id
5086  *    The port identifier of the Ethernet device.
5087  * @param[in] handle
5088  *   Handle for the indirect action object to be updated.
5089  * @param[in] update
5090  *   Update profile specification used to modify the action pointed by handle.
5091  *   *update* could be with the same type of the immediate action corresponding
5092  *   to the *handle* argument when creating, or a wrapper structure includes
5093  *   action configuration to be updated and bit fields to indicate the member
5094  *   of fields inside the action to update.
5095  * @param[out] error
5096  *   Perform verbose error reporting if not NULL. PMDs initialize this
5097  *   structure in case of error only.
5098  * @return
5099  *   - (0) if success.
5100  *   - (-ENODEV) if *port_id* invalid.
5101  *   - (-ENOSYS) if underlying device does not support this functionality.
5102  *   - (-EIO) if underlying device is removed.
5103  *   - (-EINVAL) if *update* invalid.
5104  *   - (-ENOTSUP) if *update* valid but unsupported.
5105  *   - (-ENOENT) if indirect action object pointed by *handle* was not found.
5106  *   rte_errno is also set.
5107  */
5108 __rte_experimental
5109 int
5110 rte_flow_action_handle_update(uint16_t port_id,
5111 			      struct rte_flow_action_handle *handle,
5112 			      const void *update,
5113 			      struct rte_flow_error *error);
5114 
5115 /**
5116  * @warning
5117  * @b EXPERIMENTAL: this API may change without prior notice.
5118  *
5119  * Query the direct action by corresponding indirect action object handle.
5120  *
5121  * Retrieve action-specific data such as counters.
5122  * Data is gathered by special action which may be present/referenced in
5123  * more than one flow rule definition.
5124  *
5125  * @see RTE_FLOW_ACTION_TYPE_COUNT
5126  *
5127  * @param port_id
5128  *   Port identifier of Ethernet device.
5129  * @param[in] handle
5130  *   Handle for the action object to query.
5131  * @param[in, out] data
5132  *   Pointer to storage for the associated query data type.
5133  * @param[out] error
5134  *   Perform verbose error reporting if not NULL. PMDs initialize this
5135  *   structure in case of error only.
5136  *
5137  * @return
5138  *   0 on success, a negative errno value otherwise and rte_errno is set.
5139  */
5140 __rte_experimental
5141 int
5142 rte_flow_action_handle_query(uint16_t port_id,
5143 			     const struct rte_flow_action_handle *handle,
5144 			     void *data, struct rte_flow_error *error);
5145 
5146 /* Tunnel has a type and the key information. */
5147 struct rte_flow_tunnel {
5148 	/**
5149 	 * Tunnel type, for example RTE_FLOW_ITEM_TYPE_VXLAN,
5150 	 * RTE_FLOW_ITEM_TYPE_NVGRE etc.
5151 	 */
5152 	enum rte_flow_item_type	type;
5153 	uint64_t tun_id; /**< Tunnel identification. */
5154 
5155 	union {
5156 		struct {
5157 			rte_be32_t src_addr; /**< IPv4 source address. */
5158 			rte_be32_t dst_addr; /**< IPv4 destination address. */
5159 		} ipv4;
5160 		struct {
5161 			uint8_t src_addr[16]; /**< IPv6 source address. */
5162 			uint8_t dst_addr[16]; /**< IPv6 destination address. */
5163 		} ipv6;
5164 	};
5165 	rte_be16_t tp_src; /**< Tunnel port source. */
5166 	rte_be16_t tp_dst; /**< Tunnel port destination. */
5167 	uint16_t   tun_flags; /**< Tunnel flags. */
5168 
5169 	bool       is_ipv6; /**< True for valid IPv6 fields. Otherwise IPv4. */
5170 
5171 	/**
5172 	 * the following members are required to restore packet
5173 	 * after miss
5174 	 */
5175 	uint8_t    tos; /**< TOS for IPv4, TC for IPv6. */
5176 	uint8_t    ttl; /**< TTL for IPv4, HL for IPv6. */
5177 	uint32_t label; /**< Flow Label for IPv6. */
5178 };
5179 
5180 /**
5181  * Indicate that the packet has a tunnel.
5182  */
5183 #define RTE_FLOW_RESTORE_INFO_TUNNEL RTE_BIT64(0)
5184 
5185 /**
5186  * Indicate that the packet has a non decapsulated tunnel header.
5187  */
5188 #define RTE_FLOW_RESTORE_INFO_ENCAPSULATED RTE_BIT64(1)
5189 
5190 /**
5191  * Indicate that the packet has a group_id.
5192  */
5193 #define RTE_FLOW_RESTORE_INFO_GROUP_ID RTE_BIT64(2)
5194 
5195 /**
5196  * Restore information structure to communicate the current packet processing
5197  * state when some of the processing pipeline is done in hardware and should
5198  * continue in software.
5199  */
5200 struct rte_flow_restore_info {
5201 	/**
5202 	 * Bitwise flags (RTE_FLOW_RESTORE_INFO_*) to indicate validation of
5203 	 * other fields in struct rte_flow_restore_info.
5204 	 */
5205 	uint64_t flags;
5206 	uint32_t group_id; /**< Group ID where packed missed */
5207 	struct rte_flow_tunnel tunnel; /**< Tunnel information. */
5208 };
5209 
5210 /**
5211  * Allocate an array of actions to be used in rte_flow_create, to implement
5212  * tunnel-decap-set for the given tunnel.
5213  * Sample usage:
5214  *   actions vxlan_decap / tunnel-decap-set(tunnel properties) /
5215  *            jump group 0 / end
5216  *
5217  * @param port_id
5218  *   Port identifier of Ethernet device.
5219  * @param[in] tunnel
5220  *   Tunnel properties.
5221  * @param[out] actions
5222  *   Array of actions to be allocated by the PMD. This array should be
5223  *   concatenated with the actions array provided to rte_flow_create.
5224  * @param[out] num_of_actions
5225  *   Number of actions allocated.
5226  * @param[out] error
5227  *   Perform verbose error reporting if not NULL. PMDs initialize this
5228  *   structure in case of error only.
5229  *
5230  * @return
5231  *   0 on success, a negative errno value otherwise and rte_errno is set.
5232  */
5233 __rte_experimental
5234 int
5235 rte_flow_tunnel_decap_set(uint16_t port_id,
5236 			  struct rte_flow_tunnel *tunnel,
5237 			  struct rte_flow_action **actions,
5238 			  uint32_t *num_of_actions,
5239 			  struct rte_flow_error *error);
5240 
5241 /**
5242  * Allocate an array of items to be used in rte_flow_create, to implement
5243  * tunnel-match for the given tunnel.
5244  * Sample usage:
5245  *   pattern tunnel-match(tunnel properties) / outer-header-matches /
5246  *           inner-header-matches / end
5247  *
5248  * @param port_id
5249  *   Port identifier of Ethernet device.
5250  * @param[in] tunnel
5251  *   Tunnel properties.
5252  * @param[out] items
5253  *   Array of items to be allocated by the PMD. This array should be
5254  *   concatenated with the items array provided to rte_flow_create.
5255  * @param[out] num_of_items
5256  *   Number of items allocated.
5257  * @param[out] error
5258  *   Perform verbose error reporting if not NULL. PMDs initialize this
5259  *   structure in case of error only.
5260  *
5261  * @return
5262  *   0 on success, a negative errno value otherwise and rte_errno is set.
5263  */
5264 __rte_experimental
5265 int
5266 rte_flow_tunnel_match(uint16_t port_id,
5267 		      struct rte_flow_tunnel *tunnel,
5268 		      struct rte_flow_item **items,
5269 		      uint32_t *num_of_items,
5270 		      struct rte_flow_error *error);
5271 
5272 /**
5273  * On reception of a mbuf from HW, a call to rte_flow_get_restore_info() may be
5274  * required to retrieve some metadata.
5275  * This function returns the associated mbuf ol_flags.
5276  *
5277  * Note: the dynamic flag is registered during a call to
5278  * rte_eth_rx_metadata_negotiate() with RTE_ETH_RX_METADATA_TUNNEL_ID.
5279  *
5280  * @return
5281  *   The offload flag indicating rte_flow_get_restore_info() must be called.
5282  */
5283 __rte_experimental
5284 uint64_t
5285 rte_flow_restore_info_dynflag(void);
5286 
5287 /**
5288  * If a mbuf contains the rte_flow_restore_info_dynflag() flag in ol_flags,
5289  * populate the current packet processing state.
5290  *
5291  * One should negotiate tunnel metadata delivery from the NIC to the HW.
5292  * @see rte_eth_rx_metadata_negotiate()
5293  * @see RTE_ETH_RX_METADATA_TUNNEL_ID
5294  *
5295  * @param port_id
5296  *   Port identifier of Ethernet device.
5297  * @param[in] m
5298  *   Mbuf struct.
5299  * @param[out] info
5300  *   Restore information. Upon success contains the HW state.
5301  * @param[out] error
5302  *   Perform verbose error reporting if not NULL. PMDs initialize this
5303  *   structure in case of error only.
5304  *
5305  * @return
5306  *   0 on success, a negative errno value otherwise and rte_errno is set.
5307  */
5308 __rte_experimental
5309 int
5310 rte_flow_get_restore_info(uint16_t port_id,
5311 			  struct rte_mbuf *m,
5312 			  struct rte_flow_restore_info *info,
5313 			  struct rte_flow_error *error);
5314 
5315 /**
5316  * Release the action array as allocated by rte_flow_tunnel_decap_set.
5317  *
5318  * @param port_id
5319  *   Port identifier of Ethernet device.
5320  * @param[in] actions
5321  *   Array of actions to be released.
5322  * @param[in] num_of_actions
5323  *   Number of elements in actions array.
5324  * @param[out] error
5325  *   Perform verbose error reporting if not NULL. PMDs initialize this
5326  *   structure in case of error only.
5327  *
5328  * @return
5329  *   0 on success, a negative errno value otherwise and rte_errno is set.
5330  */
5331 __rte_experimental
5332 int
5333 rte_flow_tunnel_action_decap_release(uint16_t port_id,
5334 				     struct rte_flow_action *actions,
5335 				     uint32_t num_of_actions,
5336 				     struct rte_flow_error *error);
5337 
5338 /**
5339  * Release the item array as allocated by rte_flow_tunnel_match.
5340  *
5341  * @param port_id
5342  *   Port identifier of Ethernet device.
5343  * @param[in] items
5344  *   Array of items to be released.
5345  * @param[in] num_of_items
5346  *   Number of elements in item array.
5347  * @param[out] error
5348  *   Perform verbose error reporting if not NULL. PMDs initialize this
5349  *   structure in case of error only.
5350  *
5351  * @return
5352  *   0 on success, a negative errno value otherwise and rte_errno is set.
5353  */
5354 __rte_experimental
5355 int
5356 rte_flow_tunnel_item_release(uint16_t port_id,
5357 			     struct rte_flow_item *items,
5358 			     uint32_t num_of_items,
5359 			     struct rte_flow_error *error);
5360 
5361 /**
5362  * Get a proxy port to manage "transfer" flows.
5363  *
5364  * Managing "transfer" flows requires that the user communicate them
5365  * via a port which has the privilege to control the embedded switch.
5366  * For some vendors, all ports in a given switching domain have
5367  * this privilege. For other vendors, it's only one port.
5368  *
5369  * This API indicates such a privileged port (a "proxy")
5370  * for a given port in the same switching domain.
5371  *
5372  * @note
5373  *   If the PMD serving @p port_id doesn't have the corresponding method
5374  *   implemented, the API will return @p port_id via @p proxy_port_id.
5375  *
5376  * @param port_id
5377  *   Indicates the port to get a "proxy" for
5378  * @param[out] proxy_port_id
5379  *   Indicates the "proxy" port
5380  * @param[out] error
5381  *   If not NULL, allows the PMD to provide verbose report in case of error
5382  *
5383  * @return
5384  *   0 on success, a negative error code otherwise
5385  */
5386 int
5387 rte_flow_pick_transfer_proxy(uint16_t port_id, uint16_t *proxy_port_id,
5388 			     struct rte_flow_error *error);
5389 
5390 /**
5391  * @warning
5392  * @b EXPERIMENTAL: this API may change without prior notice.
5393  *
5394  * Create the flex item with specified configuration over
5395  * the Ethernet device.
5396  *
5397  * @param port_id
5398  *   Port identifier of Ethernet device.
5399  * @param[in] conf
5400  *   Item configuration.
5401  * @param[out] error
5402  *   Perform verbose error reporting if not NULL. PMDs initialize this
5403  *   structure in case of error only.
5404  *
5405  * @return
5406  *   Non-NULL opaque pointer on success, NULL otherwise and rte_errno is set.
5407  */
5408 __rte_experimental
5409 struct rte_flow_item_flex_handle *
5410 rte_flow_flex_item_create(uint16_t port_id,
5411 			  const struct rte_flow_item_flex_conf *conf,
5412 			  struct rte_flow_error *error);
5413 
5414 /**
5415  * Release the flex item on the specified Ethernet device.
5416  *
5417  * @param port_id
5418  *   Port identifier of Ethernet device.
5419  * @param[in] handle
5420  *   Handle of the item existing on the specified device.
5421  * @param[out] error
5422  *   Perform verbose error reporting if not NULL. PMDs initialize this
5423  *   structure in case of error only.
5424  *
5425  * @return
5426  *   0 on success, a negative errno value otherwise and rte_errno is set.
5427  */
5428 __rte_experimental
5429 int
5430 rte_flow_flex_item_release(uint16_t port_id,
5431 			   const struct rte_flow_item_flex_handle *handle,
5432 			   struct rte_flow_error *error);
5433 
5434 /**
5435  * Indicate all operations for a given flow rule will _strictly_
5436  * happen on the same queue (create/destroy/query/update).
5437  */
5438 #define RTE_FLOW_PORT_FLAG_STRICT_QUEUE RTE_BIT32(0)
5439 
5440 /**
5441  * Indicate all steering objects should be created on contexts
5442  * of the host port, providing indirect object sharing between
5443  * ports.
5444  */
5445 #define RTE_FLOW_PORT_FLAG_SHARE_INDIRECT RTE_BIT32(1)
5446 
5447 /**
5448  * @warning
5449  * @b EXPERIMENTAL: this API may change without prior notice.
5450  *
5451  * Information about flow engine resources.
5452  * The zero value means a resource is not supported.
5453  */
5454 struct rte_flow_port_info {
5455 	/**
5456 	 * Maximum number of queues for asynchronous operations.
5457 	 */
5458 	uint32_t max_nb_queues;
5459 	/**
5460 	 * Maximum number of counters.
5461 	 * @see RTE_FLOW_ACTION_TYPE_COUNT
5462 	 */
5463 	uint32_t max_nb_counters;
5464 	/**
5465 	 * Maximum number of aging objects.
5466 	 * @see RTE_FLOW_ACTION_TYPE_AGE
5467 	 */
5468 	uint32_t max_nb_aging_objects;
5469 	/**
5470 	 * Maximum number traffic meters.
5471 	 * @see RTE_FLOW_ACTION_TYPE_METER
5472 	 */
5473 	uint32_t max_nb_meters;
5474 	/**
5475 	 * Maximum number connection trackings.
5476 	 * @see RTE_FLOW_ACTION_TYPE_CONNTRACK
5477 	 */
5478 	uint32_t max_nb_conn_tracks;
5479 	/**
5480 	 * Maximum number of quota actions.
5481 	 * @see RTE_FLOW_ACTION_TYPE_QUOTA
5482 	 */
5483 	uint32_t max_nb_quotas;
5484 	/**
5485 	 * Port supported flags (RTE_FLOW_PORT_FLAG_*).
5486 	 */
5487 	uint32_t supported_flags;
5488 };
5489 
5490 /**
5491  * @warning
5492  * @b EXPERIMENTAL: this API may change without prior notice.
5493  *
5494  * Information about flow engine asynchronous queues.
5495  * The value only valid if @p port_attr.max_nb_queues is not zero.
5496  */
5497 struct rte_flow_queue_info {
5498 	/**
5499 	 * Maximum number of operations a queue can hold.
5500 	 */
5501 	uint32_t max_size;
5502 };
5503 
5504 /**
5505  * @warning
5506  * @b EXPERIMENTAL: this API may change without prior notice.
5507  *
5508  * Get information about flow engine resources.
5509  *
5510  * @param port_id
5511  *   Port identifier of Ethernet device.
5512  * @param[out] port_info
5513  *   A pointer to a structure of type *rte_flow_port_info*
5514  *   to be filled with the resources information of the port.
5515  * @param[out] queue_info
5516  *   A pointer to a structure of type *rte_flow_queue_info*
5517  *   to be filled with the asynchronous queues information.
5518  * @param[out] error
5519  *   Perform verbose error reporting if not NULL.
5520  *   PMDs initialize this structure in case of error only.
5521  *
5522  * @return
5523  *   0 on success, a negative errno value otherwise and rte_errno is set.
5524  */
5525 __rte_experimental
5526 int
5527 rte_flow_info_get(uint16_t port_id,
5528 		  struct rte_flow_port_info *port_info,
5529 		  struct rte_flow_queue_info *queue_info,
5530 		  struct rte_flow_error *error);
5531 
5532 /**
5533  * @warning
5534  * @b EXPERIMENTAL: this API may change without prior notice.
5535  *
5536  * Flow engine resources settings.
5537  * The zero value means on demand resource allocations only.
5538  */
5539 struct rte_flow_port_attr {
5540 	/**
5541 	 * Number of counters to configure.
5542 	 * @see RTE_FLOW_ACTION_TYPE_COUNT
5543 	 */
5544 	uint32_t nb_counters;
5545 	/**
5546 	 * Number of aging objects to configure.
5547 	 * @see RTE_FLOW_ACTION_TYPE_AGE
5548 	 */
5549 	uint32_t nb_aging_objects;
5550 	/**
5551 	 * Number of traffic meters to configure.
5552 	 * @see RTE_FLOW_ACTION_TYPE_METER
5553 	 */
5554 	uint32_t nb_meters;
5555 	/**
5556 	 * Number of connection trackings to configure.
5557 	 * @see RTE_FLOW_ACTION_TYPE_CONNTRACK
5558 	 */
5559 	uint32_t nb_conn_tracks;
5560 	/**
5561 	 * Port to base shared objects on.
5562 	 */
5563 	uint16_t host_port_id;
5564 	/**
5565 	 * Maximum number of quota actions.
5566 	 * @see RTE_FLOW_ACTION_TYPE_QUOTA
5567 	 */
5568 	uint32_t nb_quotas;
5569 	/**
5570 	 * Port flags (RTE_FLOW_PORT_FLAG_*).
5571 	 */
5572 	uint32_t flags;
5573 };
5574 
5575 /**
5576  * @warning
5577  * @b EXPERIMENTAL: this API may change without prior notice.
5578  *
5579  * Flow engine asynchronous queues settings.
5580  * The value means default value picked by PMD.
5581  */
5582 struct rte_flow_queue_attr {
5583 	/**
5584 	 * Number of flow rule operations a queue can hold.
5585 	 */
5586 	uint32_t size;
5587 };
5588 
5589 /**
5590  * @warning
5591  * @b EXPERIMENTAL: this API may change without prior notice.
5592  *
5593  * Configure the port's flow API engine.
5594  *
5595  * This API can only be invoked before the application
5596  * starts using the rest of the flow library functions.
5597  *
5598  * The API can be invoked multiple times to change the settings.
5599  * The port, however, may reject changes and keep the old config.
5600  *
5601  * Parameters in configuration attributes must not exceed
5602  * numbers of resources returned by the rte_flow_info_get API.
5603  *
5604  * @param port_id
5605  *   Port identifier of Ethernet device.
5606  * @param[in] port_attr
5607  *   Port configuration attributes.
5608  * @param[in] nb_queue
5609  *   Number of flow queues to be configured.
5610  * @param[in] queue_attr
5611  *   Array that holds attributes for each flow queue.
5612  *   Number of elements is set in @p port_attr.nb_queues.
5613  * @param[out] error
5614  *   Perform verbose error reporting if not NULL.
5615  *   PMDs initialize this structure in case of error only.
5616  *
5617  * @return
5618  *   0 on success, a negative errno value otherwise and rte_errno is set.
5619  */
5620 __rte_experimental
5621 int
5622 rte_flow_configure(uint16_t port_id,
5623 		   const struct rte_flow_port_attr *port_attr,
5624 		   uint16_t nb_queue,
5625 		   const struct rte_flow_queue_attr *queue_attr[],
5626 		   struct rte_flow_error *error);
5627 
5628 /**
5629  * Opaque type returned after successful creation of pattern template.
5630  * This handle can be used to manage the created pattern template.
5631  */
5632 struct rte_flow_pattern_template;
5633 
5634 /**
5635  * @warning
5636  * @b EXPERIMENTAL: this API may change without prior notice.
5637  *
5638  * Flow pattern template attributes.
5639  */
5640 __extension__
5641 struct rte_flow_pattern_template_attr {
5642 	/**
5643 	 * Relaxed matching policy.
5644 	 * - If 1, matching is performed only on items with the mask member set
5645 	 * and matching on protocol layers specified without any masks is skipped.
5646 	 * - If 0, matching on protocol layers specified without any masks is done
5647 	 * as well. This is the standard behaviour of Flow API now.
5648 	 */
5649 	uint32_t relaxed_matching:1;
5650 	/**
5651 	 * Flow direction for the pattern template.
5652 	 * At least one direction must be specified.
5653 	 */
5654 	/** Pattern valid for rules applied to ingress traffic. */
5655 	uint32_t ingress:1;
5656 	/** Pattern valid for rules applied to egress traffic. */
5657 	uint32_t egress:1;
5658 	/** Pattern valid for rules applied to transfer traffic. */
5659 	uint32_t transfer:1;
5660 };
5661 
5662 /**
5663  * @warning
5664  * @b EXPERIMENTAL: this API may change without prior notice.
5665  *
5666  * Create flow pattern template.
5667  *
5668  * The pattern template defines common matching fields without values.
5669  * For example, matching on 5 tuple TCP flow, the template will be
5670  * eth(null) + IPv4(source + dest) + TCP(s_port + d_port),
5671  * while values for each rule will be set during the flow rule creation.
5672  * The number and order of items in the template must be the same
5673  * at the rule creation.
5674  *
5675  * @param port_id
5676  *   Port identifier of Ethernet device.
5677  * @param[in] template_attr
5678  *   Pattern template attributes.
5679  * @param[in] pattern
5680  *   Pattern specification (list terminated by the END pattern item).
5681  *   The spec member of an item is not used unless the end member is used.
5682  * @param[out] error
5683  *   Perform verbose error reporting if not NULL.
5684  *   PMDs initialize this structure in case of error only.
5685  *
5686  * @return
5687  *   Handle on success, NULL otherwise and rte_errno is set.
5688  */
5689 __rte_experimental
5690 struct rte_flow_pattern_template *
5691 rte_flow_pattern_template_create(uint16_t port_id,
5692 		const struct rte_flow_pattern_template_attr *template_attr,
5693 		const struct rte_flow_item pattern[],
5694 		struct rte_flow_error *error);
5695 
5696 /**
5697  * @warning
5698  * @b EXPERIMENTAL: this API may change without prior notice.
5699  *
5700  * Destroy flow pattern template.
5701  *
5702  * This function may be called only when
5703  * there are no more tables referencing this template.
5704  *
5705  * @param port_id
5706  *   Port identifier of Ethernet device.
5707  * @param[in] pattern_template
5708  *   Handle of the template to be destroyed.
5709  * @param[out] error
5710  *   Perform verbose error reporting if not NULL.
5711  *   PMDs initialize this structure in case of error only.
5712  *
5713  * @return
5714  *   0 on success, a negative errno value otherwise and rte_errno is set.
5715  */
5716 __rte_experimental
5717 int
5718 rte_flow_pattern_template_destroy(uint16_t port_id,
5719 		struct rte_flow_pattern_template *pattern_template,
5720 		struct rte_flow_error *error);
5721 
5722 /**
5723  * Opaque type returned after successful creation of actions template.
5724  * This handle can be used to manage the created actions template.
5725  */
5726 struct rte_flow_actions_template;
5727 
5728 /**
5729  * @warning
5730  * @b EXPERIMENTAL: this API may change without prior notice.
5731  *
5732  * Flow actions template attributes.
5733  */
5734 __extension__
5735 struct rte_flow_actions_template_attr {
5736 	/**
5737 	 * Flow direction for the actions template.
5738 	 * At least one direction must be specified.
5739 	 */
5740 	/** Action valid for rules applied to ingress traffic. */
5741 	uint32_t ingress:1;
5742 	/** Action valid for rules applied to egress traffic. */
5743 	uint32_t egress:1;
5744 	/** Action valid for rules applied to transfer traffic. */
5745 	uint32_t transfer:1;
5746 };
5747 
5748 /**
5749  * @warning
5750  * @b EXPERIMENTAL: this API may change without prior notice.
5751  *
5752  * Create flow actions template.
5753  *
5754  * The actions template holds a list of action types without values.
5755  * For example, the template to change TCP ports is TCP(s_port + d_port),
5756  * while values for each rule will be set during the flow rule creation.
5757  * The number and order of actions in the template must be the same
5758  * at the rule creation.
5759  *
5760  * @param port_id
5761  *   Port identifier of Ethernet device.
5762  * @param[in] template_attr
5763  *   Template attributes.
5764  * @param[in] actions
5765  *   Associated actions (list terminated by the END action).
5766  *   The spec member is only used if @p masks spec is non-zero.
5767  * @param[in] masks
5768  *   List of actions that marks which of the action's member is constant.
5769  *   A mask has the same format as the corresponding action.
5770  *   If the action field in @p masks is not 0,
5771  *   the corresponding value in an action from @p actions will be the part
5772  *   of the template and used in all flow rules.
5773  *   The order of actions in @p masks is the same as in @p actions.
5774  *   In case of indirect actions present in @p actions,
5775  *   the actual action type should be present in @p mask.
5776  * @param[out] error
5777  *   Perform verbose error reporting if not NULL.
5778  *   PMDs initialize this structure in case of error only.
5779  *
5780  * @return
5781  *   Handle on success, NULL otherwise and rte_errno is set.
5782  */
5783 __rte_experimental
5784 struct rte_flow_actions_template *
5785 rte_flow_actions_template_create(uint16_t port_id,
5786 		const struct rte_flow_actions_template_attr *template_attr,
5787 		const struct rte_flow_action actions[],
5788 		const struct rte_flow_action masks[],
5789 		struct rte_flow_error *error);
5790 
5791 /**
5792  * @warning
5793  * @b EXPERIMENTAL: this API may change without prior notice.
5794  *
5795  * Destroy flow actions template.
5796  *
5797  * This function may be called only when
5798  * there are no more tables referencing this template.
5799  *
5800  * @param port_id
5801  *   Port identifier of Ethernet device.
5802  * @param[in] actions_template
5803  *   Handle to the template to be destroyed.
5804  * @param[out] error
5805  *   Perform verbose error reporting if not NULL.
5806  *   PMDs initialize this structure in case of error only.
5807  *
5808  * @return
5809  *   0 on success, a negative errno value otherwise and rte_errno is set.
5810  */
5811 __rte_experimental
5812 int
5813 rte_flow_actions_template_destroy(uint16_t port_id,
5814 		struct rte_flow_actions_template *actions_template,
5815 		struct rte_flow_error *error);
5816 
5817 /**
5818  * Opaque type returned after successful creation of a template table.
5819  * This handle can be used to manage the created template table.
5820  */
5821 struct rte_flow_template_table;
5822 
5823 /**@{@name Flags for template table attribute.
5824  * Each bit is an optional hint for table specialization,
5825  * offering a potential optimization at driver layer.
5826  * The driver can ignore the hints silently.
5827  * The hints do not replace any matching criteria.
5828  */
5829 /**
5830  * Specialize table for transfer flows which come only from wire.
5831  * It allows PMD not to allocate resources for non-wire originated traffic.
5832  * This bit is not a matching criteria, just an optimization hint.
5833  * Flow rules which match non-wire originated traffic will be missed
5834  * if the hint is supported.
5835  */
5836 #define RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG RTE_BIT32(0)
5837 /**
5838  * Specialize table for transfer flows which come only from vport (e.g. VF, SF).
5839  * It allows PMD not to allocate resources for non-vport originated traffic.
5840  * This bit is not a matching criteria, just an optimization hint.
5841  * Flow rules which match non-vport originated traffic will be missed
5842  * if the hint is supported.
5843  */
5844 #define RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG RTE_BIT32(1)
5845 /**
5846  * Specialize table for resize.
5847  */
5848 #define RTE_FLOW_TABLE_SPECIALIZE_RESIZABLE RTE_BIT32(2)
5849 /**@}*/
5850 
5851 /**
5852  * @warning
5853  * @b EXPERIMENTAL: this API may change without prior notice.
5854  *
5855  * Template table flow rules insertion type.
5856  */
5857 enum rte_flow_table_insertion_type {
5858 	/**
5859 	 * Pattern-based insertion.
5860 	 */
5861 	RTE_FLOW_TABLE_INSERTION_TYPE_PATTERN,
5862 	/**
5863 	 * Index-based insertion.
5864 	 */
5865 	RTE_FLOW_TABLE_INSERTION_TYPE_INDEX,
5866 };
5867 
5868 /**
5869  * @warning
5870  * @b EXPERIMENTAL: this API may change without prior notice.
5871  *
5872  * Template table hash index calculation function.
5873  */
5874 enum rte_flow_table_hash_func {
5875 	/**
5876 	 * Default hash calculation.
5877 	 */
5878 	RTE_FLOW_TABLE_HASH_FUNC_DEFAULT,
5879 	/**
5880 	 * Linear hash calculation.
5881 	 */
5882 	RTE_FLOW_TABLE_HASH_FUNC_LINEAR,
5883 	/**
5884 	 * 32-bit checksum hash calculation.
5885 	 */
5886 	RTE_FLOW_TABLE_HASH_FUNC_CRC32,
5887 	/**
5888 	 * 16-bit checksum hash calculation.
5889 	 */
5890 	RTE_FLOW_TABLE_HASH_FUNC_CRC16,
5891 };
5892 
5893 /**
5894  * @warning
5895  * @b EXPERIMENTAL: this API may change without prior notice.
5896  *
5897  * Table attributes.
5898  */
5899 struct rte_flow_template_table_attr {
5900 	/**
5901 	 * Flow attributes to be used in each rule generated from this table.
5902 	 */
5903 	struct rte_flow_attr flow_attr;
5904 	/**
5905 	 * Maximum number of flow rules that this table holds.
5906 	 */
5907 	uint32_t nb_flows;
5908 	/**
5909 	 * Optional hint flags for driver optimization.
5910 	 * The effect may vary in the different drivers.
5911 	 * The functionality must not rely on the hints.
5912 	 * Value is composed with RTE_FLOW_TABLE_SPECIALIZE_* based on application
5913 	 * design choices.
5914 	 * Misused hints may mislead the driver, it may result in an undefined behavior.
5915 	 */
5916 	uint32_t specialize;
5917 	/**
5918 	 * Insertion type for flow rules.
5919 	 */
5920 	enum rte_flow_table_insertion_type insertion_type;
5921 	/**
5922 	 * Hash calculation function for the packet matching.
5923 	 */
5924 	enum rte_flow_table_hash_func hash_func;
5925 };
5926 
5927 /**
5928  * @warning
5929  * @b EXPERIMENTAL: this API may change without prior notice.
5930  *
5931  * Query whether a table can be resized.
5932  *
5933  * @param port_id
5934  *   Port identifier of Ethernet device.
5935  * @param tbl_attr
5936  *   Template table.
5937  *
5938  * @return
5939  *   True if the table can be resized.
5940  */
5941 __rte_experimental
5942 bool
5943 rte_flow_template_table_resizable(__rte_unused uint16_t port_id,
5944 		const struct rte_flow_template_table_attr *tbl_attr);
5945 
5946 /**
5947  * @warning
5948  * @b EXPERIMENTAL: this API may change without prior notice.
5949  *
5950  * Create flow template table.
5951  *
5952  * A template table consists of multiple pattern templates and actions
5953  * templates associated with a single set of rule attributes (group ID,
5954  * priority and traffic direction).
5955  *
5956  * Each rule is free to use any combination of pattern and actions templates
5957  * and specify particular values for items and actions it would like to change.
5958  *
5959  * @param port_id
5960  *   Port identifier of Ethernet device.
5961  * @param[in] table_attr
5962  *   Template table attributes.
5963  * @param[in] pattern_templates
5964  *   Array of pattern templates to be used in this table.
5965  * @param[in] nb_pattern_templates
5966  *   The number of pattern templates in the pattern_templates array.
5967  * @param[in] actions_templates
5968  *   Array of actions templates to be used in this table.
5969  * @param[in] nb_actions_templates
5970  *   The number of actions templates in the actions_templates array.
5971  * @param[out] error
5972  *   Perform verbose error reporting if not NULL.
5973  *   PMDs initialize this structure in case of error only.
5974  *
5975  * @return
5976  *   Handle on success, NULL otherwise and rte_errno is set.
5977  */
5978 __rte_experimental
5979 struct rte_flow_template_table *
5980 rte_flow_template_table_create(uint16_t port_id,
5981 		const struct rte_flow_template_table_attr *table_attr,
5982 		struct rte_flow_pattern_template *pattern_templates[],
5983 		uint8_t nb_pattern_templates,
5984 		struct rte_flow_actions_template *actions_templates[],
5985 		uint8_t nb_actions_templates,
5986 		struct rte_flow_error *error);
5987 
5988 /**
5989  * @warning
5990  * @b EXPERIMENTAL: this API may change without prior notice.
5991  *
5992  * Destroy flow template table.
5993  *
5994  * This function may be called only when
5995  * there are no more flow rules referencing this table.
5996  *
5997  * @param port_id
5998  *   Port identifier of Ethernet device.
5999  * @param[in] template_table
6000  *   Handle to the table to be destroyed.
6001  * @param[out] error
6002  *   Perform verbose error reporting if not NULL.
6003  *   PMDs initialize this structure in case of error only.
6004  *
6005  * @return
6006  *   0 on success, a negative errno value otherwise and rte_errno is set.
6007  */
6008 __rte_experimental
6009 int
6010 rte_flow_template_table_destroy(uint16_t port_id,
6011 		struct rte_flow_template_table *template_table,
6012 		struct rte_flow_error *error);
6013 
6014 /**
6015  * @warning
6016  * @b EXPERIMENTAL: this API may change without prior notice.
6017  *
6018  * Set group miss actions.
6019  *
6020  * @param port_id
6021  *   Port identifier of Ethernet device.
6022  * @param group_id
6023  *   Identifier of a group to set miss actions for.
6024  * @param attr
6025  *   Group attributes.
6026  * @param actions
6027  *   List of group miss actions.
6028  * @param[out] error
6029  *   Perform verbose error reporting if not NULL.
6030  *   PMDs initialize this structure in case of error only.
6031  *
6032  * @return
6033  *   0 on success, a negative errno value otherwise and rte_errno is set.
6034  */
6035 __rte_experimental
6036 int
6037 rte_flow_group_set_miss_actions(uint16_t port_id,
6038 				uint32_t group_id,
6039 				const struct rte_flow_group_attr *attr,
6040 				const struct rte_flow_action actions[],
6041 				struct rte_flow_error *error);
6042 
6043 /**
6044  * @warning
6045  * @b EXPERIMENTAL: this API may change without prior notice.
6046  *
6047  * Asynchronous operation attributes.
6048  */
6049 __extension__
6050 struct rte_flow_op_attr {
6051 	/**
6052 	 * When set, the requested action will not be sent to the HW immediately.
6053 	 * The application must call the rte_flow_queue_push to actually send it.
6054 	 */
6055 	uint32_t postpone:1;
6056 };
6057 
6058 /**
6059  * @warning
6060  * @b EXPERIMENTAL: this API may change without prior notice.
6061  *
6062  * Enqueue rule creation operation.
6063  *
6064  * @param port_id
6065  *   Port identifier of Ethernet device.
6066  * @param queue_id
6067  *   Flow queue used to insert the rule.
6068  * @param[in] op_attr
6069  *   Rule creation operation attributes.
6070  * @param[in] template_table
6071  *   Template table to select templates from.
6072  * @param[in] pattern
6073  *   List of pattern items to be used.
6074  *   The list order should match the order in the pattern template.
6075  *   The spec is the only relevant member of the item that is being used.
6076  * @param[in] pattern_template_index
6077  *   Pattern template index in the table.
6078  * @param[in] actions
6079  *   List of actions to be used.
6080  *   The list order should match the order in the actions template.
6081  * @param[in] actions_template_index
6082  *   Actions template index in the table.
6083  * @param[in] user_data
6084  *   The user data that will be returned on the completion events.
6085  * @param[out] error
6086  *   Perform verbose error reporting if not NULL.
6087  *   PMDs initialize this structure in case of error only.
6088  *
6089  * @return
6090  *   Handle on success, NULL otherwise and rte_errno is set.
6091  *   The rule handle doesn't mean that the rule has been populated.
6092  *   Only completion result indicates that if there was success or failure.
6093  */
6094 __rte_experimental
6095 struct rte_flow *
6096 rte_flow_async_create(uint16_t port_id,
6097 		      uint32_t queue_id,
6098 		      const struct rte_flow_op_attr *op_attr,
6099 		      struct rte_flow_template_table *template_table,
6100 		      const struct rte_flow_item pattern[],
6101 		      uint8_t pattern_template_index,
6102 		      const struct rte_flow_action actions[],
6103 		      uint8_t actions_template_index,
6104 		      void *user_data,
6105 		      struct rte_flow_error *error);
6106 
6107 /**
6108  * @warning
6109  * @b EXPERIMENTAL: this API may change without prior notice.
6110  *
6111  * Enqueue rule creation operation.
6112  *
6113  * @param port_id
6114  *   Port identifier of Ethernet device.
6115  * @param queue_id
6116  *   Flow queue used to insert the rule.
6117  * @param[in] op_attr
6118  *   Rule creation operation attributes.
6119  * @param[in] template_table
6120  *   Template table to select templates from.
6121  * @param[in] rule_index
6122  *   Rule index in the table.
6123  * @param[in] actions
6124  *   List of actions to be used.
6125  *   The list order should match the order in the actions template.
6126  * @param[in] actions_template_index
6127  *   Actions template index in the table.
6128  * @param[in] user_data
6129  *   The user data that will be returned on the completion events.
6130  * @param[out] error
6131  *   Perform verbose error reporting if not NULL.
6132  *   PMDs initialize this structure in case of error only.
6133  *
6134  * @return
6135  *   Handle on success, NULL otherwise and rte_errno is set.
6136  *   The rule handle doesn't mean that the rule has been populated.
6137  *   Only completion result indicates that if there was success or failure.
6138  */
6139 __rte_experimental
6140 struct rte_flow *
6141 rte_flow_async_create_by_index(uint16_t port_id,
6142 			       uint32_t queue_id,
6143 			       const struct rte_flow_op_attr *op_attr,
6144 			       struct rte_flow_template_table *template_table,
6145 			       uint32_t rule_index,
6146 			       const struct rte_flow_action actions[],
6147 			       uint8_t actions_template_index,
6148 			       void *user_data,
6149 			       struct rte_flow_error *error);
6150 
6151 /**
6152  * @warning
6153  * @b EXPERIMENTAL: this API may change without prior notice.
6154  *
6155  * Enqueue rule destruction operation.
6156  *
6157  * This function enqueues a destruction operation on the queue.
6158  * Application should assume that after calling this function
6159  * the rule handle is not valid anymore.
6160  * Completion indicates the full removal of the rule from the HW.
6161  *
6162  * @param port_id
6163  *   Port identifier of Ethernet device.
6164  * @param queue_id
6165  *   Flow queue which is used to destroy the rule.
6166  *   This must match the queue on which the rule was created.
6167  * @param[in] op_attr
6168  *   Rule destruction operation attributes.
6169  * @param[in] flow
6170  *   Flow handle to be destroyed.
6171  * @param[in] user_data
6172  *   The user data that will be returned on the completion events.
6173  * @param[out] error
6174  *   Perform verbose error reporting if not NULL.
6175  *   PMDs initialize this structure in case of error only.
6176  *
6177  * @return
6178  *   0 on success, a negative errno value otherwise and rte_errno is set.
6179  */
6180 __rte_experimental
6181 int
6182 rte_flow_async_destroy(uint16_t port_id,
6183 		       uint32_t queue_id,
6184 		       const struct rte_flow_op_attr *op_attr,
6185 		       struct rte_flow *flow,
6186 		       void *user_data,
6187 		       struct rte_flow_error *error);
6188 
6189 /**
6190  * @warning
6191  * @b EXPERIMENTAL: this API may change without prior notice.
6192  *
6193  * Enqueue rule update operation.
6194  *
6195  * @param port_id
6196  *   Port identifier of Ethernet device.
6197  * @param queue_id
6198  *   Flow queue used to insert the rule.
6199  * @param[in] op_attr
6200  *   Rule creation operation attributes.
6201  * @param[in] flow
6202  *   Flow rule to be updated.
6203  * @param[in] actions
6204  *   List of actions to be used.
6205  *   The list order should match the order in the actions template.
6206  * @param[in] actions_template_index
6207  *   Actions template index in the table.
6208  * @param[in] user_data
6209  *   The user data that will be returned on the completion events.
6210  * @param[out] error
6211  *   Perform verbose error reporting if not NULL.
6212  *   PMDs initialize this structure in case of error only.
6213  *
6214  * @return
6215  *   0 on success, a negative errno value otherwise and rte_errno is set.
6216  */
6217 __rte_experimental
6218 int
6219 rte_flow_async_actions_update(uint16_t port_id,
6220 			      uint32_t queue_id,
6221 			      const struct rte_flow_op_attr *op_attr,
6222 			      struct rte_flow *flow,
6223 			      const struct rte_flow_action actions[],
6224 			      uint8_t actions_template_index,
6225 			      void *user_data,
6226 			      struct rte_flow_error *error);
6227 
6228 /**
6229  * @warning
6230  * @b EXPERIMENTAL: this API may change without prior notice.
6231  *
6232  * Push all internally stored rules to the HW.
6233  * Postponed rules are rules that were inserted with the postpone flag set.
6234  * Can be used to notify the HW about batch of rules prepared by the SW to
6235  * reduce the number of communications between the HW and SW.
6236  *
6237  * @param port_id
6238  *   Port identifier of Ethernet device.
6239  * @param queue_id
6240  *   Flow queue to be pushed.
6241  * @param[out] error
6242  *   Perform verbose error reporting if not NULL.
6243  *   PMDs initialize this structure in case of error only.
6244  *
6245  * @return
6246  *   0 on success, a negative errno value otherwise and rte_errno is set.
6247  */
6248 __rte_experimental
6249 int
6250 rte_flow_push(uint16_t port_id,
6251 	      uint32_t queue_id,
6252 	      struct rte_flow_error *error);
6253 
6254 /**
6255  * @warning
6256  * @b EXPERIMENTAL: this API may change without prior notice.
6257  *
6258  * Asynchronous operation status.
6259  */
6260 enum rte_flow_op_status {
6261 	/**
6262 	 * The operation was completed successfully.
6263 	 */
6264 	RTE_FLOW_OP_SUCCESS,
6265 	/**
6266 	 * The operation was not completed successfully.
6267 	 */
6268 	RTE_FLOW_OP_ERROR,
6269 };
6270 
6271 /**
6272  * @warning
6273  * @b EXPERIMENTAL: this API may change without prior notice.
6274  *
6275  * Asynchronous operation result.
6276  */
6277 __extension__
6278 struct rte_flow_op_result {
6279 	/**
6280 	 * Returns the status of the operation that this completion signals.
6281 	 */
6282 	enum rte_flow_op_status status;
6283 	/**
6284 	 * The user data that will be returned on the completion events.
6285 	 */
6286 	void *user_data;
6287 };
6288 
6289 /**
6290  * @warning
6291  * @b EXPERIMENTAL: this API may change without prior notice.
6292  *
6293  * Pull a rte flow operation.
6294  * The application must invoke this function in order to complete
6295  * the flow rule offloading and to retrieve the flow rule operation status.
6296  *
6297  * @param port_id
6298  *   Port identifier of Ethernet device.
6299  * @param queue_id
6300  *   Flow queue which is used to pull the operation.
6301  * @param[out] res
6302  *   Array of results that will be set.
6303  * @param[in] n_res
6304  *   Maximum number of results that can be returned.
6305  *   This value is equal to the size of the res array.
6306  * @param[out] error
6307  *   Perform verbose error reporting if not NULL.
6308  *   PMDs initialize this structure in case of error only.
6309  *
6310  * @return
6311  *   Number of results that were pulled,
6312  *   a negative errno value otherwise and rte_errno is set.
6313  */
6314 __rte_experimental
6315 int
6316 rte_flow_pull(uint16_t port_id,
6317 	      uint32_t queue_id,
6318 	      struct rte_flow_op_result res[],
6319 	      uint16_t n_res,
6320 	      struct rte_flow_error *error);
6321 
6322 /**
6323  * @warning
6324  * @b EXPERIMENTAL: this API may change without prior notice.
6325  *
6326  * Enqueue indirect action creation operation.
6327  * @see rte_flow_action_handle_create
6328  *
6329  * @param[in] port_id
6330  *   Port identifier of Ethernet device.
6331  * @param[in] queue_id
6332  *   Flow queue which is used to create the rule.
6333  * @param[in] op_attr
6334  *   Indirect action creation operation attributes.
6335  * @param[in] indir_action_conf
6336  *   Action configuration for the indirect action object creation.
6337  * @param[in] action
6338  *   Specific configuration of the indirect action object.
6339  * @param[in] user_data
6340  *   The user data that will be returned on the completion events.
6341  * @param[out] error
6342  *   Perform verbose error reporting if not NULL.
6343  *   PMDs initialize this structure in case of error only.
6344  *
6345  * @return
6346  *   A valid handle in case of success, NULL otherwise and rte_errno is set.
6347  */
6348 __rte_experimental
6349 struct rte_flow_action_handle *
6350 rte_flow_async_action_handle_create(uint16_t port_id,
6351 		uint32_t queue_id,
6352 		const struct rte_flow_op_attr *op_attr,
6353 		const struct rte_flow_indir_action_conf *indir_action_conf,
6354 		const struct rte_flow_action *action,
6355 		void *user_data,
6356 		struct rte_flow_error *error);
6357 
6358 /**
6359  * @warning
6360  * @b EXPERIMENTAL: this API may change without prior notice.
6361  *
6362  * Enqueue indirect action destruction operation.
6363  * The destroy queue must be the same
6364  * as the queue on which the action was created.
6365  *
6366  * @param[in] port_id
6367  *   Port identifier of Ethernet device.
6368  * @param[in] queue_id
6369  *   Flow queue which is used to destroy the rule.
6370  * @param[in] op_attr
6371  *   Indirect action destruction operation attributes.
6372  * @param[in] action_handle
6373  *   Handle for the indirect action object to be destroyed.
6374  * @param[in] user_data
6375  *   The user data that will be returned on the completion events.
6376  * @param[out] error
6377  *   Perform verbose error reporting if not NULL.
6378  *   PMDs initialize this structure in case of error only.
6379  *
6380  * @return
6381  *   0 on success, a negative errno value otherwise and rte_errno is set.
6382  */
6383 __rte_experimental
6384 int
6385 rte_flow_async_action_handle_destroy(uint16_t port_id,
6386 		uint32_t queue_id,
6387 		const struct rte_flow_op_attr *op_attr,
6388 		struct rte_flow_action_handle *action_handle,
6389 		void *user_data,
6390 		struct rte_flow_error *error);
6391 
6392 /**
6393  * @warning
6394  * @b EXPERIMENTAL: this API may change without prior notice.
6395  *
6396  * Enqueue indirect action update operation.
6397  * @see rte_flow_action_handle_create
6398  *
6399  * @param[in] port_id
6400  *   Port identifier of Ethernet device.
6401  * @param[in] queue_id
6402  *   Flow queue which is used to update the rule.
6403  * @param[in] op_attr
6404  *   Indirect action update operation attributes.
6405  * @param[in] action_handle
6406  *   Handle for the indirect action object to be updated.
6407  * @param[in] update
6408  *   Update profile specification used to modify the action pointed by handle.
6409  *   *update* could be with the same type of the immediate action corresponding
6410  *   to the *handle* argument when creating, or a wrapper structure includes
6411  *   action configuration to be updated and bit fields to indicate the member
6412  *   of fields inside the action to update.
6413  * @param[in] user_data
6414  *   The user data that will be returned on the completion events.
6415  * @param[out] error
6416  *   Perform verbose error reporting if not NULL.
6417  *   PMDs initialize this structure in case of error only.
6418  *
6419  * @return
6420  *   0 on success, a negative errno value otherwise and rte_errno is set.
6421  */
6422 __rte_experimental
6423 int
6424 rte_flow_async_action_handle_update(uint16_t port_id,
6425 		uint32_t queue_id,
6426 		const struct rte_flow_op_attr *op_attr,
6427 		struct rte_flow_action_handle *action_handle,
6428 		const void *update,
6429 		void *user_data,
6430 		struct rte_flow_error *error);
6431 
6432 /**
6433  * @warning
6434  * @b EXPERIMENTAL: this API may change without prior notice.
6435  *
6436  * Enqueue indirect action query operation.
6437  *
6438  * Retrieve action-specific data such as counters.
6439  * Data is gathered by special action which may be present/referenced in
6440  * more than one flow rule definition.
6441  * Data will be available only when completion event returns.
6442  *
6443  * @see rte_flow_async_action_handle_query
6444  *
6445  * @param port_id
6446  *   Port identifier of Ethernet device.
6447  * @param[in] queue_id
6448  *   Flow queue which is used to query the action.
6449  * @param[in] op_attr
6450  *   Indirect action update operation attributes.
6451  * @param[in] action_handle
6452  *   Handle for the action object to query.
6453  * @param[in, out] data
6454  *   Pointer to storage for the associated query data type.
6455  *   The out data will be available only when completion event returns
6456  *   from rte_flow_pull.
6457  * @param[in] user_data
6458  *   The user data that will be returned on the completion events.
6459  * @param[out] error
6460  *   Perform verbose error reporting if not NULL. PMDs initialize this
6461  *   structure in case of error only.
6462  *
6463  * @return
6464  *   0 on success, a negative errno value otherwise and rte_errno is set.
6465  */
6466 __rte_experimental
6467 int
6468 rte_flow_async_action_handle_query(uint16_t port_id,
6469 		uint32_t queue_id,
6470 		const struct rte_flow_op_attr *op_attr,
6471 		const struct rte_flow_action_handle *action_handle,
6472 		void *data,
6473 		void *user_data,
6474 		struct rte_flow_error *error);
6475 
6476 /**
6477  * @warning
6478  * @b EXPERIMENTAL: this API may change without prior notice.
6479  *
6480  * Query and update operational mode.
6481  *
6482  * @see rte_flow_action_handle_query_update()
6483  * @see rte_flow_async_action_handle_query_update()
6484  */
6485 enum rte_flow_query_update_mode {
6486 	RTE_FLOW_QU_QUERY_FIRST = 1,  /**< Query before update. */
6487 	RTE_FLOW_QU_UPDATE_FIRST,     /**< Query after  update. */
6488 };
6489 
6490 /**
6491  * @warning
6492  * @b EXPERIMENTAL: this API may change without prior notice.
6493  *
6494  * Query and/or update indirect flow action.
6495  * If both query and update not NULL, the function atomically
6496  * queries and updates indirect action. Query and update are carried in order
6497  * specified in the mode parameter.
6498  * If ether query or update is NULL, the function executes
6499  * complementing operation.
6500  *
6501  * @param port_id
6502  *   Port identifier of Ethernet device.
6503  * @param handle
6504  *   Handle for the indirect action object to be updated.
6505  * @param update
6506  *   If not NULL, update profile specification used to modify the action
6507  *   pointed by handle.
6508  * @param query
6509  *   If not NULL pointer to storage for the associated query data type.
6510  * @param mode
6511  *   Operational mode.
6512  * @param error
6513  *   Perform verbose error reporting if not NULL.
6514  *   PMDs initialize this structure in case of error only.
6515  *
6516  * @return
6517  * 0 on success, a negative errno value otherwise and rte_errno is set.
6518  * - (-ENODEV) if *port_id* invalid.
6519  * - (-ENOTSUP) if underlying device does not support this functionality.
6520  * - (-EINVAL) if *handle* or *mode* invalid or
6521  *             both *query* and *update* are NULL.
6522  */
6523 __rte_experimental
6524 int
6525 rte_flow_action_handle_query_update(uint16_t port_id,
6526 				    struct rte_flow_action_handle *handle,
6527 				    const void *update, void *query,
6528 				    enum rte_flow_query_update_mode mode,
6529 				    struct rte_flow_error *error);
6530 
6531 /**
6532  * @warning
6533  * @b EXPERIMENTAL: this API may change without prior notice.
6534  *
6535  * Enqueue async indirect flow action query and/or update
6536  *
6537  * @param port_id
6538  *   Port identifier of Ethernet device.
6539  * @param queue_id
6540  *   Flow queue which is used to update the rule.
6541  * @param attr
6542  *   Indirect action update operation attributes.
6543  * @param handle
6544  *   Handle for the indirect action object to be updated.
6545  * @param update
6546  *   If not NULL, update profile specification used to modify the action
6547  *   pointed by handle.
6548  * @param query
6549  *   If not NULL, pointer to storage for the associated query data type.
6550  *   Query result returned on async completion event.
6551  * @param mode
6552  *   Operational mode.
6553  * @param user_data
6554  *   The user data that will be returned on async completion event.
6555  * @param error
6556  *   Perform verbose error reporting if not NULL.
6557  *   PMDs initialize this structure in case of error only.
6558  *
6559  * @return
6560  *   0 on success, a negative errno value otherwise and rte_errno is set.
6561  * - (-ENODEV) if *port_id* invalid.
6562  * - (-ENOTSUP) if underlying device does not support this functionality.
6563  * - (-EINVAL) if *handle* or *mode* invalid or
6564  *             both *update* and *query* are NULL.
6565  */
6566 __rte_experimental
6567 int
6568 rte_flow_async_action_handle_query_update(uint16_t port_id, uint32_t queue_id,
6569 					  const struct rte_flow_op_attr *attr,
6570 					  struct rte_flow_action_handle *handle,
6571 					  const void *update, void *query,
6572 					  enum rte_flow_query_update_mode mode,
6573 					  void *user_data,
6574 					  struct rte_flow_error *error);
6575 
6576 struct rte_flow_action_list_handle;
6577 
6578 /**
6579  * @warning
6580  * @b EXPERIMENTAL: this API may change without prior notice.
6581  *
6582  * Configure INDIRECT_LIST flow action.
6583  *
6584  * @see RTE_FLOW_ACTION_TYPE_INDIRECT_LIST
6585  */
6586 struct rte_flow_action_indirect_list {
6587 	/** Indirect action list handle */
6588 	struct rte_flow_action_list_handle *handle;
6589 	/**
6590 	 * Flow mutable configuration array.
6591 	 * NULL if the handle has no flow mutable configuration update.
6592 	 * Otherwise, if the handle was created with list A1 / A2 .. An / END
6593 	 * size of conf is n.
6594 	 * conf[i] points to flow mutable update of Ai in the handle
6595 	 * actions list or NULL if Ai has no update.
6596 	 */
6597 	const void **conf;
6598 };
6599 
6600 /**
6601  * @warning
6602  * @b EXPERIMENTAL: this API may change without prior notice.
6603  *
6604  * Create an indirect flow action object from flow actions list.
6605  * The object is identified by a unique handle.
6606  * The handle has single state and configuration
6607  * across all the flow rules using it.
6608  *
6609  * @param[in] port_id
6610  *    The port identifier of the Ethernet device.
6611  * @param[in] conf
6612  *   Action configuration for the indirect action list creation.
6613  * @param[in] actions
6614  *   Specific configuration of the indirect action lists.
6615  * @param[out] error
6616  *   Perform verbose error reporting if not NULL. PMDs initialize this
6617  *   structure in case of error only.
6618  * @return
6619  *   A valid handle in case of success, NULL otherwise and rte_errno is set
6620  *   to one of the error codes defined:
6621  *   - (-ENODEV) if *port_id* invalid.
6622  *   - (-ENOSYS) if underlying device does not support this functionality.
6623  *   - (-EIO) if underlying device is removed.
6624  *   - (-EINVAL) if *actions* list invalid.
6625  *   - (-ENOTSUP) if *action* list element valid but unsupported.
6626  */
6627 __rte_experimental
6628 struct rte_flow_action_list_handle *
6629 rte_flow_action_list_handle_create(uint16_t port_id,
6630 				   const
6631 				   struct rte_flow_indir_action_conf *conf,
6632 				   const struct rte_flow_action *actions,
6633 				   struct rte_flow_error *error);
6634 
6635 /**
6636  * @warning
6637  * @b EXPERIMENTAL: this API may change without prior notice.
6638  *
6639  * Async function call to create an indirect flow action object
6640  * from flow actions list.
6641  * The object is identified by a unique handle.
6642  * The handle has single state and configuration
6643  * across all the flow rules using it.
6644  *
6645  * @param[in] port_id
6646  *    The port identifier of the Ethernet device.
6647  * @param[in] queue_id
6648  *   Flow queue which is used to update the rule.
6649  * @param[in] attr
6650  *   Indirect action update operation attributes.
6651  * @param[in] conf
6652  *   Action configuration for the indirect action list creation.
6653  * @param[in] actions
6654  *   Specific configuration of the indirect action list.
6655  * @param[in] user_data
6656  *   The user data that will be returned on async completion event.
6657  * @param[out] error
6658  *   Perform verbose error reporting if not NULL. PMDs initialize this
6659  *   structure in case of error only.
6660  * @return
6661  *   A valid handle in case of success, NULL otherwise and rte_errno is set
6662  *   to one of the error codes defined:
6663  *   - (-ENODEV) if *port_id* invalid.
6664  *   - (-ENOSYS) if underlying device does not support this functionality.
6665  *   - (-EIO) if underlying device is removed.
6666  *   - (-EINVAL) if *actions* list invalid.
6667  *   - (-ENOTSUP) if *action* list element valid but unsupported.
6668  */
6669 __rte_experimental
6670 struct rte_flow_action_list_handle *
6671 rte_flow_async_action_list_handle_create(uint16_t port_id, uint32_t queue_id,
6672 					 const struct rte_flow_op_attr *attr,
6673 					 const struct rte_flow_indir_action_conf *conf,
6674 					 const struct rte_flow_action *actions,
6675 					 void *user_data,
6676 					 struct rte_flow_error *error);
6677 
6678 /**
6679  * @warning
6680  * @b EXPERIMENTAL: this API may change without prior notice.
6681  *
6682  * Destroy indirect actions list by handle.
6683  *
6684  * @param[in] port_id
6685  *    The port identifier of the Ethernet device.
6686  * @param[in] handle
6687  *   Handle for the indirect actions list to be destroyed.
6688  * @param[out] error
6689  *   Perform verbose error reporting if not NULL. PMDs initialize this
6690  *   structure in case of error only.
6691  * @return
6692  *   - (0) if success.
6693  *   - (-ENODEV) if *port_id* invalid.
6694  *   - (-ENOSYS) if underlying device does not support this functionality.
6695  *   - (-EIO) if underlying device is removed.
6696  *   - (-ENOENT) if actions list pointed by *action* handle was not found.
6697  *   - (-EBUSY) if actions list pointed by *action* handle still used
6698  */
6699 __rte_experimental
6700 int
6701 rte_flow_action_list_handle_destroy(uint16_t port_id,
6702 				    struct rte_flow_action_list_handle *handle,
6703 				    struct rte_flow_error *error);
6704 
6705 /**
6706  * @warning
6707  * @b EXPERIMENTAL: this API may change without prior notice.
6708  *
6709  * Enqueue indirect action list destruction operation.
6710  * The destroy queue must be the same
6711  * as the queue on which the action was created.
6712  *
6713  * @param[in] port_id
6714  *   Port identifier of Ethernet device.
6715  * @param[in] queue_id
6716  *   Flow queue which is used to destroy the rule.
6717  * @param[in] op_attr
6718  *   Indirect action destruction operation attributes.
6719  * @param[in] handle
6720  *   Handle for the indirect action object to be destroyed.
6721  * @param[in] user_data
6722  *   The user data that will be returned on the completion events.
6723  * @param[out] error
6724  *   Perform verbose error reporting if not NULL.
6725  *   PMDs initialize this structure in case of error only.
6726  *
6727  * @return
6728  *   - (0) if success.
6729  *   - (-ENODEV) if *port_id* invalid.
6730  *   - (-ENOSYS) if underlying device does not support this functionality.
6731  *   - (-EIO) if underlying device is removed.
6732  *   - (-ENOENT) if actions list pointed by *action* handle was not found.
6733  *   - (-EBUSY) if actions list pointed by *action* handle still used
6734  */
6735 __rte_experimental
6736 int
6737 rte_flow_async_action_list_handle_destroy
6738 		(uint16_t port_id, uint32_t queue_id,
6739 		 const struct rte_flow_op_attr *op_attr,
6740 		 struct rte_flow_action_list_handle *handle,
6741 		 void *user_data, struct rte_flow_error *error);
6742 
6743 /**
6744  * @warning
6745  * @b EXPERIMENTAL: this API may change without prior notice.
6746  *
6747  * Query and/or update indirect flow actions list.
6748  * If both query and update not NULL, the function atomically
6749  * queries and updates indirect action. Query and update are carried in order
6750  * specified in the mode parameter.
6751  * If ether query or update is NULL, the function executes
6752  * complementing operation.
6753  *
6754  * @param port_id
6755  *   Port identifier of Ethernet device.
6756  * @param handle
6757  *   Handle for the indirect actions list object to be updated.
6758  * @param update
6759  *   If the action list handle was created from n actions A1 / A2 ... An / END
6760  *   non-NULL update parameter is an array [U1, U2, ... Un] where Ui points to
6761  *   Ai update context or NULL if Ai should not be updated.
6762  * @param query
6763  *   If the action list handle was created from n actions A1 / A2 ... An / END
6764  *   non-NULL query parameter is an array [Q1, Q2, ... Qn] where Qi points to
6765  *   Ai query context or NULL if Ai should not be queried.
6766  * @param mode
6767  *   Operational mode.
6768  * @param error
6769  *   Perform verbose error reporting if not NULL.
6770  *   PMDs initialize this structure in case of error only.
6771  *
6772  * @return
6773  *   - (0) if success.
6774  * - (-ENODEV) if *port_id* invalid.
6775  * - (-ENOTSUP) if underlying device does not support this functionality.
6776  * - (-EINVAL) if *handle* or *mode* invalid or
6777  *             both *query* and *update* are NULL.
6778  */
6779 __rte_experimental
6780 int
6781 rte_flow_action_list_handle_query_update(uint16_t port_id,
6782 					 const struct rte_flow_action_list_handle *handle,
6783 					 const void **update, void **query,
6784 					 enum rte_flow_query_update_mode mode,
6785 					 struct rte_flow_error *error);
6786 
6787 /**
6788  * @warning
6789  * @b EXPERIMENTAL: this API may change without prior notice.
6790  *
6791  * Enqueue async indirect flow actions list query and/or update
6792  * If both query and update not NULL, the function atomically
6793  * queries and updates indirect action. Query and update are carried in order
6794  * specified in the mode parameter.
6795  * If ether query or update is NULL, the function executes
6796  * complementing operation.
6797  *
6798  * @param port_id
6799  *   Port identifier of Ethernet device.
6800  * @param queue_id
6801  *   Flow queue which is used to update the rule.
6802  * @param attr
6803  *   Indirect action update operation attributes.
6804  * @param handle
6805  *   Handle for the indirect actions list object to be updated.
6806  * @param update
6807  *   If the action list handle was created from n actions A1 / A2 ... An / END
6808  *   non-NULL update parameter is an array [U1, U2, ... Un] where Ui points to
6809  *   Ai update context or NULL if Ai should not be updated.
6810  * @param query
6811  *   If the action list handle was created from n actions A1 / A2 ... An / END
6812  *   non-NULL query parameter is an array [Q1, Q2, ... Qn] where Qi points to
6813  *   Ai query context or NULL if Ai should not be queried.
6814  *   Query result returned on async completion event.
6815  * @param mode
6816  *   Operational mode.
6817  * @param user_data
6818  *   The user data that will be returned on async completion event.
6819  * @param error
6820  *   Perform verbose error reporting if not NULL.
6821  *   PMDs initialize this structure in case of error only.
6822  *
6823  * @return
6824  *   - (0) if success.
6825  * - (-ENODEV) if *port_id* invalid.
6826  * - (-ENOTSUP) if underlying device does not support this functionality.
6827  * - (-EINVAL) if *handle* or *mode* invalid or
6828  *             both *update* and *query* are NULL.
6829  */
6830 __rte_experimental
6831 int
6832 rte_flow_async_action_list_handle_query_update(uint16_t port_id, uint32_t queue_id,
6833 					  const struct rte_flow_op_attr *attr,
6834 					  const struct rte_flow_action_list_handle *handle,
6835 					  const void **update, void **query,
6836 					  enum rte_flow_query_update_mode mode,
6837 					  void *user_data,
6838 					  struct rte_flow_error *error);
6839 
6840 /**
6841  * @warning
6842  * @b EXPERIMENTAL: this API may change without prior notice.
6843  *
6844  * Calculate the hash for a given pattern in a given table as
6845  * calculated by the HW.
6846  *
6847  * @param port_id
6848  *   Port identifier of Ethernet device.
6849  * @param table
6850  *   The table the SW wishes to simulate.
6851  * @param pattern
6852  *   The values to be used in the hash calculation.
6853  * @param pattern_template_index
6854  *   The pattern index in the table to be used for the calculation.
6855  * @param hash
6856  *   Used to return the calculated hash.
6857  * @param error
6858  *   Perform verbose error reporting if not NULL.
6859  *   PMDs initialize this structure in case of error only.
6860  *
6861  * @return
6862  *   - (0) if success.
6863  *   - (-ENODEV) if *port_id* invalid.
6864  *   - (-ENOTSUP) if underlying device does not support this functionality.
6865  */
6866 __rte_experimental
6867 int
6868 rte_flow_calc_table_hash(uint16_t port_id, const struct rte_flow_template_table *table,
6869 			 const struct rte_flow_item pattern[], uint8_t pattern_template_index,
6870 			 uint32_t *hash, struct rte_flow_error *error);
6871 
6872 /**
6873  * @warning
6874  * @b EXPERIMENTAL: this API may change without prior notice.
6875  *
6876  * Destination field type for the hash calculation, when encap action is used.
6877  * The encap field implies the size, meaning XXX_SRC_PORT hash len is 2 bytes,
6878  * while XXX_NVGRE_FLOW_ID hash len is 1 byte.
6879  *
6880  * @see function rte_flow_calc_encap_hash
6881  */
6882 enum rte_flow_encap_hash_field {
6883 	/** Calculate hash placed in UDP source port field. */
6884 	RTE_FLOW_ENCAP_HASH_FIELD_SRC_PORT,
6885 	/** Calculate hash placed in NVGRE flow ID field. */
6886 	RTE_FLOW_ENCAP_HASH_FIELD_NVGRE_FLOW_ID,
6887 };
6888 
6889 /**
6890  * @warning
6891  * @b EXPERIMENTAL: this API may change without prior notice.
6892  *
6893  * Simulate HW hash calculation that is done when an encap action is being used.
6894  * This hash can be stored in tunnel outer header to improve packet distribution.
6895  *
6896  * @param[in] port_id
6897  *   Port identifier of Ethernet device.
6898  * @param[in] pattern
6899  *   The values to be used in the hash calculation.
6900  * @param[in] dest_field
6901  *   Type of destination field for hash calculation.
6902  * @param[in] hash_len
6903  *   The length of the hash pointer in bytes. Should be according to dest_field.
6904  * @param[out] hash
6905  *   Used to return the calculated hash. It will be written in network order,
6906  *   so hash[0] is the MSB.
6907  *   The number of bytes is based on the destination field type.
6908  * @param[out] error
6909  *   Perform verbose error reporting if not NULL.
6910  *   PMDs initialize this structure in case of error only.
6911  *
6912  * @return
6913  *   - (0) if success.
6914  *   - (-ENODEV) if *port_id* invalid.
6915  *   - (-ENOTSUP) if underlying device does not support this functionality.
6916  *   - (-EINVAL) if *pattern* doesn't hold enough information to calculate the hash
6917  *               or the dest is not supported.
6918  */
6919 __rte_experimental
6920 int
6921 rte_flow_calc_encap_hash(uint16_t port_id, const struct rte_flow_item pattern[],
6922 			 enum rte_flow_encap_hash_field dest_field, uint8_t hash_len,
6923 			 uint8_t *hash, struct rte_flow_error *error);
6924 
6925 /**
6926  * @warning
6927  * @b EXPERIMENTAL: this API may change without prior notice.
6928  *
6929  * Update template table for new flow rules capacity.
6930  *
6931  * @param port_id
6932  *   Port identifier of Ethernet device.
6933  * @param table
6934  *   Template table to modify.
6935  * @param nb_rules
6936  *   New flow rules capacity.
6937  * @param error
6938  *   Perform verbose error reporting if not NULL.
6939  *   PMDs initialize this structure in case of error only.
6940  *
6941  * @return
6942  *   - (0) if success.
6943  *   - (-ENODEV) if *port_id* invalid.
6944  *   - (-ENOTSUP) if underlying device does not support this functionality.
6945  *   - (-EINVAL) if *table* is not resizable or
6946  *               *table* resize to *nb_rules* is not supported or
6947  *               unrecoverable *table* error.
6948  */
6949 __rte_experimental
6950 int
6951 rte_flow_template_table_resize(uint16_t port_id,
6952 			       struct rte_flow_template_table *table,
6953 			       uint32_t nb_rules,
6954 			       struct rte_flow_error *error);
6955 /**
6956  * @warning
6957  * @b EXPERIMENTAL: this API may change without prior notice.
6958  *
6959  * Update *rule* for the new *table* configuration after table resize.
6960  * Must be called for each *rule* created before *table* resize.
6961  * If called for *rule* created after *table* resize returns success.
6962  *
6963  * @param port_id
6964  *   Port identifier of Ethernet device.
6965  * @param queue
6966  *   Flow queue for async operation.
6967  * @param attr
6968  *   Async operation attributes.
6969  * @param rule
6970  *   Flow rule to update.
6971  * @param user_data
6972  *   The user data that will be returned on async completion event.
6973  * @param error
6974  *   Perform verbose error reporting if not NULL.
6975  *   PMDs initialize this structure in case of error only.
6976  *
6977  * @return
6978  *   - (0) if success.
6979  *   - (-ENODEV) if *port_id* invalid.
6980  *   - (-ENOTSUP) if underlying device does not support this functionality.
6981  *   - (-EINVAL) if *table* was not resized.
6982  *               If *rule* cannot be updated after *table* resize,
6983  *               unrecoverable *table* error.
6984  */
6985 __rte_experimental
6986 int
6987 rte_flow_async_update_resized(uint16_t port_id, uint32_t queue,
6988 			      const struct rte_flow_op_attr *attr,
6989 			      struct rte_flow *rule, void *user_data,
6990 			      struct rte_flow_error *error);
6991 
6992 /**
6993  * @warning
6994  * @b EXPERIMENTAL: this API may change without prior notice.
6995  *
6996  * Resume normal operational mode after table was resized and
6997  * table rules were updated for the new table configuration.
6998  *
6999  * @param port_id
7000  *   Port identifier of Ethernet device.
7001  * @param table
7002  *   Template table that undergoing resize operation.
7003  * @param error
7004  *   Perform verbose error reporting if not NULL.
7005  *   PMDs initialize this structure in case of error only.
7006  *
7007  * @return
7008  *   - (0) if success.
7009  *   - (-ENODEV) if *port_id* invalid.
7010  *   - (-ENOTSUP) if underlying device does not support this functionality.
7011  *   - (-EBUSY) if not all *table* rules were updated.
7012  *   - (-EINVAL) if *table* cannot complete table resize,
7013  *               unrecoverable error.
7014  */
7015 __rte_experimental
7016 int
7017 rte_flow_template_table_resize_complete(uint16_t port_id,
7018 					struct rte_flow_template_table *table,
7019 					struct rte_flow_error *error);
7020 
7021 #ifdef __cplusplus
7022 }
7023 #endif
7024 
7025 #endif /* RTE_FLOW_H_ */
7026