DPDK: Data Plane Development Kit

18.02.0-rc0
rte_thash.h File Reference
#include <stdint.h>
#include <rte_byteorder.h>
#include <rte_ip.h>
#include <rte_common.h>

Go to the source code of this file.

Data Structures

struct  rte_ipv4_tuple
struct  rte_ipv6_tuple

Macros

#define RTE_THASH_V4_L3_LEN
#define RTE_THASH_V4_L4_LEN   ((sizeof(struct rte_ipv4_tuple)) / 4)
#define RTE_THASH_V6_L3_LEN
#define RTE_THASH_V6_L4_LEN   ((sizeof(struct rte_ipv6_tuple)) / 4)

Functions

static void rte_convert_rss_key (const uint32_t *orig, uint32_t *targ, int len)
static void rte_thash_load_v6_addrs (const struct ipv6_hdr *orig, union rte_thash_tuple *targ)
static uint32_t rte_softrss (uint32_t *input_tuple, uint32_t input_len, const uint8_t *rss_key)
static uint32_t rte_softrss_be (uint32_t *input_tuple, uint32_t input_len, const uint8_t *rss_key)

Detailed Description

toeplitz hash functions.

Definition in file rte_thash.h.

Macro Definition Documentation

#define RTE_THASH_V4_L3_LEN
Value:
((sizeof(struct rte_ipv4_tuple) - \
sizeof(((struct rte_ipv4_tuple *)0)->sctp_tag)) / 4)

Software implementation of the Toeplitz hash function used by RSS. Can be used either for packet distribution on single queue NIC or for simulating of RSS computation on specific NIC (for example after GRE header decapsulating) length in dwords of input tuple to calculate hash of ipv4 header only

Definition at line 75 of file rte_thash.h.

#define RTE_THASH_V4_L4_LEN   ((sizeof(struct rte_ipv4_tuple)) / 4)

length in dwords of input tuple to calculate hash of ipv4 header + transport header

Definition at line 83 of file rte_thash.h.

#define RTE_THASH_V6_L3_LEN
Value:
((sizeof(struct rte_ipv6_tuple) - \
sizeof(((struct rte_ipv6_tuple *)0)->sctp_tag)) / 4)

length in dwords of input tuple to calculate hash of ipv6 header only

Definition at line 89 of file rte_thash.h.

#define RTE_THASH_V6_L4_LEN   ((sizeof(struct rte_ipv6_tuple)) / 4)

length in dwords of input tuple to calculate hash of ipv6 header + transport header

Definition at line 97 of file rte_thash.h.

Function Documentation

static void rte_convert_rss_key ( const uint32_t *  orig,
uint32_t *  targ,
int  len 
)
inlinestatic

Prepare special converted key to use with rte_softrss_be()

Parameters
origpointer to original RSS key
targpointer to target RSS key
lenRSS key length

Definition at line 153 of file rte_thash.h.

static void rte_thash_load_v6_addrs ( const struct ipv6_hdr orig,
union rte_thash_tuple *  targ 
)
inlinestatic

Prepare and load IPv6 addresses (src and dst) into target tuple

Parameters
origPointer to ipv6 header of the original packet
targPointer to rte_ipv6_tuple structure

Definition at line 170 of file rte_thash.h.

static uint32_t rte_softrss ( uint32_t *  input_tuple,
uint32_t  input_len,
const uint8_t *  rss_key 
)
inlinestatic

Generic implementation. Can be used with original rss_key

Parameters
input_tuplePointer to input tuple
input_lenLength of input_tuple in 4-bytes chunks
rss_keyPointer to RSS hash key.
Returns
Calculated hash value.

Definition at line 207 of file rte_thash.h.

static uint32_t rte_softrss_be ( uint32_t *  input_tuple,
uint32_t  input_len,
const uint8_t *  rss_key 
)
inlinestatic

Optimized implementation. If you want the calculated hash value matches NIC RSS value you have to use special converted key with rte_convert_rss_key() fn.

Parameters
input_tuplePointer to input tuple
input_lenLength of input_tuple in 4-bytes chunks
*rss_keyPointer to RSS hash key.
Returns
Calculated hash value.

Definition at line 237 of file rte_thash.h.