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_vxlan.h>
29 #include <rte_byteorder.h>
31 #include <rte_higig.h>
32 #include <rte_ecpri.h>
33 #include <rte_bitops.h>
35 #include <rte_mbuf_dyn.h>
36 #include <rte_meter.h>
38 #include <rte_l2tpv2.h>
47 * Flow rule attributes.
49 * Priorities are set on a per rule based within groups.
51 * Lower values denote higher priority, the highest priority for a flow rule
52 * is 0, so that a flow that matches for than one rule, the rule with the
53 * lowest priority value will always be matched.
55 * Although optional, applications are encouraged to group similar rules as
56 * much as possible to fully take advantage of hardware capabilities
57 * (e.g. optimized matching) and work around limitations (e.g. a single
58 * pattern type possibly allowed in a given group). Applications should be
59 * aware that groups are not linked by default, and that they must be
60 * explicitly linked by the application using the JUMP action.
62 * Priority levels are arbitrary and up to the application, they
63 * do not need to be contiguous nor start from 0, however the maximum number
64 * varies between devices and may be affected by existing flow rules.
66 * If a packet is matched by several rules of a given group for a given
67 * priority level, the outcome is undefined. It can take any path, may be
68 * duplicated or even cause unrecoverable errors.
70 * Note that support for more than a single group and priority level is not
73 * At vNIC / ethdev level, flow rules can apply to inbound and / or outbound
74 * traffic (ingress / egress), with respect to the vNIC / ethdev in question.
75 * At embedded switch level, flow rules apply to all traffic seen by it
76 * unless fitting meta items are used to set concrete traffic source(s).
78 * Several pattern items and actions are valid and can be used in both
79 * directions. Those valid for only one direction are described as such.
81 * At least one direction must be specified.
83 * Specifying both directions at once for a given rule is not recommended
84 * but may be valid in a few cases.
86 struct rte_flow_attr {
87 uint32_t group; /**< Priority group. */
88 uint32_t priority; /**< Rule priority level within group. */
90 * The rule in question applies to ingress traffic (non-"transfer").
93 * It has been possible to combine this attribute with "transfer".
94 * Doing so has been assumed to restrict the scope of matching
95 * to traffic going from within the embedded switch toward the
96 * ethdev the flow rule being created through. This behaviour
97 * is deprecated. During the transition period, one may still
98 * rely on it, but PMDs and applications are encouraged to
99 * gradually move away from this approach.
103 * The rule in question applies to egress traffic (non-"transfer").
106 * It has been possible to combine this attribute with "transfer".
107 * Doing so has been assumed to restrict the scope of matching
108 * to traffic sent by the application by virtue of the ethdev
109 * the flow rule being created through. This behaviour is now
110 * deprecated. During the transition period, one may still
111 * rely on it, but PMDs and applications are encouraged to
112 * gradually move away from this approach.
116 * Instead of simply matching the properties of traffic as it would
117 * appear on a given DPDK port ID, enabling this attribute transfers
118 * a flow rule to the lowest possible level of any device endpoints
119 * found in the pattern.
121 * When supported, this effectively enables an application to
122 * re-route traffic not necessarily intended for it (e.g. coming
123 * from or addressed to different physical ports, VFs or
124 * applications) at the device level.
126 * The application should match traffic originating from precise
127 * locations. See items PORT_REPRESENTOR and REPRESENTED_PORT.
129 * Managing "transfer" flows requires that the user communicate them
130 * through a suitable port. @see rte_flow_pick_transfer_proxy().
133 uint32_t reserved:29; /**< Reserved, must be zero. */
137 * Matching pattern item types.
139 * Pattern items fall in two categories:
141 * - Matching protocol headers and packet data, usually associated with a
142 * specification structure. These must be stacked in the same order as the
143 * protocol layers to match inside packets, starting from the lowest.
145 * - Matching meta-data or affecting pattern processing, often without a
146 * specification structure. Since they do not match packet contents, their
147 * position in the list is usually not relevant.
149 * See the description of individual types for more information. Those
150 * marked with [META] fall into the second category.
152 enum rte_flow_item_type {
156 * End marker for item lists. Prevents further processing of items,
157 * thereby ending the pattern.
159 * No associated specification structure.
161 RTE_FLOW_ITEM_TYPE_END,
166 * Used as a placeholder for convenience. It is ignored and simply
169 * No associated specification structure.
171 RTE_FLOW_ITEM_TYPE_VOID,
176 * Inverted matching, i.e. process packets that do not match the
179 * No associated specification structure.
181 RTE_FLOW_ITEM_TYPE_INVERT,
184 * Matches any protocol in place of the current layer, a single ANY
185 * may also stand for several protocol layers.
187 * See struct rte_flow_item_any.
189 RTE_FLOW_ITEM_TYPE_ANY,
193 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
194 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
198 * Matches traffic originating from (ingress) or going to (egress)
199 * the physical function of the current device.
201 * No associated specification structure.
203 RTE_FLOW_ITEM_TYPE_PF,
207 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
208 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
212 * Matches traffic originating from (ingress) or going to (egress) a
213 * given virtual function of the current device.
215 * See struct rte_flow_item_vf.
217 RTE_FLOW_ITEM_TYPE_VF,
221 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
222 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
226 * Matches traffic originating from (ingress) or going to (egress) a
227 * physical port of the underlying device.
229 * See struct rte_flow_item_phy_port.
231 RTE_FLOW_ITEM_TYPE_PHY_PORT,
235 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
236 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
240 * Matches traffic originating from (ingress) or going to (egress) a
241 * given DPDK port ID.
243 * See struct rte_flow_item_port_id.
245 RTE_FLOW_ITEM_TYPE_PORT_ID,
248 * Matches a byte string of a given length at a given offset.
250 * See struct rte_flow_item_raw.
252 RTE_FLOW_ITEM_TYPE_RAW,
255 * Matches an Ethernet header.
257 * See struct rte_flow_item_eth.
259 RTE_FLOW_ITEM_TYPE_ETH,
262 * Matches an 802.1Q/ad VLAN tag.
264 * See struct rte_flow_item_vlan.
266 RTE_FLOW_ITEM_TYPE_VLAN,
269 * Matches an IPv4 header.
271 * See struct rte_flow_item_ipv4.
273 RTE_FLOW_ITEM_TYPE_IPV4,
276 * Matches an IPv6 header.
278 * See struct rte_flow_item_ipv6.
280 RTE_FLOW_ITEM_TYPE_IPV6,
283 * Matches an ICMP header.
285 * See struct rte_flow_item_icmp.
287 RTE_FLOW_ITEM_TYPE_ICMP,
290 * Matches a UDP header.
292 * See struct rte_flow_item_udp.
294 RTE_FLOW_ITEM_TYPE_UDP,
297 * Matches a TCP header.
299 * See struct rte_flow_item_tcp.
301 RTE_FLOW_ITEM_TYPE_TCP,
304 * Matches a SCTP header.
306 * See struct rte_flow_item_sctp.
308 RTE_FLOW_ITEM_TYPE_SCTP,
311 * Matches a VXLAN header.
313 * See struct rte_flow_item_vxlan.
315 RTE_FLOW_ITEM_TYPE_VXLAN,
318 * Matches a E_TAG header.
320 * See struct rte_flow_item_e_tag.
322 RTE_FLOW_ITEM_TYPE_E_TAG,
325 * Matches a NVGRE header.
327 * See struct rte_flow_item_nvgre.
329 RTE_FLOW_ITEM_TYPE_NVGRE,
332 * Matches a MPLS header.
334 * See struct rte_flow_item_mpls.
336 RTE_FLOW_ITEM_TYPE_MPLS,
339 * Matches a GRE header.
341 * See struct rte_flow_item_gre.
343 RTE_FLOW_ITEM_TYPE_GRE,
348 * Fuzzy pattern match, expect faster than default.
350 * This is for device that support fuzzy matching option.
351 * Usually a fuzzy matching is fast but the cost is accuracy.
353 * See struct rte_flow_item_fuzzy.
355 RTE_FLOW_ITEM_TYPE_FUZZY,
358 * Matches a GTP header.
360 * Configure flow for GTP packets.
362 * See struct rte_flow_item_gtp.
364 RTE_FLOW_ITEM_TYPE_GTP,
367 * Matches a GTP header.
369 * Configure flow for GTP-C packets.
371 * See struct rte_flow_item_gtp.
373 RTE_FLOW_ITEM_TYPE_GTPC,
376 * Matches a GTP header.
378 * Configure flow for GTP-U packets.
380 * See struct rte_flow_item_gtp.
382 RTE_FLOW_ITEM_TYPE_GTPU,
385 * Matches a ESP header.
387 * See struct rte_flow_item_esp.
389 RTE_FLOW_ITEM_TYPE_ESP,
392 * Matches a GENEVE header.
394 * See struct rte_flow_item_geneve.
396 RTE_FLOW_ITEM_TYPE_GENEVE,
399 * Matches a VXLAN-GPE header.
401 * See struct rte_flow_item_vxlan_gpe.
403 RTE_FLOW_ITEM_TYPE_VXLAN_GPE,
406 * Matches an ARP header for Ethernet/IPv4.
408 * See struct rte_flow_item_arp_eth_ipv4.
410 RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4,
413 * Matches the presence of any IPv6 extension header.
415 * See struct rte_flow_item_ipv6_ext.
417 RTE_FLOW_ITEM_TYPE_IPV6_EXT,
420 * Matches any ICMPv6 header.
422 * See struct rte_flow_item_icmp6.
424 RTE_FLOW_ITEM_TYPE_ICMP6,
427 * Matches an ICMPv6 neighbor discovery solicitation.
429 * See struct rte_flow_item_icmp6_nd_ns.
431 RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS,
434 * Matches an ICMPv6 neighbor discovery advertisement.
436 * See struct rte_flow_item_icmp6_nd_na.
438 RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA,
441 * Matches the presence of any ICMPv6 neighbor discovery option.
443 * See struct rte_flow_item_icmp6_nd_opt.
445 RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT,
448 * Matches an ICMPv6 neighbor discovery source Ethernet link-layer
451 * See struct rte_flow_item_icmp6_nd_opt_sla_eth.
453 RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH,
456 * Matches an ICMPv6 neighbor discovery target Ethernet link-layer
459 * See struct rte_flow_item_icmp6_nd_opt_tla_eth.
461 RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH,
464 * Matches specified mark field.
466 * See struct rte_flow_item_mark.
468 RTE_FLOW_ITEM_TYPE_MARK,
473 * Matches a metadata value.
475 * See struct rte_flow_item_meta.
477 RTE_FLOW_ITEM_TYPE_META,
480 * Matches a GRE optional key field.
482 * The value should a big-endian 32bit integer.
484 * When this item present the K bit is implicitly matched as "1"
485 * in the default mask.
488 * @code rte_be32_t * @endcode
490 RTE_FLOW_ITEM_TYPE_GRE_KEY,
493 * Matches a GTP extension header: PDU session container.
495 * Configure flow for GTP packets with extension header type 0x85.
497 * See struct rte_flow_item_gtp_psc.
499 RTE_FLOW_ITEM_TYPE_GTP_PSC,
502 * Matches a PPPoE header.
504 * Configure flow for PPPoE session packets.
506 * See struct rte_flow_item_pppoe.
508 RTE_FLOW_ITEM_TYPE_PPPOES,
511 * Matches a PPPoE header.
513 * Configure flow for PPPoE discovery packets.
515 * See struct rte_flow_item_pppoe.
517 RTE_FLOW_ITEM_TYPE_PPPOED,
520 * Matches a PPPoE optional proto_id field.
522 * It only applies to PPPoE session packets.
524 * See struct rte_flow_item_pppoe_proto_id.
526 RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID,
529 * Matches Network service header (NSH).
530 * See struct rte_flow_item_nsh.
533 RTE_FLOW_ITEM_TYPE_NSH,
536 * Matches Internet Group Management Protocol (IGMP).
537 * See struct rte_flow_item_igmp.
540 RTE_FLOW_ITEM_TYPE_IGMP,
543 * Matches IP Authentication Header (AH).
544 * See struct rte_flow_item_ah.
547 RTE_FLOW_ITEM_TYPE_AH,
550 * Matches a HIGIG header.
551 * see struct rte_flow_item_higig2_hdr.
553 RTE_FLOW_ITEM_TYPE_HIGIG2,
558 * Matches a tag value.
560 * See struct rte_flow_item_tag.
562 RTE_FLOW_ITEM_TYPE_TAG,
565 * Matches a L2TPv3 over IP header.
567 * Configure flow for L2TPv3 over IP packets.
569 * See struct rte_flow_item_l2tpv3oip.
571 RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
574 * Matches PFCP Header.
575 * See struct rte_flow_item_pfcp.
578 RTE_FLOW_ITEM_TYPE_PFCP,
581 * Matches eCPRI Header.
583 * Configure flow for eCPRI over ETH or UDP packets.
585 * See struct rte_flow_item_ecpri.
587 RTE_FLOW_ITEM_TYPE_ECPRI,
590 * Matches the presence of IPv6 fragment extension header.
592 * See struct rte_flow_item_ipv6_frag_ext.
594 RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
597 * Matches Geneve Variable Length Option
599 * See struct rte_flow_item_geneve_opt
601 RTE_FLOW_ITEM_TYPE_GENEVE_OPT,
606 * Matches on packet integrity.
607 * For some devices application needs to enable integration checks in HW
608 * before using this item.
610 * @see struct rte_flow_item_integrity.
612 RTE_FLOW_ITEM_TYPE_INTEGRITY,
617 * Matches conntrack state.
619 * @see struct rte_flow_item_conntrack.
621 RTE_FLOW_ITEM_TYPE_CONNTRACK,
626 * Matches traffic entering the embedded switch from the given ethdev.
628 * @see struct rte_flow_item_ethdev
630 RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
635 * Matches traffic entering the embedded switch from
636 * the entity represented by the given ethdev.
638 * @see struct rte_flow_item_ethdev
640 RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT,
643 * Matches a configured set of fields at runtime calculated offsets
644 * over the generic network header with variable length and
647 * @see struct rte_flow_item_flex.
649 RTE_FLOW_ITEM_TYPE_FLEX,
652 * Matches L2TPv2 Header.
654 * See struct rte_flow_item_l2tpv2.
656 RTE_FLOW_ITEM_TYPE_L2TPV2,
659 * Matches PPP Header.
661 * See struct rte_flow_item_ppp.
663 RTE_FLOW_ITEM_TYPE_PPP,
666 * Matches GRE optional fields.
668 * See struct rte_flow_item_gre_opt.
670 RTE_FLOW_ITEM_TYPE_GRE_OPTION,
675 * RTE_FLOW_ITEM_TYPE_HIGIG2
676 * Matches higig2 header
679 struct rte_flow_item_higig2_hdr {
680 struct rte_higig2_hdr hdr;
683 /** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
685 static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
688 .classification = 0xffff,
696 * RTE_FLOW_ITEM_TYPE_ANY
698 * Matches any protocol in place of the current layer, a single ANY may also
699 * stand for several protocol layers.
701 * This is usually specified as the first pattern item when looking for a
702 * protocol anywhere in a packet.
704 * A zeroed mask stands for any number of layers.
706 struct rte_flow_item_any {
707 uint32_t num; /**< Number of layers covered. */
710 /** Default mask for RTE_FLOW_ITEM_TYPE_ANY. */
712 static const struct rte_flow_item_any rte_flow_item_any_mask = {
719 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
720 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
722 * RTE_FLOW_ITEM_TYPE_VF
724 * Matches traffic originating from (ingress) or going to (egress) a given
725 * virtual function of the current device.
727 * If supported, should work even if the virtual function is not managed by
728 * the application and thus not associated with a DPDK port ID.
730 * Note this pattern item does not match VF representors traffic which, as
731 * separate entities, should be addressed through their own DPDK port IDs.
733 * - Can be specified multiple times to match traffic addressed to several
735 * - Can be combined with a PF item to match both PF and VF traffic.
737 * A zeroed mask can be used to match any VF ID.
739 struct rte_flow_item_vf {
740 uint32_t id; /**< VF ID. */
743 /** Default mask for RTE_FLOW_ITEM_TYPE_VF. */
745 static const struct rte_flow_item_vf rte_flow_item_vf_mask = {
752 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
753 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
755 * RTE_FLOW_ITEM_TYPE_PHY_PORT
757 * Matches traffic originating from (ingress) or going to (egress) a
758 * physical port of the underlying device.
760 * The first PHY_PORT item overrides the physical port normally associated
761 * with the specified DPDK input port (port_id). This item can be provided
762 * several times to match additional physical ports.
764 * Note that physical ports are not necessarily tied to DPDK input ports
765 * (port_id) when those are not under DPDK control. Possible values are
766 * specific to each device, they are not necessarily indexed from zero and
767 * may not be contiguous.
769 * As a device property, the list of allowed values as well as the value
770 * associated with a port_id should be retrieved by other means.
772 * A zeroed mask can be used to match any port index.
774 struct rte_flow_item_phy_port {
775 uint32_t index; /**< Physical port index. */
778 /** Default mask for RTE_FLOW_ITEM_TYPE_PHY_PORT. */
780 static const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask = {
787 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
788 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
790 * RTE_FLOW_ITEM_TYPE_PORT_ID
792 * Matches traffic originating from (ingress) or going to (egress) a given
795 * Normally only supported if the port ID in question is known by the
796 * underlying PMD and related to the device the flow rule is created
799 * This must not be confused with @p PHY_PORT which refers to the physical
800 * port of a device, whereas @p PORT_ID refers to a struct rte_eth_dev
801 * object on the application side (also known as "port representor"
802 * depending on the kind of underlying device).
804 struct rte_flow_item_port_id {
805 uint32_t id; /**< DPDK port ID. */
808 /** Default mask for RTE_FLOW_ITEM_TYPE_PORT_ID. */
810 static const struct rte_flow_item_port_id rte_flow_item_port_id_mask = {
816 * RTE_FLOW_ITEM_TYPE_RAW
818 * Matches a byte string of a given length at a given offset.
820 * Offset is either absolute (using the start of the packet) or relative to
821 * the end of the previous matched item in the stack, in which case negative
822 * values are allowed.
824 * If search is enabled, offset is used as the starting point. The search
825 * area can be delimited by setting limit to a nonzero value, which is the
826 * maximum number of bytes after offset where the pattern may start.
828 * Matching a zero-length pattern is allowed, doing so resets the relative
829 * offset for subsequent items.
831 * This type does not support ranges (struct rte_flow_item.last).
833 struct rte_flow_item_raw {
834 uint32_t relative:1; /**< Look for pattern after the previous item. */
835 uint32_t search:1; /**< Search pattern from offset (see also limit). */
836 uint32_t reserved:30; /**< Reserved, must be set to zero. */
837 int32_t offset; /**< Absolute or relative offset for pattern. */
838 uint16_t limit; /**< Search area limit for start of pattern. */
839 uint16_t length; /**< Pattern length. */
840 const uint8_t *pattern; /**< Byte string to look for. */
843 /** Default mask for RTE_FLOW_ITEM_TYPE_RAW. */
845 static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
848 .reserved = 0x3fffffff,
849 .offset = 0xffffffff,
857 * RTE_FLOW_ITEM_TYPE_ETH
859 * Matches an Ethernet header.
861 * Inside @p hdr field, the sub-field @p ether_type stands either for EtherType
862 * or TPID, depending on whether the item is followed by a VLAN item or not. If
863 * two VLAN items follow, the sub-field refers to the outer one, which, in turn,
864 * contains the inner TPID in the similar header field. The innermost VLAN item
865 * contains a layer-3 EtherType. All of that follows the order seen on the wire.
867 * If the field in question contains a TPID value, only tagged packets with the
868 * specified TPID will match the pattern. Alternatively, it's possible to match
869 * any type of tagged packets by means of the field @p has_vlan rather than use
870 * the EtherType/TPID field. Also, it's possible to leave the two fields unused.
871 * If this is the case, both tagged and untagged packets will match the pattern.
874 struct rte_flow_item_eth {
878 * These fields are retained for compatibility.
879 * Please switch to the new header field below.
881 struct rte_ether_addr dst; /**< Destination MAC. */
882 struct rte_ether_addr src; /**< Source MAC. */
883 rte_be16_t type; /**< EtherType or TPID. */
885 struct rte_ether_hdr hdr;
887 uint32_t has_vlan:1; /**< Packet header contains at least one VLAN. */
888 uint32_t reserved:31; /**< Reserved, must be zero. */
891 /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */
893 static const struct rte_flow_item_eth rte_flow_item_eth_mask = {
894 .hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
895 .hdr.src_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
896 .hdr.ether_type = RTE_BE16(0x0000),
901 * RTE_FLOW_ITEM_TYPE_VLAN
903 * Matches an 802.1Q/ad VLAN tag.
905 * The corresponding standard outer EtherType (TPID) values are
906 * RTE_ETHER_TYPE_VLAN or RTE_ETHER_TYPE_QINQ. It can be overridden by
907 * the preceding pattern item.
908 * If a @p VLAN item is present in the pattern, then only tagged packets will
910 * The field @p has_more_vlan can be used to match any type of tagged packets,
911 * instead of using the @p eth_proto field of @p hdr.
912 * If the @p eth_proto of @p hdr and @p has_more_vlan fields are not specified,
913 * then any tagged packets will match the pattern.
916 struct rte_flow_item_vlan {
920 * These fields are retained for compatibility.
921 * Please switch to the new header field below.
923 rte_be16_t tci; /**< Tag control information. */
924 rte_be16_t inner_type; /**< Inner EtherType or TPID. */
926 struct rte_vlan_hdr hdr;
928 /** Packet header contains at least one more VLAN, after this VLAN. */
929 uint32_t has_more_vlan:1;
930 uint32_t reserved:31; /**< Reserved, must be zero. */
933 /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */
935 static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = {
936 .hdr.vlan_tci = RTE_BE16(0x0fff),
937 .hdr.eth_proto = RTE_BE16(0x0000),
942 * RTE_FLOW_ITEM_TYPE_IPV4
944 * Matches an IPv4 header.
946 * Note: IPv4 options are handled by dedicated pattern items.
948 struct rte_flow_item_ipv4 {
949 struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */
952 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */
954 static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = {
956 .src_addr = RTE_BE32(0xffffffff),
957 .dst_addr = RTE_BE32(0xffffffff),
963 * RTE_FLOW_ITEM_TYPE_IPV6.
965 * Matches an IPv6 header.
967 * Dedicated flags indicate if header contains specific extension headers.
969 struct rte_flow_item_ipv6 {
970 struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
971 /** Header contains Hop-by-Hop Options extension header. */
972 uint32_t has_hop_ext:1;
973 /** Header contains Routing extension header. */
974 uint32_t has_route_ext:1;
975 /** Header contains Fragment extension header. */
976 uint32_t has_frag_ext:1;
977 /** Header contains Authentication extension header. */
978 uint32_t has_auth_ext:1;
979 /** Header contains Encapsulation Security Payload extension header. */
980 uint32_t has_esp_ext:1;
981 /** Header contains Destination Options extension header. */
982 uint32_t has_dest_ext:1;
983 /** Header contains Mobility extension header. */
984 uint32_t has_mobil_ext:1;
985 /** Header contains Host Identity Protocol extension header. */
986 uint32_t has_hip_ext:1;
987 /** Header contains Shim6 Protocol extension header. */
988 uint32_t has_shim6_ext:1;
989 /** Reserved for future extension headers, must be zero. */
990 uint32_t reserved:23;
993 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
995 static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
998 "\xff\xff\xff\xff\xff\xff\xff\xff"
999 "\xff\xff\xff\xff\xff\xff\xff\xff",
1001 "\xff\xff\xff\xff\xff\xff\xff\xff"
1002 "\xff\xff\xff\xff\xff\xff\xff\xff",
1008 * RTE_FLOW_ITEM_TYPE_ICMP.
1010 * Matches an ICMP header.
1012 struct rte_flow_item_icmp {
1013 struct rte_icmp_hdr hdr; /**< ICMP header definition. */
1016 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */
1018 static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = {
1027 * RTE_FLOW_ITEM_TYPE_UDP.
1029 * Matches a UDP header.
1031 struct rte_flow_item_udp {
1032 struct rte_udp_hdr hdr; /**< UDP header definition. */
1035 /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */
1037 static const struct rte_flow_item_udp rte_flow_item_udp_mask = {
1039 .src_port = RTE_BE16(0xffff),
1040 .dst_port = RTE_BE16(0xffff),
1046 * RTE_FLOW_ITEM_TYPE_TCP.
1048 * Matches a TCP header.
1050 struct rte_flow_item_tcp {
1051 struct rte_tcp_hdr hdr; /**< TCP header definition. */
1054 /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */
1056 static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = {
1058 .src_port = RTE_BE16(0xffff),
1059 .dst_port = RTE_BE16(0xffff),
1065 * RTE_FLOW_ITEM_TYPE_SCTP.
1067 * Matches a SCTP header.
1069 struct rte_flow_item_sctp {
1070 struct rte_sctp_hdr hdr; /**< SCTP header definition. */
1073 /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */
1075 static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = {
1077 .src_port = RTE_BE16(0xffff),
1078 .dst_port = RTE_BE16(0xffff),
1084 * RTE_FLOW_ITEM_TYPE_VXLAN.
1086 * Matches a VXLAN header (RFC 7348).
1089 struct rte_flow_item_vxlan {
1093 * These fields are retained for compatibility.
1094 * Please switch to the new header field below.
1096 uint8_t flags; /**< Normally 0x08 (I flag). */
1097 uint8_t rsvd0[3]; /**< Reserved, normally 0x000000. */
1098 uint8_t vni[3]; /**< VXLAN identifier. */
1099 uint8_t rsvd1; /**< Reserved, normally 0x00. */
1101 struct rte_vxlan_hdr hdr;
1105 /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */
1107 static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
1108 .hdr.vx_vni = RTE_BE32(0xffffff00), /* (0xffffff << 8) */
1113 * RTE_FLOW_ITEM_TYPE_E_TAG.
1115 * Matches a E-tag header.
1117 * The corresponding standard outer EtherType (TPID) value is
1118 * RTE_ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item.
1120 struct rte_flow_item_e_tag {
1122 * E-Tag control information (E-TCI).
1123 * E-PCP (3b), E-DEI (1b), ingress E-CID base (12b).
1125 rte_be16_t epcp_edei_in_ecid_b;
1126 /** Reserved (2b), GRP (2b), E-CID base (12b). */
1127 rte_be16_t rsvd_grp_ecid_b;
1128 uint8_t in_ecid_e; /**< Ingress E-CID ext. */
1129 uint8_t ecid_e; /**< E-CID ext. */
1130 rte_be16_t inner_type; /**< Inner EtherType or TPID. */
1133 /** Default mask for RTE_FLOW_ITEM_TYPE_E_TAG. */
1135 static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask = {
1136 .rsvd_grp_ecid_b = RTE_BE16(0x3fff),
1141 * RTE_FLOW_ITEM_TYPE_NVGRE.
1143 * Matches a NVGRE header.
1145 struct rte_flow_item_nvgre {
1147 * Checksum (1b), undefined (1b), key bit (1b), sequence number (1b),
1148 * reserved 0 (9b), version (3b).
1150 * c_k_s_rsvd0_ver must have value 0x2000 according to RFC 7637.
1152 rte_be16_t c_k_s_rsvd0_ver;
1153 rte_be16_t protocol; /**< Protocol type (0x6558). */
1154 uint8_t tni[3]; /**< Virtual subnet ID. */
1155 uint8_t flow_id; /**< Flow ID. */
1158 /** Default mask for RTE_FLOW_ITEM_TYPE_NVGRE. */
1160 static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask = {
1161 .tni = "\xff\xff\xff",
1166 * RTE_FLOW_ITEM_TYPE_MPLS.
1168 * Matches a MPLS header.
1170 struct rte_flow_item_mpls {
1172 * Label (20b), TC (3b), Bottom of Stack (1b).
1174 uint8_t label_tc_s[3];
1175 uint8_t ttl; /** Time-to-Live. */
1178 /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */
1180 static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
1181 .label_tc_s = "\xff\xff\xf0",
1186 * RTE_FLOW_ITEM_TYPE_GRE.
1188 * Matches a GRE header.
1190 struct rte_flow_item_gre {
1192 * Checksum (1b), reserved 0 (12b), version (3b).
1193 * Refer to RFC 2784.
1195 rte_be16_t c_rsvd0_ver;
1196 rte_be16_t protocol; /**< Protocol type. */
1199 /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
1201 static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
1202 .protocol = RTE_BE16(0xffff),
1207 * RTE_FLOW_ITEM_TYPE_GRE_OPTION.
1209 * Matches GRE optional fields in header.
1211 struct rte_flow_item_gre_opt {
1212 struct rte_gre_hdr_opt_checksum_rsvd checksum_rsvd;
1213 struct rte_gre_hdr_opt_key key;
1214 struct rte_gre_hdr_opt_sequence sequence;
1218 * RTE_FLOW_ITEM_TYPE_FUZZY
1220 * Fuzzy pattern match, expect faster than default.
1222 * This is for device that support fuzzy match option.
1223 * Usually a fuzzy match is fast but the cost is accuracy.
1224 * i.e. Signature Match only match pattern's hash value, but it is
1225 * possible two different patterns have the same hash value.
1227 * Matching accuracy level can be configure by threshold.
1228 * Driver can divide the range of threshold and map to different
1229 * accuracy levels that device support.
1231 * Threshold 0 means perfect match (no fuzziness), while threshold
1232 * 0xffffffff means fuzziest match.
1234 struct rte_flow_item_fuzzy {
1235 uint32_t thresh; /**< Accuracy threshold. */
1238 /** Default mask for RTE_FLOW_ITEM_TYPE_FUZZY. */
1240 static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask = {
1241 .thresh = 0xffffffff,
1246 * RTE_FLOW_ITEM_TYPE_GTP.
1248 * Matches a GTPv1 header.
1250 struct rte_flow_item_gtp {
1252 * Version (3b), protocol type (1b), reserved (1b),
1253 * Extension header flag (1b),
1254 * Sequence number flag (1b),
1255 * N-PDU number flag (1b).
1257 uint8_t v_pt_rsv_flags;
1258 uint8_t msg_type; /**< Message type. */
1259 rte_be16_t msg_len; /**< Message length. */
1260 rte_be32_t teid; /**< Tunnel endpoint identifier. */
1263 /** Default mask for RTE_FLOW_ITEM_TYPE_GTP. */
1265 static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = {
1266 .teid = RTE_BE32(0xffffffff),
1271 * RTE_FLOW_ITEM_TYPE_ESP
1273 * Matches an ESP header.
1275 struct rte_flow_item_esp {
1276 struct rte_esp_hdr hdr; /**< ESP header definition. */
1279 /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */
1281 static const struct rte_flow_item_esp rte_flow_item_esp_mask = {
1283 .spi = RTE_BE32(0xffffffff),
1289 * RTE_FLOW_ITEM_TYPE_GENEVE.
1291 * Matches a GENEVE header.
1293 struct rte_flow_item_geneve {
1295 * Version (2b), length of the options fields (6b), OAM packet (1b),
1296 * critical options present (1b), reserved 0 (6b).
1298 rte_be16_t ver_opt_len_o_c_rsvd0;
1299 rte_be16_t protocol; /**< Protocol type. */
1300 uint8_t vni[3]; /**< Virtual Network Identifier. */
1301 uint8_t rsvd1; /**< Reserved, normally 0x00. */
1304 /** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE. */
1306 static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = {
1307 .vni = "\xff\xff\xff",
1312 * RTE_FLOW_ITEM_TYPE_VXLAN_GPE (draft-ietf-nvo3-vxlan-gpe-05).
1314 * Matches a VXLAN-GPE header.
1316 struct rte_flow_item_vxlan_gpe {
1317 uint8_t flags; /**< Normally 0x0c (I and P flags). */
1318 uint8_t rsvd0[2]; /**< Reserved, normally 0x0000. */
1319 uint8_t protocol; /**< Protocol type. */
1320 uint8_t vni[3]; /**< VXLAN identifier. */
1321 uint8_t rsvd1; /**< Reserved, normally 0x00. */
1324 /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */
1326 static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = {
1327 .vni = "\xff\xff\xff",
1332 * RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4
1334 * Matches an ARP header for Ethernet/IPv4.
1336 struct rte_flow_item_arp_eth_ipv4 {
1337 rte_be16_t hrd; /**< Hardware type, normally 1. */
1338 rte_be16_t pro; /**< Protocol type, normally 0x0800. */
1339 uint8_t hln; /**< Hardware address length, normally 6. */
1340 uint8_t pln; /**< Protocol address length, normally 4. */
1341 rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */
1342 struct rte_ether_addr sha; /**< Sender hardware address. */
1343 rte_be32_t spa; /**< Sender IPv4 address. */
1344 struct rte_ether_addr tha; /**< Target hardware address. */
1345 rte_be32_t tpa; /**< Target IPv4 address. */
1348 /** Default mask for RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4. */
1350 static const struct rte_flow_item_arp_eth_ipv4
1351 rte_flow_item_arp_eth_ipv4_mask = {
1352 .sha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1353 .spa = RTE_BE32(0xffffffff),
1354 .tha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1355 .tpa = RTE_BE32(0xffffffff),
1360 * RTE_FLOW_ITEM_TYPE_IPV6_EXT
1362 * Matches the presence of any IPv6 extension header.
1364 * Normally preceded by any of:
1366 * - RTE_FLOW_ITEM_TYPE_IPV6
1367 * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
1369 struct rte_flow_item_ipv6_ext {
1370 uint8_t next_hdr; /**< Next header. */
1373 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6_EXT. */
1376 struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
1382 * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
1384 * Matches the presence of IPv6 fragment extension header.
1386 * Preceded by any of:
1388 * - RTE_FLOW_ITEM_TYPE_IPV6
1389 * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
1391 struct rte_flow_item_ipv6_frag_ext {
1392 struct rte_ipv6_fragment_ext hdr;
1396 * RTE_FLOW_ITEM_TYPE_ICMP6
1398 * Matches any ICMPv6 header.
1400 struct rte_flow_item_icmp6 {
1401 uint8_t type; /**< ICMPv6 type. */
1402 uint8_t code; /**< ICMPv6 code. */
1403 uint16_t checksum; /**< ICMPv6 checksum. */
1406 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6. */
1408 static const struct rte_flow_item_icmp6 rte_flow_item_icmp6_mask = {
1415 * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1417 * Matches an ICMPv6 neighbor discovery solicitation.
1419 struct rte_flow_item_icmp6_nd_ns {
1420 uint8_t type; /**< ICMPv6 type, normally 135. */
1421 uint8_t code; /**< ICMPv6 code, normally 0. */
1422 rte_be16_t checksum; /**< ICMPv6 checksum. */
1423 rte_be32_t reserved; /**< Reserved, normally 0. */
1424 uint8_t target_addr[16]; /**< Target address. */
1427 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS. */
1430 struct rte_flow_item_icmp6_nd_ns rte_flow_item_icmp6_nd_ns_mask = {
1432 "\xff\xff\xff\xff\xff\xff\xff\xff"
1433 "\xff\xff\xff\xff\xff\xff\xff\xff",
1438 * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1440 * Matches an ICMPv6 neighbor discovery advertisement.
1442 struct rte_flow_item_icmp6_nd_na {
1443 uint8_t type; /**< ICMPv6 type, normally 136. */
1444 uint8_t code; /**< ICMPv6 code, normally 0. */
1445 rte_be16_t checksum; /**< ICMPv6 checksum. */
1447 * Route flag (1b), solicited flag (1b), override flag (1b),
1450 rte_be32_t rso_reserved;
1451 uint8_t target_addr[16]; /**< Target address. */
1454 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA. */
1457 struct rte_flow_item_icmp6_nd_na rte_flow_item_icmp6_nd_na_mask = {
1459 "\xff\xff\xff\xff\xff\xff\xff\xff"
1460 "\xff\xff\xff\xff\xff\xff\xff\xff",
1465 * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1467 * Matches the presence of any ICMPv6 neighbor discovery option.
1469 * Normally preceded by any of:
1471 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1472 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1473 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1475 struct rte_flow_item_icmp6_nd_opt {
1476 uint8_t type; /**< ND option type. */
1477 uint8_t length; /**< ND option length. */
1480 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT. */
1482 static const struct rte_flow_item_icmp6_nd_opt
1483 rte_flow_item_icmp6_nd_opt_mask = {
1489 * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH
1491 * Matches an ICMPv6 neighbor discovery source Ethernet link-layer address
1494 * Normally preceded by any of:
1496 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1497 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1499 struct rte_flow_item_icmp6_nd_opt_sla_eth {
1500 uint8_t type; /**< ND option type, normally 1. */
1501 uint8_t length; /**< ND option length, normally 1. */
1502 struct rte_ether_addr sla; /**< Source Ethernet LLA. */
1505 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */
1507 static const struct rte_flow_item_icmp6_nd_opt_sla_eth
1508 rte_flow_item_icmp6_nd_opt_sla_eth_mask = {
1509 .sla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1514 * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH
1516 * Matches an ICMPv6 neighbor discovery target Ethernet link-layer address
1519 * Normally preceded by any of:
1521 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1522 * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1524 struct rte_flow_item_icmp6_nd_opt_tla_eth {
1525 uint8_t type; /**< ND option type, normally 2. */
1526 uint8_t length; /**< ND option length, normally 1. */
1527 struct rte_ether_addr tla; /**< Target Ethernet LLA. */
1530 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */
1532 static const struct rte_flow_item_icmp6_nd_opt_tla_eth
1533 rte_flow_item_icmp6_nd_opt_tla_eth_mask = {
1534 .tla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1539 * RTE_FLOW_ITEM_TYPE_META
1541 * Matches a specified metadata value. On egress, metadata can be set
1542 * either by mbuf dynamic metadata field with RTE_MBUF_DYNFLAG_TX_METADATA flag
1543 * or RTE_FLOW_ACTION_TYPE_SET_META. On ingress, RTE_FLOW_ACTION_TYPE_SET_META
1544 * sets metadata for a packet and the metadata will be reported via mbuf
1545 * metadata dynamic field with RTE_MBUF_DYNFLAG_RX_METADATA flag. The dynamic
1546 * mbuf field must be registered in advance by
1547 * rte_flow_dynf_metadata_register().
1549 struct rte_flow_item_meta {
1553 /** Default mask for RTE_FLOW_ITEM_TYPE_META. */
1555 static const struct rte_flow_item_meta rte_flow_item_meta_mask = {
1561 * RTE_FLOW_ITEM_TYPE_GTP_PSC.
1563 * Matches a GTP PDU extension header with type 0x85.
1565 struct rte_flow_item_gtp_psc {
1566 struct rte_gtp_psc_generic_hdr hdr; /**< gtp psc generic hdr. */
1569 /** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */
1571 static const struct rte_flow_item_gtp_psc
1572 rte_flow_item_gtp_psc_mask = {
1578 * RTE_FLOW_ITEM_TYPE_PPPOE.
1580 * Matches a PPPoE header.
1582 struct rte_flow_item_pppoe {
1584 * Version (4b), type (4b).
1586 uint8_t version_type;
1587 uint8_t code; /**< Message type. */
1588 rte_be16_t session_id; /**< Session identifier. */
1589 rte_be16_t length; /**< Payload length. */
1593 * RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID.
1595 * Matches a PPPoE optional proto_id field.
1597 * It only applies to PPPoE session packets.
1599 * Normally preceded by any of:
1601 * - RTE_FLOW_ITEM_TYPE_PPPOE
1602 * - RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID
1604 struct rte_flow_item_pppoe_proto_id {
1605 rte_be16_t proto_id; /**< PPP protocol identifier. */
1608 /** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID. */
1610 static const struct rte_flow_item_pppoe_proto_id
1611 rte_flow_item_pppoe_proto_id_mask = {
1612 .proto_id = RTE_BE16(0xffff),
1618 * @b EXPERIMENTAL: this structure may change without prior notice
1620 * RTE_FLOW_ITEM_TYPE_TAG
1622 * Matches a specified tag value at the specified index.
1624 struct rte_flow_item_tag {
1629 /** Default mask for RTE_FLOW_ITEM_TYPE_TAG. */
1631 static const struct rte_flow_item_tag rte_flow_item_tag_mask = {
1638 * RTE_FLOW_ITEM_TYPE_L2TPV3OIP.
1640 * Matches a L2TPv3 over IP header.
1642 struct rte_flow_item_l2tpv3oip {
1643 rte_be32_t session_id; /**< Session ID. */
1646 /** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV3OIP. */
1648 static const struct rte_flow_item_l2tpv3oip rte_flow_item_l2tpv3oip_mask = {
1649 .session_id = RTE_BE32(UINT32_MAX),
1656 * @b EXPERIMENTAL: this structure may change without prior notice
1658 * RTE_FLOW_ITEM_TYPE_MARK
1660 * Matches an arbitrary integer value which was set using the ``MARK`` action
1661 * in a previously matched rule.
1663 * This item can only be specified once as a match criteria as the ``MARK``
1664 * action can only be specified once in a flow action.
1666 * This value is arbitrary and application-defined. Maximum allowed value
1667 * depends on the underlying implementation.
1669 * Depending on the underlying implementation the MARK item may be supported on
1670 * the physical device, with virtual groups in the PMD or not at all.
1672 struct rte_flow_item_mark {
1673 uint32_t id; /**< Integer value to match against. */
1676 /** Default mask for RTE_FLOW_ITEM_TYPE_MARK. */
1678 static const struct rte_flow_item_mark rte_flow_item_mark_mask = {
1685 * @b EXPERIMENTAL: this structure may change without prior notice
1687 * RTE_FLOW_ITEM_TYPE_NSH
1689 * Match network service header (NSH), RFC 8300
1692 struct rte_flow_item_nsh {
1695 uint32_t reserved:1;
1698 uint32_t reserved1:4;
1700 uint32_t next_proto:8;
1705 /** Default mask for RTE_FLOW_ITEM_TYPE_NSH. */
1707 static const struct rte_flow_item_nsh rte_flow_item_nsh_mask = {
1717 * @b EXPERIMENTAL: this structure may change without prior notice
1719 * RTE_FLOW_ITEM_TYPE_IGMP
1721 * Match Internet Group Management Protocol (IGMP), RFC 2236
1724 struct rte_flow_item_igmp {
1726 uint32_t max_resp_time:8;
1727 uint32_t checksum:16;
1728 uint32_t group_addr;
1731 /** Default mask for RTE_FLOW_ITEM_TYPE_IGMP. */
1733 static const struct rte_flow_item_igmp rte_flow_item_igmp_mask = {
1734 .group_addr = 0xffffffff,
1740 * @b EXPERIMENTAL: this structure may change without prior notice
1742 * RTE_FLOW_ITEM_TYPE_AH
1744 * Match IP Authentication Header (AH), RFC 4302
1747 struct rte_flow_item_ah {
1748 uint32_t next_hdr:8;
1749 uint32_t payload_len:8;
1750 uint32_t reserved:16;
1755 /** Default mask for RTE_FLOW_ITEM_TYPE_AH. */
1757 static const struct rte_flow_item_ah rte_flow_item_ah_mask = {
1764 * @b EXPERIMENTAL: this structure may change without prior notice
1766 * RTE_FLOW_ITEM_TYPE_PFCP
1770 struct rte_flow_item_pfcp {
1777 /** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */
1779 static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
1781 .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
1787 * @b EXPERIMENTAL: this structure may change without prior notice
1789 * RTE_FLOW_ITEM_TYPE_ECPRI
1791 * Match eCPRI Header
1793 struct rte_flow_item_ecpri {
1794 struct rte_ecpri_combined_msg_hdr hdr;
1797 /** Default mask for RTE_FLOW_ITEM_TYPE_ECPRI. */
1799 static const struct rte_flow_item_ecpri rte_flow_item_ecpri_mask = {
1809 * RTE_FLOW_ITEM_TYPE_GENEVE_OPT
1811 * Matches a GENEVE Variable Length Option
1813 struct rte_flow_item_geneve_opt {
1814 rte_be16_t option_class;
1815 uint8_t option_type;
1820 /** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE_OPT. */
1822 static const struct rte_flow_item_geneve_opt
1823 rte_flow_item_geneve_opt_mask = {
1824 .option_type = 0xff,
1830 * @b EXPERIMENTAL: this structure may change without prior notice
1832 * RTE_FLOW_ITEM_TYPE_INTEGRITY
1834 * Match on packet integrity check result.
1836 struct rte_flow_item_integrity {
1837 /** Tunnel encapsulation level the item should apply to.
1838 * @see rte_flow_action_rss
1845 /** The packet is valid after passing all HW checks. */
1846 uint64_t packet_ok:1;
1847 /** L2 layer is valid after passing all HW checks. */
1849 /** L3 layer is valid after passing all HW checks. */
1851 /** L4 layer is valid after passing all HW checks. */
1853 /** L2 layer CRC is valid. */
1854 uint64_t l2_crc_ok:1;
1855 /** IPv4 layer checksum is valid. */
1856 uint64_t ipv4_csum_ok:1;
1857 /** L4 layer checksum is valid. */
1858 uint64_t l4_csum_ok:1;
1859 /** L3 length is smaller than frame length. */
1860 uint64_t l3_len_ok:1;
1861 uint64_t reserved:56;
1868 static const struct rte_flow_item_integrity
1869 rte_flow_item_integrity_mask = {
1876 * The packet is valid after conntrack checking.
1878 #define RTE_FLOW_CONNTRACK_PKT_STATE_VALID RTE_BIT32(0)
1880 * The state of the connection is changed.
1882 #define RTE_FLOW_CONNTRACK_PKT_STATE_CHANGED RTE_BIT32(1)
1884 * Error is detected on this packet for this connection and
1885 * an invalid state is set.
1887 #define RTE_FLOW_CONNTRACK_PKT_STATE_INVALID RTE_BIT32(2)
1889 * The HW connection tracking module is disabled.
1890 * It can be due to application command or an invalid state.
1892 #define RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED RTE_BIT32(3)
1894 * The packet contains some bad field(s) and cannot continue
1895 * with the conntrack module checking.
1897 #define RTE_FLOW_CONNTRACK_PKT_STATE_BAD RTE_BIT32(4)
1901 * @b EXPERIMENTAL: this structure may change without prior notice
1903 * RTE_FLOW_ITEM_TYPE_CONNTRACK
1905 * Matches the state of a packet after it passed the connection tracking
1906 * examination. The state is a bitmap of one RTE_FLOW_CONNTRACK_PKT_STATE*
1907 * or a reasonable combination of these bits.
1909 struct rte_flow_item_conntrack {
1913 /** Default mask for RTE_FLOW_ITEM_TYPE_CONNTRACK. */
1915 static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask = {
1916 .flags = 0xffffffff,
1922 * @b EXPERIMENTAL: this structure may change without prior notice
1924 * Provides an ethdev port ID for use with the following items:
1925 * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
1926 * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT.
1928 struct rte_flow_item_ethdev {
1929 uint16_t port_id; /**< ethdev port ID */
1932 /** Default mask for items based on struct rte_flow_item_ethdev */
1934 static const struct rte_flow_item_ethdev rte_flow_item_ethdev_mask = {
1941 * @b EXPERIMENTAL: this structure may change without prior notice
1943 * RTE_FLOW_ITEM_TYPE_L2TPV2
1945 * Matches L2TPv2 Header
1947 struct rte_flow_item_l2tpv2 {
1948 struct rte_l2tpv2_combined_msg_hdr hdr;
1951 /** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV2. */
1953 static const struct rte_flow_item_l2tpv2 rte_flow_item_l2tpv2_mask = {
1955 * flags and version bit mask
1956 * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
1957 * T L x x S x O P x x x x V V V V
1961 .flags_version = RTE_BE16(0xcb0f),
1969 * @b EXPERIMENTAL: this structure may change without prior notice
1971 * RTE_FLOW_ITEM_TYPE_PPP
1973 * Matches PPP Header
1975 struct rte_flow_item_ppp {
1976 struct rte_ppp_hdr hdr;
1979 /** Default mask for RTE_FLOW_ITEM_TYPE_PPP. */
1981 static const struct rte_flow_item_ppp rte_flow_item_ppp_mask = {
1985 .proto_id = RTE_BE16(0xffff),
1991 * Matching pattern item definition.
1993 * A pattern is formed by stacking items starting from the lowest protocol
1994 * layer to match. This stacking restriction does not apply to meta items
1995 * which can be placed anywhere in the stack without affecting the meaning
1996 * of the resulting pattern.
1998 * Patterns are terminated by END items.
2000 * The spec field should be a valid pointer to a structure of the related
2001 * item type. It may remain unspecified (NULL) in many cases to request
2002 * broad (nonspecific) matching. In such cases, last and mask must also be
2005 * Optionally, last can point to a structure of the same type to define an
2006 * inclusive range. This is mostly supported by integer and address fields,
2007 * may cause errors otherwise. Fields that do not support ranges must be set
2008 * to 0 or to the same value as the corresponding fields in spec.
2010 * Only the fields defined to nonzero values in the default masks (see
2011 * rte_flow_item_{name}_mask constants) are considered relevant by
2012 * default. This can be overridden by providing a mask structure of the
2013 * same type with applicable bits set to one. It can also be used to
2014 * partially filter out specific fields (e.g. as an alternate mean to match
2015 * ranges of IP addresses).
2017 * Mask is a simple bit-mask applied before interpreting the contents of
2018 * spec and last, which may yield unexpected results if not used
2019 * carefully. For example, if for an IPv4 address field, spec provides
2020 * 10.1.2.3, last provides 10.3.4.5 and mask provides 255.255.0.0, the
2021 * effective range becomes 10.1.0.0 to 10.3.255.255.
2023 struct rte_flow_item {
2024 enum rte_flow_item_type type; /**< Item type. */
2025 const void *spec; /**< Pointer to item specification structure. */
2026 const void *last; /**< Defines an inclusive range (spec to last). */
2027 const void *mask; /**< Bit-mask applied to spec and last. */
2032 * @b EXPERIMENTAL: this structure may change without prior notice
2034 * RTE_FLOW_ITEM_TYPE_FLEX
2036 * Matches a specified set of fields within the network protocol
2037 * header. Each field is presented as set of bits with specified width, and
2038 * bit offset from the header beginning.
2040 * The pattern is concatenation of bit fields configured at item creation
2041 * by rte_flow_flex_item_create(). At configuration the fields are presented
2042 * by sample_data array.
2044 * This type does not support ranges (struct rte_flow_item.last).
2046 struct rte_flow_item_flex {
2047 struct rte_flow_item_flex_handle *handle; /**< Opaque item handle. */
2048 uint32_t length; /**< Pattern length in bytes. */
2049 const uint8_t *pattern; /**< Combined bitfields pattern to match. */
2052 * Field bit offset calculation mode.
2054 enum rte_flow_item_flex_field_mode {
2056 * Dummy field, used for byte boundary alignment in pattern.
2057 * Pattern mask and data are ignored in the match. All configuration
2058 * parameters besides field size are ignored.
2060 FIELD_MODE_DUMMY = 0,
2062 * Fixed offset field. The bit offset from header beginning
2063 * is permanent and defined by field_base parameter.
2067 * The field bit offset is extracted from other header field (indirect
2068 * offset field). The resulting field offset to match is calculated as:
2070 * field_base + (*offset_base & offset_mask) << offset_shift
2074 * The field bit offset is extracted from other header field (indirect
2075 * offset field), the latter is considered as bitmask containing some
2076 * number of one bits, the resulting field offset to match is
2079 * field_base + bitcount(*offset_base & offset_mask) << offset_shift
2085 * Flex item field tunnel mode
2087 enum rte_flow_item_flex_tunnel_mode {
2089 * The protocol header can be present in the packet only once.
2090 * No multiple flex item flow inclusions (for inner/outer) are allowed.
2091 * No any relations with tunnel protocols are imposed. The drivers
2092 * can optimize hardware resource usage to handle match on single flex
2093 * item of specific type.
2095 FLEX_TUNNEL_MODE_SINGLE = 0,
2097 * Flex item presents outer header only.
2099 FLEX_TUNNEL_MODE_OUTER,
2101 * Flex item presents inner header only.
2103 FLEX_TUNNEL_MODE_INNER,
2105 * Flex item presents either inner or outer header. The driver
2106 * handles as many multiple inners as hardware supports.
2108 FLEX_TUNNEL_MODE_MULTI,
2110 * Flex item presents tunnel protocol header.
2112 FLEX_TUNNEL_MODE_TUNNEL,
2118 * @b EXPERIMENTAL: this structure may change without prior notice
2121 struct rte_flow_item_flex_field {
2122 /** Defines how match field offset is calculated over the packet. */
2123 enum rte_flow_item_flex_field_mode field_mode;
2124 uint32_t field_size; /**< Field size in bits. */
2125 int32_t field_base; /**< Field offset in bits. */
2126 uint32_t offset_base; /**< Indirect offset field offset in bits. */
2127 uint32_t offset_mask; /**< Indirect offset field bit mask. */
2128 int32_t offset_shift; /**< Indirect offset multiply factor. */
2129 uint32_t field_id:16; /**< Device hint, for multiple items in flow. */
2130 uint32_t reserved:16; /**< Reserved field. */
2135 * @b EXPERIMENTAL: this structure may change without prior notice
2137 struct rte_flow_item_flex_link {
2139 * Preceding/following header. The item type must be always provided.
2140 * For preceding one item must specify the header value/mask to match
2141 * for the link be taken and start the flex item header parsing.
2143 struct rte_flow_item item;
2145 * Next field value to match to continue with one of the configured
2153 * @b EXPERIMENTAL: this structure may change without prior notice
2155 struct rte_flow_item_flex_conf {
2157 * Specifies the flex item and tunnel relations and tells the PMD
2158 * whether flex item can be used for inner, outer or both headers,
2159 * or whether flex item presents the tunnel protocol itself.
2161 enum rte_flow_item_flex_tunnel_mode tunnel;
2163 * The next header offset, it presents the network header size covered
2164 * by the flex item and can be obtained with all supported offset
2165 * calculating methods (fixed, dedicated field, bitmask, etc).
2167 struct rte_flow_item_flex_field next_header;
2169 * Specifies the next protocol field to match with link next protocol
2170 * values and continue packet parsing with matching link.
2172 struct rte_flow_item_flex_field next_protocol;
2174 * The fields will be sampled and presented for explicit match
2175 * with pattern in the rte_flow_flex_item. There can be multiple
2176 * fields descriptors, the number should be specified by nb_samples.
2178 struct rte_flow_item_flex_field *sample_data;
2179 /** Number of field descriptors in the sample_data array. */
2180 uint32_t nb_samples;
2182 * Input link defines the flex item relation with preceding
2183 * header. It specified the preceding item type and provides pattern
2184 * to match. The flex item will continue parsing and will provide the
2185 * data to flow match in case if there is the match with one of input
2188 struct rte_flow_item_flex_link *input_link;
2189 /** Number of link descriptors in the input link array. */
2192 * Output link defines the next protocol field value to match and
2193 * the following protocol header to continue packet parsing. Also
2194 * defines the tunnel-related behaviour.
2196 struct rte_flow_item_flex_link *output_link;
2197 /** Number of link descriptors in the output link array. */
2198 uint32_t nb_outputs;
2204 * Each possible action is represented by a type.
2205 * An action can have an associated configuration object.
2206 * Several actions combined in a list can be assigned
2207 * to a flow rule and are performed in order.
2209 * They fall in three categories:
2211 * - Actions that modify the fate of matching traffic, for instance by
2212 * dropping or assigning it a specific destination.
2214 * - Actions that modify matching traffic contents or its properties. This
2215 * includes adding/removing encapsulation, encryption, compression and
2218 * - Actions related to the flow rule itself, such as updating counters or
2219 * making it non-terminating.
2221 * Flow rules being terminating by default, not specifying any action of the
2222 * fate kind results in undefined behavior. This applies to both ingress and
2225 * PASSTHRU, when supported, makes a flow rule non-terminating.
2227 enum rte_flow_action_type {
2229 * End marker for action lists. Prevents further processing of
2230 * actions, thereby ending the list.
2232 * No associated configuration structure.
2234 RTE_FLOW_ACTION_TYPE_END,
2237 * Used as a placeholder for convenience. It is ignored and simply
2238 * discarded by PMDs.
2240 * No associated configuration structure.
2242 RTE_FLOW_ACTION_TYPE_VOID,
2245 * Leaves traffic up for additional processing by subsequent flow
2246 * rules; makes a flow rule non-terminating.
2248 * No associated configuration structure.
2250 RTE_FLOW_ACTION_TYPE_PASSTHRU,
2253 * RTE_FLOW_ACTION_TYPE_JUMP
2255 * Redirects packets to a group on the current device.
2257 * See struct rte_flow_action_jump.
2259 RTE_FLOW_ACTION_TYPE_JUMP,
2262 * Attaches an integer value to packets and sets RTE_MBUF_F_RX_FDIR and
2263 * RTE_MBUF_F_RX_FDIR_ID mbuf flags.
2265 * See struct rte_flow_action_mark.
2267 * One should negotiate mark delivery from the NIC to the PMD.
2268 * @see rte_eth_rx_metadata_negotiate()
2269 * @see RTE_ETH_RX_METADATA_USER_MARK
2271 RTE_FLOW_ACTION_TYPE_MARK,
2274 * Flags packets. Similar to MARK without a specific value; only
2275 * sets the RTE_MBUF_F_RX_FDIR mbuf flag.
2277 * No associated configuration structure.
2279 * One should negotiate flag delivery from the NIC to the PMD.
2280 * @see rte_eth_rx_metadata_negotiate()
2281 * @see RTE_ETH_RX_METADATA_USER_FLAG
2283 RTE_FLOW_ACTION_TYPE_FLAG,
2286 * Assigns packets to a given queue index.
2288 * See struct rte_flow_action_queue.
2290 RTE_FLOW_ACTION_TYPE_QUEUE,
2295 * PASSTHRU overrides this action if both are specified.
2297 * No associated configuration structure.
2299 RTE_FLOW_ACTION_TYPE_DROP,
2302 * Enables counters for this flow rule.
2304 * These counters can be retrieved and reset through rte_flow_query() or
2305 * rte_flow_action_handle_query() if the action provided via handle,
2306 * see struct rte_flow_query_count.
2308 * See struct rte_flow_action_count.
2310 RTE_FLOW_ACTION_TYPE_COUNT,
2313 * Similar to QUEUE, except RSS is additionally performed on packets
2314 * to spread them among several queues according to the provided
2317 * See struct rte_flow_action_rss.
2319 RTE_FLOW_ACTION_TYPE_RSS,
2323 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2324 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2326 * Directs matching traffic to the physical function (PF) of the
2329 * No associated configuration structure.
2331 RTE_FLOW_ACTION_TYPE_PF,
2335 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2336 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2338 * Directs matching traffic to a given virtual function of the
2341 * See struct rte_flow_action_vf.
2343 RTE_FLOW_ACTION_TYPE_VF,
2347 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2348 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2350 * Directs packets to a given physical port index of the underlying
2353 * See struct rte_flow_action_phy_port.
2355 RTE_FLOW_ACTION_TYPE_PHY_PORT,
2359 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2360 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2362 * Directs matching traffic to a given DPDK port ID.
2364 * See struct rte_flow_action_port_id.
2366 RTE_FLOW_ACTION_TYPE_PORT_ID,
2369 * Traffic metering and policing (MTR).
2371 * See struct rte_flow_action_meter.
2372 * See file rte_mtr.h for MTR object configuration.
2374 RTE_FLOW_ACTION_TYPE_METER,
2377 * Redirects packets to security engine of current device for security
2378 * processing as specified by security session.
2380 * See struct rte_flow_action_security.
2382 RTE_FLOW_ACTION_TYPE_SECURITY,
2386 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2388 * Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the
2389 * OpenFlow Switch Specification.
2391 * See struct rte_flow_action_of_set_mpls_ttl.
2393 RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL,
2397 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2399 * Implements OFPAT_DEC_MPLS_TTL ("decrement MPLS TTL") as defined
2400 * by the OpenFlow Switch Specification.
2402 * No associated configuration structure.
2404 RTE_FLOW_ACTION_TYPE_OF_DEC_MPLS_TTL,
2408 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2410 * Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow
2411 * Switch Specification.
2413 * See struct rte_flow_action_of_set_nw_ttl.
2415 RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL,
2418 * @warning This is a legacy action.
2419 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2421 * Implements OFPAT_DEC_NW_TTL ("decrement IP TTL") as defined by
2422 * the OpenFlow Switch Specification.
2424 * No associated configuration structure.
2426 RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL,
2430 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2432 * Implements OFPAT_COPY_TTL_OUT ("copy TTL "outwards" -- from
2433 * next-to-outermost to outermost") as defined by the OpenFlow
2434 * Switch Specification.
2436 * No associated configuration structure.
2438 RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_OUT,
2442 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2444 * Implements OFPAT_COPY_TTL_IN ("copy TTL "inwards" -- from
2445 * outermost to next-to-outermost") as defined by the OpenFlow
2446 * Switch Specification.
2448 * No associated configuration structure.
2450 RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_IN,
2453 * Implements OFPAT_POP_VLAN ("pop the outer VLAN tag") as defined
2454 * by the OpenFlow Switch Specification.
2456 * No associated configuration structure.
2458 RTE_FLOW_ACTION_TYPE_OF_POP_VLAN,
2461 * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by
2462 * the OpenFlow Switch Specification.
2464 * See struct rte_flow_action_of_push_vlan.
2466 RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN,
2469 * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN ID") as
2470 * defined by the OpenFlow Switch Specification.
2472 * See struct rte_flow_action_of_set_vlan_vid.
2474 RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID,
2477 * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as
2478 * defined by the OpenFlow Switch Specification.
2480 * See struct rte_flow_action_of_set_vlan_pcp.
2482 RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP,
2485 * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined
2486 * by the OpenFlow Switch Specification.
2488 * See struct rte_flow_action_of_pop_mpls.
2490 RTE_FLOW_ACTION_TYPE_OF_POP_MPLS,
2493 * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by
2494 * the OpenFlow Switch Specification.
2496 * See struct rte_flow_action_of_push_mpls.
2498 RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS,
2501 * Encapsulate flow in VXLAN tunnel as defined in
2502 * rte_flow_action_vxlan_encap action structure.
2504 * See struct rte_flow_action_vxlan_encap.
2506 RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP,
2509 * Decapsulate outer most VXLAN tunnel from matched flow.
2511 * If flow pattern does not define a valid VXLAN tunnel (as specified by
2512 * RFC7348) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
2515 RTE_FLOW_ACTION_TYPE_VXLAN_DECAP,
2518 * Encapsulate flow in NVGRE tunnel defined in the
2519 * rte_flow_action_nvgre_encap action structure.
2521 * See struct rte_flow_action_nvgre_encap.
2523 RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP,
2526 * Decapsulate outer most NVGRE tunnel from matched flow.
2528 * If flow pattern does not define a valid NVGRE tunnel (as specified by
2529 * RFC7637) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
2532 RTE_FLOW_ACTION_TYPE_NVGRE_DECAP,
2535 * Add outer header whose template is provided in its data buffer
2537 * See struct rte_flow_action_raw_encap.
2539 RTE_FLOW_ACTION_TYPE_RAW_ENCAP,
2542 * Remove outer header whose template is provided in its data buffer.
2544 * See struct rte_flow_action_raw_decap
2546 RTE_FLOW_ACTION_TYPE_RAW_DECAP,
2549 * @warning This is a legacy action.
2550 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2552 * Modify IPv4 source address in the outermost IPv4 header.
2554 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2555 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2557 * See struct rte_flow_action_set_ipv4.
2559 RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC,
2562 * @warning This is a legacy action.
2563 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2565 * Modify IPv4 destination address in the outermost IPv4 header.
2567 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2568 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2570 * See struct rte_flow_action_set_ipv4.
2572 RTE_FLOW_ACTION_TYPE_SET_IPV4_DST,
2575 * @warning This is a legacy action.
2576 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2578 * Modify IPv6 source address in the outermost IPv6 header.
2580 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2581 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2583 * See struct rte_flow_action_set_ipv6.
2585 RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC,
2588 * @warning This is a legacy action.
2589 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2591 * Modify IPv6 destination address in the outermost IPv6 header.
2593 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2594 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2596 * See struct rte_flow_action_set_ipv6.
2598 RTE_FLOW_ACTION_TYPE_SET_IPV6_DST,
2601 * @warning This is a legacy action.
2602 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2604 * Modify source port number in the outermost TCP/UDP header.
2606 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
2607 * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
2608 * RTE_FLOW_ERROR_TYPE_ACTION error.
2610 * See struct rte_flow_action_set_tp.
2612 RTE_FLOW_ACTION_TYPE_SET_TP_SRC,
2615 * @warning This is a legacy action.
2616 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2618 * Modify destination port number in the outermost TCP/UDP header.
2620 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
2621 * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
2622 * RTE_FLOW_ERROR_TYPE_ACTION error.
2624 * See struct rte_flow_action_set_tp.
2626 RTE_FLOW_ACTION_TYPE_SET_TP_DST,
2629 * Swap the source and destination MAC addresses in the outermost
2632 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2633 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2635 * No associated configuration structure.
2637 RTE_FLOW_ACTION_TYPE_MAC_SWAP,
2640 * @warning This is a legacy action.
2641 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2643 * Decrease TTL value directly
2645 * No associated configuration structure.
2647 RTE_FLOW_ACTION_TYPE_DEC_TTL,
2650 * @warning This is a legacy action.
2651 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2655 * See struct rte_flow_action_set_ttl
2657 RTE_FLOW_ACTION_TYPE_SET_TTL,
2660 * @warning This is a legacy action.
2661 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2663 * Set source MAC address from matched flow.
2665 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2666 * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2668 * See struct rte_flow_action_set_mac.
2670 RTE_FLOW_ACTION_TYPE_SET_MAC_SRC,
2673 * @warning This is a legacy action.
2674 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2676 * Set destination MAC address from matched flow.
2678 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2679 * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2681 * See struct rte_flow_action_set_mac.
2683 RTE_FLOW_ACTION_TYPE_SET_MAC_DST,
2686 * @warning This is a legacy action.
2687 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2689 * Increase sequence number in the outermost TCP header.
2691 * Action configuration specifies the value to increase
2692 * TCP sequence number as a big-endian 32 bit integer.
2695 * @code rte_be32_t * @endcode
2697 * Using this action on non-matching traffic will result in
2698 * undefined behavior.
2700 RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ,
2703 * @warning This is a legacy action.
2704 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2706 * Decrease sequence number in the outermost TCP header.
2708 * Action configuration specifies the value to decrease
2709 * TCP sequence number as a big-endian 32 bit integer.
2712 * @code rte_be32_t * @endcode
2714 * Using this action on non-matching traffic will result in
2715 * undefined behavior.
2717 RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ,
2720 * @warning This is a legacy action.
2721 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2723 * Increase acknowledgment number in the outermost TCP header.
2725 * Action configuration specifies the value to increase
2726 * TCP acknowledgment number as a big-endian 32 bit integer.
2729 * @code rte_be32_t * @endcode
2731 * Using this action on non-matching traffic will result in
2732 * undefined behavior.
2734 RTE_FLOW_ACTION_TYPE_INC_TCP_ACK,
2737 * @warning This is a legacy action.
2738 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2740 * Decrease acknowledgment number in the outermost TCP header.
2742 * Action configuration specifies the value to decrease
2743 * TCP acknowledgment number as a big-endian 32 bit integer.
2746 * @code rte_be32_t * @endcode
2748 * Using this action on non-matching traffic will result in
2749 * undefined behavior.
2751 RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK,
2754 * @warning This is a legacy action.
2755 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2759 * Tag is for internal flow usage only and
2760 * is not delivered to the application.
2762 * See struct rte_flow_action_set_tag.
2764 RTE_FLOW_ACTION_TYPE_SET_TAG,
2767 * @warning This is a legacy action.
2768 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2770 * Set metadata on ingress or egress path.
2772 * See struct rte_flow_action_set_meta.
2774 RTE_FLOW_ACTION_TYPE_SET_META,
2777 * @warning This is a legacy action.
2778 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2780 * Modify IPv4 DSCP in the outermost IP header.
2782 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2783 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2785 * See struct rte_flow_action_set_dscp.
2787 RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP,
2790 * @warning This is a legacy action.
2791 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2793 * Modify IPv6 DSCP in the outermost IP header.
2795 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2796 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2798 * See struct rte_flow_action_set_dscp.
2800 RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP,
2803 * Report as aged flow if timeout passed without any matching on the
2806 * See struct rte_flow_action_age.
2807 * See function rte_flow_get_aged_flows
2808 * see enum RTE_ETH_EVENT_FLOW_AGED
2809 * See struct rte_flow_query_age
2811 RTE_FLOW_ACTION_TYPE_AGE,
2814 * The matching packets will be duplicated with specified ratio and
2815 * applied with own set of actions with a fate action.
2817 * See struct rte_flow_action_sample.
2819 RTE_FLOW_ACTION_TYPE_SAMPLE,
2823 * @see RTE_FLOW_ACTION_TYPE_INDIRECT
2825 * Describe action shared across multiple flow rules.
2827 * Allow multiple rules reference the same action by handle (see
2828 * struct rte_flow_shared_action).
2830 RTE_FLOW_ACTION_TYPE_SHARED,
2833 * Modify a packet header field, tag, mark or metadata.
2835 * Allow the modification of an arbitrary header field via
2836 * set, add and sub operations or copying its content into
2837 * tag, meta or mark for future processing.
2839 * See struct rte_flow_action_modify_field.
2841 RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
2844 * An action handle is referenced in a rule through an indirect action.
2846 * The same action handle may be used in multiple rules for the same
2847 * or different ethdev ports.
2849 RTE_FLOW_ACTION_TYPE_INDIRECT,
2854 * Enable tracking a TCP connection state.
2856 * @see struct rte_flow_action_conntrack.
2858 RTE_FLOW_ACTION_TYPE_CONNTRACK,
2861 * Color the packet to reflect the meter color result.
2862 * Set the meter color in the mbuf to the selected color.
2864 * See struct rte_flow_action_meter_color.
2866 RTE_FLOW_ACTION_TYPE_METER_COLOR,
2869 * At embedded switch level, sends matching traffic to the given ethdev.
2871 * @see struct rte_flow_action_ethdev
2873 RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
2876 * At embedded switch level, send matching traffic to
2877 * the entity represented by the given ethdev.
2879 * @see struct rte_flow_action_ethdev
2881 RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
2885 * RTE_FLOW_ACTION_TYPE_MARK
2887 * Attaches an integer value to packets and sets RTE_MBUF_F_RX_FDIR and
2888 * RTE_MBUF_F_RX_FDIR_ID mbuf flags.
2890 * This value is arbitrary and application-defined. Maximum allowed value
2891 * depends on the underlying implementation. It is returned in the
2892 * hash.fdir.hi mbuf field.
2894 struct rte_flow_action_mark {
2895 uint32_t id; /**< Integer value to return with packets. */
2900 * @b EXPERIMENTAL: this structure may change without prior notice
2902 * RTE_FLOW_ACTION_TYPE_JUMP
2904 * Redirects packets to a group on the current device.
2906 * In a hierarchy of groups, which can be used to represent physical or logical
2907 * flow tables on the device, this action allows the action to be a redirect to
2908 * a group on that device.
2910 struct rte_flow_action_jump {
2915 * RTE_FLOW_ACTION_TYPE_QUEUE
2917 * Assign packets to a given queue index.
2919 struct rte_flow_action_queue {
2920 uint16_t index; /**< Queue index to use. */
2925 * @b EXPERIMENTAL: this structure may change without prior notice
2927 * RTE_FLOW_ACTION_TYPE_AGE
2929 * Report flow as aged-out if timeout passed without any matching
2930 * on the flow. RTE_ETH_EVENT_FLOW_AGED event is triggered when a
2931 * port detects new aged-out flows.
2933 * The flow context and the flow handle will be reported by the
2934 * rte_flow_get_aged_flows API.
2936 struct rte_flow_action_age {
2937 uint32_t timeout:24; /**< Time in seconds. */
2938 uint32_t reserved:8; /**< Reserved, must be zero. */
2939 /** The user flow context, NULL means the rte_flow pointer. */
2944 * RTE_FLOW_ACTION_TYPE_AGE (query)
2946 * Query structure to retrieve the aging status information of a
2947 * shared AGE action, or a flow rule using the AGE action.
2949 struct rte_flow_query_age {
2950 uint32_t reserved:6; /**< Reserved, must be zero. */
2951 uint32_t aged:1; /**< 1 if aging timeout expired, 0 otherwise. */
2952 /** sec_since_last_hit value is valid. */
2953 uint32_t sec_since_last_hit_valid:1;
2954 uint32_t sec_since_last_hit:24; /**< Seconds since last traffic hit. */
2959 * @b EXPERIMENTAL: this structure may change without prior notice
2961 * RTE_FLOW_ACTION_TYPE_COUNT
2963 * Adds a counter action to a matched flow.
2965 * If more than one count action is specified in a single flow rule, then each
2966 * action must specify a unique ID.
2968 * Counters can be retrieved and reset through ``rte_flow_query()``, see
2969 * ``struct rte_flow_query_count``.
2971 * For ports within the same switch domain then the counter ID namespace extends
2972 * to all ports within that switch domain.
2974 struct rte_flow_action_count {
2975 uint32_t id; /**< Counter ID. */
2979 * RTE_FLOW_ACTION_TYPE_COUNT (query)
2981 * Query structure to retrieve and reset flow rule counters.
2983 struct rte_flow_query_count {
2984 uint32_t reset:1; /**< Reset counters after query [in]. */
2985 uint32_t hits_set:1; /**< hits field is set [out]. */
2986 uint32_t bytes_set:1; /**< bytes field is set [out]. */
2987 uint32_t reserved:29; /**< Reserved, must be zero [in, out]. */
2988 uint64_t hits; /**< Number of hits for this rule [out]. */
2989 uint64_t bytes; /**< Number of bytes through this rule [out]. */
2993 * Hash function types.
2995 enum rte_eth_hash_function {
2996 RTE_ETH_HASH_FUNCTION_DEFAULT = 0,
2997 RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */
2998 RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */
3000 * Symmetric Toeplitz: src, dst will be replaced by
3001 * xor(src, dst). For the case with src/dst only,
3002 * src or dst address will xor with zero pair.
3004 RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
3005 RTE_ETH_HASH_FUNCTION_MAX,
3009 * RTE_FLOW_ACTION_TYPE_RSS
3011 * Similar to QUEUE, except RSS is additionally performed on packets to
3012 * spread them among several queues according to the provided parameters.
3014 * Unlike global RSS settings used by other DPDK APIs, unsetting the
3015 * @p types field does not disable RSS in a flow rule. Doing so instead
3016 * requests safe unspecified "best-effort" settings from the underlying PMD,
3017 * which depending on the flow rule, may result in anything ranging from
3018 * empty (single queue) to all-inclusive RSS.
3020 * Note: RSS hash result is stored in the hash.rss mbuf field which overlaps
3021 * hash.fdir.lo. Since the MARK action sets the hash.fdir.hi field only,
3022 * both can be requested simultaneously.
3024 struct rte_flow_action_rss {
3025 enum rte_eth_hash_function func; /**< RSS hash function to apply. */
3027 * Packet encapsulation level RSS hash @p types apply to.
3029 * - @p 0 requests the default behavior. Depending on the packet
3030 * type, it can mean outermost, innermost, anything in between or
3033 * It basically stands for the innermost encapsulation level RSS
3034 * can be performed on according to PMD and device capabilities.
3036 * - @p 1 requests RSS to be performed on the outermost packet
3037 * encapsulation level.
3039 * - @p 2 and subsequent values request RSS to be performed on the
3040 * specified inner packet encapsulation level, from outermost to
3041 * innermost (lower to higher values).
3043 * Values other than @p 0 are not necessarily supported.
3045 * Requesting a specific RSS level on unrecognized traffic results
3046 * in undefined behavior. For predictable results, it is recommended
3047 * to make the flow rule pattern match packet headers up to the
3048 * requested encapsulation level so that only matching traffic goes
3052 uint64_t types; /**< Specific RSS hash types (see RTE_ETH_RSS_*). */
3053 uint32_t key_len; /**< Hash key length in bytes. */
3054 uint32_t queue_num; /**< Number of entries in @p queue. */
3055 const uint8_t *key; /**< Hash key. */
3056 const uint16_t *queue; /**< Queue indices to use. */
3061 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
3062 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
3064 * RTE_FLOW_ACTION_TYPE_VF
3066 * Directs matching traffic to a given virtual function of the current
3069 * Packets matched by a VF pattern item can be redirected to their original
3070 * VF ID instead of the specified one. This parameter may not be available
3071 * and is not guaranteed to work properly if the VF part is matched by a
3072 * prior flow rule or if packets are not addressed to a VF in the first
3075 struct rte_flow_action_vf {
3076 uint32_t original:1; /**< Use original VF ID if possible. */
3077 uint32_t reserved:31; /**< Reserved, must be zero. */
3078 uint32_t id; /**< VF ID. */
3083 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
3084 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
3086 * RTE_FLOW_ACTION_TYPE_PHY_PORT
3088 * Directs packets to a given physical port index of the underlying
3091 * @see RTE_FLOW_ITEM_TYPE_PHY_PORT
3093 struct rte_flow_action_phy_port {
3094 uint32_t original:1; /**< Use original port index if possible. */
3095 uint32_t reserved:31; /**< Reserved, must be zero. */
3096 uint32_t index; /**< Physical port index. */
3101 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
3102 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
3104 * RTE_FLOW_ACTION_TYPE_PORT_ID
3106 * Directs matching traffic to a given DPDK port ID.
3108 * @see RTE_FLOW_ITEM_TYPE_PORT_ID
3110 struct rte_flow_action_port_id {
3111 uint32_t original:1; /**< Use original DPDK port ID if possible. */
3112 uint32_t reserved:31; /**< Reserved, must be zero. */
3113 uint32_t id; /**< DPDK port ID. */
3117 * RTE_FLOW_ACTION_TYPE_METER
3119 * Traffic metering and policing (MTR).
3121 * Packets matched by items of this type can be either dropped or passed to the
3122 * next item with their color set by the MTR object.
3124 struct rte_flow_action_meter {
3125 uint32_t mtr_id; /**< MTR object ID created with rte_mtr_create(). */
3129 * RTE_FLOW_ACTION_TYPE_SECURITY
3131 * Perform the security action on flows matched by the pattern items
3132 * according to the configuration of the security session.
3134 * This action modifies the payload of matched flows. For INLINE_CRYPTO, the
3135 * security protocol headers and IV are fully provided by the application as
3136 * specified in the flow pattern. The payload of matching packets is
3137 * encrypted on egress, and decrypted and authenticated on ingress.
3138 * For INLINE_PROTOCOL, the security protocol is fully offloaded to HW,
3139 * providing full encapsulation and decapsulation of packets in security
3140 * protocols. The flow pattern specifies both the outer security header fields
3141 * and the inner packet fields. The security session specified in the action
3142 * must match the pattern parameters.
3144 * The security session specified in the action must be created on the same
3145 * port as the flow action that is being specified.
3147 * The ingress/egress flow attribute should match that specified in the
3148 * security session if the security session supports the definition of the
3151 * Multiple flows can be configured to use the same security session.
3153 * The NULL value is allowed for security session. If security session is NULL,
3154 * then SPI field in ESP flow item and IP addresses in flow items 'IPv4' and
3155 * 'IPv6' will be allowed to be a range. The rule thus created can enable
3156 * security processing on multiple flows.
3158 struct rte_flow_action_security {
3159 void *security_session; /**< Pointer to security session structure. */
3164 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3166 * RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL
3168 * Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the OpenFlow
3169 * Switch Specification.
3171 struct rte_flow_action_of_set_mpls_ttl {
3172 uint8_t mpls_ttl; /**< MPLS TTL. */
3177 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3179 * RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL
3181 * Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow Switch
3184 struct rte_flow_action_of_set_nw_ttl {
3185 uint8_t nw_ttl; /**< IP TTL. */
3189 * RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN
3191 * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by the
3192 * OpenFlow Switch Specification.
3194 struct rte_flow_action_of_push_vlan {
3195 rte_be16_t ethertype; /**< EtherType. */
3199 * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID
3201 * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN ID") as defined by
3202 * the OpenFlow Switch Specification.
3204 struct rte_flow_action_of_set_vlan_vid {
3205 rte_be16_t vlan_vid; /**< VLAN ID. */
3209 * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP
3211 * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as defined by
3212 * the OpenFlow Switch Specification.
3214 struct rte_flow_action_of_set_vlan_pcp {
3215 uint8_t vlan_pcp; /**< VLAN priority. */
3219 * RTE_FLOW_ACTION_TYPE_OF_POP_MPLS
3221 * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined by the
3222 * OpenFlow Switch Specification.
3224 struct rte_flow_action_of_pop_mpls {
3225 rte_be16_t ethertype; /**< EtherType. */
3229 * RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS
3231 * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by the
3232 * OpenFlow Switch Specification.
3234 struct rte_flow_action_of_push_mpls {
3235 rte_be16_t ethertype; /**< EtherType. */
3240 * @b EXPERIMENTAL: this structure may change without prior notice
3242 * RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP
3244 * VXLAN tunnel end-point encapsulation data definition
3246 * The tunnel definition is provided through the flow item pattern, the
3247 * provided pattern must conform to RFC7348 for the tunnel specified. The flow
3248 * definition must be provided in order from the RTE_FLOW_ITEM_TYPE_ETH
3249 * definition up the end item which is specified by RTE_FLOW_ITEM_TYPE_END.
3251 * The mask field allows user to specify which fields in the flow item
3252 * definitions can be ignored and which have valid data and can be used
3255 * Note: the last field is not used in the definition of a tunnel and can be
3258 * Valid flow definition for RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP include:
3260 * - ETH / IPV4 / UDP / VXLAN / END
3261 * - ETH / IPV6 / UDP / VXLAN / END
3262 * - ETH / VLAN / IPV4 / UDP / VXLAN / END
3265 struct rte_flow_action_vxlan_encap {
3267 * Encapsulating vxlan tunnel definition
3268 * (terminated by the END pattern item).
3270 struct rte_flow_item *definition;
3275 * @b EXPERIMENTAL: this structure may change without prior notice
3277 * RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP
3279 * NVGRE tunnel end-point encapsulation data definition
3281 * The tunnel definition is provided through the flow item pattern the
3282 * provided pattern must conform with RFC7637. The flow definition must be
3283 * provided in order from the RTE_FLOW_ITEM_TYPE_ETH definition up the end item
3284 * which is specified by RTE_FLOW_ITEM_TYPE_END.
3286 * The mask field allows user to specify which fields in the flow item
3287 * definitions can be ignored and which have valid data and can be used
3290 * Note: the last field is not used in the definition of a tunnel and can be
3293 * Valid flow definition for RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP include:
3295 * - ETH / IPV4 / NVGRE / END
3296 * - ETH / VLAN / IPV6 / NVGRE / END
3299 struct rte_flow_action_nvgre_encap {
3301 * Encapsulating vxlan tunnel definition
3302 * (terminated by the END pattern item).
3304 struct rte_flow_item *definition;
3309 * @b EXPERIMENTAL: this structure may change without prior notice
3311 * RTE_FLOW_ACTION_TYPE_RAW_ENCAP
3313 * Raw tunnel end-point encapsulation data definition.
3315 * The data holds the headers definitions to be applied on the packet.
3316 * The data must start with ETH header up to the tunnel item header itself.
3317 * When used right after RAW_DECAP (for decapsulating L3 tunnel type for
3318 * example MPLSoGRE) the data will just hold layer 2 header.
3320 * The preserve parameter holds which bits in the packet the PMD is not allowed
3321 * to change, this parameter can also be NULL and then the PMD is allowed
3322 * to update any field.
3324 * size holds the number of bytes in @p data and @p preserve.
3326 struct rte_flow_action_raw_encap {
3327 uint8_t *data; /**< Encapsulation data. */
3328 uint8_t *preserve; /**< Bit-mask of @p data to preserve on output. */
3329 size_t size; /**< Size of @p data and @p preserve. */
3334 * @b EXPERIMENTAL: this structure may change without prior notice
3336 * RTE_FLOW_ACTION_TYPE_RAW_DECAP
3338 * Raw tunnel end-point decapsulation data definition.
3340 * The data holds the headers definitions to be removed from the packet.
3341 * The data must start with ETH header up to the tunnel item header itself.
3342 * When used right before RAW_DECAP (for encapsulating L3 tunnel type for
3343 * example MPLSoGRE) the data will just hold layer 2 header.
3345 * size holds the number of bytes in @p data.
3347 struct rte_flow_action_raw_decap {
3348 uint8_t *data; /**< Encapsulation data. */
3349 size_t size; /**< Size of @p data and @p preserve. */
3354 * @b EXPERIMENTAL: this structure may change without prior notice
3356 * RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC
3357 * RTE_FLOW_ACTION_TYPE_SET_IPV4_DST
3359 * Allows modification of IPv4 source (RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC)
3360 * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV4_DST) in the
3361 * specified outermost IPv4 header.
3363 struct rte_flow_action_set_ipv4 {
3364 rte_be32_t ipv4_addr;
3369 * @b EXPERIMENTAL: this structure may change without prior notice
3371 * RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC
3372 * RTE_FLOW_ACTION_TYPE_SET_IPV6_DST
3374 * Allows modification of IPv6 source (RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC)
3375 * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) in the
3376 * specified outermost IPv6 header.
3378 struct rte_flow_action_set_ipv6 {
3379 uint8_t ipv6_addr[16];
3384 * @b EXPERIMENTAL: this structure may change without prior notice
3386 * RTE_FLOW_ACTION_TYPE_SET_TP_SRC
3387 * RTE_FLOW_ACTION_TYPE_SET_TP_DST
3389 * Allows modification of source (RTE_FLOW_ACTION_TYPE_SET_TP_SRC)
3390 * and destination (RTE_FLOW_ACTION_TYPE_SET_TP_DST) port numbers
3391 * in the specified outermost TCP/UDP header.
3393 struct rte_flow_action_set_tp {
3398 * RTE_FLOW_ACTION_TYPE_SET_TTL
3400 * Set the TTL value directly for IPv4 or IPv6
3402 struct rte_flow_action_set_ttl {
3407 * RTE_FLOW_ACTION_TYPE_SET_MAC
3409 * Set MAC address from the matched flow
3411 struct rte_flow_action_set_mac {
3412 uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
3417 * @b EXPERIMENTAL: this structure may change without prior notice
3419 * RTE_FLOW_ACTION_TYPE_SET_TAG
3421 * Set a tag which is a transient data used during flow matching. This is not
3422 * delivered to application. Multiple tags are supported by specifying index.
3424 struct rte_flow_action_set_tag {
3432 * @b EXPERIMENTAL: this structure may change without prior notice
3434 * RTE_FLOW_ACTION_TYPE_SET_META
3436 * Set metadata. Metadata set by mbuf metadata dynamic field with
3437 * RTE_MBUF_DYNFLAG_TX_METADATA flag on egress will be overridden by this
3438 * action. On ingress, the metadata will be carried by mbuf metadata dynamic
3439 * field with RTE_MBUF_DYNFLAG_RX_METADATA flag if set. The dynamic mbuf field
3440 * must be registered in advance by rte_flow_dynf_metadata_register().
3442 * Altering partial bits is supported with mask. For bits which have never
3443 * been set, unpredictable value will be seen depending on driver
3444 * implementation. For loopback/hairpin packet, metadata set on Rx/Tx may
3445 * or may not be propagated to the other path depending on HW capability.
3447 * RTE_FLOW_ITEM_TYPE_META matches metadata.
3449 struct rte_flow_action_set_meta {
3455 * RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP
3456 * RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP
3458 * Set the DSCP value for IPv4/IPv6 header.
3459 * DSCP in low 6 bits, rest ignored.
3461 struct rte_flow_action_set_dscp {
3467 * @b EXPERIMENTAL: this structure may change without prior notice
3469 * RTE_FLOW_ACTION_TYPE_INDIRECT
3471 * Opaque type returned after successfully creating an indirect action object.
3472 * The definition of the object handle is different per driver or
3473 * per direct action type.
3475 * This handle can be used to manage and query the related direct action:
3476 * - referenced in single flow rule or across multiple flow rules
3477 * over multiple ports
3478 * - update action object configuration
3479 * - query action object data
3480 * - destroy action object
3482 struct rte_flow_action_handle;
3485 * The state of a TCP connection.
3487 enum rte_flow_conntrack_state {
3488 /** SYN-ACK packet was seen. */
3489 RTE_FLOW_CONNTRACK_STATE_SYN_RECV,
3490 /** 3-way handshake was done. */
3491 RTE_FLOW_CONNTRACK_STATE_ESTABLISHED,
3492 /** First FIN packet was received to close the connection. */
3493 RTE_FLOW_CONNTRACK_STATE_FIN_WAIT,
3494 /** First FIN was ACKed. */
3495 RTE_FLOW_CONNTRACK_STATE_CLOSE_WAIT,
3496 /** Second FIN was received, waiting for the last ACK. */
3497 RTE_FLOW_CONNTRACK_STATE_LAST_ACK,
3498 /** Second FIN was ACKed, connection was closed. */
3499 RTE_FLOW_CONNTRACK_STATE_TIME_WAIT,
3503 * The last passed TCP packet flags of a connection.
3505 enum rte_flow_conntrack_tcp_last_index {
3506 RTE_FLOW_CONNTRACK_FLAG_NONE = 0, /**< No Flag. */
3507 RTE_FLOW_CONNTRACK_FLAG_SYN = RTE_BIT32(0), /**< With SYN flag. */
3508 RTE_FLOW_CONNTRACK_FLAG_SYNACK = RTE_BIT32(1), /**< With SYNACK flag. */
3509 RTE_FLOW_CONNTRACK_FLAG_FIN = RTE_BIT32(2), /**< With FIN flag. */
3510 RTE_FLOW_CONNTRACK_FLAG_ACK = RTE_BIT32(3), /**< With ACK flag. */
3511 RTE_FLOW_CONNTRACK_FLAG_RST = RTE_BIT32(4), /**< With RST flag. */
3516 * @b EXPERIMENTAL: this structure may change without prior notice
3518 * Configuration parameters for each direction of a TCP connection.
3519 * All fields should be in host byte order.
3520 * If needed, driver should convert all fields to network byte order
3521 * if HW needs them in that way.
3523 struct rte_flow_tcp_dir_param {
3524 /** TCP window scaling factor, 0xF to disable. */
3526 /** The FIN was sent by this direction. */
3527 uint32_t close_initiated:1;
3528 /** An ACK packet has been received by this side. */
3529 uint32_t last_ack_seen:1;
3531 * If set, it indicates that there is unacknowledged data for the
3532 * packets sent from this direction.
3534 uint32_t data_unacked:1;
3536 * Maximal value of sequence + payload length in sent
3537 * packets (next ACK from the opposite direction).
3541 * Maximal value of (ACK + window size) in received packet + length
3542 * over sent packet (maximal sequence could be sent).
3545 /** Maximal value of actual window size in sent packets. */
3547 /** Maximal value of ACK in sent packets. */
3553 * @b EXPERIMENTAL: this structure may change without prior notice
3555 * RTE_FLOW_ACTION_TYPE_CONNTRACK
3557 * Configuration and initial state for the connection tracking module.
3558 * This structure could be used for both setting and query.
3559 * All fields should be in host byte order.
3561 struct rte_flow_action_conntrack {
3562 /** The peer port number, can be the same port. */
3565 * Direction of this connection when creating a flow rule, the
3566 * value only affects the creation of subsequent flow rules.
3568 uint32_t is_original_dir:1;
3570 * Enable / disable the conntrack HW module. When disabled, the
3571 * result will always be RTE_FLOW_CONNTRACK_FLAG_DISABLED.
3572 * In this state the HW will act as passthrough.
3573 * It only affects this conntrack object in the HW without any effect
3574 * to the other objects.
3577 /** At least one ack was seen after the connection was established. */
3578 uint32_t live_connection:1;
3579 /** Enable selective ACK on this connection. */
3580 uint32_t selective_ack:1;
3581 /** A challenge ack has passed. */
3582 uint32_t challenge_ack_passed:1;
3584 * 1: The last packet is seen from the original direction.
3585 * 0: The last packet is seen from the reply direction.
3587 uint32_t last_direction:1;
3588 /** No TCP check will be done except the state change. */
3589 uint32_t liberal_mode:1;
3590 /** The current state of this connection. */
3591 enum rte_flow_conntrack_state state;
3592 /** Scaling factor for maximal allowed ACK window. */
3593 uint8_t max_ack_window;
3594 /** Maximal allowed number of retransmission times. */
3595 uint8_t retransmission_limit;
3596 /** TCP parameters of the original direction. */
3597 struct rte_flow_tcp_dir_param original_dir;
3598 /** TCP parameters of the reply direction. */
3599 struct rte_flow_tcp_dir_param reply_dir;
3600 /** The window value of the last packet passed this conntrack. */
3601 uint16_t last_window;
3602 enum rte_flow_conntrack_tcp_last_index last_index;
3603 /** The sequence of the last packet passed this conntrack. */
3605 /** The acknowledgment of the last packet passed this conntrack. */
3608 * The total value ACK + payload length of the last packet
3609 * passed this conntrack.
3615 * RTE_FLOW_ACTION_TYPE_CONNTRACK
3617 * Wrapper structure for the context update interface.
3618 * Ports cannot support updating, and the only valid solution is to
3619 * destroy the old context and create a new one instead.
3621 struct rte_flow_modify_conntrack {
3622 /** New connection tracking parameters to be updated. */
3623 struct rte_flow_action_conntrack new_ct;
3624 /** The direction field will be updated. */
3625 uint32_t direction:1;
3626 /** All the other fields except direction will be updated. */
3628 /** Reserved bits for the future usage. */
3629 uint32_t reserved:30;
3634 * @b EXPERIMENTAL: this structure may change without prior notice
3636 * RTE_FLOW_ACTION_TYPE_METER_COLOR
3638 * The meter color should be set in the packet meta-data
3639 * (i.e. struct rte_mbuf::sched::color).
3641 struct rte_flow_action_meter_color {
3642 enum rte_color color; /**< Packet color. */
3647 * @b EXPERIMENTAL: this structure may change without prior notice
3649 * Provides an ethdev port ID for use with the following actions:
3650 * RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
3651 * RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT.
3653 struct rte_flow_action_ethdev {
3654 uint16_t port_id; /**< ethdev port ID */
3658 * Field IDs for MODIFY_FIELD action.
3660 enum rte_flow_field_id {
3661 RTE_FLOW_FIELD_START = 0, /**< Start of a packet. */
3662 RTE_FLOW_FIELD_MAC_DST, /**< Destination MAC Address. */
3663 RTE_FLOW_FIELD_MAC_SRC, /**< Source MAC Address. */
3664 RTE_FLOW_FIELD_VLAN_TYPE, /**< 802.1Q Tag Identifier. */
3665 RTE_FLOW_FIELD_VLAN_ID, /**< 802.1Q VLAN Identifier. */
3666 RTE_FLOW_FIELD_MAC_TYPE, /**< EtherType. */
3667 RTE_FLOW_FIELD_IPV4_DSCP, /**< IPv4 DSCP. */
3668 RTE_FLOW_FIELD_IPV4_TTL, /**< IPv4 Time To Live. */
3669 RTE_FLOW_FIELD_IPV4_SRC, /**< IPv4 Source Address. */
3670 RTE_FLOW_FIELD_IPV4_DST, /**< IPv4 Destination Address. */
3671 RTE_FLOW_FIELD_IPV6_DSCP, /**< IPv6 DSCP. */
3672 RTE_FLOW_FIELD_IPV6_HOPLIMIT, /**< IPv6 Hop Limit. */
3673 RTE_FLOW_FIELD_IPV6_SRC, /**< IPv6 Source Address. */
3674 RTE_FLOW_FIELD_IPV6_DST, /**< IPv6 Destination Address. */
3675 RTE_FLOW_FIELD_TCP_PORT_SRC, /**< TCP Source Port Number. */
3676 RTE_FLOW_FIELD_TCP_PORT_DST, /**< TCP Destination Port Number. */
3677 RTE_FLOW_FIELD_TCP_SEQ_NUM, /**< TCP Sequence Number. */
3678 RTE_FLOW_FIELD_TCP_ACK_NUM, /**< TCP Acknowledgment Number. */
3679 RTE_FLOW_FIELD_TCP_FLAGS, /**< TCP Flags. */
3680 RTE_FLOW_FIELD_UDP_PORT_SRC, /**< UDP Source Port Number. */
3681 RTE_FLOW_FIELD_UDP_PORT_DST, /**< UDP Destination Port Number. */
3682 RTE_FLOW_FIELD_VXLAN_VNI, /**< VXLAN Network Identifier. */
3683 RTE_FLOW_FIELD_GENEVE_VNI, /**< GENEVE Network Identifier. */
3684 RTE_FLOW_FIELD_GTP_TEID, /**< GTP Tunnel Endpoint Identifier. */
3685 RTE_FLOW_FIELD_TAG, /**< Tag value. */
3686 RTE_FLOW_FIELD_MARK, /**< Mark value. */
3687 RTE_FLOW_FIELD_META, /**< Metadata value. */
3688 RTE_FLOW_FIELD_POINTER, /**< Memory pointer. */
3689 RTE_FLOW_FIELD_VALUE, /**< Immediate value. */
3694 * @b EXPERIMENTAL: this structure may change without prior notice
3696 * Field description for MODIFY_FIELD action.
3698 struct rte_flow_action_modify_data {
3699 enum rte_flow_field_id field; /**< Field or memory type ID. */
3703 /** Encapsulation level or tag index. */
3705 /** Number of bits to skip from a field. */
3709 * Immediate value for RTE_FLOW_FIELD_VALUE, presented in the
3710 * same byte order and length as in relevant rte_flow_item_xxx.
3711 * The immediate source bitfield offset is inherited from
3712 * the destination's one.
3716 * Memory address for RTE_FLOW_FIELD_POINTER, memory layout
3717 * should be the same as for relevant field in the
3718 * rte_flow_item_xxx structure.
3725 * Operation types for MODIFY_FIELD action.
3727 enum rte_flow_modify_op {
3728 RTE_FLOW_MODIFY_SET = 0, /**< Set a new value. */
3729 RTE_FLOW_MODIFY_ADD, /**< Add a value to a field. */
3730 RTE_FLOW_MODIFY_SUB, /**< Subtract a value from a field. */
3735 * @b EXPERIMENTAL: this structure may change without prior notice
3737 * RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3739 * Modify a destination header field according to the specified
3740 * operation. Another field of the packet can be used as a source as well
3741 * as tag, mark, metadata, immediate value or a pointer to it.
3743 struct rte_flow_action_modify_field {
3744 enum rte_flow_modify_op operation; /**< Operation to perform. */
3745 struct rte_flow_action_modify_data dst; /**< Destination field. */
3746 struct rte_flow_action_modify_data src; /**< Source field. */
3747 uint32_t width; /**< Number of bits to use from a source field. */
3750 /* Mbuf dynamic field offset for metadata. */
3751 extern int32_t rte_flow_dynf_metadata_offs;
3753 /* Mbuf dynamic field flag mask for metadata. */
3754 extern uint64_t rte_flow_dynf_metadata_mask;
3756 /* Mbuf dynamic field pointer for metadata. */
3757 #define RTE_FLOW_DYNF_METADATA(m) \
3758 RTE_MBUF_DYNFIELD((m), rte_flow_dynf_metadata_offs, uint32_t *)
3760 /* Mbuf dynamic flags for metadata. */
3761 #define RTE_MBUF_DYNFLAG_RX_METADATA (rte_flow_dynf_metadata_mask)
3762 #define PKT_RX_DYNF_METADATA RTE_DEPRECATED(PKT_RX_DYNF_METADATA) \
3763 RTE_MBUF_DYNFLAG_RX_METADATA
3764 #define RTE_MBUF_DYNFLAG_TX_METADATA (rte_flow_dynf_metadata_mask)
3765 #define PKT_TX_DYNF_METADATA RTE_DEPRECATED(PKT_TX_DYNF_METADATA) \
3766 RTE_MBUF_DYNFLAG_TX_METADATA
3769 static inline uint32_t
3770 rte_flow_dynf_metadata_get(struct rte_mbuf *m)
3772 return *RTE_FLOW_DYNF_METADATA(m);
3777 rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v)
3779 *RTE_FLOW_DYNF_METADATA(m) = v;
3783 * Definition of a single action.
3785 * A list of actions is terminated by a END action.
3787 * For simple actions without a configuration object, conf remains NULL.
3789 struct rte_flow_action {
3790 enum rte_flow_action_type type; /**< Action type. */
3791 const void *conf; /**< Pointer to action configuration object. */
3795 * Opaque type returned after successfully creating a flow.
3797 * This handle can be used to manage and query the related flow (e.g. to
3798 * destroy it or retrieve counters).
3804 * @b EXPERIMENTAL: this structure may change without prior notice
3806 * RTE_FLOW_ACTION_TYPE_SAMPLE
3808 * Adds a sample action to a matched flow.
3810 * The matching packets will be duplicated with specified ratio and applied
3811 * with own set of actions with a fate action, the sampled packet could be
3812 * redirected to queue or port. All the packets continue processing on the
3813 * default flow path.
3815 * When the sample ratio is set to 1 then the packets will be 100% mirrored.
3816 * Additional action list be supported to add for sampled or mirrored packets.
3818 struct rte_flow_action_sample {
3819 uint32_t ratio; /**< packets sampled equals to '1/ratio'. */
3820 /** sub-action list specific for the sampling hit cases. */
3821 const struct rte_flow_action *actions;
3825 * Verbose error types.
3827 * Most of them provide the type of the object referenced by struct
3828 * rte_flow_error.cause.
3830 enum rte_flow_error_type {
3831 RTE_FLOW_ERROR_TYPE_NONE, /**< No error. */
3832 RTE_FLOW_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
3833 RTE_FLOW_ERROR_TYPE_HANDLE, /**< Flow rule (handle). */
3834 RTE_FLOW_ERROR_TYPE_ATTR_GROUP, /**< Group field. */
3835 RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, /**< Priority field. */
3836 RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, /**< Ingress field. */
3837 RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, /**< Egress field. */
3838 RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, /**< Transfer field. */
3839 RTE_FLOW_ERROR_TYPE_ATTR, /**< Attributes structure. */
3840 RTE_FLOW_ERROR_TYPE_ITEM_NUM, /**< Pattern length. */
3841 RTE_FLOW_ERROR_TYPE_ITEM_SPEC, /**< Item specification. */
3842 RTE_FLOW_ERROR_TYPE_ITEM_LAST, /**< Item specification range. */
3843 RTE_FLOW_ERROR_TYPE_ITEM_MASK, /**< Item specification mask. */
3844 RTE_FLOW_ERROR_TYPE_ITEM, /**< Specific pattern item. */
3845 RTE_FLOW_ERROR_TYPE_ACTION_NUM, /**< Number of actions. */
3846 RTE_FLOW_ERROR_TYPE_ACTION_CONF, /**< Action configuration. */
3847 RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */
3848 RTE_FLOW_ERROR_TYPE_STATE, /**< Current device state. */
3852 * Verbose error structure definition.
3854 * This object is normally allocated by applications and set by PMDs, the
3855 * message points to a constant string which does not need to be freed by
3856 * the application, however its pointer can be considered valid only as long
3857 * as its associated DPDK port remains configured. Closing the underlying
3858 * device or unloading the PMD invalidates it.
3860 * Both cause and message may be NULL regardless of the error type.
3862 struct rte_flow_error {
3863 enum rte_flow_error_type type; /**< Cause field and error types. */
3864 const void *cause; /**< Object responsible for the error. */
3865 const char *message; /**< Human-readable error message. */
3869 * Complete flow rule description.
3871 * This object type is used when converting a flow rule description.
3873 * @see RTE_FLOW_CONV_OP_RULE
3874 * @see rte_flow_conv()
3877 struct rte_flow_conv_rule {
3879 const struct rte_flow_attr *attr_ro; /**< RO attributes. */
3880 struct rte_flow_attr *attr; /**< Attributes. */
3883 const struct rte_flow_item *pattern_ro; /**< RO pattern. */
3884 struct rte_flow_item *pattern; /**< Pattern items. */
3887 const struct rte_flow_action *actions_ro; /**< RO actions. */
3888 struct rte_flow_action *actions; /**< List of actions. */
3893 * Conversion operations for flow API objects.
3895 * @see rte_flow_conv()
3897 enum rte_flow_conv_op {
3899 * No operation to perform.
3901 * rte_flow_conv() simply returns 0.
3903 RTE_FLOW_CONV_OP_NONE,
3906 * Convert attributes structure.
3908 * This is a basic copy of an attributes structure.
3911 * @code const struct rte_flow_attr * @endcode
3913 * @code struct rte_flow_attr * @endcode
3915 RTE_FLOW_CONV_OP_ATTR,
3918 * Convert a single item.
3920 * Duplicates @p spec, @p last and @p mask but not outside objects.
3923 * @code const struct rte_flow_item * @endcode
3925 * @code struct rte_flow_item * @endcode
3927 RTE_FLOW_CONV_OP_ITEM,
3930 * Convert a single action.
3932 * Duplicates @p conf but not outside objects.
3935 * @code const struct rte_flow_action * @endcode
3937 * @code struct rte_flow_action * @endcode
3939 RTE_FLOW_CONV_OP_ACTION,
3942 * Convert an entire pattern.
3944 * Duplicates all pattern items at once with the same constraints as
3945 * RTE_FLOW_CONV_OP_ITEM.
3948 * @code const struct rte_flow_item * @endcode
3950 * @code struct rte_flow_item * @endcode
3952 RTE_FLOW_CONV_OP_PATTERN,
3955 * Convert a list of actions.
3957 * Duplicates the entire list of actions at once with the same
3958 * constraints as RTE_FLOW_CONV_OP_ACTION.
3961 * @code const struct rte_flow_action * @endcode
3963 * @code struct rte_flow_action * @endcode
3965 RTE_FLOW_CONV_OP_ACTIONS,
3968 * Convert a complete flow rule description.
3970 * Comprises attributes, pattern and actions together at once with
3971 * the usual constraints.
3974 * @code const struct rte_flow_conv_rule * @endcode
3976 * @code struct rte_flow_conv_rule * @endcode
3978 RTE_FLOW_CONV_OP_RULE,
3981 * Convert item type to its name string.
3983 * Writes a NUL-terminated string to @p dst. Like snprintf(), the
3984 * returned value excludes the terminator which is always written
3988 * @code (const void *)enum rte_flow_item_type @endcode
3990 * @code char * @endcode
3992 RTE_FLOW_CONV_OP_ITEM_NAME,
3995 * Convert action type to its name string.
3997 * Writes a NUL-terminated string to @p dst. Like snprintf(), the
3998 * returned value excludes the terminator which is always written
4002 * @code (const void *)enum rte_flow_action_type @endcode
4004 * @code char * @endcode
4006 RTE_FLOW_CONV_OP_ACTION_NAME,
4009 * Convert item type to pointer to item name.
4011 * Retrieves item name pointer from its type. The string itself is
4012 * not copied; instead, a unique pointer to an internal static
4013 * constant storage is written to @p dst.
4016 * @code (const void *)enum rte_flow_item_type @endcode
4018 * @code const char ** @endcode
4020 RTE_FLOW_CONV_OP_ITEM_NAME_PTR,
4023 * Convert action type to pointer to action name.
4025 * Retrieves action name pointer from its type. The string itself is
4026 * not copied; instead, a unique pointer to an internal static
4027 * constant storage is written to @p dst.
4030 * @code (const void *)enum rte_flow_action_type @endcode
4032 * @code const char ** @endcode
4034 RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
4039 * @b EXPERIMENTAL: this API may change without prior notice.
4041 * Dump hardware internal representation information of
4044 * @param[in] port_id
4045 * The port identifier of the Ethernet device.
4047 * The pointer of flow rule to dump. Dump all rules if NULL.
4049 * A pointer to a file for output.
4051 * Perform verbose error reporting if not NULL. PMDs initialize this
4052 * structure in case of error only.
4054 * 0 on success, a negative value otherwise.
4058 rte_flow_dev_dump(uint16_t port_id, struct rte_flow *flow,
4059 FILE *file, struct rte_flow_error *error);
4062 * Check if mbuf dynamic field for metadata is registered.
4065 * True if registered, false otherwise.
4069 rte_flow_dynf_metadata_avail(void)
4071 return !!rte_flow_dynf_metadata_mask;
4075 * Register mbuf dynamic field and flag for metadata.
4077 * This function must be called prior to use SET_META action in order to
4078 * register the dynamic mbuf field. Otherwise, the data cannot be delivered to
4082 * 0 on success, a negative errno value otherwise and rte_errno is set.
4086 rte_flow_dynf_metadata_register(void);
4089 * Check whether a flow rule can be created on a given port.
4091 * The flow rule is validated for correctness and whether it could be accepted
4092 * by the device given sufficient resources. The rule is checked against the
4093 * current device mode and queue configuration. The flow rule may also
4094 * optionally be validated against existing flow rules and device resources.
4095 * This function has no effect on the target device.
4097 * The returned value is guaranteed to remain valid only as long as no
4098 * successful calls to rte_flow_create() or rte_flow_destroy() are made in
4099 * the meantime and no device parameter affecting flow rules in any way are
4100 * modified, due to possible collisions or resource limitations (although in
4101 * such cases EINVAL should not be returned).
4104 * Port identifier of Ethernet device.
4106 * Flow rule attributes.
4107 * @param[in] pattern
4108 * Pattern specification (list terminated by the END pattern item).
4109 * @param[in] actions
4110 * Associated actions (list terminated by the END action).
4112 * Perform verbose error reporting if not NULL. PMDs initialize this
4113 * structure in case of error only.
4116 * 0 if flow rule is valid and can be created. A negative errno value
4117 * otherwise (rte_errno is also set), the following errors are defined:
4119 * -ENOSYS: underlying device does not support this functionality.
4121 * -EIO: underlying device is removed.
4123 * -EINVAL: unknown or invalid rule specification.
4125 * -ENOTSUP: valid but unsupported rule specification (e.g. partial
4126 * bit-masks are unsupported).
4128 * -EEXIST: collision with an existing rule. Only returned if device
4129 * supports flow rule collision checking and there was a flow rule
4130 * collision. Not receiving this return code is no guarantee that creating
4131 * the rule will not fail due to a collision.
4133 * -ENOMEM: not enough memory to execute the function, or if the device
4134 * supports resource validation, resource limitation on the device.
4136 * -EBUSY: action cannot be performed due to busy device resources, may
4137 * succeed if the affected queues or even the entire port are in a stopped
4138 * state (see rte_eth_dev_rx_queue_stop() and rte_eth_dev_stop()).
4141 rte_flow_validate(uint16_t port_id,
4142 const struct rte_flow_attr *attr,
4143 const struct rte_flow_item pattern[],
4144 const struct rte_flow_action actions[],
4145 struct rte_flow_error *error);
4148 * Create a flow rule on a given port.
4151 * Port identifier of Ethernet device.
4153 * Flow rule attributes.
4154 * @param[in] pattern
4155 * Pattern specification (list terminated by the END pattern item).
4156 * @param[in] actions
4157 * Associated actions (list terminated by the END action).
4159 * Perform verbose error reporting if not NULL. PMDs initialize this
4160 * structure in case of error only.
4163 * A valid handle in case of success, NULL otherwise and rte_errno is set
4164 * to the positive version of one of the error codes defined for
4165 * rte_flow_validate().
4168 rte_flow_create(uint16_t port_id,
4169 const struct rte_flow_attr *attr,
4170 const struct rte_flow_item pattern[],
4171 const struct rte_flow_action actions[],
4172 struct rte_flow_error *error);
4175 * Destroy a flow rule on a given port.
4177 * Failure to destroy a flow rule handle may occur when other flow rules
4178 * depend on it, and destroying it would result in an inconsistent state.
4180 * This function is only guaranteed to succeed if handles are destroyed in
4181 * reverse order of their creation.
4184 * Port identifier of Ethernet device.
4186 * Flow rule handle to destroy.
4188 * Perform verbose error reporting if not NULL. PMDs initialize this
4189 * structure in case of error only.
4192 * 0 on success, a negative errno value otherwise and rte_errno is set.
4195 rte_flow_destroy(uint16_t port_id,
4196 struct rte_flow *flow,
4197 struct rte_flow_error *error);
4200 * Destroy all flow rules associated with a port.
4202 * In the unlikely event of failure, handles are still considered destroyed
4203 * and no longer valid but the port must be assumed to be in an inconsistent
4207 * Port identifier of Ethernet device.
4209 * Perform verbose error reporting if not NULL. PMDs initialize this
4210 * structure in case of error only.
4213 * 0 on success, a negative errno value otherwise and rte_errno is set.
4216 rte_flow_flush(uint16_t port_id,
4217 struct rte_flow_error *error);
4220 * Query an existing flow rule.
4222 * This function allows retrieving flow-specific data such as counters.
4223 * Data is gathered by special actions which must be present in the flow
4226 * \see RTE_FLOW_ACTION_TYPE_COUNT
4229 * Port identifier of Ethernet device.
4231 * Flow rule handle to query.
4233 * Action definition as defined in original flow rule.
4234 * @param[in, out] data
4235 * Pointer to storage for the associated query data type.
4237 * Perform verbose error reporting if not NULL. PMDs initialize this
4238 * structure in case of error only.
4241 * 0 on success, a negative errno value otherwise and rte_errno is set.
4244 rte_flow_query(uint16_t port_id,
4245 struct rte_flow *flow,
4246 const struct rte_flow_action *action,
4248 struct rte_flow_error *error);
4251 * Restrict ingress traffic to the defined flow rules.
4253 * Isolated mode guarantees that all ingress traffic comes from defined flow
4254 * rules only (current and future).
4256 * Besides making ingress more deterministic, it allows PMDs to safely reuse
4257 * resources otherwise assigned to handle the remaining traffic, such as
4258 * global RSS configuration settings, VLAN filters, MAC address entries,
4259 * legacy filter API rules and so on in order to expand the set of possible
4262 * Calling this function as soon as possible after device initialization,
4263 * ideally before the first call to rte_eth_dev_configure(), is recommended
4264 * to avoid possible failures due to conflicting settings.
4266 * Once effective, leaving isolated mode may not be possible depending on
4267 * PMD implementation.
4269 * Additionally, the following functionality has no effect on the underlying
4270 * port and may return errors such as ENOTSUP ("not supported"):
4272 * - Toggling promiscuous mode.
4273 * - Toggling allmulticast mode.
4274 * - Configuring MAC addresses.
4275 * - Configuring multicast addresses.
4276 * - Configuring VLAN filters.
4277 * - Configuring Rx filters through the legacy API (e.g. FDIR).
4278 * - Configuring global RSS settings.
4281 * Port identifier of Ethernet device.
4283 * Nonzero to enter isolated mode, attempt to leave it otherwise.
4285 * Perform verbose error reporting if not NULL. PMDs initialize this
4286 * structure in case of error only.
4289 * 0 on success, a negative errno value otherwise and rte_errno is set.
4292 rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
4295 * Initialize flow error structure.
4298 * Pointer to flow error structure (may be NULL).
4300 * Related error code (rte_errno).
4302 * Cause field and error types.
4304 * Object responsible for the error.
4306 * Human-readable error message.
4309 * Negative error code (errno value) and rte_errno is set.
4312 rte_flow_error_set(struct rte_flow_error *error,
4314 enum rte_flow_error_type type,
4316 const char *message);
4320 * @see rte_flow_copy()
4322 struct rte_flow_desc {
4323 size_t size; /**< Allocated space including data[]. */
4324 struct rte_flow_attr attr; /**< Attributes. */
4325 struct rte_flow_item *items; /**< Items. */
4326 struct rte_flow_action *actions; /**< Actions. */
4327 uint8_t data[]; /**< Storage for items/actions. */
4332 * Copy an rte_flow rule description.
4334 * This interface is kept for compatibility with older applications but is
4335 * implemented as a wrapper to rte_flow_conv(). It is deprecated due to its
4336 * lack of flexibility and reliance on a type unusable with C++ programs
4337 * (struct rte_flow_desc).
4340 * Flow rule description.
4342 * Total size of allocated data for the flow description.
4344 * Flow rule attributes.
4346 * Pattern specification (list terminated by the END pattern item).
4347 * @param[in] actions
4348 * Associated actions (list terminated by the END action).
4351 * If len is greater or equal to the size of the flow, the total size of the
4352 * flow description and its data.
4353 * If len is lower than the size of the flow, the number of bytes that would
4354 * have been written to desc had it been sufficient. Nothing is written.
4358 rte_flow_copy(struct rte_flow_desc *fd, size_t len,
4359 const struct rte_flow_attr *attr,
4360 const struct rte_flow_item *items,
4361 const struct rte_flow_action *actions);
4364 * Flow object conversion helper.
4366 * This function performs conversion of various flow API objects to a
4367 * pre-allocated destination buffer. See enum rte_flow_conv_op for possible
4368 * operations and details about each of them.
4370 * Since destination buffer must be large enough, it works in a manner
4371 * reminiscent of snprintf():
4373 * - If @p size is 0, @p dst may be a NULL pointer, otherwise @p dst must be
4375 * - If positive, the returned value represents the number of bytes needed
4376 * to store the conversion of @p src to @p dst according to @p op
4377 * regardless of the @p size parameter.
4378 * - Since no more than @p size bytes can be written to @p dst, output is
4379 * truncated and may be inconsistent when the returned value is larger
4381 * - In case of conversion error, a negative error code is returned and
4382 * @p dst contents are unspecified.
4385 * Operation to perform, related to the object type of @p dst.
4387 * Destination buffer address. Must be suitably aligned by the caller.
4389 * Destination buffer size in bytes.
4391 * Source object to copy. Depending on @p op, its type may differ from
4394 * Perform verbose error reporting if not NULL. Initialized in case of
4398 * The number of bytes required to convert @p src to @p dst on success, a
4399 * negative errno value otherwise and rte_errno is set.
4401 * @see rte_flow_conv_op
4405 rte_flow_conv(enum rte_flow_conv_op op,
4409 struct rte_flow_error *error);
4412 * Get aged-out flows of a given port.
4414 * RTE_ETH_EVENT_FLOW_AGED event will be triggered when at least one new aged
4415 * out flow was detected after the last call to rte_flow_get_aged_flows.
4416 * This function can be called to get the aged flows asynchronously from the
4417 * event callback or synchronously regardless the event.
4418 * This is not safe to call rte_flow_get_aged_flows function with other flow
4419 * functions from multiple threads simultaneously.
4422 * Port identifier of Ethernet device.
4423 * @param[in, out] contexts
4424 * The address of an array of pointers to the aged-out flows contexts.
4425 * @param[in] nb_contexts
4426 * The length of context array pointers.
4428 * Perform verbose error reporting if not NULL. Initialized in case of
4432 * if nb_contexts is 0, return the amount of all aged contexts.
4433 * if nb_contexts is not 0 , return the amount of aged flows reported
4434 * in the context array, otherwise negative errno value.
4436 * @see rte_flow_action_age
4437 * @see RTE_ETH_EVENT_FLOW_AGED
4441 rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
4442 uint32_t nb_contexts, struct rte_flow_error *error);
4445 * Specify indirect action object configuration
4447 struct rte_flow_indir_action_conf {
4449 * Flow direction for the indirect action configuration.
4451 * Action should be valid at least for one flow direction,
4452 * otherwise it is invalid for both ingress and egress rules.
4454 /** Action valid for rules applied to ingress traffic. */
4456 /** Action valid for rules applied to egress traffic. */
4459 * When set to 1, indicates that the action is valid for
4460 * transfer traffic; otherwise, for non-transfer traffic.
4462 uint32_t transfer:1;
4467 * @b EXPERIMENTAL: this API may change without prior notice.
4469 * Create an indirect action object that can be used in flow rules
4471 * The created object handle has single state and configuration
4472 * across all the flow rules using it.
4474 * @param[in] port_id
4475 * The port identifier of the Ethernet device.
4477 * Action configuration for the indirect action object creation.
4479 * Specific configuration of the indirect action object.
4481 * Perform verbose error reporting if not NULL. PMDs initialize this
4482 * structure in case of error only.
4484 * A valid handle in case of success, NULL otherwise and rte_errno is set
4485 * to one of the error codes defined:
4486 * - (ENODEV) if *port_id* invalid.
4487 * - (ENOSYS) if underlying device does not support this functionality.
4488 * - (EIO) if underlying device is removed.
4489 * - (EINVAL) if *action* invalid.
4490 * - (ENOTSUP) if *action* valid but unsupported.
4493 struct rte_flow_action_handle *
4494 rte_flow_action_handle_create(uint16_t port_id,
4495 const struct rte_flow_indir_action_conf *conf,
4496 const struct rte_flow_action *action,
4497 struct rte_flow_error *error);
4501 * @b EXPERIMENTAL: this API may change without prior notice.
4503 * Destroy indirect action by handle.
4505 * @param[in] port_id
4506 * The port identifier of the Ethernet device.
4508 * Handle for the indirect action object to be destroyed.
4510 * Perform verbose error reporting if not NULL. PMDs initialize this
4511 * structure in case of error only.
4514 * - (-ENODEV) if *port_id* invalid.
4515 * - (-ENOSYS) if underlying device does not support this functionality.
4516 * - (-EIO) if underlying device is removed.
4517 * - (-ENOENT) if action pointed by *action* handle was not found.
4518 * - (-EBUSY) if action pointed by *action* handle still used by some rules
4519 * rte_errno is also set.
4523 rte_flow_action_handle_destroy(uint16_t port_id,
4524 struct rte_flow_action_handle *handle,
4525 struct rte_flow_error *error);
4529 * @b EXPERIMENTAL: this API may change without prior notice.
4531 * Update in-place the action configuration and / or state pointed
4532 * by action *handle* with the configuration provided as *update* argument.
4533 * The update of the action configuration effects all flow rules reusing
4534 * the action via *handle*.
4535 * The update general pointer provides the ability of partial updating.
4537 * @param[in] port_id
4538 * The port identifier of the Ethernet device.
4540 * Handle for the indirect action object to be updated.
4542 * Update profile specification used to modify the action pointed by handle.
4543 * *update* could be with the same type of the immediate action corresponding
4544 * to the *handle* argument when creating, or a wrapper structure includes
4545 * action configuration to be updated and bit fields to indicate the member
4546 * of fields inside the action to update.
4548 * Perform verbose error reporting if not NULL. PMDs initialize this
4549 * structure in case of error only.
4552 * - (-ENODEV) if *port_id* invalid.
4553 * - (-ENOSYS) if underlying device does not support this functionality.
4554 * - (-EIO) if underlying device is removed.
4555 * - (-EINVAL) if *update* invalid.
4556 * - (-ENOTSUP) if *update* valid but unsupported.
4557 * - (-ENOENT) if indirect action object pointed by *handle* was not found.
4558 * rte_errno is also set.
4562 rte_flow_action_handle_update(uint16_t port_id,
4563 struct rte_flow_action_handle *handle,
4565 struct rte_flow_error *error);
4569 * @b EXPERIMENTAL: this API may change without prior notice.
4571 * Query the direct action by corresponding indirect action object handle.
4573 * Retrieve action-specific data such as counters.
4574 * Data is gathered by special action which may be present/referenced in
4575 * more than one flow rule definition.
4577 * @see RTE_FLOW_ACTION_TYPE_COUNT
4580 * Port identifier of Ethernet device.
4582 * Handle for the action object to query.
4583 * @param[in, out] data
4584 * Pointer to storage for the associated query data type.
4586 * Perform verbose error reporting if not NULL. PMDs initialize this
4587 * structure in case of error only.
4590 * 0 on success, a negative errno value otherwise and rte_errno is set.
4594 rte_flow_action_handle_query(uint16_t port_id,
4595 const struct rte_flow_action_handle *handle,
4596 void *data, struct rte_flow_error *error);
4598 /* Tunnel has a type and the key information. */
4599 struct rte_flow_tunnel {
4601 * Tunnel type, for example RTE_FLOW_ITEM_TYPE_VXLAN,
4602 * RTE_FLOW_ITEM_TYPE_NVGRE etc.
4604 enum rte_flow_item_type type;
4605 uint64_t tun_id; /**< Tunnel identification. */
4610 rte_be32_t src_addr; /**< IPv4 source address. */
4611 rte_be32_t dst_addr; /**< IPv4 destination address. */
4614 uint8_t src_addr[16]; /**< IPv6 source address. */
4615 uint8_t dst_addr[16]; /**< IPv6 destination address. */
4618 rte_be16_t tp_src; /**< Tunnel port source. */
4619 rte_be16_t tp_dst; /**< Tunnel port destination. */
4620 uint16_t tun_flags; /**< Tunnel flags. */
4622 bool is_ipv6; /**< True for valid IPv6 fields. Otherwise IPv4. */
4625 * the following members are required to restore packet
4628 uint8_t tos; /**< TOS for IPv4, TC for IPv6. */
4629 uint8_t ttl; /**< TTL for IPv4, HL for IPv6. */
4630 uint32_t label; /**< Flow Label for IPv6. */
4634 * Indicate that the packet has a tunnel.
4636 #define RTE_FLOW_RESTORE_INFO_TUNNEL RTE_BIT64(0)
4639 * Indicate that the packet has a non decapsulated tunnel header.
4641 #define RTE_FLOW_RESTORE_INFO_ENCAPSULATED RTE_BIT64(1)
4644 * Indicate that the packet has a group_id.
4646 #define RTE_FLOW_RESTORE_INFO_GROUP_ID RTE_BIT64(2)
4649 * Restore information structure to communicate the current packet processing
4650 * state when some of the processing pipeline is done in hardware and should
4651 * continue in software.
4653 struct rte_flow_restore_info {
4655 * Bitwise flags (RTE_FLOW_RESTORE_INFO_*) to indicate validation of
4656 * other fields in struct rte_flow_restore_info.
4659 uint32_t group_id; /**< Group ID where packed missed */
4660 struct rte_flow_tunnel tunnel; /**< Tunnel information. */
4664 * Allocate an array of actions to be used in rte_flow_create, to implement
4665 * tunnel-decap-set for the given tunnel.
4667 * actions vxlan_decap / tunnel-decap-set(tunnel properties) /
4668 * jump group 0 / end
4671 * Port identifier of Ethernet device.
4673 * Tunnel properties.
4674 * @param[out] actions
4675 * Array of actions to be allocated by the PMD. This array should be
4676 * concatenated with the actions array provided to rte_flow_create.
4677 * @param[out] num_of_actions
4678 * Number of actions allocated.
4680 * Perform verbose error reporting if not NULL. PMDs initialize this
4681 * structure in case of error only.
4684 * 0 on success, a negative errno value otherwise and rte_errno is set.
4688 rte_flow_tunnel_decap_set(uint16_t port_id,
4689 struct rte_flow_tunnel *tunnel,
4690 struct rte_flow_action **actions,
4691 uint32_t *num_of_actions,
4692 struct rte_flow_error *error);
4695 * Allocate an array of items to be used in rte_flow_create, to implement
4696 * tunnel-match for the given tunnel.
4698 * pattern tunnel-match(tunnel properties) / outer-header-matches /
4699 * inner-header-matches / end
4702 * Port identifier of Ethernet device.
4704 * Tunnel properties.
4706 * Array of items to be allocated by the PMD. This array should be
4707 * concatenated with the items array provided to rte_flow_create.
4708 * @param[out] num_of_items
4709 * Number of items allocated.
4711 * Perform verbose error reporting if not NULL. PMDs initialize this
4712 * structure in case of error only.
4715 * 0 on success, a negative errno value otherwise and rte_errno is set.
4719 rte_flow_tunnel_match(uint16_t port_id,
4720 struct rte_flow_tunnel *tunnel,
4721 struct rte_flow_item **items,
4722 uint32_t *num_of_items,
4723 struct rte_flow_error *error);
4726 * Populate the current packet processing state, if exists, for the given mbuf.
4728 * One should negotiate tunnel metadata delivery from the NIC to the HW.
4729 * @see rte_eth_rx_metadata_negotiate()
4730 * @see RTE_ETH_RX_METADATA_TUNNEL_ID
4733 * Port identifier of Ethernet device.
4737 * Restore information. Upon success contains the HW state.
4739 * Perform verbose error reporting if not NULL. PMDs initialize this
4740 * structure in case of error only.
4743 * 0 on success, a negative errno value otherwise and rte_errno is set.
4747 rte_flow_get_restore_info(uint16_t port_id,
4749 struct rte_flow_restore_info *info,
4750 struct rte_flow_error *error);
4753 * Release the action array as allocated by rte_flow_tunnel_decap_set.
4756 * Port identifier of Ethernet device.
4757 * @param[in] actions
4758 * Array of actions to be released.
4759 * @param[in] num_of_actions
4760 * Number of elements in actions array.
4762 * Perform verbose error reporting if not NULL. PMDs initialize this
4763 * structure in case of error only.
4766 * 0 on success, a negative errno value otherwise and rte_errno is set.
4770 rte_flow_tunnel_action_decap_release(uint16_t port_id,
4771 struct rte_flow_action *actions,
4772 uint32_t num_of_actions,
4773 struct rte_flow_error *error);
4776 * Release the item array as allocated by rte_flow_tunnel_match.
4779 * Port identifier of Ethernet device.
4781 * Array of items to be released.
4782 * @param[in] num_of_items
4783 * Number of elements in item array.
4785 * Perform verbose error reporting if not NULL. PMDs initialize this
4786 * structure in case of error only.
4789 * 0 on success, a negative errno value otherwise and rte_errno is set.
4793 rte_flow_tunnel_item_release(uint16_t port_id,
4794 struct rte_flow_item *items,
4795 uint32_t num_of_items,
4796 struct rte_flow_error *error);
4800 * @b EXPERIMENTAL: this API may change without prior notice.
4802 * Get a proxy port to manage "transfer" flows.
4804 * Managing "transfer" flows requires that the user communicate them
4805 * via a port which has the privilege to control the embedded switch.
4806 * For some vendors, all ports in a given switching domain have
4807 * this privilege. For other vendors, it's only one port.
4809 * This API indicates such a privileged port (a "proxy")
4810 * for a given port in the same switching domain.
4813 * If the PMD serving @p port_id doesn't have the corresponding method
4814 * implemented, the API will return @p port_id via @p proxy_port_id.
4817 * Indicates the port to get a "proxy" for
4818 * @param[out] proxy_port_id
4819 * Indicates the "proxy" port
4821 * If not NULL, allows the PMD to provide verbose report in case of error
4824 * 0 on success, a negative error code otherwise
4828 rte_flow_pick_transfer_proxy(uint16_t port_id, uint16_t *proxy_port_id,
4829 struct rte_flow_error *error);
4833 * @b EXPERIMENTAL: this API may change without prior notice.
4835 * Create the flex item with specified configuration over
4836 * the Ethernet device.
4839 * Port identifier of Ethernet device.
4841 * Item configuration.
4843 * Perform verbose error reporting if not NULL. PMDs initialize this
4844 * structure in case of error only.
4847 * Non-NULL opaque pointer on success, NULL otherwise and rte_errno is set.
4850 struct rte_flow_item_flex_handle *
4851 rte_flow_flex_item_create(uint16_t port_id,
4852 const struct rte_flow_item_flex_conf *conf,
4853 struct rte_flow_error *error);
4856 * Release the flex item on the specified Ethernet device.
4859 * Port identifier of Ethernet device.
4861 * Handle of the item existing on the specified device.
4863 * Perform verbose error reporting if not NULL. PMDs initialize this
4864 * structure in case of error only.
4867 * 0 on success, a negative errno value otherwise and rte_errno is set.
4871 rte_flow_flex_item_release(uint16_t port_id,
4872 const struct rte_flow_item_flex_handle *handle,
4873 struct rte_flow_error *error);
4879 #endif /* RTE_FLOW_H_ */