DPDK  20.05.0
Data Structures | Macros | Functions
rte_thash.h File Reference
#include <stdint.h>
#include <rte_byteorder.h>
#include <rte_config.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 rte_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 47 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 55 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 61 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 69 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 125 of file rte_thash.h.

static void rte_thash_load_v6_addrs ( const struct rte_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 142 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 180 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 210 of file rte_thash.h.