rte_memory.h(3)

πŸ“¦ version 26.03, in nixos 26.05, nixpkgs unstable

πŸ¦‹ rte_memory.h β€” memory API bestie check πŸ¦‹

okay so this is the rte_memory.h(3) page from the Library Functions Manual, and it's literally the memory-related RTE API. It is giving low-level memory main character energy, so hydrate and let's go. πŸ’–

πŸŽ€ NAME πŸŽ€

rte_memory.h β€” that's the name. No extra lore. Periodt. πŸ’…


✨ SYNOPSIS ✨

First things first, include these headers exactly, bestie:

#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#include <rte_bitops.h>
#include <rte_common.h>
#include <rte_config.h>
#include <rte_eal_memconfig.h>
#include <rte_fbarray.h>

🧱 Data Structures 🧱

  • struct rte_memseg
  • struct rte_memseg_list

🧸 Macros 🧸

#define SOCKET_ID_ANY   -1
#define RTE_MEMSEG_FLAG_DO_NOT_FREE   RTE_BIT32(0)
#define RTE_MEMSEG_FLAG_DIRTY   RTE_BIT32(1)
#define RTE_MEM_EVENT_CALLBACK_NAME_LEN   64
#define RTE_MEM_ALLOC_VALIDATOR_NAME_LEN   64

🧬 Typedefs 🧬

typedef int(* rte_memseg_walk_t) (const struct rte_memseg_list *msl,
    const struct rte_memseg *ms, void *arg)
typedef int(* rte_memseg_contig_walk_t) (const struct rte_memseg_list
    *msl, const struct rte_memseg *ms, size_t len, void *arg)
typedef int(* rte_memseg_list_walk_t) (const struct rte_memseg_list
    *msl, void *arg)
typedef void(* rte_mem_event_callback_t) (enum rte_mem_event event_type,
    const void *addr, size_t len, void *arg)
typedef int(* rte_mem_alloc_validator_t) (int socket_id, size_t
    cur_limit, size_t new_len)

🌈 Enumerations 🌈

enum rte_mem_event { RTE_MEM_EVENT_ALLOC = 0, RTE_MEM_EVENT_FREE }

πŸ› οΈ Functions πŸ› οΈ

int rte_mem_lock_page (const void *virt)
phys_addr_t rte_mem_virt2phy (const void *virt)
rte_iova_t rte_mem_virt2iova (const void *virt)
void * rte_mem_iova2virt (rte_iova_t iova)
struct rte_memseg * rte_mem_virt2memseg (const void *virt, const struct
    rte_memseg_list *msl)
struct rte_memseg_list * rte_mem_virt2memseg_list (const void *virt)
int rte_memseg_walk (rte_memseg_walk_t func, void *arg)
int rte_memseg_contig_walk (rte_memseg_contig_walk_t func, void *arg)
int rte_memseg_list_walk (rte_memseg_list_walk_t func, void *arg)
    __rte_locks_excluded(rte_mcfg_mem_get_lock())
int rte_memseg_walk_thread_unsafe (rte_memseg_walk_t func, void *arg)
int rte_memseg_contig_walk_thread_unsafe (rte_memseg_contig_walk_t func,
    void *arg)
int rte_memseg_list_walk_thread_unsafe (rte_memseg_list_walk_t func,
    void *arg)
int rte_memseg_get_fd (const struct rte_memseg *ms)
int rte_memseg_get_fd_thread_unsafe (const struct rte_memseg *ms)
int rte_memseg_get_fd_offset (const struct rte_memseg *ms, size_t
    *offset)
int rte_memseg_get_fd_offset_thread_unsafe (const struct rte_memseg *ms,
    size_t *offset)
int rte_extmem_register (void *va_addr, size_t len, rte_iova_t
    iova_addrs[], unsigned int n_pages, size_t page_sz)
int rte_extmem_unregister (void *va_addr, size_t len)
int rte_extmem_attach (void *va_addr, size_t len)
int rte_extmem_detach (void *va_addr, size_t len)
void rte_dump_physmem_layout (FILE *f)
uint64_t rte_eal_get_physmem_size (void)
unsigned rte_memory_get_nchannel (void)
unsigned rte_memory_get_nrank (void)
int rte_mem_check_dma_mask (uint8_t maskbits)
int rte_mem_check_dma_mask_thread_unsafe (uint8_t maskbits)
void rte_mem_set_dma_mask (uint8_t maskbits)
int rte_eal_using_phys_addrs (void)
int rte_mem_event_callback_register (const char *name,
    rte_mem_event_callback_t clb, void *arg)
