X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_ether%2Frte_eth_ctrl.h;h=498fc85c5f3ac002bb87857670f634d1bcf867a5;hb=f161fb6ad5125e8286ea6aaa01e8903dacf21161;hp=bda880e0254dc38efd8b2ac8cbd954b486e1a574;hpb=2d72306de1dcd2ae0013fcb74673496b2cc52420;p=dpdk.git diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index bda880e025..498fc85c5f 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -46,6 +46,36 @@ extern "C" { #endif +/* + * A packet can be identified by hardware as different flow types. Different + * NIC hardwares may support different flow types. + * Basically, the NIC hardware identifies the flow type as deep protocol as + * possible, and exclusively. For example, if a packet is identified as + * 'RTE_ETH_FLOW_NONFRAG_IPV4_TCP', it will not be any of other flow types, + * though it is an actual IPV4 packet. + * Note that the flow types are used to define RSS offload types in + * rte_ethdev.h. + */ +#define RTE_ETH_FLOW_UNKNOWN 0 +#define RTE_ETH_FLOW_RAW 1 +#define RTE_ETH_FLOW_IPV4 2 +#define RTE_ETH_FLOW_FRAG_IPV4 3 +#define RTE_ETH_FLOW_NONFRAG_IPV4_TCP 4 +#define RTE_ETH_FLOW_NONFRAG_IPV4_UDP 5 +#define RTE_ETH_FLOW_NONFRAG_IPV4_SCTP 6 +#define RTE_ETH_FLOW_NONFRAG_IPV4_OTHER 7 +#define RTE_ETH_FLOW_IPV6 8 +#define RTE_ETH_FLOW_FRAG_IPV6 9 +#define RTE_ETH_FLOW_NONFRAG_IPV6_TCP 10 +#define RTE_ETH_FLOW_NONFRAG_IPV6_UDP 11 +#define RTE_ETH_FLOW_NONFRAG_IPV6_SCTP 12 +#define RTE_ETH_FLOW_NONFRAG_IPV6_OTHER 13 +#define RTE_ETH_FLOW_L2_PAYLOAD 14 +#define RTE_ETH_FLOW_IPV6_EX 15 +#define RTE_ETH_FLOW_IPV6_TCP_EX 16 +#define RTE_ETH_FLOW_IPV6_UDP_EX 17 +#define RTE_ETH_FLOW_MAX 18 + /** * Feature filter types */ @@ -54,6 +84,8 @@ enum rte_filter_type { RTE_ETH_FILTER_MACVLAN, RTE_ETH_FILTER_ETHERTYPE, RTE_ETH_FILTER_FLEXIBLE, + RTE_ETH_FILTER_SYN, + RTE_ETH_FILTER_NTUPLE, RTE_ETH_FILTER_TUNNEL, RTE_ETH_FILTER_FDIR, RTE_ETH_FILTER_HASH, @@ -136,6 +168,73 @@ struct rte_eth_flex_filter { uint16_t queue; /**< Queue assigned to when match. */ }; +/** + * A structure used to define the TCP syn filter entry + * to support RTE_ETH_FILTER_SYN with RTE_ETH_FILTER_ADD, + * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations. + */ +struct rte_eth_syn_filter { + uint8_t hig_pri; /**< 1 - higher priority than other filters, + 0 - lower priority. */ + uint16_t queue; /**< Queue assigned to when match */ +}; + +/** + * Define all structures for ntuple Filter type. + */ + +#define RTE_NTUPLE_FLAGS_DST_IP 0x0001 /**< If set, dst_ip is part of ntuple */ +#define RTE_NTUPLE_FLAGS_SRC_IP 0x0002 /**< If set, src_ip is part of ntuple */ +#define RTE_NTUPLE_FLAGS_DST_PORT 0x0004 /**< If set, dst_port is part of ntuple */ +#define RTE_NTUPLE_FLAGS_SRC_PORT 0x0008 /**< If set, src_port is part of ntuple */ +#define RTE_NTUPLE_FLAGS_PROTO 0x0010 /**< If set, protocol is part of ntuple */ +#define RTE_NTUPLE_FLAGS_TCP_FLAG 0x0020 /**< If set, tcp flag is involved */ + +#define RTE_5TUPLE_FLAGS ( \ + RTE_NTUPLE_FLAGS_DST_IP | \ + RTE_NTUPLE_FLAGS_SRC_IP | \ + RTE_NTUPLE_FLAGS_DST_PORT | \ + RTE_NTUPLE_FLAGS_SRC_PORT | \ + RTE_NTUPLE_FLAGS_PROTO) + +#define RTE_2TUPLE_FLAGS ( \ + RTE_NTUPLE_FLAGS_DST_PORT | \ + RTE_NTUPLE_FLAGS_PROTO) + +#define TCP_URG_FLAG 0x20 +#define TCP_ACK_FLAG 0x10 +#define TCP_PSH_FLAG 0x08 +#define TCP_RST_FLAG 0x04 +#define TCP_SYN_FLAG 0x02 +#define TCP_FIN_FLAG 0x01 +#define TCP_FLAG_ALL 0x3F + +/** + * A structure used to define the ntuple filter entry + * to support RTE_ETH_FILTER_NTUPLE with RTE_ETH_FILTER_ADD, + * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations. + */ +struct rte_eth_ntuple_filter { + uint16_t flags; /**< Flags from RTE_NTUPLE_FLAGS_* */ + uint32_t dst_ip; /**< Destination IP address in big endian. */ + uint32_t dst_ip_mask; /**< Mask of destination IP address. */ + uint32_t src_ip; /**< Source IP address in big endian. */ + uint32_t src_ip_mask; /**< Mask of destination IP address. */ + uint16_t dst_port; /**< Destination port in big endian. */ + uint16_t dst_port_mask; /**< Mask of destination port. */ + uint16_t src_port; /**< Source Port in big endian. */ + uint16_t src_port_mask; /**< Mask of source port. */ + uint8_t proto; /**< L4 protocol. */ + uint8_t proto_mask; /**< Mask of L4 protocol. */ + /** tcp_flags only meaningful when the proto is TCP. + The packet matched above ntuple fields and contain + any set bit in tcp_flags will hit this filter. */ + uint8_t tcp_flags; + uint16_t priority; /**< seven levels (001b-111b), 111b is highest, + used when more than one filter matches. */ + uint16_t queue; /**< Queue assigned to when match*/ +}; + /** * Tunneled type. */ @@ -198,25 +297,6 @@ struct rte_eth_tunnel_filter_conf { #define RTE_ETH_FDIR_MAX_FLEXLEN 16 /** < Max length of flexbytes. */ -/** - * Flow type - */ -enum rte_eth_flow_type { - RTE_ETH_FLOW_TYPE_NONE = 0, - RTE_ETH_FLOW_TYPE_RAW, - RTE_ETH_FLOW_TYPE_UDPV4, - RTE_ETH_FLOW_TYPE_TCPV4, - RTE_ETH_FLOW_TYPE_SCTPV4, - RTE_ETH_FLOW_TYPE_IPV4_OTHER, - RTE_ETH_FLOW_TYPE_FRAG_IPV4, - RTE_ETH_FLOW_TYPE_UDPV6, - RTE_ETH_FLOW_TYPE_TCPV6, - RTE_ETH_FLOW_TYPE_SCTPV6, - RTE_ETH_FLOW_TYPE_IPV6_OTHER, - RTE_ETH_FLOW_TYPE_FRAG_IPV6, - RTE_ETH_FLOW_TYPE_MAX = 64, -}; - /** * A structure used to define the input for IPV4 flow */ @@ -312,7 +392,7 @@ struct rte_eth_fdir_flow_ext { * A structure used to define the input for a flow director filter entry */ struct rte_eth_fdir_input { - enum rte_eth_flow_type flow_type; /**< Type of flow */ + uint16_t flow_type; union rte_eth_fdir_flow flow; /**< Flow fields to match, dependent on flow_type */ struct rte_eth_fdir_flow_ext flow_ext; @@ -405,7 +485,7 @@ struct rte_eth_flex_payload_cfg { * for each flow type */ struct rte_eth_fdir_flex_mask { - enum rte_eth_flow_type flow_type; /**< Flow type */ + uint16_t flow_type; uint8_t mask[RTE_ETH_FDIR_MAX_FLEXLEN]; /**< Mask for the whole flexible payload */ }; @@ -419,7 +499,7 @@ struct rte_eth_fdir_flex_conf { uint16_t nb_flexmasks; /**< The number of following mask */ struct rte_eth_flex_payload_cfg flex_set[RTE_ETH_PAYLOAD_MAX]; /**< Flex payload configuration for each payload type */ - struct rte_eth_fdir_flex_mask flex_mask[RTE_ETH_FLOW_TYPE_MAX]; + struct rte_eth_fdir_flex_mask flex_mask[RTE_ETH_FLOW_MAX]; /**< Flex mask configuration for each flow type */ }; @@ -432,6 +512,10 @@ enum rte_fdir_mode { RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode. */ }; +#define UINT32_BIT (CHAR_BIT * sizeof(uint32_t)) +#define RTE_FLOW_MASK_ARRAY_SIZE \ + (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT) + /** * A structure used to get the information of flow director filter. * It supports RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_INFO operation. @@ -440,30 +524,30 @@ enum rte_fdir_mode { * It can be gotten to help taking specific configurations per device. */ struct rte_eth_fdir_info { - enum rte_fdir_mode mode; /**< Flow director mode */ + enum rte_fdir_mode mode; /**< Flow director mode */ struct rte_eth_fdir_masks mask; + /** Flex payload configuration information */ struct rte_eth_fdir_flex_conf flex_conf; - /**< Flex payload configuration information */ - uint32_t guarant_spc; /**< Guaranteed spaces.*/ - uint32_t best_spc; /**< Best effort spaces.*/ - uint32_t flow_types_mask[RTE_ETH_FLOW_TYPE_MAX / sizeof(uint32_t)]; - /**< Bit mask for every supported flow type. */ - uint32_t max_flexpayload; /**< Total flex payload in bytes. */ + uint32_t guarant_spc; /**< Guaranteed spaces.*/ + uint32_t best_spc; /**< Best effort spaces.*/ + /** Bit mask for every supported flow type. */ + uint32_t flow_types_mask[RTE_FLOW_MASK_ARRAY_SIZE]; + uint32_t max_flexpayload; /**< Total flex payload in bytes. */ + /** Flexible payload unit in bytes. Size and alignments of all flex + payload segments should be multiplies of this value. */ uint32_t flex_payload_unit; - /**< Flexible payload unit in bytes. Size and alignments of all flex - payload segments should be multiplies of this value. */ + /** Max number of flexible payload continuous segments. + Each segment should be a multiple of flex_payload_unit.*/ uint32_t max_flex_payload_segment_num; - /**< Max number of flexible payload continuous segments. - Each segment should be a multiple of flex_payload_unit.*/ + /** Maximum src_offset in bytes allowed. It indicates that + src_offset[i] in struct rte_eth_flex_payload_cfg should be less + than this value. */ uint16_t flex_payload_limit; - /**< Maximum src_offset in bytes allowed. It indicates that - src_offset[i] in struct rte_eth_flex_payload_cfg should be - less than this value. */ + /** Flex bitmask unit in bytes. Size of flex bitmasks should be a + multiply of this value. */ uint32_t flex_bitmask_unit; - /**< Flex bitmask unit in bytes. Size of flex bitmasks should - be a multiply of this value. */ + /** Max supported size of flex bitmasks in flex_bitmask_unit */ uint32_t max_flex_bitmask_num; - /**< Max supported size of flex bitmasks in flex_bitmask_unit */ }; /** @@ -512,9 +596,8 @@ enum rte_eth_hash_function { RTE_ETH_HASH_FUNCTION_MAX, }; -#define UINT32_BIT (CHAR_BIT * sizeof(uint32_t)) #define RTE_SYM_HASH_MASK_ARRAY_SIZE \ - (RTE_ALIGN(RTE_ETH_FLOW_TYPE_MAX, UINT32_BIT)/UINT32_BIT) + (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT) /** * A structure used to set or get global hash function configurations which * include symmetric hash enable per flow type and hash function type.