rte_hash_crc.h(3)
π¦ rte_hash_crc.h(3) β the Library Functions Manual glow-up β¨
okay bestie, so this is rte_hash_crc.h from the DPDK crew β it lives in the Library Functions Manual and it's literally all about CRC hashing. sit with me, I got you π
β¨ NAME β¨
rte_hash_crc.h β no cap, that's the whole name. iconic, lowkey.
πΈ SYNOPSIS πΈ
first up, the includes you gotta pull in:
#include <stdint.h>
#include <rte_branch_prediction.h>
#include <rte_common.h>
#include <rte_config.h>
#include 'rte_crc_sw.h'
#include 'rte_crc_generic.h'
π Functions
here's the whole friend group, signatures exactly as they are:
void rte_hash_crc_set_alg (uint8_t alg)
static uint32_t rte_hash_crc_1byte (uint8_t data, uint32_t init_val)
static uint32_t rte_hash_crc_2byte (uint16_t data, uint32_t init_val)
static uint32_t rte_hash_crc_4byte (uint32_t data, uint32_t init_val)
static uint32_t rte_hash_crc_8byte (uint64_t data, uint32_t init_val)
static uint32_t rte_hash_crc (const void *data, uint32_t data_len,
uint32_t init_val)
π Detailed Description π
RTE CRC Hash
that's the vibe. it's literally called "RTE CRC Hash" in the source, periodt.
Definition in file rte_hash_crc.h.
π Function Documentation π
π void rte_hash_crc_set_alg (uint8_t alg)
ok so this one is the bouncer at the club πͺ β it lets you allow or disallow use of the SSE4.2 / ARMv8 intrinsics for CRC32 hash calculation. like, you're telling the code whether it's allowed to flex the fancy hardware instructions or not.
Parameters
algβ an OR of the following flags, bestie:- (CRC32_SW) β don't use SSE4.2/ARMv8 intrinsics. this is the default when you're non-[x86/ARMv8], iykyk.
- (CRC32_SSE42) β use SSE4.2 intrinsics if available.
- (CRC32_SSE42_x64) β use the 64-bit SSE4.2 intrinsic if available. this is the default on x86 π₯
- (CRC32_ARM64) β use the ARMv8 CRC intrinsic if available. default for ARMv8 π§
π uint32_t rte_hash_crc_1byte (uint8_t data, uint32_t init_val) [inline], [static]
uses a single CRC32 instruction to hash a byte value. one byte, one instruction, ate. π
Parameters
dataβ the data you're hashing, bb.init_valβ the value that initialises the hash generator.
Returns
a 32bit calculated hash value. β¨
πΈ uint32_t rte_hash_crc_2byte (uint16_t data, uint32_t init_val) [inline], [static]
same energy, but for a 2 bytes value β one CRC32 instruction does the whole thing. so efficient of it.
Parameters
dataβ the data to perform the hash on.init_valβ the value that initialises the hash generator.
Returns
32bit calculated hash value, as always π
π¦ uint32_t rte_hash_crc_4byte (uint32_t data, uint32_t init_val) [inline], [static]
you guessed it β single CRC32 instruction, hashing a 4 bytes value. main character behaviour.
Parameters
dataβ the data to hash.init_valβ initialises the hash generator.
Returns
32bit calculated hash value β
π uint32_t rte_hash_crc_8byte (uint64_t data, uint32_t init_val) [inline], [static]
and now the big one β one CRC32 instruction, hashing an 8 bytes value. absolute unit. π₯
Parameters
dataβ the data to hash.init_valβ initialises the hash generator.
Returns
32bit calculated hash value, no notes π«Ά
π
uint32_t rte_hash_crc (const void * data, uint32_t data_len, uint32_t init_val) [inline], [static]
this is the generalist of the group π β it calculates a CRC32 hash on a user-supplied byte array. any length, you're in charge.
Parameters
dataβ the data you want to hash.data_lenβ literally how many bytes to use to calculate the hash value.init_valβ the value that initialises the hash generator.
Returns
32bit calculated hash value π«
Definition at line 125 of file rte_hash_crc.h.
π Author π
Generated automatically by Doxygen for DPDK from the source code. so technically the author is a robot, but she's doing her best π
aaaand that's the whole page! shoutout to DPDK Version 25.11.3 for making rte_hash_crc.h(3) happen β go forth and hash responsibly, bestie πβ¨π¦
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms