NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
doca_sta_mem.h File Reference
#include <stdint.h>
#include <doca_compat.h>
#include <doca_error.h>
#include <doca_types.h>
Include dependency graph for doca_sta_mem.h:

Go to the source code of this file.

Macros

#define DOCA_STA_VTOPHYS_ERROR   (0xFFFFFFFFFFFFFFFFULL)
 

Typedefs

typedef void *(* doca_sta_zmalloc_cb_t) (size_t size, size_t align, uint64_t *phys_addr)
 Function to allocate a pinned memory buffer with the given size and alignment. The buffer will be zeroed. More...
 
typedef void(* doca_sta_free_cb_t) (void *buf)
 Function to free a memory buffer previously allocated by doca_sta_zmalloc_cb_t(). More...
 
typedef uint64_t(* doca_sta_vtophys_cb_t) (const void *buf, uint32_t size)
 Get the physical address of a buffer previously allocated by doca_sta_zmalloc_cb_t. More...
 

Functions

DOCA_EXPERIMENTAL doca_error_t doca_sta_mem_allocator_register (const struct doca_sta *sta, doca_sta_zmalloc_cb_t alloc_cb, doca_sta_free_cb_t free_cb, doca_sta_vtophys_cb_t vtophys_cb)
 

Macro Definition Documentation

◆ DOCA_STA_VTOPHYS_ERROR

#define DOCA_STA_VTOPHYS_ERROR   (0xFFFFFFFFFFFFFFFFULL)

Definition at line 55 of file doca_sta_mem.h.

Typedef Documentation

◆ doca_sta_free_cb_t

typedef void(* doca_sta_free_cb_t) (void *buf)

Function to free a memory buffer previously allocated by doca_sta_zmalloc_cb_t().

Parameters
[in]bufBuffer to free

Definition at line 53 of file doca_sta_mem.h.

◆ doca_sta_vtophys_cb_t

typedef uint64_t(* doca_sta_vtophys_cb_t) (const void *buf, uint32_t size)

Get the physical address of a buffer previously allocated by doca_sta_zmalloc_cb_t.

Parameters
[in]bufA pointer to a buffer.
[in]sizeContains the size of the memory region pointed to by vaddr.
Returns
the physical address of this buffer on success, or DOCA_STA_VTOPHYS_ERROR on failure.

Definition at line 66 of file doca_sta_mem.h.

◆ doca_sta_zmalloc_cb_t

typedef void*(* doca_sta_zmalloc_cb_t) (size_t size, size_t align, uint64_t *phys_addr)

Function to allocate a pinned memory buffer with the given size and alignment. The buffer will be zeroed.

Parameters
[in]sizeSize in bytes.
[in]alignIf non-zero, the allocated buffer is aligned to a multiple of align. In this case, it must be a power of two. The returned buffer is always aligned to at least cache line size.
[in]phys_addrA pointer to the variable to hold the physical address of the allocated buffer is passed. If NULL, the physical address is not returned.
Returns
a pointer to the allocated memory buffer.

Definition at line 45 of file doca_sta_mem.h.

Function Documentation

◆ doca_sta_mem_allocator_register()

DOCA_EXPERIMENTAL doca_error_t doca_sta_mem_allocator_register ( const struct doca_sta *  sta,
doca_sta_zmalloc_cb_t  alloc_cb,
doca_sta_free_cb_t  free_cb,
doca_sta_vtophys_cb_t  vtophys_cb 
)