DPDK  20.05.0
Data Structures | Enumerations | Functions | Variables
rte_flow.h File Reference
#include <stddef.h>
#include <stdint.h>
#include <rte_arp.h>
#include <rte_common.h>
#include <rte_ether.h>
#include <rte_icmp.h>
#include <rte_ip.h>
#include <rte_sctp.h>
#include <rte_tcp.h>
#include <rte_udp.h>
#include <rte_byteorder.h>
#include <rte_esp.h>
#include <rte_higig.h>
#include <rte_mbuf.h>
#include <rte_mbuf_dyn.h>

Go to the source code of this file.

Data Structures

struct  rte_flow_attr
 
struct  rte_flow_item_higig2_hdr
 
struct  rte_flow_item_any
 
struct  rte_flow_item_vf
 
struct  rte_flow_item_phy_port
 
struct  rte_flow_item_port_id
 
struct  rte_flow_item_raw
 
struct  rte_flow_item_eth
 
struct  rte_flow_item_vlan
 
struct  rte_flow_item_ipv4
 
struct  rte_flow_item_ipv6
 
struct  rte_flow_item_icmp
 
struct  rte_flow_item_udp
 
struct  rte_flow_item_tcp
 
struct  rte_flow_item_sctp
 
struct  rte_flow_item_vxlan
 
struct  rte_flow_item_e_tag
 
struct  rte_flow_item_nvgre
 
struct  rte_flow_item_mpls
 
struct  rte_flow_item_gre
 
struct  rte_flow_item_fuzzy
 
struct  rte_flow_item_gtp
 
struct  rte_flow_item_esp
 
struct  rte_flow_item_geneve
 
struct  rte_flow_item_vxlan_gpe
 
struct  rte_flow_item_arp_eth_ipv4
 
struct  rte_flow_item_ipv6_ext
 
struct  rte_flow_item_icmp6
 
struct  rte_flow_item_icmp6_nd_ns
 
struct  rte_flow_item_icmp6_nd_na
 
struct  rte_flow_item_icmp6_nd_opt
 
struct  rte_flow_item_icmp6_nd_opt_sla_eth
 
struct  rte_flow_item_icmp6_nd_opt_tla_eth
 
struct  rte_flow_item_meta
 
struct  rte_flow_item_gtp_psc
 
struct  rte_flow_item_pppoe
 
struct  rte_flow_item_pppoe_proto_id
 
struct  rte_flow_item_tag
 
struct  rte_flow_item_l2tpv3oip
 
struct  rte_flow_item_mark
 
struct  rte_flow_item_nsh
 
struct  rte_flow_item_igmp
 
struct  rte_flow_item_ah
 
struct  rte_flow_item_pfcp
 
struct  rte_flow_item
 
struct  rte_flow_action_mark
 
struct  rte_flow_action_jump
 
struct  rte_flow_action_queue
 
struct  rte_flow_action_age
 
struct  rte_flow_action_count
 
struct  rte_flow_query_count
 
struct  rte_flow_action_rss
 
struct  rte_flow_action_vf
 
struct  rte_flow_action_phy_port
 
struct  rte_flow_action_port_id
 
struct  rte_flow_action_meter
 
struct  rte_flow_action_security
 
struct  rte_flow_action_of_set_mpls_ttl
 
struct  rte_flow_action_of_set_nw_ttl
 
struct  rte_flow_action_of_push_vlan
 
struct  rte_flow_action_of_set_vlan_vid
 
struct  rte_flow_action_of_set_vlan_pcp
 
struct  rte_flow_action_of_pop_mpls
 
struct  rte_flow_action_of_push_mpls
 
struct  rte_flow_action_vxlan_encap
 
struct  rte_flow_action_nvgre_encap
 
struct  rte_flow_action_raw_encap
 
struct  rte_flow_action_raw_decap
 
struct  rte_flow_action_set_ipv4
 
struct  rte_flow_action_set_ipv6
 
struct  rte_flow_action_set_tp
 
struct  rte_flow_action_set_ttl
 
struct  rte_flow_action_set_mac
 
struct  rte_flow_action_set_tag
 
struct  rte_flow_action_set_meta
 
struct  rte_flow_action_set_dscp
 
struct  rte_flow_error
 
struct  rte_flow_conv_rule
 
struct  rte_flow_desc
 

Enumerations

enum  rte_flow_item_type {
  RTE_FLOW_ITEM_TYPE_END, RTE_FLOW_ITEM_TYPE_VOID, RTE_FLOW_ITEM_TYPE_INVERT, RTE_FLOW_ITEM_TYPE_ANY,
  RTE_FLOW_ITEM_TYPE_PF, RTE_FLOW_ITEM_TYPE_VF, RTE_FLOW_ITEM_TYPE_PHY_PORT, RTE_FLOW_ITEM_TYPE_PORT_ID,
  RTE_FLOW_ITEM_TYPE_RAW, RTE_FLOW_ITEM_TYPE_ETH, RTE_FLOW_ITEM_TYPE_VLAN, RTE_FLOW_ITEM_TYPE_IPV4,
  RTE_FLOW_ITEM_TYPE_IPV6, RTE_FLOW_ITEM_TYPE_ICMP, RTE_FLOW_ITEM_TYPE_UDP, RTE_FLOW_ITEM_TYPE_TCP,
  RTE_FLOW_ITEM_TYPE_SCTP, RTE_FLOW_ITEM_TYPE_VXLAN, RTE_FLOW_ITEM_TYPE_E_TAG, RTE_FLOW_ITEM_TYPE_NVGRE,
  RTE_FLOW_ITEM_TYPE_MPLS, RTE_FLOW_ITEM_TYPE_GRE, RTE_FLOW_ITEM_TYPE_FUZZY, RTE_FLOW_ITEM_TYPE_GTP,
  RTE_FLOW_ITEM_TYPE_GTPC, RTE_FLOW_ITEM_TYPE_GTPU, RTE_FLOW_ITEM_TYPE_ESP, RTE_FLOW_ITEM_TYPE_GENEVE,
  RTE_FLOW_ITEM_TYPE_VXLAN_GPE, RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4, RTE_FLOW_ITEM_TYPE_IPV6_EXT, RTE_FLOW_ITEM_TYPE_ICMP6,
  RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS, RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA, RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT, RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH,
  RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH, RTE_FLOW_ITEM_TYPE_MARK, RTE_FLOW_ITEM_TYPE_META, RTE_FLOW_ITEM_TYPE_GRE_KEY,
  RTE_FLOW_ITEM_TYPE_GTP_PSC, RTE_FLOW_ITEM_TYPE_PPPOES, RTE_FLOW_ITEM_TYPE_PPPOED, RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID,
  RTE_FLOW_ITEM_TYPE_NSH, RTE_FLOW_ITEM_TYPE_IGMP, RTE_FLOW_ITEM_TYPE_AH, RTE_FLOW_ITEM_TYPE_HIGIG2,
  RTE_FLOW_ITEM_TYPE_TAG, RTE_FLOW_ITEM_TYPE_L2TPV3OIP, RTE_FLOW_ITEM_TYPE_PFCP
}
 
