NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
doca_sta_mem.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES, ALL RIGHTS RESERVED.
3  *
4  * This software product is a proprietary product of NVIDIA CORPORATION &
5  * AFFILIATES (the "Company") and all right, title, and interest in and to the
6  * software product, including all associated intellectual property rights, are
7  * and shall remain exclusively with the Company.
8  *
9  * This software product is governed by the End User License Agreement
10  * provided with the software product.
11  *
12  */
13 
14 #ifndef DOCA_STA_MEM_H_
15 #define DOCA_STA_MEM_H_
16 
17 #include <stdint.h>
18 
19 #include <doca_compat.h>
20 #include <doca_error.h>
21 #include <doca_types.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 struct doca_sta;
28 
45 typedef void *(*doca_sta_zmalloc_cb_t)(size_t size, size_t align, uint64_t *phys_addr);
46 
53 typedef void (*doca_sta_free_cb_t)(void *buf);
54 
55 #define DOCA_STA_VTOPHYS_ERROR (0xFFFFFFFFFFFFFFFFULL)
56 
66 typedef uint64_t (*doca_sta_vtophys_cb_t)(const void *buf, uint32_t size);
67 
69 doca_error_t doca_sta_mem_allocator_register(const struct doca_sta *sta,
70  doca_sta_zmalloc_cb_t alloc_cb,
72  doca_sta_vtophys_cb_t vtophys_cb);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif /* DOCA_STA_MEM_H_ */
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.
Definition: doca_sta_mem.h:66
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)
void(* doca_sta_free_cb_t)(void *buf)
Function to free a memory buffer previously allocated by doca_sta_zmalloc_cb_t().
Definition: doca_sta_mem.h:53
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 zer...
Definition: doca_sta_mem.h:45
static void free_cb(void *addr, size_t len, void *opaque)
#define DOCA_EXPERIMENTAL
To set a Symbol (or specifically a function) as experimental.
Definition: doca_compat.h:103
enum doca_error doca_error_t
DOCA API return codes.