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