int rte_mem_event_callback_unregister (const char *name, void *arg)
int rte_mem_alloc_validator_register (const char *name,
    rte_mem_alloc_validator_t clb, int socket_id, size_t limit)
    Register validator callback for memory allocations.
int rte_mem_alloc_validator_unregister (const char *name, int socket_id)
    Unregister validator callback for memory allocations.
__rte_experimental void rte_memzero_explicit (void *dst, size_t sz)
static __rte_experimental bool rte_memeq_timingsafe (const void *a,
    const void *b, size_t n)

Also, the synopsis specifically says:

  • rte_mem_alloc_validator_register β€” Register validator callback for memory allocations.
  • rte_mem_alloc_validator_unregister β€” Unregister validator callback for memory allocations.

🌟 Detailed Description 🌟

Memory-related RTE API.

Definition in file rte_memory.h.


🧷 Macro Definition Documentation 🧷

#define SOCKET_ID_ANY -1

Any NUMA socket.

Definition at line 39 of file rte_memory.h.

#define RTE_MEMSEG_FLAG_DO_NOT_FREE RTE_BIT32(0)

Prevent this segment from being freed back to the OS.

Definition at line 42 of file rte_memory.h.

#define RTE_MEMSEG_FLAG_DIRTY RTE_BIT32(1)

This segment is not filled with zeros.

Definition at line 44 of file rte_memory.h.

#define RTE_MEM_EVENT_CALLBACK_NAME_LEN 64

maximum length of callback name

Definition at line 609 of file rte_memory.h.

#define RTE_MEM_ALLOC_VALIDATOR_NAME_LEN 64

maximum length of alloc validator name

Definition at line 665 of file rte_memory.h.


🧡 Typedef Documentation 🧡

rte_memseg_walk_t

typedef int(* rte_memseg_walk_t) (const struct rte_memseg_list *msl, const
    struct rte_memseg *ms, void *arg)

Memseg walk function prototype.

  • Returning 0 will continue walk.
  • Returning 1 will stop the walk.
  • Returning -1 will stop the walk and report error.

Definition at line 167 of file rte_memory.h.

rte_memseg_contig_walk_t

typedef int(* rte_memseg_contig_walk_t) (const struct rte_memseg_list *msl,
    const struct rte_memseg *ms, size_t len, void *arg)

Memseg contig walk function prototype. This will trigger a callback on every VA-contiguous area starting at memseg ms, so total valid VA space at each callback call will be [ms->addr, ms->addr + len).

  • Returning 0 will continue walk.
  • Returning 1 will stop the walk.
  • Returning -1 will stop the walk and report error.

Definition at line 179 of file rte_memory.h.

rte_memseg_list_walk_t

typedef int(* rte_memseg_list_walk_t) (const struct rte_memseg_list *msl,
    void *arg)

Memseg list walk function prototype. This will trigger a callback on every allocated memseg list.

  • Returning 0 will continue walk.
  • Returning 1 will stop the walk.
  • Returning -1 will stop the walk and report error.

Definition at line 190 of file rte_memory.h.

rte_mem_event_callback_t

typedef void(* rte_mem_event_callback_t) (enum rte_mem_event event_type,
    const void *addr, size_t len, void *arg)

Function typedef used to register callbacks for memory events.

Definition at line 615 of file rte_memory.h.

rte_mem_alloc_validator_t

typedef int(* rte_mem_alloc_validator_t) (int socket_id, size_t cur_limit,
    size_t new_len)

Function typedef used to register memory allocation validation callbacks.

  • Returning 0 will allow allocation attempt to continue.
  • Returning -1 will prevent allocation from succeeding.

Definition at line 673 of file rte_memory.h.


🌈 Enumeration Type Documentation 🌈

enum rte_mem_event

Enum indicating which kind of memory event has happened. Used by callbacks to distinguish between memory allocations and deallocations.

  • RTE_MEM_EVENT_ALLOC β€” Allocation event.
  • RTE_MEM_EVENT_FREE β€” Deallocation event.

Definition at line 605 of file rte_memory.h.


πŸ’» Function Documentation πŸ’»

int rte_mem_lock_page (const void * virt)

Lock page in physical memory and prevent from swapping.

Parameters

  • virt β€” The virtual address.

Returns

0 on success, negative on error.

phys_addr_t rte_mem_virt2phy (const void * virt)