enum  rte_flow_action_type {
  RTE_FLOW_ACTION_TYPE_END, RTE_FLOW_ACTION_TYPE_VOID, RTE_FLOW_ACTION_TYPE_PASSTHRU, RTE_FLOW_ACTION_TYPE_JUMP,
  RTE_FLOW_ACTION_TYPE_MARK, RTE_FLOW_ACTION_TYPE_FLAG, RTE_FLOW_ACTION_TYPE_QUEUE, RTE_FLOW_ACTION_TYPE_DROP,
  RTE_FLOW_ACTION_TYPE_COUNT, RTE_FLOW_ACTION_TYPE_RSS, RTE_FLOW_ACTION_TYPE_PF, RTE_FLOW_ACTION_TYPE_VF,
  RTE_FLOW_ACTION_TYPE_PHY_PORT, RTE_FLOW_ACTION_TYPE_PORT_ID, RTE_FLOW_ACTION_TYPE_METER, RTE_FLOW_ACTION_TYPE_SECURITY,
  RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL, RTE_FLOW_ACTION_TYPE_OF_DEC_MPLS_TTL, RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL, RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL,
  RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_OUT, RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_IN, RTE_FLOW_ACTION_TYPE_OF_POP_VLAN, RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN,
  RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP, RTE_FLOW_ACTION_TYPE_OF_POP_MPLS, RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS,
  RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP, RTE_FLOW_ACTION_TYPE_VXLAN_DECAP, RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP, RTE_FLOW_ACTION_TYPE_NVGRE_DECAP,
  RTE_FLOW_ACTION_TYPE_RAW_ENCAP, RTE_FLOW_ACTION_TYPE_RAW_DECAP, RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC, RTE_FLOW_ACTION_TYPE_SET_IPV4_DST,
  RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC, RTE_FLOW_ACTION_TYPE_SET_IPV6_DST, RTE_FLOW_ACTION_TYPE_SET_TP_SRC, RTE_FLOW_ACTION_TYPE_SET_TP_DST,
  RTE_FLOW_ACTION_TYPE_MAC_SWAP, RTE_FLOW_ACTION_TYPE_DEC_TTL, RTE_FLOW_ACTION_TYPE_SET_TTL, RTE_FLOW_ACTION_TYPE_SET_MAC_SRC,
  RTE_FLOW_ACTION_TYPE_SET_MAC_DST, RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ, RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ, RTE_FLOW_ACTION_TYPE_INC_TCP_ACK,
  RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK, RTE_FLOW_ACTION_TYPE_SET_TAG, RTE_FLOW_ACTION_TYPE_SET_META, RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP,
  RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP, RTE_FLOW_ACTION_TYPE_AGE
}
 
enum  rte_eth_hash_function { , RTE_ETH_HASH_FUNCTION_TOEPLITZ, RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ }
 
enum  rte_flow_error_type {
  RTE_FLOW_ERROR_TYPE_NONE, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, RTE_FLOW_ERROR_TYPE_HANDLE, RTE_FLOW_ERROR_TYPE_ATTR_GROUP,
  RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER,
  RTE_FLOW_ERROR_TYPE_ATTR, RTE_FLOW_ERROR_TYPE_ITEM_NUM, RTE_FLOW_ERROR_TYPE_ITEM_SPEC, RTE_FLOW_ERROR_TYPE_ITEM_LAST,
  RTE_FLOW_ERROR_TYPE_ITEM_MASK, RTE_FLOW_ERROR_TYPE_ITEM, RTE_FLOW_ERROR_TYPE_ACTION_NUM, RTE_FLOW_ERROR_TYPE_ACTION_CONF,
  RTE_FLOW_ERROR_TYPE_ACTION
}
 
enum  rte_flow_conv_op {
  RTE_FLOW_CONV_OP_NONE, RTE_FLOW_CONV_OP_ATTR, RTE_FLOW_CONV_OP_ITEM, RTE_FLOW_CONV_OP_ACTION,
  RTE_FLOW_CONV_OP_PATTERN, RTE_FLOW_CONV_OP_ACTIONS, RTE_FLOW_CONV_OP_RULE, RTE_FLOW_CONV_OP_ITEM_NAME,
  RTE_FLOW_CONV_OP_ACTION_NAME, RTE_FLOW_CONV_OP_ITEM_NAME_PTR, RTE_FLOW_CONV_OP_ACTION_NAME_PTR
}
 

Functions

__rte_experimental int rte_flow_dev_dump (uint16_t port_id, FILE *file, struct rte_flow_error *error)
 
static __rte_experimental int rte_flow_dynf_metadata_avail (void)
 
__rte_experimental int rte_flow_dynf_metadata_register (void)
 
int rte_flow_validate (uint16_t port_id, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error)
 
struct rte_flow * rte_flow_create (uint16_t port_id, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error)
 
int rte_flow_destroy (uint16_t port_id, struct rte_flow *flow, struct rte_flow_error *error)
 
int rte_flow_flush (uint16_t port_id, struct rte_flow_error *error)
 
int rte_flow_query (uint16_t port_id, struct rte_flow *flow, const struct rte_flow_action *action, void *data, struct rte_flow_error *error)
 
int rte_flow_isolate (uint16_t port_id, int set, struct rte_flow_error *error)
 
int rte_flow_error_set (struct rte_flow_error *error, int code, enum rte_flow_error_type type, const void *cause, const char *message)
 
__rte_deprecated size_t rte_flow_copy (struct rte_flow_desc *fd, size_t len, const struct rte_flow_attr *attr, const struct rte_flow_item *items, const struct rte_flow_action *actions)
 
__rte_experimental int rte_flow_conv (enum rte_flow_conv_op op, void *dst, size_t size, const void *src, struct rte_flow_error *error)
 
__rte_experimental int rte_flow_get_aged_flows (uint16_t port_id, void **contexts, uint32_t nb_contexts, struct rte_flow_error *error)
 

Variables

static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask
 
static const struct rte_flow_item_any rte_flow_item_any_mask
 
static const struct rte_flow_item_vf rte_flow_item_vf_mask
 
static const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask
 
static const struct rte_flow_item_port_id rte_flow_item_port_id_mask
 
static const struct rte_flow_item_raw rte_flow_item_raw_mask
 
static const struct rte_flow_item_eth rte_flow_item_eth_mask
 
static const struct rte_flow_item_vlan rte_flow_item_vlan_mask
 
static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask
 
static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask
 
static const struct rte_flow_item_icmp rte_flow_item_icmp_mask
 
static const struct rte_flow_item_udp rte_flow_item_udp_mask
 
static const struct rte_flow_item_tcp rte_flow_item_tcp_mask
 
static const struct rte_flow_item_sctp rte_flow_item_sctp_mask
 
static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask
 
static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask
 
static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask
 
static const struct rte_flow_item_mpls rte_flow_item_mpls_mask
 
static const struct rte_flow_item_gre rte_flow_item_gre_mask
 
static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask
 
static const struct rte_flow_item_gtp rte_flow_item_gtp_mask
 
static const struct rte_flow_item_esp rte_flow_item_esp_mask
 
static const struct rte_flow_item_geneve rte_flow_item_geneve_mask
 
static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask
 
static const struct rte_flow_item_arp_eth_ipv4 rte_flow_item_arp_eth_ipv4_mask
 
static const struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask
 
static const struct rte_flow_item_icmp6 rte_flow_item_icmp6_mask
 
static const struct rte_flow_item_icmp6_nd_ns rte_flow_item_icmp6_nd_ns_mask
 
static const struct rte_flow_item_icmp6_nd_na rte_flow_item_icmp6_nd_na_mask
 
static const struct rte_flow_item_icmp6_nd_opt rte_flow_item_icmp6_nd_opt_mask
 
static const struct rte_flow_item_icmp6_nd_opt_sla_eth rte_flow_item_icmp6_nd_opt_sla_eth_mask
 
static const struct rte_flow_item_icmp6_nd_opt_tla_eth rte_flow_item_icmp6_nd_opt_tla_eth_mask
 
static const struct rte_flow_item_meta rte_flow_item_meta_mask
 
static const struct rte_flow_item_gtp_psc rte_flow_item_gtp_psc_mask
 
