enum rte_eth_hash_function定义了各种可能的RSS散列键类型,它在rte_ethdev.h头文件中定义,以下是全部代码:
/**
* Select hash functions used by the RSS.
*
* For example:
* ETH_RSS_IP, which indicates that the IPv4/IPv6 addresses
* are used to compute the RSS hash.
*/
enum rte_eth_hash_function {
ETH_HASH_FUNCTION_DEFAULT = 0,
/**< Default hash function. */
ETH_HASH_FUNCTION_TOEPLITZ,
/**< Toeplitz hash function defined in IEEE Std 802.3-2012 Annex F.3.4 */
ETH_HASH_FUNCTION_SIMPLE_XOR,
/**< Simple XOR-based hash function */
ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
/**< Symmetric Toeplitz hash using a key generated using
an external tool, such as dpdk-hw-vendor */
ETH_HASH_FUNCTION_MAX,
};
/**
* Additional input set for hash computation.
*
* The additional input set is used together with the default input set
* (that is, IP addresses and TCP/UDP ports) to generate a more complex
* but potentially more precise hash result.
*
* For example:
* - if @p RTE_ETH_INPUT_IPV4_TCP_SYN is set, only SYN packets are
* hashed differently;
*
* - if @p RTE_ETH_INPUT_IPV4 has all bits set, then it includes all of
* IPv4 fields in the input set.
*/
enum rte_eth_input_set_field {
RTE_ETH_INPUT_SET_UNKNOWN = 0x00000000,
/**< Input set field unknown/not applicable. */
RTE_ETH_INPUT_SET_L2_SRC_MAC = 0x00000001,
/**< Hash on source MAC address (in Ethernet header).*/
RTE_ETH_INPUT_SET_L2_DST_MAC = 0x00000002,
/**< Hash on destination MAC address (in Ethernet header).*/
RTE_ETH_INPUT_SET_L3_SRC_IP = 0x00000100,
/**< Hash on source IPv4 address (in IP header). */
RTE_ETH_INPUT_SET_L3_DST_IP = 0x00000200,
/**< Hash on destination IPv4 address (in IP header). */
RTE_ETH_INPUT_SET_L4_TCP_PORT = 0x00010000,
/**< Hash on TCP port number (in TCP header). */
RTE_ETH_INPUT_SET_L4_UDP_PORT = 0x00020000,
/**< Hash on UDP port number (in UDP header). */
RTE_ETH_INPUT_SET_TUNNEL_IPTYPE = 0x01000000,
/**< Hash based on tunnel type. */
RTE_ETH_INPUT_SET_TUNNEL_IPV4_ID = 0x02000000,
/**< Hash based on IPv4 ID of outermost tunnel packet. */
RTE_ETH_INPUT_SET_TUNNEL_IPV6_FLOW = 0x04000000,
/**< Hash based on IPv6 flow label of outermost tunnel packet. */
RTE_ETH_INPUT_SET_GRE_KEY_LSB =
(1 << ETH_RSS_NONFRAG_IPV4_TCP) |
(1 << ETH_RSS_NONFRAG_IPV4_UDP) |
(1 << ETH_RSS_NONFRAG_IPV6_TCP) |
(1 << ETH_RSS_NONFRAG_IPV6_UDP),
/**< Input set to include GRE key for non-fragmented
packets only. This is the value used by default in DPDK
for symmetric hash. */
RTE_ETH_INPUT_SET_VXLAN_VNI =
(1 << ETH_RSS_VXLAN) |
(1 << ETH_RSS_GENEVE) |
(1 << ETH_RSS_NVGRE),
/**< Input set to include VXLAN VNI for VXLAN, GENEVE and NVGRE
tunnel packets. */
RTE_ETH_INPUT_SET_GTPU_TEID = 0x40000000,
/**< Hash based on GTP-U TEID of outermost tunnel packet.
This is the value used by default in DPDK for symmetric hash. */
RTE_ETH_INPUT_SET_PPPOE_PROTO_ID = 0x80000000,
/**< Hash based on PPPoE protocol ID field in Ethernet header. */
};
/**
* Select keys used by the RSS.
*
* For example:
* ETH_RSS_IPV4, which indicates that IPv4 addresses are used
* to compute the RSS key.
*/
enum rte_eth_hash_function_selected {
ETH_HASH_FUNCTION_DEFAULT_SELECTED = (1ULL << ETH_HASH_FUNCTION_DEFAULT),
/**< Default hash function selected.*/
ETH_HASH_FUNCTION_TOEPLITZ_SELECTED = (1ULL << ETH_HASH_FUNCTION_TOEPLITZ),
/**< Toeplitz hash function selected. */
ETH_HASH_FUNCTION_SIMPLE_XOR_SELECTED =
(1ULL << ETH_HASH_FUNCTION_SIMPLE_XOR),
/**< Simple XOR-based hash function selected. */
ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SELECTED =
(1ULL << ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ),
/**< Symmetric Toeplitz hash using a key generated using
an external tool, such as dpdk-hw-vendor, selected.*/
};
/**
* Select input sets used by the RSS.
*
* For example:
* RTE_ETH_INPUT_SET_L3_SRC_IP, which indicates that the source IP address
* in L3 is included in the input set used to compute the RSS key.
*
* RTE_ETH_INPUT_SET_L4_UDP_PORT|RTE_ETH_INPUT_SET_TUNNEL_IPTYPE,
* which indicates that the UDP port number and tunnel type are included in
* the input set used to compute the RSS key.
*/
enum rte_eth_input_set_selected {
RTE_ETH_INPUT_SET_UNKNOWN_SELECTED =
(1ULL << RTE_ETH_INPUT_SET_UNKNOWN),
/**< Input set field unknown/not applicable selected. */
RTE_ETH_INPUT_SET_L2_SRC_MAC_SELECTED =
(1ULL << RTE_ETH_INPUT_SET_L2_SRC_MAC),
/**< Hash on source MAC address (in Ethernet header) selected.*/
RTE_ETH_INPUT_SET_L2_DST_MAC_SELECTED =
(1ULL << RTE_ETH_INPUT_SET_L2_DST_MAC),
/**< Hash on destination MAC address (in Ethernet header) selected.*/
RTE_ETH_INPUT_SET_L3_SRC_IP_SELECTED =
(1ULL << RTE_ETH_INPUT_SET_L3_SRC_IP),
/**< Hash on source IPv4 address (in IP header) selected. */
RTE_ETH_INPUT_SET_L3_DST_IP_SELECTED =
(1ULL << RTE_ETH_INPUT_SET_L3_DST_IP),
/**< Hash on destination IPv4 address (in IP header) selected. */
RTE_ETH_INPUT_SET_L4_TCP_PORT_SELECTED =
(1ULL << RTE_ETH_INPUT_SET_L4_TCP_PORT),
/**< Hash on TCP port number (in TCP header) selected. */
RTE_ETH_INPUT_SET_L4_UDP_PORT_SELECTED =
(1ULL << RTE_ETH_INPUT_SET_L4_UDP_PORT),
/**< Hash on UDP port number (in UDP header) selected. */
RTE_ETH_IS_TUNNEL_TYPE_GRE_KEY_LSB_SELECTED =
(ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV4_UDP |
ETH_RSS_NONFRAG_IPV6_TCP | ETH_RSS_NONFRAG_IPV6_UDP),
/**< Input set to include GRE key for non-fragmented packets only
is selected. This is the value used by default in DPDK
for symmetric hash. */
RTE_ETH_IS_TUNNEL_TYPE_VXLAN_SELECTED =
(ETH_RSS_VXLAN | ETH_RSS_GENEVE | ETH_RSS_NVGRE),
/**< Input set to include VXLAN VNI for VXLAN, GENEVE and NVGRE
tunnel packets is selected. */
RTE_ETH_INPUT_SET_GTPU_TEID_SELECTED =
(1ULL << RTE_ETH_INPUT_SET_GTPU_TEID),
/**< Hash based on GTP-U TEID of outermost tunnel packet
selected. This is the value used by default in DPDK
for symmetric hash. */
RTE_ETH_INPUT_SET_PPPOE_PROTO_ID_SELECTED =
(1ULL << RTE_ETH_INPUT_SET_PPPOE_PROTO_ID),
/**< Hash based on PPPoE protocol ID field in Ethernet header
selected.*/
};