Get physical address of any mapped virtual address in the current process. It is found by browsing the /proc/self/pagemap special file. The page must be locked.

Parameters

  • virt β€” The virtual address.

Returns

The physical address or RTE_BAD_IOVA on error.

rte_iova_t rte_mem_virt2iova (const void * virt)

Get IO virtual address of any mapped virtual address in the current process.

Note: This function will not check internal page table. Instead, in IOVA as PA mode, it will fall back to getting real physical address (which may not match the expected IOVA, such as what was specified for external memory).

Parameters

  • virt β€” The virtual address.

Returns

The IO address or RTE_BAD_IOVA on error.

void * rte_mem_iova2virt (rte_iova_t iova)

Get virtual memory address corresponding to iova address.

Note: This function read-locks the memory hotplug subsystem, and thus cannot be used within memory-related callback functions.

Parameters

  • iova β€” The iova address.

Returns

Virtual address corresponding to iova address (or NULL if address does not exist within DPDK memory map).

struct rte_memseg * rte_mem_virt2memseg (const void * virt, const struct rte_memseg_list * msl)

Get memseg to which a particular virtual address belongs.

Parameters

  • virt β€” The virtual address.
  • msl β€” The memseg list in which to look up based on virt address (can be NULL).

Returns

Memseg pointer on success, or NULL on error.

struct rte_memseg_list * rte_mem_virt2memseg_list (const void * virt)

Get memseg list corresponding to virtual memory address.

Parameters

  • virt β€” The virtual address.

Returns

Memseg list to which this virtual address belongs to.

int rte_memseg_walk (rte_memseg_walk_t func, void * arg)

Walk list of all memsegs.

Note: This function read-locks the memory hotplug subsystem, and thus cannot be used within memory-related callback functions. This function will also walk through externally allocated segments. It is up to the user to decide whether to skip through these segments.

Parameters

  • func β€” Iterator function
  • arg β€” Argument passed to iterator

Returns

  • 0 if walked over the entire list
  • 1 if stopped by the user
  • -1 if user function reported error

int rte_memseg_contig_walk (rte_memseg_contig_walk_t func, void * arg)

Walk each VA-contiguous area.

Note: This function read-locks the memory hotplug subsystem, and thus cannot be used within memory-related callback functions. This function will also walk through externally allocated segments. It is up to the user to decide whether to skip through these segments.

Parameters

  • func β€” Iterator function
  • arg β€” Argument passed to iterator

Returns

  • 0 if walked over the entire list
  • 1 if stopped by the user
  • -1 if user function reported error

int rte_memseg_list_walk (rte_memseg_list_walk_t func, void * arg)

Walk each allocated memseg list.

Note: This function read-locks the memory hotplug subsystem, and thus cannot be used within memory-related callback functions. This function will also walk through externally allocated segments. It is up to the user to decide whether to skip through these segments.

Parameters

  • func β€” Iterator function
  • arg β€” Argument passed to iterator

Returns

  • 0 if walked over the entire list
  • 1 if stopped by the user
  • -1 if user function reported error

int rte_memseg_walk_thread_unsafe (rte_memseg_walk_t func, void * arg)

Walk list of all memsegs without performing any locking.

Note: This function does not perform any locking, and is only safe to call from within memory-related callback functions.

Parameters

  • func β€” Iterator function
  • arg β€” Argument passed to iterator

…and wrapping up that last one, here's how it reports back:

Returns β€” 0 if it walked over the entire list, 1 if you (the user) stopped it, and -1 if your user function reported an error ✨


int rte_memseg_contig_walk_thread_unsafe(rte_memseg_contig_walk_t func, void * arg)

Walks every VA-contiguous area, and does it without doing any locking πŸ’…

Note β€” bestie, this one does not perform any locking, and it's only safe to call from within memory-related callback functions. That's the whole deal, iykyk.
  • func β€” the iterator function
  • arg β€” the argument that gets passed to the iterator

Returns β€” 0 if it walked over the entire list, 1 if the user stopped it, -1 if the user function reported an error 🫢


int rte_memseg_list_walk_thread_unsafe(rte_memseg_list_walk_t func, void * arg)

Walks each allocated memseg list, no locking involved, periodt ✨

Note β€” same warning as above: no locking here, and it's only safe to call from within memory-related callback functions.
  • func β€” the iterator function
  • arg β€” the argument passed to the iterator

Returns β€” 0 if it walked over the entire list, 1 if the user stopped it, -1 if the user function reported an error πŸ’–