static const struct rte_flow_item_pppoe_proto_id rte_flow_item_pppoe_proto_id_mask
 
static const struct rte_flow_item_tag rte_flow_item_tag_mask
 
static const struct rte_flow_item_l2tpv3oip rte_flow_item_l2tpv3oip_mask
 
static const struct rte_flow_item_mark rte_flow_item_mark_mask
 
static const struct rte_flow_item_nsh rte_flow_item_nsh_mask
 
static const struct rte_flow_item_igmp rte_flow_item_igmp_mask
 
static const struct rte_flow_item_ah rte_flow_item_ah_mask
 
static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask
 

Detailed Description

RTE generic flow API

This interface provides the ability to program packet matching and associated actions in hardware through flow rules.

Definition in file rte_flow.h.

Enumeration Type Documentation

Matching pattern item types.

Pattern items fall in two categories:

  • Matching protocol headers and packet data, usually associated with a specification structure. These must be stacked in the same order as the protocol layers to match inside packets, starting from the lowest.
  • Matching meta-data or affecting pattern processing, often without a specification structure. Since they do not match packet contents, their position in the list is usually not relevant.

See the description of individual types for more information. Those marked with [META] fall into the second category.

Enumerator
RTE_FLOW_ITEM_TYPE_END 

[META]

End marker for item lists. Prevents further processing of items, thereby ending the pattern.

No associated specification structure.

RTE_FLOW_ITEM_TYPE_VOID 

[META]

Used as a placeholder for convenience. It is ignored and simply discarded by PMDs.

No associated specification structure.

RTE_FLOW_ITEM_TYPE_INVERT 

[META]

Inverted matching, i.e. process packets that do not match the pattern.

No associated specification structure.

RTE_FLOW_ITEM_TYPE_ANY 

Matches any protocol in place of the current layer, a single ANY may also stand for several protocol layers.

See struct rte_flow_item_any.

RTE_FLOW_ITEM_TYPE_PF 

[META]

Matches traffic originating from (ingress) or going to (egress) the physical function of the current device.

No associated specification structure.

RTE_FLOW_ITEM_TYPE_VF 

[META]

Matches traffic originating from (ingress) or going to (egress) a given virtual function of the current device.

See struct rte_flow_item_vf.

RTE_FLOW_ITEM_TYPE_PHY_PORT 

[META]

Matches traffic originating from (ingress) or going to (egress) a physical port of the underlying device.

See struct rte_flow_item_phy_port.

RTE_FLOW_ITEM_TYPE_PORT_ID 

[META]

Matches traffic originating from (ingress) or going to (egress) a given DPDK port ID.

See struct rte_flow_item_port_id.

RTE_FLOW_ITEM_TYPE_RAW 

Matches a byte string of a given length at a given offset.

See struct rte_flow_item_raw.

RTE_FLOW_ITEM_TYPE_ETH 

Matches an Ethernet header.

See struct rte_flow_item_eth.

RTE_FLOW_ITEM_TYPE_VLAN 

Matches an 802.1Q/ad VLAN tag.

See struct rte_flow_item_vlan.

RTE_FLOW_ITEM_TYPE_IPV4 

Matches an IPv4 header.

See struct rte_flow_item_ipv4.

RTE_FLOW_ITEM_TYPE_IPV6 

Matches an IPv6 header.

See struct rte_flow_item_ipv6.

RTE_FLOW_ITEM_TYPE_ICMP 

Matches an ICMP header.

See struct rte_flow_item_icmp.

RTE_FLOW_ITEM_TYPE_UDP 

Matches a UDP header.

See struct rte_flow_item_udp.

RTE_FLOW_ITEM_TYPE_TCP 

Matches a TCP header.

See struct rte_flow_item_tcp.

RTE_FLOW_ITEM_TYPE_SCTP 

Matches a SCTP header.

See struct rte_flow_item_sctp.

RTE_FLOW_ITEM_TYPE_VXLAN 

Matches a VXLAN header.

See struct rte_flow_item_vxlan.

RTE_FLOW_ITEM_TYPE_E_TAG 

Matches a E_TAG header.

See struct rte_flow_item_e_tag.

RTE_FLOW_ITEM_TYPE_NVGRE 

Matches a NVGRE header.

See struct rte_flow_item_nvgre.

RTE_FLOW_ITEM_TYPE_MPLS 

Matches a MPLS header.

See struct rte_flow_item_mpls.

RTE_FLOW_ITEM_TYPE_GRE 

Matches a GRE header.

See struct rte_flow_item_gre.

RTE_FLOW_ITEM_TYPE_FUZZY 

[META]

Fuzzy pattern match, expect faster than default.

This is for device that support fuzzy matching option. Usually a fuzzy matching is fast but the cost is accuracy.

See struct rte_flow_item_fuzzy.

RTE_FLOW_ITEM_TYPE_GTP 

Matches a GTP header.

Configure flow for GTP packets.

See struct rte_flow_item_gtp.

RTE_FLOW_ITEM_TYPE_GTPC 

Matches a GTP header.

Configure flow for GTP-C packets.

See struct rte_flow_item_gtp.

RTE_FLOW_ITEM_TYPE_GTPU 

Matches a GTP header.

Configure flow for GTP-U packets.

See struct rte_flow_item_gtp.

RTE_FLOW_ITEM_TYPE_ESP 

Matches a ESP header.

See struct rte_flow_item_esp.

RTE_FLOW_ITEM_TYPE_GENEVE 

Matches a GENEVE header.

See struct rte_flow_item_geneve.

RTE_FLOW_ITEM_TYPE_VXLAN_GPE 

Matches a VXLAN-GPE header.

See struct rte_flow_item_vxlan_gpe.

RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4 

Matches an ARP header for Ethernet/IPv4.

See struct rte_flow_item_arp_eth_ipv4.

RTE_FLOW_ITEM_TYPE_IPV6_EXT 

Matches the presence of any IPv6 extension header.

See struct rte_flow_item_ipv6_ext.

RTE_FLOW_ITEM_TYPE_ICMP6 

Matches any ICMPv6 header.

See struct rte_flow_item_icmp6.

RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS 

Matches an ICMPv6 neighbor discovery solicitation.

See struct rte_flow_item_icmp6_nd_ns.

RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA 

Matches an ICMPv6 neighbor discovery advertisement.

See struct rte_flow_item_icmp6_nd_na.

RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT 

Matches the presence of any ICMPv6 neighbor discovery option.

See struct rte_flow_item_icmp6_nd_opt.

RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH 

Matches an ICMPv6 neighbor discovery source Ethernet link-layer address option.

See struct rte_flow_item_icmp6_nd_opt_sla_eth.

RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH 

Matches an ICMPv6 neighbor discovery target Ethernet link-layer address option.

See struct rte_flow_item_icmp6_nd_opt_tla_eth.

RTE_FLOW_ITEM_TYPE_MARK 

Matches specified mark field.

See struct rte_flow_item_mark.

RTE_FLOW_ITEM_TYPE_META 

[META]

Matches a metadata value.

See struct rte_flow_item_meta.

RTE_FLOW_ITEM_TYPE_GRE_KEY 

Matches a GRE optional key field.

The value should a big-endian 32bit integer.

When this item present the K bit is implicitly matched as "1" in the default mask.

spec/mask type:

1 rte_be32_t *
RTE_FLOW_ITEM_TYPE_GTP_PSC 

Matches a GTP extension header: PDU session container.

Configure flow for GTP packets with extension header type 0x85.

See struct rte_flow_item_gtp_psc.

RTE_FLOW_ITEM_TYPE_PPPOES 

Matches a PPPoE header.

Configure flow for PPPoE session packets.

See struct rte_flow_item_pppoe.

RTE_FLOW_ITEM_TYPE_PPPOED 

