xref: /dpdk/lib/ethdev/rte_flow.h (revision 5da44faa)
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_arp.h>
21 #include <rte_common.h>
22 #include <rte_ether.h>
23 #include <rte_icmp.h>
24 #include <rte_ip.h>
25 #include <rte_sctp.h>
26 #include <rte_tcp.h>
27 #include <rte_udp.h>
28 #include <rte_vxlan.h>
29 #include <rte_byteorder.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.h>
35 #include <rte_mbuf_dyn.h>
36 #include <rte_meter.h>
37 #include <rte_gtp.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 /**
44  * Flow rule attributes.
45  *
46  * Priorities are set on a per rule based within groups.
47  *
48  * Lower values denote higher priority, the highest priority for a flow rule
49  * is 0, so that a flow that matches for than one rule, the rule with the
50  * lowest priority value will always be matched.
51  *
52  * Although optional, applications are encouraged to group similar rules as
53  * much as possible to fully take advantage of hardware capabilities
54  * (e.g. optimized matching) and work around limitations (e.g. a single
55  * pattern type possibly allowed in a given group). Applications should be
56  * aware that groups are not linked by default, and that they must be
57  * explicitly linked by the application using the JUMP action.
58  *
59  * Priority levels are arbitrary and up to the application, they
60  * do not need to be contiguous nor start from 0, however the maximum number
61  * varies between devices and may be affected by existing flow rules.
62  *
63  * If a packet is matched by several rules of a given group for a given
64  * priority level, the outcome is undefined. It can take any path, may be
65  * duplicated or even cause unrecoverable errors.
66  *
67  * Note that support for more than a single group and priority level is not
68  * guaranteed.
69  *
70  * Flow rules can apply to inbound and/or outbound traffic (ingress/egress).
71  *
72  * Several pattern items and actions are valid and can be used in both
73  * directions. Those valid for only one direction are described as such.
74  *
75  * At least one direction must be specified.
76  *
77  * Specifying both directions at once for a given rule is not recommended
78  * but may be valid in a few cases.
79  */
80 struct rte_flow_attr {
81 	uint32_t group; /**< Priority group. */
82 	uint32_t priority; /**< Rule priority level within group. */
83 	uint32_t ingress:1; /**< Rule applies to ingress traffic. */
84 	uint32_t egress:1; /**< Rule applies to egress traffic. */
85 	/**
86 	 * Instead of simply matching the properties of traffic as it would
87 	 * appear on a given DPDK port ID, enabling this attribute transfers
88 	 * a flow rule to the lowest possible level of any device endpoints
89 	 * found in the pattern.
90 	 *
91 	 * When supported, this effectively enables an application to
92 	 * re-route traffic not necessarily intended for it (e.g. coming
93 	 * from or addressed to different physical ports, VFs or
94 	 * applications) at the device level.
95 	 *
96 	 * It complements the behavior of some pattern items such as
97 	 * RTE_FLOW_ITEM_TYPE_PHY_PORT and is meaningless without them.
98 	 *
99 	 * When transferring flow rules, ingress and egress attributes keep
100 	 * their original meaning, as if processing traffic emitted or
101 	 * received by the application.
102 	 */
103 	uint32_t transfer:1;
104 	uint32_t reserved:29; /**< Reserved, must be zero. */
105 };
106 
107 /**
108  * Matching pattern item types.
109  *
110  * Pattern items fall in two categories:
111  *
112  * - Matching protocol headers and packet data, usually associated with a
113  *   specification structure. These must be stacked in the same order as the
114  *   protocol layers to match inside packets, starting from the lowest.
115  *
116  * - Matching meta-data or affecting pattern processing, often without a
117  *   specification structure. Since they do not match packet contents, their
118  *   position in the list is usually not relevant.
119  *
120  * See the description of individual types for more information. Those
121  * marked with [META] fall into the second category.
122  */
123 enum rte_flow_item_type {
124 	/**
125 	 * [META]
126 	 *
127 	 * End marker for item lists. Prevents further processing of items,
128 	 * thereby ending the pattern.
129 	 *
130 	 * No associated specification structure.
131 	 */
132 	RTE_FLOW_ITEM_TYPE_END,
133 
134 	/**
135 	 * [META]
136 	 *
137 	 * Used as a placeholder for convenience. It is ignored and simply
138 	 * discarded by PMDs.
139 	 *
140 	 * No associated specification structure.
141 	 */
142 	RTE_FLOW_ITEM_TYPE_VOID,
143 
144 	/**
145 	 * [META]
146 	 *
147 	 * Inverted matching, i.e. process packets that do not match the
148 	 * pattern.
149 	 *
150 	 * No associated specification structure.
151 	 */
152 	RTE_FLOW_ITEM_TYPE_INVERT,
153 
154 	/**
155 	 * Matches any protocol in place of the current layer, a single ANY
156 	 * may also stand for several protocol layers.
157 	 *
158 	 * See struct rte_flow_item_any.
159 	 */
160 	RTE_FLOW_ITEM_TYPE_ANY,
161 
162 	/**
163 	 * @deprecated
164 	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
165 	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
166 	 *
167 	 * [META]
168 	 *
169 	 * Matches traffic originating from (ingress) or going to (egress)
170 	 * the physical function of the current device.
171 	 *
172 	 * No associated specification structure.
173 	 */
174 	RTE_FLOW_ITEM_TYPE_PF,
175 
176 	/**
177 	 * @deprecated
178 	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
179 	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
180 	 *
181 	 * [META]
182 	 *
183 	 * Matches traffic originating from (ingress) or going to (egress) a
184 	 * given virtual function of the current device.
185 	 *
186 	 * See struct rte_flow_item_vf.
187 	 */
188 	RTE_FLOW_ITEM_TYPE_VF,
189 
190 	/**
191 	 * @deprecated
192 	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
193 	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
194 	 *
195 	 * [META]
196 	 *
197 	 * Matches traffic originating from (ingress) or going to (egress) a
198 	 * physical port of the underlying device.
199 	 *
200 	 * See struct rte_flow_item_phy_port.
201 	 */
202 	RTE_FLOW_ITEM_TYPE_PHY_PORT,
203 
204 	/**
205 	 * @deprecated
206 	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
207 	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
208 	 *
209 	 * [META]
210 	 *
211 	 * Matches traffic originating from (ingress) or going to (egress) a
212 	 * given DPDK port ID.
213 	 *
214 	 * See struct rte_flow_item_port_id.
215 	 */
216 	RTE_FLOW_ITEM_TYPE_PORT_ID,
217 
218 	/**
219 	 * Matches a byte string of a given length at a given offset.
220 	 *
221 	 * See struct rte_flow_item_raw.
222 	 */
223 	RTE_FLOW_ITEM_TYPE_RAW,
224 
225 	/**
226 	 * Matches an Ethernet header.
227 	 *
228 	 * See struct rte_flow_item_eth.
229 	 */
230 	RTE_FLOW_ITEM_TYPE_ETH,
231 
232 	/**
233 	 * Matches an 802.1Q/ad VLAN tag.
234 	 *
235 	 * See struct rte_flow_item_vlan.
236 	 */
237 	RTE_FLOW_ITEM_TYPE_VLAN,
238 
239 	/**
240 	 * Matches an IPv4 header.
241 	 *
242 	 * See struct rte_flow_item_ipv4.
243 	 */
244 	RTE_FLOW_ITEM_TYPE_IPV4,
245 
246 	/**
247 	 * Matches an IPv6 header.
248 	 *
249 	 * See struct rte_flow_item_ipv6.
250 	 */
251 	RTE_FLOW_ITEM_TYPE_IPV6,
252 
253 	/**
254 	 * Matches an ICMP header.
255 	 *
256 	 * See struct rte_flow_item_icmp.
257 	 */
258 	RTE_FLOW_ITEM_TYPE_ICMP,
259 
260 	/**
261 	 * Matches a UDP header.
262 	 *
263 	 * See struct rte_flow_item_udp.
264 	 */
265 	RTE_FLOW_ITEM_TYPE_UDP,
266 
267 	/**
268 	 * Matches a TCP header.
269 	 *
270 	 * See struct rte_flow_item_tcp.
271 	 */
272 	RTE_FLOW_ITEM_TYPE_TCP,
273 
274 	/**
275 	 * Matches a SCTP header.
276 	 *
277 	 * See struct rte_flow_item_sctp.
278 	 */
279 	RTE_FLOW_ITEM_TYPE_SCTP,
280 
281 	/**
282 	 * Matches a VXLAN header.
283 	 *
284 	 * See struct rte_flow_item_vxlan.
285 	 */
286 	RTE_FLOW_ITEM_TYPE_VXLAN,
287 
288 	/**
289 	 * Matches a E_TAG header.
290 	 *
291 	 * See struct rte_flow_item_e_tag.
292 	 */
293 	RTE_FLOW_ITEM_TYPE_E_TAG,
294 
295 	/**
296 	 * Matches a NVGRE header.
297 	 *
298 	 * See struct rte_flow_item_nvgre.
299 	 */
300 	RTE_FLOW_ITEM_TYPE_NVGRE,
301 
302 	/**
303 	 * Matches a MPLS header.
304 	 *
305 	 * See struct rte_flow_item_mpls.
306 	 */
307 	RTE_FLOW_ITEM_TYPE_MPLS,
308 
309 	/**
310 	 * Matches a GRE header.
311 	 *
312 	 * See struct rte_flow_item_gre.
313 	 */
314 	RTE_FLOW_ITEM_TYPE_GRE,
315 
316 	/**
317 	 * [META]
318 	 *
319 	 * Fuzzy pattern match, expect faster than default.
320 	 *
321 	 * This is for device that support fuzzy matching option.
322 	 * Usually a fuzzy matching is fast but the cost is accuracy.
323 	 *
324 	 * See struct rte_flow_item_fuzzy.
325 	 */
326 	RTE_FLOW_ITEM_TYPE_FUZZY,
327 
328 	/**
329 	 * Matches a GTP header.
330 	 *
331 	 * Configure flow for GTP packets.
332 	 *
333 	 * See struct rte_flow_item_gtp.
334 	 */
335 	RTE_FLOW_ITEM_TYPE_GTP,
336 
337 	/**
338 	 * Matches a GTP header.
339 	 *
340 	 * Configure flow for GTP-C packets.
341 	 *
342 	 * See struct rte_flow_item_gtp.
343 	 */
344 	RTE_FLOW_ITEM_TYPE_GTPC,
345 
346 	/**
347 	 * Matches a GTP header.
348 	 *
349 	 * Configure flow for GTP-U packets.
350 	 *
351 	 * See struct rte_flow_item_gtp.
352 	 */
353 	RTE_FLOW_ITEM_TYPE_GTPU,
354 
355 	/**
356 	 * Matches a ESP header.
357 	 *
358 	 * See struct rte_flow_item_esp.
359 	 */
360 	RTE_FLOW_ITEM_TYPE_ESP,
361 
362 	/**
363 	 * Matches a GENEVE header.
364 	 *
365 	 * See struct rte_flow_item_geneve.
366 	 */
367 	RTE_FLOW_ITEM_TYPE_GENEVE,
368 
369 	/**
370 	 * Matches a VXLAN-GPE header.
371 	 *
372 	 * See struct rte_flow_item_vxlan_gpe.
373 	 */
374 	RTE_FLOW_ITEM_TYPE_VXLAN_GPE,
375 
376 	/**
377 	 * Matches an ARP header for Ethernet/IPv4.
378 	 *
379 	 * See struct rte_flow_item_arp_eth_ipv4.
380 	 */
381 	RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4,
382 
383 	/**
384 	 * Matches the presence of any IPv6 extension header.
385 	 *
386 	 * See struct rte_flow_item_ipv6_ext.
387 	 */
388 	RTE_FLOW_ITEM_TYPE_IPV6_EXT,
389 
390 	/**
391 	 * Matches any ICMPv6 header.
392 	 *
393 	 * See struct rte_flow_item_icmp6.
394 	 */
395 	RTE_FLOW_ITEM_TYPE_ICMP6,
396 
397 	/**
398 	 * Matches an ICMPv6 neighbor discovery solicitation.
399 	 *
400 	 * See struct rte_flow_item_icmp6_nd_ns.
401 	 */
402 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS,
403 
404 	/**
405 	 * Matches an ICMPv6 neighbor discovery advertisement.
406 	 *
407 	 * See struct rte_flow_item_icmp6_nd_na.
408 	 */
409 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA,
410 
411 	/**
412 	 * Matches the presence of any ICMPv6 neighbor discovery option.
413 	 *
414 	 * See struct rte_flow_item_icmp6_nd_opt.
415 	 */
416 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT,
417 
418 	/**
419 	 * Matches an ICMPv6 neighbor discovery source Ethernet link-layer
420 	 * address option.
421 	 *
422 	 * See struct rte_flow_item_icmp6_nd_opt_sla_eth.
423 	 */
424 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH,
425 
426 	/**
427 	 * Matches an ICMPv6 neighbor discovery target Ethernet link-layer
428 	 * address option.
429 	 *
430 	 * See struct rte_flow_item_icmp6_nd_opt_tla_eth.
431 	 */
432 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH,
433 
434 	/**
435 	 * Matches specified mark field.
436 	 *
437 	 * See struct rte_flow_item_mark.
438 	 */
439 	RTE_FLOW_ITEM_TYPE_MARK,
440 
441 	/**
442 	 * [META]
443 	 *
444 	 * Matches a metadata value.
445 	 *
446 	 * See struct rte_flow_item_meta.
447 	 */
448 	RTE_FLOW_ITEM_TYPE_META,
449 
450 	/**
451 	 * Matches a GRE optional key field.
452 	 *
453 	 * The value should a big-endian 32bit integer.
454 	 *
455 	 * When this item present the K bit is implicitly matched as "1"
456 	 * in the default mask.
457 	 *
458 	 * @p spec/mask type:
459 	 * @code rte_be32_t * @endcode
460 	 */
461 	RTE_FLOW_ITEM_TYPE_GRE_KEY,
462 
463 	/**
464 	 * Matches a GTP extension header: PDU session container.
465 	 *
466 	 * Configure flow for GTP packets with extension header type 0x85.
467 	 *
468 	 * See struct rte_flow_item_gtp_psc.
469 	 */
470 	RTE_FLOW_ITEM_TYPE_GTP_PSC,
471 
472 	/**
473 	 * Matches a PPPoE header.
474 	 *
475 	 * Configure flow for PPPoE session packets.
476 	 *
477 	 * See struct rte_flow_item_pppoe.
478 	 */
479 	RTE_FLOW_ITEM_TYPE_PPPOES,
480 
481 	/**
482 	 * Matches a PPPoE header.
483 	 *
484 	 * Configure flow for PPPoE discovery packets.
485 	 *
486 	 * See struct rte_flow_item_pppoe.
487 	 */
488 	RTE_FLOW_ITEM_TYPE_PPPOED,
489 
490 	/**
491 	 * Matches a PPPoE optional proto_id field.
492 	 *
493 	 * It only applies to PPPoE session packets.
494 	 *
495 	 * See struct rte_flow_item_pppoe_proto_id.
496 	 */
497 	RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID,
498 
499 	/**
500 	 * Matches Network service header (NSH).
501 	 * See struct rte_flow_item_nsh.
502 	 *
503 	 */
504 	RTE_FLOW_ITEM_TYPE_NSH,
505 
506 	/**
507 	 * Matches Internet Group Management Protocol (IGMP).
508 	 * See struct rte_flow_item_igmp.
509 	 *
510 	 */
511 	RTE_FLOW_ITEM_TYPE_IGMP,
512 
513 	/**
514 	 * Matches IP Authentication Header (AH).
515 	 * See struct rte_flow_item_ah.
516 	 *
517 	 */
518 	RTE_FLOW_ITEM_TYPE_AH,
519 
520 	/**
521 	 * Matches a HIGIG header.
522 	 * see struct rte_flow_item_higig2_hdr.
523 	 */
524 	RTE_FLOW_ITEM_TYPE_HIGIG2,
525 
526 	/**
527 	 * [META]
528 	 *
529 	 * Matches a tag value.
530 	 *
531 	 * See struct rte_flow_item_tag.
532 	 */
533 	RTE_FLOW_ITEM_TYPE_TAG,
534 
535 	/**
536 	 * Matches a L2TPv3 over IP header.
537 	 *
538 	 * Configure flow for L2TPv3 over IP packets.
539 	 *
540 	 * See struct rte_flow_item_l2tpv3oip.
541 	 */
542 	RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
543 
544 	/**
545 	 * Matches PFCP Header.
546 	 * See struct rte_flow_item_pfcp.
547 	 *
548 	 */
549 	RTE_FLOW_ITEM_TYPE_PFCP,
550 
551 	/**
552 	 * Matches eCPRI Header.
553 	 *
554 	 * Configure flow for eCPRI over ETH or UDP packets.
555 	 *
556 	 * See struct rte_flow_item_ecpri.
557 	 */
558 	RTE_FLOW_ITEM_TYPE_ECPRI,
559 
560 	/**
561 	 * Matches the presence of IPv6 fragment extension header.
562 	 *
563 	 * See struct rte_flow_item_ipv6_frag_ext.
564 	 */
565 	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
566 
567 	/**
568 	 * Matches Geneve Variable Length Option
569 	 *
570 	 * See struct rte_flow_item_geneve_opt
571 	 */
572 	RTE_FLOW_ITEM_TYPE_GENEVE_OPT,
573 
574 	/**
575 	 * [META]
576 	 *
577 	 * Matches on packet integrity.
578 	 * For some devices application needs to enable integration checks in HW
579 	 * before using this item.
580 	 *
581 	 * @see struct rte_flow_item_integrity.
582 	 */
583 	RTE_FLOW_ITEM_TYPE_INTEGRITY,
584 
585 	/**
586 	 * [META]
587 	 *
588 	 * Matches conntrack state.
589 	 *
590 	 * @see struct rte_flow_item_conntrack.
591 	 */
592 	RTE_FLOW_ITEM_TYPE_CONNTRACK,
593 
594 	/**
595 	 * [META]
596 	 *
597 	 * Matches traffic entering the embedded switch from the given ethdev.
598 	 *
599 	 * @see struct rte_flow_item_ethdev
600 	 */
601 	RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
602 
603 	/**
604 	 * [META]
605 	 *
606 	 * Matches traffic entering the embedded switch from
607 	 * the entity represented by the given ethdev.
608 	 *
609 	 * @see struct rte_flow_item_ethdev
610 	 */
611 	RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT,
612 };
613 
614 /**
615  *
616  * RTE_FLOW_ITEM_TYPE_HIGIG2
617  * Matches higig2 header
618  */
619 RTE_STD_C11
620 struct rte_flow_item_higig2_hdr {
621 	struct rte_higig2_hdr hdr;
622 };
623 
624 /** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
625 #ifndef __cplusplus
626 static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
627 	.hdr = {
628 		.ppt1 = {
629 			.classification = 0xffff,
630 			.vid = 0xfff,
631 		},
632 	},
633 };
634 #endif
635 
636 /**
637  * RTE_FLOW_ITEM_TYPE_ANY
638  *
639  * Matches any protocol in place of the current layer, a single ANY may also
640  * stand for several protocol layers.
641  *
642  * This is usually specified as the first pattern item when looking for a
643  * protocol anywhere in a packet.
644  *
645  * A zeroed mask stands for any number of layers.
646  */
647 struct rte_flow_item_any {
648 	uint32_t num; /**< Number of layers covered. */
649 };
650 
651 /** Default mask for RTE_FLOW_ITEM_TYPE_ANY. */
652 #ifndef __cplusplus
653 static const struct rte_flow_item_any rte_flow_item_any_mask = {
654 	.num = 0x00000000,
655 };
656 #endif
657 
658 /**
659  * @deprecated
660  * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
661  * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
662  *
663  * RTE_FLOW_ITEM_TYPE_VF
664  *
665  * Matches traffic originating from (ingress) or going to (egress) a given
666  * virtual function of the current device.
667  *
668  * If supported, should work even if the virtual function is not managed by
669  * the application and thus not associated with a DPDK port ID.
670  *
671  * Note this pattern item does not match VF representors traffic which, as
672  * separate entities, should be addressed through their own DPDK port IDs.
673  *
674  * - Can be specified multiple times to match traffic addressed to several
675  *   VF IDs.
676  * - Can be combined with a PF item to match both PF and VF traffic.
677  *
678  * A zeroed mask can be used to match any VF ID.
679  */
680 struct rte_flow_item_vf {
681 	uint32_t id; /**< VF ID. */
682 };
683 
684 /** Default mask for RTE_FLOW_ITEM_TYPE_VF. */
685 #ifndef __cplusplus
686 static const struct rte_flow_item_vf rte_flow_item_vf_mask = {
687 	.id = 0x00000000,
688 };
689 #endif
690 
691 /**
692  * @deprecated
693  * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
694  * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
695  *
696  * RTE_FLOW_ITEM_TYPE_PHY_PORT
697  *
698  * Matches traffic originating from (ingress) or going to (egress) a
699  * physical port of the underlying device.
700  *
701  * The first PHY_PORT item overrides the physical port normally associated
702  * with the specified DPDK input port (port_id). This item can be provided
703  * several times to match additional physical ports.
704  *
705  * Note that physical ports are not necessarily tied to DPDK input ports
706  * (port_id) when those are not under DPDK control. Possible values are
707  * specific to each device, they are not necessarily indexed from zero and
708  * may not be contiguous.
709  *
710  * As a device property, the list of allowed values as well as the value
711  * associated with a port_id should be retrieved by other means.
712  *
713  * A zeroed mask can be used to match any port index.
714  */
715 struct rte_flow_item_phy_port {
716 	uint32_t index; /**< Physical port index. */
717 };
718 
719 /** Default mask for RTE_FLOW_ITEM_TYPE_PHY_PORT. */
720 #ifndef __cplusplus
721 static const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask = {
722 	.index = 0x00000000,
723 };
724 #endif
725 
726 /**
727  * @deprecated
728  * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
729  * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
730  *
731  * RTE_FLOW_ITEM_TYPE_PORT_ID
732  *
733  * Matches traffic originating from (ingress) or going to (egress) a given
734  * DPDK port ID.
735  *
736  * Normally only supported if the port ID in question is known by the
737  * underlying PMD and related to the device the flow rule is created
738  * against.
739  *
740  * This must not be confused with @p PHY_PORT which refers to the physical
741  * port of a device, whereas @p PORT_ID refers to a struct rte_eth_dev
742  * object on the application side (also known as "port representor"
743  * depending on the kind of underlying device).
744  */
745 struct rte_flow_item_port_id {
746 	uint32_t id; /**< DPDK port ID. */
747 };
748 
749 /** Default mask for RTE_FLOW_ITEM_TYPE_PORT_ID. */
750 #ifndef __cplusplus
751 static const struct rte_flow_item_port_id rte_flow_item_port_id_mask = {
752 	.id = 0xffffffff,
753 };
754 #endif
755 
756 /**
757  * RTE_FLOW_ITEM_TYPE_RAW
758  *
759  * Matches a byte string of a given length at a given offset.
760  *
761  * Offset is either absolute (using the start of the packet) or relative to
762  * the end of the previous matched item in the stack, in which case negative
763  * values are allowed.
764  *
765  * If search is enabled, offset is used as the starting point. The search
766  * area can be delimited by setting limit to a nonzero value, which is the
767  * maximum number of bytes after offset where the pattern may start.
768  *
769  * Matching a zero-length pattern is allowed, doing so resets the relative
770  * offset for subsequent items.
771  *
772  * This type does not support ranges (struct rte_flow_item.last).
773  */
774 struct rte_flow_item_raw {
775 	uint32_t relative:1; /**< Look for pattern after the previous item. */
776 	uint32_t search:1; /**< Search pattern from offset (see also limit). */
777 	uint32_t reserved:30; /**< Reserved, must be set to zero. */
778 	int32_t offset; /**< Absolute or relative offset for pattern. */
779 	uint16_t limit; /**< Search area limit for start of pattern. */
780 	uint16_t length; /**< Pattern length. */
781 	const uint8_t *pattern; /**< Byte string to look for. */
782 };
783 
784 /** Default mask for RTE_FLOW_ITEM_TYPE_RAW. */
785 #ifndef __cplusplus
786 static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
787 	.relative = 1,
788 	.search = 1,
789 	.reserved = 0x3fffffff,
790 	.offset = 0xffffffff,
791 	.limit = 0xffff,
792 	.length = 0xffff,
793 	.pattern = NULL,
794 };
795 #endif
796 
797 /**
798  * RTE_FLOW_ITEM_TYPE_ETH
799  *
800  * Matches an Ethernet header.
801  *
802  * Inside @p hdr field, the sub-field @p ether_type stands either for EtherType
803  * or TPID, depending on whether the item is followed by a VLAN item or not. If
804  * two VLAN items follow, the sub-field refers to the outer one, which, in turn,
805  * contains the inner TPID in the similar header field. The innermost VLAN item
806  * contains a layer-3 EtherType. All of that follows the order seen on the wire.
807  *
808  * If the field in question contains a TPID value, only tagged packets with the
809  * specified TPID will match the pattern. Alternatively, it's possible to match
810  * any type of tagged packets by means of the field @p has_vlan rather than use
811  * the EtherType/TPID field. Also, it's possible to leave the two fields unused.
812  * If this is the case, both tagged and untagged packets will match the pattern.
813  */
814 RTE_STD_C11
815 struct rte_flow_item_eth {
816 	union {
817 		struct {
818 			/*
819 			 * These fields are retained for compatibility.
820 			 * Please switch to the new header field below.
821 			 */
822 			struct rte_ether_addr dst; /**< Destination MAC. */
823 			struct rte_ether_addr src; /**< Source MAC. */
824 			rte_be16_t type; /**< EtherType or TPID. */
825 		};
826 		struct rte_ether_hdr hdr;
827 	};
828 	uint32_t has_vlan:1; /**< Packet header contains at least one VLAN. */
829 	uint32_t reserved:31; /**< Reserved, must be zero. */
830 };
831 
832 /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */
833 #ifndef __cplusplus
834 static const struct rte_flow_item_eth rte_flow_item_eth_mask = {
835 	.hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
836 	.hdr.src_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
837 	.hdr.ether_type = RTE_BE16(0x0000),
838 };
839 #endif
840 
841 /**
842  * RTE_FLOW_ITEM_TYPE_VLAN
843  *
844  * Matches an 802.1Q/ad VLAN tag.
845  *
846  * The corresponding standard outer EtherType (TPID) values are
847  * RTE_ETHER_TYPE_VLAN or RTE_ETHER_TYPE_QINQ. It can be overridden by
848  * the preceding pattern item.
849  * If a @p VLAN item is present in the pattern, then only tagged packets will
850  * match the pattern.
851  * The field @p has_more_vlan can be used to match any type of tagged packets,
852  * instead of using the @p eth_proto field of @p hdr.
853  * If the @p eth_proto of @p hdr and @p has_more_vlan fields are not specified,
854  * then any tagged packets will match the pattern.
855  */
856 RTE_STD_C11
857 struct rte_flow_item_vlan {
858 	union {
859 		struct {
860 			/*
861 			 * These fields are retained for compatibility.
862 			 * Please switch to the new header field below.
863 			 */
864 			rte_be16_t tci; /**< Tag control information. */
865 			rte_be16_t inner_type; /**< Inner EtherType or TPID. */
866 		};
867 		struct rte_vlan_hdr hdr;
868 	};
869 	uint32_t has_more_vlan:1;
870 	/**< Packet header contains at least one more VLAN, after this VLAN. */
871 	uint32_t reserved:31; /**< Reserved, must be zero. */
872 };
873 
874 /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */
875 #ifndef __cplusplus
876 static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = {
877 	.hdr.vlan_tci = RTE_BE16(0x0fff),
878 	.hdr.eth_proto = RTE_BE16(0x0000),
879 };
880 #endif
881 
882 /**
883  * RTE_FLOW_ITEM_TYPE_IPV4
884  *
885  * Matches an IPv4 header.
886  *
887  * Note: IPv4 options are handled by dedicated pattern items.
888  */
889 struct rte_flow_item_ipv4 {
890 	struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */
891 };
892 
893 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */
894 #ifndef __cplusplus
895 static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = {
896 	.hdr = {
897 		.src_addr = RTE_BE32(0xffffffff),
898 		.dst_addr = RTE_BE32(0xffffffff),
899 	},
900 };
901 #endif
902 
903 /**
904  * RTE_FLOW_ITEM_TYPE_IPV6.
905  *
906  * Matches an IPv6 header.
907  *
908  * Dedicated flags indicate if header contains specific extension headers.
909  */
910 struct rte_flow_item_ipv6 {
911 	struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
912 	uint32_t has_hop_ext:1;
913 	/**< Header contains Hop-by-Hop Options extension header. */
914 	uint32_t has_route_ext:1;
915 	/**< Header contains Routing extension header. */
916 	uint32_t has_frag_ext:1;
917 	/**< Header contains Fragment extension header. */
918 	uint32_t has_auth_ext:1;
919 	/**< Header contains Authentication extension header. */
920 	uint32_t has_esp_ext:1;
921 	/**< Header contains Encapsulation Security Payload extension header. */
922 	uint32_t has_dest_ext:1;
923 	/**< Header contains Destination Options extension header. */
924 	uint32_t has_mobil_ext:1;
925 	/**< Header contains Mobility extension header. */
926 	uint32_t has_hip_ext:1;
927 	/**< Header contains Host Identity Protocol extension header. */
928 	uint32_t has_shim6_ext:1;
929 	/**< Header contains Shim6 Protocol extension header. */
930 	uint32_t reserved:23;
931 	/**< Reserved for future extension headers, must be zero. */
932 };
933 
934 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
935 #ifndef __cplusplus
936 static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
937 	.hdr = {
938 		.src_addr =
939 			"\xff\xff\xff\xff\xff\xff\xff\xff"
940 			"\xff\xff\xff\xff\xff\xff\xff\xff",
941 		.dst_addr =
942 			"\xff\xff\xff\xff\xff\xff\xff\xff"
943 			"\xff\xff\xff\xff\xff\xff\xff\xff",
944 	},
945 };
946 #endif
947 
948 /**
949  * RTE_FLOW_ITEM_TYPE_ICMP.
950  *
951  * Matches an ICMP header.
952  */
953 struct rte_flow_item_icmp {
954 	struct rte_icmp_hdr hdr; /**< ICMP header definition. */
955 };
956 
957 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */
958 #ifndef __cplusplus
959 static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = {
960 	.hdr = {
961 		.icmp_type = 0xff,
962 		.icmp_code = 0xff,
963 	},
964 };
965 #endif
966 
967 /**
968  * RTE_FLOW_ITEM_TYPE_UDP.
969  *
970  * Matches a UDP header.
971  */
972 struct rte_flow_item_udp {
973 	struct rte_udp_hdr hdr; /**< UDP header definition. */
974 };
975 
976 /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */
977 #ifndef __cplusplus
978 static const struct rte_flow_item_udp rte_flow_item_udp_mask = {
979 	.hdr = {
980 		.src_port = RTE_BE16(0xffff),
981 		.dst_port = RTE_BE16(0xffff),
982 	},
983 };
984 #endif
985 
986 /**
987  * RTE_FLOW_ITEM_TYPE_TCP.
988  *
989  * Matches a TCP header.
990  */
991 struct rte_flow_item_tcp {
992 	struct rte_tcp_hdr hdr; /**< TCP header definition. */
993 };
994 
995 /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */
996 #ifndef __cplusplus
997 static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = {
998 	.hdr = {
999 		.src_port = RTE_BE16(0xffff),
1000 		.dst_port = RTE_BE16(0xffff),
1001 	},
1002 };
1003 #endif
1004 
1005 /**
1006  * RTE_FLOW_ITEM_TYPE_SCTP.
1007  *
1008  * Matches a SCTP header.
1009  */
1010 struct rte_flow_item_sctp {
1011 	struct rte_sctp_hdr hdr; /**< SCTP header definition. */
1012 };
1013 
1014 /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */
1015 #ifndef __cplusplus
1016 static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = {
1017 	.hdr = {
1018 		.src_port = RTE_BE16(0xffff),
1019 		.dst_port = RTE_BE16(0xffff),
1020 	},
1021 };
1022 #endif
1023 
1024 /**
1025  * RTE_FLOW_ITEM_TYPE_VXLAN.
1026  *
1027  * Matches a VXLAN header (RFC 7348).
1028  */
1029 RTE_STD_C11
1030 struct rte_flow_item_vxlan {
1031 	union {
1032 		struct {
1033 			/*
1034 			 * These fields are retained for compatibility.
1035 			 * Please switch to the new header field below.
1036 			 */
1037 			uint8_t flags; /**< Normally 0x08 (I flag). */
1038 			uint8_t rsvd0[3]; /**< Reserved, normally 0x000000. */
1039 			uint8_t vni[3]; /**< VXLAN identifier. */
1040 			uint8_t rsvd1; /**< Reserved, normally 0x00. */
1041 		};
1042 		struct rte_vxlan_hdr hdr;
1043 	};
1044 };
1045 
1046 /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */
1047 #ifndef __cplusplus
1048 static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
1049 	.hdr.vx_vni = RTE_BE32(0xffffff00), /* (0xffffff << 8) */
1050 };
1051 #endif
1052 
1053 /**
1054  * RTE_FLOW_ITEM_TYPE_E_TAG.
1055  *
1056  * Matches a E-tag header.
1057  *
1058  * The corresponding standard outer EtherType (TPID) value is
1059  * RTE_ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item.
1060  */
1061 struct rte_flow_item_e_tag {
1062 	/**
1063 	 * E-Tag control information (E-TCI).
1064 	 * E-PCP (3b), E-DEI (1b), ingress E-CID base (12b).
1065 	 */
1066 	rte_be16_t epcp_edei_in_ecid_b;
1067 	/** Reserved (2b), GRP (2b), E-CID base (12b). */
1068 	rte_be16_t rsvd_grp_ecid_b;
1069 	uint8_t in_ecid_e; /**< Ingress E-CID ext. */
1070 	uint8_t ecid_e; /**< E-CID ext. */
1071 	rte_be16_t inner_type; /**< Inner EtherType or TPID. */
1072 };
1073 
1074 /** Default mask for RTE_FLOW_ITEM_TYPE_E_TAG. */
1075 #ifndef __cplusplus
1076 static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask = {
1077 	.rsvd_grp_ecid_b = RTE_BE16(0x3fff),
1078 };
1079 #endif
1080 
1081 /**
1082  * RTE_FLOW_ITEM_TYPE_NVGRE.
1083  *
1084  * Matches a NVGRE header.
1085  */
1086 struct rte_flow_item_nvgre {
1087 	/**
1088 	 * Checksum (1b), undefined (1b), key bit (1b), sequence number (1b),
1089 	 * reserved 0 (9b), version (3b).
1090 	 *
1091 	 * c_k_s_rsvd0_ver must have value 0x2000 according to RFC 7637.
1092 	 */
1093 	rte_be16_t c_k_s_rsvd0_ver;
1094 	rte_be16_t protocol; /**< Protocol type (0x6558). */
1095 	uint8_t tni[3]; /**< Virtual subnet ID. */
1096 	uint8_t flow_id; /**< Flow ID. */
1097 };
1098 
1099 /** Default mask for RTE_FLOW_ITEM_TYPE_NVGRE. */
1100 #ifndef __cplusplus
1101 static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask = {
1102 	.tni = "\xff\xff\xff",
1103 };
1104 #endif
1105 
1106 /**
1107  * RTE_FLOW_ITEM_TYPE_MPLS.
1108  *
1109  * Matches a MPLS header.
1110  */
1111 struct rte_flow_item_mpls {
1112 	/**
1113 	 * Label (20b), TC (3b), Bottom of Stack (1b).
1114 	 */
1115 	uint8_t label_tc_s[3];
1116 	uint8_t ttl; /** Time-to-Live. */
1117 };
1118 
1119 /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */
1120 #ifndef __cplusplus
1121 static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
1122 	.label_tc_s = "\xff\xff\xf0",
1123 };
1124 #endif
1125 
1126 /**
1127  * RTE_FLOW_ITEM_TYPE_GRE.
1128  *
1129  * Matches a GRE header.
1130  */
1131 struct rte_flow_item_gre {
1132 	/**
1133 	 * Checksum (1b), reserved 0 (12b), version (3b).
1134 	 * Refer to RFC 2784.
1135 	 */
1136 	rte_be16_t c_rsvd0_ver;
1137 	rte_be16_t protocol; /**< Protocol type. */
1138 };
1139 
1140 /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
1141 #ifndef __cplusplus
1142 static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
1143 	.protocol = RTE_BE16(0xffff),
1144 };
1145 #endif
1146 
1147 /**
1148  * RTE_FLOW_ITEM_TYPE_FUZZY
1149  *
1150  * Fuzzy pattern match, expect faster than default.
1151  *
1152  * This is for device that support fuzzy match option.
1153  * Usually a fuzzy match is fast but the cost is accuracy.
1154  * i.e. Signature Match only match pattern's hash value, but it is
1155  * possible two different patterns have the same hash value.
1156  *
1157  * Matching accuracy level can be configure by threshold.
1158  * Driver can divide the range of threshold and map to different
1159  * accuracy levels that device support.
1160  *
1161  * Threshold 0 means perfect match (no fuzziness), while threshold
1162  * 0xffffffff means fuzziest match.
1163  */
1164 struct rte_flow_item_fuzzy {
1165 	uint32_t thresh; /**< Accuracy threshold. */
1166 };
1167 
1168 /** Default mask for RTE_FLOW_ITEM_TYPE_FUZZY. */
1169 #ifndef __cplusplus
1170 static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask = {
1171 	.thresh = 0xffffffff,
1172 };
1173 #endif
1174 
1175 /**
1176  * RTE_FLOW_ITEM_TYPE_GTP.
1177  *
1178  * Matches a GTPv1 header.
1179  */
1180 struct rte_flow_item_gtp {
1181 	/**
1182 	 * Version (3b), protocol type (1b), reserved (1b),
1183 	 * Extension header flag (1b),
1184 	 * Sequence number flag (1b),
1185 	 * N-PDU number flag (1b).
1186 	 */
1187 	uint8_t v_pt_rsv_flags;
1188 	uint8_t msg_type; /**< Message type. */
1189 	rte_be16_t msg_len; /**< Message length. */
1190 	rte_be32_t teid; /**< Tunnel endpoint identifier. */
1191 };
1192 
1193 /** Default mask for RTE_FLOW_ITEM_TYPE_GTP. */
1194 #ifndef __cplusplus
1195 static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = {
1196 	.teid = RTE_BE32(0xffffffff),
1197 };
1198 #endif
1199 
1200 /**
1201  * RTE_FLOW_ITEM_TYPE_ESP
1202  *
1203  * Matches an ESP header.
1204  */
1205 struct rte_flow_item_esp {
1206 	struct rte_esp_hdr hdr; /**< ESP header definition. */
1207 };
1208 
1209 /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */
1210 #ifndef __cplusplus
1211 static const struct rte_flow_item_esp rte_flow_item_esp_mask = {
1212 	.hdr = {
1213 		.spi = RTE_BE32(0xffffffff),
1214 	},
1215 };
1216 #endif
1217 
1218 /**
1219  * RTE_FLOW_ITEM_TYPE_GENEVE.
1220  *
1221  * Matches a GENEVE header.
1222  */
1223 struct rte_flow_item_geneve {
1224 	/**
1225 	 * Version (2b), length of the options fields (6b), OAM packet (1b),
1226 	 * critical options present (1b), reserved 0 (6b).
1227 	 */
1228 	rte_be16_t ver_opt_len_o_c_rsvd0;
1229 	rte_be16_t protocol; /**< Protocol type. */
1230 	uint8_t vni[3]; /**< Virtual Network Identifier. */
1231 	uint8_t rsvd1; /**< Reserved, normally 0x00. */
1232 };
1233 
1234 /** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE. */
1235 #ifndef __cplusplus
1236 static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = {
1237 	.vni = "\xff\xff\xff",
1238 };
1239 #endif
1240 
1241 /**
1242  * RTE_FLOW_ITEM_TYPE_VXLAN_GPE (draft-ietf-nvo3-vxlan-gpe-05).
1243  *
1244  * Matches a VXLAN-GPE header.
1245  */
1246 struct rte_flow_item_vxlan_gpe {
1247 	uint8_t flags; /**< Normally 0x0c (I and P flags). */
1248 	uint8_t rsvd0[2]; /**< Reserved, normally 0x0000. */
1249 	uint8_t protocol; /**< Protocol type. */
1250 	uint8_t vni[3]; /**< VXLAN identifier. */
1251 	uint8_t rsvd1; /**< Reserved, normally 0x00. */
1252 };
1253 
1254 /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */
1255 #ifndef __cplusplus
1256 static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = {
1257 	.vni = "\xff\xff\xff",
1258 };
1259 #endif
1260 
1261 /**
1262  * RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4
1263  *
1264  * Matches an ARP header for Ethernet/IPv4.
1265  */
1266 struct rte_flow_item_arp_eth_ipv4 {
1267 	rte_be16_t hrd; /**< Hardware type, normally 1. */
1268 	rte_be16_t pro; /**< Protocol type, normally 0x0800. */
1269 	uint8_t hln; /**< Hardware address length, normally 6. */
1270 	uint8_t pln; /**< Protocol address length, normally 4. */
1271 	rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */
1272 	struct rte_ether_addr sha; /**< Sender hardware address. */
1273 	rte_be32_t spa; /**< Sender IPv4 address. */
1274 	struct rte_ether_addr tha; /**< Target hardware address. */
1275 	rte_be32_t tpa; /**< Target IPv4 address. */
1276 };
1277 
1278 /** Default mask for RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4. */
1279 #ifndef __cplusplus
1280 static const struct rte_flow_item_arp_eth_ipv4
1281 rte_flow_item_arp_eth_ipv4_mask = {
1282 	.sha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1283 	.spa = RTE_BE32(0xffffffff),
1284 	.tha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1285 	.tpa = RTE_BE32(0xffffffff),
1286 };
1287 #endif
1288 
1289 /**
1290  * RTE_FLOW_ITEM_TYPE_IPV6_EXT
1291  *
1292  * Matches the presence of any IPv6 extension header.
1293  *
1294  * Normally preceded by any of:
1295  *
1296  * - RTE_FLOW_ITEM_TYPE_IPV6
1297  * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
1298  */
1299 struct rte_flow_item_ipv6_ext {
1300 	uint8_t next_hdr; /**< Next header. */
1301 };
1302 
1303 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6_EXT. */
1304 #ifndef __cplusplus
1305 static const
1306 struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
1307 	.next_hdr = 0xff,
1308 };
1309 #endif
1310 
1311 /**
1312  * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
1313  *
1314  * Matches the presence of IPv6 fragment extension header.
1315  *
1316  * Preceded by any of:
1317  *
1318  * - RTE_FLOW_ITEM_TYPE_IPV6
1319  * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
1320  */
1321 struct rte_flow_item_ipv6_frag_ext {
1322 	struct rte_ipv6_fragment_ext hdr;
1323 };
1324 
1325 /**
1326  * RTE_FLOW_ITEM_TYPE_ICMP6
1327  *
1328  * Matches any ICMPv6 header.
1329  */
1330 struct rte_flow_item_icmp6 {
1331 	uint8_t type; /**< ICMPv6 type. */
1332 	uint8_t code; /**< ICMPv6 code. */
1333 	uint16_t checksum; /**< ICMPv6 checksum. */
1334 };
1335 
1336 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6. */
1337 #ifndef __cplusplus
1338 static const struct rte_flow_item_icmp6 rte_flow_item_icmp6_mask = {
1339 	.type = 0xff,
1340 	.code = 0xff,
1341 };
1342 #endif
1343 
1344 /**
1345  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1346  *
1347  * Matches an ICMPv6 neighbor discovery solicitation.
1348  */
1349 struct rte_flow_item_icmp6_nd_ns {
1350 	uint8_t type; /**< ICMPv6 type, normally 135. */
1351 	uint8_t code; /**< ICMPv6 code, normally 0. */
1352 	rte_be16_t checksum; /**< ICMPv6 checksum. */
1353 	rte_be32_t reserved; /**< Reserved, normally 0. */
1354 	uint8_t target_addr[16]; /**< Target address. */
1355 };
1356 
1357 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS. */
1358 #ifndef __cplusplus
1359 static const
1360 struct rte_flow_item_icmp6_nd_ns rte_flow_item_icmp6_nd_ns_mask = {
1361 	.target_addr =
1362 		"\xff\xff\xff\xff\xff\xff\xff\xff"
1363 		"\xff\xff\xff\xff\xff\xff\xff\xff",
1364 };
1365 #endif
1366 
1367 /**
1368  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1369  *
1370  * Matches an ICMPv6 neighbor discovery advertisement.
1371  */
1372 struct rte_flow_item_icmp6_nd_na {
1373 	uint8_t type; /**< ICMPv6 type, normally 136. */
1374 	uint8_t code; /**< ICMPv6 code, normally 0. */
1375 	rte_be16_t checksum; /**< ICMPv6 checksum. */
1376 	/**
1377 	 * Route flag (1b), solicited flag (1b), override flag (1b),
1378 	 * reserved (29b).
1379 	 */
1380 	rte_be32_t rso_reserved;
1381 	uint8_t target_addr[16]; /**< Target address. */
1382 };
1383 
1384 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA. */
1385 #ifndef __cplusplus
1386 static const
1387 struct rte_flow_item_icmp6_nd_na rte_flow_item_icmp6_nd_na_mask = {
1388 	.target_addr =
1389 		"\xff\xff\xff\xff\xff\xff\xff\xff"
1390 		"\xff\xff\xff\xff\xff\xff\xff\xff",
1391 };
1392 #endif
1393 
1394 /**
1395  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1396  *
1397  * Matches the presence of any ICMPv6 neighbor discovery option.
1398  *
1399  * Normally preceded by any of:
1400  *
1401  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1402  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1403  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1404  */
1405 struct rte_flow_item_icmp6_nd_opt {
1406 	uint8_t type; /**< ND option type. */
1407 	uint8_t length; /**< ND option length. */
1408 };
1409 
1410 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT. */
1411 #ifndef __cplusplus
1412 static const struct rte_flow_item_icmp6_nd_opt
1413 rte_flow_item_icmp6_nd_opt_mask = {
1414 	.type = 0xff,
1415 };
1416 #endif
1417 
1418 /**
1419  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH
1420  *
1421  * Matches an ICMPv6 neighbor discovery source Ethernet link-layer address
1422  * option.
1423  *
1424  * Normally preceded by any of:
1425  *
1426  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1427  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1428  */
1429 struct rte_flow_item_icmp6_nd_opt_sla_eth {
1430 	uint8_t type; /**< ND option type, normally 1. */
1431 	uint8_t length; /**< ND option length, normally 1. */
1432 	struct rte_ether_addr sla; /**< Source Ethernet LLA. */
1433 };
1434 
1435 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */
1436 #ifndef __cplusplus
1437 static const struct rte_flow_item_icmp6_nd_opt_sla_eth
1438 rte_flow_item_icmp6_nd_opt_sla_eth_mask = {
1439 	.sla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1440 };
1441 #endif
1442 
1443 /**
1444  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH
1445  *
1446  * Matches an ICMPv6 neighbor discovery target Ethernet link-layer address
1447  * option.
1448  *
1449  * Normally preceded by any of:
1450  *
1451  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1452  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1453  */
1454 struct rte_flow_item_icmp6_nd_opt_tla_eth {
1455 	uint8_t type; /**< ND option type, normally 2. */
1456 	uint8_t length; /**< ND option length, normally 1. */
1457 	struct rte_ether_addr tla; /**< Target Ethernet LLA. */
1458 };
1459 
1460 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */
1461 #ifndef __cplusplus
1462 static const struct rte_flow_item_icmp6_nd_opt_tla_eth
1463 rte_flow_item_icmp6_nd_opt_tla_eth_mask = {
1464 	.tla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1465 };
1466 #endif
1467 
1468 /**
1469  * RTE_FLOW_ITEM_TYPE_META
1470  *
1471  * Matches a specified metadata value. On egress, metadata can be set
1472  * either by mbuf dynamic metadata field with PKT_TX_DYNF_METADATA flag or
1473  * RTE_FLOW_ACTION_TYPE_SET_META. On ingress, RTE_FLOW_ACTION_TYPE_SET_META
1474  * sets metadata for a packet and the metadata will be reported via mbuf
1475  * metadata dynamic field with PKT_RX_DYNF_METADATA flag. The dynamic mbuf
1476  * field must be registered in advance by rte_flow_dynf_metadata_register().
1477  */
1478 struct rte_flow_item_meta {
1479 	uint32_t data;
1480 };
1481 
1482 /** Default mask for RTE_FLOW_ITEM_TYPE_META. */
1483 #ifndef __cplusplus
1484 static const struct rte_flow_item_meta rte_flow_item_meta_mask = {
1485 	.data = UINT32_MAX,
1486 };
1487 #endif
1488 
1489 /**
1490  * RTE_FLOW_ITEM_TYPE_GTP_PSC.
1491  *
1492  * Matches a GTP PDU extension header with type 0x85.
1493  */
1494 struct rte_flow_item_gtp_psc {
1495 	struct rte_gtp_psc_generic_hdr hdr; /**< gtp psc generic hdr. */
1496 };
1497 
1498 /** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */
1499 #ifndef __cplusplus
1500 static const struct rte_flow_item_gtp_psc
1501 rte_flow_item_gtp_psc_mask = {
1502 	.hdr.qfi = 0x3f,
1503 };
1504 #endif
1505 
1506 /**
1507  * RTE_FLOW_ITEM_TYPE_PPPOE.
1508  *
1509  * Matches a PPPoE header.
1510  */
1511 struct rte_flow_item_pppoe {
1512 	/**
1513 	 * Version (4b), type (4b).
1514 	 */
1515 	uint8_t version_type;
1516 	uint8_t code; /**< Message type. */
1517 	rte_be16_t session_id; /**< Session identifier. */
1518 	rte_be16_t length; /**< Payload length. */
1519 };
1520 
1521 /**
1522  * RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID.
1523  *
1524  * Matches a PPPoE optional proto_id field.
1525  *
1526  * It only applies to PPPoE session packets.
1527  *
1528  * Normally preceded by any of:
1529  *
1530  * - RTE_FLOW_ITEM_TYPE_PPPOE
1531  * - RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID
1532  */
1533 struct rte_flow_item_pppoe_proto_id {
1534 	rte_be16_t proto_id; /**< PPP protocol identifier. */
1535 };
1536 
1537 /** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID. */
1538 #ifndef __cplusplus
1539 static const struct rte_flow_item_pppoe_proto_id
1540 rte_flow_item_pppoe_proto_id_mask = {
1541 	.proto_id = RTE_BE16(0xffff),
1542 };
1543 #endif
1544 
1545 /**
1546  * @warning
1547  * @b EXPERIMENTAL: this structure may change without prior notice
1548  *
1549  * RTE_FLOW_ITEM_TYPE_TAG
1550  *
1551  * Matches a specified tag value at the specified index.
1552  */
1553 struct rte_flow_item_tag {
1554 	uint32_t data;
1555 	uint8_t index;
1556 };
1557 
1558 /** Default mask for RTE_FLOW_ITEM_TYPE_TAG. */
1559 #ifndef __cplusplus
1560 static const struct rte_flow_item_tag rte_flow_item_tag_mask = {
1561 	.data = 0xffffffff,
1562 	.index = 0xff,
1563 };
1564 #endif
1565 
1566 /**
1567  * RTE_FLOW_ITEM_TYPE_L2TPV3OIP.
1568  *
1569  * Matches a L2TPv3 over IP header.
1570  */
1571 struct rte_flow_item_l2tpv3oip {
1572 	rte_be32_t session_id; /**< Session ID. */
1573 };
1574 
1575 /** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV3OIP. */
1576 #ifndef __cplusplus
1577 static const struct rte_flow_item_l2tpv3oip rte_flow_item_l2tpv3oip_mask = {
1578 	.session_id = RTE_BE32(UINT32_MAX),
1579 };
1580 #endif
1581 
1582 
1583 /**
1584  * @warning
1585  * @b EXPERIMENTAL: this structure may change without prior notice
1586  *
1587  * RTE_FLOW_ITEM_TYPE_MARK
1588  *
1589  * Matches an arbitrary integer value which was set using the ``MARK`` action
1590  * in a previously matched rule.
1591  *
1592  * This item can only be specified once as a match criteria as the ``MARK``
1593  * action can only be specified once in a flow action.
1594  *
1595  * This value is arbitrary and application-defined. Maximum allowed value
1596  * depends on the underlying implementation.
1597  *
1598  * Depending on the underlying implementation the MARK item may be supported on
1599  * the physical device, with virtual groups in the PMD or not at all.
1600  */
1601 struct rte_flow_item_mark {
1602 	uint32_t id; /**< Integer value to match against. */
1603 };
1604 
1605 /** Default mask for RTE_FLOW_ITEM_TYPE_MARK. */
1606 #ifndef __cplusplus
1607 static const struct rte_flow_item_mark rte_flow_item_mark_mask = {
1608 	.id = 0xffffffff,
1609 };
1610 #endif
1611 
1612 /**
1613  * @warning
1614  * @b EXPERIMENTAL: this structure may change without prior notice
1615  *
1616  * RTE_FLOW_ITEM_TYPE_NSH
1617  *
1618  * Match network service header (NSH), RFC 8300
1619  *
1620  */
1621 struct rte_flow_item_nsh {
1622 	uint32_t version:2;
1623 	uint32_t oam_pkt:1;
1624 	uint32_t reserved:1;
1625 	uint32_t ttl:6;
1626 	uint32_t length:6;
1627 	uint32_t reserved1:4;
1628 	uint32_t mdtype:4;
1629 	uint32_t next_proto:8;
1630 	uint32_t spi:24;
1631 	uint32_t sindex:8;
1632 };
1633 
1634 /** Default mask for RTE_FLOW_ITEM_TYPE_NSH. */
1635 #ifndef __cplusplus
1636 static const struct rte_flow_item_nsh rte_flow_item_nsh_mask = {
1637 	.mdtype = 0xf,
1638 	.next_proto = 0xff,
1639 	.spi = 0xffffff,
1640 	.sindex = 0xff,
1641 };
1642 #endif
1643 
1644 /**
1645  * @warning
1646  * @b EXPERIMENTAL: this structure may change without prior notice
1647  *
1648  * RTE_FLOW_ITEM_TYPE_IGMP
1649  *
1650  * Match Internet Group Management Protocol (IGMP), RFC 2236
1651  *
1652  */
1653 struct rte_flow_item_igmp {
1654 	uint32_t type:8;
1655 	uint32_t max_resp_time:8;
1656 	uint32_t checksum:16;
1657 	uint32_t group_addr;
1658 };
1659 
1660 /** Default mask for RTE_FLOW_ITEM_TYPE_IGMP. */
1661 #ifndef __cplusplus
1662 static const struct rte_flow_item_igmp rte_flow_item_igmp_mask = {
1663 	.group_addr = 0xffffffff,
1664 };
1665 #endif
1666 
1667 /**
1668  * @warning
1669  * @b EXPERIMENTAL: this structure may change without prior notice
1670  *
1671  * RTE_FLOW_ITEM_TYPE_AH
1672  *
1673  * Match IP Authentication Header (AH), RFC 4302
1674  *
1675  */
1676 struct rte_flow_item_ah {
1677 	uint32_t next_hdr:8;
1678 	uint32_t payload_len:8;
1679 	uint32_t reserved:16;
1680 	uint32_t spi;
1681 	uint32_t seq_num;
1682 };
1683 
1684 /** Default mask for RTE_FLOW_ITEM_TYPE_AH. */
1685 #ifndef __cplusplus
1686 static const struct rte_flow_item_ah rte_flow_item_ah_mask = {
1687 	.spi = 0xffffffff,
1688 };
1689 #endif
1690 
1691 /**
1692  * @warning
1693  * @b EXPERIMENTAL: this structure may change without prior notice
1694  *
1695  * RTE_FLOW_ITEM_TYPE_PFCP
1696  *
1697  * Match PFCP Header
1698  */
1699 struct rte_flow_item_pfcp {
1700 	uint8_t s_field;
1701 	uint8_t msg_type;
1702 	rte_be16_t msg_len;
1703 	rte_be64_t seid;
1704 };
1705 
1706 /** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */
1707 #ifndef __cplusplus
1708 static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
1709 	.s_field = 0x01,
1710 	.seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
1711 };
1712 #endif
1713 
1714 /**
1715  * @warning
1716  * @b EXPERIMENTAL: this structure may change without prior notice
1717  *
1718  * RTE_FLOW_ITEM_TYPE_ECPRI
1719  *
1720  * Match eCPRI Header
1721  */
1722 struct rte_flow_item_ecpri {
1723 	struct rte_ecpri_combined_msg_hdr hdr;
1724 };
1725 
1726 /** Default mask for RTE_FLOW_ITEM_TYPE_ECPRI. */
1727 #ifndef __cplusplus
1728 static const struct rte_flow_item_ecpri rte_flow_item_ecpri_mask = {
1729 	.hdr = {
1730 		.common = {
1731 			.u32 = 0x0,
1732 		},
1733 	},
1734 };
1735 #endif
1736 
1737 /**
1738  * RTE_FLOW_ITEM_TYPE_GENEVE_OPT
1739  *
1740  * Matches a GENEVE Variable Length Option
1741  */
1742 struct rte_flow_item_geneve_opt {
1743 	rte_be16_t option_class;
1744 	uint8_t option_type;
1745 	uint8_t option_len;
1746 	uint32_t *data;
1747 };
1748 
1749 /** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE_OPT. */
1750 #ifndef __cplusplus
1751 static const struct rte_flow_item_geneve_opt
1752 rte_flow_item_geneve_opt_mask = {
1753 	.option_type = 0xff,
1754 };
1755 #endif
1756 
1757 /**
1758  * @warning
1759  * @b EXPERIMENTAL: this structure may change without prior notice
1760  *
1761  * RTE_FLOW_ITEM_TYPE_INTEGRITY
1762  *
1763  * Match on packet integrity check result.
1764  */
1765 struct rte_flow_item_integrity {
1766 	/** Tunnel encapsulation level the item should apply to.
1767 	 * @see rte_flow_action_rss
1768 	 */
1769 	uint32_t level;
1770 	RTE_STD_C11
1771 	union {
1772 		__extension__
1773 		struct {
1774 			/** The packet is valid after passing all HW checks. */
1775 			uint64_t packet_ok:1;
1776 			/** L2 layer is valid after passing all HW checks. */
1777 			uint64_t l2_ok:1;
1778 			/** L3 layer is valid after passing all HW checks. */
1779 			uint64_t l3_ok:1;
1780 			/** L4 layer is valid after passing all HW checks. */
1781 			uint64_t l4_ok:1;
1782 			/** L2 layer CRC is valid. */
1783 			uint64_t l2_crc_ok:1;
1784 			/** IPv4 layer checksum is valid. */
1785 			uint64_t ipv4_csum_ok:1;
1786 			/** L4 layer checksum is valid. */
1787 			uint64_t l4_csum_ok:1;
1788 			/** L3 length is smaller than frame length. */
1789 			uint64_t l3_len_ok:1;
1790 			uint64_t reserved:56;
1791 		};
1792 		uint64_t value;
1793 	};
1794 };
1795 
1796 #ifndef __cplusplus
1797 static const struct rte_flow_item_integrity
1798 rte_flow_item_integrity_mask = {
1799 	.level = 0,
1800 	.value = 0,
1801 };
1802 #endif
1803 
1804 /**
1805  * The packet is valid after conntrack checking.
1806  */
1807 #define RTE_FLOW_CONNTRACK_PKT_STATE_VALID RTE_BIT32(0)
1808 /**
1809  * The state of the connection is changed.
1810  */
1811 #define RTE_FLOW_CONNTRACK_PKT_STATE_CHANGED RTE_BIT32(1)
1812 /**
1813  * Error is detected on this packet for this connection and
1814  * an invalid state is set.
1815  */
1816 #define RTE_FLOW_CONNTRACK_PKT_STATE_INVALID RTE_BIT32(2)
1817 /**
1818  * The HW connection tracking module is disabled.
1819  * It can be due to application command or an invalid state.
1820  */
1821 #define RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED RTE_BIT32(3)
1822 /**
1823  * The packet contains some bad field(s) and cannot continue
1824  * with the conntrack module checking.
1825  */
1826 #define RTE_FLOW_CONNTRACK_PKT_STATE_BAD RTE_BIT32(4)
1827 
1828 /**
1829  * @warning
1830  * @b EXPERIMENTAL: this structure may change without prior notice
1831  *
1832  * RTE_FLOW_ITEM_TYPE_CONNTRACK
1833  *
1834  * Matches the state of a packet after it passed the connection tracking
1835  * examination. The state is a bitmap of one RTE_FLOW_CONNTRACK_PKT_STATE*
1836  * or a reasonable combination of these bits.
1837  */
1838 struct rte_flow_item_conntrack {
1839 	uint32_t flags;
1840 };
1841 
1842 /** Default mask for RTE_FLOW_ITEM_TYPE_CONNTRACK. */
1843 #ifndef __cplusplus
1844 static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask = {
1845 	.flags = 0xffffffff,
1846 };
1847 #endif
1848 
1849 /**
1850  * @warning
1851  * @b EXPERIMENTAL: this structure may change without prior notice
1852  *
1853  * Provides an ethdev port ID for use with the following items:
1854  * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
1855  * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT.
1856  */
1857 struct rte_flow_item_ethdev {
1858 	uint16_t port_id; /**< ethdev port ID */
1859 };
1860 
1861 /** Default mask for items based on struct rte_flow_item_ethdev */
1862 #ifndef __cplusplus
1863 static const struct rte_flow_item_ethdev rte_flow_item_ethdev_mask = {
1864 	.port_id = 0xffff,
1865 };
1866 #endif
1867 
1868 /**
1869  * Matching pattern item definition.
1870  *
1871  * A pattern is formed by stacking items starting from the lowest protocol
1872  * layer to match. This stacking restriction does not apply to meta items
1873  * which can be placed anywhere in the stack without affecting the meaning
1874  * of the resulting pattern.
1875  *
1876  * Patterns are terminated by END items.
1877  *
1878  * The spec field should be a valid pointer to a structure of the related
1879  * item type. It may remain unspecified (NULL) in many cases to request
1880  * broad (nonspecific) matching. In such cases, last and mask must also be
1881  * set to NULL.
1882  *
1883  * Optionally, last can point to a structure of the same type to define an
1884  * inclusive range. This is mostly supported by integer and address fields,
1885  * may cause errors otherwise. Fields that do not support ranges must be set
1886  * to 0 or to the same value as the corresponding fields in spec.
1887  *
1888  * Only the fields defined to nonzero values in the default masks (see
1889  * rte_flow_item_{name}_mask constants) are considered relevant by
1890  * default. This can be overridden by providing a mask structure of the
1891  * same type with applicable bits set to one. It can also be used to
1892  * partially filter out specific fields (e.g. as an alternate mean to match
1893  * ranges of IP addresses).
1894  *
1895  * Mask is a simple bit-mask applied before interpreting the contents of
1896  * spec and last, which may yield unexpected results if not used
1897  * carefully. For example, if for an IPv4 address field, spec provides
1898  * 10.1.2.3, last provides 10.3.4.5 and mask provides 255.255.0.0, the
1899  * effective range becomes 10.1.0.0 to 10.3.255.255.
1900  */
1901 struct rte_flow_item {
1902 	enum rte_flow_item_type type; /**< Item type. */
1903 	const void *spec; /**< Pointer to item specification structure. */
1904 	const void *last; /**< Defines an inclusive range (spec to last). */
1905 	const void *mask; /**< Bit-mask applied to spec and last. */
1906 };
1907 
1908 /**
1909  * Action types.
1910  *
1911  * Each possible action is represented by a type.
1912  * An action can have an associated configuration object.
1913  * Several actions combined in a list can be assigned
1914  * to a flow rule and are performed in order.
1915  *
1916  * They fall in three categories:
1917  *
1918  * - Actions that modify the fate of matching traffic, for instance by
1919  *   dropping or assigning it a specific destination.
1920  *
1921  * - Actions that modify matching traffic contents or its properties. This
1922  *   includes adding/removing encapsulation, encryption, compression and
1923  *   marks.
1924  *
1925  * - Actions related to the flow rule itself, such as updating counters or
1926  *   making it non-terminating.
1927  *
1928  * Flow rules being terminating by default, not specifying any action of the
1929  * fate kind results in undefined behavior. This applies to both ingress and
1930  * egress.
1931  *
1932  * PASSTHRU, when supported, makes a flow rule non-terminating.
1933  */
1934 enum rte_flow_action_type {
1935 	/**
1936 	 * End marker for action lists. Prevents further processing of
1937 	 * actions, thereby ending the list.
1938 	 *
1939 	 * No associated configuration structure.
1940 	 */
1941 	RTE_FLOW_ACTION_TYPE_END,
1942 
1943 	/**
1944 	 * Used as a placeholder for convenience. It is ignored and simply
1945 	 * discarded by PMDs.
1946 	 *
1947 	 * No associated configuration structure.
1948 	 */
1949 	RTE_FLOW_ACTION_TYPE_VOID,
1950 
1951 	/**
1952 	 * Leaves traffic up for additional processing by subsequent flow
1953 	 * rules; makes a flow rule non-terminating.
1954 	 *
1955 	 * No associated configuration structure.
1956 	 */
1957 	RTE_FLOW_ACTION_TYPE_PASSTHRU,
1958 
1959 	/**
1960 	 * RTE_FLOW_ACTION_TYPE_JUMP
1961 	 *
1962 	 * Redirects packets to a group on the current device.
1963 	 *
1964 	 * See struct rte_flow_action_jump.
1965 	 */
1966 	RTE_FLOW_ACTION_TYPE_JUMP,
1967 
1968 	/**
1969 	 * Attaches an integer value to packets and sets PKT_RX_FDIR and
1970 	 * PKT_RX_FDIR_ID mbuf flags.
1971 	 *
1972 	 * See struct rte_flow_action_mark.
1973 	 *
1974 	 * One should negotiate mark delivery from the NIC to the PMD.
1975 	 * @see rte_eth_rx_metadata_negotiate()
1976 	 * @see RTE_ETH_RX_METADATA_USER_MARK
1977 	 */
1978 	RTE_FLOW_ACTION_TYPE_MARK,
1979 
1980 	/**
1981 	 * Flags packets. Similar to MARK without a specific value; only
1982 	 * sets the PKT_RX_FDIR mbuf flag.
1983 	 *
1984 	 * No associated configuration structure.
1985 	 *
1986 	 * One should negotiate flag delivery from the NIC to the PMD.
1987 	 * @see rte_eth_rx_metadata_negotiate()
1988 	 * @see RTE_ETH_RX_METADATA_USER_FLAG
1989 	 */
1990 	RTE_FLOW_ACTION_TYPE_FLAG,
1991 
1992 	/**
1993 	 * Assigns packets to a given queue index.
1994 	 *
1995 	 * See struct rte_flow_action_queue.
1996 	 */
1997 	RTE_FLOW_ACTION_TYPE_QUEUE,
1998 
1999 	/**
2000 	 * Drops packets.
2001 	 *
2002 	 * PASSTHRU overrides this action if both are specified.
2003 	 *
2004 	 * No associated configuration structure.
2005 	 */
2006 	RTE_FLOW_ACTION_TYPE_DROP,
2007 
2008 	/**
2009 	 * Enables counters for this flow rule.
2010 	 *
2011 	 * These counters can be retrieved and reset through rte_flow_query() or
2012 	 * rte_flow_action_handle_query() if the action provided via handle,
2013 	 * see struct rte_flow_query_count.
2014 	 *
2015 	 * See struct rte_flow_action_count.
2016 	 */
2017 	RTE_FLOW_ACTION_TYPE_COUNT,
2018 
2019 	/**
2020 	 * Similar to QUEUE, except RSS is additionally performed on packets
2021 	 * to spread them among several queues according to the provided
2022 	 * parameters.
2023 	 *
2024 	 * See struct rte_flow_action_rss.
2025 	 */
2026 	RTE_FLOW_ACTION_TYPE_RSS,
2027 
2028 	/**
2029 	 * @deprecated
2030 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2031 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2032 	 *
2033 	 * Directs matching traffic to the physical function (PF) of the
2034 	 * current device.
2035 	 *
2036 	 * No associated configuration structure.
2037 	 */
2038 	RTE_FLOW_ACTION_TYPE_PF,
2039 
2040 	/**
2041 	 * @deprecated
2042 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2043 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2044 	 *
2045 	 * Directs matching traffic to a given virtual function of the
2046 	 * current device.
2047 	 *
2048 	 * See struct rte_flow_action_vf.
2049 	 */
2050 	RTE_FLOW_ACTION_TYPE_VF,
2051 
2052 	/**
2053 	 * @deprecated
2054 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2055 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2056 	 *
2057 	 * Directs packets to a given physical port index of the underlying
2058 	 * device.
2059 	 *
2060 	 * See struct rte_flow_action_phy_port.
2061 	 */
2062 	RTE_FLOW_ACTION_TYPE_PHY_PORT,
2063 
2064 	/**
2065 	 * @deprecated
2066 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2067 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2068 	 *
2069 	 * Directs matching traffic to a given DPDK port ID.
2070 	 *
2071 	 * See struct rte_flow_action_port_id.
2072 	 */
2073 	RTE_FLOW_ACTION_TYPE_PORT_ID,
2074 
2075 	/**
2076 	 * Traffic metering and policing (MTR).
2077 	 *
2078 	 * See struct rte_flow_action_meter.
2079 	 * See file rte_mtr.h for MTR object configuration.
2080 	 */
2081 	RTE_FLOW_ACTION_TYPE_METER,
2082 
2083 	/**
2084 	 * Redirects packets to security engine of current device for security
2085 	 * processing as specified by security session.
2086 	 *
2087 	 * See struct rte_flow_action_security.
2088 	 */
2089 	RTE_FLOW_ACTION_TYPE_SECURITY,
2090 
2091 	/**
2092 	 * Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the
2093 	 * OpenFlow Switch Specification.
2094 	 *
2095 	 * See struct rte_flow_action_of_set_mpls_ttl.
2096 	 */
2097 	RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL,
2098 
2099 	/**
2100 	 * Implements OFPAT_DEC_MPLS_TTL ("decrement MPLS TTL") as defined
2101 	 * by the OpenFlow Switch Specification.
2102 	 *
2103 	 * No associated configuration structure.
2104 	 */
2105 	RTE_FLOW_ACTION_TYPE_OF_DEC_MPLS_TTL,
2106 
2107 	/**
2108 	 * Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow
2109 	 * Switch Specification.
2110 	 *
2111 	 * See struct rte_flow_action_of_set_nw_ttl.
2112 	 */
2113 	RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL,
2114 
2115 	/**
2116 	 * Implements OFPAT_DEC_NW_TTL ("decrement IP TTL") as defined by
2117 	 * the OpenFlow Switch Specification.
2118 	 *
2119 	 * No associated configuration structure.
2120 	 */
2121 	RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL,
2122 
2123 	/**
2124 	 * Implements OFPAT_COPY_TTL_OUT ("copy TTL "outwards" -- from
2125 	 * next-to-outermost to outermost") as defined by the OpenFlow
2126 	 * Switch Specification.
2127 	 *
2128 	 * No associated configuration structure.
2129 	 */
2130 	RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_OUT,
2131 
2132 	/**
2133 	 * Implements OFPAT_COPY_TTL_IN ("copy TTL "inwards" -- from
2134 	 * outermost to next-to-outermost") as defined by the OpenFlow
2135 	 * Switch Specification.
2136 	 *
2137 	 * No associated configuration structure.
2138 	 */
2139 	RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_IN,
2140 
2141 	/**
2142 	 * Implements OFPAT_POP_VLAN ("pop the outer VLAN tag") as defined
2143 	 * by the OpenFlow Switch Specification.
2144 	 *
2145 	 * No associated configuration structure.
2146 	 */
2147 	RTE_FLOW_ACTION_TYPE_OF_POP_VLAN,
2148 
2149 	/**
2150 	 * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by
2151 	 * the OpenFlow Switch Specification.
2152 	 *
2153 	 * See struct rte_flow_action_of_push_vlan.
2154 	 */
2155 	RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN,
2156 
2157 	/**
2158 	 * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN id") as
2159 	 * defined by the OpenFlow Switch Specification.
2160 	 *
2161 	 * See struct rte_flow_action_of_set_vlan_vid.
2162 	 */
2163 	RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID,
2164 
2165 	/**
2166 	 * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as
2167 	 * defined by the OpenFlow Switch Specification.
2168 	 *
2169 	 * See struct rte_flow_action_of_set_vlan_pcp.
2170 	 */
2171 	RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP,
2172 
2173 	/**
2174 	 * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined
2175 	 * by the OpenFlow Switch Specification.
2176 	 *
2177 	 * See struct rte_flow_action_of_pop_mpls.
2178 	 */
2179 	RTE_FLOW_ACTION_TYPE_OF_POP_MPLS,
2180 
2181 	/**
2182 	 * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by
2183 	 * the OpenFlow Switch Specification.
2184 	 *
2185 	 * See struct rte_flow_action_of_push_mpls.
2186 	 */
2187 	RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS,
2188 
2189 	/**
2190 	 * Encapsulate flow in VXLAN tunnel as defined in
2191 	 * rte_flow_action_vxlan_encap action structure.
2192 	 *
2193 	 * See struct rte_flow_action_vxlan_encap.
2194 	 */
2195 	RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP,
2196 
2197 	/**
2198 	 * Decapsulate outer most VXLAN tunnel from matched flow.
2199 	 *
2200 	 * If flow pattern does not define a valid VXLAN tunnel (as specified by
2201 	 * RFC7348) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
2202 	 * error.
2203 	 */
2204 	RTE_FLOW_ACTION_TYPE_VXLAN_DECAP,
2205 
2206 	/**
2207 	 * Encapsulate flow in NVGRE tunnel defined in the
2208 	 * rte_flow_action_nvgre_encap action structure.
2209 	 *
2210 	 * See struct rte_flow_action_nvgre_encap.
2211 	 */
2212 	RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP,
2213 
2214 	/**
2215 	 * Decapsulate outer most NVGRE tunnel from matched flow.
2216 	 *
2217 	 * If flow pattern does not define a valid NVGRE tunnel (as specified by
2218 	 * RFC7637) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
2219 	 * error.
2220 	 */
2221 	RTE_FLOW_ACTION_TYPE_NVGRE_DECAP,
2222 
2223 	/**
2224 	 * Add outer header whose template is provided in its data buffer
2225 	 *
2226 	 * See struct rte_flow_action_raw_encap.
2227 	 */
2228 	RTE_FLOW_ACTION_TYPE_RAW_ENCAP,
2229 
2230 	/**
2231 	 * Remove outer header whose template is provided in its data buffer.
2232 	 *
2233 	 * See struct rte_flow_action_raw_decap
2234 	 */
2235 	RTE_FLOW_ACTION_TYPE_RAW_DECAP,
2236 
2237 	/**
2238 	 * Modify IPv4 source address in the outermost IPv4 header.
2239 	 *
2240 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2241 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2242 	 *
2243 	 * See struct rte_flow_action_set_ipv4.
2244 	 */
2245 	RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC,
2246 
2247 	/**
2248 	 * Modify IPv4 destination address in the outermost IPv4 header.
2249 	 *
2250 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2251 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2252 	 *
2253 	 * See struct rte_flow_action_set_ipv4.
2254 	 */
2255 	RTE_FLOW_ACTION_TYPE_SET_IPV4_DST,
2256 
2257 	/**
2258 	 * Modify IPv6 source address in the outermost IPv6 header.
2259 	 *
2260 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2261 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2262 	 *
2263 	 * See struct rte_flow_action_set_ipv6.
2264 	 */
2265 	RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC,
2266 
2267 	/**
2268 	 * Modify IPv6 destination address in the outermost IPv6 header.
2269 	 *
2270 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2271 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2272 	 *
2273 	 * See struct rte_flow_action_set_ipv6.
2274 	 */
2275 	RTE_FLOW_ACTION_TYPE_SET_IPV6_DST,
2276 
2277 	/**
2278 	 * Modify source port number in the outermost TCP/UDP header.
2279 	 *
2280 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
2281 	 * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
2282 	 * RTE_FLOW_ERROR_TYPE_ACTION error.
2283 	 *
2284 	 * See struct rte_flow_action_set_tp.
2285 	 */
2286 	RTE_FLOW_ACTION_TYPE_SET_TP_SRC,
2287 
2288 	/**
2289 	 * Modify destination port number in the outermost TCP/UDP header.
2290 	 *
2291 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
2292 	 * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
2293 	 * RTE_FLOW_ERROR_TYPE_ACTION error.
2294 	 *
2295 	 * See struct rte_flow_action_set_tp.
2296 	 */
2297 	RTE_FLOW_ACTION_TYPE_SET_TP_DST,
2298 
2299 	/**
2300 	 * Swap the source and destination MAC addresses in the outermost
2301 	 * Ethernet header.
2302 	 *
2303 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2304 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2305 	 *
2306 	 * No associated configuration structure.
2307 	 */
2308 	RTE_FLOW_ACTION_TYPE_MAC_SWAP,
2309 
2310 	/**
2311 	 * Decrease TTL value directly
2312 	 *
2313 	 * No associated configuration structure.
2314 	 */
2315 	RTE_FLOW_ACTION_TYPE_DEC_TTL,
2316 
2317 	/**
2318 	 * Set TTL value
2319 	 *
2320 	 * See struct rte_flow_action_set_ttl
2321 	 */
2322 	RTE_FLOW_ACTION_TYPE_SET_TTL,
2323 
2324 	/**
2325 	 * Set source MAC address from matched flow.
2326 	 *
2327 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2328 	 * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2329 	 *
2330 	 * See struct rte_flow_action_set_mac.
2331 	 */
2332 	RTE_FLOW_ACTION_TYPE_SET_MAC_SRC,
2333 
2334 	/**
2335 	 * Set destination MAC address from matched flow.
2336 	 *
2337 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2338 	 * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2339 	 *
2340 	 * See struct rte_flow_action_set_mac.
2341 	 */
2342 	RTE_FLOW_ACTION_TYPE_SET_MAC_DST,
2343 
2344 	/**
2345 	 * Increase sequence number in the outermost TCP header.
2346 	 *
2347 	 * Action configuration specifies the value to increase
2348 	 * TCP sequence number as a big-endian 32 bit integer.
2349 	 *
2350 	 * @p conf type:
2351 	 * @code rte_be32_t * @endcode
2352 	 *
2353 	 * Using this action on non-matching traffic will result in
2354 	 * undefined behavior.
2355 	 */
2356 	RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ,
2357 
2358 	/**
2359 	 * Decrease sequence number in the outermost TCP header.
2360 	 *
2361 	 * Action configuration specifies the value to decrease
2362 	 * TCP sequence number as a big-endian 32 bit integer.
2363 	 *
2364 	 * @p conf type:
2365 	 * @code rte_be32_t * @endcode
2366 	 *
2367 	 * Using this action on non-matching traffic will result in
2368 	 * undefined behavior.
2369 	 */
2370 	RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ,
2371 
2372 	/**
2373 	 * Increase acknowledgment number in the outermost TCP header.
2374 	 *
2375 	 * Action configuration specifies the value to increase
2376 	 * TCP acknowledgment number as a big-endian 32 bit integer.
2377 	 *
2378 	 * @p conf type:
2379 	 * @code rte_be32_t * @endcode
2380 
2381 	 * Using this action on non-matching traffic will result in
2382 	 * undefined behavior.
2383 	 */
2384 	RTE_FLOW_ACTION_TYPE_INC_TCP_ACK,
2385 
2386 	/**
2387 	 * Decrease acknowledgment number in the outermost TCP header.
2388 	 *
2389 	 * Action configuration specifies the value to decrease
2390 	 * TCP acknowledgment number as a big-endian 32 bit integer.
2391 	 *
2392 	 * @p conf type:
2393 	 * @code rte_be32_t * @endcode
2394 	 *
2395 	 * Using this action on non-matching traffic will result in
2396 	 * undefined behavior.
2397 	 */
2398 	RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK,
2399 
2400 	/**
2401 	 * Set Tag.
2402 	 *
2403 	 * Tag is for internal flow usage only and
2404 	 * is not delivered to the application.
2405 	 *
2406 	 * See struct rte_flow_action_set_tag.
2407 	 */
2408 	RTE_FLOW_ACTION_TYPE_SET_TAG,
2409 
2410 	/**
2411 	 * Set metadata on ingress or egress path.
2412 	 *
2413 	 * See struct rte_flow_action_set_meta.
2414 	 */
2415 	RTE_FLOW_ACTION_TYPE_SET_META,
2416 
2417 	/**
2418 	 * Modify IPv4 DSCP in the outermost IP header.
2419 	 *
2420 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2421 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2422 	 *
2423 	 * See struct rte_flow_action_set_dscp.
2424 	 */
2425 	RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP,
2426 
2427 	/**
2428 	 * Modify IPv6 DSCP in the outermost IP header.
2429 	 *
2430 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2431 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2432 	 *
2433 	 * See struct rte_flow_action_set_dscp.
2434 	 */
2435 	RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP,
2436 
2437 	/**
2438 	 * Report as aged flow if timeout passed without any matching on the
2439 	 * flow.
2440 	 *
2441 	 * See struct rte_flow_action_age.
2442 	 * See function rte_flow_get_aged_flows
2443 	 * see enum RTE_ETH_EVENT_FLOW_AGED
2444 	 * See struct rte_flow_query_age
2445 	 */
2446 	RTE_FLOW_ACTION_TYPE_AGE,
2447 
2448 	/**
2449 	 * The matching packets will be duplicated with specified ratio and
2450 	 * applied with own set of actions with a fate action.
2451 	 *
2452 	 * See struct rte_flow_action_sample.
2453 	 */
2454 	RTE_FLOW_ACTION_TYPE_SAMPLE,
2455 
2456 	/**
2457 	 * @deprecated
2458 	 * @see RTE_FLOW_ACTION_TYPE_INDIRECT
2459 	 *
2460 	 * Describe action shared across multiple flow rules.
2461 	 *
2462 	 * Allow multiple rules reference the same action by handle (see
2463 	 * struct rte_flow_shared_action).
2464 	 */
2465 	RTE_FLOW_ACTION_TYPE_SHARED,
2466 
2467 	/**
2468 	 * Modify a packet header field, tag, mark or metadata.
2469 	 *
2470 	 * Allow the modification of an arbitrary header field via
2471 	 * set, add and sub operations or copying its content into
2472 	 * tag, meta or mark for future processing.
2473 	 *
2474 	 * See struct rte_flow_action_modify_field.
2475 	 */
2476 	RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
2477 
2478 	/**
2479 	 * An action handle is referenced in a rule through an indirect action.
2480 	 *
2481 	 * The same action handle may be used in multiple rules for the same
2482 	 * or different ethdev ports.
2483 	 */
2484 	RTE_FLOW_ACTION_TYPE_INDIRECT,
2485 
2486 	/**
2487 	 * [META]
2488 	 *
2489 	 * Enable tracking a TCP connection state.
2490 	 *
2491 	 * @see struct rte_flow_action_conntrack.
2492 	 */
2493 	RTE_FLOW_ACTION_TYPE_CONNTRACK,
2494 
2495 	/**
2496 	 * Color the packet to reflect the meter color result.
2497 	 * Set the meter color in the mbuf to the selected color.
2498 	 *
2499 	 * See struct rte_flow_action_meter_color.
2500 	 */
2501 	RTE_FLOW_ACTION_TYPE_METER_COLOR,
2502 
2503 	/**
2504 	 * At embedded switch level, sends matching traffic to the given ethdev.
2505 	 *
2506 	 * @see struct rte_flow_action_ethdev
2507 	 */
2508 	RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
2509 
2510 	/**
2511 	 * At embedded switch level, send matching traffic to
2512 	 * the entity represented by the given ethdev.
2513 	 *
2514 	 * @see struct rte_flow_action_ethdev
2515 	 */
2516 	RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
2517 };
2518 
2519 /**
2520  * RTE_FLOW_ACTION_TYPE_MARK
2521  *
2522  * Attaches an integer value to packets and sets PKT_RX_FDIR and
2523  * PKT_RX_FDIR_ID mbuf flags.
2524  *
2525  * This value is arbitrary and application-defined. Maximum allowed value
2526  * depends on the underlying implementation. It is returned in the
2527  * hash.fdir.hi mbuf field.
2528  */
2529 struct rte_flow_action_mark {
2530 	uint32_t id; /**< Integer value to return with packets. */
2531 };
2532 
2533 /**
2534  * @warning
2535  * @b EXPERIMENTAL: this structure may change without prior notice
2536  *
2537  * RTE_FLOW_ACTION_TYPE_JUMP
2538  *
2539  * Redirects packets to a group on the current device.
2540  *
2541  * In a hierarchy of groups, which can be used to represent physical or logical
2542  * flow tables on the device, this action allows the action to be a redirect to
2543  * a group on that device.
2544  */
2545 struct rte_flow_action_jump {
2546 	uint32_t group;
2547 };
2548 
2549 /**
2550  * RTE_FLOW_ACTION_TYPE_QUEUE
2551  *
2552  * Assign packets to a given queue index.
2553  */
2554 struct rte_flow_action_queue {
2555 	uint16_t index; /**< Queue index to use. */
2556 };
2557 
2558 /**
2559  * @warning
2560  * @b EXPERIMENTAL: this structure may change without prior notice
2561  *
2562  * RTE_FLOW_ACTION_TYPE_AGE
2563  *
2564  * Report flow as aged-out if timeout passed without any matching
2565  * on the flow. RTE_ETH_EVENT_FLOW_AGED event is triggered when a
2566  * port detects new aged-out flows.
2567  *
2568  * The flow context and the flow handle will be reported by the
2569  * rte_flow_get_aged_flows API.
2570  */
2571 struct rte_flow_action_age {
2572 	uint32_t timeout:24; /**< Time in seconds. */
2573 	uint32_t reserved:8; /**< Reserved, must be zero. */
2574 	void *context;
2575 		/**< The user flow context, NULL means the rte_flow pointer. */
2576 };
2577 
2578 /**
2579  * RTE_FLOW_ACTION_TYPE_AGE (query)
2580  *
2581  * Query structure to retrieve the aging status information of a
2582  * shared AGE action, or a flow rule using the AGE action.
2583  */
2584 struct rte_flow_query_age {
2585 	uint32_t reserved:6; /**< Reserved, must be zero. */
2586 	uint32_t aged:1; /**< 1 if aging timeout expired, 0 otherwise. */
2587 	uint32_t sec_since_last_hit_valid:1;
2588 	/**< sec_since_last_hit value is valid. */
2589 	uint32_t sec_since_last_hit:24; /**< Seconds since last traffic hit. */
2590 };
2591 
2592 /**
2593  * @warning
2594  * @b EXPERIMENTAL: this structure may change without prior notice
2595  *
2596  * RTE_FLOW_ACTION_TYPE_COUNT
2597  *
2598  * Adds a counter action to a matched flow.
2599  *
2600  * If more than one count action is specified in a single flow rule, then each
2601  * action must specify a unique id.
2602  *
2603  * Counters can be retrieved and reset through ``rte_flow_query()``, see
2604  * ``struct rte_flow_query_count``.
2605  *
2606  * For ports within the same switch domain then the counter id namespace extends
2607  * to all ports within that switch domain.
2608  */
2609 struct rte_flow_action_count {
2610 	uint32_t id; /**< Counter ID. */
2611 };
2612 
2613 /**
2614  * RTE_FLOW_ACTION_TYPE_COUNT (query)
2615  *
2616  * Query structure to retrieve and reset flow rule counters.
2617  */
2618 struct rte_flow_query_count {
2619 	uint32_t reset:1; /**< Reset counters after query [in]. */
2620 	uint32_t hits_set:1; /**< hits field is set [out]. */
2621 	uint32_t bytes_set:1; /**< bytes field is set [out]. */
2622 	uint32_t reserved:29; /**< Reserved, must be zero [in, out]. */
2623 	uint64_t hits; /**< Number of hits for this rule [out]. */
2624 	uint64_t bytes; /**< Number of bytes through this rule [out]. */
2625 };
2626 
2627 /**
2628  * Hash function types.
2629  */
2630 enum rte_eth_hash_function {
2631 	RTE_ETH_HASH_FUNCTION_DEFAULT = 0,
2632 	RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */
2633 	RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */
2634 	/**
2635 	 * Symmetric Toeplitz: src, dst will be replaced by
2636 	 * xor(src, dst). For the case with src/dst only,
2637 	 * src or dst address will xor with zero pair.
2638 	 */
2639 	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
2640 	RTE_ETH_HASH_FUNCTION_MAX,
2641 };
2642 
2643 /**
2644  * RTE_FLOW_ACTION_TYPE_RSS
2645  *
2646  * Similar to QUEUE, except RSS is additionally performed on packets to
2647  * spread them among several queues according to the provided parameters.
2648  *
2649  * Unlike global RSS settings used by other DPDK APIs, unsetting the
2650  * @p types field does not disable RSS in a flow rule. Doing so instead
2651  * requests safe unspecified "best-effort" settings from the underlying PMD,
2652  * which depending on the flow rule, may result in anything ranging from
2653  * empty (single queue) to all-inclusive RSS.
2654  *
2655  * Note: RSS hash result is stored in the hash.rss mbuf field which overlaps
2656  * hash.fdir.lo. Since the MARK action sets the hash.fdir.hi field only,
2657  * both can be requested simultaneously.
2658  */
2659 struct rte_flow_action_rss {
2660 	enum rte_eth_hash_function func; /**< RSS hash function to apply. */
2661 	/**
2662 	 * Packet encapsulation level RSS hash @p types apply to.
2663 	 *
2664 	 * - @p 0 requests the default behavior. Depending on the packet
2665 	 *   type, it can mean outermost, innermost, anything in between or
2666 	 *   even no RSS.
2667 	 *
2668 	 *   It basically stands for the innermost encapsulation level RSS
2669 	 *   can be performed on according to PMD and device capabilities.
2670 	 *
2671 	 * - @p 1 requests RSS to be performed on the outermost packet
2672 	 *   encapsulation level.
2673 	 *
2674 	 * - @p 2 and subsequent values request RSS to be performed on the
2675 	 *   specified inner packet encapsulation level, from outermost to
2676 	 *   innermost (lower to higher values).
2677 	 *
2678 	 * Values other than @p 0 are not necessarily supported.
2679 	 *
2680 	 * Requesting a specific RSS level on unrecognized traffic results
2681 	 * in undefined behavior. For predictable results, it is recommended
2682 	 * to make the flow rule pattern match packet headers up to the
2683 	 * requested encapsulation level so that only matching traffic goes
2684 	 * through.
2685 	 */
2686 	uint32_t level;
2687 	uint64_t types; /**< Specific RSS hash types (see ETH_RSS_*). */
2688 	uint32_t key_len; /**< Hash key length in bytes. */
2689 	uint32_t queue_num; /**< Number of entries in @p queue. */
2690 	const uint8_t *key; /**< Hash key. */
2691 	const uint16_t *queue; /**< Queue indices to use. */
2692 };
2693 
2694 /**
2695  * @deprecated
2696  * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2697  * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2698  *
2699  * RTE_FLOW_ACTION_TYPE_VF
2700  *
2701  * Directs matching traffic to a given virtual function of the current
2702  * device.
2703  *
2704  * Packets matched by a VF pattern item can be redirected to their original
2705  * VF ID instead of the specified one. This parameter may not be available
2706  * and is not guaranteed to work properly if the VF part is matched by a
2707  * prior flow rule or if packets are not addressed to a VF in the first
2708  * place.
2709  */
2710 struct rte_flow_action_vf {
2711 	uint32_t original:1; /**< Use original VF ID if possible. */
2712 	uint32_t reserved:31; /**< Reserved, must be zero. */
2713 	uint32_t id; /**< VF ID. */
2714 };
2715 
2716 /**
2717  * @deprecated
2718  * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2719  * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2720  *
2721  * RTE_FLOW_ACTION_TYPE_PHY_PORT
2722  *
2723  * Directs packets to a given physical port index of the underlying
2724  * device.
2725  *
2726  * @see RTE_FLOW_ITEM_TYPE_PHY_PORT
2727  */
2728 struct rte_flow_action_phy_port {
2729 	uint32_t original:1; /**< Use original port index if possible. */
2730 	uint32_t reserved:31; /**< Reserved, must be zero. */
2731 	uint32_t index; /**< Physical port index. */
2732 };
2733 
2734 /**
2735  * @deprecated
2736  * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2737  * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2738  *
2739  * RTE_FLOW_ACTION_TYPE_PORT_ID
2740  *
2741  * Directs matching traffic to a given DPDK port ID.
2742  *
2743  * @see RTE_FLOW_ITEM_TYPE_PORT_ID
2744  */
2745 struct rte_flow_action_port_id {
2746 	uint32_t original:1; /**< Use original DPDK port ID if possible. */
2747 	uint32_t reserved:31; /**< Reserved, must be zero. */
2748 	uint32_t id; /**< DPDK port ID. */
2749 };
2750 
2751 /**
2752  * RTE_FLOW_ACTION_TYPE_METER
2753  *
2754  * Traffic metering and policing (MTR).
2755  *
2756  * Packets matched by items of this type can be either dropped or passed to the
2757  * next item with their color set by the MTR object.
2758  */
2759 struct rte_flow_action_meter {
2760 	uint32_t mtr_id; /**< MTR object ID created with rte_mtr_create(). */
2761 };
2762 
2763 /**
2764  * RTE_FLOW_ACTION_TYPE_SECURITY
2765  *
2766  * Perform the security action on flows matched by the pattern items
2767  * according to the configuration of the security session.
2768  *
2769  * This action modifies the payload of matched flows. For INLINE_CRYPTO, the
2770  * security protocol headers and IV are fully provided by the application as
2771  * specified in the flow pattern. The payload of matching packets is
2772  * encrypted on egress, and decrypted and authenticated on ingress.
2773  * For INLINE_PROTOCOL, the security protocol is fully offloaded to HW,
2774  * providing full encapsulation and decapsulation of packets in security
2775  * protocols. The flow pattern specifies both the outer security header fields
2776  * and the inner packet fields. The security session specified in the action
2777  * must match the pattern parameters.
2778  *
2779  * The security session specified in the action must be created on the same
2780  * port as the flow action that is being specified.
2781  *
2782  * The ingress/egress flow attribute should match that specified in the
2783  * security session if the security session supports the definition of the
2784  * direction.
2785  *
2786  * Multiple flows can be configured to use the same security session.
2787  *
2788  * The NULL value is allowed for security session. If security session is NULL,
2789  * then SPI field in ESP flow item and IP addresses in flow items 'IPv4' and
2790  * 'IPv6' will be allowed to be a range. The rule thus created can enable
2791  * security processing on multiple flows.
2792  */
2793 struct rte_flow_action_security {
2794 	void *security_session; /**< Pointer to security session structure. */
2795 };
2796 
2797 /**
2798  * RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL
2799  *
2800  * Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the OpenFlow
2801  * Switch Specification.
2802  */
2803 struct rte_flow_action_of_set_mpls_ttl {
2804 	uint8_t mpls_ttl; /**< MPLS TTL. */
2805 };
2806 
2807 /**
2808  * RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL
2809  *
2810  * Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow Switch
2811  * Specification.
2812  */
2813 struct rte_flow_action_of_set_nw_ttl {
2814 	uint8_t nw_ttl; /**< IP TTL. */
2815 };
2816 
2817 /**
2818  * RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN
2819  *
2820  * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by the
2821  * OpenFlow Switch Specification.
2822  */
2823 struct rte_flow_action_of_push_vlan {
2824 	rte_be16_t ethertype; /**< EtherType. */
2825 };
2826 
2827 /**
2828  * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID
2829  *
2830  * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN id") as defined by
2831  * the OpenFlow Switch Specification.
2832  */
2833 struct rte_flow_action_of_set_vlan_vid {
2834 	rte_be16_t vlan_vid; /**< VLAN id. */
2835 };
2836 
2837 /**
2838  * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP
2839  *
2840  * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as defined by
2841  * the OpenFlow Switch Specification.
2842  */
2843 struct rte_flow_action_of_set_vlan_pcp {
2844 	uint8_t vlan_pcp; /**< VLAN priority. */
2845 };
2846 
2847 /**
2848  * RTE_FLOW_ACTION_TYPE_OF_POP_MPLS
2849  *
2850  * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined by the
2851  * OpenFlow Switch Specification.
2852  */
2853 struct rte_flow_action_of_pop_mpls {
2854 	rte_be16_t ethertype; /**< EtherType. */
2855 };
2856 
2857 /**
2858  * RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS
2859  *
2860  * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by the
2861  * OpenFlow Switch Specification.
2862  */
2863 struct rte_flow_action_of_push_mpls {
2864 	rte_be16_t ethertype; /**< EtherType. */
2865 };
2866 
2867 /**
2868  * @warning
2869  * @b EXPERIMENTAL: this structure may change without prior notice
2870  *
2871  * RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP
2872  *
2873  * VXLAN tunnel end-point encapsulation data definition
2874  *
2875  * The tunnel definition is provided through the flow item pattern, the
2876  * provided pattern must conform to RFC7348 for the tunnel specified. The flow
2877  * definition must be provided in order from the RTE_FLOW_ITEM_TYPE_ETH
2878  * definition up the end item which is specified by RTE_FLOW_ITEM_TYPE_END.
2879  *
2880  * The mask field allows user to specify which fields in the flow item
2881  * definitions can be ignored and which have valid data and can be used
2882  * verbatim.
2883  *
2884  * Note: the last field is not used in the definition of a tunnel and can be
2885  * ignored.
2886  *
2887  * Valid flow definition for RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP include:
2888  *
2889  * - ETH / IPV4 / UDP / VXLAN / END
2890  * - ETH / IPV6 / UDP / VXLAN / END
2891  * - ETH / VLAN / IPV4 / UDP / VXLAN / END
2892  *
2893  */
2894 struct rte_flow_action_vxlan_encap {
2895 	/**
2896 	 * Encapsulating vxlan tunnel definition
2897 	 * (terminated by the END pattern item).
2898 	 */
2899 	struct rte_flow_item *definition;
2900 };
2901 
2902 /**
2903  * @warning
2904  * @b EXPERIMENTAL: this structure may change without prior notice
2905  *
2906  * RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP
2907  *
2908  * NVGRE tunnel end-point encapsulation data definition
2909  *
2910  * The tunnel definition is provided through the flow item pattern  the
2911  * provided pattern must conform with RFC7637. The flow definition must be
2912  * provided in order from the RTE_FLOW_ITEM_TYPE_ETH definition up the end item
2913  * which is specified by RTE_FLOW_ITEM_TYPE_END.
2914  *
2915  * The mask field allows user to specify which fields in the flow item
2916  * definitions can be ignored and which have valid data and can be used
2917  * verbatim.
2918  *
2919  * Note: the last field is not used in the definition of a tunnel and can be
2920  * ignored.
2921  *
2922  * Valid flow definition for RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP include:
2923  *
2924  * - ETH / IPV4 / NVGRE / END
2925  * - ETH / VLAN / IPV6 / NVGRE / END
2926  *
2927  */
2928 struct rte_flow_action_nvgre_encap {
2929 	/**
2930 	 * Encapsulating vxlan tunnel definition
2931 	 * (terminated by the END pattern item).
2932 	 */
2933 	struct rte_flow_item *definition;
2934 };
2935 
2936 /**
2937  * @warning
2938  * @b EXPERIMENTAL: this structure may change without prior notice
2939  *
2940  * RTE_FLOW_ACTION_TYPE_RAW_ENCAP
2941  *
2942  * Raw tunnel end-point encapsulation data definition.
2943  *
2944  * The data holds the headers definitions to be applied on the packet.
2945  * The data must start with ETH header up to the tunnel item header itself.
2946  * When used right after RAW_DECAP (for decapsulating L3 tunnel type for
2947  * example MPLSoGRE) the data will just hold layer 2 header.
2948  *
2949  * The preserve parameter holds which bits in the packet the PMD is not allowed
2950  * to change, this parameter can also be NULL and then the PMD is allowed
2951  * to update any field.
2952  *
2953  * size holds the number of bytes in @p data and @p preserve.
2954  */
2955 struct rte_flow_action_raw_encap {
2956 	uint8_t *data; /**< Encapsulation data. */
2957 	uint8_t *preserve; /**< Bit-mask of @p data to preserve on output. */
2958 	size_t size; /**< Size of @p data and @p preserve. */
2959 };
2960 
2961 /**
2962  * @warning
2963  * @b EXPERIMENTAL: this structure may change without prior notice
2964  *
2965  * RTE_FLOW_ACTION_TYPE_RAW_DECAP
2966  *
2967  * Raw tunnel end-point decapsulation data definition.
2968  *
2969  * The data holds the headers definitions to be removed from the packet.
2970  * The data must start with ETH header up to the tunnel item header itself.
2971  * When used right before RAW_DECAP (for encapsulating L3 tunnel type for
2972  * example MPLSoGRE) the data will just hold layer 2 header.
2973  *
2974  * size holds the number of bytes in @p data.
2975  */
2976 struct rte_flow_action_raw_decap {
2977 	uint8_t *data; /**< Encapsulation data. */
2978 	size_t size; /**< Size of @p data and @p preserve. */
2979 };
2980 
2981 /**
2982  * @warning
2983  * @b EXPERIMENTAL: this structure may change without prior notice
2984  *
2985  * RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC
2986  * RTE_FLOW_ACTION_TYPE_SET_IPV4_DST
2987  *
2988  * Allows modification of IPv4 source (RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC)
2989  * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV4_DST) in the
2990  * specified outermost IPv4 header.
2991  */
2992 struct rte_flow_action_set_ipv4 {
2993 	rte_be32_t ipv4_addr;
2994 };
2995 
2996 /**
2997  * @warning
2998  * @b EXPERIMENTAL: this structure may change without prior notice
2999  *
3000  * RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC
3001  * RTE_FLOW_ACTION_TYPE_SET_IPV6_DST
3002  *
3003  * Allows modification of IPv6 source (RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC)
3004  * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) in the
3005  * specified outermost IPv6 header.
3006  */
3007 struct rte_flow_action_set_ipv6 {
3008 	uint8_t ipv6_addr[16];
3009 };
3010 
3011 /**
3012  * @warning
3013  * @b EXPERIMENTAL: this structure may change without prior notice
3014  *
3015  * RTE_FLOW_ACTION_TYPE_SET_TP_SRC
3016  * RTE_FLOW_ACTION_TYPE_SET_TP_DST
3017  *
3018  * Allows modification of source (RTE_FLOW_ACTION_TYPE_SET_TP_SRC)
3019  * and destination (RTE_FLOW_ACTION_TYPE_SET_TP_DST) port numbers
3020  * in the specified outermost TCP/UDP header.
3021  */
3022 struct rte_flow_action_set_tp {
3023 	rte_be16_t port;
3024 };
3025 
3026 /**
3027  * RTE_FLOW_ACTION_TYPE_SET_TTL
3028  *
3029  * Set the TTL value directly for IPv4 or IPv6
3030  */
3031 struct rte_flow_action_set_ttl {
3032 	uint8_t ttl_value;
3033 };
3034 
3035 /**
3036  * RTE_FLOW_ACTION_TYPE_SET_MAC
3037  *
3038  * Set MAC address from the matched flow
3039  */
3040 struct rte_flow_action_set_mac {
3041 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
3042 };
3043 
3044 /**
3045  * @warning
3046  * @b EXPERIMENTAL: this structure may change without prior notice
3047  *
3048  * RTE_FLOW_ACTION_TYPE_SET_TAG
3049  *
3050  * Set a tag which is a transient data used during flow matching. This is not
3051  * delivered to application. Multiple tags are supported by specifying index.
3052  */
3053 struct rte_flow_action_set_tag {
3054 	uint32_t data;
3055 	uint32_t mask;
3056 	uint8_t index;
3057 };
3058 
3059 /**
3060  * @warning
3061  * @b EXPERIMENTAL: this structure may change without prior notice
3062  *
3063  * RTE_FLOW_ACTION_TYPE_SET_META
3064  *
3065  * Set metadata. Metadata set by mbuf metadata dynamic field with
3066  * PKT_TX_DYNF_DATA flag on egress will be overridden by this action. On
3067  * ingress, the metadata will be carried by mbuf metadata dynamic field
3068  * with PKT_RX_DYNF_METADATA flag if set.  The dynamic mbuf field must be
3069  * registered in advance by rte_flow_dynf_metadata_register().
3070  *
3071  * Altering partial bits is supported with mask. For bits which have never
3072  * been set, unpredictable value will be seen depending on driver
3073  * implementation. For loopback/hairpin packet, metadata set on Rx/Tx may
3074  * or may not be propagated to the other path depending on HW capability.
3075  *
3076  * RTE_FLOW_ITEM_TYPE_META matches metadata.
3077  */
3078 struct rte_flow_action_set_meta {
3079 	uint32_t data;
3080 	uint32_t mask;
3081 };
3082 
3083 /**
3084  * RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP
3085  * RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP
3086  *
3087  * Set the DSCP value for IPv4/IPv6 header.
3088  * DSCP in low 6 bits, rest ignored.
3089  */
3090 struct rte_flow_action_set_dscp {
3091 	uint8_t dscp;
3092 };
3093 
3094 /**
3095  * @warning
3096  * @b EXPERIMENTAL: this structure may change without prior notice
3097  *
3098  * RTE_FLOW_ACTION_TYPE_INDIRECT
3099  *
3100  * Opaque type returned after successfully creating an indirect action object.
3101  * The definition of the object handle is different per driver or
3102  * per direct action type.
3103  *
3104  * This handle can be used to manage and query the related direct action:
3105  * - referenced in single flow rule or across multiple flow rules
3106  *   over multiple ports
3107  * - update action object configuration
3108  * - query action object data
3109  * - destroy action object
3110  */
3111 struct rte_flow_action_handle;
3112 
3113 /**
3114  * The state of a TCP connection.
3115  */
3116 enum rte_flow_conntrack_state {
3117 	/** SYN-ACK packet was seen. */
3118 	RTE_FLOW_CONNTRACK_STATE_SYN_RECV,
3119 	/** 3-way handshake was done. */
3120 	RTE_FLOW_CONNTRACK_STATE_ESTABLISHED,
3121 	/** First FIN packet was received to close the connection. */
3122 	RTE_FLOW_CONNTRACK_STATE_FIN_WAIT,
3123 	/** First FIN was ACKed. */
3124 	RTE_FLOW_CONNTRACK_STATE_CLOSE_WAIT,
3125 	/** Second FIN was received, waiting for the last ACK. */
3126 	RTE_FLOW_CONNTRACK_STATE_LAST_ACK,
3127 	/** Second FIN was ACKed, connection was closed. */
3128 	RTE_FLOW_CONNTRACK_STATE_TIME_WAIT,
3129 };
3130 
3131 /**
3132  * The last passed TCP packet flags of a connection.
3133  */
3134 enum rte_flow_conntrack_tcp_last_index {
3135 	RTE_FLOW_CONNTRACK_FLAG_NONE = 0, /**< No Flag. */
3136 	RTE_FLOW_CONNTRACK_FLAG_SYN = RTE_BIT32(0), /**< With SYN flag. */
3137 	RTE_FLOW_CONNTRACK_FLAG_SYNACK = RTE_BIT32(1), /**< With SYNACK flag. */
3138 	RTE_FLOW_CONNTRACK_FLAG_FIN = RTE_BIT32(2), /**< With FIN flag. */
3139 	RTE_FLOW_CONNTRACK_FLAG_ACK = RTE_BIT32(3), /**< With ACK flag. */
3140 	RTE_FLOW_CONNTRACK_FLAG_RST = RTE_BIT32(4), /**< With RST flag. */
3141 };
3142 
3143 /**
3144  * @warning
3145  * @b EXPERIMENTAL: this structure may change without prior notice
3146  *
3147  * Configuration parameters for each direction of a TCP connection.
3148  * All fields should be in host byte order.
3149  * If needed, driver should convert all fields to network byte order
3150  * if HW needs them in that way.
3151  */
3152 struct rte_flow_tcp_dir_param {
3153 	/** TCP window scaling factor, 0xF to disable. */
3154 	uint32_t scale:4;
3155 	/** The FIN was sent by this direction. */
3156 	uint32_t close_initiated:1;
3157 	/** An ACK packet has been received by this side. */
3158 	uint32_t last_ack_seen:1;
3159 	/**
3160 	 * If set, it indicates that there is unacknowledged data for the
3161 	 * packets sent from this direction.
3162 	 */
3163 	uint32_t data_unacked:1;
3164 	/**
3165 	 * Maximal value of sequence + payload length in sent
3166 	 * packets (next ACK from the opposite direction).
3167 	 */
3168 	uint32_t sent_end;
3169 	/**
3170 	 * Maximal value of (ACK + window size) in received packet + length
3171 	 * over sent packet (maximal sequence could be sent).
3172 	 */
3173 	uint32_t reply_end;
3174 	/** Maximal value of actual window size in sent packets. */
3175 	uint32_t max_win;
3176 	/** Maximal value of ACK in sent packets. */
3177 	uint32_t max_ack;
3178 };
3179 
3180 /**
3181  * @warning
3182  * @b EXPERIMENTAL: this structure may change without prior notice
3183  *
3184  * RTE_FLOW_ACTION_TYPE_CONNTRACK
3185  *
3186  * Configuration and initial state for the connection tracking module.
3187  * This structure could be used for both setting and query.
3188  * All fields should be in host byte order.
3189  */
3190 struct rte_flow_action_conntrack {
3191 	/** The peer port number, can be the same port. */
3192 	uint16_t peer_port;
3193 	/**
3194 	 * Direction of this connection when creating a flow rule, the
3195 	 * value only affects the creation of subsequent flow rules.
3196 	 */
3197 	uint32_t is_original_dir:1;
3198 	/**
3199 	 * Enable / disable the conntrack HW module. When disabled, the
3200 	 * result will always be RTE_FLOW_CONNTRACK_FLAG_DISABLED.
3201 	 * In this state the HW will act as passthrough.
3202 	 * It only affects this conntrack object in the HW without any effect
3203 	 * to the other objects.
3204 	 */
3205 	uint32_t enable:1;
3206 	/** At least one ack was seen after the connection was established. */
3207 	uint32_t live_connection:1;
3208 	/** Enable selective ACK on this connection. */
3209 	uint32_t selective_ack:1;
3210 	/** A challenge ack has passed. */
3211 	uint32_t challenge_ack_passed:1;
3212 	/**
3213 	 * 1: The last packet is seen from the original direction.
3214 	 * 0: The last packet is seen from the reply direction.
3215 	 */
3216 	uint32_t last_direction:1;
3217 	/** No TCP check will be done except the state change. */
3218 	uint32_t liberal_mode:1;
3219 	/**<The current state of this connection. */
3220 	enum rte_flow_conntrack_state state;
3221 	/** Scaling factor for maximal allowed ACK window. */
3222 	uint8_t max_ack_window;
3223 	/** Maximal allowed number of retransmission times. */
3224 	uint8_t retransmission_limit;
3225 	/** TCP parameters of the original direction. */
3226 	struct rte_flow_tcp_dir_param original_dir;
3227 	/** TCP parameters of the reply direction. */
3228 	struct rte_flow_tcp_dir_param reply_dir;
3229 	/** The window value of the last packet passed this conntrack. */
3230 	uint16_t last_window;
3231 	enum rte_flow_conntrack_tcp_last_index last_index;
3232 	/** The sequence of the last packet passed this conntrack. */
3233 	uint32_t last_seq;
3234 	/** The acknowledgment of the last packet passed this conntrack. */
3235 	uint32_t last_ack;
3236 	/**
3237 	 * The total value ACK + payload length of the last packet
3238 	 * passed this conntrack.
3239 	 */
3240 	uint32_t last_end;
3241 };
3242 
3243 /**
3244  * RTE_FLOW_ACTION_TYPE_CONNTRACK
3245  *
3246  * Wrapper structure for the context update interface.
3247  * Ports cannot support updating, and the only valid solution is to
3248  * destroy the old context and create a new one instead.
3249  */
3250 struct rte_flow_modify_conntrack {
3251 	/** New connection tracking parameters to be updated. */
3252 	struct rte_flow_action_conntrack new_ct;
3253 	/** The direction field will be updated. */
3254 	uint32_t direction:1;
3255 	/** All the other fields except direction will be updated. */
3256 	uint32_t state:1;
3257 	/** Reserved bits for the future usage. */
3258 	uint32_t reserved:30;
3259 };
3260 
3261 /**
3262  * @warning
3263  * @b EXPERIMENTAL: this structure may change without prior notice
3264  *
3265  * RTE_FLOW_ACTION_TYPE_METER_COLOR
3266  *
3267  * The meter color should be set in the packet meta-data
3268  * (i.e. struct rte_mbuf::sched::color).
3269  */
3270 struct rte_flow_action_meter_color {
3271 	enum rte_color color; /**< Packet color. */
3272 };
3273 
3274 /**
3275  * @warning
3276  * @b EXPERIMENTAL: this structure may change without prior notice
3277  *
3278  * Provides an ethdev port ID for use with the following actions:
3279  * RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
3280  * RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT.
3281  */
3282 struct rte_flow_action_ethdev {
3283 	uint16_t port_id; /**< ethdev port ID */
3284 };
3285 
3286 /**
3287  * Field IDs for MODIFY_FIELD action.
3288  */
3289 enum rte_flow_field_id {
3290 	RTE_FLOW_FIELD_START = 0,	/**< Start of a packet. */
3291 	RTE_FLOW_FIELD_MAC_DST,		/**< Destination MAC Address. */
3292 	RTE_FLOW_FIELD_MAC_SRC,		/**< Source MAC Address. */
3293 	RTE_FLOW_FIELD_VLAN_TYPE,	/**< 802.1Q Tag Identifier. */
3294 	RTE_FLOW_FIELD_VLAN_ID,		/**< 802.1Q VLAN Identifier. */
3295 	RTE_FLOW_FIELD_MAC_TYPE,	/**< EtherType. */
3296 	RTE_FLOW_FIELD_IPV4_DSCP,	/**< IPv4 DSCP. */
3297 	RTE_FLOW_FIELD_IPV4_TTL,	/**< IPv4 Time To Live. */
3298 	RTE_FLOW_FIELD_IPV4_SRC,	/**< IPv4 Source Address. */
3299 	RTE_FLOW_FIELD_IPV4_DST,	/**< IPv4 Destination Address. */
3300 	RTE_FLOW_FIELD_IPV6_DSCP,	/**< IPv6 DSCP. */
3301 	RTE_FLOW_FIELD_IPV6_HOPLIMIT,	/**< IPv6 Hop Limit. */
3302 	RTE_FLOW_FIELD_IPV6_SRC,	/**< IPv6 Source Address. */
3303 	RTE_FLOW_FIELD_IPV6_DST,	/**< IPv6 Destination Address. */
3304 	RTE_FLOW_FIELD_TCP_PORT_SRC,	/**< TCP Source Port Number. */
3305 	RTE_FLOW_FIELD_TCP_PORT_DST,	/**< TCP Destination Port Number. */
3306 	RTE_FLOW_FIELD_TCP_SEQ_NUM,	/**< TCP Sequence Number. */
3307 	RTE_FLOW_FIELD_TCP_ACK_NUM,	/**< TCP Acknowledgment Number. */
3308 	RTE_FLOW_FIELD_TCP_FLAGS,	/**< TCP Flags. */
3309 	RTE_FLOW_FIELD_UDP_PORT_SRC,	/**< UDP Source Port Number. */
3310 	RTE_FLOW_FIELD_UDP_PORT_DST,	/**< UDP Destination Port Number. */
3311 	RTE_FLOW_FIELD_VXLAN_VNI,	/**< VXLAN Network Identifier. */
3312 	RTE_FLOW_FIELD_GENEVE_VNI,	/**< GENEVE Network Identifier. */
3313 	RTE_FLOW_FIELD_GTP_TEID,	/**< GTP Tunnel Endpoint Identifier. */
3314 	RTE_FLOW_FIELD_TAG,		/**< Tag value. */
3315 	RTE_FLOW_FIELD_MARK,		/**< Mark value. */
3316 	RTE_FLOW_FIELD_META,		/**< Metadata value. */
3317 	RTE_FLOW_FIELD_POINTER,		/**< Memory pointer. */
3318 	RTE_FLOW_FIELD_VALUE,		/**< Immediate value. */
3319 };
3320 
3321 /**
3322  * Field description for MODIFY_FIELD action.
3323  */
3324 struct rte_flow_action_modify_data {
3325 	enum rte_flow_field_id field; /**< Field or memory type ID. */
3326 	RTE_STD_C11
3327 	union {
3328 		struct {
3329 			/**< Encapsulation level or tag index. */
3330 			uint32_t level;
3331 			/**< Number of bits to skip from a field. */
3332 			uint32_t offset;
3333 		};
3334 		/**
3335 		 * Immediate value for RTE_FLOW_FIELD_VALUE or
3336 		 * memory address for RTE_FLOW_FIELD_POINTER.
3337 		 */
3338 		uint64_t value;
3339 	};
3340 };
3341 
3342 /**
3343  * Operation types for MODIFY_FIELD action.
3344  */
3345 enum rte_flow_modify_op {
3346 	RTE_FLOW_MODIFY_SET = 0, /**< Set a new value. */
3347 	RTE_FLOW_MODIFY_ADD,     /**< Add a value to a field.  */
3348 	RTE_FLOW_MODIFY_SUB,     /**< Subtract a value from a field. */
3349 };
3350 
3351 /**
3352  * @warning
3353  * @b EXPERIMENTAL: this structure may change without prior notice
3354  *
3355  * RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3356  *
3357  * Modify a destination header field according to the specified
3358  * operation. Another packet field can be used as a source as well
3359  * as tag, mark, metadata, immediate value or a pointer to it.
3360  */
3361 struct rte_flow_action_modify_field {
3362 	enum rte_flow_modify_op operation; /**< Operation to perform. */
3363 	struct rte_flow_action_modify_data dst; /**< Destination field. */
3364 	struct rte_flow_action_modify_data src; /**< Source field. */
3365 	uint32_t width; /**< Number of bits to use from a source field. */
3366 };
3367 
3368 /* Mbuf dynamic field offset for metadata. */
3369 extern int32_t rte_flow_dynf_metadata_offs;
3370 
3371 /* Mbuf dynamic field flag mask for metadata. */
3372 extern uint64_t rte_flow_dynf_metadata_mask;
3373 
3374 /* Mbuf dynamic field pointer for metadata. */
3375 #define RTE_FLOW_DYNF_METADATA(m) \
3376 	RTE_MBUF_DYNFIELD((m), rte_flow_dynf_metadata_offs, uint32_t *)
3377 
3378 /* Mbuf dynamic flags for metadata. */
3379 #define PKT_RX_DYNF_METADATA (rte_flow_dynf_metadata_mask)
3380 #define PKT_TX_DYNF_METADATA (rte_flow_dynf_metadata_mask)
3381 
3382 __rte_experimental
3383 static inline uint32_t
3384 rte_flow_dynf_metadata_get(struct rte_mbuf *m)
3385 {
3386 	return *RTE_FLOW_DYNF_METADATA(m);
3387 }
3388 
3389 __rte_experimental
3390 static inline void
3391 rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v)
3392 {
3393 	*RTE_FLOW_DYNF_METADATA(m) = v;
3394 }
3395 
3396 /**
3397  * Definition of a single action.
3398  *
3399  * A list of actions is terminated by a END action.
3400  *
3401  * For simple actions without a configuration object, conf remains NULL.
3402  */
3403 struct rte_flow_action {
3404 	enum rte_flow_action_type type; /**< Action type. */
3405 	const void *conf; /**< Pointer to action configuration object. */
3406 };
3407 
3408 /**
3409  * Opaque type returned after successfully creating a flow.
3410  *
3411  * This handle can be used to manage and query the related flow (e.g. to
3412  * destroy it or retrieve counters).
3413  */
3414 struct rte_flow;
3415 
3416 /**
3417  * @warning
3418  * @b EXPERIMENTAL: this structure may change without prior notice
3419  *
3420  * RTE_FLOW_ACTION_TYPE_SAMPLE
3421  *
3422  * Adds a sample action to a matched flow.
3423  *
3424  * The matching packets will be duplicated with specified ratio and applied
3425  * with own set of actions with a fate action, the sampled packet could be
3426  * redirected to queue or port. All the packets continue processing on the
3427  * default flow path.
3428  *
3429  * When the sample ratio is set to 1 then the packets will be 100% mirrored.
3430  * Additional action list be supported to add for sampled or mirrored packets.
3431  */
3432 struct rte_flow_action_sample {
3433 	uint32_t ratio; /**< packets sampled equals to '1/ratio'. */
3434 	const struct rte_flow_action *actions;
3435 		/**< sub-action list specific for the sampling hit cases. */
3436 };
3437 
3438 /**
3439  * Verbose error types.
3440  *
3441  * Most of them provide the type of the object referenced by struct
3442  * rte_flow_error.cause.
3443  */
3444 enum rte_flow_error_type {
3445 	RTE_FLOW_ERROR_TYPE_NONE, /**< No error. */
3446 	RTE_FLOW_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
3447 	RTE_FLOW_ERROR_TYPE_HANDLE, /**< Flow rule (handle). */
3448 	RTE_FLOW_ERROR_TYPE_ATTR_GROUP, /**< Group field. */
3449 	RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, /**< Priority field. */
3450 	RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, /**< Ingress field. */
3451 	RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, /**< Egress field. */
3452 	RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, /**< Transfer field. */
3453 	RTE_FLOW_ERROR_TYPE_ATTR, /**< Attributes structure. */
3454 	RTE_FLOW_ERROR_TYPE_ITEM_NUM, /**< Pattern length. */
3455 	RTE_FLOW_ERROR_TYPE_ITEM_SPEC, /**< Item specification. */
3456 	RTE_FLOW_ERROR_TYPE_ITEM_LAST, /**< Item specification range. */
3457 	RTE_FLOW_ERROR_TYPE_ITEM_MASK, /**< Item specification mask. */
3458 	RTE_FLOW_ERROR_TYPE_ITEM, /**< Specific pattern item. */
3459 	RTE_FLOW_ERROR_TYPE_ACTION_NUM, /**< Number of actions. */
3460 	RTE_FLOW_ERROR_TYPE_ACTION_CONF, /**< Action configuration. */
3461 	RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */
3462 };
3463 
3464 /**
3465  * Verbose error structure definition.
3466  *
3467  * This object is normally allocated by applications and set by PMDs, the
3468  * message points to a constant string which does not need to be freed by
3469  * the application, however its pointer can be considered valid only as long
3470  * as its associated DPDK port remains configured. Closing the underlying
3471  * device or unloading the PMD invalidates it.
3472  *
3473  * Both cause and message may be NULL regardless of the error type.
3474  */
3475 struct rte_flow_error {
3476 	enum rte_flow_error_type type; /**< Cause field and error types. */
3477 	const void *cause; /**< Object responsible for the error. */
3478 	const char *message; /**< Human-readable error message. */
3479 };
3480 
3481 /**
3482  * Complete flow rule description.
3483  *
3484  * This object type is used when converting a flow rule description.
3485  *
3486  * @see RTE_FLOW_CONV_OP_RULE
3487  * @see rte_flow_conv()
3488  */
3489 RTE_STD_C11
3490 struct rte_flow_conv_rule {
3491 	union {
3492 		const struct rte_flow_attr *attr_ro; /**< RO attributes. */
3493 		struct rte_flow_attr *attr; /**< Attributes. */
3494 	};
3495 	union {
3496 		const struct rte_flow_item *pattern_ro; /**< RO pattern. */
3497 		struct rte_flow_item *pattern; /**< Pattern items. */
3498 	};
3499 	union {
3500 		const struct rte_flow_action *actions_ro; /**< RO actions. */
3501 		struct rte_flow_action *actions; /**< List of actions. */
3502 	};
3503 };
3504 
3505 /**
3506  * Conversion operations for flow API objects.
3507  *
3508  * @see rte_flow_conv()
3509  */
3510 enum rte_flow_conv_op {
3511 	/**
3512 	 * No operation to perform.
3513 	 *
3514 	 * rte_flow_conv() simply returns 0.
3515 	 */
3516 	RTE_FLOW_CONV_OP_NONE,
3517 
3518 	/**
3519 	 * Convert attributes structure.
3520 	 *
3521 	 * This is a basic copy of an attributes structure.
3522 	 *
3523 	 * - @p src type:
3524 	 *   @code const struct rte_flow_attr * @endcode
3525 	 * - @p dst type:
3526 	 *   @code struct rte_flow_attr * @endcode
3527 	 */
3528 	RTE_FLOW_CONV_OP_ATTR,
3529 
3530 	/**
3531 	 * Convert a single item.
3532 	 *
3533 	 * Duplicates @p spec, @p last and @p mask but not outside objects.
3534 	 *
3535 	 * - @p src type:
3536 	 *   @code const struct rte_flow_item * @endcode
3537 	 * - @p dst type:
3538 	 *   @code struct rte_flow_item * @endcode
3539 	 */
3540 	RTE_FLOW_CONV_OP_ITEM,
3541 
3542 	/**
3543 	 * Convert a single action.
3544 	 *
3545 	 * Duplicates @p conf but not outside objects.
3546 	 *
3547 	 * - @p src type:
3548 	 *   @code const struct rte_flow_action * @endcode
3549 	 * - @p dst type:
3550 	 *   @code struct rte_flow_action * @endcode
3551 	 */
3552 	RTE_FLOW_CONV_OP_ACTION,
3553 
3554 	/**
3555 	 * Convert an entire pattern.
3556 	 *
3557 	 * Duplicates all pattern items at once with the same constraints as
3558 	 * RTE_FLOW_CONV_OP_ITEM.
3559 	 *
3560 	 * - @p src type:
3561 	 *   @code const struct rte_flow_item * @endcode
3562 	 * - @p dst type:
3563 	 *   @code struct rte_flow_item * @endcode
3564 	 */
3565 	RTE_FLOW_CONV_OP_PATTERN,
3566 
3567 	/**
3568 	 * Convert a list of actions.
3569 	 *
3570 	 * Duplicates the entire list of actions at once with the same
3571 	 * constraints as RTE_FLOW_CONV_OP_ACTION.
3572 	 *
3573 	 * - @p src type:
3574 	 *   @code const struct rte_flow_action * @endcode
3575 	 * - @p dst type:
3576 	 *   @code struct rte_flow_action * @endcode
3577 	 */
3578 	RTE_FLOW_CONV_OP_ACTIONS,
3579 
3580 	/**
3581 	 * Convert a complete flow rule description.
3582 	 *
3583 	 * Comprises attributes, pattern and actions together at once with
3584 	 * the usual constraints.
3585 	 *
3586 	 * - @p src type:
3587 	 *   @code const struct rte_flow_conv_rule * @endcode
3588 	 * - @p dst type:
3589 	 *   @code struct rte_flow_conv_rule * @endcode
3590 	 */
3591 	RTE_FLOW_CONV_OP_RULE,
3592 
3593 	/**
3594 	 * Convert item type to its name string.
3595 	 *
3596 	 * Writes a NUL-terminated string to @p dst. Like snprintf(), the
3597 	 * returned value excludes the terminator which is always written
3598 	 * nonetheless.
3599 	 *
3600 	 * - @p src type:
3601 	 *   @code (const void *)enum rte_flow_item_type @endcode
3602 	 * - @p dst type:
3603 	 *   @code char * @endcode
3604 	 **/
3605 	RTE_FLOW_CONV_OP_ITEM_NAME,
3606 
3607 	/**
3608 	 * Convert action type to its name string.
3609 	 *
3610 	 * Writes a NUL-terminated string to @p dst. Like snprintf(), the
3611 	 * returned value excludes the terminator which is always written
3612 	 * nonetheless.
3613 	 *
3614 	 * - @p src type:
3615 	 *   @code (const void *)enum rte_flow_action_type @endcode
3616 	 * - @p dst type:
3617 	 *   @code char * @endcode
3618 	 **/
3619 	RTE_FLOW_CONV_OP_ACTION_NAME,
3620 
3621 	/**
3622 	 * Convert item type to pointer to item name.
3623 	 *
3624 	 * Retrieves item name pointer from its type. The string itself is
3625 	 * not copied; instead, a unique pointer to an internal static
3626 	 * constant storage is written to @p dst.
3627 	 *
3628 	 * - @p src type:
3629 	 *   @code (const void *)enum rte_flow_item_type @endcode
3630 	 * - @p dst type:
3631 	 *   @code const char ** @endcode
3632 	 */
3633 	RTE_FLOW_CONV_OP_ITEM_NAME_PTR,
3634 
3635 	/**
3636 	 * Convert action type to pointer to action name.
3637 	 *
3638 	 * Retrieves action name pointer from its type. The string itself is
3639 	 * not copied; instead, a unique pointer to an internal static
3640 	 * constant storage is written to @p dst.
3641 	 *
3642 	 * - @p src type:
3643 	 *   @code (const void *)enum rte_flow_action_type @endcode
3644 	 * - @p dst type:
3645 	 *   @code const char ** @endcode
3646 	 */
3647 	RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
3648 };
3649 
3650 /**
3651  * @warning
3652  * @b EXPERIMENTAL: this API may change without prior notice.
3653  *
3654  * Dump hardware internal representation information of
3655  * rte flow to file.
3656  *
3657  * @param[in] port_id
3658  *    The port identifier of the Ethernet device.
3659  * @param[in] flow
3660  *   The pointer of flow rule to dump. Dump all rules if NULL.
3661  * @param[in] file
3662  *   A pointer to a file for output.
3663  * @param[out] error
3664  *   Perform verbose error reporting if not NULL. PMDs initialize this
3665  *   structure in case of error only.
3666  * @return
3667  *   0 on success, a nagative value otherwise.
3668  */
3669 __rte_experimental
3670 int
3671 rte_flow_dev_dump(uint16_t port_id, struct rte_flow *flow,
3672 		FILE *file, struct rte_flow_error *error);
3673 
3674 /**
3675  * Check if mbuf dynamic field for metadata is registered.
3676  *
3677  * @return
3678  *   True if registered, false otherwise.
3679  */
3680 __rte_experimental
3681 static inline int
3682 rte_flow_dynf_metadata_avail(void)
3683 {
3684 	return !!rte_flow_dynf_metadata_mask;
3685 }
3686 
3687 /**
3688  * Register mbuf dynamic field and flag for metadata.
3689  *
3690  * This function must be called prior to use SET_META action in order to
3691  * register the dynamic mbuf field. Otherwise, the data cannot be delivered to
3692  * application.
3693  *
3694  * @return
3695  *   0 on success, a negative errno value otherwise and rte_errno is set.
3696  */
3697 __rte_experimental
3698 int
3699 rte_flow_dynf_metadata_register(void);
3700 
3701 /**
3702  * Check whether a flow rule can be created on a given port.
3703  *
3704  * The flow rule is validated for correctness and whether it could be accepted
3705  * by the device given sufficient resources. The rule is checked against the
3706  * current device mode and queue configuration. The flow rule may also
3707  * optionally be validated against existing flow rules and device resources.
3708  * This function has no effect on the target device.
3709  *
3710  * The returned value is guaranteed to remain valid only as long as no
3711  * successful calls to rte_flow_create() or rte_flow_destroy() are made in
3712  * the meantime and no device parameter affecting flow rules in any way are
3713  * modified, due to possible collisions or resource limitations (although in
3714  * such cases EINVAL should not be returned).
3715  *
3716  * @param port_id
3717  *   Port identifier of Ethernet device.
3718  * @param[in] attr
3719  *   Flow rule attributes.
3720  * @param[in] pattern
3721  *   Pattern specification (list terminated by the END pattern item).
3722  * @param[in] actions
3723  *   Associated actions (list terminated by the END action).
3724  * @param[out] error
3725  *   Perform verbose error reporting if not NULL. PMDs initialize this
3726  *   structure in case of error only.
3727  *
3728  * @return
3729  *   0 if flow rule is valid and can be created. A negative errno value
3730  *   otherwise (rte_errno is also set), the following errors are defined:
3731  *
3732  *   -ENOSYS: underlying device does not support this functionality.
3733  *
3734  *   -EIO: underlying device is removed.
3735  *
3736  *   -EINVAL: unknown or invalid rule specification.
3737  *
3738  *   -ENOTSUP: valid but unsupported rule specification (e.g. partial
3739  *   bit-masks are unsupported).
3740  *
3741  *   -EEXIST: collision with an existing rule. Only returned if device
3742  *   supports flow rule collision checking and there was a flow rule
3743  *   collision. Not receiving this return code is no guarantee that creating
3744  *   the rule will not fail due to a collision.
3745  *
3746  *   -ENOMEM: not enough memory to execute the function, or if the device
3747  *   supports resource validation, resource limitation on the device.
3748  *
3749  *   -EBUSY: action cannot be performed due to busy device resources, may
3750  *   succeed if the affected queues or even the entire port are in a stopped
3751  *   state (see rte_eth_dev_rx_queue_stop() and rte_eth_dev_stop()).
3752  */
3753 int
3754 rte_flow_validate(uint16_t port_id,
3755 		  const struct rte_flow_attr *attr,
3756 		  const struct rte_flow_item pattern[],
3757 		  const struct rte_flow_action actions[],
3758 		  struct rte_flow_error *error);
3759 
3760 /**
3761  * Create a flow rule on a given port.
3762  *
3763  * @param port_id
3764  *   Port identifier of Ethernet device.
3765  * @param[in] attr
3766  *   Flow rule attributes.
3767  * @param[in] pattern
3768  *   Pattern specification (list terminated by the END pattern item).
3769  * @param[in] actions
3770  *   Associated actions (list terminated by the END action).
3771  * @param[out] error
3772  *   Perform verbose error reporting if not NULL. PMDs initialize this
3773  *   structure in case of error only.
3774  *
3775  * @return
3776  *   A valid handle in case of success, NULL otherwise and rte_errno is set
3777  *   to the positive version of one of the error codes defined for
3778  *   rte_flow_validate().
3779  */
3780 struct rte_flow *
3781 rte_flow_create(uint16_t port_id,
3782 		const struct rte_flow_attr *attr,
3783 		const struct rte_flow_item pattern[],
3784 		const struct rte_flow_action actions[],
3785 		struct rte_flow_error *error);
3786 
3787 /**
3788  * Destroy a flow rule on a given port.
3789  *
3790  * Failure to destroy a flow rule handle may occur when other flow rules
3791  * depend on it, and destroying it would result in an inconsistent state.
3792  *
3793  * This function is only guaranteed to succeed if handles are destroyed in
3794  * reverse order of their creation.
3795  *
3796  * @param port_id
3797  *   Port identifier of Ethernet device.
3798  * @param flow
3799  *   Flow rule handle to destroy.
3800  * @param[out] error
3801  *   Perform verbose error reporting if not NULL. PMDs initialize this
3802  *   structure in case of error only.
3803  *
3804  * @return
3805  *   0 on success, a negative errno value otherwise and rte_errno is set.
3806  */
3807 int
3808 rte_flow_destroy(uint16_t port_id,
3809 		 struct rte_flow *flow,
3810 		 struct rte_flow_error *error);
3811 
3812 /**
3813  * Destroy all flow rules associated with a port.
3814  *
3815  * In the unlikely event of failure, handles are still considered destroyed
3816  * and no longer valid but the port must be assumed to be in an inconsistent
3817  * state.
3818  *
3819  * @param port_id
3820  *   Port identifier of Ethernet device.
3821  * @param[out] error
3822  *   Perform verbose error reporting if not NULL. PMDs initialize this
3823  *   structure in case of error only.
3824  *
3825  * @return
3826  *   0 on success, a negative errno value otherwise and rte_errno is set.
3827  */
3828 int
3829 rte_flow_flush(uint16_t port_id,
3830 	       struct rte_flow_error *error);
3831 
3832 /**
3833  * Query an existing flow rule.
3834  *
3835  * This function allows retrieving flow-specific data such as counters.
3836  * Data is gathered by special actions which must be present in the flow
3837  * rule definition.
3838  *
3839  * \see RTE_FLOW_ACTION_TYPE_COUNT
3840  *
3841  * @param port_id
3842  *   Port identifier of Ethernet device.
3843  * @param flow
3844  *   Flow rule handle to query.
3845  * @param action
3846  *   Action definition as defined in original flow rule.
3847  * @param[in, out] data
3848  *   Pointer to storage for the associated query data type.
3849  * @param[out] error
3850  *   Perform verbose error reporting if not NULL. PMDs initialize this
3851  *   structure in case of error only.
3852  *
3853  * @return
3854  *   0 on success, a negative errno value otherwise and rte_errno is set.
3855  */
3856 int
3857 rte_flow_query(uint16_t port_id,
3858 	       struct rte_flow *flow,
3859 	       const struct rte_flow_action *action,
3860 	       void *data,
3861 	       struct rte_flow_error *error);
3862 
3863 /**
3864  * Restrict ingress traffic to the defined flow rules.
3865  *
3866  * Isolated mode guarantees that all ingress traffic comes from defined flow
3867  * rules only (current and future).
3868  *
3869  * Besides making ingress more deterministic, it allows PMDs to safely reuse
3870  * resources otherwise assigned to handle the remaining traffic, such as
3871  * global RSS configuration settings, VLAN filters, MAC address entries,
3872  * legacy filter API rules and so on in order to expand the set of possible
3873  * flow rule types.
3874  *
3875  * Calling this function as soon as possible after device initialization,
3876  * ideally before the first call to rte_eth_dev_configure(), is recommended
3877  * to avoid possible failures due to conflicting settings.
3878  *
3879  * Once effective, leaving isolated mode may not be possible depending on
3880  * PMD implementation.
3881  *
3882  * Additionally, the following functionality has no effect on the underlying
3883  * port and may return errors such as ENOTSUP ("not supported"):
3884  *
3885  * - Toggling promiscuous mode.
3886  * - Toggling allmulticast mode.
3887  * - Configuring MAC addresses.
3888  * - Configuring multicast addresses.
3889  * - Configuring VLAN filters.
3890  * - Configuring Rx filters through the legacy API (e.g. FDIR).
3891  * - Configuring global RSS settings.
3892  *
3893  * @param port_id
3894  *   Port identifier of Ethernet device.
3895  * @param set
3896  *   Nonzero to enter isolated mode, attempt to leave it otherwise.
3897  * @param[out] error
3898  *   Perform verbose error reporting if not NULL. PMDs initialize this
3899  *   structure in case of error only.
3900  *
3901  * @return
3902  *   0 on success, a negative errno value otherwise and rte_errno is set.
3903  */
3904 int
3905 rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
3906 
3907 /**
3908  * Initialize flow error structure.
3909  *
3910  * @param[out] error
3911  *   Pointer to flow error structure (may be NULL).
3912  * @param code
3913  *   Related error code (rte_errno).
3914  * @param type
3915  *   Cause field and error types.
3916  * @param cause
3917  *   Object responsible for the error.
3918  * @param message
3919  *   Human-readable error message.
3920  *
3921  * @return
3922  *   Negative error code (errno value) and rte_errno is set.
3923  */
3924 int
3925 rte_flow_error_set(struct rte_flow_error *error,
3926 		   int code,
3927 		   enum rte_flow_error_type type,
3928 		   const void *cause,
3929 		   const char *message);
3930 
3931 /**
3932  * @deprecated
3933  * @see rte_flow_copy()
3934  */
3935 struct rte_flow_desc {
3936 	size_t size; /**< Allocated space including data[]. */
3937 	struct rte_flow_attr attr; /**< Attributes. */
3938 	struct rte_flow_item *items; /**< Items. */
3939 	struct rte_flow_action *actions; /**< Actions. */
3940 	uint8_t data[]; /**< Storage for items/actions. */
3941 };
3942 
3943 /**
3944  * @deprecated
3945  * Copy an rte_flow rule description.
3946  *
3947  * This interface is kept for compatibility with older applications but is
3948  * implemented as a wrapper to rte_flow_conv(). It is deprecated due to its
3949  * lack of flexibility and reliance on a type unusable with C++ programs
3950  * (struct rte_flow_desc).
3951  *
3952  * @param[in] fd
3953  *   Flow rule description.
3954  * @param[in] len
3955  *   Total size of allocated data for the flow description.
3956  * @param[in] attr
3957  *   Flow rule attributes.
3958  * @param[in] items
3959  *   Pattern specification (list terminated by the END pattern item).
3960  * @param[in] actions
3961  *   Associated actions (list terminated by the END action).
3962  *
3963  * @return
3964  *   If len is greater or equal to the size of the flow, the total size of the
3965  *   flow description and its data.
3966  *   If len is lower than the size of the flow, the number of bytes that would
3967  *   have been written to desc had it been sufficient. Nothing is written.
3968  */
3969 __rte_deprecated
3970 size_t
3971 rte_flow_copy(struct rte_flow_desc *fd, size_t len,
3972 	      const struct rte_flow_attr *attr,
3973 	      const struct rte_flow_item *items,
3974 	      const struct rte_flow_action *actions);
3975 
3976 /**
3977  * Flow object conversion helper.
3978  *
3979  * This function performs conversion of various flow API objects to a
3980  * pre-allocated destination buffer. See enum rte_flow_conv_op for possible
3981  * operations and details about each of them.
3982  *
3983  * Since destination buffer must be large enough, it works in a manner
3984  * reminiscent of snprintf():
3985  *
3986  * - If @p size is 0, @p dst may be a NULL pointer, otherwise @p dst must be
3987  *   non-NULL.
3988  * - If positive, the returned value represents the number of bytes needed
3989  *   to store the conversion of @p src to @p dst according to @p op
3990  *   regardless of the @p size parameter.
3991  * - Since no more than @p size bytes can be written to @p dst, output is
3992  *   truncated and may be inconsistent when the returned value is larger
3993  *   than that.
3994  * - In case of conversion error, a negative error code is returned and
3995  *   @p dst contents are unspecified.
3996  *
3997  * @param op
3998  *   Operation to perform, related to the object type of @p dst.
3999  * @param[out] dst
4000  *   Destination buffer address. Must be suitably aligned by the caller.
4001  * @param size
4002  *   Destination buffer size in bytes.
4003  * @param[in] src
4004  *   Source object to copy. Depending on @p op, its type may differ from
4005  *   that of @p dst.
4006  * @param[out] error
4007  *   Perform verbose error reporting if not NULL. Initialized in case of
4008  *   error only.
4009  *
4010  * @return
4011  *   The number of bytes required to convert @p src to @p dst on success, a
4012  *   negative errno value otherwise and rte_errno is set.
4013  *
4014  * @see rte_flow_conv_op
4015  */
4016 __rte_experimental
4017 int
4018 rte_flow_conv(enum rte_flow_conv_op op,
4019 	      void *dst,
4020 	      size_t size,
4021 	      const void *src,
4022 	      struct rte_flow_error *error);
4023 
4024 /**
4025  * Get aged-out flows of a given port.
4026  *
4027  * RTE_ETH_EVENT_FLOW_AGED event will be triggered when at least one new aged
4028  * out flow was detected after the last call to rte_flow_get_aged_flows.
4029  * This function can be called to get the aged flows usynchronously from the
4030  * event callback or synchronously regardless the event.
4031  * This is not safe to call rte_flow_get_aged_flows function with other flow
4032  * functions from multiple threads simultaneously.
4033  *
4034  * @param port_id
4035  *   Port identifier of Ethernet device.
4036  * @param[in, out] contexts
4037  *   The address of an array of pointers to the aged-out flows contexts.
4038  * @param[in] nb_contexts
4039  *   The length of context array pointers.
4040  * @param[out] error
4041  *   Perform verbose error reporting if not NULL. Initialized in case of
4042  *   error only.
4043  *
4044  * @return
4045  *   if nb_contexts is 0, return the amount of all aged contexts.
4046  *   if nb_contexts is not 0 , return the amount of aged flows reported
4047  *   in the context array, otherwise negative errno value.
4048  *
4049  * @see rte_flow_action_age
4050  * @see RTE_ETH_EVENT_FLOW_AGED
4051  */
4052 __rte_experimental
4053 int
4054 rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
4055 			uint32_t nb_contexts, struct rte_flow_error *error);
4056 
4057 /**
4058  * Specify indirect action object configuration
4059  */
4060 struct rte_flow_indir_action_conf {
4061 	/**
4062 	 * Flow direction for the indirect action configuration.
4063 	 *
4064 	 * Action should be valid at least for one flow direction,
4065 	 * otherwise it is invalid for both ingress and egress rules.
4066 	 */
4067 	uint32_t ingress:1;
4068 	/**< Action valid for rules applied to ingress traffic. */
4069 	uint32_t egress:1;
4070 	/**< Action valid for rules applied to egress traffic. */
4071 	/**
4072 	 * When set to 1, indicates that the action is valid for
4073 	 * transfer traffic; otherwise, for non-transfer traffic.
4074 	 */
4075 	uint32_t transfer:1;
4076 };
4077 
4078 /**
4079  * @warning
4080  * @b EXPERIMENTAL: this API may change without prior notice.
4081  *
4082  * Create an indirect action object that can be used in flow rules
4083  * via its handle.
4084  * The created object handle has single state and configuration
4085  * across all the flow rules using it.
4086  *
4087  * @param[in] port_id
4088  *    The port identifier of the Ethernet device.
4089  * @param[in] conf
4090  *   Action configuration for the indirect action object creation.
4091  * @param[in] action
4092  *   Specific configuration of the indirect action object.
4093  * @param[out] error
4094  *   Perform verbose error reporting if not NULL. PMDs initialize this
4095  *   structure in case of error only.
4096  * @return
4097  *   A valid handle in case of success, NULL otherwise and rte_errno is set
4098  *   to one of the error codes defined:
4099  *   - (ENODEV) if *port_id* invalid.
4100  *   - (ENOSYS) if underlying device does not support this functionality.
4101  *   - (EIO) if underlying device is removed.
4102  *   - (EINVAL) if *action* invalid.
4103  *   - (ENOTSUP) if *action* valid but unsupported.
4104  */
4105 __rte_experimental
4106 struct rte_flow_action_handle *
4107 rte_flow_action_handle_create(uint16_t port_id,
4108 			      const struct rte_flow_indir_action_conf *conf,
4109 			      const struct rte_flow_action *action,
4110 			      struct rte_flow_error *error);
4111 
4112 /**
4113  * @warning
4114  * @b EXPERIMENTAL: this API may change without prior notice.
4115  *
4116  * Destroy indirect action by handle.
4117  *
4118  * @param[in] port_id
4119  *    The port identifier of the Ethernet device.
4120  * @param[in] handle
4121  *   Handle for the indirect action object to be destroyed.
4122  * @param[out] error
4123  *   Perform verbose error reporting if not NULL. PMDs initialize this
4124  *   structure in case of error only.
4125  * @return
4126  *   - (0) if success.
4127  *   - (-ENODEV) if *port_id* invalid.
4128  *   - (-ENOSYS) if underlying device does not support this functionality.
4129  *   - (-EIO) if underlying device is removed.
4130  *   - (-ENOENT) if action pointed by *action* handle was not found.
4131  *   - (-EBUSY) if action pointed by *action* handle still used by some rules
4132  *   rte_errno is also set.
4133  */
4134 __rte_experimental
4135 int
4136 rte_flow_action_handle_destroy(uint16_t port_id,
4137 			       struct rte_flow_action_handle *handle,
4138 			       struct rte_flow_error *error);
4139 
4140 /**
4141  * @warning
4142  * @b EXPERIMENTAL: this API may change without prior notice.
4143  *
4144  * Update in-place the action configuration and / or state pointed
4145  * by action *handle* with the configuration provided as *update* argument.
4146  * The update of the action configuration effects all flow rules reusing
4147  * the action via *handle*.
4148  * The update general pointer provides the ability of partial updating.
4149  *
4150  * @param[in] port_id
4151  *    The port identifier of the Ethernet device.
4152  * @param[in] handle
4153  *   Handle for the indirect action object to be updated.
4154  * @param[in] update
4155  *   Update profile specification used to modify the action pointed by handle.
4156  *   *update* could be with the same type of the immediate action corresponding
4157  *   to the *handle* argument when creating, or a wrapper structure includes
4158  *   action configuration to be updated and bit fields to indicate the member
4159  *   of fields inside the action to update.
4160  * @param[out] error
4161  *   Perform verbose error reporting if not NULL. PMDs initialize this
4162  *   structure in case of error only.
4163  * @return
4164  *   - (0) if success.
4165  *   - (-ENODEV) if *port_id* invalid.
4166  *   - (-ENOSYS) if underlying device does not support this functionality.
4167  *   - (-EIO) if underlying device is removed.
4168  *   - (-EINVAL) if *update* invalid.
4169  *   - (-ENOTSUP) if *update* valid but unsupported.
4170  *   - (-ENOENT) if indirect action object pointed by *handle* was not found.
4171  *   rte_errno is also set.
4172  */
4173 __rte_experimental
4174 int
4175 rte_flow_action_handle_update(uint16_t port_id,
4176 			      struct rte_flow_action_handle *handle,
4177 			      const void *update,
4178 			      struct rte_flow_error *error);
4179 
4180 /**
4181  * @warning
4182  * @b EXPERIMENTAL: this API may change without prior notice.
4183  *
4184  * Query the direct action by corresponding indirect action object handle.
4185  *
4186  * Retrieve action-specific data such as counters.
4187  * Data is gathered by special action which may be present/referenced in
4188  * more than one flow rule definition.
4189  *
4190  * @see RTE_FLOW_ACTION_TYPE_COUNT
4191  *
4192  * @param port_id
4193  *   Port identifier of Ethernet device.
4194  * @param[in] handle
4195  *   Handle for the action object to query.
4196  * @param[in, out] data
4197  *   Pointer to storage for the associated query data type.
4198  * @param[out] error
4199  *   Perform verbose error reporting if not NULL. PMDs initialize this
4200  *   structure in case of error only.
4201  *
4202  * @return
4203  *   0 on success, a negative errno value otherwise and rte_errno is set.
4204  */
4205 __rte_experimental
4206 int
4207 rte_flow_action_handle_query(uint16_t port_id,
4208 			     const struct rte_flow_action_handle *handle,
4209 			     void *data, struct rte_flow_error *error);
4210 
4211 /* Tunnel has a type and the key information. */
4212 struct rte_flow_tunnel {
4213 	/**
4214 	 * Tunnel type, for example RTE_FLOW_ITEM_TYPE_VXLAN,
4215 	 * RTE_FLOW_ITEM_TYPE_NVGRE etc.
4216 	 */
4217 	enum rte_flow_item_type	type;
4218 	uint64_t tun_id; /**< Tunnel identification. */
4219 
4220 	RTE_STD_C11
4221 	union {
4222 		struct {
4223 			rte_be32_t src_addr; /**< IPv4 source address. */
4224 			rte_be32_t dst_addr; /**< IPv4 destination address. */
4225 		} ipv4;
4226 		struct {
4227 			uint8_t src_addr[16]; /**< IPv6 source address. */
4228 			uint8_t dst_addr[16]; /**< IPv6 destination address. */
4229 		} ipv6;
4230 	};
4231 	rte_be16_t tp_src; /**< Tunnel port source. */
4232 	rte_be16_t tp_dst; /**< Tunnel port destination. */
4233 	uint16_t   tun_flags; /**< Tunnel flags. */
4234 
4235 	bool       is_ipv6; /**< True for valid IPv6 fields. Otherwise IPv4. */
4236 
4237 	/**
4238 	 * the following members are required to restore packet
4239 	 * after miss
4240 	 */
4241 	uint8_t    tos; /**< TOS for IPv4, TC for IPv6. */
4242 	uint8_t    ttl; /**< TTL for IPv4, HL for IPv6. */
4243 	uint32_t label; /**< Flow Label for IPv6. */
4244 };
4245 
4246 /**
4247  * Indicate that the packet has a tunnel.
4248  */
4249 #define RTE_FLOW_RESTORE_INFO_TUNNEL  (1ULL << 0)
4250 
4251 /**
4252  * Indicate that the packet has a non decapsulated tunnel header.
4253  */
4254 #define RTE_FLOW_RESTORE_INFO_ENCAPSULATED  (1ULL << 1)
4255 
4256 /**
4257  * Indicate that the packet has a group_id.
4258  */
4259 #define RTE_FLOW_RESTORE_INFO_GROUP_ID  (1ULL << 2)
4260 
4261 /**
4262  * Restore information structure to communicate the current packet processing
4263  * state when some of the processing pipeline is done in hardware and should
4264  * continue in software.
4265  */
4266 struct rte_flow_restore_info {
4267 	/**
4268 	 * Bitwise flags (RTE_FLOW_RESTORE_INFO_*) to indicate validation of
4269 	 * other fields in struct rte_flow_restore_info.
4270 	 */
4271 	uint64_t flags;
4272 	uint32_t group_id; /**< Group ID where packed missed */
4273 	struct rte_flow_tunnel tunnel; /**< Tunnel information. */
4274 };
4275 
4276 /**
4277  * Allocate an array of actions to be used in rte_flow_create, to implement
4278  * tunnel-decap-set for the given tunnel.
4279  * Sample usage:
4280  *   actions vxlan_decap / tunnel-decap-set(tunnel properties) /
4281  *            jump group 0 / end
4282  *
4283  * @param port_id
4284  *   Port identifier of Ethernet device.
4285  * @param[in] tunnel
4286  *   Tunnel properties.
4287  * @param[out] actions
4288  *   Array of actions to be allocated by the PMD. This array should be
4289  *   concatenated with the actions array provided to rte_flow_create.
4290  * @param[out] num_of_actions
4291  *   Number of actions allocated.
4292  * @param[out] error
4293  *   Perform verbose error reporting if not NULL. PMDs initialize this
4294  *   structure in case of error only.
4295  *
4296  * @return
4297  *   0 on success, a negative errno value otherwise and rte_errno is set.
4298  */
4299 __rte_experimental
4300 int
4301 rte_flow_tunnel_decap_set(uint16_t port_id,
4302 			  struct rte_flow_tunnel *tunnel,
4303 			  struct rte_flow_action **actions,
4304 			  uint32_t *num_of_actions,
4305 			  struct rte_flow_error *error);
4306 
4307 /**
4308  * Allocate an array of items to be used in rte_flow_create, to implement
4309  * tunnel-match for the given tunnel.
4310  * Sample usage:
4311  *   pattern tunnel-match(tunnel properties) / outer-header-matches /
4312  *           inner-header-matches / end
4313  *
4314  * @param port_id
4315  *   Port identifier of Ethernet device.
4316  * @param[in] tunnel
4317  *   Tunnel properties.
4318  * @param[out] items
4319  *   Array of items to be allocated by the PMD. This array should be
4320  *   concatenated with the items array provided to rte_flow_create.
4321  * @param[out] num_of_items
4322  *   Number of items allocated.
4323  * @param[out] error
4324  *   Perform verbose error reporting if not NULL. PMDs initialize this
4325  *   structure in case of error only.
4326  *
4327  * @return
4328  *   0 on success, a negative errno value otherwise and rte_errno is set.
4329  */
4330 __rte_experimental
4331 int
4332 rte_flow_tunnel_match(uint16_t port_id,
4333 		      struct rte_flow_tunnel *tunnel,
4334 		      struct rte_flow_item **items,
4335 		      uint32_t *num_of_items,
4336 		      struct rte_flow_error *error);
4337 
4338 /**
4339  * Populate the current packet processing state, if exists, for the given mbuf.
4340  *
4341  * One should negotiate tunnel metadata delivery from the NIC to the HW.
4342  * @see rte_eth_rx_metadata_negotiate()
4343  * @see RTE_ETH_RX_METADATA_TUNNEL_ID
4344  *
4345  * @param port_id
4346  *   Port identifier of Ethernet device.
4347  * @param[in] m
4348  *   Mbuf struct.
4349  * @param[out] info
4350  *   Restore information. Upon success contains the HW state.
4351  * @param[out] error
4352  *   Perform verbose error reporting if not NULL. PMDs initialize this
4353  *   structure in case of error only.
4354  *
4355  * @return
4356  *   0 on success, a negative errno value otherwise and rte_errno is set.
4357  */
4358 __rte_experimental
4359 int
4360 rte_flow_get_restore_info(uint16_t port_id,
4361 			  struct rte_mbuf *m,
4362 			  struct rte_flow_restore_info *info,
4363 			  struct rte_flow_error *error);
4364 
4365 /**
4366  * Release the action array as allocated by rte_flow_tunnel_decap_set.
4367  *
4368  * @param port_id
4369  *   Port identifier of Ethernet device.
4370  * @param[in] actions
4371  *   Array of actions to be released.
4372  * @param[in] num_of_actions
4373  *   Number of elements in actions array.
4374  * @param[out] error
4375  *   Perform verbose error reporting if not NULL. PMDs initialize this
4376  *   structure in case of error only.
4377  *
4378  * @return
4379  *   0 on success, a negative errno value otherwise and rte_errno is set.
4380  */
4381 __rte_experimental
4382 int
4383 rte_flow_tunnel_action_decap_release(uint16_t port_id,
4384 				     struct rte_flow_action *actions,
4385 				     uint32_t num_of_actions,
4386 				     struct rte_flow_error *error);
4387 
4388 /**
4389  * Release the item array as allocated by rte_flow_tunnel_match.
4390  *
4391  * @param port_id
4392  *   Port identifier of Ethernet device.
4393  * @param[in] items
4394  *   Array of items to be released.
4395  * @param[in] num_of_items
4396  *   Number of elements in item array.
4397  * @param[out] error
4398  *   Perform verbose error reporting if not NULL. PMDs initialize this
4399  *   structure in case of error only.
4400  *
4401  * @return
4402  *   0 on success, a negative errno value otherwise and rte_errno is set.
4403  */
4404 __rte_experimental
4405 int
4406 rte_flow_tunnel_item_release(uint16_t port_id,
4407 			     struct rte_flow_item *items,
4408 			     uint32_t num_of_items,
4409 			     struct rte_flow_error *error);
4410 #ifdef __cplusplus
4411 }
4412 #endif
4413 
4414 #endif /* RTE_FLOW_H_ */
4415