staticvoidrte_convert_rss_key(constuint32_t*orig,uint32_t*targ,intlen)[inline],[static]
Prepare special converted key to use with rte_softrss_be()Parametersorig pointer to original RSS key
targ pointer to target RSS key
len RSS key length
Definition at line 134 of file rte_thash.h.
staticvoidrte_thash_load_v6_addrs(conststructrte_ipv6_hdr*orig,unionrte_thash_tuple*targ)[inline],[static]
Prepare and load IPv6 addresses (src and dst) into target tuple
Parametersorig Pointer to ipv6 header of the original packet
targ Pointer to rte_ipv6_tuple structure
Definition at line 151 of file rte_thash.h.
staticuint32_trte_softrss(uint32_t*input_tuple,uint32_tinput_len,constuint8_t*rss_key)[inline],[static]
Generic implementation. Can be used with original rss_key
Parametersinput_tuple Pointer to input tuple
input_len Length of input_tuple in 4-bytes chunks
rss_key Pointer to RSS hash key.
Returns
Calculated hash value.
Definition at line 189 of file rte_thash.h.
staticuint32_trte_softrss_be(uint32_t*input_tuple,uint32_tinput_len,constuint8_t*rss_key)[inline],[static]
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.
Parametersinput_tuple Pointer to input tuple
input_len Length of input_tuple in 4-bytes chunks
*rss_key Pointer to RSS hash key.
Returns
Calculated hash value.
Definition at line 219 of file rte_thash.h.
intrte_thash_gfni_supported(void)
Indicates if GFNI implementations of the Toeplitz hash are supported.
Returns
1 if GFNI is supported 0 otherwise
voidrte_thash_complete_matrix(uint64_t*matrixes,constuint8_t*rss_key,intsize)
Converts Toeplitz hash key (RSS key) into matrixes required for GFNI implementation
Parametersmatrixes pointer to the memory where matrices will be written. Note: the size of this memory must be
equal to size * 8
rss_key pointer to the Toeplitz hash key
size Size of the rss_key in bytes.
structrte_thash_ctx*rte_thash_init_ctx(constchar*name,uint32_tkey_len,uint32_treta_sz,uint8_t*key,uint32_tflags)
Create a new thash context.
Parametersname Context name
key_len Length of the toeplitz hash key
reta_sz Logarithm of the NIC's Redirection Table (ReTa) size, i.e. number of the LSBs if the hash
used to determine the reta entry.
key Pointer to the key used to init an internal key state. Could be NULL, in this case internal key
will be inited with random.
flags Supported flags are: RTE_THASH_IGNORE_PERIOD_OVERFLOW RTE_THASH_MINIMAL_SEQ
Returns
A pointer to the created context on success NULL otherwise
structrte_thash_ctx*rte_thash_find_existing(constchar*name)
Find an existing thash context and return a pointer to it.
Parametersname Name of the thash context
Returns
Pointer to the thash context or NULL if it was not found with rte_errno set appropriately. Possible
rte_errno values include:
• ENOENT - required entry not available to return.
voidrte_thash_free_ctx(structrte_thash_ctx*ctx)
Free a thash context object
Parametersctx Thash context
intrte_thash_add_helper(structrte_thash_ctx*ctx,constchar*name,uint32_tlen,uint32_toffset)
Add a special properties to the toeplitz hash key inside a thash context. Creates an internal helper
struct which has a complementary table to calculate toeplitz hash collisions. This function is not multi-
thread safe.
Parametersctx Thash context
name Name of the helper
len Length in bits of the target subtuple Must be no shorter than reta_sz passed on
rte_thash_init_ctx().
offset Offset in bits of the subtuple
Returns
0 on success negative on error
structrte_thash_subtuple_helper*rte_thash_get_helper(structrte_thash_ctx*ctx,constchar*name)
Find a helper in the context by the given name
Parametersctx Thash context
name Name of the helper
Returns
Pointer to the thash helper or NULL if it was not found.
uint32_trte_thash_get_complement(structrte_thash_subtuple_helper*h,uint32_thash,uint32_tdesired_hash)
Get a complementary value for the subtuple to produce a partial toeplitz hash collision. It must be
XOR'ed with the subtuple to produce the hash value with the desired hash LSB's This function is multi-
thread safe.
Parametersh Pointer to the helper struct
hash Toeplitz hash value calculated for the given tuple
desired_hash Desired hash value to find a collision for
Returns
A complementary value which must be xored with the corresponding subtuple
constuint8_t*rte_thash_get_key(structrte_thash_ctx*ctx)
Get a pointer to the toeplitz hash contained in the context. It changes after each addition of a helper.
It should be installed to the NIC.
Parametersctx Thash context
Returns
A pointer to the toeplitz hash key
constuint64_t*rte_thash_get_gfni_matrices(structrte_thash_ctx*ctx)
Get a pointer to the toeplitz hash matrices contained in the context. These matrices could be used with
fast toeplitz hash implementation if CPU supports GFNI. Matrices changes after each addition of a helper.
Parametersctx Thash context
Returns
A pointer to the toeplitz hash key matrices on success NULL if GFNI is not supported.
intrte_thash_adjust_tuple(structrte_thash_ctx*ctx,structrte_thash_subtuple_helper*h,uint8_t*tuple,unsignedinttuple_len,uint32_tdesired_value,unsignedintattempts,rte_thash_check_tuple_tfn,void*userdata)
Adjusts tuple in the way to make Toeplitz hash has desired least significant bits. This function is
multi-thread safe.
Parametersctx Thash context
h Pointer to the helper struct
tuple Pointer to the tuple to be adjusted
tuple_len Length of the tuple. Must be multiple of 4.
desired_value Desired value of least significant bits of the hash
attempts Number of attempts to adjust tuple with fn() calling
fn Callback function to check adjusted tuple. Could be NULL
userdata Pointer to the userdata to be passed to fn(). Could be NULL
Returns
0 on success negative otherwise
__rte_experimentalintrte_thash_gen_key(uint8_t*key,size_tkey_len,size_treta_sz_log,uint32_tentropy_start,size_tentropy_sz)WarningEXPERIMENTAL: this API may change without prior notice.
Modify RSS hash key such that subtuple bits corresponding to entropy_sz bits starting from entropy_start
will have the most even distribution with this key with a given ReTa size.
Parameterskey Pointer to the RSS hash key.
key_len Length of the key.
reta_sz_log Log2 of the size of RSS redirection table, i.e. number of bits of the RSS hash value used
to identify RSS ReTa entry.
entropy_start Bit offset from the beginning of the tuple where user expects best distribution of the
subtuple values.
entropy_sz Size in bits of the part of subtuple.
Returns
0 on success negative otherwise