Matches a PPPoE header.

Configure flow for PPPoE discovery packets.

See struct rte_flow_item_pppoe.

RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID 

Matches a PPPoE optional proto_id field.

It only applies to PPPoE session packets.

See struct rte_flow_item_pppoe_proto_id.

RTE_FLOW_ITEM_TYPE_NSH 

Matches Network service header (NSH). See struct rte_flow_item_nsh.

RTE_FLOW_ITEM_TYPE_IGMP 

Matches Internet Group Management Protocol (IGMP). See struct rte_flow_item_igmp.

RTE_FLOW_ITEM_TYPE_AH 

Matches IP Authentication Header (AH). See struct rte_flow_item_ah.

RTE_FLOW_ITEM_TYPE_HIGIG2 

Matches a HIGIG header. see struct rte_flow_item_higig2_hdr.

RTE_FLOW_ITEM_TYPE_TAG 

[META]

Matches a tag value.

See struct rte_flow_item_tag.

RTE_FLOW_ITEM_TYPE_L2TPV3OIP 

Matches a L2TPv3 over IP header.

Configure flow for L2TPv3 over IP packets.

See struct rte_flow_item_l2tpv3oip.

RTE_FLOW_ITEM_TYPE_PFCP 

Matches PFCP Header. See struct rte_flow_item_pfcp.

Definition at line 118 of file rte_flow.h.

Action types.

Each possible action is represented by a type. An action can have an associated configuration object. Several actions combined in a list can be assigned to a flow rule and are performed in order.

They fall in three categories:

  • Actions that modify the fate of matching traffic, for instance by dropping or assigning it a specific destination.
  • Actions that modify matching traffic contents or its properties. This includes adding/removing encapsulation, encryption, compression and marks.
  • Actions related to the flow rule itself, such as updating counters or making it non-terminating.

Flow rules being terminating by default, not specifying any action of the fate kind results in undefined behavior. This applies to both ingress and egress.

PASSTHRU, when supported, makes a flow rule non-terminating.

Enumerator
RTE_FLOW_ACTION_TYPE_END 

End marker for action lists. Prevents further processing of actions, thereby ending the list.

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_VOID 

Used as a placeholder for convenience. It is ignored and simply discarded by PMDs.

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_PASSTHRU 

Leaves traffic up for additional processing by subsequent flow rules; makes a flow rule non-terminating.

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_JUMP 

RTE_FLOW_ACTION_TYPE_JUMP

Redirects packets to a group on the current device.

See struct rte_flow_action_jump.

RTE_FLOW_ACTION_TYPE_MARK 

Attaches an integer value to packets and sets PKT_RX_FDIR and PKT_RX_FDIR_ID mbuf flags.

See struct rte_flow_action_mark.

RTE_FLOW_ACTION_TYPE_FLAG 

Flags packets. Similar to MARK without a specific value; only sets the PKT_RX_FDIR mbuf flag.

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_QUEUE 

Assigns packets to a given queue index.

See struct rte_flow_action_queue.

RTE_FLOW_ACTION_TYPE_DROP 

Drops packets.

PASSTHRU overrides this action if both are specified.

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_COUNT 

Enables counters for this flow rule.

These counters can be retrieved and reset through rte_flow_query(), see struct rte_flow_query_count.

See struct rte_flow_action_count.

RTE_FLOW_ACTION_TYPE_RSS 

Similar to QUEUE, except RSS is additionally performed on packets to spread them among several queues according to the provided parameters.

See struct rte_flow_action_rss.

RTE_FLOW_ACTION_TYPE_PF 

Directs matching traffic to the physical function (PF) of the current device.

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_VF 

Directs matching traffic to a given virtual function of the current device.

See struct rte_flow_action_vf.

RTE_FLOW_ACTION_TYPE_PHY_PORT 

Directs packets to a given physical port index of the underlying device.

See struct rte_flow_action_phy_port.

RTE_FLOW_ACTION_TYPE_PORT_ID 

Directs matching traffic to a given DPDK port ID.

See struct rte_flow_action_port_id.

RTE_FLOW_ACTION_TYPE_METER 

Traffic metering and policing (MTR).

See struct rte_flow_action_meter. See file rte_mtr.h for MTR object configuration.

RTE_FLOW_ACTION_TYPE_SECURITY 

Redirects packets to security engine of current device for security processing as specified by security session.

See struct rte_flow_action_security.

RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL 

Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the OpenFlow Switch Specification.

See struct rte_flow_action_of_set_mpls_ttl.

RTE_FLOW_ACTION_TYPE_OF_DEC_MPLS_TTL 

Implements OFPAT_DEC_MPLS_TTL ("decrement MPLS TTL") as defined by the OpenFlow Switch Specification.

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL 

Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow Switch Specification.

See struct rte_flow_action_of_set_nw_ttl.

RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL 

Implements OFPAT_DEC_NW_TTL ("decrement IP TTL") as defined by the OpenFlow Switch Specification.

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_OUT 

Implements OFPAT_COPY_TTL_OUT ("copy TTL "outwards" -- from next-to-outermost to outermost") as defined by the OpenFlow Switch Specification.

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_IN 

Implements OFPAT_COPY_TTL_IN ("copy TTL "inwards" -- from outermost to next-to-outermost") as defined by the OpenFlow Switch Specification.

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_OF_POP_VLAN 

Implements OFPAT_POP_VLAN ("pop the outer VLAN tag") as defined by the OpenFlow Switch Specification.

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN 

Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by the OpenFlow Switch Specification.

See struct rte_flow_action_of_push_vlan.

RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID 

Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN id") as defined by the OpenFlow Switch Specification.

See struct rte_flow_action_of_set_vlan_vid.

RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP 

Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as defined by the OpenFlow Switch Specification.

See struct rte_flow_action_of_set_vlan_pcp.

RTE_FLOW_ACTION_TYPE_OF_POP_MPLS 

Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined by the OpenFlow Switch Specification.

See struct rte_flow_action_of_pop_mpls.

RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS 

Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by the OpenFlow Switch Specification.

See struct rte_flow_action_of_push_mpls.

RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP 

Encapsulate flow in VXLAN tunnel as defined in rte_flow_action_vxlan_encap action structure.

See struct rte_flow_action_vxlan_encap.

RTE_FLOW_ACTION_TYPE_VXLAN_DECAP 

Decapsulate outer most VXLAN tunnel from matched flow.

If flow pattern does not define a valid VXLAN tunnel (as specified by RFC7348) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP 

Encapsulate flow in NVGRE tunnel defined in the rte_flow_action_nvgre_encap action structure.

See struct rte_flow_action_nvgre_encap.

RTE_FLOW_ACTION_TYPE_NVGRE_DECAP 

Decapsulate outer most NVGRE tunnel from matched flow.

If flow pattern does not define a valid NVGRE tunnel (as specified by RFC7637) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

RTE_FLOW_ACTION_TYPE_RAW_ENCAP 

Add outer header whose template is provided in its data buffer

See struct rte_flow_action_raw_encap.

RTE_FLOW_ACTION_TYPE_RAW_DECAP 

Remove outer header whose template is provided in its data buffer.

See struct rte_flow_action_raw_decap

RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC 

Modify IPv4 source address in the outermost IPv4 header.

If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4, then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

See struct rte_flow_action_set_ipv4.

RTE_FLOW_ACTION_TYPE_SET_IPV4_DST 

Modify IPv4 destination address in the outermost IPv4 header.

If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4, then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

See struct rte_flow_action_set_ipv4.

RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC 

Modify IPv6 source address in the outermost IPv6 header.

If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6, then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

See struct rte_flow_action_set_ipv6.

RTE_FLOW_ACTION_TYPE_SET_IPV6_DST 

