xref: /dpdk/lib/ethdev/rte_flow.h (revision 1d343c19330a11f05e3ea369ae5780d38772358e)
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  */
1731 struct rte_flow_item_nsh {
1732 	uint32_t version:2;
1733 	uint32_t oam_pkt:1;
1734 	uint32_t reserved:1;
1735 	uint32_t ttl:6;
1736 	uint32_t length:6;
1737 	uint32_t reserved1:4;
1738 	uint32_t mdtype:4;
1739 	uint32_t next_proto:8;
1740 	uint32_t spi:24;
1741 	uint32_t sindex:8;
1742 };
1743 
1744 /** Default mask for RTE_FLOW_ITEM_TYPE_NSH. */
1745 #ifndef __cplusplus
1746 static const struct rte_flow_item_nsh rte_flow_item_nsh_mask = {
1747 	.mdtype = 0xf,
1748 	.next_proto = 0xff,
1749 	.spi = 0xffffff,
1750 	.sindex = 0xff,
1751 };
1752 #endif
1753 
1754 /**
1755  * @warning
1756  * @b EXPERIMENTAL: this structure may change without prior notice
1757  *
1758  * RTE_FLOW_ITEM_TYPE_IGMP
1759  *
1760  * Match Internet Group Management Protocol (IGMP), RFC 2236
1761  *
1762  */
1763 struct rte_flow_item_igmp {
1764 	uint32_t type:8;
1765 	uint32_t max_resp_time:8;
1766 	uint32_t checksum:16;
1767 	uint32_t group_addr;
1768 };
1769 
1770 /** Default mask for RTE_FLOW_ITEM_TYPE_IGMP. */
1771 #ifndef __cplusplus
1772 static const struct rte_flow_item_igmp rte_flow_item_igmp_mask = {
1773 	.group_addr = 0xffffffff,
1774 };
1775 #endif
1776 
1777 /**
1778  * @warning
1779  * @b EXPERIMENTAL: this structure may change without prior notice
1780  *
1781  * RTE_FLOW_ITEM_TYPE_AH
1782  *
1783  * Match IP Authentication Header (AH), RFC 4302
1784  *
1785  */
1786 struct rte_flow_item_ah {
1787 	uint32_t next_hdr:8;
1788 	uint32_t payload_len:8;
1789 	uint32_t reserved:16;
1790 	uint32_t spi;
1791 	uint32_t seq_num;
1792 };
1793 
1794 /** Default mask for RTE_FLOW_ITEM_TYPE_AH. */
1795 #ifndef __cplusplus
1796 static const struct rte_flow_item_ah rte_flow_item_ah_mask = {
1797 	.spi = 0xffffffff,
1798 };
1799 #endif
1800 
1801 /**
1802  * @warning
1803  * @b EXPERIMENTAL: this structure may change without prior notice
1804  *
1805  * RTE_FLOW_ITEM_TYPE_PFCP
1806  *
1807  * Match PFCP Header
1808  */
1809 struct rte_flow_item_pfcp {
1810 	uint8_t s_field;
1811 	uint8_t msg_type;
1812 	rte_be16_t msg_len;
1813 	rte_be64_t seid;
1814 };
1815 
1816 /** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */
1817 #ifndef __cplusplus
1818 static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
1819 	.s_field = 0x01,
1820 	.seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
1821 };
1822 #endif
1823 
1824 /**
1825  * @warning
1826  * @b EXPERIMENTAL: this structure may change without prior notice
1827  *
1828  * RTE_FLOW_ITEM_TYPE_ECPRI
1829  *
1830  * Match eCPRI Header
1831  */
1832 struct rte_flow_item_ecpri {
1833 	struct rte_ecpri_combined_msg_hdr hdr;
1834 };
1835 
1836 /** Default mask for RTE_FLOW_ITEM_TYPE_ECPRI. */
1837 #ifndef __cplusplus
1838 static const struct rte_flow_item_ecpri rte_flow_item_ecpri_mask = {
1839 	.hdr = {
1840 		.common = {
1841 			.u32 = 0x0,
1842 		},
1843 	},
1844 };
1845 #endif
1846 
1847 /**
1848  * RTE_FLOW_ITEM_TYPE_GENEVE_OPT
1849  *
1850  * Matches a GENEVE Variable Length Option
1851  */
1852 struct rte_flow_item_geneve_opt {
1853 	rte_be16_t option_class;
1854 	uint8_t option_type;
1855 	uint8_t option_len;
1856 	uint32_t *data;
1857 };
1858 
1859 /** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE_OPT. */
1860 #ifndef __cplusplus
1861 static const struct rte_flow_item_geneve_opt
1862 rte_flow_item_geneve_opt_mask = {
1863 	.option_type = 0xff,
1864 };
1865 #endif
1866 
1867 /**
1868  * @warning
1869  * @b EXPERIMENTAL: this structure may change without prior notice
1870  *
1871  * RTE_FLOW_ITEM_TYPE_INTEGRITY
1872  *
1873  * Match on packet integrity check result.
1874  */
1875 struct rte_flow_item_integrity {
1876 	/** Tunnel encapsulation level the item should apply to.
1877 	 * @see rte_flow_action_rss
1878 	 */
1879 	uint32_t level;
1880 	RTE_STD_C11
1881 	union {
1882 		__extension__
1883 		struct {
1884 			/** The packet is valid after passing all HW checks. */
1885 			uint64_t packet_ok:1;
1886 			/** L2 layer is valid after passing all HW checks. */
1887 			uint64_t l2_ok:1;
1888 			/** L3 layer is valid after passing all HW checks. */
1889 			uint64_t l3_ok:1;
1890 			/** L4 layer is valid after passing all HW checks. */
1891 			uint64_t l4_ok:1;
1892 			/** L2 layer CRC is valid. */
1893 			uint64_t l2_crc_ok:1;
1894 			/** IPv4 layer checksum is valid. */
1895 			uint64_t ipv4_csum_ok:1;
1896 			/** L4 layer checksum is valid. */
1897 			uint64_t l4_csum_ok:1;
1898 			/** L3 length is smaller than frame length. */
1899 			uint64_t l3_len_ok:1;
1900 			uint64_t reserved:56;
1901 		};
1902 		uint64_t value;
1903 	};
1904 };
1905 
1906 #ifndef __cplusplus
1907 static const struct rte_flow_item_integrity
1908 rte_flow_item_integrity_mask = {
1909 	.level = 0,
1910 	.value = 0,
1911 };
1912 #endif
1913 
1914 /**
1915  * The packet is valid after conntrack checking.
1916  */
1917 #define RTE_FLOW_CONNTRACK_PKT_STATE_VALID RTE_BIT32(0)
1918 /**
1919  * The state of the connection is changed.
1920  */
1921 #define RTE_FLOW_CONNTRACK_PKT_STATE_CHANGED RTE_BIT32(1)
1922 /**
1923  * Error is detected on this packet for this connection and
1924  * an invalid state is set.
1925  */
1926 #define RTE_FLOW_CONNTRACK_PKT_STATE_INVALID RTE_BIT32(2)
1927 /**
1928  * The HW connection tracking module is disabled.
1929  * It can be due to application command or an invalid state.
1930  */
1931 #define RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED RTE_BIT32(3)
1932 /**
1933  * The packet contains some bad field(s) and cannot continue
1934  * with the conntrack module checking.
1935  */
1936 #define RTE_FLOW_CONNTRACK_PKT_STATE_BAD RTE_BIT32(4)
1937 
1938 /**
1939  * @warning
1940  * @b EXPERIMENTAL: this structure may change without prior notice
1941  *
1942  * RTE_FLOW_ITEM_TYPE_CONNTRACK
1943  *
1944  * Matches the state of a packet after it passed the connection tracking
1945  * examination. The state is a bitmap of one RTE_FLOW_CONNTRACK_PKT_STATE*
1946  * or a reasonable combination of these bits.
1947  */
1948 struct rte_flow_item_conntrack {
1949 	uint32_t flags;
1950 };
1951 
1952 /** Default mask for RTE_FLOW_ITEM_TYPE_CONNTRACK. */
1953 #ifndef __cplusplus
1954 static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask = {
1955 	.flags = 0xffffffff,
1956 };
1957 #endif
1958 
1959 /**
1960  * Provides an ethdev port ID for use with the following items:
1961  * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
1962  * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT.
1963  */
1964 struct rte_flow_item_ethdev {
1965 	uint16_t port_id; /**< ethdev port ID */
1966 };
1967 
1968 /** Default mask for items based on struct rte_flow_item_ethdev */
1969 #ifndef __cplusplus
1970 static const struct rte_flow_item_ethdev rte_flow_item_ethdev_mask = {
1971 	.port_id = 0xffff,
1972 };
1973 #endif
1974 
1975 /**
1976  * @warning
1977  * @b EXPERIMENTAL: this structure may change without prior notice
1978  *
1979  * RTE_FLOW_ITEM_TYPE_L2TPV2
1980  *
1981  * Matches L2TPv2 Header
1982  */
1983 struct rte_flow_item_l2tpv2 {
1984 	struct rte_l2tpv2_combined_msg_hdr hdr;
1985 };
1986 
1987 /** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV2. */
1988 #ifndef __cplusplus
1989 static const struct rte_flow_item_l2tpv2 rte_flow_item_l2tpv2_mask = {
1990 	/*
1991 	 * flags and version bit mask
1992 	 * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
1993 	 * T L x x S x O P x x x x V V V V
1994 	 */
1995 	.hdr = {
1996 		.common = {
1997 			.flags_version = RTE_BE16(0xcb0f),
1998 		},
1999 	},
2000 };
2001 #endif
2002 
2003 /**
2004  * @warning
2005  * @b EXPERIMENTAL: this structure may change without prior notice
2006  *
2007  * RTE_FLOW_ITEM_TYPE_PPP
2008  *
2009  * Matches PPP Header
2010  */
2011 struct rte_flow_item_ppp {
2012 	struct rte_ppp_hdr hdr;
2013 };
2014 
2015 /** Default mask for RTE_FLOW_ITEM_TYPE_PPP. */
2016 #ifndef __cplusplus
2017 static const struct rte_flow_item_ppp rte_flow_item_ppp_mask = {
2018 	.hdr = {
2019 		.addr = 0xff,
2020 		.ctrl = 0xff,
2021 		.proto_id = RTE_BE16(0xffff),
2022 	}
2023 };
2024 #endif
2025 
2026 /**
2027  * RTE_FLOW_ITEM_TYPE_IB_BTH.
2028  *
2029  * Matches an InfiniBand base transport header in RoCE packet.
2030  */
2031 struct rte_flow_item_ib_bth {
2032 	struct rte_ib_bth hdr; /**< InfiniBand base transport header definition. */
2033 };
2034 
2035 /** Default mask for RTE_FLOW_ITEM_TYPE_IB_BTH. */
2036 #ifndef __cplusplus
2037 static const struct rte_flow_item_ib_bth rte_flow_item_ib_bth_mask = {
2038 	.hdr = {
2039 		.opcode = 0xff,
2040 		.dst_qp = "\xff\xff\xff",
2041 	},
2042 };
2043 #endif
2044 
2045 /**
2046  * Matching pattern item definition.
2047  *
2048  * A pattern is formed by stacking items starting from the lowest protocol
2049  * layer to match. This stacking restriction does not apply to meta items
2050  * which can be placed anywhere in the stack without affecting the meaning
2051  * of the resulting pattern.
2052  *
2053  * Patterns are terminated by END items.
2054  *
2055  * The spec field should be a valid pointer to a structure of the related
2056  * item type. It may remain unspecified (NULL) in many cases to request
2057  * broad (nonspecific) matching. In such cases, last and mask must also be
2058  * set to NULL.
2059  *
2060  * Optionally, last can point to a structure of the same type to define an
2061  * inclusive range. This is mostly supported by integer and address fields,
2062  * may cause errors otherwise. Fields that do not support ranges must be set
2063  * to 0 or to the same value as the corresponding fields in spec.
2064  *
2065  * Only the fields defined to nonzero values in the default masks (see
2066  * rte_flow_item_{name}_mask constants) are considered relevant by
2067  * default. This can be overridden by providing a mask structure of the
2068  * same type with applicable bits set to one. It can also be used to
2069  * partially filter out specific fields (e.g. as an alternate mean to match
2070  * ranges of IP addresses).
2071  *
2072  * Mask is a simple bit-mask applied before interpreting the contents of
2073  * spec and last, which may yield unexpected results if not used
2074  * carefully. For example, if for an IPv4 address field, spec provides
2075  * 10.1.2.3, last provides 10.3.4.5 and mask provides 255.255.0.0, the
2076  * effective range becomes 10.1.0.0 to 10.3.255.255.
2077  */
2078 struct rte_flow_item {
2079 	enum rte_flow_item_type type; /**< Item type. */
2080 	const void *spec; /**< Pointer to item specification structure. */
2081 	const void *last; /**< Defines an inclusive range (spec to last). */
2082 	const void *mask; /**< Bit-mask applied to spec and last. */
2083 };
2084 
2085 /**
2086  * @warning
2087  * @b EXPERIMENTAL: this structure may change without prior notice
2088  *
2089  * RTE_FLOW_ITEM_TYPE_FLEX
2090  *
2091  * Matches a specified set of fields within the network protocol
2092  * header. Each field is presented as set of bits with specified width, and
2093  * bit offset from the header beginning.
2094  *
2095  * The pattern is concatenation of bit fields configured at item creation
2096  * by rte_flow_flex_item_create(). At configuration the fields are presented
2097  * by sample_data array.
2098  *
2099  * This type does not support ranges (struct rte_flow_item.last).
2100  */
2101 struct rte_flow_item_flex {
2102 	struct rte_flow_item_flex_handle *handle; /**< Opaque item handle. */
2103 	uint32_t length; /**< Pattern length in bytes. */
2104 	const uint8_t *pattern; /**< Combined bitfields pattern to match. */
2105 };
2106 /**
2107  * Field bit offset calculation mode.
2108  */
2109 enum rte_flow_item_flex_field_mode {
2110 	/**
2111 	 * Dummy field, used for byte boundary alignment in pattern.
2112 	 * Pattern mask and data are ignored in the match. All configuration
2113 	 * parameters besides field size are ignored.
2114 	 */
2115 	FIELD_MODE_DUMMY = 0,
2116 	/**
2117 	 * Fixed offset field. The bit offset from header beginning
2118 	 * is permanent and defined by field_base parameter.
2119 	 */
2120 	FIELD_MODE_FIXED,
2121 	/**
2122 	 * The field bit offset is extracted from other header field (indirect
2123 	 * offset field). The resulting field offset to match is calculated as:
2124 	 *
2125 	 *    field_base + (*offset_base & offset_mask) << offset_shift
2126 	 */
2127 	FIELD_MODE_OFFSET,
2128 	/**
2129 	 * The field bit offset is extracted from other header field (indirect
2130 	 * offset field), the latter is considered as bitmask containing some
2131 	 * number of one bits, the resulting field offset to match is
2132 	 * calculated as:
2133 	 *
2134 	 *    field_base + bitcount(*offset_base & offset_mask) << offset_shift
2135 	 */
2136 	FIELD_MODE_BITMASK,
2137 };
2138 
2139 /**
2140  * Flex item field tunnel mode
2141  */
2142 enum rte_flow_item_flex_tunnel_mode {
2143 	/**
2144 	 * The protocol header can be present in the packet only once.
2145 	 * No multiple flex item flow inclusions (for inner/outer) are allowed.
2146 	 * No any relations with tunnel protocols are imposed. The drivers
2147 	 * can optimize hardware resource usage to handle match on single flex
2148 	 * item of specific type.
2149 	 */
2150 	FLEX_TUNNEL_MODE_SINGLE = 0,
2151 	/**
2152 	 * Flex item presents outer header only.
2153 	 */
2154 	FLEX_TUNNEL_MODE_OUTER,
2155 	/**
2156 	 * Flex item presents inner header only.
2157 	 */
2158 	FLEX_TUNNEL_MODE_INNER,
2159 	/**
2160 	 * Flex item presents either inner or outer header. The driver
2161 	 * handles as many multiple inners as hardware supports.
2162 	 */
2163 	FLEX_TUNNEL_MODE_MULTI,
2164 	/**
2165 	 * Flex item presents tunnel protocol header.
2166 	 */
2167 	FLEX_TUNNEL_MODE_TUNNEL,
2168 };
2169 
2170 /**
2171  *
2172  * @warning
2173  * @b EXPERIMENTAL: this structure may change without prior notice
2174  */
2175 __extension__
2176 struct rte_flow_item_flex_field {
2177 	/** Defines how match field offset is calculated over the packet. */
2178 	enum rte_flow_item_flex_field_mode field_mode;
2179 	uint32_t field_size; /**< Field size in bits. */
2180 	int32_t field_base; /**< Field offset in bits. */
2181 	uint32_t offset_base; /**< Indirect offset field offset in bits. */
2182 	uint32_t offset_mask; /**< Indirect offset field bit mask. */
2183 	int32_t offset_shift; /**< Indirect offset multiply factor. */
2184 	uint32_t field_id:16; /**< Device hint, for multiple items in flow. */
2185 	uint32_t reserved:16; /**< Reserved field. */
2186 };
2187 
2188 /**
2189  * @warning
2190  * @b EXPERIMENTAL: this structure may change without prior notice
2191  */
2192 struct rte_flow_item_flex_link {
2193 	/**
2194 	 * Preceding/following header. The item type must be always provided.
2195 	 * For preceding one item must specify the header value/mask to match
2196 	 * for the link be taken and start the flex item header parsing.
2197 	 */
2198 	struct rte_flow_item item;
2199 	/**
2200 	 * Next field value to match to continue with one of the configured
2201 	 * next protocols.
2202 	 */
2203 	uint32_t next;
2204 };
2205 
2206 /**
2207  * @warning
2208  * @b EXPERIMENTAL: this structure may change without prior notice
2209  */
2210 struct rte_flow_item_flex_conf {
2211 	/**
2212 	 * Specifies the flex item and tunnel relations and tells the PMD
2213 	 * whether flex item can be used for inner, outer or both headers,
2214 	 * or whether flex item presents the tunnel protocol itself.
2215 	 */
2216 	enum rte_flow_item_flex_tunnel_mode tunnel;
2217 	/**
2218 	 * The next header offset, it presents the network header size covered
2219 	 * by the flex item and can be obtained with all supported offset
2220 	 * calculating methods (fixed, dedicated field, bitmask, etc).
2221 	 */
2222 	struct rte_flow_item_flex_field next_header;
2223 	/**
2224 	 * Specifies the next protocol field to match with link next protocol
2225 	 * values and continue packet parsing with matching link.
2226 	 */
2227 	struct rte_flow_item_flex_field next_protocol;
2228 	/**
2229 	 * The fields will be sampled and presented for explicit match
2230 	 * with pattern in the rte_flow_flex_item. There can be multiple
2231 	 * fields descriptors, the number should be specified by nb_samples.
2232 	 */
2233 	struct rte_flow_item_flex_field *sample_data;
2234 	/** Number of field descriptors in the sample_data array. */
2235 	uint32_t nb_samples;
2236 	/**
2237 	 * Input link defines the flex item relation with preceding
2238 	 * header. It specified the preceding item type and provides pattern
2239 	 * to match. The flex item will continue parsing and will provide the
2240 	 * data to flow match in case if there is the match with one of input
2241 	 * links.
2242 	 */
2243 	struct rte_flow_item_flex_link *input_link;
2244 	/** Number of link descriptors in the input link array. */
2245 	uint32_t nb_inputs;
2246 	/**
2247 	 * Output link defines the next protocol field value to match and
2248 	 * the following protocol header to continue packet parsing. Also
2249 	 * defines the tunnel-related behaviour.
2250 	 */
2251 	struct rte_flow_item_flex_link *output_link;
2252 	/** Number of link descriptors in the output link array. */
2253 	uint32_t nb_outputs;
2254 };
2255 
2256 /**
2257  * RTE_FLOW_ITEM_TYPE_METER_COLOR.
2258  *
2259  * Matches Color Marker set by a Meter.
2260  */
2261 struct rte_flow_item_meter_color {
2262 	enum rte_color color; /**< Meter color marker. */
2263 };
2264 
2265 /** Default mask for RTE_FLOW_ITEM_TYPE_METER_COLOR. */
2266 #ifndef __cplusplus
2267 static const struct rte_flow_item_meter_color rte_flow_item_meter_color_mask = {
2268 	.color = RTE_COLORS,
2269 };
2270 #endif
2271 
2272 /**
2273  * @warning
2274  * @b EXPERIMENTAL: this structure may change without prior notice
2275  *
2276  * RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY
2277  *
2278  * For multiple ports aggregated to a single DPDK port,
2279  * match the aggregated port receiving the packets.
2280  */
2281 struct rte_flow_item_aggr_affinity {
2282 	/**
2283 	 * An aggregated port receiving the packets.
2284 	 * Numbering starts from 1.
2285 	 * Number of aggregated ports is reported by rte_eth_dev_count_aggr_ports().
2286 	 */
2287 	uint8_t affinity;
2288 };
2289 
2290 /** Default mask for RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY. */
2291 #ifndef __cplusplus
2292 static const struct rte_flow_item_aggr_affinity
2293 rte_flow_item_aggr_affinity_mask = {
2294 	.affinity = 0xff,
2295 };
2296 #endif
2297 
2298 /**
2299  * RTE_FLOW_ITEM_TYPE_TX_QUEUE
2300  *
2301  * Tx queue number.
2302  *
2303  * @see struct rte_flow_item_tx_queue
2304  */
2305 struct rte_flow_item_tx_queue {
2306 	/** Tx queue number of packet being transmitted. */
2307 	uint16_t tx_queue;
2308 };
2309 
2310 /** Default mask for RTE_FLOW_ITEM_TX_QUEUE. */
2311 #ifndef __cplusplus
2312 static const struct rte_flow_item_tx_queue rte_flow_item_tx_queue_mask = {
2313 	.tx_queue = RTE_BE16(0xffff),
2314 };
2315 #endif
2316 
2317 /**
2318  * Action types.
2319  *
2320  * Each possible action is represented by a type.
2321  * An action can have an associated configuration object.
2322  * Several actions combined in a list can be assigned
2323  * to a flow rule and are performed in order.
2324  *
2325  * They fall in three categories:
2326  *
2327  * - Actions that modify the fate of matching traffic, for instance by
2328  *   dropping or assigning it a specific destination.
2329  *
2330  * - Actions that modify matching traffic contents or its properties. This
2331  *   includes adding/removing encapsulation, encryption, compression and
2332  *   marks.
2333  *
2334  * - Actions related to the flow rule itself, such as updating counters or
2335  *   making it non-terminating.
2336  *
2337  * Flow rules being terminating by default, not specifying any action of the
2338  * fate kind results in undefined behavior. This applies to both ingress and
2339  * egress.
2340  *
2341  * PASSTHRU, when supported, makes a flow rule non-terminating.
2342  */
2343 enum rte_flow_action_type {
2344 	/**
2345 	 * End marker for action lists. Prevents further processing of
2346 	 * actions, thereby ending the list.
2347 	 *
2348 	 * No associated configuration structure.
2349 	 */
2350 	RTE_FLOW_ACTION_TYPE_END,
2351 
2352 	/**
2353 	 * Used as a placeholder for convenience. It is ignored and simply
2354 	 * discarded by PMDs.
2355 	 *
2356 	 * No associated configuration structure.
2357 	 */
2358 	RTE_FLOW_ACTION_TYPE_VOID,
2359 
2360 	/**
2361 	 * Leaves traffic up for additional processing by subsequent flow
2362 	 * rules; makes a flow rule non-terminating.
2363 	 *
2364 	 * No associated configuration structure.
2365 	 */
2366 	RTE_FLOW_ACTION_TYPE_PASSTHRU,
2367 
2368 	/**
2369 	 * RTE_FLOW_ACTION_TYPE_JUMP
2370 	 *
2371 	 * Redirects packets to a group on the current device.
2372 	 *
2373 	 * See struct rte_flow_action_jump.
2374 	 */
2375 	RTE_FLOW_ACTION_TYPE_JUMP,
2376 
2377 	/**
2378 	 * Attaches an integer value to packets and sets RTE_MBUF_F_RX_FDIR and
2379 	 * RTE_MBUF_F_RX_FDIR_ID mbuf flags.
2380 	 *
2381 	 * See struct rte_flow_action_mark.
2382 	 *
2383 	 * One should negotiate mark delivery from the NIC to the PMD.
2384 	 * @see rte_eth_rx_metadata_negotiate()
2385 	 * @see RTE_ETH_RX_METADATA_USER_MARK
2386 	 */
2387 	RTE_FLOW_ACTION_TYPE_MARK,
2388 
2389 	/**
2390 	 * Flags packets. Similar to MARK without a specific value; only
2391 	 * sets the RTE_MBUF_F_RX_FDIR mbuf flag.
2392 	 *
2393 	 * No associated configuration structure.
2394 	 *
2395 	 * One should negotiate flag delivery from the NIC to the PMD.
2396 	 * @see rte_eth_rx_metadata_negotiate()
2397 	 * @see RTE_ETH_RX_METADATA_USER_FLAG
2398 	 */
2399 	RTE_FLOW_ACTION_TYPE_FLAG,
2400 
2401 	/**
2402 	 * Assigns packets to a given queue index.
2403 	 *
2404 	 * See struct rte_flow_action_queue.
2405 	 */
2406 	RTE_FLOW_ACTION_TYPE_QUEUE,
2407 
2408 	/**
2409 	 * Drops packets.
2410 	 *
2411 	 * PASSTHRU overrides this action if both are specified.
2412 	 *
2413 	 * No associated configuration structure.
2414 	 */
2415 	RTE_FLOW_ACTION_TYPE_DROP,
2416 
2417 	/**
2418 	 * Enables counters for this flow rule.
2419 	 *
2420 	 * These counters can be retrieved and reset through rte_flow_query() or
2421 	 * rte_flow_action_handle_query() if the action provided via handle,
2422 	 * see struct rte_flow_query_count.
2423 	 *
2424 	 * See struct rte_flow_action_count.
2425 	 */
2426 	RTE_FLOW_ACTION_TYPE_COUNT,
2427 
2428 	/**
2429 	 * Similar to QUEUE, except RSS is additionally performed on packets
2430 	 * to spread them among several queues according to the provided
2431 	 * parameters.
2432 	 *
2433 	 * See struct rte_flow_action_rss.
2434 	 */
2435 	RTE_FLOW_ACTION_TYPE_RSS,
2436 
2437 	/**
2438 	 * @deprecated
2439 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2440 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2441 	 *
2442 	 * Directs matching traffic to the physical function (PF) of the
2443 	 * current device.
2444 	 *
2445 	 * No associated configuration structure.
2446 	 */
2447 	RTE_FLOW_ACTION_TYPE_PF,
2448 
2449 	/**
2450 	 * @deprecated
2451 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2452 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2453 	 *
2454 	 * Directs matching traffic to a given virtual function of the
2455 	 * current device.
2456 	 *
2457 	 * See struct rte_flow_action_vf.
2458 	 */
2459 	RTE_FLOW_ACTION_TYPE_VF,
2460 
2461 	/**
2462 	 * @deprecated
2463 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2464 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2465 	 *
2466 	 * Directs matching traffic to a given DPDK port ID.
2467 	 *
2468 	 * See struct rte_flow_action_port_id.
2469 	 */
2470 	RTE_FLOW_ACTION_TYPE_PORT_ID,
2471 
2472 	/**
2473 	 * Traffic metering and policing (MTR).
2474 	 *
2475 	 * See struct rte_flow_action_meter.
2476 	 * See file rte_mtr.h for MTR object configuration.
2477 	 */
2478 	RTE_FLOW_ACTION_TYPE_METER,
2479 
2480 	/**
2481 	 * Redirects packets to security engine of current device for security
2482 	 * processing as specified by security session.
2483 	 *
2484 	 * See struct rte_flow_action_security.
2485 	 */
2486 	RTE_FLOW_ACTION_TYPE_SECURITY,
2487 
2488 	/**
2489 	 * @warning This is a legacy action.
2490 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2491 	 *
2492 	 * Implements OFPAT_DEC_NW_TTL ("decrement IP TTL") as defined by
2493 	 * the OpenFlow Switch Specification.
2494 	 *
2495 	 * No associated configuration structure.
2496 	 */
2497 	RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL,
2498 
2499 	/**
2500 	 * Implements OFPAT_POP_VLAN ("pop the outer VLAN tag") as defined
2501 	 * by the OpenFlow Switch Specification.
2502 	 *
2503 	 * No associated configuration structure.
2504 	 */
2505 	RTE_FLOW_ACTION_TYPE_OF_POP_VLAN,
2506 
2507 	/**
2508 	 * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by
2509 	 * the OpenFlow Switch Specification.
2510 	 *
2511 	 * See struct rte_flow_action_of_push_vlan.
2512 	 */
2513 	RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN,
2514 
2515 	/**
2516 	 * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN ID") as
2517 	 * defined by the OpenFlow Switch Specification.
2518 	 *
2519 	 * See struct rte_flow_action_of_set_vlan_vid.
2520 	 */
2521 	RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID,
2522 
2523 	/**
2524 	 * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as
2525 	 * defined by the OpenFlow Switch Specification.
2526 	 *
2527 	 * See struct rte_flow_action_of_set_vlan_pcp.
2528 	 */
2529 	RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP,
2530 
2531 	/**
2532 	 * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined
2533 	 * by the OpenFlow Switch Specification.
2534 	 *
2535 	 * See struct rte_flow_action_of_pop_mpls.
2536 	 */
2537 	RTE_FLOW_ACTION_TYPE_OF_POP_MPLS,
2538 
2539 	/**
2540 	 * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by
2541 	 * the OpenFlow Switch Specification.
2542 	 *
2543 	 * See struct rte_flow_action_of_push_mpls.
2544 	 */
2545 	RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS,
2546 
2547 	/**
2548 	 * Encapsulate flow in VXLAN tunnel as defined in
2549 	 * rte_flow_action_vxlan_encap action structure.
2550 	 *
2551 	 * See struct rte_flow_action_vxlan_encap.
2552 	 */
2553 	RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP,
2554 
2555 	/**
2556 	 * Decapsulate outer most VXLAN tunnel from matched flow.
2557 	 *
2558 	 * If flow pattern does not define a valid VXLAN tunnel (as specified by
2559 	 * RFC7348) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
2560 	 * error.
2561 	 */
2562 	RTE_FLOW_ACTION_TYPE_VXLAN_DECAP,
2563 
2564 	/**
2565 	 * Encapsulate flow in NVGRE tunnel defined in the
2566 	 * rte_flow_action_nvgre_encap action structure.
2567 	 *
2568 	 * See struct rte_flow_action_nvgre_encap.
2569 	 */
2570 	RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP,
2571 
2572 	/**
2573 	 * Decapsulate outer most NVGRE tunnel from matched flow.
2574 	 *
2575 	 * If flow pattern does not define a valid NVGRE tunnel (as specified by
2576 	 * RFC7637) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
2577 	 * error.
2578 	 */
2579 	RTE_FLOW_ACTION_TYPE_NVGRE_DECAP,
2580 
2581 	/**
2582 	 * Add outer header whose template is provided in its data buffer
2583 	 *
2584 	 * See struct rte_flow_action_raw_encap.
2585 	 */
2586 	RTE_FLOW_ACTION_TYPE_RAW_ENCAP,
2587 
2588 	/**
2589 	 * Remove outer header whose template is provided in its data buffer.
2590 	 *
2591 	 * See struct rte_flow_action_raw_decap
2592 	 */
2593 	RTE_FLOW_ACTION_TYPE_RAW_DECAP,
2594 
2595 	/**
2596 	 * @warning This is a legacy action.
2597 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2598 	 *
2599 	 * Modify IPv4 source address in the outermost IPv4 header.
2600 	 *
2601 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2602 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2603 	 *
2604 	 * See struct rte_flow_action_set_ipv4.
2605 	 */
2606 	RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC,
2607 
2608 	/**
2609 	 * @warning This is a legacy action.
2610 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2611 	 *
2612 	 * Modify IPv4 destination address in the outermost IPv4 header.
2613 	 *
2614 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2615 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2616 	 *
2617 	 * See struct rte_flow_action_set_ipv4.
2618 	 */
2619 	RTE_FLOW_ACTION_TYPE_SET_IPV4_DST,
2620 
2621 	/**
2622 	 * @warning This is a legacy action.
2623 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2624 	 *
2625 	 * Modify IPv6 source address in the outermost IPv6 header.
2626 	 *
2627 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2628 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2629 	 *
2630 	 * See struct rte_flow_action_set_ipv6.
2631 	 */
2632 	RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC,
2633 
2634 	/**
2635 	 * @warning This is a legacy action.
2636 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2637 	 *
2638 	 * Modify IPv6 destination address in the outermost IPv6 header.
2639 	 *
2640 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2641 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2642 	 *
2643 	 * See struct rte_flow_action_set_ipv6.
2644 	 */
2645 	RTE_FLOW_ACTION_TYPE_SET_IPV6_DST,
2646 
2647 	/**
2648 	 * @warning This is a legacy action.
2649 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2650 	 *
2651 	 * Modify source port number in the outermost TCP/UDP header.
2652 	 *
2653 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
2654 	 * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
2655 	 * RTE_FLOW_ERROR_TYPE_ACTION error.
2656 	 *
2657 	 * See struct rte_flow_action_set_tp.
2658 	 */
2659 	RTE_FLOW_ACTION_TYPE_SET_TP_SRC,
2660 
2661 	/**
2662 	 * @warning This is a legacy action.
2663 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2664 	 *
2665 	 * Modify destination port number in the outermost TCP/UDP header.
2666 	 *
2667 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
2668 	 * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
2669 	 * RTE_FLOW_ERROR_TYPE_ACTION error.
2670 	 *
2671 	 * See struct rte_flow_action_set_tp.
2672 	 */
2673 	RTE_FLOW_ACTION_TYPE_SET_TP_DST,
2674 
2675 	/**
2676 	 * Swap the source and destination MAC addresses in the outermost
2677 	 * Ethernet header.
2678 	 *
2679 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2680 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2681 	 *
2682 	 * No associated configuration structure.
2683 	 */
2684 	RTE_FLOW_ACTION_TYPE_MAC_SWAP,
2685 
2686 	/**
2687 	 * @warning This is a legacy action.
2688 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2689 	 *
2690 	 * Decrease TTL value directly
2691 	 *
2692 	 * No associated configuration structure.
2693 	 */
2694 	RTE_FLOW_ACTION_TYPE_DEC_TTL,
2695 
2696 	/**
2697 	 * @warning This is a legacy action.
2698 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2699 	 *
2700 	 * Set TTL value
2701 	 *
2702 	 * See struct rte_flow_action_set_ttl
2703 	 */
2704 	RTE_FLOW_ACTION_TYPE_SET_TTL,
2705 
2706 	/**
2707 	 * @warning This is a legacy action.
2708 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2709 	 *
2710 	 * Set source MAC address from matched flow.
2711 	 *
2712 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2713 	 * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2714 	 *
2715 	 * See struct rte_flow_action_set_mac.
2716 	 */
2717 	RTE_FLOW_ACTION_TYPE_SET_MAC_SRC,
2718 
2719 	/**
2720 	 * @warning This is a legacy action.
2721 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2722 	 *
2723 	 * Set destination MAC address from matched flow.
2724 	 *
2725 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2726 	 * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2727 	 *
2728 	 * See struct rte_flow_action_set_mac.
2729 	 */
2730 	RTE_FLOW_ACTION_TYPE_SET_MAC_DST,
2731 
2732 	/**
2733 	 * @warning This is a legacy action.
2734 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2735 	 *
2736 	 * Increase sequence number in the outermost TCP header.
2737 	 *
2738 	 * Action configuration specifies the value to increase
2739 	 * TCP sequence number as a big-endian 32 bit integer.
2740 	 *
2741 	 * @p conf type:
2742 	 * @code rte_be32_t * @endcode
2743 	 *
2744 	 * Using this action on non-matching traffic will result in
2745 	 * undefined behavior.
2746 	 */
2747 	RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ,
2748 
2749 	/**
2750 	 * @warning This is a legacy action.
2751 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2752 	 *
2753 	 * Decrease sequence number in the outermost TCP header.
2754 	 *
2755 	 * Action configuration specifies the value to decrease
2756 	 * TCP sequence number as a big-endian 32 bit integer.
2757 	 *
2758 	 * @p conf type:
2759 	 * @code rte_be32_t * @endcode
2760 	 *
2761 	 * Using this action on non-matching traffic will result in
2762 	 * undefined behavior.
2763 	 */
2764 	RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ,
2765 
2766 	/**
2767 	 * @warning This is a legacy action.
2768 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2769 	 *
2770 	 * Increase acknowledgment number in the outermost TCP header.
2771 	 *
2772 	 * Action configuration specifies the value to increase
2773 	 * TCP acknowledgment number as a big-endian 32 bit integer.
2774 	 *
2775 	 * @p conf type:
2776 	 * @code rte_be32_t * @endcode
2777 
2778 	 * Using this action on non-matching traffic will result in
2779 	 * undefined behavior.
2780 	 */
2781 	RTE_FLOW_ACTION_TYPE_INC_TCP_ACK,
2782 
2783 	/**
2784 	 * @warning This is a legacy action.
2785 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2786 	 *
2787 	 * Decrease acknowledgment number in the outermost TCP header.
2788 	 *
2789 	 * Action configuration specifies the value to decrease
2790 	 * TCP acknowledgment number as a big-endian 32 bit integer.
2791 	 *
2792 	 * @p conf type:
2793 	 * @code rte_be32_t * @endcode
2794 	 *
2795 	 * Using this action on non-matching traffic will result in
2796 	 * undefined behavior.
2797 	 */
2798 	RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK,
2799 
2800 	/**
2801 	 * @warning This is a legacy action.
2802 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2803 	 *
2804 	 * Set Tag.
2805 	 *
2806 	 * Tag is for internal flow usage only and
2807 	 * is not delivered to the application.
2808 	 *
2809 	 * See struct rte_flow_action_set_tag.
2810 	 */
2811 	RTE_FLOW_ACTION_TYPE_SET_TAG,
2812 
2813 	/**
2814 	 * @warning This is a legacy action.
2815 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2816 	 *
2817 	 * Set metadata on ingress or egress path.
2818 	 *
2819 	 * See struct rte_flow_action_set_meta.
2820 	 */
2821 	RTE_FLOW_ACTION_TYPE_SET_META,
2822 
2823 	/**
2824 	 * @warning This is a legacy action.
2825 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2826 	 *
2827 	 * Modify IPv4 DSCP in the outermost IP header.
2828 	 *
2829 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2830 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2831 	 *
2832 	 * See struct rte_flow_action_set_dscp.
2833 	 */
2834 	RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP,
2835 
2836 	/**
2837 	 * @warning This is a legacy action.
2838 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2839 	 *
2840 	 * Modify IPv6 DSCP in the outermost IP header.
2841 	 *
2842 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2843 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2844 	 *
2845 	 * See struct rte_flow_action_set_dscp.
2846 	 */
2847 	RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP,
2848 
2849 	/**
2850 	 * Report as aged flow if timeout passed without any matching on the
2851 	 * flow.
2852 	 *
2853 	 * See struct rte_flow_action_age.
2854 	 * See function rte_flow_get_q_aged_flows
2855 	 * See function rte_flow_get_aged_flows
2856 	 * see enum RTE_ETH_EVENT_FLOW_AGED
2857 	 * See struct rte_flow_query_age
2858 	 * See struct rte_flow_update_age
2859 	 */
2860 	RTE_FLOW_ACTION_TYPE_AGE,
2861 
2862 	/**
2863 	 * The matching packets will be duplicated with specified ratio and
2864 	 * applied with own set of actions with a fate action.
2865 	 *
2866 	 * See struct rte_flow_action_sample.
2867 	 */
2868 	RTE_FLOW_ACTION_TYPE_SAMPLE,
2869 
2870 	/**
2871 	 * @deprecated
2872 	 * @see RTE_FLOW_ACTION_TYPE_INDIRECT
2873 	 *
2874 	 * Describe action shared across multiple flow rules.
2875 	 *
2876 	 * Allow multiple rules reference the same action by handle (see
2877 	 * struct rte_flow_shared_action).
2878 	 */
2879 	RTE_FLOW_ACTION_TYPE_SHARED,
2880 
2881 	/**
2882 	 * Modify a packet header field, tag, mark or metadata.
2883 	 *
2884 	 * Allow the modification of an arbitrary header field via
2885 	 * set, add and sub operations or copying its content into
2886 	 * tag, meta or mark for future processing.
2887 	 *
2888 	 * See struct rte_flow_action_modify_field.
2889 	 */
2890 	RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
2891 
2892 	/**
2893 	 * An action handle is referenced in a rule through an indirect action.
2894 	 *
2895 	 * The same action handle may be used in multiple rules for the same
2896 	 * or different ethdev ports.
2897 	 */
2898 	RTE_FLOW_ACTION_TYPE_INDIRECT,
2899 
2900 	/**
2901 	 * [META]
2902 	 *
2903 	 * Enable tracking a TCP connection state.
2904 	 *
2905 	 * @see struct rte_flow_action_conntrack.
2906 	 */
2907 	RTE_FLOW_ACTION_TYPE_CONNTRACK,
2908 
2909 	/**
2910 	 * Color the packet to reflect the meter color result.
2911 	 * Set the meter color in the mbuf to the selected color.
2912 	 *
2913 	 * See struct rte_flow_action_meter_color.
2914 	 */
2915 	RTE_FLOW_ACTION_TYPE_METER_COLOR,
2916 
2917 	/**
2918 	 * At embedded switch level, sends matching traffic to the given ethdev.
2919 	 *
2920 	 * @see struct rte_flow_action_ethdev
2921 	 */
2922 	RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
2923 
2924 	/**
2925 	 * At embedded switch level, send matching traffic to
2926 	 * the entity represented by the given ethdev.
2927 	 *
2928 	 * @see struct rte_flow_action_ethdev
2929 	 */
2930 	RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
2931 
2932 	/**
2933 	 * Traffic metering and marking (MTR).
2934 	 *
2935 	 * @see struct rte_flow_action_meter_mark
2936 	 * See file rte_mtr.h for MTR profile object configuration.
2937 	 */
2938 	RTE_FLOW_ACTION_TYPE_METER_MARK,
2939 
2940 	/**
2941 	 * Send packets to the kernel, without going to userspace at all.
2942 	 * The packets will be received by the kernel driver sharing
2943 	 * the same device as the DPDK port on which this action is configured.
2944 	 * This action mostly suits bifurcated driver model.
2945 	 * This is an ingress non-transfer action only.
2946 	 *
2947 	 * No associated configuration structure.
2948 	 */
2949 	RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL,
2950 
2951 	/**
2952 	 * Apply the quota verdict (PASS or BLOCK) to a flow.
2953 	 *
2954 	 * @see struct rte_flow_action_quota
2955 	 * @see struct rte_flow_query_quota
2956 	 * @see struct rte_flow_update_quota
2957 	 */
2958 	 RTE_FLOW_ACTION_TYPE_QUOTA,
2959 
2960 	/**
2961 	 * Skip congestion management configuration.
2962 	 *
2963 	 * Using rte_eth_cman_config_set(), the application
2964 	 * can configure ethdev Rx queue's congestion mechanism.
2965 	 * This flow action allows to skip the congestion configuration
2966 	 * applied to the given ethdev Rx queue.
2967 	 */
2968 	RTE_FLOW_ACTION_TYPE_SKIP_CMAN,
2969 
2970 	/**
2971 	 * RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH
2972 	 *
2973 	 * Push IPv6 extension into IPv6 packet.
2974 	 *
2975 	 * @see struct rte_flow_action_ipv6_ext_push.
2976 	 */
2977 	RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH,
2978 
2979 	/**
2980 	 * RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE
2981 	 *
2982 	 * Remove IPv6 extension from IPv6 packet whose type
2983 	 * is provided in its configuration buffer.
2984 	 *
2985 	 * @see struct rte_flow_action_ipv6_ext_remove.
2986 	 */
2987 	RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE,
2988 
2989 	/**
2990 	 * Action handle to reference flow actions list.
2991 	 *
2992 	 * @see struct rte_flow_action_indirect_list
2993 	 */
2994 	RTE_FLOW_ACTION_TYPE_INDIRECT_LIST,
2995 };
2996 
2997 /**
2998  * @warning
2999  * @b EXPERIMENTAL: this API may change without prior notice.
3000  *
3001  * QUOTA operational mode.
3002  *
3003  * @see struct rte_flow_action_quota
3004  */
3005 enum rte_flow_quota_mode {
3006 	RTE_FLOW_QUOTA_MODE_PACKET = 1, /**< Count packets. */
3007 	RTE_FLOW_QUOTA_MODE_L2 = 2, /**< Count packet bytes starting from L2. */
3008 	RTE_FLOW_QUOTA_MODE_L3 = 3, /**< Count packet bytes starting from L3. */
3009 };
3010 
3011 /**
3012  * @warning
3013  * @b EXPERIMENTAL: this API may change without prior notice.
3014  *
3015  * Create QUOTA action.
3016  *
3017  * @see RTE_FLOW_ACTION_TYPE_QUOTA
3018  */
3019 struct rte_flow_action_quota {
3020 	enum rte_flow_quota_mode mode; /**< Quota operational mode. */
3021 	int64_t quota;                 /**< Quota value. */
3022 };
3023 
3024 /**
3025  * @warning
3026  * @b EXPERIMENTAL: this API may change without prior notice.
3027  *
3028  * Query indirect QUOTA action.
3029  *
3030  * @see RTE_FLOW_ACTION_TYPE_QUOTA
3031  *
3032  */
3033 struct rte_flow_query_quota {
3034 	int64_t quota; /**< Quota value. */
3035 };
3036 
3037 /**
3038  * @warning
3039  * @b EXPERIMENTAL: this API may change without prior notice.
3040  *
3041  * Indirect QUOTA update operations.
3042  *
3043  * @see struct rte_flow_update_quota
3044  */
3045 enum rte_flow_update_quota_op {
3046 	RTE_FLOW_UPDATE_QUOTA_SET, /**< Set new quota value. */
3047 	RTE_FLOW_UPDATE_QUOTA_ADD, /**< Increase quota value. */
3048 };
3049 
3050 /**
3051  * @warning
3052  * @b EXPERIMENTAL: this API may change without prior notice.
3053  *
3054  * @see RTE_FLOW_ACTION_TYPE_QUOTA
3055  *
3056  * Update indirect QUOTA action.
3057  */
3058 struct rte_flow_update_quota {
3059 	enum rte_flow_update_quota_op op; /**< Update operation. */
3060 	int64_t quota;                    /**< Quota value. */
3061 };
3062 
3063 /**
3064  * RTE_FLOW_ACTION_TYPE_MARK
3065  *
3066  * Attaches an integer value to packets and sets RTE_MBUF_F_RX_FDIR and
3067  * RTE_MBUF_F_RX_FDIR_ID mbuf flags.
3068  *
3069  * This value is arbitrary and application-defined. Maximum allowed value
3070  * depends on the underlying implementation. It is returned in the
3071  * hash.fdir.hi mbuf field.
3072  */
3073 struct rte_flow_action_mark {
3074 	uint32_t id; /**< Integer value to return with packets. */
3075 };
3076 
3077 /**
3078  * @warning
3079  * @b EXPERIMENTAL: this structure may change without prior notice
3080  *
3081  * RTE_FLOW_ACTION_TYPE_JUMP
3082  *
3083  * Redirects packets to a group on the current device.
3084  *
3085  * In a hierarchy of groups, which can be used to represent physical or logical
3086  * flow tables on the device, this action allows the action to be a redirect to
3087  * a group on that device.
3088  */
3089 struct rte_flow_action_jump {
3090 	uint32_t group;
3091 };
3092 
3093 /**
3094  * RTE_FLOW_ACTION_TYPE_QUEUE
3095  *
3096  * Assign packets to a given queue index.
3097  */
3098 struct rte_flow_action_queue {
3099 	uint16_t index; /**< Queue index to use. */
3100 };
3101 
3102 /**
3103  * @warning
3104  * @b EXPERIMENTAL: this structure may change without prior notice
3105  *
3106  * RTE_FLOW_ACTION_TYPE_AGE
3107  *
3108  * Report flow as aged-out if timeout passed without any matching
3109  * on the flow. RTE_ETH_EVENT_FLOW_AGED event is triggered when a
3110  * port detects new aged-out flows.
3111  *
3112  * The flow context and the flow handle will be reported by the either
3113  * rte_flow_get_aged_flows or rte_flow_get_q_aged_flows APIs.
3114  */
3115 struct rte_flow_action_age {
3116 	uint32_t timeout:24; /**< Time in seconds. */
3117 	uint32_t reserved:8; /**< Reserved, must be zero. */
3118 	/** The user flow context, NULL means the rte_flow pointer. */
3119 	void *context;
3120 };
3121 
3122 /**
3123  * RTE_FLOW_ACTION_TYPE_AGE (query)
3124  *
3125  * Query structure to retrieve the aging status information of a
3126  * shared AGE action, or a flow rule using the AGE action.
3127  */
3128 struct rte_flow_query_age {
3129 	uint32_t reserved:6; /**< Reserved, must be zero. */
3130 	uint32_t aged:1; /**< 1 if aging timeout expired, 0 otherwise. */
3131 	/** sec_since_last_hit value is valid. */
3132 	uint32_t sec_since_last_hit_valid:1;
3133 	uint32_t sec_since_last_hit:24; /**< Seconds since last traffic hit. */
3134 };
3135 
3136 /**
3137  * @warning
3138  * @b EXPERIMENTAL: this structure may change without prior notice
3139  *
3140  * RTE_FLOW_ACTION_TYPE_AGE
3141  *
3142  * Update indirect AGE action attributes:
3143  *  - Timeout can be updated including stop/start action:
3144  *     +-------------+-------------+------------------------------+
3145  *     | Old Timeout | New Timeout | Updating                     |
3146  *     +=============+=============+==============================+
3147  *     | 0           | positive    | Start aging with new value   |
3148  *     +-------------+-------------+------------------------------+
3149  *     | positive    | 0           | Stop aging			  |
3150  *     +-------------+-------------+------------------------------+
3151  *     | positive    | positive    | Change timeout to new value  |
3152  *     +-------------+-------------+------------------------------+
3153  *  - sec_since_last_hit can be reset.
3154  */
3155 struct rte_flow_update_age {
3156 	uint32_t reserved:6; /**< Reserved, must be zero. */
3157 	uint32_t timeout_valid:1; /**< The timeout is valid for update. */
3158 	uint32_t timeout:24; /**< Time in seconds. */
3159 	/** Means that aging should assume packet passed the aging. */
3160 	uint32_t touch:1;
3161 };
3162 
3163 /**
3164  * @warning
3165  * @b EXPERIMENTAL: this structure may change without prior notice
3166  *
3167  * RTE_FLOW_ACTION_TYPE_COUNT
3168  *
3169  * Adds a counter action to a matched flow.
3170  *
3171  * If more than one count action is specified in a single flow rule, then each
3172  * action must specify a unique ID.
3173  *
3174  * Counters can be retrieved and reset through ``rte_flow_query()``, see
3175  * ``struct rte_flow_query_count``.
3176  *
3177  * For ports within the same switch domain then the counter ID namespace extends
3178  * to all ports within that switch domain.
3179  */
3180 struct rte_flow_action_count {
3181 	uint32_t id; /**< Counter ID. */
3182 };
3183 
3184 /**
3185  * RTE_FLOW_ACTION_TYPE_COUNT (query)
3186  *
3187  * Query structure to retrieve and reset flow rule counters.
3188  */
3189 struct rte_flow_query_count {
3190 	uint32_t reset:1; /**< Reset counters after query [in]. */
3191 	uint32_t hits_set:1; /**< hits field is set [out]. */
3192 	uint32_t bytes_set:1; /**< bytes field is set [out]. */
3193 	uint32_t reserved:29; /**< Reserved, must be zero [in, out]. */
3194 	uint64_t hits; /**< Number of hits for this rule [out]. */
3195 	uint64_t bytes; /**< Number of bytes through this rule [out]. */
3196 };
3197 
3198 /**
3199  * Hash function types.
3200  */
3201 enum rte_eth_hash_function {
3202 	RTE_ETH_HASH_FUNCTION_DEFAULT = 0,
3203 	RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */
3204 	RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */
3205 	/**
3206 	 * Symmetric Toeplitz: src, dst will be replaced by
3207 	 * xor(src, dst). For the case with src/dst only,
3208 	 * src or dst address will xor with zero pair.
3209 	 */
3210 	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
3211 	RTE_ETH_HASH_FUNCTION_MAX,
3212 };
3213 
3214 /**
3215  * RTE_FLOW_ACTION_TYPE_RSS
3216  *
3217  * Similar to QUEUE, except RSS is additionally performed on packets to
3218  * spread them among several queues according to the provided parameters.
3219  *
3220  * Unlike global RSS settings used by other DPDK APIs, unsetting the
3221  * @p types field does not disable RSS in a flow rule. Doing so instead
3222  * requests safe unspecified "best-effort" settings from the underlying PMD,
3223  * which depending on the flow rule, may result in anything ranging from
3224  * empty (single queue) to all-inclusive RSS.
3225  *
3226  * Note: RSS hash result is stored in the hash.rss mbuf field which overlaps
3227  * hash.fdir.lo. Since the MARK action sets the hash.fdir.hi field only,
3228  * both can be requested simultaneously.
3229  */
3230 struct rte_flow_action_rss {
3231 	enum rte_eth_hash_function func; /**< RSS hash function to apply. */
3232 	/**
3233 	 * Packet encapsulation level RSS hash @p types apply to.
3234 	 *
3235 	 * - @p 0 requests the default behavior. Depending on the packet
3236 	 *   type, it can mean outermost, innermost, anything in between or
3237 	 *   even no RSS.
3238 	 *
3239 	 *   It basically stands for the innermost encapsulation level RSS
3240 	 *   can be performed on according to PMD and device capabilities.
3241 	 *
3242 	 * - @p 1 requests RSS to be performed on the outermost packet
3243 	 *   encapsulation level.
3244 	 *
3245 	 * - @p 2 and subsequent values request RSS to be performed on the
3246 	 *   specified inner packet encapsulation level, from outermost to
3247 	 *   innermost (lower to higher values).
3248 	 *
3249 	 * Values other than @p 0 are not necessarily supported.
3250 	 *
3251 	 * Requesting a specific RSS level on unrecognized traffic results
3252 	 * in undefined behavior. For predictable results, it is recommended
3253 	 * to make the flow rule pattern match packet headers up to the
3254 	 * requested encapsulation level so that only matching traffic goes
3255 	 * through.
3256 	 */
3257 	uint32_t level;
3258 	uint64_t types; /**< Specific RSS hash types (see RTE_ETH_RSS_*). */
3259 	uint32_t key_len; /**< Hash key length in bytes. */
3260 	uint32_t queue_num; /**< Number of entries in @p queue. */
3261 	const uint8_t *key; /**< Hash key. */
3262 	const uint16_t *queue; /**< Queue indices to use. */
3263 };
3264 
3265 /**
3266  * @deprecated
3267  * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
3268  * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
3269  *
3270  * RTE_FLOW_ACTION_TYPE_VF
3271  *
3272  * Directs matching traffic to a given virtual function of the current
3273  * device.
3274  *
3275  * Packets matched by a VF pattern item can be redirected to their original
3276  * VF ID instead of the specified one. This parameter may not be available
3277  * and is not guaranteed to work properly if the VF part is matched by a
3278  * prior flow rule or if packets are not addressed to a VF in the first
3279  * place.
3280  */
3281 struct rte_flow_action_vf {
3282 	uint32_t original:1; /**< Use original VF ID if possible. */
3283 	uint32_t reserved:31; /**< Reserved, must be zero. */
3284 	uint32_t id; /**< VF ID. */
3285 };
3286 
3287 /**
3288  * @deprecated
3289  * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
3290  * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
3291  *
3292  * RTE_FLOW_ACTION_TYPE_PORT_ID
3293  *
3294  * Directs matching traffic to a given DPDK port ID.
3295  *
3296  * @see RTE_FLOW_ITEM_TYPE_PORT_ID
3297  */
3298 struct rte_flow_action_port_id {
3299 	uint32_t original:1; /**< Use original DPDK port ID if possible. */
3300 	uint32_t reserved:31; /**< Reserved, must be zero. */
3301 	uint32_t id; /**< DPDK port ID. */
3302 };
3303 
3304 /**
3305  * RTE_FLOW_ACTION_TYPE_METER
3306  *
3307  * Traffic metering and policing (MTR).
3308  *
3309  * Packets matched by items of this type can be either dropped or passed to the
3310  * next item with their color set by the MTR object.
3311  */
3312 struct rte_flow_action_meter {
3313 	uint32_t mtr_id; /**< MTR object ID created with rte_mtr_create(). */
3314 };
3315 
3316 /**
3317  * RTE_FLOW_ACTION_TYPE_SECURITY
3318  *
3319  * Perform the security action on flows matched by the pattern items
3320  * according to the configuration of the security session.
3321  *
3322  * This action modifies the payload of matched flows. For INLINE_CRYPTO, the
3323  * security protocol headers and IV are fully provided by the application as
3324  * specified in the flow pattern. The payload of matching packets is
3325  * encrypted on egress, and decrypted and authenticated on ingress.
3326  * For INLINE_PROTOCOL, the security protocol is fully offloaded to HW,
3327  * providing full encapsulation and decapsulation of packets in security
3328  * protocols. The flow pattern specifies both the outer security header fields
3329  * and the inner packet fields. The security session specified in the action
3330  * must match the pattern parameters.
3331  *
3332  * The security session specified in the action must be created on the same
3333  * port as the flow action that is being specified.
3334  *
3335  * The ingress/egress flow attribute should match that specified in the
3336  * security session if the security session supports the definition of the
3337  * direction.
3338  *
3339  * Multiple flows can be configured to use the same security session.
3340  *
3341  * The NULL value is allowed for security session. If security session is NULL,
3342  * then SPI field in ESP flow item and IP addresses in flow items 'IPv4' and
3343  * 'IPv6' will be allowed to be a range. The rule thus created can enable
3344  * security processing on multiple flows.
3345  */
3346 struct rte_flow_action_security {
3347 	void *security_session; /**< Pointer to security session structure. */
3348 };
3349 
3350 /**
3351  * RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN
3352  *
3353  * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by the
3354  * OpenFlow Switch Specification.
3355  */
3356 struct rte_flow_action_of_push_vlan {
3357 	rte_be16_t ethertype; /**< EtherType. */
3358 };
3359 
3360 /**
3361  * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID
3362  *
3363  * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN ID") as defined by
3364  * the OpenFlow Switch Specification.
3365  */
3366 struct rte_flow_action_of_set_vlan_vid {
3367 	rte_be16_t vlan_vid; /**< VLAN ID. */
3368 };
3369 
3370 /**
3371  * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP
3372  *
3373  * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as defined by
3374  * the OpenFlow Switch Specification.
3375  */
3376 struct rte_flow_action_of_set_vlan_pcp {
3377 	uint8_t vlan_pcp; /**< VLAN priority. */
3378 };
3379 
3380 /**
3381  * RTE_FLOW_ACTION_TYPE_OF_POP_MPLS
3382  *
3383  * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined by the
3384  * OpenFlow Switch Specification.
3385  */
3386 struct rte_flow_action_of_pop_mpls {
3387 	rte_be16_t ethertype; /**< EtherType. */
3388 };
3389 
3390 /**
3391  * RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS
3392  *
3393  * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by the
3394  * OpenFlow Switch Specification.
3395  */
3396 struct rte_flow_action_of_push_mpls {
3397 	rte_be16_t ethertype; /**< EtherType. */
3398 };
3399 
3400 /**
3401  * @warning
3402  * @b EXPERIMENTAL: this structure may change without prior notice
3403  *
3404  * RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP
3405  *
3406  * VXLAN tunnel end-point encapsulation data definition
3407  *
3408  * The tunnel definition is provided through the flow item pattern, the
3409  * provided pattern must conform to RFC7348 for the tunnel specified. The flow
3410  * definition must be provided in order from the RTE_FLOW_ITEM_TYPE_ETH
3411  * definition up the end item which is specified by RTE_FLOW_ITEM_TYPE_END.
3412  *
3413  * The mask field allows user to specify which fields in the flow item
3414  * definitions can be ignored and which have valid data and can be used
3415  * verbatim.
3416  *
3417  * Note: the last field is not used in the definition of a tunnel and can be
3418  * ignored.
3419  *
3420  * Valid flow definition for RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP include:
3421  *
3422  * - ETH / IPV4 / UDP / VXLAN / END
3423  * - ETH / IPV6 / UDP / VXLAN / END
3424  * - ETH / VLAN / IPV4 / UDP / VXLAN / END
3425  *
3426  */
3427 struct rte_flow_action_vxlan_encap {
3428 	/**
3429 	 * Encapsulating vxlan tunnel definition
3430 	 * (terminated by the END pattern item).
3431 	 */
3432 	struct rte_flow_item *definition;
3433 };
3434 
3435 /**
3436  * @warning
3437  * @b EXPERIMENTAL: this structure may change without prior notice
3438  *
3439  * RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP
3440  *
3441  * NVGRE tunnel end-point encapsulation data definition
3442  *
3443  * The tunnel definition is provided through the flow item pattern  the
3444  * provided pattern must conform with RFC7637. The flow definition must be
3445  * provided in order from the RTE_FLOW_ITEM_TYPE_ETH definition up the end item
3446  * which is specified by RTE_FLOW_ITEM_TYPE_END.
3447  *
3448  * The mask field allows user to specify which fields in the flow item
3449  * definitions can be ignored and which have valid data and can be used
3450  * verbatim.
3451  *
3452  * Note: the last field is not used in the definition of a tunnel and can be
3453  * ignored.
3454  *
3455  * Valid flow definition for RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP include:
3456  *
3457  * - ETH / IPV4 / NVGRE / END
3458  * - ETH / VLAN / IPV6 / NVGRE / END
3459  *
3460  */
3461 struct rte_flow_action_nvgre_encap {
3462 	/**
3463 	 * Encapsulating vxlan tunnel definition
3464 	 * (terminated by the END pattern item).
3465 	 */
3466 	struct rte_flow_item *definition;
3467 };
3468 
3469 /**
3470  * @warning
3471  * @b EXPERIMENTAL: this structure may change without prior notice
3472  *
3473  * RTE_FLOW_ACTION_TYPE_RAW_ENCAP
3474  *
3475  * Raw tunnel end-point encapsulation data definition.
3476  *
3477  * The data holds the headers definitions to be applied on the packet.
3478  * The data must start with ETH header up to the tunnel item header itself.
3479  * When used right after RAW_DECAP (for decapsulating L3 tunnel type for
3480  * example MPLSoGRE) the data will just hold layer 2 header.
3481  *
3482  * The preserve parameter holds which bits in the packet the PMD is not allowed
3483  * to change, this parameter can also be NULL and then the PMD is allowed
3484  * to update any field.
3485  *
3486  * size holds the number of bytes in @p data and @p preserve.
3487  */
3488 struct rte_flow_action_raw_encap {
3489 	uint8_t *data; /**< Encapsulation data. */
3490 	uint8_t *preserve; /**< Bit-mask of @p data to preserve on output. */
3491 	size_t size; /**< Size of @p data and @p preserve. */
3492 };
3493 
3494 /**
3495  * @warning
3496  * @b EXPERIMENTAL: this structure may change without prior notice
3497  *
3498  * RTE_FLOW_ACTION_TYPE_RAW_DECAP
3499  *
3500  * Raw tunnel end-point decapsulation data definition.
3501  *
3502  * The data holds the headers definitions to be removed from the packet.
3503  * The data must start with ETH header up to the tunnel item header itself.
3504  * When used right before RAW_DECAP (for encapsulating L3 tunnel type for
3505  * example MPLSoGRE) the data will just hold layer 2 header.
3506  *
3507  * size holds the number of bytes in @p data.
3508  */
3509 struct rte_flow_action_raw_decap {
3510 	uint8_t *data; /**< Encapsulation data. */
3511 	size_t size; /**< Size of @p data and @p preserve. */
3512 };
3513 
3514 /**
3515  * @warning
3516  * @b EXPERIMENTAL: this structure may change without prior notice
3517  *
3518  * RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC
3519  * RTE_FLOW_ACTION_TYPE_SET_IPV4_DST
3520  *
3521  * Allows modification of IPv4 source (RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC)
3522  * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV4_DST) in the
3523  * specified outermost IPv4 header.
3524  */
3525 struct rte_flow_action_set_ipv4 {
3526 	rte_be32_t ipv4_addr;
3527 };
3528 
3529 /**
3530  * @warning
3531  * @b EXPERIMENTAL: this structure may change without prior notice
3532  *
3533  * RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC
3534  * RTE_FLOW_ACTION_TYPE_SET_IPV6_DST
3535  *
3536  * Allows modification of IPv6 source (RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC)
3537  * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) in the
3538  * specified outermost IPv6 header.
3539  */
3540 struct rte_flow_action_set_ipv6 {
3541 	uint8_t ipv6_addr[16];
3542 };
3543 
3544 /**
3545  * @warning
3546  * @b EXPERIMENTAL: this structure may change without prior notice.
3547  *
3548  * RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH
3549  *
3550  * Valid flow definition for RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH include:
3551  *
3552  * - IPV6_EXT TYPE / IPV6_EXT_HEADER_IN_TYPE / END
3553  *
3554  * The data must be added as the last IPv6 extension.
3555  */
3556 struct rte_flow_action_ipv6_ext_push {
3557 	uint8_t *data; /**< IPv6 extension header data. */
3558 	size_t size; /**< Size (in bytes) of @p data. */
3559 	uint8_t type; /**< Type of IPv6 extension. */
3560 };
3561 
3562 /**
3563  * @warning
3564  * @b EXPERIMENTAL: this structure may change without prior notice.
3565  *
3566  * RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE
3567  *
3568  * Valid flow definition for RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE include:
3569  *
3570  * - IPV6_EXT TYPE / END
3571  */
3572 struct rte_flow_action_ipv6_ext_remove {
3573 	uint8_t type; /**< Type of IPv6 extension. */
3574 };
3575 
3576 /**
3577  * @warning
3578  * @b EXPERIMENTAL: this structure may change without prior notice
3579  *
3580  * RTE_FLOW_ACTION_TYPE_SET_TP_SRC
3581  * RTE_FLOW_ACTION_TYPE_SET_TP_DST
3582  *
3583  * Allows modification of source (RTE_FLOW_ACTION_TYPE_SET_TP_SRC)
3584  * and destination (RTE_FLOW_ACTION_TYPE_SET_TP_DST) port numbers
3585  * in the specified outermost TCP/UDP header.
3586  */
3587 struct rte_flow_action_set_tp {
3588 	rte_be16_t port;
3589 };
3590 
3591 /**
3592  * RTE_FLOW_ACTION_TYPE_SET_TTL
3593  *
3594  * Set the TTL value directly for IPv4 or IPv6
3595  */
3596 struct rte_flow_action_set_ttl {
3597 	uint8_t ttl_value;
3598 };
3599 
3600 /**
3601  * RTE_FLOW_ACTION_TYPE_SET_MAC
3602  *
3603  * Set MAC address from the matched flow
3604  */
3605 struct rte_flow_action_set_mac {
3606 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
3607 };
3608 
3609 /**
3610  * @warning
3611  * @b EXPERIMENTAL: this structure may change without prior notice
3612  *
3613  * RTE_FLOW_ACTION_TYPE_SET_TAG
3614  *
3615  * Set a tag which is a transient data used during flow matching. This is not
3616  * delivered to application. Multiple tags are supported by specifying index.
3617  */
3618 struct rte_flow_action_set_tag {
3619 	uint32_t data;
3620 	uint32_t mask;
3621 	uint8_t index;
3622 };
3623 
3624 /**
3625  * @warning
3626  * @b EXPERIMENTAL: this structure may change without prior notice
3627  *
3628  * RTE_FLOW_ACTION_TYPE_SET_META
3629  *
3630  * Set metadata. Metadata set by mbuf metadata dynamic field with
3631  * RTE_MBUF_DYNFLAG_TX_METADATA flag on egress will be overridden by this
3632  * action. On ingress, the metadata will be carried by mbuf metadata dynamic
3633  * field with RTE_MBUF_DYNFLAG_RX_METADATA flag if set.  The dynamic mbuf field
3634  * must be registered in advance by rte_flow_dynf_metadata_register().
3635  *
3636  * Altering partial bits is supported with mask. For bits which have never
3637  * been set, unpredictable value will be seen depending on driver
3638  * implementation. For loopback/hairpin packet, metadata set on Rx/Tx may
3639  * or may not be propagated to the other path depending on HW capability.
3640  *
3641  * RTE_FLOW_ITEM_TYPE_META matches metadata.
3642  */
3643 struct rte_flow_action_set_meta {
3644 	uint32_t data;
3645 	uint32_t mask;
3646 };
3647 
3648 /**
3649  * RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP
3650  * RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP
3651  *
3652  * Set the DSCP value for IPv4/IPv6 header.
3653  * DSCP in low 6 bits, rest ignored.
3654  */
3655 struct rte_flow_action_set_dscp {
3656 	uint8_t dscp;
3657 };
3658 
3659 /**
3660  * @warning
3661  * @b EXPERIMENTAL: this structure may change without prior notice
3662  *
3663  * RTE_FLOW_ACTION_TYPE_INDIRECT
3664  *
3665  * Opaque type returned after successfully creating an indirect action object.
3666  * The definition of the object handle is different per driver or
3667  * per direct action type.
3668  *
3669  * This handle can be used to manage and query the related direct action:
3670  * - referenced in single flow rule or across multiple flow rules
3671  *   over multiple ports
3672  * - update action object configuration
3673  * - query action object data
3674  * - destroy action object
3675  */
3676 struct rte_flow_action_handle;
3677 
3678 /**
3679  * The state of a TCP connection.
3680  */
3681 enum rte_flow_conntrack_state {
3682 	/** SYN-ACK packet was seen. */
3683 	RTE_FLOW_CONNTRACK_STATE_SYN_RECV,
3684 	/** 3-way handshake was done. */
3685 	RTE_FLOW_CONNTRACK_STATE_ESTABLISHED,
3686 	/** First FIN packet was received to close the connection. */
3687 	RTE_FLOW_CONNTRACK_STATE_FIN_WAIT,
3688 	/** First FIN was ACKed. */
3689 	RTE_FLOW_CONNTRACK_STATE_CLOSE_WAIT,
3690 	/** Second FIN was received, waiting for the last ACK. */
3691 	RTE_FLOW_CONNTRACK_STATE_LAST_ACK,
3692 	/** Second FIN was ACKed, connection was closed. */
3693 	RTE_FLOW_CONNTRACK_STATE_TIME_WAIT,
3694 };
3695 
3696 /**
3697  * The last passed TCP packet flags of a connection.
3698  */
3699 enum rte_flow_conntrack_tcp_last_index {
3700 	RTE_FLOW_CONNTRACK_FLAG_NONE = 0, /**< No Flag. */
3701 	RTE_FLOW_CONNTRACK_FLAG_SYN = RTE_BIT32(0), /**< With SYN flag. */
3702 	RTE_FLOW_CONNTRACK_FLAG_SYNACK = RTE_BIT32(1), /**< With SYNACK flag. */
3703 	RTE_FLOW_CONNTRACK_FLAG_FIN = RTE_BIT32(2), /**< With FIN flag. */
3704 	RTE_FLOW_CONNTRACK_FLAG_ACK = RTE_BIT32(3), /**< With ACK flag. */
3705 	RTE_FLOW_CONNTRACK_FLAG_RST = RTE_BIT32(4), /**< With RST flag. */
3706 };
3707 
3708 /**
3709  * @warning
3710  * @b EXPERIMENTAL: this structure may change without prior notice
3711  *
3712  * Configuration parameters for each direction of a TCP connection.
3713  * All fields should be in host byte order.
3714  * If needed, driver should convert all fields to network byte order
3715  * if HW needs them in that way.
3716  */
3717 struct rte_flow_tcp_dir_param {
3718 	/** TCP window scaling factor, 0xF to disable. */
3719 	uint32_t scale:4;
3720 	/** The FIN was sent by this direction. */
3721 	uint32_t close_initiated:1;
3722 	/** An ACK packet has been received by this side. */
3723 	uint32_t last_ack_seen:1;
3724 	/**
3725 	 * If set, it indicates that there is unacknowledged data for the
3726 	 * packets sent from this direction.
3727 	 */
3728 	uint32_t data_unacked:1;
3729 	/**
3730 	 * Maximal value of sequence + payload length in sent
3731 	 * packets (next ACK from the opposite direction).
3732 	 */
3733 	uint32_t sent_end;
3734 	/**
3735 	 * Maximal value of (ACK + window size) in received packet + length
3736 	 * over sent packet (maximal sequence could be sent).
3737 	 */
3738 	uint32_t reply_end;
3739 	/** Maximal value of actual window size in sent packets. */
3740 	uint32_t max_win;
3741 	/** Maximal value of ACK in sent packets. */
3742 	uint32_t max_ack;
3743 };
3744 
3745 /**
3746  * @warning
3747  * @b EXPERIMENTAL: this structure may change without prior notice
3748  *
3749  * RTE_FLOW_ACTION_TYPE_CONNTRACK
3750  *
3751  * Configuration and initial state for the connection tracking module.
3752  * This structure could be used for both setting and query.
3753  * All fields should be in host byte order.
3754  */
3755 struct rte_flow_action_conntrack {
3756 	/** The peer port number, can be the same port. */
3757 	uint16_t peer_port;
3758 	/**
3759 	 * Direction of this connection when creating a flow rule, the
3760 	 * value only affects the creation of subsequent flow rules.
3761 	 */
3762 	uint32_t is_original_dir:1;
3763 	/**
3764 	 * Enable / disable the conntrack HW module. When disabled, the
3765 	 * result will always be RTE_FLOW_CONNTRACK_FLAG_DISABLED.
3766 	 * In this state the HW will act as passthrough.
3767 	 * It only affects this conntrack object in the HW without any effect
3768 	 * to the other objects.
3769 	 */
3770 	uint32_t enable:1;
3771 	/** At least one ack was seen after the connection was established. */
3772 	uint32_t live_connection:1;
3773 	/** Enable selective ACK on this connection. */
3774 	uint32_t selective_ack:1;
3775 	/** A challenge ack has passed. */
3776 	uint32_t challenge_ack_passed:1;
3777 	/**
3778 	 * 1: The last packet is seen from the original direction.
3779 	 * 0: The last packet is seen from the reply direction.
3780 	 */
3781 	uint32_t last_direction:1;
3782 	/** No TCP check will be done except the state change. */
3783 	uint32_t liberal_mode:1;
3784 	/** The current state of this connection. */
3785 	enum rte_flow_conntrack_state state;
3786 	/** Scaling factor for maximal allowed ACK window. */
3787 	uint8_t max_ack_window;
3788 	/** Maximal allowed number of retransmission times. */
3789 	uint8_t retransmission_limit;
3790 	/** TCP parameters of the original direction. */
3791 	struct rte_flow_tcp_dir_param original_dir;
3792 	/** TCP parameters of the reply direction. */
3793 	struct rte_flow_tcp_dir_param reply_dir;
3794 	/** The window value of the last packet passed this conntrack. */
3795 	uint16_t last_window;
3796 	enum rte_flow_conntrack_tcp_last_index last_index;
3797 	/** The sequence of the last packet passed this conntrack. */
3798 	uint32_t last_seq;
3799 	/** The acknowledgment of the last packet passed this conntrack. */
3800 	uint32_t last_ack;
3801 	/**
3802 	 * The total value ACK + payload length of the last packet
3803 	 * passed this conntrack.
3804 	 */
3805 	uint32_t last_end;
3806 };
3807 
3808 /**
3809  * RTE_FLOW_ACTION_TYPE_CONNTRACK
3810  *
3811  * Wrapper structure for the context update interface.
3812  * Ports cannot support updating, and the only valid solution is to
3813  * destroy the old context and create a new one instead.
3814  */
3815 struct rte_flow_modify_conntrack {
3816 	/** New connection tracking parameters to be updated. */
3817 	struct rte_flow_action_conntrack new_ct;
3818 	/** The direction field will be updated. */
3819 	uint32_t direction:1;
3820 	/** All the other fields except direction will be updated. */
3821 	uint32_t state:1;
3822 	/** Reserved bits for the future usage. */
3823 	uint32_t reserved:30;
3824 };
3825 
3826 /**
3827  * @warning
3828  * @b EXPERIMENTAL: this structure may change without prior notice
3829  *
3830  * RTE_FLOW_ACTION_TYPE_METER_COLOR
3831  *
3832  * The meter color should be set in the packet meta-data
3833  * (i.e. struct rte_mbuf::sched::color).
3834  */
3835 struct rte_flow_action_meter_color {
3836 	enum rte_color color; /**< Packet color. */
3837 };
3838 
3839 /**
3840  * Provides an ethdev port ID for use with the following actions:
3841  * RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
3842  * RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT.
3843  */
3844 struct rte_flow_action_ethdev {
3845 	uint16_t port_id; /**< ethdev port ID */
3846 };
3847 
3848 /**
3849  * Field IDs for MODIFY_FIELD action.
3850  */
3851 enum rte_flow_field_id {
3852 	RTE_FLOW_FIELD_START = 0,	/**< Start of a packet. */
3853 	RTE_FLOW_FIELD_MAC_DST,		/**< Destination MAC Address. */
3854 	RTE_FLOW_FIELD_MAC_SRC,		/**< Source MAC Address. */
3855 	RTE_FLOW_FIELD_VLAN_TYPE,	/**< VLAN Tag Identifier. */
3856 	RTE_FLOW_FIELD_VLAN_ID,		/**< VLAN Identifier. */
3857 	RTE_FLOW_FIELD_MAC_TYPE,	/**< EtherType. */
3858 	RTE_FLOW_FIELD_IPV4_DSCP,	/**< IPv4 DSCP. */
3859 	RTE_FLOW_FIELD_IPV4_TTL,	/**< IPv4 Time To Live. */
3860 	RTE_FLOW_FIELD_IPV4_SRC,	/**< IPv4 Source Address. */
3861 	RTE_FLOW_FIELD_IPV4_DST,	/**< IPv4 Destination Address. */
3862 	RTE_FLOW_FIELD_IPV6_DSCP,	/**< IPv6 DSCP. */
3863 	RTE_FLOW_FIELD_IPV6_HOPLIMIT,	/**< IPv6 Hop Limit. */
3864 	RTE_FLOW_FIELD_IPV6_SRC,	/**< IPv6 Source Address. */
3865 	RTE_FLOW_FIELD_IPV6_DST,	/**< IPv6 Destination Address. */
3866 	RTE_FLOW_FIELD_TCP_PORT_SRC,	/**< TCP Source Port Number. */
3867 	RTE_FLOW_FIELD_TCP_PORT_DST,	/**< TCP Destination Port Number. */
3868 	RTE_FLOW_FIELD_TCP_SEQ_NUM,	/**< TCP Sequence Number. */
3869 	RTE_FLOW_FIELD_TCP_ACK_NUM,	/**< TCP Acknowledgment Number. */
3870 	RTE_FLOW_FIELD_TCP_FLAGS,	/**< TCP Flags. */
3871 	RTE_FLOW_FIELD_UDP_PORT_SRC,	/**< UDP Source Port Number. */
3872 	RTE_FLOW_FIELD_UDP_PORT_DST,	/**< UDP Destination Port Number. */
3873 	RTE_FLOW_FIELD_VXLAN_VNI,	/**< VXLAN Network Identifier. */
3874 	RTE_FLOW_FIELD_GENEVE_VNI,	/**< GENEVE Network Identifier. */
3875 	RTE_FLOW_FIELD_GTP_TEID,	/**< GTP Tunnel Endpoint Identifier. */
3876 	RTE_FLOW_FIELD_TAG,		/**< Tag value. */
3877 	RTE_FLOW_FIELD_MARK,		/**< Mark value. */
3878 	RTE_FLOW_FIELD_META,		/**< Metadata value. */
3879 	RTE_FLOW_FIELD_POINTER,		/**< Memory pointer. */
3880 	RTE_FLOW_FIELD_VALUE,		/**< Immediate value. */
3881 	RTE_FLOW_FIELD_IPV4_ECN,	/**< IPv4 ECN. */
3882 	RTE_FLOW_FIELD_IPV6_ECN,	/**< IPv6 ECN. */
3883 	RTE_FLOW_FIELD_GTP_PSC_QFI,	/**< GTP QFI. */
3884 	RTE_FLOW_FIELD_METER_COLOR,	/**< Meter color marker. */
3885 	RTE_FLOW_FIELD_IPV6_PROTO,	/**< IPv6 next header. */
3886 	RTE_FLOW_FIELD_FLEX_ITEM,	/**< Flex item. */
3887 	RTE_FLOW_FIELD_HASH_RESULT,	/**< Hash result. */
3888 	RTE_FLOW_FIELD_GENEVE_OPT_TYPE,	/**< GENEVE option type. */
3889 	RTE_FLOW_FIELD_GENEVE_OPT_CLASS,/**< GENEVE option class. */
3890 	RTE_FLOW_FIELD_GENEVE_OPT_DATA,	/**< GENEVE option data. */
3891 	RTE_FLOW_FIELD_MPLS,		/**< MPLS header. */
3892 };
3893 
3894 /**
3895  * @warning
3896  * @b EXPERIMENTAL: this structure may change without prior notice
3897  *
3898  * Field description for MODIFY_FIELD action.
3899  */
3900 struct rte_flow_action_modify_data {
3901 	enum rte_flow_field_id field; /**< Field or memory type ID. */
3902 	RTE_STD_C11
3903 	union {
3904 		struct {
3905 			/** Encapsulation level and tag index or flex item handle. */
3906 			union {
3907 				struct {
3908 					/**
3909 					 * Packet encapsulation level containing
3910 					 * the field to modify.
3911 					 *
3912 					 * - @p 0 requests the default behavior.
3913 					 *   Depending on the packet type, it
3914 					 *   can mean outermost, innermost or
3915 					 *   anything in between.
3916 					 *
3917 					 *   It basically stands for the
3918 					 *   innermost encapsulation level.
3919 					 *   Modification can be performed
3920 					 *   according to PMD and device
3921 					 *   capabilities.
3922 					 *
3923 					 * - @p 1 requests modification to be
3924 					 *   performed on the outermost packet
3925 					 *   encapsulation level.
3926 					 *
3927 					 * - @p 2 and subsequent values request
3928 					 *   modification to be performed on
3929 					 *   the specified inner packet
3930 					 *   encapsulation level, from
3931 					 *   outermost to innermost (lower to
3932 					 *   higher values).
3933 					 *
3934 					 * Values other than @p 0 are not
3935 					 * necessarily supported.
3936 					 *
3937 					 * @note that for MPLS field,
3938 					 * encapsulation level also include
3939 					 * tunnel since MPLS may appear in
3940 					 * outer, inner or tunnel.
3941 					 */
3942 					uint8_t level;
3943 					union {
3944 						/**
3945 						 * Tag index array inside
3946 						 * encapsulation level.
3947 						 * Used for VLAN, MPLS or TAG types.
3948 						 */
3949 						uint8_t tag_index;
3950 						/**
3951 						 * Geneve option identifier.
3952 						 * Relevant only for
3953 						 * RTE_FLOW_FIELD_GENEVE_OPT_XXXX
3954 						 * modification type.
3955 						 */
3956 						struct {
3957 							/**
3958 							 * Geneve option type.
3959 							 */
3960 							uint8_t type;
3961 							/**
3962 							 * Geneve option class.
3963 							 */
3964 							rte_be16_t class_id;
3965 						};
3966 					};
3967 				};
3968 				struct rte_flow_item_flex_handle *flex_handle;
3969 			};
3970 			/** Number of bits to skip from a field. */
3971 			uint32_t offset;
3972 		};
3973 		/**
3974 		 * Immediate value for RTE_FLOW_FIELD_VALUE, presented in the
3975 		 * same byte order and length as in relevant rte_flow_item_xxx.
3976 		 * The immediate source bitfield offset is inherited from
3977 		 * the destination's one.
3978 		 */
3979 		uint8_t value[16];
3980 		/**
3981 		 * Memory address for RTE_FLOW_FIELD_POINTER, memory layout
3982 		 * should be the same as for relevant field in the
3983 		 * rte_flow_item_xxx structure.
3984 		 */
3985 		void *pvalue;
3986 	};
3987 };
3988 
3989 /**
3990  * Operation types for MODIFY_FIELD action.
3991  */
3992 enum rte_flow_modify_op {
3993 	RTE_FLOW_MODIFY_SET = 0, /**< Set a new value. */
3994 	RTE_FLOW_MODIFY_ADD,     /**< Add a value to a field.  */
3995 	RTE_FLOW_MODIFY_SUB,     /**< Subtract a value from a field. */
3996 };
3997 
3998 /**
3999  * @warning
4000  * @b EXPERIMENTAL: this structure may change without prior notice
4001  *
4002  * RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
4003  *
4004  * Modify a destination header field according to the specified
4005  * operation. Another field of the packet can be used as a source as well
4006  * as tag, mark, metadata, immediate value or a pointer to it.
4007  */
4008 struct rte_flow_action_modify_field {
4009 	enum rte_flow_modify_op operation; /**< Operation to perform. */
4010 	struct rte_flow_action_modify_data dst; /**< Destination field. */
4011 	struct rte_flow_action_modify_data src; /**< Source field. */
4012 	uint32_t width; /**< Number of bits to use from a source field. */
4013 };
4014 
4015 /**
4016  * RTE_FLOW_ACTION_TYPE_METER_MARK
4017  *
4018  * Traffic metering and marking (MTR).
4019  *
4020  * Meters a packet stream and marks its packets either
4021  * green, yellow, or red according to the specified profile.
4022  * The policy is optional and may be specified for defining
4023  * subsequent actions based on a color assigned by MTR.
4024  * Alternatively, the METER_COLOR item may be used for this.
4025  */
4026 struct rte_flow_action_meter_mark {
4027 
4028 	/**< Profile config retrieved with rte_mtr_profile_get(). */
4029 	struct rte_flow_meter_profile *profile;
4030 	/**< Policy config retrieved with rte_mtr_policy_get(). */
4031 	struct rte_flow_meter_policy *policy;
4032 	/** Metering mode: 0 - Color-Blind, 1 - Color-Aware. */
4033 	int color_mode;
4034 	/** Initial Color applied to packets in Color-Aware mode. */
4035 	enum rte_color init_color;
4036 	/** Metering state: 0 - Disabled, 1 - Enabled. */
4037 	int state;
4038 };
4039 
4040 /**
4041  * RTE_FLOW_ACTION_TYPE_METER_MARK
4042  *
4043  * Wrapper structure for the context update interface.
4044  *
4045  */
4046 struct rte_flow_update_meter_mark {
4047 	/** New meter_mark parameters to be updated. */
4048 	struct rte_flow_action_meter_mark meter_mark;
4049 	/** The profile will be updated. */
4050 	uint32_t profile_valid:1;
4051 	/** The policy will be updated. */
4052 	uint32_t policy_valid:1;
4053 	/** The color mode will be updated. */
4054 	uint32_t color_mode_valid:1;
4055 	/** The initial color will be updated. */
4056 	uint32_t init_color_valid:1;
4057 	/** The meter state will be updated. */
4058 	uint32_t state_valid:1;
4059 	/** Reserved bits for the future usage. */
4060 	uint32_t reserved:27;
4061 };
4062 
4063 /**
4064  * @see RTE_FLOW_ACTION_TYPE_METER_MARK
4065  * @see RTE_FLOW_ACTION_TYPE_INDIRECT_LIST
4066  *
4067  * Update flow mutable context.
4068  */
4069 struct rte_flow_indirect_update_flow_meter_mark {
4070 	/** Updated init color applied to packet */
4071 	enum rte_color init_color;
4072 };
4073 
4074 /* Mbuf dynamic field offset for metadata. */
4075 extern int32_t rte_flow_dynf_metadata_offs;
4076 
4077 /* Mbuf dynamic field flag mask for metadata. */
4078 extern uint64_t rte_flow_dynf_metadata_mask;
4079 
4080 /* Mbuf dynamic field pointer for metadata. */
4081 #define RTE_FLOW_DYNF_METADATA(m) \
4082 	RTE_MBUF_DYNFIELD((m), rte_flow_dynf_metadata_offs, uint32_t *)
4083 
4084 /* Mbuf dynamic flags for metadata. */
4085 #define RTE_MBUF_DYNFLAG_RX_METADATA (rte_flow_dynf_metadata_mask)
4086 #define RTE_MBUF_DYNFLAG_TX_METADATA (rte_flow_dynf_metadata_mask)
4087 
4088 __rte_experimental
4089 static inline uint32_t
4090 rte_flow_dynf_metadata_get(struct rte_mbuf *m)
4091 {
4092 	return *RTE_FLOW_DYNF_METADATA(m);
4093 }
4094 
4095 __rte_experimental
4096 static inline void
4097 rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v)
4098 {
4099 	*RTE_FLOW_DYNF_METADATA(m) = v;
4100 }
4101 
4102 /**
4103  * Definition of a single action.
4104  *
4105  * A list of actions is terminated by a END action.
4106  *
4107  * For simple actions without a configuration object, conf remains NULL.
4108  */
4109 struct rte_flow_action {
4110 	enum rte_flow_action_type type; /**< Action type. */
4111 	const void *conf; /**< Pointer to action configuration object. */
4112 };
4113 
4114 /**
4115  * Opaque type returned after successfully creating a flow.
4116  *
4117  * This handle can be used to manage and query the related flow (e.g. to
4118  * destroy it or retrieve counters).
4119  */
4120 struct rte_flow;
4121 
4122 /**
4123  * Opaque type for Meter profile object returned by MTR API.
4124  *
4125  * This handle can be used to create Meter actions instead of profile ID.
4126  */
4127 struct rte_flow_meter_profile;
4128 
4129 /**
4130  * Opaque type for Meter policy object returned by MTR API.
4131  *
4132  * This handle can be used to create Meter actions instead of policy ID.
4133  */
4134 struct rte_flow_meter_policy;
4135 
4136 /**
4137  * @warning
4138  * @b EXPERIMENTAL: this structure may change without prior notice
4139  *
4140  * RTE_FLOW_ACTION_TYPE_SAMPLE
4141  *
4142  * Adds a sample action to a matched flow.
4143  *
4144  * The matching packets will be duplicated with specified ratio and applied
4145  * with own set of actions with a fate action, the sampled packet could be
4146  * redirected to queue or port. All the packets continue processing on the
4147  * default flow path.
4148  *
4149  * When the sample ratio is set to 1 then the packets will be 100% mirrored.
4150  * Additional action list be supported to add for sampled or mirrored packets.
4151  */
4152 struct rte_flow_action_sample {
4153 	uint32_t ratio; /**< packets sampled equals to '1/ratio'. */
4154 	/** sub-action list specific for the sampling hit cases. */
4155 	const struct rte_flow_action *actions;
4156 };
4157 
4158 /**
4159  * Verbose error types.
4160  *
4161  * Most of them provide the type of the object referenced by struct
4162  * rte_flow_error.cause.
4163  */
4164 enum rte_flow_error_type {
4165 	RTE_FLOW_ERROR_TYPE_NONE, /**< No error. */
4166 	RTE_FLOW_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
4167 	RTE_FLOW_ERROR_TYPE_HANDLE, /**< Flow rule (handle). */
4168 	RTE_FLOW_ERROR_TYPE_ATTR_GROUP, /**< Group field. */
4169 	RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, /**< Priority field. */
4170 	RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, /**< Ingress field. */
4171 	RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, /**< Egress field. */
4172 	RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, /**< Transfer field. */
4173 	RTE_FLOW_ERROR_TYPE_ATTR, /**< Attributes structure. */
4174 	RTE_FLOW_ERROR_TYPE_ITEM_NUM, /**< Pattern length. */
4175 	RTE_FLOW_ERROR_TYPE_ITEM_SPEC, /**< Item specification. */
4176 	RTE_FLOW_ERROR_TYPE_ITEM_LAST, /**< Item specification range. */
4177 	RTE_FLOW_ERROR_TYPE_ITEM_MASK, /**< Item specification mask. */
4178 	RTE_FLOW_ERROR_TYPE_ITEM, /**< Specific pattern item. */
4179 	RTE_FLOW_ERROR_TYPE_ACTION_NUM, /**< Number of actions. */
4180 	RTE_FLOW_ERROR_TYPE_ACTION_CONF, /**< Action configuration. */
4181 	RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */
4182 	RTE_FLOW_ERROR_TYPE_STATE, /**< Current device state. */
4183 };
4184 
4185 /**
4186  * Verbose error structure definition.
4187  *
4188  * This object is normally allocated by applications and set by PMDs, the
4189  * message points to a constant string which does not need to be freed by
4190  * the application, however its pointer can be considered valid only as long
4191  * as its associated DPDK port remains configured. Closing the underlying
4192  * device or unloading the PMD invalidates it.
4193  *
4194  * Both cause and message may be NULL regardless of the error type.
4195  */
4196 struct rte_flow_error {
4197 	enum rte_flow_error_type type; /**< Cause field and error types. */
4198 	const void *cause; /**< Object responsible for the error. */
4199 	const char *message; /**< Human-readable error message. */
4200 };
4201 
4202 /**
4203  * Complete flow rule description.
4204  *
4205  * This object type is used when converting a flow rule description.
4206  *
4207  * @see RTE_FLOW_CONV_OP_RULE
4208  * @see rte_flow_conv()
4209  */
4210 RTE_STD_C11
4211 struct rte_flow_conv_rule {
4212 	union {
4213 		const struct rte_flow_attr *attr_ro; /**< RO attributes. */
4214 		struct rte_flow_attr *attr; /**< Attributes. */
4215 	};
4216 	union {
4217 		const struct rte_flow_item *pattern_ro; /**< RO pattern. */
4218 		struct rte_flow_item *pattern; /**< Pattern items. */
4219 	};
4220 	union {
4221 		const struct rte_flow_action *actions_ro; /**< RO actions. */
4222 		struct rte_flow_action *actions; /**< List of actions. */
4223 	};
4224 };
4225 
4226 /**
4227  * Conversion operations for flow API objects.
4228  *
4229  * @see rte_flow_conv()
4230  */
4231 enum rte_flow_conv_op {
4232 	/**
4233 	 * No operation to perform.
4234 	 *
4235 	 * rte_flow_conv() simply returns 0.
4236 	 */
4237 	RTE_FLOW_CONV_OP_NONE,
4238 
4239 	/**
4240 	 * Convert attributes structure.
4241 	 *
4242 	 * This is a basic copy of an attributes structure.
4243 	 *
4244 	 * - @p src type:
4245 	 *   @code const struct rte_flow_attr * @endcode
4246 	 * - @p dst type:
4247 	 *   @code struct rte_flow_attr * @endcode
4248 	 */
4249 	RTE_FLOW_CONV_OP_ATTR,
4250 
4251 	/**
4252 	 * Convert a single item.
4253 	 *
4254 	 * Duplicates @p spec, @p last and @p mask but not outside objects.
4255 	 *
4256 	 * - @p src type:
4257 	 *   @code const struct rte_flow_item * @endcode
4258 	 * - @p dst type:
4259 	 *   @code struct rte_flow_item * @endcode
4260 	 */
4261 	RTE_FLOW_CONV_OP_ITEM,
4262 
4263 	/**
4264 	 * Convert a single action.
4265 	 *
4266 	 * Duplicates @p conf but not outside objects.
4267 	 *
4268 	 * - @p src type:
4269 	 *   @code const struct rte_flow_action * @endcode
4270 	 * - @p dst type:
4271 	 *   @code struct rte_flow_action * @endcode
4272 	 */
4273 	RTE_FLOW_CONV_OP_ACTION,
4274 
4275 	/**
4276 	 * Convert an entire pattern.
4277 	 *
4278 	 * Duplicates all pattern items at once with the same constraints as
4279 	 * RTE_FLOW_CONV_OP_ITEM.
4280 	 *
4281 	 * - @p src type:
4282 	 *   @code const struct rte_flow_item * @endcode
4283 	 * - @p dst type:
4284 	 *   @code struct rte_flow_item * @endcode
4285 	 */
4286 	RTE_FLOW_CONV_OP_PATTERN,
4287 
4288 	/**
4289 	 * Convert a list of actions.
4290 	 *
4291 	 * Duplicates the entire list of actions at once with the same
4292 	 * constraints as RTE_FLOW_CONV_OP_ACTION.
4293 	 *
4294 	 * - @p src type:
4295 	 *   @code const struct rte_flow_action * @endcode
4296 	 * - @p dst type:
4297 	 *   @code struct rte_flow_action * @endcode
4298 	 */
4299 	RTE_FLOW_CONV_OP_ACTIONS,
4300 
4301 	/**
4302 	 * Convert a complete flow rule description.
4303 	 *
4304 	 * Comprises attributes, pattern and actions together at once with
4305 	 * the usual constraints.
4306 	 *
4307 	 * - @p src type:
4308 	 *   @code const struct rte_flow_conv_rule * @endcode
4309 	 * - @p dst type:
4310 	 *   @code struct rte_flow_conv_rule * @endcode
4311 	 */
4312 	RTE_FLOW_CONV_OP_RULE,
4313 
4314 	/**
4315 	 * Convert item type to its name string.
4316 	 *
4317 	 * Writes a NUL-terminated string to @p dst. Like snprintf(), the
4318 	 * returned value excludes the terminator which is always written
4319 	 * nonetheless.
4320 	 *
4321 	 * - @p src type:
4322 	 *   @code (const void *)enum rte_flow_item_type @endcode
4323 	 * - @p dst type:
4324 	 *   @code char * @endcode
4325 	 **/
4326 	RTE_FLOW_CONV_OP_ITEM_NAME,
4327 
4328 	/**
4329 	 * Convert action type to its name string.
4330 	 *
4331 	 * Writes a NUL-terminated string to @p dst. Like snprintf(), the
4332 	 * returned value excludes the terminator which is always written
4333 	 * nonetheless.
4334 	 *
4335 	 * - @p src type:
4336 	 *   @code (const void *)enum rte_flow_action_type @endcode
4337 	 * - @p dst type:
4338 	 *   @code char * @endcode
4339 	 **/
4340 	RTE_FLOW_CONV_OP_ACTION_NAME,
4341 
4342 	/**
4343 	 * Convert item type to pointer to item name.
4344 	 *
4345 	 * Retrieves item name pointer from its type. The string itself is
4346 	 * not copied; instead, a unique pointer to an internal static
4347 	 * constant storage is written to @p dst.
4348 	 *
4349 	 * - @p src type:
4350 	 *   @code (const void *)enum rte_flow_item_type @endcode
4351 	 * - @p dst type:
4352 	 *   @code const char ** @endcode
4353 	 */
4354 	RTE_FLOW_CONV_OP_ITEM_NAME_PTR,
4355 
4356 	/**
4357 	 * Convert action type to pointer to action name.
4358 	 *
4359 	 * Retrieves action name pointer from its type. The string itself is
4360 	 * not copied; instead, a unique pointer to an internal static
4361 	 * constant storage is written to @p dst.
4362 	 *
4363 	 * - @p src type:
4364 	 *   @code (const void *)enum rte_flow_action_type @endcode
4365 	 * - @p dst type:
4366 	 *   @code const char ** @endcode
4367 	 */
4368 	RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
4369 };
4370 
4371 /**
4372  * @warning
4373  * @b EXPERIMENTAL: this API may change without prior notice.
4374  *
4375  * Dump hardware internal representation information of
4376  * rte flow to file.
4377  *
4378  * @param[in] port_id
4379  *    The port identifier of the Ethernet device.
4380  * @param[in] flow
4381  *   The pointer of flow rule to dump. Dump all rules if NULL.
4382  * @param[in] file
4383  *   A pointer to a file for output.
4384  * @param[out] error
4385  *   Perform verbose error reporting if not NULL. PMDs initialize this
4386  *   structure in case of error only.
4387  * @return
4388  *   0 on success, a negative value otherwise.
4389  */
4390 __rte_experimental
4391 int
4392 rte_flow_dev_dump(uint16_t port_id, struct rte_flow *flow,
4393 		FILE *file, struct rte_flow_error *error);
4394 
4395 /**
4396  * Check if mbuf dynamic field for metadata is registered.
4397  *
4398  * @return
4399  *   True if registered, false otherwise.
4400  */
4401 __rte_experimental
4402 static inline int
4403 rte_flow_dynf_metadata_avail(void)
4404 {
4405 	return !!rte_flow_dynf_metadata_mask;
4406 }
4407 
4408 /**
4409  * Register mbuf dynamic field and flag for metadata.
4410  *
4411  * This function must be called prior to use SET_META action in order to
4412  * register the dynamic mbuf field. Otherwise, the data cannot be delivered to
4413  * application.
4414  *
4415  * @return
4416  *   0 on success, a negative errno value otherwise and rte_errno is set.
4417  */
4418 __rte_experimental
4419 int
4420 rte_flow_dynf_metadata_register(void);
4421 
4422 /**
4423  * Check whether a flow rule can be created on a given port.
4424  *
4425  * The flow rule is validated for correctness and whether it could be accepted
4426  * by the device given sufficient resources. The rule is checked against the
4427  * current device mode and queue configuration. The flow rule may also
4428  * optionally be validated against existing flow rules and device resources.
4429  * This function has no effect on the target device.
4430  *
4431  * The returned value is guaranteed to remain valid only as long as no
4432  * successful calls to rte_flow_create() or rte_flow_destroy() are made in
4433  * the meantime and no device parameter affecting flow rules in any way are
4434  * modified, due to possible collisions or resource limitations (although in
4435  * such cases EINVAL should not be returned).
4436  *
4437  * @param port_id
4438  *   Port identifier of Ethernet device.
4439  * @param[in] attr
4440  *   Flow rule attributes.
4441  * @param[in] pattern
4442  *   Pattern specification (list terminated by the END pattern item).
4443  * @param[in] actions
4444  *   Associated actions (list terminated by the END action).
4445  * @param[out] error
4446  *   Perform verbose error reporting if not NULL. PMDs initialize this
4447  *   structure in case of error only.
4448  *
4449  * @return
4450  *   0 if flow rule is valid and can be created. A negative errno value
4451  *   otherwise (rte_errno is also set), the following errors are defined:
4452  *
4453  *   -ENOSYS: underlying device does not support this functionality.
4454  *
4455  *   -EIO: underlying device is removed.
4456  *
4457  *   -EINVAL: unknown or invalid rule specification.
4458  *
4459  *   -ENOTSUP: valid but unsupported rule specification (e.g. partial
4460  *   bit-masks are unsupported).
4461  *
4462  *   -EEXIST: collision with an existing rule. Only returned if device
4463  *   supports flow rule collision checking and there was a flow rule
4464  *   collision. Not receiving this return code is no guarantee that creating
4465  *   the rule will not fail due to a collision.
4466  *
4467  *   -ENOMEM: not enough memory to execute the function, or if the device
4468  *   supports resource validation, resource limitation on the device.
4469  *
4470  *   -EBUSY: action cannot be performed due to busy device resources, may
4471  *   succeed if the affected queues or even the entire port are in a stopped
4472  *   state (see rte_eth_dev_rx_queue_stop() and rte_eth_dev_stop()).
4473  */
4474 int
4475 rte_flow_validate(uint16_t port_id,
4476 		  const struct rte_flow_attr *attr,
4477 		  const struct rte_flow_item pattern[],
4478 		  const struct rte_flow_action actions[],
4479 		  struct rte_flow_error *error);
4480 
4481 /**
4482  * Create a flow rule on a given port.
4483  *
4484  * @param port_id
4485  *   Port identifier of Ethernet device.
4486  * @param[in] attr
4487  *   Flow rule attributes.
4488  * @param[in] pattern
4489  *   Pattern specification (list terminated by the END pattern item).
4490  * @param[in] actions
4491  *   Associated actions (list terminated by the END action).
4492  * @param[out] error
4493  *   Perform verbose error reporting if not NULL. PMDs initialize this
4494  *   structure in case of error only.
4495  *
4496  * @return
4497  *   A valid handle in case of success, NULL otherwise and rte_errno is set
4498  *   to the positive version of one of the error codes defined for
4499  *   rte_flow_validate().
4500  */
4501 struct rte_flow *
4502 rte_flow_create(uint16_t port_id,
4503 		const struct rte_flow_attr *attr,
4504 		const struct rte_flow_item pattern[],
4505 		const struct rte_flow_action actions[],
4506 		struct rte_flow_error *error);
4507 
4508 /**
4509  * Destroy a flow rule on a given port.
4510  *
4511  * Failure to destroy a flow rule handle may occur when other flow rules
4512  * depend on it, and destroying it would result in an inconsistent state.
4513  *
4514  * This function is only guaranteed to succeed if handles are destroyed in
4515  * reverse order of their creation.
4516  *
4517  * @param port_id
4518  *   Port identifier of Ethernet device.
4519  * @param flow
4520  *   Flow rule handle to destroy.
4521  * @param[out] error
4522  *   Perform verbose error reporting if not NULL. PMDs initialize this
4523  *   structure in case of error only.
4524  *
4525  * @return
4526  *   0 on success, a negative errno value otherwise and rte_errno is set.
4527  */
4528 int
4529 rte_flow_destroy(uint16_t port_id,
4530 		 struct rte_flow *flow,
4531 		 struct rte_flow_error *error);
4532 
4533 /**
4534  * Update a flow rule with new actions on a given port.
4535  *
4536  * @param port_id
4537  *   Port identifier of Ethernet device.
4538  * @param flow
4539  *   Flow rule handle to update.
4540  * @param[in] actions
4541  *   Associated actions (list terminated by the END action).
4542  * @param[out] error
4543  *   Perform verbose error reporting if not NULL. PMDs initialize this
4544  *   structure in case of error only.
4545  *
4546  * @return
4547  *   0 on success, a negative errno value otherwise and rte_errno is set.
4548  */
4549 __rte_experimental
4550 int
4551 rte_flow_actions_update(uint16_t port_id,
4552 			struct rte_flow *flow,
4553 			const struct rte_flow_action actions[],
4554 			struct rte_flow_error *error);
4555 
4556 /**
4557  * Destroy all flow rules associated with a port.
4558  *
4559  * In the unlikely event of failure, handles are still considered destroyed
4560  * and no longer valid but the port must be assumed to be in an inconsistent
4561  * state.
4562  *
4563  * @param port_id
4564  *   Port identifier of Ethernet device.
4565  * @param[out] error
4566  *   Perform verbose error reporting if not NULL. PMDs initialize this
4567  *   structure in case of error only.
4568  *
4569  * @return
4570  *   0 on success, a negative errno value otherwise and rte_errno is set.
4571  */
4572 int
4573 rte_flow_flush(uint16_t port_id,
4574 	       struct rte_flow_error *error);
4575 
4576 /**
4577  * Query an existing flow rule.
4578  *
4579  * This function allows retrieving flow-specific data such as counters.
4580  * Data is gathered by special actions which must be present in the flow
4581  * rule definition.
4582  *
4583  * \see RTE_FLOW_ACTION_TYPE_COUNT
4584  *
4585  * @param port_id
4586  *   Port identifier of Ethernet device.
4587  * @param flow
4588  *   Flow rule handle to query.
4589  * @param action
4590  *   Action definition as defined in original flow rule.
4591  * @param[in, out] data
4592  *   Pointer to storage for the associated query data type.
4593  * @param[out] error
4594  *   Perform verbose error reporting if not NULL. PMDs initialize this
4595  *   structure in case of error only.
4596  *
4597  * @return
4598  *   0 on success, a negative errno value otherwise and rte_errno is set.
4599  */
4600 int
4601 rte_flow_query(uint16_t port_id,
4602 	       struct rte_flow *flow,
4603 	       const struct rte_flow_action *action,
4604 	       void *data,
4605 	       struct rte_flow_error *error);
4606 
4607 /**
4608  * Restrict ingress traffic to the defined flow rules.
4609  *
4610  * Isolated mode guarantees that all ingress traffic comes from defined flow
4611  * rules only (current and future).
4612  * When enabled with a bifurcated driver,
4613  * non-matched packets are routed to the kernel driver interface.
4614  * When disabled (the default),
4615  * there may be some default rules routing traffic to the DPDK port.
4616  *
4617  * Besides making ingress more deterministic, it allows PMDs to safely reuse
4618  * resources otherwise assigned to handle the remaining traffic, such as
4619  * global RSS configuration settings, VLAN filters, MAC address entries,
4620  * legacy filter API rules and so on in order to expand the set of possible
4621  * flow rule types.
4622  *
4623  * Calling this function as soon as possible after device initialization,
4624  * ideally before the first call to rte_eth_dev_configure(), is recommended
4625  * to avoid possible failures due to conflicting settings.
4626  *
4627  * Once effective, leaving isolated mode may not be possible depending on
4628  * PMD implementation.
4629  *
4630  * Additionally, the following functionality has no effect on the underlying
4631  * port and may return errors such as ENOTSUP ("not supported"):
4632  *
4633  * - Toggling promiscuous mode.
4634  * - Toggling allmulticast mode.
4635  * - Configuring MAC addresses.
4636  * - Configuring multicast addresses.
4637  * - Configuring VLAN filters.
4638  * - Configuring Rx filters through the legacy API (e.g. FDIR).
4639  * - Configuring global RSS settings.
4640  *
4641  * @param port_id
4642  *   Port identifier of Ethernet device.
4643  * @param set
4644  *   Nonzero to enter isolated mode, attempt to leave it otherwise.
4645  * @param[out] error
4646  *   Perform verbose error reporting if not NULL. PMDs initialize this
4647  *   structure in case of error only.
4648  *
4649  * @return
4650  *   0 on success, a negative errno value otherwise and rte_errno is set.
4651  */
4652 int
4653 rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
4654 
4655 /**
4656  * Initialize flow error structure.
4657  *
4658  * @param[out] error
4659  *   Pointer to flow error structure (may be NULL).
4660  * @param code
4661  *   Related error code (rte_errno).
4662  * @param type
4663  *   Cause field and error types.
4664  * @param cause
4665  *   Object responsible for the error.
4666  * @param message
4667  *   Human-readable error message.
4668  *
4669  * @return
4670  *   Negative error code (errno value) and rte_errno is set.
4671  */
4672 int
4673 rte_flow_error_set(struct rte_flow_error *error,
4674 		   int code,
4675 		   enum rte_flow_error_type type,
4676 		   const void *cause,
4677 		   const char *message);
4678 
4679 /**
4680  * @deprecated
4681  * @see rte_flow_copy()
4682  */
4683 struct rte_flow_desc {
4684 	size_t size; /**< Allocated space including data[]. */
4685 	struct rte_flow_attr attr; /**< Attributes. */
4686 	struct rte_flow_item *items; /**< Items. */
4687 	struct rte_flow_action *actions; /**< Actions. */
4688 	uint8_t data[]; /**< Storage for items/actions. */
4689 };
4690 
4691 /**
4692  * @deprecated
4693  * Copy an rte_flow rule description.
4694  *
4695  * This interface is kept for compatibility with older applications but is
4696  * implemented as a wrapper to rte_flow_conv(). It is deprecated due to its
4697  * lack of flexibility and reliance on a type unusable with C++ programs
4698  * (struct rte_flow_desc).
4699  *
4700  * @param[in] fd
4701  *   Flow rule description.
4702  * @param[in] len
4703  *   Total size of allocated data for the flow description.
4704  * @param[in] attr
4705  *   Flow rule attributes.
4706  * @param[in] items
4707  *   Pattern specification (list terminated by the END pattern item).
4708  * @param[in] actions
4709  *   Associated actions (list terminated by the END action).
4710  *
4711  * @return
4712  *   If len is greater or equal to the size of the flow, the total size of the
4713  *   flow description and its data.
4714  *   If len is lower than the size of the flow, the number of bytes that would
4715  *   have been written to desc had it been sufficient. Nothing is written.
4716  */
4717 __rte_deprecated
4718 size_t
4719 rte_flow_copy(struct rte_flow_desc *fd, size_t len,
4720 	      const struct rte_flow_attr *attr,
4721 	      const struct rte_flow_item *items,
4722 	      const struct rte_flow_action *actions);
4723 
4724 /**
4725  * Flow object conversion helper.
4726  *
4727  * This function performs conversion of various flow API objects to a
4728  * pre-allocated destination buffer. See enum rte_flow_conv_op for possible
4729  * operations and details about each of them.
4730  *
4731  * Since destination buffer must be large enough, it works in a manner
4732  * reminiscent of snprintf():
4733  *
4734  * - If @p size is 0, @p dst may be a NULL pointer, otherwise @p dst must be
4735  *   non-NULL.
4736  * - If positive, the returned value represents the number of bytes needed
4737  *   to store the conversion of @p src to @p dst according to @p op
4738  *   regardless of the @p size parameter.
4739  * - Since no more than @p size bytes can be written to @p dst, output is
4740  *   truncated and may be inconsistent when the returned value is larger
4741  *   than that.
4742  * - In case of conversion error, a negative error code is returned and
4743  *   @p dst contents are unspecified.
4744  *
4745  * @param op
4746  *   Operation to perform, related to the object type of @p dst.
4747  * @param[out] dst
4748  *   Destination buffer address. Must be suitably aligned by the caller.
4749  * @param size
4750  *   Destination buffer size in bytes.
4751  * @param[in] src
4752  *   Source object to copy. Depending on @p op, its type may differ from
4753  *   that of @p dst.
4754  * @param[out] error
4755  *   Perform verbose error reporting if not NULL. Initialized in case of
4756  *   error only.
4757  *
4758  * @return
4759  *   The number of bytes required to convert @p src to @p dst on success, a
4760  *   negative errno value otherwise and rte_errno is set.
4761  *
4762  * @see rte_flow_conv_op
4763  */
4764 __rte_experimental
4765 int
4766 rte_flow_conv(enum rte_flow_conv_op op,
4767 	      void *dst,
4768 	      size_t size,
4769 	      const void *src,
4770 	      struct rte_flow_error *error);
4771 
4772 /**
4773  * Get aged-out flows of a given port.
4774  *
4775  * RTE_ETH_EVENT_FLOW_AGED event will be triggered when at least one new aged
4776  * out flow was detected after the last call to rte_flow_get_aged_flows.
4777  * This function can be called to get the aged flows asynchronously from the
4778  * event callback or synchronously regardless the event.
4779  * This is not safe to call rte_flow_get_aged_flows function with other flow
4780  * functions from multiple threads simultaneously.
4781  *
4782  * @param port_id
4783  *   Port identifier of Ethernet device.
4784  * @param[in, out] contexts
4785  *   The address of an array of pointers to the aged-out flows contexts.
4786  * @param[in] nb_contexts
4787  *   The length of context array pointers.
4788  * @param[out] error
4789  *   Perform verbose error reporting if not NULL. Initialized in case of
4790  *   error only.
4791  *
4792  * @return
4793  *   if nb_contexts is 0, return the amount of all aged contexts.
4794  *   if nb_contexts is not 0 , return the amount of aged flows reported
4795  *   in the context array, otherwise negative errno value.
4796  *
4797  * @see rte_flow_action_age
4798  * @see RTE_ETH_EVENT_FLOW_AGED
4799  */
4800 __rte_experimental
4801 int
4802 rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
4803 			uint32_t nb_contexts, struct rte_flow_error *error);
4804 
4805 /**
4806  * @warning
4807  * @b EXPERIMENTAL: this API may change without prior notice.
4808  *
4809  * Get aged-out flows of a given port on the given flow queue.
4810  *
4811  * If application configure port attribute with RTE_FLOW_PORT_FLAG_STRICT_QUEUE,
4812  * there is no RTE_ETH_EVENT_FLOW_AGED event and this function must be called to
4813  * get the aged flows synchronously.
4814  *
4815  * If application configure port attribute without
4816  * RTE_FLOW_PORT_FLAG_STRICT_QUEUE, RTE_ETH_EVENT_FLOW_AGED event will be
4817  * triggered at least one new aged out flow was detected on any flow queue after
4818  * the last call to rte_flow_get_q_aged_flows.
4819  * In addition, the @p queue_id will be ignored.
4820  * This function can be called to get the aged flows asynchronously from the
4821  * event callback or synchronously regardless the event.
4822  *
4823  * @param[in] port_id
4824  *   Port identifier of Ethernet device.
4825  * @param[in] queue_id
4826  *   Flow queue to query. Ignored when RTE_FLOW_PORT_FLAG_STRICT_QUEUE not set.
4827  * @param[in, out] contexts
4828  *   The address of an array of pointers to the aged-out flows contexts.
4829  * @param[in] nb_contexts
4830  *   The length of context array pointers.
4831  * @param[out] error
4832  *   Perform verbose error reporting if not NULL. Initialized in case of
4833  *   error only.
4834  *
4835  * @return
4836  *   if nb_contexts is 0, return the amount of all aged contexts.
4837  *   if nb_contexts is not 0 , return the amount of aged flows reported
4838  *   in the context array, otherwise negative errno value.
4839  *
4840  * @see rte_flow_action_age
4841  * @see RTE_ETH_EVENT_FLOW_AGED
4842  * @see rte_flow_port_flag
4843  */
4844 __rte_experimental
4845 int
4846 rte_flow_get_q_aged_flows(uint16_t port_id, uint32_t queue_id, void **contexts,
4847 			  uint32_t nb_contexts, struct rte_flow_error *error);
4848 
4849 /**
4850  * Specify indirect action object configuration
4851  */
4852 struct rte_flow_indir_action_conf {
4853 	/**
4854 	 * Flow direction for the indirect action configuration.
4855 	 *
4856 	 * Action should be valid at least for one flow direction,
4857 	 * otherwise it is invalid for both ingress and egress rules.
4858 	 */
4859 	/** Action valid for rules applied to ingress traffic. */
4860 	uint32_t ingress:1;
4861 	/** Action valid for rules applied to egress traffic. */
4862 	uint32_t egress:1;
4863 	/**
4864 	 * When set to 1, indicates that the action is valid for
4865 	 * transfer traffic; otherwise, for non-transfer traffic.
4866 	 */
4867 	uint32_t transfer:1;
4868 };
4869 
4870 /**
4871  * @warning
4872  * @b EXPERIMENTAL: this API may change without prior notice.
4873  *
4874  * Create an indirect action object that can be used in flow rules
4875  * via its handle.
4876  * The created object handle has single state and configuration
4877  * across all the flow rules using it.
4878  *
4879  * @param[in] port_id
4880  *    The port identifier of the Ethernet device.
4881  * @param[in] conf
4882  *   Action configuration for the indirect action object creation.
4883  * @param[in] action
4884  *   Specific configuration of the indirect action object.
4885  * @param[out] error
4886  *   Perform verbose error reporting if not NULL. PMDs initialize this
4887  *   structure in case of error only.
4888  * @return
4889  *   A valid handle in case of success, NULL otherwise and rte_errno is set
4890  *   to one of the error codes defined:
4891  *   - (ENODEV) if *port_id* invalid.
4892  *   - (ENOSYS) if underlying device does not support this functionality.
4893  *   - (EIO) if underlying device is removed.
4894  *   - (EINVAL) if *action* invalid.
4895  *   - (ENOTSUP) if *action* valid but unsupported.
4896  */
4897 __rte_experimental
4898 struct rte_flow_action_handle *
4899 rte_flow_action_handle_create(uint16_t port_id,
4900 			      const struct rte_flow_indir_action_conf *conf,
4901 			      const struct rte_flow_action *action,
4902 			      struct rte_flow_error *error);
4903 
4904 /**
4905  * @warning
4906  * @b EXPERIMENTAL: this API may change without prior notice.
4907  *
4908  * Destroy indirect action by handle.
4909  *
4910  * @param[in] port_id
4911  *    The port identifier of the Ethernet device.
4912  * @param[in] handle
4913  *   Handle for the indirect action object to be destroyed.
4914  * @param[out] error
4915  *   Perform verbose error reporting if not NULL. PMDs initialize this
4916  *   structure in case of error only.
4917  * @return
4918  *   - (0) if success.
4919  *   - (-ENODEV) if *port_id* invalid.
4920  *   - (-ENOSYS) if underlying device does not support this functionality.
4921  *   - (-EIO) if underlying device is removed.
4922  *   - (-ENOENT) if action pointed by *action* handle was not found.
4923  *   - (-EBUSY) if action pointed by *action* handle still used by some rules
4924  *   rte_errno is also set.
4925  */
4926 __rte_experimental
4927 int
4928 rte_flow_action_handle_destroy(uint16_t port_id,
4929 			       struct rte_flow_action_handle *handle,
4930 			       struct rte_flow_error *error);
4931 
4932 /**
4933  * @warning
4934  * @b EXPERIMENTAL: this API may change without prior notice.
4935  *
4936  * Update in-place the action configuration and / or state pointed
4937  * by action *handle* with the configuration provided as *update* argument.
4938  * The update of the action configuration effects all flow rules reusing
4939  * the action via *handle*.
4940  * The update general pointer provides the ability of partial updating.
4941  *
4942  * @param[in] port_id
4943  *    The port identifier of the Ethernet device.
4944  * @param[in] handle
4945  *   Handle for the indirect action object to be updated.
4946  * @param[in] update
4947  *   Update profile specification used to modify the action pointed by handle.
4948  *   *update* could be with the same type of the immediate action corresponding
4949  *   to the *handle* argument when creating, or a wrapper structure includes
4950  *   action configuration to be updated and bit fields to indicate the member
4951  *   of fields inside the action to update.
4952  * @param[out] error
4953  *   Perform verbose error reporting if not NULL. PMDs initialize this
4954  *   structure in case of error only.
4955  * @return
4956  *   - (0) if success.
4957  *   - (-ENODEV) if *port_id* invalid.
4958  *   - (-ENOSYS) if underlying device does not support this functionality.
4959  *   - (-EIO) if underlying device is removed.
4960  *   - (-EINVAL) if *update* invalid.
4961  *   - (-ENOTSUP) if *update* valid but unsupported.
4962  *   - (-ENOENT) if indirect action object pointed by *handle* was not found.
4963  *   rte_errno is also set.
4964  */
4965 __rte_experimental
4966 int
4967 rte_flow_action_handle_update(uint16_t port_id,
4968 			      struct rte_flow_action_handle *handle,
4969 			      const void *update,
4970 			      struct rte_flow_error *error);
4971 
4972 /**
4973  * @warning
4974  * @b EXPERIMENTAL: this API may change without prior notice.
4975  *
4976  * Query the direct action by corresponding indirect action object handle.
4977  *
4978  * Retrieve action-specific data such as counters.
4979  * Data is gathered by special action which may be present/referenced in
4980  * more than one flow rule definition.
4981  *
4982  * @see RTE_FLOW_ACTION_TYPE_COUNT
4983  *
4984  * @param port_id
4985  *   Port identifier of Ethernet device.
4986  * @param[in] handle
4987  *   Handle for the action object to query.
4988  * @param[in, out] data
4989  *   Pointer to storage for the associated query data type.
4990  * @param[out] error
4991  *   Perform verbose error reporting if not NULL. PMDs initialize this
4992  *   structure in case of error only.
4993  *
4994  * @return
4995  *   0 on success, a negative errno value otherwise and rte_errno is set.
4996  */
4997 __rte_experimental
4998 int
4999 rte_flow_action_handle_query(uint16_t port_id,
5000 			     const struct rte_flow_action_handle *handle,
5001 			     void *data, struct rte_flow_error *error);
5002 
5003 /* Tunnel has a type and the key information. */
5004 struct rte_flow_tunnel {
5005 	/**
5006 	 * Tunnel type, for example RTE_FLOW_ITEM_TYPE_VXLAN,
5007 	 * RTE_FLOW_ITEM_TYPE_NVGRE etc.
5008 	 */
5009 	enum rte_flow_item_type	type;
5010 	uint64_t tun_id; /**< Tunnel identification. */
5011 
5012 	RTE_STD_C11
5013 	union {
5014 		struct {
5015 			rte_be32_t src_addr; /**< IPv4 source address. */
5016 			rte_be32_t dst_addr; /**< IPv4 destination address. */
5017 		} ipv4;
5018 		struct {
5019 			uint8_t src_addr[16]; /**< IPv6 source address. */
5020 			uint8_t dst_addr[16]; /**< IPv6 destination address. */
5021 		} ipv6;
5022 	};
5023 	rte_be16_t tp_src; /**< Tunnel port source. */
5024 	rte_be16_t tp_dst; /**< Tunnel port destination. */
5025 	uint16_t   tun_flags; /**< Tunnel flags. */
5026 
5027 	bool       is_ipv6; /**< True for valid IPv6 fields. Otherwise IPv4. */
5028 
5029 	/**
5030 	 * the following members are required to restore packet
5031 	 * after miss
5032 	 */
5033 	uint8_t    tos; /**< TOS for IPv4, TC for IPv6. */
5034 	uint8_t    ttl; /**< TTL for IPv4, HL for IPv6. */
5035 	uint32_t label; /**< Flow Label for IPv6. */
5036 };
5037 
5038 /**
5039  * Indicate that the packet has a tunnel.
5040  */
5041 #define RTE_FLOW_RESTORE_INFO_TUNNEL RTE_BIT64(0)
5042 
5043 /**
5044  * Indicate that the packet has a non decapsulated tunnel header.
5045  */
5046 #define RTE_FLOW_RESTORE_INFO_ENCAPSULATED RTE_BIT64(1)
5047 
5048 /**
5049  * Indicate that the packet has a group_id.
5050  */
5051 #define RTE_FLOW_RESTORE_INFO_GROUP_ID RTE_BIT64(2)
5052 
5053 /**
5054  * Restore information structure to communicate the current packet processing
5055  * state when some of the processing pipeline is done in hardware and should
5056  * continue in software.
5057  */
5058 struct rte_flow_restore_info {
5059 	/**
5060 	 * Bitwise flags (RTE_FLOW_RESTORE_INFO_*) to indicate validation of
5061 	 * other fields in struct rte_flow_restore_info.
5062 	 */
5063 	uint64_t flags;
5064 	uint32_t group_id; /**< Group ID where packed missed */
5065 	struct rte_flow_tunnel tunnel; /**< Tunnel information. */
5066 };
5067 
5068 /**
5069  * Allocate an array of actions to be used in rte_flow_create, to implement
5070  * tunnel-decap-set for the given tunnel.
5071  * Sample usage:
5072  *   actions vxlan_decap / tunnel-decap-set(tunnel properties) /
5073  *            jump group 0 / end
5074  *
5075  * @param port_id
5076  *   Port identifier of Ethernet device.
5077  * @param[in] tunnel
5078  *   Tunnel properties.
5079  * @param[out] actions
5080  *   Array of actions to be allocated by the PMD. This array should be
5081  *   concatenated with the actions array provided to rte_flow_create.
5082  * @param[out] num_of_actions
5083  *   Number of actions allocated.
5084  * @param[out] error
5085  *   Perform verbose error reporting if not NULL. PMDs initialize this
5086  *   structure in case of error only.
5087  *
5088  * @return
5089  *   0 on success, a negative errno value otherwise and rte_errno is set.
5090  */
5091 __rte_experimental
5092 int
5093 rte_flow_tunnel_decap_set(uint16_t port_id,
5094 			  struct rte_flow_tunnel *tunnel,
5095 			  struct rte_flow_action **actions,
5096 			  uint32_t *num_of_actions,
5097 			  struct rte_flow_error *error);
5098 
5099 /**
5100  * Allocate an array of items to be used in rte_flow_create, to implement
5101  * tunnel-match for the given tunnel.
5102  * Sample usage:
5103  *   pattern tunnel-match(tunnel properties) / outer-header-matches /
5104  *           inner-header-matches / end
5105  *
5106  * @param port_id
5107  *   Port identifier of Ethernet device.
5108  * @param[in] tunnel
5109  *   Tunnel properties.
5110  * @param[out] items
5111  *   Array of items to be allocated by the PMD. This array should be
5112  *   concatenated with the items array provided to rte_flow_create.
5113  * @param[out] num_of_items
5114  *   Number of items allocated.
5115  * @param[out] error
5116  *   Perform verbose error reporting if not NULL. PMDs initialize this
5117  *   structure in case of error only.
5118  *
5119  * @return
5120  *   0 on success, a negative errno value otherwise and rte_errno is set.
5121  */
5122 __rte_experimental
5123 int
5124 rte_flow_tunnel_match(uint16_t port_id,
5125 		      struct rte_flow_tunnel *tunnel,
5126 		      struct rte_flow_item **items,
5127 		      uint32_t *num_of_items,
5128 		      struct rte_flow_error *error);
5129 
5130 /**
5131  * Populate the current packet processing state, if exists, for the given mbuf.
5132  *
5133  * One should negotiate tunnel metadata delivery from the NIC to the HW.
5134  * @see rte_eth_rx_metadata_negotiate()
5135  * @see RTE_ETH_RX_METADATA_TUNNEL_ID
5136  *
5137  * @param port_id
5138  *   Port identifier of Ethernet device.
5139  * @param[in] m
5140  *   Mbuf struct.
5141  * @param[out] info
5142  *   Restore information. Upon success contains the HW state.
5143  * @param[out] error
5144  *   Perform verbose error reporting if not NULL. PMDs initialize this
5145  *   structure in case of error only.
5146  *
5147  * @return
5148  *   0 on success, a negative errno value otherwise and rte_errno is set.
5149  */
5150 __rte_experimental
5151 int
5152 rte_flow_get_restore_info(uint16_t port_id,
5153 			  struct rte_mbuf *m,
5154 			  struct rte_flow_restore_info *info,
5155 			  struct rte_flow_error *error);
5156 
5157 /**
5158  * Release the action array as allocated by rte_flow_tunnel_decap_set.
5159  *
5160  * @param port_id
5161  *   Port identifier of Ethernet device.
5162  * @param[in] actions
5163  *   Array of actions to be released.
5164  * @param[in] num_of_actions
5165  *   Number of elements in actions array.
5166  * @param[out] error
5167  *   Perform verbose error reporting if not NULL. PMDs initialize this
5168  *   structure in case of error only.
5169  *
5170  * @return
5171  *   0 on success, a negative errno value otherwise and rte_errno is set.
5172  */
5173 __rte_experimental
5174 int
5175 rte_flow_tunnel_action_decap_release(uint16_t port_id,
5176 				     struct rte_flow_action *actions,
5177 				     uint32_t num_of_actions,
5178 				     struct rte_flow_error *error);
5179 
5180 /**
5181  * Release the item array as allocated by rte_flow_tunnel_match.
5182  *
5183  * @param port_id
5184  *   Port identifier of Ethernet device.
5185  * @param[in] items
5186  *   Array of items to be released.
5187  * @param[in] num_of_items
5188  *   Number of elements in item array.
5189  * @param[out] error
5190  *   Perform verbose error reporting if not NULL. PMDs initialize this
5191  *   structure in case of error only.
5192  *
5193  * @return
5194  *   0 on success, a negative errno value otherwise and rte_errno is set.
5195  */
5196 __rte_experimental
5197 int
5198 rte_flow_tunnel_item_release(uint16_t port_id,
5199 			     struct rte_flow_item *items,
5200 			     uint32_t num_of_items,
5201 			     struct rte_flow_error *error);
5202 
5203 /**
5204  * Get a proxy port to manage "transfer" flows.
5205  *
5206  * Managing "transfer" flows requires that the user communicate them
5207  * via a port which has the privilege to control the embedded switch.
5208  * For some vendors, all ports in a given switching domain have
5209  * this privilege. For other vendors, it's only one port.
5210  *
5211  * This API indicates such a privileged port (a "proxy")
5212  * for a given port in the same switching domain.
5213  *
5214  * @note
5215  *   If the PMD serving @p port_id doesn't have the corresponding method
5216  *   implemented, the API will return @p port_id via @p proxy_port_id.
5217  *
5218  * @param port_id
5219  *   Indicates the port to get a "proxy" for
5220  * @param[out] proxy_port_id
5221  *   Indicates the "proxy" port
5222  * @param[out] error
5223  *   If not NULL, allows the PMD to provide verbose report in case of error
5224  *
5225  * @return
5226  *   0 on success, a negative error code otherwise
5227  */
5228 int
5229 rte_flow_pick_transfer_proxy(uint16_t port_id, uint16_t *proxy_port_id,
5230 			     struct rte_flow_error *error);
5231 
5232 /**
5233  * @warning
5234  * @b EXPERIMENTAL: this API may change without prior notice.
5235  *
5236  * Create the flex item with specified configuration over
5237  * the Ethernet device.
5238  *
5239  * @param port_id
5240  *   Port identifier of Ethernet device.
5241  * @param[in] conf
5242  *   Item configuration.
5243  * @param[out] error
5244  *   Perform verbose error reporting if not NULL. PMDs initialize this
5245  *   structure in case of error only.
5246  *
5247  * @return
5248  *   Non-NULL opaque pointer on success, NULL otherwise and rte_errno is set.
5249  */
5250 __rte_experimental
5251 struct rte_flow_item_flex_handle *
5252 rte_flow_flex_item_create(uint16_t port_id,
5253 			  const struct rte_flow_item_flex_conf *conf,
5254 			  struct rte_flow_error *error);
5255 
5256 /**
5257  * Release the flex item on the specified Ethernet device.
5258  *
5259  * @param port_id
5260  *   Port identifier of Ethernet device.
5261  * @param[in] handle
5262  *   Handle of the item existing on the specified device.
5263  * @param[out] error
5264  *   Perform verbose error reporting if not NULL. PMDs initialize this
5265  *   structure in case of error only.
5266  *
5267  * @return
5268  *   0 on success, a negative errno value otherwise and rte_errno is set.
5269  */
5270 __rte_experimental
5271 int
5272 rte_flow_flex_item_release(uint16_t port_id,
5273 			   const struct rte_flow_item_flex_handle *handle,
5274 			   struct rte_flow_error *error);
5275 
5276 /**
5277  * Indicate all operations for a given flow rule will _strictly_
5278  * happen on the same queue (create/destroy/query/update).
5279  */
5280 #define RTE_FLOW_PORT_FLAG_STRICT_QUEUE RTE_BIT32(0)
5281 
5282 /**
5283  * @warning
5284  * @b EXPERIMENTAL: this API may change without prior notice.
5285  *
5286  * Information about flow engine resources.
5287  * The zero value means a resource is not supported.
5288  *
5289  */
5290 struct rte_flow_port_info {
5291 	/**
5292 	 * Maximum number of queues for asynchronous operations.
5293 	 */
5294 	uint32_t max_nb_queues;
5295 	/**
5296 	 * Maximum number of counters.
5297 	 * @see RTE_FLOW_ACTION_TYPE_COUNT
5298 	 */
5299 	uint32_t max_nb_counters;
5300 	/**
5301 	 * Maximum number of aging objects.
5302 	 * @see RTE_FLOW_ACTION_TYPE_AGE
5303 	 */
5304 	uint32_t max_nb_aging_objects;
5305 	/**
5306 	 * Maximum number traffic meters.
5307 	 * @see RTE_FLOW_ACTION_TYPE_METER
5308 	 */
5309 	uint32_t max_nb_meters;
5310 	/**
5311 	 * Maximum number connection trackings.
5312 	 * @see RTE_FLOW_ACTION_TYPE_CONNTRACK
5313 	 */
5314 	uint32_t max_nb_conn_tracks;
5315 	/**
5316 	 * Maximum number of quota actions.
5317 	 * @see RTE_FLOW_ACTION_TYPE_QUOTA
5318 	 */
5319 	uint32_t max_nb_quotas;
5320 	/**
5321 	 * Port supported flags (RTE_FLOW_PORT_FLAG_*).
5322 	 */
5323 	uint32_t supported_flags;
5324 };
5325 
5326 /**
5327  * @warning
5328  * @b EXPERIMENTAL: this API may change without prior notice.
5329  *
5330  * Information about flow engine asynchronous queues.
5331  * The value only valid if @p port_attr.max_nb_queues is not zero.
5332  *
5333  */
5334 struct rte_flow_queue_info {
5335 	/**
5336 	 * Maximum number of operations a queue can hold.
5337 	 */
5338 	uint32_t max_size;
5339 };
5340 
5341 /**
5342  * @warning
5343  * @b EXPERIMENTAL: this API may change without prior notice.
5344  *
5345  * Get information about flow engine resources.
5346  *
5347  * @param port_id
5348  *   Port identifier of Ethernet device.
5349  * @param[out] port_info
5350  *   A pointer to a structure of type *rte_flow_port_info*
5351  *   to be filled with the resources information of the port.
5352  * @param[out] queue_info
5353  *   A pointer to a structure of type *rte_flow_queue_info*
5354  *   to be filled with the asynchronous queues information.
5355  * @param[out] error
5356  *   Perform verbose error reporting if not NULL.
5357  *   PMDs initialize this structure in case of error only.
5358  *
5359  * @return
5360  *   0 on success, a negative errno value otherwise and rte_errno is set.
5361  */
5362 __rte_experimental
5363 int
5364 rte_flow_info_get(uint16_t port_id,
5365 		  struct rte_flow_port_info *port_info,
5366 		  struct rte_flow_queue_info *queue_info,
5367 		  struct rte_flow_error *error);
5368 
5369 /**
5370  * Indicate all steering objects should be created on contexts
5371  * of the host port, providing indirect object sharing between
5372  * ports.
5373  */
5374 #define RTE_FLOW_PORT_FLAG_SHARE_INDIRECT RTE_BIT32(0)
5375 
5376 /**
5377  * @warning
5378  * @b EXPERIMENTAL: this API may change without prior notice.
5379  *
5380  * Flow engine resources settings.
5381  * The zero value means on demand resource allocations only.
5382  *
5383  */
5384 struct rte_flow_port_attr {
5385 	/**
5386 	 * Number of counters to configure.
5387 	 * @see RTE_FLOW_ACTION_TYPE_COUNT
5388 	 */
5389 	uint32_t nb_counters;
5390 	/**
5391 	 * Number of aging objects to configure.
5392 	 * @see RTE_FLOW_ACTION_TYPE_AGE
5393 	 */
5394 	uint32_t nb_aging_objects;
5395 	/**
5396 	 * Number of traffic meters to configure.
5397 	 * @see RTE_FLOW_ACTION_TYPE_METER
5398 	 */
5399 	uint32_t nb_meters;
5400 	/**
5401 	 * Number of connection trackings to configure.
5402 	 * @see RTE_FLOW_ACTION_TYPE_CONNTRACK
5403 	 */
5404 	uint32_t nb_conn_tracks;
5405 	/**
5406 	 * Port to base shared objects on.
5407 	 */
5408 	uint16_t host_port_id;
5409 	/**
5410 	 * Maximum number of quota actions.
5411 	 * @see RTE_FLOW_ACTION_TYPE_QUOTA
5412 	 */
5413 	uint32_t nb_quotas;
5414 	/**
5415 	 * Port flags (RTE_FLOW_PORT_FLAG_*).
5416 	 */
5417 	uint32_t flags;
5418 };
5419 
5420 /**
5421  * @warning
5422  * @b EXPERIMENTAL: this API may change without prior notice.
5423  *
5424  * Flow engine asynchronous queues settings.
5425  * The value means default value picked by PMD.
5426  *
5427  */
5428 struct rte_flow_queue_attr {
5429 	/**
5430 	 * Number of flow rule operations a queue can hold.
5431 	 */
5432 	uint32_t size;
5433 };
5434 
5435 /**
5436  * @warning
5437  * @b EXPERIMENTAL: this API may change without prior notice.
5438  *
5439  * Configure the port's flow API engine.
5440  *
5441  * This API can only be invoked before the application
5442  * starts using the rest of the flow library functions.
5443  *
5444  * The API can be invoked multiple times to change the settings.
5445  * The port, however, may reject changes and keep the old config.
5446  *
5447  * Parameters in configuration attributes must not exceed
5448  * numbers of resources returned by the rte_flow_info_get API.
5449  *
5450  * @param port_id
5451  *   Port identifier of Ethernet device.
5452  * @param[in] port_attr
5453  *   Port configuration attributes.
5454  * @param[in] nb_queue
5455  *   Number of flow queues to be configured.
5456  * @param[in] queue_attr
5457  *   Array that holds attributes for each flow queue.
5458  *   Number of elements is set in @p port_attr.nb_queues.
5459  * @param[out] error
5460  *   Perform verbose error reporting if not NULL.
5461  *   PMDs initialize this structure in case of error only.
5462  *
5463  * @return
5464  *   0 on success, a negative errno value otherwise and rte_errno is set.
5465  */
5466 __rte_experimental
5467 int
5468 rte_flow_configure(uint16_t port_id,
5469 		   const struct rte_flow_port_attr *port_attr,
5470 		   uint16_t nb_queue,
5471 		   const struct rte_flow_queue_attr *queue_attr[],
5472 		   struct rte_flow_error *error);
5473 
5474 /**
5475  * Opaque type returned after successful creation of pattern template.
5476  * This handle can be used to manage the created pattern template.
5477  */
5478 struct rte_flow_pattern_template;
5479 
5480 /**
5481  * @warning
5482  * @b EXPERIMENTAL: this API may change without prior notice.
5483  *
5484  * Flow pattern template attributes.
5485  */
5486 __extension__
5487 struct rte_flow_pattern_template_attr {
5488 	/**
5489 	 * Relaxed matching policy.
5490 	 * - If 1, matching is performed only on items with the mask member set
5491 	 * and matching on protocol layers specified without any masks is skipped.
5492 	 * - If 0, matching on protocol layers specified without any masks is done
5493 	 * as well. This is the standard behaviour of Flow API now.
5494 	 */
5495 	uint32_t relaxed_matching:1;
5496 	/**
5497 	 * Flow direction for the pattern template.
5498 	 * At least one direction must be specified.
5499 	 */
5500 	/** Pattern valid for rules applied to ingress traffic. */
5501 	uint32_t ingress:1;
5502 	/** Pattern valid for rules applied to egress traffic. */
5503 	uint32_t egress:1;
5504 	/** Pattern valid for rules applied to transfer traffic. */
5505 	uint32_t transfer:1;
5506 };
5507 
5508 /**
5509  * @warning
5510  * @b EXPERIMENTAL: this API may change without prior notice.
5511  *
5512  * Create flow pattern template.
5513  *
5514  * The pattern template defines common matching fields without values.
5515  * For example, matching on 5 tuple TCP flow, the template will be
5516  * eth(null) + IPv4(source + dest) + TCP(s_port + d_port),
5517  * while values for each rule will be set during the flow rule creation.
5518  * The number and order of items in the template must be the same
5519  * at the rule creation.
5520  *
5521  * @param port_id
5522  *   Port identifier of Ethernet device.
5523  * @param[in] template_attr
5524  *   Pattern template attributes.
5525  * @param[in] pattern
5526  *   Pattern specification (list terminated by the END pattern item).
5527  *   The spec member of an item is not used unless the end member is used.
5528  * @param[out] error
5529  *   Perform verbose error reporting if not NULL.
5530  *   PMDs initialize this structure in case of error only.
5531  *
5532  * @return
5533  *   Handle on success, NULL otherwise and rte_errno is set.
5534  */
5535 __rte_experimental
5536 struct rte_flow_pattern_template *
5537 rte_flow_pattern_template_create(uint16_t port_id,
5538 		const struct rte_flow_pattern_template_attr *template_attr,
5539 		const struct rte_flow_item pattern[],
5540 		struct rte_flow_error *error);
5541 
5542 /**
5543  * @warning
5544  * @b EXPERIMENTAL: this API may change without prior notice.
5545  *
5546  * Destroy flow pattern template.
5547  *
5548  * This function may be called only when
5549  * there are no more tables referencing this template.
5550  *
5551  * @param port_id
5552  *   Port identifier of Ethernet device.
5553  * @param[in] pattern_template
5554  *   Handle of the template to be destroyed.
5555  * @param[out] error
5556  *   Perform verbose error reporting if not NULL.
5557  *   PMDs initialize this structure in case of error only.
5558  *
5559  * @return
5560  *   0 on success, a negative errno value otherwise and rte_errno is set.
5561  */
5562 __rte_experimental
5563 int
5564 rte_flow_pattern_template_destroy(uint16_t port_id,
5565 		struct rte_flow_pattern_template *pattern_template,
5566 		struct rte_flow_error *error);
5567 
5568 /**
5569  * Opaque type returned after successful creation of actions template.
5570  * This handle can be used to manage the created actions template.
5571  */
5572 struct rte_flow_actions_template;
5573 
5574 /**
5575  * @warning
5576  * @b EXPERIMENTAL: this API may change without prior notice.
5577  *
5578  * Flow actions template attributes.
5579  */
5580 __extension__
5581 struct rte_flow_actions_template_attr {
5582 	/**
5583 	 * Flow direction for the actions template.
5584 	 * At least one direction must be specified.
5585 	 */
5586 	/** Action valid for rules applied to ingress traffic. */
5587 	uint32_t ingress:1;
5588 	/** Action valid for rules applied to egress traffic. */
5589 	uint32_t egress:1;
5590 	/** Action valid for rules applied to transfer traffic. */
5591 	uint32_t transfer:1;
5592 };
5593 
5594 /**
5595  * @warning
5596  * @b EXPERIMENTAL: this API may change without prior notice.
5597  *
5598  * Create flow actions template.
5599  *
5600  * The actions template holds a list of action types without values.
5601  * For example, the template to change TCP ports is TCP(s_port + d_port),
5602  * while values for each rule will be set during the flow rule creation.
5603  * The number and order of actions in the template must be the same
5604  * at the rule creation.
5605  *
5606  * @param port_id
5607  *   Port identifier of Ethernet device.
5608  * @param[in] template_attr
5609  *   Template attributes.
5610  * @param[in] actions
5611  *   Associated actions (list terminated by the END action).
5612  *   The spec member is only used if @p masks spec is non-zero.
5613  * @param[in] masks
5614  *   List of actions that marks which of the action's member is constant.
5615  *   A mask has the same format as the corresponding action.
5616  *   If the action field in @p masks is not 0,
5617  *   the corresponding value in an action from @p actions will be the part
5618  *   of the template and used in all flow rules.
5619  *   The order of actions in @p masks is the same as in @p actions.
5620  *   In case of indirect actions present in @p actions,
5621  *   the actual action type should be present in @p mask.
5622  * @param[out] error
5623  *   Perform verbose error reporting if not NULL.
5624  *   PMDs initialize this structure in case of error only.
5625  *
5626  * @return
5627  *   Handle on success, NULL otherwise and rte_errno is set.
5628  */
5629 __rte_experimental
5630 struct rte_flow_actions_template *
5631 rte_flow_actions_template_create(uint16_t port_id,
5632 		const struct rte_flow_actions_template_attr *template_attr,
5633 		const struct rte_flow_action actions[],
5634 		const struct rte_flow_action masks[],
5635 		struct rte_flow_error *error);
5636 
5637 /**
5638  * @warning
5639  * @b EXPERIMENTAL: this API may change without prior notice.
5640  *
5641  * Destroy flow actions template.
5642  *
5643  * This function may be called only when
5644  * there are no more tables referencing this template.
5645  *
5646  * @param port_id
5647  *   Port identifier of Ethernet device.
5648  * @param[in] actions_template
5649  *   Handle to the template to be destroyed.
5650  * @param[out] error
5651  *   Perform verbose error reporting if not NULL.
5652  *   PMDs initialize this structure in case of error only.
5653  *
5654  * @return
5655  *   0 on success, a negative errno value otherwise and rte_errno is set.
5656  */
5657 __rte_experimental
5658 int
5659 rte_flow_actions_template_destroy(uint16_t port_id,
5660 		struct rte_flow_actions_template *actions_template,
5661 		struct rte_flow_error *error);
5662 
5663 /**
5664  * Opaque type returned after successful creation of a template table.
5665  * This handle can be used to manage the created template table.
5666  */
5667 struct rte_flow_template_table;
5668 
5669 /**@{@name Flags for template table attribute.
5670  * Each bit is an optional hint for table specialization,
5671  * offering a potential optimization at driver layer.
5672  * The driver can ignore the hints silently.
5673  * The hints do not replace any matching criteria.
5674  */
5675 /**
5676  * Specialize table for transfer flows which come only from wire.
5677  * It allows PMD not to allocate resources for non-wire originated traffic.
5678  * This bit is not a matching criteria, just an optimization hint.
5679  * Flow rules which match non-wire originated traffic will be missed
5680  * if the hint is supported.
5681  */
5682 #define RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG RTE_BIT32(0)
5683 /**
5684  * Specialize table for transfer flows which come only from vport (e.g. VF, SF).
5685  * It allows PMD not to allocate resources for non-vport originated traffic.
5686  * This bit is not a matching criteria, just an optimization hint.
5687  * Flow rules which match non-vport originated traffic will be missed
5688  * if the hint is supported.
5689  */
5690 #define RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG RTE_BIT32(1)
5691 /**@}*/
5692 
5693 /**
5694  * @warning
5695  * @b EXPERIMENTAL: this API may change without prior notice.
5696  *
5697  * Template table flow rules insertion type.
5698  */
5699 enum rte_flow_table_insertion_type {
5700 	/**
5701 	 * Pattern-based insertion.
5702 	 */
5703 	RTE_FLOW_TABLE_INSERTION_TYPE_PATTERN,
5704 	/**
5705 	 * Index-based insertion.
5706 	 */
5707 	RTE_FLOW_TABLE_INSERTION_TYPE_INDEX,
5708 };
5709 
5710 /**
5711  * @warning
5712  * @b EXPERIMENTAL: this API may change without prior notice.
5713  *
5714  * Template table hash index calculation function.
5715  */
5716 enum rte_flow_table_hash_func {
5717 	/**
5718 	 * Default hash calculation.
5719 	 */
5720 	RTE_FLOW_TABLE_HASH_FUNC_DEFAULT,
5721 	/**
5722 	 * Linear hash calculation.
5723 	 */
5724 	RTE_FLOW_TABLE_HASH_FUNC_LINEAR,
5725 	/**
5726 	 * 32-bit checksum hash calculation.
5727 	 */
5728 	RTE_FLOW_TABLE_HASH_FUNC_CRC32,
5729 	/**
5730 	 * 16-bit checksum hash calculation.
5731 	 */
5732 	RTE_FLOW_TABLE_HASH_FUNC_CRC16,
5733 };
5734 
5735 /**
5736  * @warning
5737  * @b EXPERIMENTAL: this API may change without prior notice.
5738  *
5739  * Table attributes.
5740  */
5741 struct rte_flow_template_table_attr {
5742 	/**
5743 	 * Flow attributes to be used in each rule generated from this table.
5744 	 */
5745 	struct rte_flow_attr flow_attr;
5746 	/**
5747 	 * Maximum number of flow rules that this table holds.
5748 	 */
5749 	uint32_t nb_flows;
5750 	/**
5751 	 * Optional hint flags for driver optimization.
5752 	 * The effect may vary in the different drivers.
5753 	 * The functionality must not rely on the hints.
5754 	 * Value is composed with RTE_FLOW_TABLE_SPECIALIZE_* based on application
5755 	 * design choices.
5756 	 * Misused hints may mislead the driver, it may result in an undefined behavior.
5757 	 */
5758 	uint32_t specialize;
5759 	/**
5760 	 * Insertion type for flow rules.
5761 	 */
5762 	enum rte_flow_table_insertion_type insertion_type;
5763 	/**
5764 	 * Hash calculation function for the packet matching.
5765 	 */
5766 	enum rte_flow_table_hash_func hash_func;
5767 };
5768 
5769 /**
5770  * @warning
5771  * @b EXPERIMENTAL: this API may change without prior notice.
5772  *
5773  * Create flow template table.
5774  *
5775  * A template table consists of multiple pattern templates and actions
5776  * templates associated with a single set of rule attributes (group ID,
5777  * priority and traffic direction).
5778  *
5779  * Each rule is free to use any combination of pattern and actions templates
5780  * and specify particular values for items and actions it would like to change.
5781  *
5782  * @param port_id
5783  *   Port identifier of Ethernet device.
5784  * @param[in] table_attr
5785  *   Template table attributes.
5786  * @param[in] pattern_templates
5787  *   Array of pattern templates to be used in this table.
5788  * @param[in] nb_pattern_templates
5789  *   The number of pattern templates in the pattern_templates array.
5790  * @param[in] actions_templates
5791  *   Array of actions templates to be used in this table.
5792  * @param[in] nb_actions_templates
5793  *   The number of actions templates in the actions_templates array.
5794  * @param[out] error
5795  *   Perform verbose error reporting if not NULL.
5796  *   PMDs initialize this structure in case of error only.
5797  *
5798  * @return
5799  *   Handle on success, NULL otherwise and rte_errno is set.
5800  */
5801 __rte_experimental
5802 struct rte_flow_template_table *
5803 rte_flow_template_table_create(uint16_t port_id,
5804 		const struct rte_flow_template_table_attr *table_attr,
5805 		struct rte_flow_pattern_template *pattern_templates[],
5806 		uint8_t nb_pattern_templates,
5807 		struct rte_flow_actions_template *actions_templates[],
5808 		uint8_t nb_actions_templates,
5809 		struct rte_flow_error *error);
5810 
5811 /**
5812  * @warning
5813  * @b EXPERIMENTAL: this API may change without prior notice.
5814  *
5815  * Destroy flow template table.
5816  *
5817  * This function may be called only when
5818  * there are no more flow rules referencing this table.
5819  *
5820  * @param port_id
5821  *   Port identifier of Ethernet device.
5822  * @param[in] template_table
5823  *   Handle to the table to be destroyed.
5824  * @param[out] error
5825  *   Perform verbose error reporting if not NULL.
5826  *   PMDs initialize this structure in case of error only.
5827  *
5828  * @return
5829  *   0 on success, a negative errno value otherwise and rte_errno is set.
5830  */
5831 __rte_experimental
5832 int
5833 rte_flow_template_table_destroy(uint16_t port_id,
5834 		struct rte_flow_template_table *template_table,
5835 		struct rte_flow_error *error);
5836 
5837 /**
5838  * @warning
5839  * @b EXPERIMENTAL: this API may change without prior notice.
5840  *
5841  * Asynchronous operation attributes.
5842  */
5843 __extension__
5844 struct rte_flow_op_attr {
5845 	 /**
5846 	  * When set, the requested action will not be sent to the HW immediately.
5847 	  * The application must call the rte_flow_queue_push to actually send it.
5848 	  */
5849 	uint32_t postpone:1;
5850 };
5851 
5852 /**
5853  * @warning
5854  * @b EXPERIMENTAL: this API may change without prior notice.
5855  *
5856  * Enqueue rule creation operation.
5857  *
5858  * @param port_id
5859  *   Port identifier of Ethernet device.
5860  * @param queue_id
5861  *   Flow queue used to insert the rule.
5862  * @param[in] op_attr
5863  *   Rule creation operation attributes.
5864  * @param[in] template_table
5865  *   Template table to select templates from.
5866  * @param[in] pattern
5867  *   List of pattern items to be used.
5868  *   The list order should match the order in the pattern template.
5869  *   The spec is the only relevant member of the item that is being used.
5870  * @param[in] pattern_template_index
5871  *   Pattern template index in the table.
5872  * @param[in] actions
5873  *   List of actions to be used.
5874  *   The list order should match the order in the actions template.
5875  * @param[in] actions_template_index
5876  *   Actions template index in the table.
5877  * @param[in] user_data
5878  *   The user data that will be returned on the completion events.
5879  * @param[out] error
5880  *   Perform verbose error reporting if not NULL.
5881  *   PMDs initialize this structure in case of error only.
5882  *
5883  * @return
5884  *   Handle on success, NULL otherwise and rte_errno is set.
5885  *   The rule handle doesn't mean that the rule has been populated.
5886  *   Only completion result indicates that if there was success or failure.
5887  */
5888 __rte_experimental
5889 struct rte_flow *
5890 rte_flow_async_create(uint16_t port_id,
5891 		      uint32_t queue_id,
5892 		      const struct rte_flow_op_attr *op_attr,
5893 		      struct rte_flow_template_table *template_table,
5894 		      const struct rte_flow_item pattern[],
5895 		      uint8_t pattern_template_index,
5896 		      const struct rte_flow_action actions[],
5897 		      uint8_t actions_template_index,
5898 		      void *user_data,
5899 		      struct rte_flow_error *error);
5900 
5901 /**
5902  * @warning
5903  * @b EXPERIMENTAL: this API may change without prior notice.
5904  *
5905  * Enqueue rule creation operation.
5906  *
5907  * @param port_id
5908  *   Port identifier of Ethernet device.
5909  * @param queue_id
5910  *   Flow queue used to insert the rule.
5911  * @param[in] op_attr
5912  *   Rule creation operation attributes.
5913  * @param[in] template_table
5914  *   Template table to select templates from.
5915  * @param[in] rule_index
5916  *   Rule index in the table.
5917  * @param[in] actions
5918  *   List of actions to be used.
5919  *   The list order should match the order in the actions template.
5920  * @param[in] actions_template_index
5921  *   Actions template index in the table.
5922  * @param[in] user_data
5923  *   The user data that will be returned on the completion events.
5924  * @param[out] error
5925  *   Perform verbose error reporting if not NULL.
5926  *   PMDs initialize this structure in case of error only.
5927  *
5928  * @return
5929  *   Handle on success, NULL otherwise and rte_errno is set.
5930  *   The rule handle doesn't mean that the rule has been populated.
5931  *   Only completion result indicates that if there was success or failure.
5932  */
5933 __rte_experimental
5934 struct rte_flow *
5935 rte_flow_async_create_by_index(uint16_t port_id,
5936 			       uint32_t queue_id,
5937 			       const struct rte_flow_op_attr *op_attr,
5938 			       struct rte_flow_template_table *template_table,
5939 			       uint32_t rule_index,
5940 			       const struct rte_flow_action actions[],
5941 			       uint8_t actions_template_index,
5942 			       void *user_data,
5943 			       struct rte_flow_error *error);
5944 
5945 /**
5946  * @warning
5947  * @b EXPERIMENTAL: this API may change without prior notice.
5948  *
5949  * Enqueue rule destruction operation.
5950  *
5951  * This function enqueues a destruction operation on the queue.
5952  * Application should assume that after calling this function
5953  * the rule handle is not valid anymore.
5954  * Completion indicates the full removal of the rule from the HW.
5955  *
5956  * @param port_id
5957  *   Port identifier of Ethernet device.
5958  * @param queue_id
5959  *   Flow queue which is used to destroy the rule.
5960  *   This must match the queue on which the rule was created.
5961  * @param[in] op_attr
5962  *   Rule destruction operation attributes.
5963  * @param[in] flow
5964  *   Flow handle to be destroyed.
5965  * @param[in] user_data
5966  *   The user data that will be returned on the completion events.
5967  * @param[out] error
5968  *   Perform verbose error reporting if not NULL.
5969  *   PMDs initialize this structure in case of error only.
5970  *
5971  * @return
5972  *   0 on success, a negative errno value otherwise and rte_errno is set.
5973  */
5974 __rte_experimental
5975 int
5976 rte_flow_async_destroy(uint16_t port_id,
5977 		       uint32_t queue_id,
5978 		       const struct rte_flow_op_attr *op_attr,
5979 		       struct rte_flow *flow,
5980 		       void *user_data,
5981 		       struct rte_flow_error *error);
5982 
5983 /**
5984  * @warning
5985  * @b EXPERIMENTAL: this API may change without prior notice.
5986  *
5987  * Enqueue rule update operation.
5988  *
5989  * @param port_id
5990  *   Port identifier of Ethernet device.
5991  * @param queue_id
5992  *   Flow queue used to insert the rule.
5993  * @param[in] op_attr
5994  *   Rule creation operation attributes.
5995  * @param[in] flow
5996  *   Flow rule to be updated.
5997  * @param[in] actions
5998  *   List of actions to be used.
5999  *   The list order should match the order in the actions template.
6000  * @param[in] actions_template_index
6001  *   Actions template index in the table.
6002  * @param[in] user_data
6003  *   The user data that will be returned on the completion events.
6004  * @param[out] error
6005  *   Perform verbose error reporting if not NULL.
6006  *   PMDs initialize this structure in case of error only.
6007  *
6008  * @return
6009  *   0 on success, a negative errno value otherwise and rte_errno is set.
6010  */
6011 __rte_experimental
6012 int
6013 rte_flow_async_actions_update(uint16_t port_id,
6014 			      uint32_t queue_id,
6015 			      const struct rte_flow_op_attr *op_attr,
6016 			      struct rte_flow *flow,
6017 			      const struct rte_flow_action actions[],
6018 			      uint8_t actions_template_index,
6019 			      void *user_data,
6020 			      struct rte_flow_error *error);
6021 
6022 /**
6023  * @warning
6024  * @b EXPERIMENTAL: this API may change without prior notice.
6025  *
6026  * Push all internally stored rules to the HW.
6027  * Postponed rules are rules that were inserted with the postpone flag set.
6028  * Can be used to notify the HW about batch of rules prepared by the SW to
6029  * reduce the number of communications between the HW and SW.
6030  *
6031  * @param port_id
6032  *   Port identifier of Ethernet device.
6033  * @param queue_id
6034  *   Flow queue to be pushed.
6035  * @param[out] error
6036  *   Perform verbose error reporting if not NULL.
6037  *   PMDs initialize this structure in case of error only.
6038  *
6039  * @return
6040  *   0 on success, a negative errno value otherwise and rte_errno is set.
6041  */
6042 __rte_experimental
6043 int
6044 rte_flow_push(uint16_t port_id,
6045 	      uint32_t queue_id,
6046 	      struct rte_flow_error *error);
6047 
6048 /**
6049  * @warning
6050  * @b EXPERIMENTAL: this API may change without prior notice.
6051  *
6052  * Asynchronous operation status.
6053  */
6054 enum rte_flow_op_status {
6055 	/**
6056 	 * The operation was completed successfully.
6057 	 */
6058 	RTE_FLOW_OP_SUCCESS,
6059 	/**
6060 	 * The operation was not completed successfully.
6061 	 */
6062 	RTE_FLOW_OP_ERROR,
6063 };
6064 
6065 /**
6066  * @warning
6067  * @b EXPERIMENTAL: this API may change without prior notice.
6068  *
6069  * Asynchronous operation result.
6070  */
6071 __extension__
6072 struct rte_flow_op_result {
6073 	/**
6074 	 * Returns the status of the operation that this completion signals.
6075 	 */
6076 	enum rte_flow_op_status status;
6077 	/**
6078 	 * The user data that will be returned on the completion events.
6079 	 */
6080 	void *user_data;
6081 };
6082 
6083 /**
6084  * @warning
6085  * @b EXPERIMENTAL: this API may change without prior notice.
6086  *
6087  * Pull a rte flow operation.
6088  * The application must invoke this function in order to complete
6089  * the flow rule offloading and to retrieve the flow rule operation status.
6090  *
6091  * @param port_id
6092  *   Port identifier of Ethernet device.
6093  * @param queue_id
6094  *   Flow queue which is used to pull the operation.
6095  * @param[out] res
6096  *   Array of results that will be set.
6097  * @param[in] n_res
6098  *   Maximum number of results that can be returned.
6099  *   This value is equal to the size of the res array.
6100  * @param[out] error
6101  *   Perform verbose error reporting if not NULL.
6102  *   PMDs initialize this structure in case of error only.
6103  *
6104  * @return
6105  *   Number of results that were pulled,
6106  *   a negative errno value otherwise and rte_errno is set.
6107  */
6108 __rte_experimental
6109 int
6110 rte_flow_pull(uint16_t port_id,
6111 	      uint32_t queue_id,
6112 	      struct rte_flow_op_result res[],
6113 	      uint16_t n_res,
6114 	      struct rte_flow_error *error);
6115 
6116 /**
6117  * @warning
6118  * @b EXPERIMENTAL: this API may change without prior notice.
6119  *
6120  * Enqueue indirect action creation operation.
6121  * @see rte_flow_action_handle_create
6122  *
6123  * @param[in] port_id
6124  *   Port identifier of Ethernet device.
6125  * @param[in] queue_id
6126  *   Flow queue which is used to create the rule.
6127  * @param[in] op_attr
6128  *   Indirect action creation operation attributes.
6129  * @param[in] indir_action_conf
6130  *   Action configuration for the indirect action object creation.
6131  * @param[in] action
6132  *   Specific configuration of the indirect action object.
6133  * @param[in] user_data
6134  *   The user data that will be returned on the completion events.
6135  * @param[out] error
6136  *   Perform verbose error reporting if not NULL.
6137  *   PMDs initialize this structure in case of error only.
6138  *
6139  * @return
6140  *   A valid handle in case of success, NULL otherwise and rte_errno is set.
6141  */
6142 __rte_experimental
6143 struct rte_flow_action_handle *
6144 rte_flow_async_action_handle_create(uint16_t port_id,
6145 		uint32_t queue_id,
6146 		const struct rte_flow_op_attr *op_attr,
6147 		const struct rte_flow_indir_action_conf *indir_action_conf,
6148 		const struct rte_flow_action *action,
6149 		void *user_data,
6150 		struct rte_flow_error *error);
6151 
6152 /**
6153  * @warning
6154  * @b EXPERIMENTAL: this API may change without prior notice.
6155  *
6156  * Enqueue indirect action destruction operation.
6157  * The destroy queue must be the same
6158  * as the queue on which the action was created.
6159  *
6160  * @param[in] port_id
6161  *   Port identifier of Ethernet device.
6162  * @param[in] queue_id
6163  *   Flow queue which is used to destroy the rule.
6164  * @param[in] op_attr
6165  *   Indirect action destruction operation attributes.
6166  * @param[in] action_handle
6167  *   Handle for the indirect action object to be destroyed.
6168  * @param[in] user_data
6169  *   The user data that will be returned on the completion events.
6170  * @param[out] error
6171  *   Perform verbose error reporting if not NULL.
6172  *   PMDs initialize this structure in case of error only.
6173  *
6174  * @return
6175  *   0 on success, a negative errno value otherwise and rte_errno is set.
6176  */
6177 __rte_experimental
6178 int
6179 rte_flow_async_action_handle_destroy(uint16_t port_id,
6180 		uint32_t queue_id,
6181 		const struct rte_flow_op_attr *op_attr,
6182 		struct rte_flow_action_handle *action_handle,
6183 		void *user_data,
6184 		struct rte_flow_error *error);
6185 
6186 /**
6187  * @warning
6188  * @b EXPERIMENTAL: this API may change without prior notice.
6189  *
6190  * Enqueue indirect action update operation.
6191  * @see rte_flow_action_handle_create
6192  *
6193  * @param[in] port_id
6194  *   Port identifier of Ethernet device.
6195  * @param[in] queue_id
6196  *   Flow queue which is used to update the rule.
6197  * @param[in] op_attr
6198  *   Indirect action update operation attributes.
6199  * @param[in] action_handle
6200  *   Handle for the indirect action object to be updated.
6201  * @param[in] update
6202  *   Update profile specification used to modify the action pointed by handle.
6203  *   *update* could be with the same type of the immediate action corresponding
6204  *   to the *handle* argument when creating, or a wrapper structure includes
6205  *   action configuration to be updated and bit fields to indicate the member
6206  *   of fields inside the action to update.
6207  * @param[in] user_data
6208  *   The user data that will be returned on the completion events.
6209  * @param[out] error
6210  *   Perform verbose error reporting if not NULL.
6211  *   PMDs initialize this structure in case of error only.
6212  *
6213  * @return
6214  *   0 on success, a negative errno value otherwise and rte_errno is set.
6215  */
6216 __rte_experimental
6217 int
6218 rte_flow_async_action_handle_update(uint16_t port_id,
6219 		uint32_t queue_id,
6220 		const struct rte_flow_op_attr *op_attr,
6221 		struct rte_flow_action_handle *action_handle,
6222 		const void *update,
6223 		void *user_data,
6224 		struct rte_flow_error *error);
6225 
6226 /**
6227  * @warning
6228  * @b EXPERIMENTAL: this API may change without prior notice.
6229  *
6230  * Enqueue indirect action query operation.
6231  *
6232  * Retrieve action-specific data such as counters.
6233  * Data is gathered by special action which may be present/referenced in
6234  * more than one flow rule definition.
6235  * Data will be available only when completion event returns.
6236  *
6237  * @see rte_flow_async_action_handle_query
6238  *
6239  * @param port_id
6240  *   Port identifier of Ethernet device.
6241  * @param[in] queue_id
6242  *   Flow queue which is used to query the action.
6243  * @param[in] op_attr
6244  *   Indirect action update operation attributes.
6245  * @param[in] action_handle
6246  *   Handle for the action object to query.
6247  * @param[in, out] data
6248  *   Pointer to storage for the associated query data type.
6249  *   The out data will be available only when completion event returns
6250  *   from rte_flow_pull.
6251  * @param[in] user_data
6252  *   The user data that will be returned on the completion events.
6253  * @param[out] error
6254  *   Perform verbose error reporting if not NULL. PMDs initialize this
6255  *   structure in case of error only.
6256  *
6257  * @return
6258  *   0 on success, a negative errno value otherwise and rte_errno is set.
6259  */
6260 __rte_experimental
6261 int
6262 rte_flow_async_action_handle_query(uint16_t port_id,
6263 		uint32_t queue_id,
6264 		const struct rte_flow_op_attr *op_attr,
6265 		const struct rte_flow_action_handle *action_handle,
6266 		void *data,
6267 		void *user_data,
6268 		struct rte_flow_error *error);
6269 
6270 /**
6271  * @warning
6272  * @b EXPERIMENTAL: this API may change without prior notice.
6273  *
6274  * Query and update operational mode.
6275  *
6276  * @see rte_flow_action_handle_query_update()
6277  * @see rte_flow_async_action_handle_query_update()
6278  */
6279 enum rte_flow_query_update_mode {
6280 	RTE_FLOW_QU_QUERY_FIRST = 1,  /**< Query before update. */
6281 	RTE_FLOW_QU_UPDATE_FIRST,     /**< Query after  update. */
6282 };
6283 
6284 /**
6285  * @warning
6286  * @b EXPERIMENTAL: this API may change without prior notice.
6287  *
6288  * Query and/or update indirect flow action.
6289  * If both query and update not NULL, the function atomically
6290  * queries and updates indirect action. Query and update are carried in order
6291  * specified in the mode parameter.
6292  * If ether query or update is NULL, the function executes
6293  * complementing operation.
6294  *
6295  * @param port_id
6296  *   Port identifier of Ethernet device.
6297  * @param handle
6298  *   Handle for the indirect action object to be updated.
6299  * @param update
6300  *   If not NULL, update profile specification used to modify the action
6301  *   pointed by handle.
6302  * @param query
6303  *   If not NULL pointer to storage for the associated query data type.
6304  * @param mode
6305  *   Operational mode.
6306  * @param error
6307  *   Perform verbose error reporting if not NULL.
6308  *   PMDs initialize this structure in case of error only.
6309  *
6310  * @return
6311  * 0 on success, a negative errno value otherwise and rte_errno is set.
6312  * - (-ENODEV) if *port_id* invalid.
6313  * - (-ENOTSUP) if underlying device does not support this functionality.
6314  * - (-EINVAL) if *handle* or *mode* invalid or
6315  *             both *query* and *update* are NULL.
6316  */
6317 __rte_experimental
6318 int
6319 rte_flow_action_handle_query_update(uint16_t port_id,
6320 				    struct rte_flow_action_handle *handle,
6321 				    const void *update, void *query,
6322 				    enum rte_flow_query_update_mode mode,
6323 				    struct rte_flow_error *error);
6324 
6325 /**
6326  * @warning
6327  * @b EXPERIMENTAL: this API may change without prior notice.
6328  *
6329  * Enqueue async indirect flow action query and/or update
6330  *
6331  * @param port_id
6332  *   Port identifier of Ethernet device.
6333  * @param queue_id
6334  *   Flow queue which is used to update the rule.
6335  * @param attr
6336  *   Indirect action update operation attributes.
6337  * @param handle
6338  *   Handle for the indirect action object to be updated.
6339  * @param update
6340  *   If not NULL, update profile specification used to modify the action
6341  *   pointed by handle.
6342  * @param query
6343  *   If not NULL, pointer to storage for the associated query data type.
6344  *   Query result returned on async completion event.
6345  * @param mode
6346  *   Operational mode.
6347  * @param user_data
6348  *   The user data that will be returned on async completion event.
6349  * @param error
6350  *   Perform verbose error reporting if not NULL.
6351  *   PMDs initialize this structure in case of error only.
6352  *
6353  * @return
6354  *   0 on success, a negative errno value otherwise and rte_errno is set.
6355  * - (-ENODEV) if *port_id* invalid.
6356  * - (-ENOTSUP) if underlying device does not support this functionality.
6357  * - (-EINVAL) if *handle* or *mode* invalid or
6358  *             both *update* and *query* are NULL.
6359  */
6360 __rte_experimental
6361 int
6362 rte_flow_async_action_handle_query_update(uint16_t port_id, uint32_t queue_id,
6363 					  const struct rte_flow_op_attr *attr,
6364 					  struct rte_flow_action_handle *handle,
6365 					  const void *update, void *query,
6366 					  enum rte_flow_query_update_mode mode,
6367 					  void *user_data,
6368 					  struct rte_flow_error *error);
6369 
6370 struct rte_flow_action_list_handle;
6371 
6372 /**
6373  * @warning
6374  * @b EXPERIMENTAL: this API may change without prior notice.
6375  *
6376  * Configure INDIRECT_LIST flow action.
6377  *
6378  * @see RTE_FLOW_ACTION_TYPE_INDIRECT_LIST
6379  */
6380 struct rte_flow_action_indirect_list {
6381 	/** Indirect action list handle */
6382 	struct rte_flow_action_list_handle *handle;
6383 	/**
6384 	 * Flow mutable configuration array.
6385 	 * NULL if the handle has no flow mutable configuration update.
6386 	 * Otherwise, if the handle was created with list A1 / A2 .. An / END
6387 	 * size of conf is n.
6388 	 * conf[i] points to flow mutable update of Ai in the handle
6389 	 * actions list or NULL if Ai has no update.
6390 	 */
6391 	const void **conf;
6392 };
6393 
6394 /**
6395  * @warning
6396  * @b EXPERIMENTAL: this API may change without prior notice.
6397  *
6398  * Create an indirect flow action object from flow actions list.
6399  * The object is identified by a unique handle.
6400  * The handle has single state and configuration
6401  * across all the flow rules using it.
6402  *
6403  * @param[in] port_id
6404  *    The port identifier of the Ethernet device.
6405  * @param[in] conf
6406  *   Action configuration for the indirect action list creation.
6407  * @param[in] actions
6408  *   Specific configuration of the indirect action lists.
6409  * @param[out] error
6410  *   Perform verbose error reporting if not NULL. PMDs initialize this
6411  *   structure in case of error only.
6412  * @return
6413  *   A valid handle in case of success, NULL otherwise and rte_errno is set
6414  *   to one of the error codes defined:
6415  *   - (-ENODEV) if *port_id* invalid.
6416  *   - (-ENOSYS) if underlying device does not support this functionality.
6417  *   - (-EIO) if underlying device is removed.
6418  *   - (-EINVAL) if *actions* list invalid.
6419  *   - (-ENOTSUP) if *action* list element valid but unsupported.
6420  */
6421 __rte_experimental
6422 struct rte_flow_action_list_handle *
6423 rte_flow_action_list_handle_create(uint16_t port_id,
6424 				   const
6425 				   struct rte_flow_indir_action_conf *conf,
6426 				   const struct rte_flow_action *actions,
6427 				   struct rte_flow_error *error);
6428 
6429 /**
6430  * @warning
6431  * @b EXPERIMENTAL: this API may change without prior notice.
6432  *
6433  * Async function call to create an indirect flow action object
6434  * from flow actions list.
6435  * The object is identified by a unique handle.
6436  * The handle has single state and configuration
6437  * across all the flow rules using it.
6438  *
6439  * @param[in] port_id
6440  *    The port identifier of the Ethernet device.
6441  * @param[in] queue_id
6442  *   Flow queue which is used to update the rule.
6443  * @param[in] attr
6444  *   Indirect action update operation attributes.
6445  * @param[in] conf
6446  *   Action configuration for the indirect action list creation.
6447  * @param[in] actions
6448  *   Specific configuration of the indirect action list.
6449  * @param[in] user_data
6450  *   The user data that will be returned on async completion event.
6451  * @param[out] error
6452  *   Perform verbose error reporting if not NULL. PMDs initialize this
6453  *   structure in case of error only.
6454  * @return
6455  *   A valid handle in case of success, NULL otherwise and rte_errno is set
6456  *   to one of the error codes defined:
6457  *   - (-ENODEV) if *port_id* invalid.
6458  *   - (-ENOSYS) if underlying device does not support this functionality.
6459  *   - (-EIO) if underlying device is removed.
6460  *   - (-EINVAL) if *actions* list invalid.
6461  *   - (-ENOTSUP) if *action* list element valid but unsupported.
6462  */
6463 __rte_experimental
6464 struct rte_flow_action_list_handle *
6465 rte_flow_async_action_list_handle_create(uint16_t port_id, uint32_t queue_id,
6466 					 const struct rte_flow_op_attr *attr,
6467 					 const struct rte_flow_indir_action_conf *conf,
6468 					 const struct rte_flow_action *actions,
6469 					 void *user_data,
6470 					 struct rte_flow_error *error);
6471 
6472 /**
6473  * @warning
6474  * @b EXPERIMENTAL: this API may change without prior notice.
6475  *
6476  * Destroy indirect actions list by handle.
6477  *
6478  * @param[in] port_id
6479  *    The port identifier of the Ethernet device.
6480  * @param[in] handle
6481  *   Handle for the indirect actions list to be destroyed.
6482  * @param[out] error
6483  *   Perform verbose error reporting if not NULL. PMDs initialize this
6484  *   structure in case of error only.
6485  * @return
6486  *   - (0) if success.
6487  *   - (-ENODEV) if *port_id* invalid.
6488  *   - (-ENOSYS) if underlying device does not support this functionality.
6489  *   - (-EIO) if underlying device is removed.
6490  *   - (-ENOENT) if actions list pointed by *action* handle was not found.
6491  *   - (-EBUSY) if actions list pointed by *action* handle still used
6492  */
6493 __rte_experimental
6494 int
6495 rte_flow_action_list_handle_destroy(uint16_t port_id,
6496 				    struct rte_flow_action_list_handle *handle,
6497 				    struct rte_flow_error *error);
6498 
6499 /**
6500  * @warning
6501  * @b EXPERIMENTAL: this API may change without prior notice.
6502  *
6503  * Enqueue indirect action list destruction operation.
6504  * The destroy queue must be the same
6505  * as the queue on which the action was created.
6506  *
6507  * @param[in] port_id
6508  *   Port identifier of Ethernet device.
6509  * @param[in] queue_id
6510  *   Flow queue which is used to destroy the rule.
6511  * @param[in] op_attr
6512  *   Indirect action destruction operation attributes.
6513  * @param[in] handle
6514  *   Handle for the indirect action object to be destroyed.
6515  * @param[in] user_data
6516  *   The user data that will be returned on the completion events.
6517  * @param[out] error
6518  *   Perform verbose error reporting if not NULL.
6519  *   PMDs initialize this structure in case of error only.
6520  *
6521  * @return
6522  *   - (0) if success.
6523  *   - (-ENODEV) if *port_id* invalid.
6524  *   - (-ENOSYS) if underlying device does not support this functionality.
6525  *   - (-EIO) if underlying device is removed.
6526  *   - (-ENOENT) if actions list pointed by *action* handle was not found.
6527  *   - (-EBUSY) if actions list pointed by *action* handle still used
6528  */
6529 __rte_experimental
6530 int
6531 rte_flow_async_action_list_handle_destroy
6532 		(uint16_t port_id, uint32_t queue_id,
6533 		 const struct rte_flow_op_attr *op_attr,
6534 		 struct rte_flow_action_list_handle *handle,
6535 		 void *user_data, struct rte_flow_error *error);
6536 
6537 /**
6538  * @warning
6539  * @b EXPERIMENTAL: this API may change without prior notice.
6540  *
6541  * Query and/or update indirect flow actions list.
6542  * If both query and update not NULL, the function atomically
6543  * queries and updates indirect action. Query and update are carried in order
6544  * specified in the mode parameter.
6545  * If ether query or update is NULL, the function executes
6546  * complementing operation.
6547  *
6548  * @param port_id
6549  *   Port identifier of Ethernet device.
6550  * @param handle
6551  *   Handle for the indirect actions list object to be updated.
6552  * @param update
6553  *   If the action list handle was created from n actions A1 / A2 ... An / END
6554  *   non-NULL update parameter is an array [U1, U2, ... Un] where Ui points to
6555  *   Ai update context or NULL if Ai should not be updated.
6556  * @param query
6557  *   If the action list handle was created from n actions A1 / A2 ... An / END
6558  *   non-NULL query parameter is an array [Q1, Q2, ... Qn] where Qi points to
6559  *   Ai query context or NULL if Ai should not be queried.
6560  * @param mode
6561  *   Operational mode.
6562  * @param error
6563  *   Perform verbose error reporting if not NULL.
6564  *   PMDs initialize this structure in case of error only.
6565  *
6566  * @return
6567  *   - (0) if success.
6568  * - (-ENODEV) if *port_id* invalid.
6569  * - (-ENOTSUP) if underlying device does not support this functionality.
6570  * - (-EINVAL) if *handle* or *mode* invalid or
6571  *             both *query* and *update* are NULL.
6572  */
6573 __rte_experimental
6574 int
6575 rte_flow_action_list_handle_query_update(uint16_t port_id,
6576 					 const struct rte_flow_action_list_handle *handle,
6577 					 const void **update, void **query,
6578 					 enum rte_flow_query_update_mode mode,
6579 					 struct rte_flow_error *error);
6580 
6581 /**
6582  * @warning
6583  * @b EXPERIMENTAL: this API may change without prior notice.
6584  *
6585  * Enqueue async indirect flow actions list query and/or update
6586  * If both query and update not NULL, the function atomically
6587  * queries and updates indirect action. Query and update are carried in order
6588  * specified in the mode parameter.
6589  * If ether query or update is NULL, the function executes
6590  * complementing operation.
6591  *
6592  * @param port_id
6593  *   Port identifier of Ethernet device.
6594  * @param queue_id
6595  *   Flow queue which is used to update the rule.
6596  * @param attr
6597  *   Indirect action update operation attributes.
6598  * @param handle
6599  *   Handle for the indirect actions list object to be updated.
6600  * @param update
6601  *   If the action list handle was created from n actions A1 / A2 ... An / END
6602  *   non-NULL update parameter is an array [U1, U2, ... Un] where Ui points to
6603  *   Ai update context or NULL if Ai should not be updated.
6604  * @param query
6605  *   If the action list handle was created from n actions A1 / A2 ... An / END
6606  *   non-NULL query parameter is an array [Q1, Q2, ... Qn] where Qi points to
6607  *   Ai query context or NULL if Ai should not be queried.
6608  *   Query result returned on async completion event.
6609  * @param mode
6610  *   Operational mode.
6611  * @param user_data
6612  *   The user data that will be returned on async completion event.
6613  * @param error
6614  *   Perform verbose error reporting if not NULL.
6615  *   PMDs initialize this structure in case of error only.
6616  *
6617  * @return
6618  *   - (0) if success.
6619  * - (-ENODEV) if *port_id* invalid.
6620  * - (-ENOTSUP) if underlying device does not support this functionality.
6621  * - (-EINVAL) if *handle* or *mode* invalid or
6622  *             both *update* and *query* are NULL.
6623  */
6624 __rte_experimental
6625 int
6626 rte_flow_async_action_list_handle_query_update(uint16_t port_id, uint32_t queue_id,
6627 					  const struct rte_flow_op_attr *attr,
6628 					  const struct rte_flow_action_list_handle *handle,
6629 					  const void **update, void **query,
6630 					  enum rte_flow_query_update_mode mode,
6631 					  void *user_data,
6632 					  struct rte_flow_error *error);
6633 
6634 #ifdef __cplusplus
6635 }
6636 #endif
6637 
6638 #endif /* RTE_FLOW_H_ */
6639