1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2016 6WIND S.A.
3 * Copyright 2016 Mellanox Technologies, Ltd
11 * RTE generic flow API
13 * This interface provides the ability to program packet matching and
14 * associated actions in hardware through flow rules.
21 #include <rte_common.h>
22 #include <rte_ether.h>
28 #include <rte_byteorder.h>
30 #include <rte_higig.h>
31 #include <rte_ecpri.h>
33 #include <rte_mbuf_dyn.h>
40 * Flow rule attributes.
42 * Priorities are set on a per rule based within groups.
44 * Lower values denote higher priority, the highest priority for a flow rule
45 * is 0, so that a flow that matches for than one rule, the rule with the
46 * lowest priority value will always be matched.
48 * Although optional, applications are encouraged to group similar rules as
49 * much as possible to fully take advantage of hardware capabilities
50 * (e.g. optimized matching) and work around limitations (e.g. a single
51 * pattern type possibly allowed in a given group). Applications should be
52 * aware that groups are not linked by default, and that they must be
53 * explicitly linked by the application using the JUMP action.
55 * Priority levels are arbitrary and up to the application, they
56 * do not need to be contiguous nor start from 0, however the maximum number
57 * varies between devices and may be affected by existing flow rules.
59 * If a packet is matched by several rules of a given group for a given
60 * priority level, the outcome is undefined. It can take any path, may be
61 * duplicated or even cause unrecoverable errors.
63 * Note that support for more than a single group and priority level is not
66 * Flow rules can apply to inbound and/or outbound traffic (ingress/egress).
68 * Several pattern items and actions are valid and can be used in both
69 * directions. Those valid for only one direction are described as such.
71 * At least one direction must be specified.
73 * Specifying both directions at once for a given rule is not recommended
74 * but may be valid in a few cases (e.g. shared counter).
76 struct rte_flow_attr {
77 uint32_t group; /**< Priority group. */
78 uint32_t priority; /**< Rule priority level within group. */
79 uint32_t ingress:1; /**< Rule applies to ingress traffic. */
80 uint32_t egress:1; /**< Rule applies to egress traffic. */
82 * Instead of simply matching the properties of traffic as it would
83 * appear on a given DPDK port ID, enabling this attribute transfers
84 * a flow rule to the lowest possible level of any device endpoints
85 * found in the pattern.
87 * When supported, this effectively enables an application to
88 * re-route traffic not necessarily intended for it (e.g. coming
89 * from or addressed to different physical ports, VFs or
90 * applications) at the device level.
92 * It complements the behavior of some pattern items such as
93 * RTE_FLOW_ITEM_TYPE_PHY_PORT and is meaningless without them.
95 * When transferring flow rules, ingress and egress attributes keep
96 * their original meaning, as if processing traffic emitted or
97 * received by the application.
100 uint32_t reserved:29; /**< Reserved, must be zero. */
104 * Matching pattern item types.
106 * Pattern items fall in two categories:
108 * - Matching protocol headers and packet data, usually associated with a
109 * specification structure. These must be stacked in the same order as the
110 * protocol layers to match inside packets, starting from the lowest.
112 * - Matching meta-data or affecting pattern processing, often without a
113 * specification structure. Since they do not match packet contents, their
114 * position in the list is usually not relevant.
116 * See the description of individual types for more information. Those
117 * marked with [META] fall into the second category.
119 enum rte_flow_item_type {
123 * End marker for item lists. Prevents further processing of items,
124 * thereby ending the pattern.
126 * No associated specification structure.
128 RTE_FLOW_ITEM_TYPE_END,
133 * Used as a placeholder for convenience. It is ignored and simply
136 * No associated specification structure.
138 RTE_FLOW_ITEM_TYPE_VOID,
143 * Inverted matching, i.e. process packets that do not match the
146 * No associated specification structure.
148 RTE_FLOW_ITEM_TYPE_INVERT,
151 * Matches any protocol in place of the current layer, a single ANY
152 * may also stand for several protocol layers.
154 * See struct rte_flow_item_any.
156 RTE_FLOW_ITEM_TYPE_ANY,
161 * Matches traffic originating from (ingress) or going to (egress)
162 * the physical function of the current device.
164 * No associated specification structure.
166 RTE_FLOW_ITEM_TYPE_PF,
171 * Matches traffic originating from (ingress) or going to (egress) a
172 * given virtual function of the current device.
174 * See struct rte_flow_item_vf.
176 RTE_FLOW_ITEM_TYPE_VF,
181 * Matches traffic originating from (ingress) or going to (egress) a
182 * physical port of the underlying device.
184 * See struct rte_flow_item_phy_port.
186 RTE_FLOW_ITEM_TYPE_PHY_PORT,
191 * Matches traffic originating from (ingress) or going to (egress) a
192 * given DPDK port ID.
194 * See struct rte_flow_item_port_id.
196 RTE_FLOW_ITEM_TYPE_PORT_ID,
199 * Matches a byte string of a given length at a given offset.
201 * See struct rte_flow_item_raw.
203 RTE_FLOW_ITEM_TYPE_RAW,
206 * Matches an Ethernet header.
208 * See struct rte_flow_item_eth.
210 RTE_FLOW_ITEM_TYPE_ETH,
213 * Matches an 802.1Q/ad VLAN tag.
215 * See struct rte_flow_item_vlan.
217 RTE_FLOW_ITEM_TYPE_VLAN,
220 * Matches an IPv4 header.
222 * See struct rte_flow_item_ipv4.
224 RTE_FLOW_ITEM_TYPE_IPV4,
227 * Matches an IPv6 header.
229 * See struct rte_flow_item_ipv6.
231 RTE_FLOW_ITEM_TYPE_IPV6,
234 * Matches an ICMP header.
236 * See struct rte_flow_item_icmp.
238 RTE_FLOW_ITEM_TYPE_ICMP,
241 * Matches a UDP header.
243 * See struct rte_flow_item_udp.
245 RTE_FLOW_ITEM_TYPE_UDP,
248 * Matches a TCP header.
250 * See struct rte_flow_item_tcp.
252 RTE_FLOW_ITEM_TYPE_TCP,
255 * Matches a SCTP header.
257 * See struct rte_flow_item_sctp.
259 RTE_FLOW_ITEM_TYPE_SCTP,
262 * Matches a VXLAN header.
264 * See struct rte_flow_item_vxlan.
266 RTE_FLOW_ITEM_TYPE_VXLAN,
269 * Matches a E_TAG header.
271 * See struct rte_flow_item_e_tag.
273 RTE_FLOW_ITEM_TYPE_E_TAG,
276 * Matches a NVGRE header.
278 * See struct rte_flow_item_nvgre.
280 RTE_FLOW_ITEM_TYPE_NVGRE,
283 * Matches a MPLS header.
285 * See struct rte_flow_item_mpls.
287 RTE_FLOW_ITEM_TYPE_MPLS,
290 * Matches a GRE header.
292 * See struct rte_flow_item_gre.
294 RTE_FLOW_ITEM_TYPE_GRE,
299 * Fuzzy pattern match, expect faster than default.
301 * This is for device that support fuzzy matching option.
302 * Usually a fuzzy matching is fast but the cost is accuracy.
304 * See struct rte_flow_item_fuzzy.
306 RTE_FLOW_ITEM_TYPE_FUZZY,
309 * Matches a GTP header.
311 * Configure flow for GTP packets.
313 * See struct rte_flow_item_gtp.
315 RTE_FLOW_ITEM_TYPE_GTP,
318 * Matches a GTP header.
320 * Configure flow for GTP-C packets.
322 * See struct rte_flow_item_gtp.
324 RTE_FLOW_ITEM_TYPE_GTPC,
327 * Matches a GTP header.
329 * Configure flow for GTP-U packets.
331 * See struct rte_flow_item_gtp.
333 RTE_FLOW_ITEM_TYPE_GTPU,
336 * Matches a ESP header.
338 * See struct rte_flow_item_esp.
340 RTE_FLOW_ITEM_TYPE_ESP,
343 * Matches a GENEVE header.
345 * See struct rte_flow_item_geneve.
347 RTE_FLOW_ITEM_TYPE_GENEVE,
350 * Matches a VXLAN-GPE header.
352 * See struct rte_flow_item_vxlan_gpe.
354 RTE_FLOW_ITEM_TYPE_VXLAN_GPE,
357 * Matches an ARP header for Ethernet/IPv4.
359 * See struct rte_flow_item_arp_eth_ipv4.
361 RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4,
364 * Matches the presence of any IPv6 extension header.
366 * See struct rte_flow_item_ipv6_ext.
368 RTE_FLOW_ITEM_TYPE_IPV6_EXT,
371 * Matches any ICMPv6 header.
373 * See struct rte_flow_item_icmp6.
375 RTE_FLOW_ITEM_TYPE_ICMP6,
378 * Matches an ICMPv6 neighbor discovery solicitation.
380 * See struct rte_flow_item_icmp6_nd_ns.
382 RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS,
385 * Matches an ICMPv6 neighbor discovery advertisement.
387 * See struct rte_flow_item_icmp6_nd_na.
389 RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA,
392 * Matches the presence of any ICMPv6 neighbor discovery option.
394 * See struct rte_flow_item_icmp6_nd_opt.
396 RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT,
399 * Matches an ICMPv6 neighbor discovery source Ethernet link-layer
402 * See struct rte_flow_item_icmp6_nd_opt_sla_eth.
404 RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH,
407 * Matches an ICMPv6 neighbor discovery target Ethernet link-layer
410 * See struct rte_flow_item_icmp6_nd_opt_tla_eth.
412 RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH,
415 * Matches specified mark field.
417 * See struct rte_flow_item_mark.
419 RTE_FLOW_ITEM_TYPE_MARK,
424 * Matches a metadata value.
426 * See struct rte_flow_item_meta.
428 RTE_FLOW_ITEM_TYPE_META,
431 * Matches a GRE optional key field.
433 * The value should a big-endian 32bit integer.
435 * When this item present the K bit is implicitly matched as "1"
436 * in the default mask.
439 * @code rte_be32_t * @endcode
441 RTE_FLOW_ITEM_TYPE_GRE_KEY,
444 * Matches a GTP extension header: PDU session container.
446 * Configure flow for GTP packets with extension header type 0x85.
448 * See struct rte_flow_item_gtp_psc.
450 RTE_FLOW_ITEM_TYPE_GTP_PSC,
453 * Matches a PPPoE header.
455 * Configure flow for PPPoE session packets.
457 * See struct rte_flow_item_pppoe.
459 RTE_FLOW_ITEM_TYPE_PPPOES,
462 * Matches a PPPoE header.
464 * Configure flow for PPPoE discovery packets.
466 * See struct rte_flow_item_pppoe.
468 RTE_FLOW_ITEM_TYPE_PPPOED,
471 * Matches a PPPoE optional proto_id field.
473 * It only applies to PPPoE session packets.
475 * See struct rte_flow_item_pppoe_proto_id.
477 RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID,
480 * Matches Network service header (NSH).
481 * See struct rte_flow_item_nsh.
484 RTE_FLOW_ITEM_TYPE_NSH,
487 * Matches Internet Group Management Protocol (IGMP).
488 * See struct rte_flow_item_igmp.
491 RTE_FLOW_ITEM_TYPE_IGMP,
494 * Matches IP Authentication Header (AH).
495 * See struct rte_flow_item_ah.
498 RTE_FLOW_ITEM_TYPE_AH,
501 * Matches a HIGIG header.
502 * see struct rte_flow_item_higig2_hdr.
504 RTE_FLOW_ITEM_TYPE_HIGIG2,
509 * Matches a tag value.
511 * See struct rte_flow_item_tag.
513 RTE_FLOW_ITEM_TYPE_TAG,
516 * Matches a L2TPv3 over IP header.
518 * Configure flow for L2TPv3 over IP packets.
520 * See struct rte_flow_item_l2tpv3oip.
522 RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
525 * Matches PFCP Header.
526 * See struct rte_flow_item_pfcp.
529 RTE_FLOW_ITEM_TYPE_PFCP,
532 * Matches eCPRI Header.
534 * Configure flow for eCPRI over ETH or UDP packets.
536 * See struct rte_flow_item_ecpri.
538 RTE_FLOW_ITEM_TYPE_ECPRI,
544 * RTE_FLOW_ITEM_TYPE_HIGIG2
545 * Matches higig2 header
548 struct rte_flow_item_higig2_hdr {
549 struct rte_higig2_hdr hdr;
552 /** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
554 static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
557 .classification = 0xffff,
565 * RTE_FLOW_ITEM_TYPE_ANY
567 * Matches any protocol in place of the current layer, a single ANY may also
568 * stand for several protocol layers.
570 * This is usually specified as the first pattern item when looking for a
571 * protocol anywhere in a packet.
573 * A zeroed mask stands for any number of layers.
575 struct rte_flow_item_any {
576 uint32_t num; /**< Number of layers covered. */
579 /** Default mask for RTE_FLOW_ITEM_TYPE_ANY. */
581 static const struct rte_flow_item_any rte_flow_item_any_mask = {
587 * RTE_FLOW_ITEM_TYPE_VF
589 * Matches traffic originating from (ingress) or going to (egress) a given
590 * virtual function of the current device.
592 * If supported, should work even if the virtual function is not managed by
593 * the application and thus not associated with a DPDK port ID.
595 * Note this pattern item does not match VF representors traffic which, as
596 * separate entities, should be addressed through their own DPDK port IDs.
598 * - Can be specified multiple times to match traffic addressed to several
600 * - Can be combined with a PF item to match both PF and VF traffic.
602 * A zeroed mask can be used to match any VF ID.
604 struct rte_flow_item_vf {
605 uint32_t id; /**< VF ID. */
608 /** Default mask for RTE_FLOW_ITEM_TYPE_VF. */
610 static const struct rte_flow_item_vf rte_flow_item_vf_mask = {
616 * RTE_FLOW_ITEM_TYPE_PHY_PORT
618 * Matches traffic originating from (ingress) or going to (egress) a
619 * physical port of the underlying device.
621 * The first PHY_PORT item overrides the physical port normally associated
622 * with the specified DPDK input port (port_id). This item can be provided
623 * several times to match additional physical ports.
625 * Note that physical ports are not necessarily tied to DPDK input ports
626 * (port_id) when those are not under DPDK control. Possible values are
627 * specific to each device, they are not necessarily indexed from zero and
628 * may not be contiguous.
630 * As a device property, the list of allowed values as well as the value
631 * associated with a port_id should be retrieved by other means.
633 * A zeroed mask can be used to match any port index.
635 struct rte_flow_item_phy_port {
636 uint32_t index; /**< Physical port index. */
639 /** Default mask for RTE_FLOW_ITEM_TYPE_PHY_PORT. */
641 static const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask = {
647 * RTE_FLOW_ITEM_TYPE_PORT_ID
649 * Matches traffic originating from (ingress) or going to (egress) a given
652 * Normally only supported if the port ID in question is known by the
653 * underlying PMD and related to the device the flow rule is created
656 * This must not be confused with @p PHY_PORT which refers to the physical
657 * port of a device, whereas @p PORT_ID refers to a struct rte_eth_dev
658 * object on the application side (also known as "port representor"
659 * depending on the kind of underlying device).
661 struct rte_flow_item_port_id {
662 uint32_t id; /**< DPDK port ID. */
665 /** Default mask for RTE_FLOW_ITEM_TYPE_PORT_ID. */
667 static const struct rte_flow_item_port_id rte_flow_item_port_id_mask = {
673 * RTE_FLOW_ITEM_TYPE_RAW
675 * Matches a byte string of a given length at a given offset.
677 * Offset is either absolute (using the start of the packet) or relative to
678 * the end of the previous matched item in the stack, in which case negative
679 * values are allowed.
681 * If search is enabled, offset is used as the starting point. The search
682 * area can be delimited by setting limit to a nonzero value, which is the
683 * maximum number of bytes after offset where the pattern may start.
685 * Matching a zero-length pattern is allowed, doing so resets the relative
686 * offset for subsequent items.
688 * This type does not support ranges (struct rte_flow_item.last).
690 struct rte_flow_item_raw {
691 uint32_t relative:1; /**< Look for pattern after the previous item. */
692 uint32_t search:1; /**< Search pattern from offset (see also limit). */
693 uint32_t reserved:30; /**< Reserved, must be set to zero. */
694 int32_t offset; /**< Absolute or relative offset for pattern. */
695 uint16_t limit; /**< Search area limit for start of pattern. */
696 uint16_t length; /**< Pattern length. */
697 const uint8_t *pattern; /**< Byte string to look for. */
700 /** Default mask for RTE_FLOW_ITEM_TYPE_RAW. */
702 static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
705 .reserved = 0x3fffffff,
706 .offset = 0xffffffff,
714 * RTE_FLOW_ITEM_TYPE_ETH
716 * Matches an Ethernet header.
718 * The @p type field either stands for "EtherType" or "TPID" when followed
719 * by so-called layer 2.5 pattern items such as RTE_FLOW_ITEM_TYPE_VLAN. In
720 * the latter case, @p type refers to that of the outer header, with the
721 * inner EtherType/TPID provided by the subsequent pattern item. This is the
722 * same order as on the wire.
723 * If the @p type field contains a TPID value, then only tagged packets with the
724 * specified TPID will match the pattern.
725 * Otherwise, only untagged packets will match the pattern.
726 * If the @p ETH item is the only item in the pattern, and the @p type field
727 * is not specified, then both tagged and untagged packets will match the
730 struct rte_flow_item_eth {
731 struct rte_ether_addr dst; /**< Destination MAC. */
732 struct rte_ether_addr src; /**< Source MAC. */
733 rte_be16_t type; /**< EtherType or TPID. */
736 /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */
738 static const struct rte_flow_item_eth rte_flow_item_eth_mask = {
739 .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
740 .src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
741 .type = RTE_BE16(0x0000),
746 * RTE_FLOW_ITEM_TYPE_VLAN
748 * Matches an 802.1Q/ad VLAN tag.
750 * The corresponding standard outer EtherType (TPID) values are
751 * RTE_ETHER_TYPE_VLAN or RTE_ETHER_TYPE_QINQ. It can be overridden by
752 * the preceding pattern item.
753 * If a @p VLAN item is present in the pattern, then only tagged packets will
756 struct rte_flow_item_vlan {
757 rte_be16_t tci; /**< Tag control information. */
758 rte_be16_t inner_type; /**< Inner EtherType or TPID. */
761 /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */
763 static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = {
764 .tci = RTE_BE16(0x0fff),
765 .inner_type = RTE_BE16(0x0000),
770 * RTE_FLOW_ITEM_TYPE_IPV4
772 * Matches an IPv4 header.
774 * Note: IPv4 options are handled by dedicated pattern items.
776 struct rte_flow_item_ipv4 {
777 struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */
780 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */
782 static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = {
784 .src_addr = RTE_BE32(0xffffffff),
785 .dst_addr = RTE_BE32(0xffffffff),
791 * RTE_FLOW_ITEM_TYPE_IPV6.
793 * Matches an IPv6 header.
795 * Note: IPv6 options are handled by dedicated pattern items, see
796 * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
798 struct rte_flow_item_ipv6 {
799 struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
802 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
804 static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
807 "\xff\xff\xff\xff\xff\xff\xff\xff"
808 "\xff\xff\xff\xff\xff\xff\xff\xff",
810 "\xff\xff\xff\xff\xff\xff\xff\xff"
811 "\xff\xff\xff\xff\xff\xff\xff\xff",
817 * RTE_FLOW_ITEM_TYPE_ICMP.
819 * Matches an ICMP header.
821 struct rte_flow_item_icmp {
822 struct rte_icmp_hdr hdr; /**< ICMP header definition. */
825 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */
827 static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = {
836 * RTE_FLOW_ITEM_TYPE_UDP.
838 * Matches a UDP header.
840 struct rte_flow_item_udp {
841 struct rte_udp_hdr hdr; /**< UDP header definition. */
844 /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */
846 static const struct rte_flow_item_udp rte_flow_item_udp_mask = {
848 .src_port = RTE_BE16(0xffff),
849 .dst_port = RTE_BE16(0xffff),
855 * RTE_FLOW_ITEM_TYPE_TCP.
857 * Matches a TCP header.
859 struct rte_flow_item_tcp {
860 struct rte_tcp_hdr hdr; /**< TCP header definition. */
863 /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */
865 static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = {
867 .src_port = RTE_BE16(0xffff),
868 .dst_port = RTE_BE16(0xffff),
874 * RTE_FLOW_ITEM_TYPE_SCTP.
876 * Matches a SCTP header.
878 struct rte_flow_item_sctp {
879 struct rte_sctp_hdr hdr; /**< SCTP header definition. */
882 /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */
884 static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = {
886 .src_port = RTE_BE16(0xffff),
887 .dst_port = RTE_BE16(0xffff),
893 * RTE_FLOW_ITEM_TYPE_VXLAN.
895 * Matches a VXLAN header (RFC 7348).
897 struct rte_flow_item_vxlan {
898 uint8_t flags; /**< Normally 0x08 (I flag). */
899 uint8_t rsvd0[3]; /**< Reserved, normally 0x000000. */
900 uint8_t vni[3]; /**< VXLAN identifier. */
901 uint8_t rsvd1; /**< Reserved, normally 0x00. */
904 /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */
906 static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
907 .vni = "\xff\xff\xff",
912 * RTE_FLOW_ITEM_TYPE_E_TAG.
914 * Matches a E-tag header.
916 * The corresponding standard outer EtherType (TPID) value is
917 * RTE_ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item.
919 struct rte_flow_item_e_tag {
921 * E-Tag control information (E-TCI).
922 * E-PCP (3b), E-DEI (1b), ingress E-CID base (12b).
924 rte_be16_t epcp_edei_in_ecid_b;
925 /** Reserved (2b), GRP (2b), E-CID base (12b). */
926 rte_be16_t rsvd_grp_ecid_b;
927 uint8_t in_ecid_e; /**< Ingress E-CID ext. */
928 uint8_t ecid_e; /**< E-CID ext. */
929 rte_be16_t inner_type; /**< Inner EtherType or TPID. */
932 /** Default mask for RTE_FLOW_ITEM_TYPE_E_TAG. */
934 static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask = {
935 .rsvd_grp_ecid_b = RTE_BE16(0x3fff),
940 * RTE_FLOW_ITEM_TYPE_NVGRE.
942 * Matches a NVGRE header.
944 struct rte_flow_item_nvgre {
946 * Checksum (1b), undefined (1b), key bit (1b), sequence number (1b),
947 * reserved 0 (9b), version (3b).
949 * c_k_s_rsvd0_ver must have value 0x2000 according to RFC 7637.
951 rte_be16_t c_k_s_rsvd0_ver;
952 rte_be16_t protocol; /**< Protocol type (0x6558). */
953 uint8_t tni[3]; /**< Virtual subnet ID. */
954 uint8_t flow_id; /**< Flow ID. */
957 /** Default mask for RTE_FLOW_ITEM_TYPE_NVGRE. */
959 static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask = {
960 .tni = "\xff\xff\xff",
965 * RTE_FLOW_ITEM_TYPE_MPLS.
967 * Matches a MPLS header.
969 struct rte_flow_item_mpls {
971 * Label (20b), TC (3b), Bottom of Stack (1b).
973 uint8_t label_tc_s[3];
974 uint8_t ttl; /** Time-to-Live. */
977 /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */
979 static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
980 .label_tc_s = "\xff\xff\xf0",
985 * RTE_FLOW_ITEM_TYPE_GRE.
987 * Matches a GRE header.
989 struct rte_flow_item_gre {
991 * Checksum (1b), reserved 0 (12b), version (3b).
994 rte_be16_t c_rsvd0_ver;
995 rte_be16_t protocol; /**< Protocol type. */
998 /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
1000 static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
1001 .protocol = RTE_BE16(0xffff),
1006 * RTE_FLOW_ITEM_TYPE_FUZZY
1008 * Fuzzy pattern match, expect faster than default.
1010 * This is for device that support fuzzy match option.
1011 * Usually a fuzzy match is fast but the cost is accuracy.
1012 * i.e. Signature Match only match pattern's hash value, but it is
1013 * possible two different patterns have the same hash value.
1015 * Matching accuracy level can be configure by threshold.
1016 * Driver can divide the range of threshold and map to different
1017 * accuracy levels that device support.
1019 * Threshold 0 means perfect match (no fuzziness), while threshold
1020 * 0xffffffff means fuzziest match.
1022 struct rte_flow_item_fuzzy {
1023 uint32_t thresh; /**< Accuracy threshold. */
1026 /** Default mask for RTE_FLOW_ITEM_TYPE_FUZZY. */
1028 static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask = {
1029 .thresh = 0xffffffff,
1034 * RTE_FLOW_ITEM_TYPE_GTP.
1036 * Matches a GTPv1 header.
1038 struct rte_flow_item_gtp {
1040 * Version (3b), protocol type (1b), reserved (1b),
1041 * Extension header flag (1b),
1042 * Sequence number flag (1b),
1043 * N-PDU number flag (1b).
1045 uint8_t v_pt_rsv_flags;
1046 uint8_t msg_type; /**< Message type. */
1047 rte_be16_t msg_len; /**< Message length. */
1048 rte_be32_t teid; /**< Tunnel endpoint identifier. */
1051 /** Default mask for RTE_FLOW_ITEM_TYPE_GTP. */
1053 static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = {
1054 .teid = RTE_BE32(0xffffffff),
1059 * RTE_FLOW_ITEM_TYPE_ESP
1061 * Matches an ESP header.
1063 struct rte_flow_item_esp {
1064 struct rte_esp_hdr hdr; /**< ESP header definition. */
1067 /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */
1069 static const struct rte_flow_item_esp rte_flow_item_esp_mask = {
1071 .spi = RTE_BE32(0xffffffff),
1077 * RTE_FLOW_ITEM_TYPE_GENEVE.
1079 * Matches a GENEVE header.
1081 struct rte_flow_item_geneve {
1083 * Version (2b), length of the options fields (6b), OAM packet (1b),
1084 * critical options present (1b), reserved 0 (6b).
1086 rte_be16_t ver_opt_len_o_c_rsvd0;
1087 rte_be16_t protocol; /**< Protocol type. */
1088 uint8_t vni[3]; /**< Virtual Network Identifier. */
1089 uint8_t rsvd1; /**< Reserved, normally 0x00. */
1092 /** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE. */
1094 static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = {
1095 .vni = "\xff\xff\xff",
1100 * RTE_FLOW_ITEM_TYPE_VXLAN_GPE (draft-ietf-nvo3-vxlan-gpe-05).
1102 * Matches a VXLAN-GPE header.
1104 struct rte_flow_item_vxlan_gpe {
1105 uint8_t flags; /**< Normally 0x0c (I and P flags). */
1106 uint8_t rsvd0[2]; /**< Reserved, normally 0x0000. */
1107 uint8_t protocol; /**< Protocol type. */
1108 uint8_t vni[3]; /**< VXLAN identifier. */
1109 uint8_t rsvd1; /**< Reserved, normally 0x00. */
1112 /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */
1114 static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = {
1115 .vni = "\xff\xff\xff",
1120 * RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4
1122 * Matches an ARP header for Ethernet/IPv4.
1124 struct rte_flow_item_arp_eth_ipv4 {
1125 rte_be16_t hrd; /**< Hardware type, normally 1. */
1126 rte_be16_t pro; /**< Protocol type, normally 0x0800. */
1127 uint8_t hln; /**< Hardware address length, normally 6. */
1128 uint8_t pln; /**< Protocol address length, normally 4. */
1129 rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */
1130 struct rte_ether_addr sha; /**< Sender hardware address. */
1131 rte_be32_t spa; /**< Sender IPv4 address. */
1132 struct rte_ether_addr tha; /**< Target hardware address. */
1133 rte_be32_t tpa; /**< Target IPv4 address. */
1136 /** Default mask for RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4. */
1138 static const struct rte_flow_item_arp_eth_ipv4
1139 rte_flow_item_arp_eth_ipv4_mask = {
1140 .sha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1141 .spa = RTE_BE32(0xffffffff),
1142 .tha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1143 .tpa = RTE_BE32(0xffffffff),
1148 * RTE_FLOW_ITEM_TYPE_IPV6_EXT
1150 * Matches the presence of any IPv6 extension header.
1152 * Normally preceded by any of:
1154 * - RTE_FLOW_ITEM_TYPE_IPV6
1155 * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
1157 struct rte_flow_item_ipv6_ext {
1158 uint8_t next_hdr; /**< Next header. */
1161 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6_EXT. */
1164 struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
1170 * RTE_FLOW_ITEM_TYPE_ICMP6
1172 * Matches any ICMPv6 header.
1174 struct rte_flow_item_icmp6 {
1175 uint8_t type; /**< ICMPv6 type. */
1176 uint8_t code; /**< ICMPv6 code. */
1177 uint16_t checksum; /**< ICMPv6 checksum. */
1180 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6. */
1182 static const struct rte_flow_item_icmp6 rte_flow_item_icmp6_mask = {
1189 * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1191 * Matches an ICMPv6 neighbor discovery solicitation.
1193 struct rte_flow_item_icmp6_nd_ns {
1194 uint8_t type; /**< ICMPv6 type, normally 135. */
1195 uint8_t code; /**< ICMPv6 code, normally 0. */
1196 rte_be16_t checksum; /**< ICMPv6 checksum. */
1197 rte_be32_t reserved; /**< Reserved, normally 0. */
1198 uint8_t target_addr[16]; /**< Target address. */
1201 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS. */
1204 struct rte_flow_item_icmp6_nd_ns rte_flow_item_icmp6_nd_ns_mask = {
1206 "\xff\xff\xff\xff\xff\xff\xff\xff"
1207 "\xff\xff\xff\xff\xff\xff\xff\xff",
1212 * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1214 * Matches an ICMPv6 neighbor discovery advertisement.
1216 struct rte_flow_item_icmp6_nd_na {
1217 uint8_t type; /**< ICMPv6 type, normally 136. */
1218 uint8_t code; /**< ICMPv6 code, normally 0. */
1219 rte_be16_t checksum; /**< ICMPv6 checksum. */
1221 * Route flag (1b), solicited flag (1b), override flag (1b),
1224 rte_be32_t rso_reserved;
1225 uint8_t target_addr[16]; /**< Target address. */
1228 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA. */
1231 struct rte_flow_item_icmp6_nd_na rte_flow_item_icmp6_nd_na_mask = {
1233 "\xff\xff\xff\xff\xff\xff\xff\xff"
1234 "\xff\xff\xff\xff\xff\xff\xff\xff",
1239 * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1241 * Matches the presence of any ICMPv6 neighbor discovery option.
1243 * Normally preceded by any of:
1245 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1246 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1247 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1249 struct rte_flow_item_icmp6_nd_opt {
1250 uint8_t type; /**< ND option type. */
1251 uint8_t length; /**< ND option length. */
1254 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT. */
1256 static const struct rte_flow_item_icmp6_nd_opt
1257 rte_flow_item_icmp6_nd_opt_mask = {
1263 * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH
1265 * Matches an ICMPv6 neighbor discovery source Ethernet link-layer address
1268 * Normally preceded by any of:
1270 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1271 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1273 struct rte_flow_item_icmp6_nd_opt_sla_eth {
1274 uint8_t type; /**< ND option type, normally 1. */
1275 uint8_t length; /**< ND option length, normally 1. */
1276 struct rte_ether_addr sla; /**< Source Ethernet LLA. */
1279 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */
1281 static const struct rte_flow_item_icmp6_nd_opt_sla_eth
1282 rte_flow_item_icmp6_nd_opt_sla_eth_mask = {
1283 .sla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1288 * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH
1290 * Matches an ICMPv6 neighbor discovery target Ethernet link-layer address
1293 * Normally preceded by any of:
1295 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1296 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1298 struct rte_flow_item_icmp6_nd_opt_tla_eth {
1299 uint8_t type; /**< ND option type, normally 2. */
1300 uint8_t length; /**< ND option length, normally 1. */
1301 struct rte_ether_addr tla; /**< Target Ethernet LLA. */
1304 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */
1306 static const struct rte_flow_item_icmp6_nd_opt_tla_eth
1307 rte_flow_item_icmp6_nd_opt_tla_eth_mask = {
1308 .tla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1313 * RTE_FLOW_ITEM_TYPE_META
1315 * Matches a specified metadata value. On egress, metadata can be set
1316 * either by mbuf dynamic metadata field with PKT_TX_DYNF_METADATA flag or
1317 * RTE_FLOW_ACTION_TYPE_SET_META. On ingress, RTE_FLOW_ACTION_TYPE_SET_META
1318 * sets metadata for a packet and the metadata will be reported via mbuf
1319 * metadata dynamic field with PKT_RX_DYNF_METADATA flag. The dynamic mbuf
1320 * field must be registered in advance by rte_flow_dynf_metadata_register().
1322 struct rte_flow_item_meta {
1326 /** Default mask for RTE_FLOW_ITEM_TYPE_META. */
1328 static const struct rte_flow_item_meta rte_flow_item_meta_mask = {
1334 * RTE_FLOW_ITEM_TYPE_GTP_PSC.
1336 * Matches a GTP PDU extension header with type 0x85.
1338 struct rte_flow_item_gtp_psc {
1339 uint8_t pdu_type; /**< PDU type. */
1340 uint8_t qfi; /**< QoS flow identifier. */
1343 /** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */
1345 static const struct rte_flow_item_gtp_psc
1346 rte_flow_item_gtp_psc_mask = {
1352 * RTE_FLOW_ITEM_TYPE_PPPOE.
1354 * Matches a PPPoE header.
1356 struct rte_flow_item_pppoe {
1358 * Version (4b), type (4b).
1360 uint8_t version_type;
1361 uint8_t code; /**< Message type. */
1362 rte_be16_t session_id; /**< Session identifier. */
1363 rte_be16_t length; /**< Payload length. */
1367 * RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID.
1369 * Matches a PPPoE optional proto_id field.
1371 * It only applies to PPPoE session packets.
1373 * Normally preceded by any of:
1375 * - RTE_FLOW_ITEM_TYPE_PPPOE
1376 * - RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID
1378 struct rte_flow_item_pppoe_proto_id {
1379 rte_be16_t proto_id; /**< PPP protocol identifier. */
1382 /** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID. */
1384 static const struct rte_flow_item_pppoe_proto_id
1385 rte_flow_item_pppoe_proto_id_mask = {
1386 .proto_id = RTE_BE16(0xffff),
1392 * @b EXPERIMENTAL: this structure may change without prior notice
1394 * RTE_FLOW_ITEM_TYPE_TAG
1396 * Matches a specified tag value at the specified index.
1398 struct rte_flow_item_tag {
1403 /** Default mask for RTE_FLOW_ITEM_TYPE_TAG. */
1405 static const struct rte_flow_item_tag rte_flow_item_tag_mask = {
1412 * RTE_FLOW_ITEM_TYPE_L2TPV3OIP.
1414 * Matches a L2TPv3 over IP header.
1416 struct rte_flow_item_l2tpv3oip {
1417 rte_be32_t session_id; /**< Session ID. */
1420 /** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV3OIP. */
1422 static const struct rte_flow_item_l2tpv3oip rte_flow_item_l2tpv3oip_mask = {
1423 .session_id = RTE_BE32(UINT32_MAX),
1430 * @b EXPERIMENTAL: this structure may change without prior notice
1432 * RTE_FLOW_ITEM_TYPE_MARK
1434 * Matches an arbitrary integer value which was set using the ``MARK`` action
1435 * in a previously matched rule.
1437 * This item can only be specified once as a match criteria as the ``MARK``
1438 * action can only be specified once in a flow action.
1440 * This value is arbitrary and application-defined. Maximum allowed value
1441 * depends on the underlying implementation.
1443 * Depending on the underlying implementation the MARK item may be supported on
1444 * the physical device, with virtual groups in the PMD or not at all.
1446 struct rte_flow_item_mark {
1447 uint32_t id; /**< Integer value to match against. */
1450 /** Default mask for RTE_FLOW_ITEM_TYPE_MARK. */
1452 static const struct rte_flow_item_mark rte_flow_item_mark_mask = {
1459 * @b EXPERIMENTAL: this structure may change without prior notice
1461 * RTE_FLOW_ITEM_TYPE_NSH
1463 * Match network service header (NSH), RFC 8300
1466 struct rte_flow_item_nsh {
1469 uint32_t reserved:1;
1472 uint32_t reserved1:4;
1474 uint32_t next_proto:8;
1479 /** Default mask for RTE_FLOW_ITEM_TYPE_NSH. */
1481 static const struct rte_flow_item_nsh rte_flow_item_nsh_mask = {
1491 * @b EXPERIMENTAL: this structure may change without prior notice
1493 * RTE_FLOW_ITEM_TYPE_IGMP
1495 * Match Internet Group Management Protocol (IGMP), RFC 2236
1498 struct rte_flow_item_igmp {
1500 uint32_t max_resp_time:8;
1501 uint32_t checksum:16;
1502 uint32_t group_addr;
1505 /** Default mask for RTE_FLOW_ITEM_TYPE_IGMP. */
1507 static const struct rte_flow_item_igmp rte_flow_item_igmp_mask = {
1508 .group_addr = 0xffffffff,
1514 * @b EXPERIMENTAL: this structure may change without prior notice
1516 * RTE_FLOW_ITEM_TYPE_AH
1518 * Match IP Authentication Header (AH), RFC 4302
1521 struct rte_flow_item_ah {
1522 uint32_t next_hdr:8;
1523 uint32_t payload_len:8;
1524 uint32_t reserved:16;
1529 /** Default mask for RTE_FLOW_ITEM_TYPE_AH. */
1531 static const struct rte_flow_item_ah rte_flow_item_ah_mask = {
1538 * @b EXPERIMENTAL: this structure may change without prior notice
1540 * RTE_FLOW_ITEM_TYPE_PFCP
1544 struct rte_flow_item_pfcp {
1551 /** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */
1553 static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
1555 .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
1561 * @b EXPERIMENTAL: this structure may change without prior notice
1563 * RTE_FLOW_ITEM_TYPE_ECPRI
1565 * Match eCPRI Header
1567 struct rte_flow_item_ecpri {
1568 struct rte_ecpri_combined_msg_hdr hdr;
1571 /** Default mask for RTE_FLOW_ITEM_TYPE_ECPRI. */
1573 static const struct rte_flow_item_ecpri rte_flow_item_ecpri_mask = {
1583 * Matching pattern item definition.
1585 * A pattern is formed by stacking items starting from the lowest protocol
1586 * layer to match. This stacking restriction does not apply to meta items
1587 * which can be placed anywhere in the stack without affecting the meaning
1588 * of the resulting pattern.
1590 * Patterns are terminated by END items.
1592 * The spec field should be a valid pointer to a structure of the related
1593 * item type. It may remain unspecified (NULL) in many cases to request
1594 * broad (nonspecific) matching. In such cases, last and mask must also be
1597 * Optionally, last can point to a structure of the same type to define an
1598 * inclusive range. This is mostly supported by integer and address fields,
1599 * may cause errors otherwise. Fields that do not support ranges must be set
1600 * to 0 or to the same value as the corresponding fields in spec.
1602 * Only the fields defined to nonzero values in the default masks (see
1603 * rte_flow_item_{name}_mask constants) are considered relevant by
1604 * default. This can be overridden by providing a mask structure of the
1605 * same type with applicable bits set to one. It can also be used to
1606 * partially filter out specific fields (e.g. as an alternate mean to match
1607 * ranges of IP addresses).
1609 * Mask is a simple bit-mask applied before interpreting the contents of
1610 * spec and last, which may yield unexpected results if not used
1611 * carefully. For example, if for an IPv4 address field, spec provides
1612 * 10.1.2.3, last provides 10.3.4.5 and mask provides 255.255.0.0, the
1613 * effective range becomes 10.1.0.0 to 10.3.255.255.
1615 struct rte_flow_item {
1616 enum rte_flow_item_type type; /**< Item type. */
1617 const void *spec; /**< Pointer to item specification structure. */
1618 const void *last; /**< Defines an inclusive range (spec to last). */
1619 const void *mask; /**< Bit-mask applied to spec and last. */
1625 * Each possible action is represented by a type.
1626 * An action can have an associated configuration object.
1627 * Several actions combined in a list can be assigned
1628 * to a flow rule and are performed in order.
1630 * They fall in three categories:
1632 * - Actions that modify the fate of matching traffic, for instance by
1633 * dropping or assigning it a specific destination.
1635 * - Actions that modify matching traffic contents or its properties. This
1636 * includes adding/removing encapsulation, encryption, compression and
1639 * - Actions related to the flow rule itself, such as updating counters or
1640 * making it non-terminating.
1642 * Flow rules being terminating by default, not specifying any action of the
1643 * fate kind results in undefined behavior. This applies to both ingress and
1646 * PASSTHRU, when supported, makes a flow rule non-terminating.
1648 enum rte_flow_action_type {
1650 * End marker for action lists. Prevents further processing of
1651 * actions, thereby ending the list.
1653 * No associated configuration structure.
1655 RTE_FLOW_ACTION_TYPE_END,
1658 * Used as a placeholder for convenience. It is ignored and simply
1659 * discarded by PMDs.
1661 * No associated configuration structure.
1663 RTE_FLOW_ACTION_TYPE_VOID,
1666 * Leaves traffic up for additional processing by subsequent flow
1667 * rules; makes a flow rule non-terminating.
1669 * No associated configuration structure.
1671 RTE_FLOW_ACTION_TYPE_PASSTHRU,
1674 * RTE_FLOW_ACTION_TYPE_JUMP
1676 * Redirects packets to a group on the current device.
1678 * See struct rte_flow_action_jump.
1680 RTE_FLOW_ACTION_TYPE_JUMP,
1683 * Attaches an integer value to packets and sets PKT_RX_FDIR and
1684 * PKT_RX_FDIR_ID mbuf flags.
1686 * See struct rte_flow_action_mark.
1688 RTE_FLOW_ACTION_TYPE_MARK,
1691 * Flags packets. Similar to MARK without a specific value; only
1692 * sets the PKT_RX_FDIR mbuf flag.
1694 * No associated configuration structure.
1696 RTE_FLOW_ACTION_TYPE_FLAG,
1699 * Assigns packets to a given queue index.
1701 * See struct rte_flow_action_queue.
1703 RTE_FLOW_ACTION_TYPE_QUEUE,
1708 * PASSTHRU overrides this action if both are specified.
1710 * No associated configuration structure.
1712 RTE_FLOW_ACTION_TYPE_DROP,
1715 * Enables counters for this flow rule.
1717 * These counters can be retrieved and reset through rte_flow_query(),
1718 * see struct rte_flow_query_count.
1720 * See struct rte_flow_action_count.
1722 RTE_FLOW_ACTION_TYPE_COUNT,
1725 * Similar to QUEUE, except RSS is additionally performed on packets
1726 * to spread them among several queues according to the provided
1729 * See struct rte_flow_action_rss.
1731 RTE_FLOW_ACTION_TYPE_RSS,
1734 * Directs matching traffic to the physical function (PF) of the
1737 * No associated configuration structure.
1739 RTE_FLOW_ACTION_TYPE_PF,
1742 * Directs matching traffic to a given virtual function of the
1745 * See struct rte_flow_action_vf.
1747 RTE_FLOW_ACTION_TYPE_VF,
1750 * Directs packets to a given physical port index of the underlying
1753 * See struct rte_flow_action_phy_port.
1755 RTE_FLOW_ACTION_TYPE_PHY_PORT,
1758 * Directs matching traffic to a given DPDK port ID.
1760 * See struct rte_flow_action_port_id.
1762 RTE_FLOW_ACTION_TYPE_PORT_ID,
1765 * Traffic metering and policing (MTR).
1767 * See struct rte_flow_action_meter.
1768 * See file rte_mtr.h for MTR object configuration.
1770 RTE_FLOW_ACTION_TYPE_METER,
1773 * Redirects packets to security engine of current device for security
1774 * processing as specified by security session.
1776 * See struct rte_flow_action_security.
1778 RTE_FLOW_ACTION_TYPE_SECURITY,
1781 * Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the
1782 * OpenFlow Switch Specification.
1784 * See struct rte_flow_action_of_set_mpls_ttl.
1786 RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL,
1789 * Implements OFPAT_DEC_MPLS_TTL ("decrement MPLS TTL") as defined
1790 * by the OpenFlow Switch Specification.
1792 * No associated configuration structure.
1794 RTE_FLOW_ACTION_TYPE_OF_DEC_MPLS_TTL,
1797 * Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow
1798 * Switch Specification.
1800 * See struct rte_flow_action_of_set_nw_ttl.
1802 RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL,
1805 * Implements OFPAT_DEC_NW_TTL ("decrement IP TTL") as defined by
1806 * the OpenFlow Switch Specification.
1808 * No associated configuration structure.
1810 RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL,
1813 * Implements OFPAT_COPY_TTL_OUT ("copy TTL "outwards" -- from
1814 * next-to-outermost to outermost") as defined by the OpenFlow
1815 * Switch Specification.
1817 * No associated configuration structure.
1819 RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_OUT,
1822 * Implements OFPAT_COPY_TTL_IN ("copy TTL "inwards" -- from
1823 * outermost to next-to-outermost") as defined by the OpenFlow
1824 * Switch Specification.
1826 * No associated configuration structure.
1828 RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_IN,
1831 * Implements OFPAT_POP_VLAN ("pop the outer VLAN tag") as defined
1832 * by the OpenFlow Switch Specification.
1834 * No associated configuration structure.
1836 RTE_FLOW_ACTION_TYPE_OF_POP_VLAN,
1839 * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by
1840 * the OpenFlow Switch Specification.
1842 * See struct rte_flow_action_of_push_vlan.
1844 RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN,
1847 * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN id") as
1848 * defined by the OpenFlow Switch Specification.
1850 * See struct rte_flow_action_of_set_vlan_vid.
1852 RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID,
1855 * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as
1856 * defined by the OpenFlow Switch Specification.
1858 * See struct rte_flow_action_of_set_vlan_pcp.
1860 RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP,
1863 * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined
1864 * by the OpenFlow Switch Specification.
1866 * See struct rte_flow_action_of_pop_mpls.
1868 RTE_FLOW_ACTION_TYPE_OF_POP_MPLS,
1871 * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by
1872 * the OpenFlow Switch Specification.
1874 * See struct rte_flow_action_of_push_mpls.
1876 RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS,
1879 * Encapsulate flow in VXLAN tunnel as defined in
1880 * rte_flow_action_vxlan_encap action structure.
1882 * See struct rte_flow_action_vxlan_encap.
1884 RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP,
1887 * Decapsulate outer most VXLAN tunnel from matched flow.
1889 * If flow pattern does not define a valid VXLAN tunnel (as specified by
1890 * RFC7348) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
1893 RTE_FLOW_ACTION_TYPE_VXLAN_DECAP,
1896 * Encapsulate flow in NVGRE tunnel defined in the
1897 * rte_flow_action_nvgre_encap action structure.
1899 * See struct rte_flow_action_nvgre_encap.
1901 RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP,
1904 * Decapsulate outer most NVGRE tunnel from matched flow.
1906 * If flow pattern does not define a valid NVGRE tunnel (as specified by
1907 * RFC7637) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
1910 RTE_FLOW_ACTION_TYPE_NVGRE_DECAP,
1913 * Add outer header whose template is provided in its data buffer
1915 * See struct rte_flow_action_raw_encap.
1917 RTE_FLOW_ACTION_TYPE_RAW_ENCAP,
1920 * Remove outer header whose template is provided in its data buffer.
1922 * See struct rte_flow_action_raw_decap
1924 RTE_FLOW_ACTION_TYPE_RAW_DECAP,
1927 * Modify IPv4 source address in the outermost IPv4 header.
1929 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
1930 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
1932 * See struct rte_flow_action_set_ipv4.
1934 RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC,
1937 * Modify IPv4 destination address in the outermost IPv4 header.
1939 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
1940 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
1942 * See struct rte_flow_action_set_ipv4.
1944 RTE_FLOW_ACTION_TYPE_SET_IPV4_DST,
1947 * Modify IPv6 source address in the outermost IPv6 header.
1949 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
1950 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
1952 * See struct rte_flow_action_set_ipv6.
1954 RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC,
1957 * Modify IPv6 destination address in the outermost IPv6 header.
1959 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
1960 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
1962 * See struct rte_flow_action_set_ipv6.
1964 RTE_FLOW_ACTION_TYPE_SET_IPV6_DST,
1967 * Modify source port number in the outermost TCP/UDP header.
1969 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
1970 * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
1971 * RTE_FLOW_ERROR_TYPE_ACTION error.
1973 * See struct rte_flow_action_set_tp.
1975 RTE_FLOW_ACTION_TYPE_SET_TP_SRC,
1978 * Modify destination port number in the outermost TCP/UDP header.
1980 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
1981 * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
1982 * RTE_FLOW_ERROR_TYPE_ACTION error.
1984 * See struct rte_flow_action_set_tp.
1986 RTE_FLOW_ACTION_TYPE_SET_TP_DST,
1989 * Swap the source and destination MAC addresses in the outermost
1992 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
1993 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
1995 * No associated configuration structure.
1997 RTE_FLOW_ACTION_TYPE_MAC_SWAP,
2000 * Decrease TTL value directly
2002 * No associated configuration structure.
2004 RTE_FLOW_ACTION_TYPE_DEC_TTL,
2009 * See struct rte_flow_action_set_ttl
2011 RTE_FLOW_ACTION_TYPE_SET_TTL,
2014 * Set source MAC address from matched flow.
2016 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2017 * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2019 * See struct rte_flow_action_set_mac.
2021 RTE_FLOW_ACTION_TYPE_SET_MAC_SRC,
2024 * Set destination MAC address from matched flow.
2026 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2027 * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2029 * See struct rte_flow_action_set_mac.
2031 RTE_FLOW_ACTION_TYPE_SET_MAC_DST,
2034 * Increase sequence number in the outermost TCP header.
2036 * Action configuration specifies the value to increase
2037 * TCP sequence number as a big-endian 32 bit integer.
2040 * @code rte_be32_t * @endcode
2042 * Using this action on non-matching traffic will result in
2043 * undefined behavior.
2045 RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ,
2048 * Decrease sequence number in the outermost TCP header.
2050 * Action configuration specifies the value to decrease
2051 * TCP sequence number as a big-endian 32 bit integer.
2054 * @code rte_be32_t * @endcode
2056 * Using this action on non-matching traffic will result in
2057 * undefined behavior.
2059 RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ,
2062 * Increase acknowledgment number in the outermost TCP header.
2064 * Action configuration specifies the value to increase
2065 * TCP acknowledgment number as a big-endian 32 bit integer.
2068 * @code rte_be32_t * @endcode
2070 * Using this action on non-matching traffic will result in
2071 * undefined behavior.
2073 RTE_FLOW_ACTION_TYPE_INC_TCP_ACK,
2076 * Decrease acknowledgment number in the outermost TCP header.
2078 * Action configuration specifies the value to decrease
2079 * TCP acknowledgment number as a big-endian 32 bit integer.
2082 * @code rte_be32_t * @endcode
2084 * Using this action on non-matching traffic will result in
2085 * undefined behavior.
2087 RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK,
2092 * Tag is for internal flow usage only and
2093 * is not delivered to the application.
2095 * See struct rte_flow_action_set_tag.
2097 RTE_FLOW_ACTION_TYPE_SET_TAG,
2100 * Set metadata on ingress or egress path.
2102 * See struct rte_flow_action_set_meta.
2104 RTE_FLOW_ACTION_TYPE_SET_META,
2107 * Modify IPv4 DSCP in the outermost IP header.
2109 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2110 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2112 * See struct rte_flow_action_set_dscp.
2114 RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP,
2117 * Modify IPv6 DSCP in the outermost IP header.
2119 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2120 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2122 * See struct rte_flow_action_set_dscp.
2124 RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP,
2127 * Report as aged flow if timeout passed without any matching on the
2130 * See struct rte_flow_action_age.
2131 * See function rte_flow_get_aged_flows
2132 * see enum RTE_ETH_EVENT_FLOW_AGED
2134 RTE_FLOW_ACTION_TYPE_AGE,
2138 * RTE_FLOW_ACTION_TYPE_MARK
2140 * Attaches an integer value to packets and sets PKT_RX_FDIR and
2141 * PKT_RX_FDIR_ID mbuf flags.
2143 * This value is arbitrary and application-defined. Maximum allowed value
2144 * depends on the underlying implementation. It is returned in the
2145 * hash.fdir.hi mbuf field.
2147 struct rte_flow_action_mark {
2148 uint32_t id; /**< Integer value to return with packets. */
2153 * @b EXPERIMENTAL: this structure may change without prior notice
2155 * RTE_FLOW_ACTION_TYPE_JUMP
2157 * Redirects packets to a group on the current device.
2159 * In a hierarchy of groups, which can be used to represent physical or logical
2160 * flow tables on the device, this action allows the action to be a redirect to
2161 * a group on that device.
2163 struct rte_flow_action_jump {
2168 * RTE_FLOW_ACTION_TYPE_QUEUE
2170 * Assign packets to a given queue index.
2172 struct rte_flow_action_queue {
2173 uint16_t index; /**< Queue index to use. */
2178 * @b EXPERIMENTAL: this structure may change without prior notice
2180 * RTE_FLOW_ACTION_TYPE_AGE
2182 * Report flow as aged-out if timeout passed without any matching
2183 * on the flow. RTE_ETH_EVENT_FLOW_AGED event is triggered when a
2184 * port detects new aged-out flows.
2186 * The flow context and the flow handle will be reported by the
2187 * rte_flow_get_aged_flows API.
2189 struct rte_flow_action_age {
2190 uint32_t timeout:24; /**< Time in seconds. */
2191 uint32_t reserved:8; /**< Reserved, must be zero. */
2193 /**< The user flow context, NULL means the rte_flow pointer. */
2198 * @b EXPERIMENTAL: this structure may change without prior notice
2200 * RTE_FLOW_ACTION_TYPE_COUNT
2202 * Adds a counter action to a matched flow.
2204 * If more than one count action is specified in a single flow rule, then each
2205 * action must specify a unique id.
2207 * Counters can be retrieved and reset through ``rte_flow_query()``, see
2208 * ``struct rte_flow_query_count``.
2210 * The shared flag indicates whether the counter is unique to the flow rule the
2211 * action is specified with, or whether it is a shared counter.
2213 * For a count action with the shared flag set, then then a global device
2214 * namespace is assumed for the counter id, so that any matched flow rules using
2215 * a count action with the same counter id on the same port will contribute to
2218 * For ports within the same switch domain then the counter id namespace extends
2219 * to all ports within that switch domain.
2221 struct rte_flow_action_count {
2222 uint32_t shared:1; /**< Share counter ID with other flow rules. */
2223 uint32_t reserved:31; /**< Reserved, must be zero. */
2224 uint32_t id; /**< Counter ID. */
2228 * RTE_FLOW_ACTION_TYPE_COUNT (query)
2230 * Query structure to retrieve and reset flow rule counters.
2232 struct rte_flow_query_count {
2233 uint32_t reset:1; /**< Reset counters after query [in]. */
2234 uint32_t hits_set:1; /**< hits field is set [out]. */
2235 uint32_t bytes_set:1; /**< bytes field is set [out]. */
2236 uint32_t reserved:29; /**< Reserved, must be zero [in, out]. */
2237 uint64_t hits; /**< Number of hits for this rule [out]. */
2238 uint64_t bytes; /**< Number of bytes through this rule [out]. */
2242 * Hash function types.
2244 enum rte_eth_hash_function {
2245 RTE_ETH_HASH_FUNCTION_DEFAULT = 0,
2246 RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */
2247 RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */
2249 * Symmetric Toeplitz: src, dst will be replaced by
2250 * xor(src, dst). For the case with src/dst only,
2251 * src or dst address will xor with zero pair.
2253 RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
2254 RTE_ETH_HASH_FUNCTION_MAX,
2258 * RTE_FLOW_ACTION_TYPE_RSS
2260 * Similar to QUEUE, except RSS is additionally performed on packets to
2261 * spread them among several queues according to the provided parameters.
2263 * Unlike global RSS settings used by other DPDK APIs, unsetting the
2264 * @p types field does not disable RSS in a flow rule. Doing so instead
2265 * requests safe unspecified "best-effort" settings from the underlying PMD,
2266 * which depending on the flow rule, may result in anything ranging from
2267 * empty (single queue) to all-inclusive RSS.
2269 * Note: RSS hash result is stored in the hash.rss mbuf field which overlaps
2270 * hash.fdir.lo. Since the MARK action sets the hash.fdir.hi field only,
2271 * both can be requested simultaneously.
2273 struct rte_flow_action_rss {
2274 enum rte_eth_hash_function func; /**< RSS hash function to apply. */
2276 * Packet encapsulation level RSS hash @p types apply to.
2278 * - @p 0 requests the default behavior. Depending on the packet
2279 * type, it can mean outermost, innermost, anything in between or
2282 * It basically stands for the innermost encapsulation level RSS
2283 * can be performed on according to PMD and device capabilities.
2285 * - @p 1 requests RSS to be performed on the outermost packet
2286 * encapsulation level.
2288 * - @p 2 and subsequent values request RSS to be performed on the
2289 * specified inner packet encapsulation level, from outermost to
2290 * innermost (lower to higher values).
2292 * Values other than @p 0 are not necessarily supported.
2294 * Requesting a specific RSS level on unrecognized traffic results
2295 * in undefined behavior. For predictable results, it is recommended
2296 * to make the flow rule pattern match packet headers up to the
2297 * requested encapsulation level so that only matching traffic goes
2301 uint64_t types; /**< Specific RSS hash types (see ETH_RSS_*). */
2302 uint32_t key_len; /**< Hash key length in bytes. */
2303 uint32_t queue_num; /**< Number of entries in @p queue. */
2304 const uint8_t *key; /**< Hash key. */
2305 const uint16_t *queue; /**< Queue indices to use. */
2309 * RTE_FLOW_ACTION_TYPE_VF
2311 * Directs matching traffic to a given virtual function of the current
2314 * Packets matched by a VF pattern item can be redirected to their original
2315 * VF ID instead of the specified one. This parameter may not be available
2316 * and is not guaranteed to work properly if the VF part is matched by a
2317 * prior flow rule or if packets are not addressed to a VF in the first
2320 struct rte_flow_action_vf {
2321 uint32_t original:1; /**< Use original VF ID if possible. */
2322 uint32_t reserved:31; /**< Reserved, must be zero. */
2323 uint32_t id; /**< VF ID. */
2327 * RTE_FLOW_ACTION_TYPE_PHY_PORT
2329 * Directs packets to a given physical port index of the underlying
2332 * @see RTE_FLOW_ITEM_TYPE_PHY_PORT
2334 struct rte_flow_action_phy_port {
2335 uint32_t original:1; /**< Use original port index if possible. */
2336 uint32_t reserved:31; /**< Reserved, must be zero. */
2337 uint32_t index; /**< Physical port index. */
2341 * RTE_FLOW_ACTION_TYPE_PORT_ID
2343 * Directs matching traffic to a given DPDK port ID.
2345 * @see RTE_FLOW_ITEM_TYPE_PORT_ID
2347 struct rte_flow_action_port_id {
2348 uint32_t original:1; /**< Use original DPDK port ID if possible. */
2349 uint32_t reserved:31; /**< Reserved, must be zero. */
2350 uint32_t id; /**< DPDK port ID. */
2354 * RTE_FLOW_ACTION_TYPE_METER
2356 * Traffic metering and policing (MTR).
2358 * Packets matched by items of this type can be either dropped or passed to the
2359 * next item with their color set by the MTR object.
2361 struct rte_flow_action_meter {
2362 uint32_t mtr_id; /**< MTR object ID created with rte_mtr_create(). */
2366 * RTE_FLOW_ACTION_TYPE_SECURITY
2368 * Perform the security action on flows matched by the pattern items
2369 * according to the configuration of the security session.
2371 * This action modifies the payload of matched flows. For INLINE_CRYPTO, the
2372 * security protocol headers and IV are fully provided by the application as
2373 * specified in the flow pattern. The payload of matching packets is
2374 * encrypted on egress, and decrypted and authenticated on ingress.
2375 * For INLINE_PROTOCOL, the security protocol is fully offloaded to HW,
2376 * providing full encapsulation and decapsulation of packets in security
2377 * protocols. The flow pattern specifies both the outer security header fields
2378 * and the inner packet fields. The security session specified in the action
2379 * must match the pattern parameters.
2381 * The security session specified in the action must be created on the same
2382 * port as the flow action that is being specified.
2384 * The ingress/egress flow attribute should match that specified in the
2385 * security session if the security session supports the definition of the
2388 * Multiple flows can be configured to use the same security session.
2390 * The NULL value is allowed for security session. If security session is NULL,
2391 * then SPI field in ESP flow item and IP addresses in flow items 'IPv4' and
2392 * 'IPv6' will be allowed to be a range. The rule thus created can enable
2393 * security processing on multiple flows.
2395 struct rte_flow_action_security {
2396 void *security_session; /**< Pointer to security session structure. */
2400 * RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL
2402 * Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the OpenFlow
2403 * Switch Specification.
2405 struct rte_flow_action_of_set_mpls_ttl {
2406 uint8_t mpls_ttl; /**< MPLS TTL. */
2410 * RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL
2412 * Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow Switch
2415 struct rte_flow_action_of_set_nw_ttl {
2416 uint8_t nw_ttl; /**< IP TTL. */
2420 * RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN
2422 * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by the
2423 * OpenFlow Switch Specification.
2425 struct rte_flow_action_of_push_vlan {
2426 rte_be16_t ethertype; /**< EtherType. */
2430 * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID
2432 * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN id") as defined by
2433 * the OpenFlow Switch Specification.
2435 struct rte_flow_action_of_set_vlan_vid {
2436 rte_be16_t vlan_vid; /**< VLAN id. */
2440 * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP
2442 * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as defined by
2443 * the OpenFlow Switch Specification.
2445 struct rte_flow_action_of_set_vlan_pcp {
2446 uint8_t vlan_pcp; /**< VLAN priority. */
2450 * RTE_FLOW_ACTION_TYPE_OF_POP_MPLS
2452 * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined by the
2453 * OpenFlow Switch Specification.
2455 struct rte_flow_action_of_pop_mpls {
2456 rte_be16_t ethertype; /**< EtherType. */
2460 * RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS
2462 * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by the
2463 * OpenFlow Switch Specification.
2465 struct rte_flow_action_of_push_mpls {
2466 rte_be16_t ethertype; /**< EtherType. */
2471 * @b EXPERIMENTAL: this structure may change without prior notice
2473 * RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP
2475 * VXLAN tunnel end-point encapsulation data definition
2477 * The tunnel definition is provided through the flow item pattern, the
2478 * provided pattern must conform to RFC7348 for the tunnel specified. The flow
2479 * definition must be provided in order from the RTE_FLOW_ITEM_TYPE_ETH
2480 * definition up the end item which is specified by RTE_FLOW_ITEM_TYPE_END.
2482 * The mask field allows user to specify which fields in the flow item
2483 * definitions can be ignored and which have valid data and can be used
2486 * Note: the last field is not used in the definition of a tunnel and can be
2489 * Valid flow definition for RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP include:
2491 * - ETH / IPV4 / UDP / VXLAN / END
2492 * - ETH / IPV6 / UDP / VXLAN / END
2493 * - ETH / VLAN / IPV4 / UDP / VXLAN / END
2496 struct rte_flow_action_vxlan_encap {
2498 * Encapsulating vxlan tunnel definition
2499 * (terminated by the END pattern item).
2501 struct rte_flow_item *definition;
2506 * @b EXPERIMENTAL: this structure may change without prior notice
2508 * RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP
2510 * NVGRE tunnel end-point encapsulation data definition
2512 * The tunnel definition is provided through the flow item pattern the
2513 * provided pattern must conform with RFC7637. The flow definition must be
2514 * provided in order from the RTE_FLOW_ITEM_TYPE_ETH definition up the end item
2515 * which is specified by RTE_FLOW_ITEM_TYPE_END.
2517 * The mask field allows user to specify which fields in the flow item
2518 * definitions can be ignored and which have valid data and can be used
2521 * Note: the last field is not used in the definition of a tunnel and can be
2524 * Valid flow definition for RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP include:
2526 * - ETH / IPV4 / NVGRE / END
2527 * - ETH / VLAN / IPV6 / NVGRE / END
2530 struct rte_flow_action_nvgre_encap {
2532 * Encapsulating vxlan tunnel definition
2533 * (terminated by the END pattern item).
2535 struct rte_flow_item *definition;
2540 * @b EXPERIMENTAL: this structure may change without prior notice
2542 * RTE_FLOW_ACTION_TYPE_RAW_ENCAP
2544 * Raw tunnel end-point encapsulation data definition.
2546 * The data holds the headers definitions to be applied on the packet.
2547 * The data must start with ETH header up to the tunnel item header itself.
2548 * When used right after RAW_DECAP (for decapsulating L3 tunnel type for
2549 * example MPLSoGRE) the data will just hold layer 2 header.
2551 * The preserve parameter holds which bits in the packet the PMD is not allowed
2552 * to change, this parameter can also be NULL and then the PMD is allowed
2553 * to update any field.
2555 * size holds the number of bytes in @p data and @p preserve.
2557 struct rte_flow_action_raw_encap {
2558 uint8_t *data; /**< Encapsulation data. */
2559 uint8_t *preserve; /**< Bit-mask of @p data to preserve on output. */
2560 size_t size; /**< Size of @p data and @p preserve. */
2565 * @b EXPERIMENTAL: this structure may change without prior notice
2567 * RTE_FLOW_ACTION_TYPE_RAW_DECAP
2569 * Raw tunnel end-point decapsulation data definition.
2571 * The data holds the headers definitions to be removed from the packet.
2572 * The data must start with ETH header up to the tunnel item header itself.
2573 * When used right before RAW_DECAP (for encapsulating L3 tunnel type for
2574 * example MPLSoGRE) the data will just hold layer 2 header.
2576 * size holds the number of bytes in @p data.
2578 struct rte_flow_action_raw_decap {
2579 uint8_t *data; /**< Encapsulation data. */
2580 size_t size; /**< Size of @p data and @p preserve. */
2585 * @b EXPERIMENTAL: this structure may change without prior notice
2587 * RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC
2588 * RTE_FLOW_ACTION_TYPE_SET_IPV4_DST
2590 * Allows modification of IPv4 source (RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC)
2591 * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV4_DST) in the
2592 * specified outermost IPv4 header.
2594 struct rte_flow_action_set_ipv4 {
2595 rte_be32_t ipv4_addr;
2600 * @b EXPERIMENTAL: this structure may change without prior notice
2602 * RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC
2603 * RTE_FLOW_ACTION_TYPE_SET_IPV6_DST
2605 * Allows modification of IPv6 source (RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC)
2606 * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) in the
2607 * specified outermost IPv6 header.
2609 struct rte_flow_action_set_ipv6 {
2610 uint8_t ipv6_addr[16];
2615 * @b EXPERIMENTAL: this structure may change without prior notice
2617 * RTE_FLOW_ACTION_TYPE_SET_TP_SRC
2618 * RTE_FLOW_ACTION_TYPE_SET_TP_DST
2620 * Allows modification of source (RTE_FLOW_ACTION_TYPE_SET_TP_SRC)
2621 * and destination (RTE_FLOW_ACTION_TYPE_SET_TP_DST) port numbers
2622 * in the specified outermost TCP/UDP header.
2624 struct rte_flow_action_set_tp {
2629 * RTE_FLOW_ACTION_TYPE_SET_TTL
2631 * Set the TTL value directly for IPv4 or IPv6
2633 struct rte_flow_action_set_ttl {
2638 * RTE_FLOW_ACTION_TYPE_SET_MAC
2640 * Set MAC address from the matched flow
2642 struct rte_flow_action_set_mac {
2643 uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
2648 * @b EXPERIMENTAL: this structure may change without prior notice
2650 * RTE_FLOW_ACTION_TYPE_SET_TAG
2652 * Set a tag which is a transient data used during flow matching. This is not
2653 * delivered to application. Multiple tags are supported by specifying index.
2655 struct rte_flow_action_set_tag {
2663 * @b EXPERIMENTAL: this structure may change without prior notice
2665 * RTE_FLOW_ACTION_TYPE_SET_META
2667 * Set metadata. Metadata set by mbuf metadata dynamic field with
2668 * PKT_TX_DYNF_DATA flag on egress will be overridden by this action. On
2669 * ingress, the metadata will be carried by mbuf metadata dynamic field
2670 * with PKT_RX_DYNF_METADATA flag if set. The dynamic mbuf field must be
2671 * registered in advance by rte_flow_dynf_metadata_register().
2673 * Altering partial bits is supported with mask. For bits which have never
2674 * been set, unpredictable value will be seen depending on driver
2675 * implementation. For loopback/hairpin packet, metadata set on Rx/Tx may
2676 * or may not be propagated to the other path depending on HW capability.
2678 * RTE_FLOW_ITEM_TYPE_META matches metadata.
2680 struct rte_flow_action_set_meta {
2686 * RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP
2687 * RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP
2689 * Set the DSCP value for IPv4/IPv6 header.
2690 * DSCP in low 6 bits, rest ignored.
2692 struct rte_flow_action_set_dscp {
2696 /* Mbuf dynamic field offset for metadata. */
2697 extern int32_t rte_flow_dynf_metadata_offs;
2699 /* Mbuf dynamic field flag mask for metadata. */
2700 extern uint64_t rte_flow_dynf_metadata_mask;
2702 /* Mbuf dynamic field pointer for metadata. */
2703 #define RTE_FLOW_DYNF_METADATA(m) \
2704 RTE_MBUF_DYNFIELD((m), rte_flow_dynf_metadata_offs, uint32_t *)
2706 /* Mbuf dynamic flags for metadata. */
2707 #define PKT_RX_DYNF_METADATA (rte_flow_dynf_metadata_mask)
2708 #define PKT_TX_DYNF_METADATA (rte_flow_dynf_metadata_mask)
2711 static inline uint32_t
2712 rte_flow_dynf_metadata_get(struct rte_mbuf *m)
2714 return *RTE_FLOW_DYNF_METADATA(m);
2719 rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v)
2721 *RTE_FLOW_DYNF_METADATA(m) = v;
2725 * Definition of a single action.
2727 * A list of actions is terminated by a END action.
2729 * For simple actions without a configuration object, conf remains NULL.
2731 struct rte_flow_action {
2732 enum rte_flow_action_type type; /**< Action type. */
2733 const void *conf; /**< Pointer to action configuration object. */
2737 * Opaque type returned after successfully creating a flow.
2739 * This handle can be used to manage and query the related flow (e.g. to
2740 * destroy it or retrieve counters).
2745 * Verbose error types.
2747 * Most of them provide the type of the object referenced by struct
2748 * rte_flow_error.cause.
2750 enum rte_flow_error_type {
2751 RTE_FLOW_ERROR_TYPE_NONE, /**< No error. */
2752 RTE_FLOW_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
2753 RTE_FLOW_ERROR_TYPE_HANDLE, /**< Flow rule (handle). */
2754 RTE_FLOW_ERROR_TYPE_ATTR_GROUP, /**< Group field. */
2755 RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, /**< Priority field. */
2756 RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, /**< Ingress field. */
2757 RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, /**< Egress field. */
2758 RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, /**< Transfer field. */
2759 RTE_FLOW_ERROR_TYPE_ATTR, /**< Attributes structure. */
2760 RTE_FLOW_ERROR_TYPE_ITEM_NUM, /**< Pattern length. */
2761 RTE_FLOW_ERROR_TYPE_ITEM_SPEC, /**< Item specification. */
2762 RTE_FLOW_ERROR_TYPE_ITEM_LAST, /**< Item specification range. */
2763 RTE_FLOW_ERROR_TYPE_ITEM_MASK, /**< Item specification mask. */
2764 RTE_FLOW_ERROR_TYPE_ITEM, /**< Specific pattern item. */
2765 RTE_FLOW_ERROR_TYPE_ACTION_NUM, /**< Number of actions. */
2766 RTE_FLOW_ERROR_TYPE_ACTION_CONF, /**< Action configuration. */
2767 RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */
2771 * Verbose error structure definition.
2773 * This object is normally allocated by applications and set by PMDs, the
2774 * message points to a constant string which does not need to be freed by
2775 * the application, however its pointer can be considered valid only as long
2776 * as its associated DPDK port remains configured. Closing the underlying
2777 * device or unloading the PMD invalidates it.
2779 * Both cause and message may be NULL regardless of the error type.
2781 struct rte_flow_error {
2782 enum rte_flow_error_type type; /**< Cause field and error types. */
2783 const void *cause; /**< Object responsible for the error. */
2784 const char *message; /**< Human-readable error message. */
2788 * Complete flow rule description.
2790 * This object type is used when converting a flow rule description.
2792 * @see RTE_FLOW_CONV_OP_RULE
2793 * @see rte_flow_conv()
2796 struct rte_flow_conv_rule {
2798 const struct rte_flow_attr *attr_ro; /**< RO attributes. */
2799 struct rte_flow_attr *attr; /**< Attributes. */
2802 const struct rte_flow_item *pattern_ro; /**< RO pattern. */
2803 struct rte_flow_item *pattern; /**< Pattern items. */
2806 const struct rte_flow_action *actions_ro; /**< RO actions. */
2807 struct rte_flow_action *actions; /**< List of actions. */
2812 * Conversion operations for flow API objects.
2814 * @see rte_flow_conv()
2816 enum rte_flow_conv_op {
2818 * No operation to perform.
2820 * rte_flow_conv() simply returns 0.
2822 RTE_FLOW_CONV_OP_NONE,
2825 * Convert attributes structure.
2827 * This is a basic copy of an attributes structure.
2830 * @code const struct rte_flow_attr * @endcode
2832 * @code struct rte_flow_attr * @endcode
2834 RTE_FLOW_CONV_OP_ATTR,
2837 * Convert a single item.
2839 * Duplicates @p spec, @p last and @p mask but not outside objects.
2842 * @code const struct rte_flow_item * @endcode
2844 * @code struct rte_flow_item * @endcode
2846 RTE_FLOW_CONV_OP_ITEM,
2849 * Convert a single action.
2851 * Duplicates @p conf but not outside objects.
2854 * @code const struct rte_flow_action * @endcode
2856 * @code struct rte_flow_action * @endcode
2858 RTE_FLOW_CONV_OP_ACTION,
2861 * Convert an entire pattern.
2863 * Duplicates all pattern items at once with the same constraints as
2864 * RTE_FLOW_CONV_OP_ITEM.
2867 * @code const struct rte_flow_item * @endcode
2869 * @code struct rte_flow_item * @endcode
2871 RTE_FLOW_CONV_OP_PATTERN,
2874 * Convert a list of actions.
2876 * Duplicates the entire list of actions at once with the same
2877 * constraints as RTE_FLOW_CONV_OP_ACTION.
2880 * @code const struct rte_flow_action * @endcode
2882 * @code struct rte_flow_action * @endcode
2884 RTE_FLOW_CONV_OP_ACTIONS,
2887 * Convert a complete flow rule description.
2889 * Comprises attributes, pattern and actions together at once with
2890 * the usual constraints.
2893 * @code const struct rte_flow_conv_rule * @endcode
2895 * @code struct rte_flow_conv_rule * @endcode
2897 RTE_FLOW_CONV_OP_RULE,
2900 * Convert item type to its name string.
2902 * Writes a NUL-terminated string to @p dst. Like snprintf(), the
2903 * returned value excludes the terminator which is always written
2907 * @code (const void *)enum rte_flow_item_type @endcode
2909 * @code char * @endcode
2911 RTE_FLOW_CONV_OP_ITEM_NAME,
2914 * Convert action type to its name string.
2916 * Writes a NUL-terminated string to @p dst. Like snprintf(), the
2917 * returned value excludes the terminator which is always written
2921 * @code (const void *)enum rte_flow_action_type @endcode
2923 * @code char * @endcode
2925 RTE_FLOW_CONV_OP_ACTION_NAME,
2928 * Convert item type to pointer to item name.
2930 * Retrieves item name pointer from its type. The string itself is
2931 * not copied; instead, a unique pointer to an internal static
2932 * constant storage is written to @p dst.
2935 * @code (const void *)enum rte_flow_item_type @endcode
2937 * @code const char ** @endcode
2939 RTE_FLOW_CONV_OP_ITEM_NAME_PTR,
2942 * Convert action type to pointer to action name.
2944 * Retrieves action name pointer from its type. The string itself is
2945 * not copied; instead, a unique pointer to an internal static
2946 * constant storage is written to @p dst.
2949 * @code (const void *)enum rte_flow_action_type @endcode
2951 * @code const char ** @endcode
2953 RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
2958 * @b EXPERIMENTAL: this API may change without prior notice.
2960 * Dump hardware internal representation information of
2963 * @param[in] port_id
2964 * The port identifier of the Ethernet device.
2966 * A pointer to a file for output.
2968 * Perform verbose error reporting if not NULL. PMDs initialize this
2969 * structure in case of error only.
2971 * 0 on success, a nagative value otherwise.
2975 rte_flow_dev_dump(uint16_t port_id, FILE *file, struct rte_flow_error *error);
2978 * Check if mbuf dynamic field for metadata is registered.
2981 * True if registered, false otherwise.
2985 rte_flow_dynf_metadata_avail(void)
2987 return !!rte_flow_dynf_metadata_mask;
2991 * Register mbuf dynamic field and flag for metadata.
2993 * This function must be called prior to use SET_META action in order to
2994 * register the dynamic mbuf field. Otherwise, the data cannot be delivered to
2998 * 0 on success, a negative errno value otherwise and rte_errno is set.
3002 rte_flow_dynf_metadata_register(void);
3005 * Check whether a flow rule can be created on a given port.
3007 * The flow rule is validated for correctness and whether it could be accepted
3008 * by the device given sufficient resources. The rule is checked against the
3009 * current device mode and queue configuration. The flow rule may also
3010 * optionally be validated against existing flow rules and device resources.
3011 * This function has no effect on the target device.
3013 * The returned value is guaranteed to remain valid only as long as no
3014 * successful calls to rte_flow_create() or rte_flow_destroy() are made in
3015 * the meantime and no device parameter affecting flow rules in any way are
3016 * modified, due to possible collisions or resource limitations (although in
3017 * such cases EINVAL should not be returned).
3020 * Port identifier of Ethernet device.
3022 * Flow rule attributes.
3023 * @param[in] pattern
3024 * Pattern specification (list terminated by the END pattern item).
3025 * @param[in] actions
3026 * Associated actions (list terminated by the END action).
3028 * Perform verbose error reporting if not NULL. PMDs initialize this
3029 * structure in case of error only.
3032 * 0 if flow rule is valid and can be created. A negative errno value
3033 * otherwise (rte_errno is also set), the following errors are defined:
3035 * -ENOSYS: underlying device does not support this functionality.
3037 * -EIO: underlying device is removed.
3039 * -EINVAL: unknown or invalid rule specification.
3041 * -ENOTSUP: valid but unsupported rule specification (e.g. partial
3042 * bit-masks are unsupported).
3044 * -EEXIST: collision with an existing rule. Only returned if device
3045 * supports flow rule collision checking and there was a flow rule
3046 * collision. Not receiving this return code is no guarantee that creating
3047 * the rule will not fail due to a collision.
3049 * -ENOMEM: not enough memory to execute the function, or if the device
3050 * supports resource validation, resource limitation on the device.
3052 * -EBUSY: action cannot be performed due to busy device resources, may
3053 * succeed if the affected queues or even the entire port are in a stopped
3054 * state (see rte_eth_dev_rx_queue_stop() and rte_eth_dev_stop()).
3057 rte_flow_validate(uint16_t port_id,
3058 const struct rte_flow_attr *attr,
3059 const struct rte_flow_item pattern[],
3060 const struct rte_flow_action actions[],
3061 struct rte_flow_error *error);
3064 * Create a flow rule on a given port.
3067 * Port identifier of Ethernet device.
3069 * Flow rule attributes.
3070 * @param[in] pattern
3071 * Pattern specification (list terminated by the END pattern item).
3072 * @param[in] actions
3073 * Associated actions (list terminated by the END action).
3075 * Perform verbose error reporting if not NULL. PMDs initialize this
3076 * structure in case of error only.
3079 * A valid handle in case of success, NULL otherwise and rte_errno is set
3080 * to the positive version of one of the error codes defined for
3081 * rte_flow_validate().
3084 rte_flow_create(uint16_t port_id,
3085 const struct rte_flow_attr *attr,
3086 const struct rte_flow_item pattern[],
3087 const struct rte_flow_action actions[],
3088 struct rte_flow_error *error);
3091 * Destroy a flow rule on a given port.
3093 * Failure to destroy a flow rule handle may occur when other flow rules
3094 * depend on it, and destroying it would result in an inconsistent state.
3096 * This function is only guaranteed to succeed if handles are destroyed in
3097 * reverse order of their creation.
3100 * Port identifier of Ethernet device.
3102 * Flow rule handle to destroy.
3104 * Perform verbose error reporting if not NULL. PMDs initialize this
3105 * structure in case of error only.
3108 * 0 on success, a negative errno value otherwise and rte_errno is set.
3111 rte_flow_destroy(uint16_t port_id,
3112 struct rte_flow *flow,
3113 struct rte_flow_error *error);
3116 * Destroy all flow rules associated with a port.
3118 * In the unlikely event of failure, handles are still considered destroyed
3119 * and no longer valid but the port must be assumed to be in an inconsistent
3123 * Port identifier of Ethernet device.
3125 * Perform verbose error reporting if not NULL. PMDs initialize this
3126 * structure in case of error only.
3129 * 0 on success, a negative errno value otherwise and rte_errno is set.
3132 rte_flow_flush(uint16_t port_id,
3133 struct rte_flow_error *error);
3136 * Query an existing flow rule.
3138 * This function allows retrieving flow-specific data such as counters.
3139 * Data is gathered by special actions which must be present in the flow
3142 * \see RTE_FLOW_ACTION_TYPE_COUNT
3145 * Port identifier of Ethernet device.
3147 * Flow rule handle to query.
3149 * Action definition as defined in original flow rule.
3150 * @param[in, out] data
3151 * Pointer to storage for the associated query data type.
3153 * Perform verbose error reporting if not NULL. PMDs initialize this
3154 * structure in case of error only.
3157 * 0 on success, a negative errno value otherwise and rte_errno is set.
3160 rte_flow_query(uint16_t port_id,
3161 struct rte_flow *flow,
3162 const struct rte_flow_action *action,
3164 struct rte_flow_error *error);
3167 * Restrict ingress traffic to the defined flow rules.
3169 * Isolated mode guarantees that all ingress traffic comes from defined flow
3170 * rules only (current and future).
3172 * Besides making ingress more deterministic, it allows PMDs to safely reuse
3173 * resources otherwise assigned to handle the remaining traffic, such as
3174 * global RSS configuration settings, VLAN filters, MAC address entries,
3175 * legacy filter API rules and so on in order to expand the set of possible
3178 * Calling this function as soon as possible after device initialization,
3179 * ideally before the first call to rte_eth_dev_configure(), is recommended
3180 * to avoid possible failures due to conflicting settings.
3182 * Once effective, leaving isolated mode may not be possible depending on
3183 * PMD implementation.
3185 * Additionally, the following functionality has no effect on the underlying
3186 * port and may return errors such as ENOTSUP ("not supported"):
3188 * - Toggling promiscuous mode.
3189 * - Toggling allmulticast mode.
3190 * - Configuring MAC addresses.
3191 * - Configuring multicast addresses.
3192 * - Configuring VLAN filters.
3193 * - Configuring Rx filters through the legacy API (e.g. FDIR).
3194 * - Configuring global RSS settings.
3197 * Port identifier of Ethernet device.
3199 * Nonzero to enter isolated mode, attempt to leave it otherwise.
3201 * Perform verbose error reporting if not NULL. PMDs initialize this
3202 * structure in case of error only.
3205 * 0 on success, a negative errno value otherwise and rte_errno is set.
3208 rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
3211 * Initialize flow error structure.
3214 * Pointer to flow error structure (may be NULL).
3216 * Related error code (rte_errno).
3218 * Cause field and error types.
3220 * Object responsible for the error.
3222 * Human-readable error message.
3225 * Negative error code (errno value) and rte_errno is set.
3228 rte_flow_error_set(struct rte_flow_error *error,
3230 enum rte_flow_error_type type,
3232 const char *message);
3236 * @see rte_flow_copy()
3238 struct rte_flow_desc {
3239 size_t size; /**< Allocated space including data[]. */
3240 struct rte_flow_attr attr; /**< Attributes. */
3241 struct rte_flow_item *items; /**< Items. */
3242 struct rte_flow_action *actions; /**< Actions. */
3243 uint8_t data[]; /**< Storage for items/actions. */
3248 * Copy an rte_flow rule description.
3250 * This interface is kept for compatibility with older applications but is
3251 * implemented as a wrapper to rte_flow_conv(). It is deprecated due to its
3252 * lack of flexibility and reliance on a type unusable with C++ programs
3253 * (struct rte_flow_desc).
3256 * Flow rule description.
3258 * Total size of allocated data for the flow description.
3260 * Flow rule attributes.
3262 * Pattern specification (list terminated by the END pattern item).
3263 * @param[in] actions
3264 * Associated actions (list terminated by the END action).
3267 * If len is greater or equal to the size of the flow, the total size of the
3268 * flow description and its data.
3269 * If len is lower than the size of the flow, the number of bytes that would
3270 * have been written to desc had it been sufficient. Nothing is written.
3274 rte_flow_copy(struct rte_flow_desc *fd, size_t len,
3275 const struct rte_flow_attr *attr,
3276 const struct rte_flow_item *items,
3277 const struct rte_flow_action *actions);
3280 * Flow object conversion helper.
3282 * This function performs conversion of various flow API objects to a
3283 * pre-allocated destination buffer. See enum rte_flow_conv_op for possible
3284 * operations and details about each of them.
3286 * Since destination buffer must be large enough, it works in a manner
3287 * reminiscent of snprintf():
3289 * - If @p size is 0, @p dst may be a NULL pointer, otherwise @p dst must be
3291 * - If positive, the returned value represents the number of bytes needed
3292 * to store the conversion of @p src to @p dst according to @p op
3293 * regardless of the @p size parameter.
3294 * - Since no more than @p size bytes can be written to @p dst, output is
3295 * truncated and may be inconsistent when the returned value is larger
3297 * - In case of conversion error, a negative error code is returned and
3298 * @p dst contents are unspecified.
3301 * Operation to perform, related to the object type of @p dst.
3303 * Destination buffer address. Must be suitably aligned by the caller.
3305 * Destination buffer size in bytes.
3307 * Source object to copy. Depending on @p op, its type may differ from
3310 * Perform verbose error reporting if not NULL. Initialized in case of
3314 * The number of bytes required to convert @p src to @p dst on success, a
3315 * negative errno value otherwise and rte_errno is set.
3317 * @see rte_flow_conv_op
3321 rte_flow_conv(enum rte_flow_conv_op op,
3325 struct rte_flow_error *error);
3328 * Get aged-out flows of a given port.
3330 * RTE_ETH_EVENT_FLOW_AGED event will be triggered when at least one new aged
3331 * out flow was detected after the last call to rte_flow_get_aged_flows.
3332 * This function can be called to get the aged flows usynchronously from the
3333 * event callback or synchronously regardless the event.
3334 * This is not safe to call rte_flow_get_aged_flows function with other flow
3335 * functions from multiple threads simultaneously.
3338 * Port identifier of Ethernet device.
3339 * @param[in, out] contexts
3340 * The address of an array of pointers to the aged-out flows contexts.
3341 * @param[in] nb_contexts
3342 * The length of context array pointers.
3344 * Perform verbose error reporting if not NULL. Initialized in case of
3348 * if nb_contexts is 0, return the amount of all aged contexts.
3349 * if nb_contexts is not 0 , return the amount of aged flows reported
3350 * in the context array, otherwise negative errno value.
3352 * @see rte_flow_action_age
3353 * @see RTE_ETH_EVENT_FLOW_AGED
3357 rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
3358 uint32_t nb_contexts, struct rte_flow_error *error);
3364 #endif /* RTE_FLOW_H_ */