Modify IPv6 destination address in the outermost IPv6 header.

If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6, then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

See struct rte_flow_action_set_ipv6.

RTE_FLOW_ACTION_TYPE_SET_TP_SRC 

Modify source port number in the outermost TCP/UDP header.

If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

See struct rte_flow_action_set_tp.

RTE_FLOW_ACTION_TYPE_SET_TP_DST 

Modify destination port number in the outermost TCP/UDP header.

If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

See struct rte_flow_action_set_tp.

RTE_FLOW_ACTION_TYPE_MAC_SWAP 

Swap the source and destination MAC addresses in the outermost Ethernet header.

If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH, then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_DEC_TTL 

Decrease TTL value directly

No associated configuration structure.

RTE_FLOW_ACTION_TYPE_SET_TTL 

Set TTL value

See struct rte_flow_action_set_ttl

RTE_FLOW_ACTION_TYPE_SET_MAC_SRC 

Set source MAC address from matched flow.

If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH, the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

See struct rte_flow_action_set_mac.

RTE_FLOW_ACTION_TYPE_SET_MAC_DST 

Set destination MAC address from matched flow.

If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH, the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

See struct rte_flow_action_set_mac.

RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ 

Increase sequence number in the outermost TCP header.

Action configuration specifies the value to increase TCP sequence number as a big-endian 32 bit integer.

conf type:

1 rte_be32_t *

Using this action on non-matching traffic will result in undefined behavior.

RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ 

Decrease sequence number in the outermost TCP header.

Action configuration specifies the value to decrease TCP sequence number as a big-endian 32 bit integer.

conf type:

1 rte_be32_t *

Using this action on non-matching traffic will result in undefined behavior.

RTE_FLOW_ACTION_TYPE_INC_TCP_ACK 

Increase acknowledgment number in the outermost TCP header.

Action configuration specifies the value to increase TCP acknowledgment number as a big-endian 32 bit integer.

conf type:

1 rte_be32_t *

Using this action on non-matching traffic will result in undefined behavior.

RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK 

Decrease acknowledgment number in the outermost TCP header.

Action configuration specifies the value to decrease TCP acknowledgment number as a big-endian 32 bit integer.

conf type:

1 rte_be32_t *

Using this action on non-matching traffic will result in undefined behavior.

RTE_FLOW_ACTION_TYPE_SET_TAG 

Set Tag.

Tag is for internal flow usage only and is not delivered to the application.

See struct rte_flow_action_set_tag.

RTE_FLOW_ACTION_TYPE_SET_META 

Set metadata on ingress or egress path.

See struct rte_flow_action_set_meta.

RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP 

Modify IPv4 DSCP in the outermost IP header.

If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4, then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

See struct rte_flow_action_set_dscp.

RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP 

Modify IPv6 DSCP in the outermost IP header.

If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6, then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.

See struct rte_flow_action_set_dscp.

RTE_FLOW_ACTION_TYPE_AGE 

Report as aged flow if timeout passed without any matching on the flow.

See struct rte_flow_action_age. See function rte_flow_get_aged_flows see enum RTE_ETH_EVENT_FLOW_AGED

Definition at line 1615 of file rte_flow.h.

Hash function types.

Enumerator
RTE_ETH_HASH_FUNCTION_TOEPLITZ 

Toeplitz

RTE_ETH_HASH_FUNCTION_SIMPLE_XOR 

Simple XOR

RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ 

Symmetric Toeplitz: src, dst will be replaced by xor(src, dst). For the case with src/dst only, src or dst address will xor with zero pair.

Definition at line 2211 of file rte_flow.h.

Verbose error types.

Most of them provide the type of the object referenced by struct rte_flow_error.cause.

Enumerator
RTE_FLOW_ERROR_TYPE_NONE 

No error.

RTE_FLOW_ERROR_TYPE_UNSPECIFIED 

Cause unspecified.

RTE_FLOW_ERROR_TYPE_HANDLE 

Flow rule (handle).

RTE_FLOW_ERROR_TYPE_ATTR_GROUP 

Group field.

RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY 

Priority field.

RTE_FLOW_ERROR_TYPE_ATTR_INGRESS 

Ingress field.

RTE_FLOW_ERROR_TYPE_ATTR_EGRESS 

Egress field.

RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER 

Transfer field.

RTE_FLOW_ERROR_TYPE_ATTR 

Attributes structure.

RTE_FLOW_ERROR_TYPE_ITEM_NUM 

Pattern length.

RTE_FLOW_ERROR_TYPE_ITEM_SPEC 

Item specification.

RTE_FLOW_ERROR_TYPE_ITEM_LAST 

Item specification range.

RTE_FLOW_ERROR_TYPE_ITEM_MASK 

Item specification mask.

RTE_FLOW_ERROR_TYPE_ITEM 

Specific pattern item.

RTE_FLOW_ERROR_TYPE_ACTION_NUM 

Number of actions.

RTE_FLOW_ERROR_TYPE_ACTION_CONF 

Action configuration.

RTE_FLOW_ERROR_TYPE_ACTION 

Specific action.

Definition at line 2717 of file rte_flow.h.

Conversion operations for flow API objects.

See also
rte_flow_conv()
Enumerator
RTE_FLOW_CONV_OP_NONE 

No operation to perform.

rte_flow_conv() simply returns 0.

RTE_FLOW_CONV_OP_ATTR 

Convert attributes structure.

This is a basic copy of an attributes structure.

  • src type:
    1 const struct rte_flow_attr *
  • dst type:
    1 struct rte_flow_attr *
RTE_FLOW_CONV_OP_ITEM 

Convert a single item.

Duplicates spec, last and mask but not outside objects.

  • src type:
    1 const struct rte_flow_item *
  • dst type:
    1 struct rte_flow_item *
RTE_FLOW_CONV_OP_ACTION 

Convert a single action.

Duplicates conf but not outside objects.

  • src type:
    1 const struct rte_flow_action *
  • dst type:
    1 struct rte_flow_action *
RTE_FLOW_CONV_OP_PATTERN 

Convert an entire pattern.

Duplicates all pattern items at once with the same constraints as RTE_FLOW_CONV_OP_ITEM.

  • src type:
    1 const struct rte_flow_item *
  • dst type:
    1 struct rte_flow_item *
RTE_FLOW_CONV_OP_ACTIONS 

Convert a list of actions.

Duplicates the entire list of actions at once with the same constraints as RTE_FLOW_CONV_OP_ACTION.

  • src type:
    1 const struct rte_flow_action *
  • dst type:
    1 struct rte_flow_action *
RTE_FLOW_CONV_OP_RULE 

Convert a complete flow rule description.

Comprises attributes, pattern and actions together at once with the usual constraints.

  • src type:
    1 const struct rte_flow_conv_rule *
  • dst type:
    1 struct rte_flow_conv_rule *
RTE_FLOW_CONV_OP_ITEM_NAME 

Convert item type to its name string.

Writes a NUL-terminated string to dst. Like snprintf(), the returned value excludes the terminator which is always written nonetheless.

  • src type:
    1 (const void *)enum rte_flow_item_type
  • dst type:
    1 char *
RTE_FLOW_CONV_OP_ACTION_NAME 

Convert action type to its name string.

Writes a NUL-terminated string to dst. Like snprintf(), the returned value excludes the terminator which is always written nonetheless.

  • src type:
    1 (const void *)enum rte_flow_action_type
  • dst type:
    1 char *
RTE_FLOW_CONV_OP_ITEM_NAME_PTR 

Convert item type to pointer to item name.

Retrieves item name pointer from its type. The string itself is not copied; instead, a unique pointer to an internal static constant storage is written to dst.

  • src type:
    1 (const void *)enum rte_flow_item_type
  • dst type:
    1 const char **
