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