X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_ethdev%2Frte_flow.h;h=eab87a55a61e8c56caa20cfd24cbf22e5800c9ae;hb=346553db5bd1e2d0c25d017d590cd5225a704b22;hp=942165f6391eaf55824af32c6fcf60109cdfc91e;hpb=0517eea7612a34d24348d7d6f14e31cb9794ad16;p=dpdk.git diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 942165f639..eab87a55a6 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -414,6 +413,36 @@ enum rte_flow_item_type { * See struct rte_flow_item_mark. */ RTE_FLOW_ITEM_TYPE_MARK, + + /** + * [META] + * + * Matches a metadata value specified in mbuf metadata field. + * See struct rte_flow_item_meta. + */ + RTE_FLOW_ITEM_TYPE_META, + + /** + * 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. + * + * @p spec/mask type: + * @code rte_be32_t * @endcode + */ + RTE_FLOW_ITEM_TYPE_GRE_KEY, + + /** + * 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_GTP_PSC, }; /** @@ -577,8 +606,8 @@ static const struct rte_flow_item_raw rte_flow_item_raw_mask = { * same order as on the wire. */ struct rte_flow_item_eth { - struct ether_addr dst; /**< Destination MAC. */ - struct ether_addr src; /**< Source MAC. */ + struct rte_ether_addr dst; /**< Destination MAC. */ + struct rte_ether_addr src; /**< Source MAC. */ rte_be16_t type; /**< EtherType or TPID. */ }; @@ -597,8 +626,8 @@ static const struct rte_flow_item_eth rte_flow_item_eth_mask = { * Matches an 802.1Q/ad VLAN tag. * * The corresponding standard outer EtherType (TPID) values are - * ETHER_TYPE_VLAN or ETHER_TYPE_QINQ. It can be overridden by the preceding - * pattern item. + * RTE_ETHER_TYPE_VLAN or RTE_ETHER_TYPE_QINQ. It can be overridden by + * the preceding pattern item. */ struct rte_flow_item_vlan { rte_be16_t tci; /**< Tag control information. */ @@ -621,7 +650,7 @@ static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = { * Note: IPv4 options are handled by dedicated pattern items. */ struct rte_flow_item_ipv4 { - struct ipv4_hdr hdr; /**< IPv4 header definition. */ + struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */ @@ -643,7 +672,7 @@ static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = { * RTE_FLOW_ITEM_TYPE_IPV6_EXT. */ struct rte_flow_item_ipv6 { - struct ipv6_hdr hdr; /**< IPv6 header definition. */ + struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */ @@ -666,7 +695,7 @@ static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = { * Matches an ICMP header. */ struct rte_flow_item_icmp { - struct icmp_hdr hdr; /**< ICMP header definition. */ + struct rte_icmp_hdr hdr; /**< ICMP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */ @@ -685,7 +714,7 @@ static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = { * Matches a UDP header. */ struct rte_flow_item_udp { - struct udp_hdr hdr; /**< UDP header definition. */ + struct rte_udp_hdr hdr; /**< UDP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */ @@ -704,7 +733,7 @@ static const struct rte_flow_item_udp rte_flow_item_udp_mask = { * Matches a TCP header. */ struct rte_flow_item_tcp { - struct tcp_hdr hdr; /**< TCP header definition. */ + struct rte_tcp_hdr hdr; /**< TCP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */ @@ -723,7 +752,7 @@ static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = { * Matches a SCTP header. */ struct rte_flow_item_sctp { - struct sctp_hdr hdr; /**< SCTP header definition. */ + struct rte_sctp_hdr hdr; /**< SCTP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */ @@ -761,7 +790,7 @@ static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = { * Matches a E-tag header. * * The corresponding standard outer EtherType (TPID) value is - * ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item. + * RTE_ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item. */ struct rte_flow_item_e_tag { /** @@ -908,14 +937,14 @@ static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = { * Matches an ESP header. */ struct rte_flow_item_esp { - struct esp_hdr hdr; /**< ESP header definition. */ + struct rte_esp_hdr hdr; /**< ESP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */ #ifndef __cplusplus static const struct rte_flow_item_esp rte_flow_item_esp_mask = { .hdr = { - .spi = 0xffffffff, + .spi = RTE_BE32(0xffffffff), }, }; #endif @@ -974,9 +1003,9 @@ struct rte_flow_item_arp_eth_ipv4 { uint8_t hln; /**< Hardware address length, normally 6. */ uint8_t pln; /**< Protocol address length, normally 4. */ rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */ - struct ether_addr sha; /**< Sender hardware address. */ + struct rte_ether_addr sha; /**< Sender hardware address. */ rte_be32_t spa; /**< Sender IPv4 address. */ - struct ether_addr tha; /**< Target hardware address. */ + struct rte_ether_addr tha; /**< Target hardware address. */ rte_be32_t tpa; /**< Target IPv4 address. */ }; @@ -1120,7 +1149,7 @@ rte_flow_item_icmp6_nd_opt_mask = { struct rte_flow_item_icmp6_nd_opt_sla_eth { uint8_t type; /**< ND option type, normally 1. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr sla; /**< Source Ethernet LLA. */ + struct rte_ether_addr sla; /**< Source Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */ @@ -1145,7 +1174,7 @@ rte_flow_item_icmp6_nd_opt_sla_eth_mask = { struct rte_flow_item_icmp6_nd_opt_tla_eth { uint8_t type; /**< ND option type, normally 2. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr tla; /**< Target Ethernet LLA. */ + struct rte_ether_addr tla; /**< Target Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */ @@ -1156,6 +1185,40 @@ rte_flow_item_icmp6_nd_opt_tla_eth_mask = { }; #endif +/** + * RTE_FLOW_ITEM_TYPE_META. + * + * Matches a specified metadata value. + */ +struct rte_flow_item_meta { + rte_be32_t data; +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_META. */ +#ifndef __cplusplus +static const struct rte_flow_item_meta rte_flow_item_meta_mask = { + .data = RTE_BE32(UINT32_MAX), +}; +#endif + +/** + * RTE_FLOW_ITEM_TYPE_GTP_PSC. + * + * Matches a GTP PDU extension header with type 0x85. + */ +struct rte_flow_item_gtp_psc { + uint8_t pdu_type; /**< PDU type. */ + uint8_t qfi; /**< QoS flow identifier. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */ +#ifndef __cplusplus +static const struct rte_flow_item_gtp_psc +rte_flow_item_gtp_psc_mask = { + .qfi = 0x3f, +}; +#endif + /** * @warning * @b EXPERIMENTAL: this structure may change without prior notice @@ -1221,9 +1284,10 @@ struct rte_flow_item { /** * Action types. * - * Each possible action is represented by a type. Some have associated - * configuration structures. Several actions combined in a list can be - * assigned to a flow rule and are performed in order. + * 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: * @@ -1507,6 +1571,20 @@ enum rte_flow_action_type { */ RTE_FLOW_ACTION_TYPE_NVGRE_DECAP, + /** + * Add outer header whose template is provided in its data buffer + * + * See struct rte_flow_action_raw_encap. + */ + RTE_FLOW_ACTION_TYPE_RAW_ENCAP, + + /** + * Remove outer header whose template is provided in its data buffer. + * + * See struct rte_flow_action_raw_decap + */ + RTE_FLOW_ACTION_TYPE_RAW_DECAP, + /** * Modify IPv4 source address in the outermost IPv4 header. * @@ -1546,6 +1624,129 @@ enum rte_flow_action_type { * See struct rte_flow_action_set_ipv6. */ RTE_FLOW_ACTION_TYPE_SET_IPV6_DST, + + /** + * 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_SRC, + + /** + * 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_SET_TP_DST, + + /** + * 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_MAC_SWAP, + + /** + * Decrease TTL value directly + * + * No associated configuration structure. + */ + RTE_FLOW_ACTION_TYPE_DEC_TTL, + + /** + * Set TTL value + * + * See struct rte_flow_action_set_ttl + */ + RTE_FLOW_ACTION_TYPE_SET_TTL, + + /** + * 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_SRC, + + /** + * 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_SET_MAC_DST, + + /** + * 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. + * + * @p conf type: + * @code rte_be32_t * @endcode + * + * Using this action on non-matching traffic will result in + * undefined behavior. + */ + RTE_FLOW_ACTION_TYPE_INC_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. + * + * @p conf type: + * @code rte_be32_t * @endcode + * + * Using this action on non-matching traffic will result in + * undefined behavior. + */ + RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ, + + /** + * 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. + * + * @p conf type: + * @code rte_be32_t * @endcode + + * Using this action on non-matching traffic will result in + * undefined behavior. + */ + RTE_FLOW_ACTION_TYPE_INC_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. + * + * @p conf type: + * @code rte_be32_t * @endcode + * + * Using this action on non-matching traffic will result in + * undefined behavior. + */ + RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK, }; /** @@ -1633,6 +1834,16 @@ struct rte_flow_query_count { uint64_t bytes; /**< Number of bytes through this rule [out]. */ }; +/** + * Hash function types. + */ +enum rte_eth_hash_function { + RTE_ETH_HASH_FUNCTION_DEFAULT = 0, + RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */ + RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */ + RTE_ETH_HASH_FUNCTION_MAX, +}; + /** * RTE_FLOW_ACTION_TYPE_RSS * @@ -1909,6 +2120,51 @@ struct rte_flow_action_nvgre_encap { struct rte_flow_item *definition; }; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_RAW_ENCAP + * + * Raw tunnel end-point encapsulation data definition. + * + * The data holds the headers definitions to be applied on the packet. + * The data must start with ETH header up to the tunnel item header itself. + * When used right after RAW_DECAP (for decapsulating L3 tunnel type for + * example MPLSoGRE) the data will just hold layer 2 header. + * + * The preserve parameter holds which bits in the packet the PMD is not allowed + * to change, this parameter can also be NULL and then the PMD is allowed + * to update any field. + * + * size holds the number of bytes in @p data and @p preserve. + */ +struct rte_flow_action_raw_encap { + uint8_t *data; /**< Encapsulation data. */ + uint8_t *preserve; /**< Bit-mask of @p data to preserve on output. */ + size_t size; /**< Size of @p data and @p preserve. */ +}; + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_RAW_DECAP + * + * Raw tunnel end-point decapsulation data definition. + * + * The data holds the headers definitions to be removed from the packet. + * The data must start with ETH header up to the tunnel item header itself. + * When used right before RAW_DECAP (for encapsulating L3 tunnel type for + * example MPLSoGRE) the data will just hold layer 2 header. + * + * size holds the number of bytes in @p data. + */ +struct rte_flow_action_raw_decap { + uint8_t *data; /**< Encapsulation data. */ + size_t size; /**< Size of @p data and @p preserve. */ +}; + /** * @warning * @b EXPERIMENTAL: this structure may change without prior notice @@ -1939,16 +2195,49 @@ struct rte_flow_action_set_ipv6 { uint8_t ipv6_addr[16]; }; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_SET_TP_SRC + * RTE_FLOW_ACTION_TYPE_SET_TP_DST + * + * Allows modification of source (RTE_FLOW_ACTION_TYPE_SET_TP_SRC) + * and destination (RTE_FLOW_ACTION_TYPE_SET_TP_DST) port numbers + * in the specified outermost TCP/UDP header. + */ +struct rte_flow_action_set_tp { + rte_be16_t port; +}; + +/** + * RTE_FLOW_ACTION_TYPE_SET_TTL + * + * Set the TTL value directly for IPv4 or IPv6 + */ +struct rte_flow_action_set_ttl { + uint8_t ttl_value; +}; + +/** + * RTE_FLOW_ACTION_TYPE_SET_MAC + * + * Set MAC address from the matched flow + */ +struct rte_flow_action_set_mac { + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; +}; + /* * Definition of a single action. * * A list of actions is terminated by a END action. * - * For simple actions without a configuration structure, conf remains NULL. + * For simple actions without a configuration object, conf remains NULL. */ struct rte_flow_action { enum rte_flow_action_type type; /**< Action type. */ - const void *conf; /**< Pointer to action configuration structure. */ + const void *conf; /**< Pointer to action configuration object. */ }; /**