RTE_FLOW_CONV_OP_ACTION_NAME_PTR 

Convert action type to pointer to action name.

Retrieves action name pointer from its type. The string itself is not copied; instead, a unique pointer to an internal static constant storage is written to dst.

  • src type:
    1 (const void *)enum rte_flow_action_type
  • dst type:
    1 const char **

Definition at line 2783 of file rte_flow.h.

Function Documentation

__rte_experimental int rte_flow_dev_dump ( uint16_t  port_id,
FILE *  file,
struct rte_flow_error error 
)
Warning
EXPERIMENTAL: this API may change without prior notice.

Dump hardware internal representation information of rte flow to file.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]fileA pointer to a file for output.
[out]errorPerform verbose error reporting if not NULL. PMDs initialize this structure in case of error only.
Returns
0 on success, a nagative value otherwise.
static __rte_experimental int rte_flow_dynf_metadata_avail ( void  )
inlinestatic

Check if mbuf dynamic field for metadata is registered.

Returns
True if registered, false otherwise.

Definition at line 2952 of file rte_flow.h.

__rte_experimental int rte_flow_dynf_metadata_register ( void  )

Register mbuf dynamic field and flag for metadata.

This function must be called prior to use SET_META action in order to register the dynamic mbuf field. Otherwise, the data cannot be delivered to application.

Returns
0 on success, a negative errno value otherwise and rte_errno is set.
int rte_flow_validate ( uint16_t  port_id,
const struct rte_flow_attr attr,
const struct rte_flow_item  pattern[],
const struct rte_flow_action  actions[],
struct rte_flow_error error 
)

Check whether a flow rule can be created on a given port.

The flow rule is validated for correctness and whether it could be accepted by the device given sufficient resources. The rule is checked against the current device mode and queue configuration. The flow rule may also optionally be validated against existing flow rules and device resources. This function has no effect on the target device.

The returned value is guaranteed to remain valid only as long as no successful calls to rte_flow_create() or rte_flow_destroy() are made in the meantime and no device parameter affecting flow rules in any way are modified, due to possible collisions or resource limitations (although in such cases EINVAL should not be returned).

Parameters
port_idPort identifier of Ethernet device.
[in]attrFlow rule attributes.
[in]patternPattern specification (list terminated by the END pattern item).
[in]actionsAssociated actions (list terminated by the END action).
[out]errorPerform verbose error reporting if not NULL. PMDs initialize this structure in case of error only.
Returns
0 if flow rule is valid and can be created. A negative errno value otherwise (rte_errno is also set), the following errors are defined:

-ENOSYS: underlying device does not support this functionality.

-EIO: underlying device is removed.

-EINVAL: unknown or invalid rule specification.

-ENOTSUP: valid but unsupported rule specification (e.g. partial bit-masks are unsupported).

-EEXIST: collision with an existing rule. Only returned if device supports flow rule collision checking and there was a flow rule collision. Not receiving this return code is no guarantee that creating the rule will not fail due to a collision.

-ENOMEM: not enough memory to execute the function, or if the device supports resource validation, resource limitation on the device.

-EBUSY: action cannot be performed due to busy device resources, may succeed if the affected queues or even the entire port are in a stopped state (see rte_eth_dev_rx_queue_stop() and rte_eth_dev_stop()).

Examples:
examples/flow_filtering/flow_blocks.c, examples/ipsec-secgw/ipsec-secgw.c, and examples/ipsec-secgw/ipsec.c.
struct rte_flow* rte_flow_create ( uint16_t  port_id,
const struct rte_flow_attr attr,
const struct rte_flow_item  pattern[],
const struct rte_flow_action  actions[],
struct rte_flow_error error 
)

Create a flow rule on a given port.

Parameters
port_idPort identifier of Ethernet device.
[in]attrFlow rule attributes.
[in]patternPattern specification (list terminated by the END pattern item).
[in]actionsAssociated actions (list terminated by the END action).
[out]errorPerform verbose error reporting if not NULL. PMDs initialize this structure in case of error only.
Returns
A valid handle in case of success, NULL otherwise and rte_errno is set to the positive version of one of the error codes defined for rte_flow_validate().
Examples:
examples/flow_filtering/flow_blocks.c, examples/ipsec-secgw/ipsec-secgw.c, and examples/ipsec-secgw/ipsec.c.
int rte_flow_destroy ( uint16_t  port_id,
struct rte_flow *  flow,
struct rte_flow_error error 
)

Destroy a flow rule on a given port.

Failure to destroy a flow rule handle may occur when other flow rules depend on it, and destroying it would result in an inconsistent state.

This function is only guaranteed to succeed if handles are destroyed in reverse order of their creation.

Parameters
port_idPort identifier of Ethernet device.
flowFlow rule handle to destroy.
[out]errorPerform verbose error reporting if not NULL. PMDs initialize this structure in case of error only.
Returns
0 on success, a negative errno value otherwise and rte_errno is set.
Examples:
examples/ipsec-secgw/ipsec-secgw.c.
int rte_flow_flush ( uint16_t  port_id,
struct rte_flow_error error 
)

Destroy all flow rules associated with a port.

In the unlikely event of failure, handles are still considered destroyed and no longer valid but the port must be assumed to be in an inconsistent state.

Parameters
port_idPort identifier of Ethernet device.
[out]errorPerform verbose error reporting if not NULL. PMDs initialize this structure in case of error only.
Returns
0 on success, a negative errno value otherwise and rte_errno is set.
Examples:
examples/flow_filtering/main.c.
int rte_flow_query ( uint16_t  port_id,
struct rte_flow *  flow,
const struct rte_flow_action *  action,
void *  data,
struct rte_flow_error error 
)

Query an existing flow rule.

This function allows retrieving flow-specific data such as counters. Data is gathered by special actions which must be present in the flow rule definition.

See also
RTE_FLOW_ACTION_TYPE_COUNT
Parameters
port_idPort identifier of Ethernet device.
flowFlow rule handle to query.
actionAction definition as defined in original flow rule.
[in,out]dataPointer to storage for the associated query data type.
[out]errorPerform verbose error reporting if not NULL. PMDs initialize this structure in case of error only.
Returns
0 on success, a negative errno value otherwise and rte_errno is set.
int rte_flow_isolate ( uint16_t  port_id,
int  set,
struct rte_flow_error error 
)

Restrict ingress traffic to the defined flow rules.

Isolated mode guarantees that all ingress traffic comes from defined flow rules only (current and future).

Besides making ingress more deterministic, it allows PMDs to safely reuse resources otherwise assigned to handle the remaining traffic, such as global RSS configuration settings, VLAN filters, MAC address entries, legacy filter API rules and so on in order to expand the set of possible flow rule types.

Calling this function as soon as possible after device initialization, ideally before the first call to rte_eth_dev_configure(), is recommended to avoid possible failures due to conflicting settings.

Once effective, leaving isolated mode may not be possible depending on PMD implementation.

Additionally, the following functionality has no effect on the underlying port and may return errors such as ENOTSUP ("not supported"):

  • Toggling promiscuous mode.
  • Toggling allmulticast mode.
  • Configuring MAC addresses.
  • Configuring multicast addresses.
  • Configuring VLAN filters.
  • Configuring Rx filters through the legacy API (e.g. FDIR).
  • Configuring global RSS settings.
Parameters
port_idPort identifier of Ethernet device.
setNonzero to enter isolated mode, attempt to leave it otherwise.
[out]errorPerform verbose error reporting if not NULL. PMDs initialize this structure in case of error only.
Returns
0 on success, a negative errno value otherwise and rte_errno is set.
int rte_flow_error_set ( struct rte_flow_error error,
int  code,
enum rte_flow_error_type  type,
const void *  cause,
const char *  message 
)