int rte_memseg_get_fd(const struct rte_memseg * ms)

Hands you the file descriptor tied to a particular memseg (if one's available) 🌸

Note β€” this function read-locks the memory hotplug subsystem, so no cap, it cannot be used inside memory-related callback functions. Deadlock city. πŸ’€ Also: this returns an internal file descriptor. Doing literally any operations on this fd is inherently dangerous, so treat it as read-only for all intents and purposes. Like, respectfully, don't touch. πŸ™ˆ
  • ms β€” a pointer to the memseg you want the file descriptor for

Returns β€” a valid file descriptor on success; -1 on error, with rte_errno set to one of these:

  • EINVAL β€” the ms pointer was NULL or didn't point to a valid memseg
  • ENODEV β€” ms fd is not available
  • ENOENT β€” ms is an unused segment
  • ENOTSUP β€” segment fd's are not supported

int rte_memseg_get_fd_thread_unsafe(const struct rte_memseg * ms)

Same energy as above β€” returns the file descriptor associated with a particular memseg (if available), just the thread-unsafe flavour πŸ’…

Note β€” this function does not perform any locking, and is only safe to call from within memory-related callback functions. And again: internal file descriptor alert 🚨 performing any operations on it is inherently dangerous, so treat it as read-only for all intents and purposes.
  • ms β€” a pointer to memseg for which to get the file descriptor

Returns β€” valid file descriptor on success; -1 on error, with rte_errno set to:

  • EINVAL β€” ms pointer was NULL or didn't point to a valid memseg
  • ENODEV β€” ms fd is not available
  • ENOENT β€” ms is an unused segment
  • ENOTSUP β€” segment fd's are not supported

int rte_memseg_get_fd_offset(const struct rte_memseg * ms, size_t * offset)

Gets the offset into the segment file descriptor associated with a particular memseg (if it's available) πŸŽ€

Note β€” this one read-locks the memory hotplug subsystem, so it cannot be used within memory-related callback functions. No exceptions, bestie.
  • ms β€” a pointer to memseg for which to get the file descriptor
  • offset β€” a pointer to the offset value where the result will be stored

Returns β€” valid file descriptor on success; -1 on error, with rte_errno set to:

  • EINVAL β€” ms pointer was NULL or didn't point to a valid memseg
  • EINVAL β€” offset pointer was NULL
  • ENODEV β€” ms fd is not available
  • ENOENT β€” ms is an unused segment
  • ENOTSUP β€” segment fd's are not supported

(Yes, EINVAL shows up twice β€” that's not a typo, that's just how it is πŸ’–)


int rte_memseg_get_fd_offset_thread_unsafe(const struct rte_memseg * ms, size_t * offset)

The no-locking twin: gets the offset into the segment file descriptor for a particular memseg (if available) πŸ¦‹

Note β€” does not perform any locking, and it's only safe to call from within memory-related callback functions.
  • ms β€” a pointer to memseg for which to get the file descriptor
  • offset β€” a pointer to the offset value where the result will be stored

Returns β€” valid file descriptor on success; -1 on error, with rte_errno set to:

  • EINVAL β€” ms pointer was NULL or did not point to a valid memseg
  • EINVAL β€” offset pointer was NULL
  • ENODEV β€” ms fd is not available
  • ENOENT β€” ms is an unused segment
  • ENOTSUP β€” segment fd's are not supported

int rte_extmem_register(void * va_addr, size_t len, rte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz)

Registers an external memory chunk with DPDK 🧚

Note β€” using this API is mutually exclusive with the rte_malloc family of API's. Pick a lane, babe. This API will not perform any DMA mapping. It's expected that the user does that themselves. You got this. 🫢 Before accessing this memory in other processes, it needs to be attached in each of those processes by calling rte_extmem_attach in each other process.
  • va_addr β€” start of the virtual area to register. Must be aligned by page_sz.
  • len β€” length of the virtual area to register. Must be aligned by page_sz.
  • iova_addrs β€” array of page IOVA addresses corresponding to each page in this memory area. Can be NULL, in which case page IOVA addresses will be set to RTE_BAD_IOVA.
  • n_pages β€” number of elements in the iova_addrs array. Ignored if iova_addrs is NULL.
  • page_sz β€” page size of the underlying memory

Returns

  • 0 on success πŸŽ‰
  • -1 in case of error, with rte_errno set to one of the following:
    • EINVAL β€” one of the parameters was invalid
    • EEXIST β€” memory chunk is already registered
    • ENOSPC β€” no more space in internal config to store a new memory chunk

int rte_extmem_unregister(void * va_addr, size_t len)

Unregisters an external memory chunk with DPDK πŸ‘‘

Note β€” mutually exclusive with the rte_malloc family of API's, same as above. This API will not perform any DMA unmapping. It's expected that the user will do that themselves. Before calling this function, all other processes must call rte_extmem_detach to detach from the memory area. Like, every single one. πŸ’…
  • va_addr β€” start of the virtual area to unregister
  • len β€” length of the virtual area to unregister

Returns

  • 0 on success ✨
  • -1 in case of error, with rte_errno set to one of the following:
    • EINVAL β€” one of the parameters was invalid
    • ENOENT β€” memory chunk was not found

int rte_extmem_attach(void * va_addr, size_t len)

Attaches to an external memory chunk that was registered in another process 🌈

Note β€” mutually exclusive with the rte_malloc family of API's. This API will not perform any DMA mapping β€” the user is expected to do that themselves. (No, we're not gonna do it for you.)
  • va_addr β€” start of the virtual area to register
  • len β€” length of the virtual area to register

Returns

  • 0 on success ⭐
  • -1 in case of error, with rte_errno set to one of the following:
    • EINVAL β€” one of the parameters was invalid
    • ENOENT β€” memory chunk was not found

int rte_extmem_detach(void * va_addr, size_t len)

Detaches from an external memory chunk that was registered in another process πŸ¦‹

Note β€” yep, mutually exclusive with the rte_malloc family of API's. This API will not perform any DMA unmapping β€” it's expected that the user will do that themselves. (Seeing a pattern? 😭)
  • va_addr β€” start of the virtual area to unregister
  • len β€” length of the virtual area to unregister

Returns

  • 0 on success πŸ’œ
  • -1 in case of error, with rte_errno set to one of the following:
    • EINVAL β€” one of the parameters was invalid
    • ENOENT β€” memory chunk was not found

void rte_dump_physmem_layout(FILE * f)

Dumps the physical memory layout to a file πŸ“„ β€” honestly kinda iconic for debugging.

Note β€” this function read-locks the memory hotplug subsystem, so it cannot be used within memory-related callback functions.
  • f β€” a pointer to a file for output

uint64_t rte_eal_get_physmem_size(void)

Gets the total amount of available physical memory πŸ’–

Note β€” read-locks the memory hotplug subsystem, so nope, not allowed inside memory-related callback functions.

Returns β€” the total amount of available physical memory, in bytes πŸ“


unsigned rte_memory_get_nchannel(void)

Gets the number of memory channels πŸŽ€

Returns β€” the number of memory channels on the system. The value is 0 if it's unknown or if it's not the same on all devices.


unsigned rte_memory_get_nrank(void)

Gets the number of memory ranks πŸ‘‘

Returns β€” the number of memory ranks on the system. The value is 0 if it's unknown or if it's not the same on all devices.


int rte_mem_check_dma_mask(uint8_t maskbits)

Checks whether all currently allocated memory segments are compliant with the supplied DMA address width πŸ”

  • maskbits β€” address width to check against

int rte_mem_check_dma_mask_thread_unsafe(uint8_t maskbits)

Same vibe check as above β€” checks if all currently allocated memory segments are compliant with the supplied DMA address width β€” but this one uses rte_memseg_walk_thread_unsafe instead of rte_memseg_walk, which implies memory_hotplug_lock will not be acquired, avoiding deadlock during memory initialization πŸ’€βœ¨

Important β€” this function is just for EAL core memory internal use. Drivers should use the previous rte_mem_check_dma_mask. Like, read the room. πŸ™ˆ
  • maskbits β€” address width to check against

void rte_mem_set_dma_mask(uint8_t maskbits)

Sets the dma mask to use once memory initialization is done 🌸

Heads up: the previous functions rte_mem_check_dma_mask and rte_mem_check_dma_mask_thread_unsafe cannot be used safely until memory has been initialized. So like, order matters, bestie. πŸ’…


int rte_eal_using_phys_addrs(void)

Okay so this one's got lore: drivers based on uio will not load unless physical addresses are obtainable, and it's only possible to get physical addresses when running as a privileged user πŸ‘‘

Returns β€” 1 if the system is able to obtain physical addresses, 0 if it's using DMA addresses through an IOMMU.


int rte_mem_event_callback_register(const char * name, rte_mem_event_callback_t clb, void * arg)

The function you use to register callbacks for memory events πŸ”₯

Note β€” callbacks will happen while the memory hotplug subsystem is write-locked, which means some functions (e.g. rte_memseg_walk()) will cause a deadlock when called from within such callbacks. Do not do that. 😭 Also, mem event callbacks not being supported is an expected error condition, so your user code needs to handle this situation. In those cases, the return value will be -1, and rte_errno will be set to ENOTSUP. Not a bug, just a vibe πŸ’œ

πŸ’– Parameters πŸ’–

  • name β€” Name associated with specified callback to be added to the list.
  • clb β€” Callback function pointer.
  • arg β€” Argument to pass to the callback.

🌸 Returns 🌸

0 on successful callback register, -1 on unsuccessful callback register, with rte_errno value indicating reason for failure.

πŸ¦‹ int rte_mem_event_callback_unregister (const char * name, void * arg) πŸ¦‹

Function used to unregister callbacks for memory events.

πŸ’– Parameters πŸ’–

  • name β€” Name associated with specified callback to be removed from the list.
  • arg β€” Argument to look for among callbacks with specified callback name.

🌸 Returns 🌸

0 on successful callback unregister, -1 on unsuccessful callback unregister, with rte_errno value indicating reason for failure.

πŸŽ€ int rte_mem_alloc_validator_register (const char * name, rte_mem_alloc_validator_t clb, int socket_id, size_t limit) πŸŽ€

Register validator callback for memory allocations. Callbacks registered by this function will be called right before memory allocator is about to trigger allocation of more pages from the system if said allocation will bring total memory usage above specified limit on specified socket. User will be able to cancel pending allocation if callback returns -1.

Note β€” callbacks will happen while memory hotplug subsystem is write-locked, therefore some functions (e.g. rte_memseg_walk()) will cause a deadlock when called from within such callbacks.
Note β€” validator callbacks not being supported is an expected error condition, so user code needs to handle this situation. In these cases, return value will be -1, and rte_errno will be set to ENOTSUP.

πŸ’– Parameters πŸ’–

  • name β€” Name associated with specified callback to be added to the list.
  • clb β€” Callback function pointer.
  • socket_id β€” Socket ID on which to watch for allocations.
  • limit β€” Limit above which to trigger callbacks.

🌸 Returns 🌸

0 on successful callback register, -1 on unsuccessful callback register, with rte_errno value indicating reason for failure.

πŸ¦‹ int rte_mem_alloc_validator_unregister (const char * name, int socket_id) πŸ¦‹

Unregister validator callback for memory allocations.

πŸ’– Parameters πŸ’–

  • name β€” Name associated with specified callback to be removed from the list.
  • socket_id β€” Socket ID on which to watch for allocations.

🌸 Returns 🌸

0 on successful callback unregister, -1 on unsuccessful callback unregister, with rte_errno value indicating reason for failure.

✨ __rte_experimental void rte_memzero_explicit (void * dst, size_t sz) ✨

Warning β€” EXPERIMENTAL: this API may change without prior notice.

Fill memory with zero's (e.g. sensitive keys). Normally using memset() is fine, but in cases where clearing out local data before going out of scope is required, use rte_memzero_explicit() instead to prevent the compiler from optimizing away the zeroing operation.

πŸ’– Parameters πŸ’–

  • dst β€” Target buffer.
  • sz β€” Number of bytes to fill.

πŸ”₯ __rte_experimental bool rte_memeq_timingsafe (const void * a, const void * b, size_t n) [inline], [static] πŸ”₯

Warning β€” EXPERIMENTAL: this API may change without prior notice.

Timing-safe memory equality comparison.

This function compares two memory regions in constant time, making it resistant to timing side-channel attacks. The execution time depends only on the length parameter, not on the actual data values being compared.

This is particularly important for cryptographic operations where timing differences could leak information about secret keys, passwords, or other sensitive data.

πŸ’– Parameters πŸ’–

  • a β€” Pointer to the first memory region to compare.
  • b β€” Pointer to the second memory region to compare.
  • n β€” Number of bytes to compare.

🌸 Returns 🌸

true if the memory regions are identical, false if they differ.

Definition at line 775 of file rte_memory.h.

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for DPDK from the source code.


And that’s the whole page, bestie: it was generated automatically from source, and the footer’s source/version/date line stamps it as DPDK Version 26.03.0, page rte_memory.h(3) β€” iconic auto-doc energy, no cap. πŸ’…βœ¨

πŸ“¦ where this page comes from