Initialize flow error structure.

Parameters
[out]errorPointer to flow error structure (may be NULL).
codeRelated error code (rte_errno).
typeCause field and error types.
causeObject responsible for the error.
messageHuman-readable error message.
Returns
Negative error code (errno value) and rte_errno is set.
__rte_deprecated size_t rte_flow_copy ( struct rte_flow_desc fd,
size_t  len,
const struct rte_flow_attr attr,
const struct rte_flow_item items,
const struct rte_flow_action *  actions 
)
Deprecated:
Copy an rte_flow rule description.

This interface is kept for compatibility with older applications but is implemented as a wrapper to rte_flow_conv(). It is deprecated due to its lack of flexibility and reliance on a type unusable with C++ programs (struct rte_flow_desc).

Parameters
[in]fdFlow rule description.
[in]lenTotal size of allocated data for the flow description.
[in]attrFlow rule attributes.
[in]itemsPattern specification (list terminated by the END pattern item).
[in]actionsAssociated actions (list terminated by the END action).
Returns
If len is greater or equal to the size of the flow, the total size of the flow description and its data. If len is lower than the size of the flow, the number of bytes that would have been written to desc had it been sufficient. Nothing is written.
__rte_experimental int rte_flow_conv ( enum rte_flow_conv_op  op,
void *  dst,
size_t  size,
const void *  src,
struct rte_flow_error error 
)

Flow object conversion helper.

This function performs conversion of various flow API objects to a pre-allocated destination buffer. See enum rte_flow_conv_op for possible operations and details about each of them.

Since destination buffer must be large enough, it works in a manner reminiscent of snprintf():

  • If size is 0, dst may be a NULL pointer, otherwise dst must be non-NULL.
  • If positive, the returned value represents the number of bytes needed to store the conversion of src to dst according to op regardless of the size parameter.
  • Since no more than size bytes can be written to dst, output is truncated and may be inconsistent when the returned value is larger than that.
  • In case of conversion error, a negative error code is returned and dst contents are unspecified.
Parameters
opOperation to perform, related to the object type of dst.
[out]dstDestination buffer address. Must be suitably aligned by the caller.
sizeDestination buffer size in bytes.
[in]srcSource object to copy. Depending on op, its type may differ from that of dst.
[out]errorPerform verbose error reporting if not NULL. Initialized in case of error only.
Returns
The number of bytes required to convert src to dst on success, a negative errno value otherwise and rte_errno is set.
See also
rte_flow_conv_op
__rte_experimental int rte_flow_get_aged_flows ( uint16_t  port_id,
void **  contexts,
uint32_t  nb_contexts,
struct rte_flow_error error 
)

Get aged-out flows of a given port.

RTE_ETH_EVENT_FLOW_AGED event will be triggered when at least one new aged out flow was detected after the last call to rte_flow_get_aged_flows. This function can be called to get the aged flows usynchronously from the event callback or synchronously regardless the event. This is not safe to call rte_flow_get_aged_flows function with other flow functions from multiple threads simultaneously.

Parameters
port_idPort identifier of Ethernet device.
[in,out]contextsThe address of an array of pointers to the aged-out flows contexts.
[in]nb_contextsThe length of context array pointers.
[out]errorPerform verbose error reporting if not NULL. Initialized in case of error only.
Returns
if nb_contexts is 0, return the amount of all aged contexts. if nb_contexts is not 0 , return the amount of aged flows reported in the context array, otherwise negative errno value.
See also
rte_flow_action_age
RTE_ETH_EVENT_FLOW_AGED

Variable Documentation

const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask
static
Initial value:
= {
.hdr = {
.ppt1 = {
.classification = 0xffff,
.vid = 0xfff,
},
},
}

Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2.

Definition at line 544 of file rte_flow.h.

const struct rte_flow_item_any rte_flow_item_any_mask
static
Initial value:
= {
.num = 0x00000000,
}

Default mask for RTE_FLOW_ITEM_TYPE_ANY.

Definition at line 571 of file rte_flow.h.

const struct rte_flow_item_vf rte_flow_item_vf_mask
static
Initial value:
= {
.id = 0x00000000,
}

Default mask for RTE_FLOW_ITEM_TYPE_VF.

Definition at line 600 of file rte_flow.h.

const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask
static
Initial value:
= {
.index = 0x00000000,
}

Default mask for RTE_FLOW_ITEM_TYPE_PHY_PORT.

Definition at line 631 of file rte_flow.h.

const struct rte_flow_item_port_id rte_flow_item_port_id_mask
static
Initial value:
= {
.id = 0xffffffff,
}

Default mask for RTE_FLOW_ITEM_TYPE_PORT_ID.

Definition at line 657 of file rte_flow.h.

const struct rte_flow_item_raw rte_flow_item_raw_mask
static
Initial value:
= {
.relative = 1,
.search = 1,
.reserved = 0x3fffffff,
.offset = 0xffffffff,
.limit = 0xffff,
.length = 0xffff,
.pattern = NULL,
}

Default mask for RTE_FLOW_ITEM_TYPE_RAW.

Definition at line 692 of file rte_flow.h.

const struct rte_flow_item_eth rte_flow_item_eth_mask
static
Initial value:
= {
.dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
.src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
.type = RTE_BE16(0x0000),
}

Default mask for RTE_FLOW_ITEM_TYPE_ETH.

Definition at line 728 of file rte_flow.h.

const struct rte_flow_item_vlan rte_flow_item_vlan_mask
static
Initial value:
= {
.tci = RTE_BE16(0x0fff),
.inner_type = RTE_BE16(0x0000),
}

Default mask for RTE_FLOW_ITEM_TYPE_VLAN.

Definition at line 753 of file rte_flow.h.

const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask
static
Initial value:
= {
.hdr = {
.src_addr = RTE_BE32(0xffffffff),
.dst_addr = RTE_BE32(0xffffffff),
},
}

Default mask for RTE_FLOW_ITEM_TYPE_IPV4.

Examples:
examples/ipsec-secgw/ipsec.c.

Definition at line 772 of file rte_flow.h.

const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask
static
Initial value:
= {
.hdr = {
.src_addr =
"\xff\xff\xff\xff\xff\xff\xff\xff"
"\xff\xff\xff\xff\xff\xff\xff\xff",
.dst_addr =
"\xff\xff\xff\xff\xff\xff\xff\xff"
"\xff\xff\xff\xff\xff\xff\xff\xff",
},
}

Default mask for RTE_FLOW_ITEM_TYPE_IPV6.

Examples:
examples/ipsec-secgw/ipsec.c.

Definition at line 794 of file rte_flow.h.

const struct rte_flow_item_icmp rte_flow_item_icmp_mask
static
Initial value:
= {
.hdr = {
.icmp_type = 0xff,
.icmp_code = 0xff,
},
}

Default mask for RTE_FLOW_ITEM_TYPE_ICMP.

Definition at line 817 of file rte_flow.h.

const struct rte_flow_item_udp rte_flow_item_udp_mask
static
Initial value:
= {
.hdr = {
.src_port = RTE_BE16(0xffff),
.dst_port = RTE_BE16(0xffff),
},
}

Default mask for RTE_FLOW_ITEM_TYPE_UDP.

Definition at line 836 of file rte_flow.h.

const struct rte_flow_item_tcp rte_flow_item_tcp_mask
static
Initial value:
= {
.hdr = {
.src_port = RTE_BE16(0xffff),
.dst_port = RTE_BE16(0xffff),
},
}

Default mask for RTE_FLOW_ITEM_TYPE_TCP.

Definition at line 855 of file rte_flow.h.

const struct rte_flow_item_sctp rte_flow_item_sctp_mask
static
Initial value:
= {
.hdr = {
.src_port = RTE_BE16(0xffff),
.dst_port = RTE_BE16(0xffff),
},
}

Default mask for RTE_FLOW_ITEM_TYPE_SCTP.

Definition at line 874 of file rte_flow.h.

const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask
static
Initial value:
= {
.vni = "\xff\xff\xff",
}

Default mask for RTE_FLOW_ITEM_TYPE_VXLAN.

Definition at line 896 of file rte_flow.h.

const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask
static
Initial value:
= {
.rsvd_grp_ecid_b = RTE_BE16(0x3fff),
}

Default mask for RTE_FLOW_ITEM_TYPE_E_TAG.

Definition at line 924 of file rte_flow.h.

const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask
static
Initial value:
= {
.tni = "\xff\xff\xff",
}

Default mask for RTE_FLOW_ITEM_TYPE_NVGRE.

Definition at line 949 of file rte_flow.h.

const struct rte_flow_item_mpls rte_flow_item_mpls_mask
static
Initial value:
= {
.label_tc_s = "\xff\xff\xf0",
}

Default mask for RTE_FLOW_ITEM_TYPE_MPLS.

Definition at line 969 of file rte_flow.h.

const struct rte_flow_item_gre rte_flow_item_gre_mask
static
Initial value:
= {
.protocol = RTE_BE16(0xffff),
}

Default mask for RTE_FLOW_ITEM_TYPE_GRE.

Definition at line 990 of file rte_flow.h.

const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask
static
Initial value:
= {
.thresh = 0xffffffff,
}

Default mask for RTE_FLOW_ITEM_TYPE_FUZZY.

Definition at line 1018 of file rte_flow.h.

const struct rte_flow_item_gtp rte_flow_item_gtp_mask
static
Initial value:
= {
.teid = RTE_BE32(0xffffffff),
}

Default mask for RTE_FLOW_ITEM_TYPE_GTP.

Definition at line 1043 of file rte_flow.h.

const struct rte_flow_item_esp rte_flow_item_esp_mask
static
Initial value:
= {
.hdr = {
.spi = RTE_BE32(0xffffffff),
},
}

Default mask for RTE_FLOW_ITEM_TYPE_ESP.

Examples:
examples/ipsec-secgw/ipsec.c.

Definition at line 1059 of file rte_flow.h.

const struct rte_flow_item_geneve rte_flow_item_geneve_mask
static
Initial value:
= {
.vni = "\xff\xff\xff",
}

Default mask for RTE_FLOW_ITEM_TYPE_GENEVE.

Definition at line 1084 of file rte_flow.h.

const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask
static
Initial value:
= {
.vni = "\xff\xff\xff",
}

Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE.

Definition at line 1104 of file rte_flow.h.

const struct rte_flow_item_arp_eth_ipv4 rte_flow_item_arp_eth_ipv4_mask
static
Initial value:
= {
.sha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
.spa = RTE_BE32(0xffffffff),
.tha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
.tpa = RTE_BE32(0xffffffff),
}

Default mask for RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4.

Definition at line 1129 of file rte_flow.h.

const struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask
static
Initial value:
= {
.next_hdr = 0xff,
}

Default mask for RTE_FLOW_ITEM_TYPE_IPV6_EXT.

Definition at line 1154 of file rte_flow.h.

const struct rte_flow_item_icmp6 rte_flow_item_icmp6_mask
static
Initial value:
= {
.type = 0xff,
.code = 0xff,
}

Default mask for RTE_FLOW_ITEM_TYPE_ICMP6.

Definition at line 1172 of file rte_flow.h.

const struct rte_flow_item_icmp6_nd_ns rte_flow_item_icmp6_nd_ns_mask
static
Initial value:
= {
.target_addr =
"\xff\xff\xff\xff\xff\xff\xff\xff"
"\xff\xff\xff\xff\xff\xff\xff\xff",
}

Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS.

Definition at line 1194 of file rte_flow.h.

const struct rte_flow_item_icmp6_nd_na rte_flow_item_icmp6_nd_na_mask
static
Initial value:
= {
.target_addr =
"\xff\xff\xff\xff\xff\xff\xff\xff"
"\xff\xff\xff\xff\xff\xff\xff\xff",
}

Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA.

Definition at line 1221 of file rte_flow.h.

const struct rte_flow_item_icmp6_nd_opt rte_flow_item_icmp6_nd_opt_mask
static
Initial value:
= {
.type = 0xff,
}

Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT.

Definition at line 1247 of file rte_flow.h.

const struct rte_flow_item_icmp6_nd_opt_sla_eth rte_flow_item_icmp6_nd_opt_sla_eth_mask
static
Initial value:
= {
.sla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
}

Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH.

Definition at line 1272 of file rte_flow.h.

const struct rte_flow_item_icmp6_nd_opt_tla_eth rte_flow_item_icmp6_nd_opt_tla_eth_mask
static
Initial value:
= {
.tla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
}

Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH.

Definition at line 1297 of file rte_flow.h.

const struct rte_flow_item_meta rte_flow_item_meta_mask
static
Initial value:
= {
.data = UINT32_MAX,
}

Default mask for RTE_FLOW_ITEM_TYPE_META.

Definition at line 1318 of file rte_flow.h.

const struct rte_flow_item_gtp_psc rte_flow_item_gtp_psc_mask
static
Initial value:
= {
.qfi = 0x3f,
}

Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC.

Definition at line 1336 of file rte_flow.h.

const struct rte_flow_item_pppoe_proto_id rte_flow_item_pppoe_proto_id_mask
static
Initial value:
= {
.proto_id = RTE_BE16(0xffff),
}

Default mask for RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID.

Definition at line 1375 of file rte_flow.h.

const struct rte_flow_item_tag rte_flow_item_tag_mask
static
Initial value:
= {
.data = 0xffffffff,
.index = 0xff,
}

Default mask for RTE_FLOW_ITEM_TYPE_TAG.

Definition at line 1395 of file rte_flow.h.

const struct rte_flow_item_l2tpv3oip rte_flow_item_l2tpv3oip_mask
static
Initial value:
= {
.session_id = RTE_BE32(UINT32_MAX),
}

Default mask for RTE_FLOW_ITEM_TYPE_L2TPV3OIP.

Definition at line 1412 of file rte_flow.h.

const struct rte_flow_item_mark rte_flow_item_mark_mask
static
Initial value:
= {
.id = 0xffffffff,
}

Default mask for RTE_FLOW_ITEM_TYPE_MARK.

Definition at line 1442 of file rte_flow.h.

const struct rte_flow_item_nsh rte_flow_item_nsh_mask
static
Initial value:
= {
.mdtype = 0xf,
.next_proto = 0xff,
.spi = 0xffffff,
.sindex = 0xff,
}

Default mask for RTE_FLOW_ITEM_TYPE_NSH.

Definition at line 1471 of file rte_flow.h.

const struct rte_flow_item_igmp rte_flow_item_igmp_mask
static
Initial value:
= {
.group_addr = 0xffffffff,
}

Default mask for RTE_FLOW_ITEM_TYPE_IGMP.

Definition at line 1497 of file rte_flow.h.

const struct rte_flow_item_ah rte_flow_item_ah_mask
static
Initial value:
= {
.spi = 0xffffffff,
}

Default mask for RTE_FLOW_ITEM_TYPE_AH.

Definition at line 1521 of file rte_flow.h.

const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask
static
Initial value:
= {
.s_field = 0x01,
.seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
}

Default mask for RTE_FLOW_ITEM_TYPE_PFCP.

Definition at line 1543 of file rte_flow.h.