NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
doca_buf_pool.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 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 
47 #ifndef DOCA_BUF_POOL_H_
48 #define DOCA_BUF_POOL_H_
49 
50 #include <stddef.h>
51 #include <stdint.h>
52 
53 #include <doca_error.h>
54 #include <doca_types.h>
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 struct doca_mmap;
61 struct doca_buf;
62 struct doca_buf_pool;
63 
83 doca_error_t doca_buf_pool_create(size_t num_elements,
84  size_t element_size,
85  const struct doca_mmap *mmap,
86  struct doca_buf_pool **buf_pool);
87 
106 doca_error_t doca_buf_pool_destroy(struct doca_buf_pool *buf_pool);
107 
132 doca_error_t doca_buf_pool_start(struct doca_buf_pool *buf_pool);
133 
152 doca_error_t doca_buf_pool_stop(struct doca_buf_pool *buf_pool);
153 
172 doca_error_t doca_buf_pool_buf_alloc(struct doca_buf_pool *buf_pool, struct doca_buf **buf);
173 
189 doca_error_t doca_buf_pool_set_user_data(struct doca_buf_pool *buf_pool, union doca_data user_data);
190 
206 doca_error_t doca_buf_pool_set_element_alignment(struct doca_buf_pool *buf_pool, size_t element_alignment);
207 
222 doca_error_t doca_buf_pool_get_num_elements(const struct doca_buf_pool *buf_pool, uint32_t *num_of_elements);
223 
238 doca_error_t doca_buf_pool_get_num_free_elements(const struct doca_buf_pool *buf_pool, uint32_t *num_of_free_elements);
239 
256 doca_error_t doca_buf_pool_get_user_data(const struct doca_buf_pool *buf_pool, union doca_data *user_data);
257 
275 doca_error_t doca_buf_pool_get_element_alignment(const struct doca_buf_pool *buf_pool, size_t *element_alignment);
276 
277 #ifdef __cplusplus
278 }
279 #endif
280 
283 #endif /* DOCA_BUF_POOL_H_ */
doca_dpa_dev_mmap_t mmap
DOCA_STABLE doca_error_t doca_buf_pool_get_num_elements(const struct doca_buf_pool *buf_pool, uint32_t *num_of_elements)
Get the number of elements that was set in the creation of a DOCA buffer pool.
DOCA_STABLE doca_error_t doca_buf_pool_get_user_data(const struct doca_buf_pool *buf_pool, union doca_data *user_data)
Get the user_data of a DOCA buffer pool.
DOCA_STABLE doca_error_t doca_buf_pool_create(size_t num_elements, size_t element_size, const struct doca_mmap *mmap, struct doca_buf_pool **buf_pool)
Allocates a buffer pool and sets it with doca_buf objects.
DOCA_STABLE doca_error_t doca_buf_pool_buf_alloc(struct doca_buf_pool *buf_pool, struct doca_buf **buf)
This method acquires a doca_buf from a DOCA buffer pool, pointing to an allocated empty buffer.
DOCA_STABLE doca_error_t doca_buf_pool_get_element_alignment(const struct doca_buf_pool *buf_pool, size_t *element_alignment)
Get the element alignment of a DOCA buffer pool.
DOCA_STABLE doca_error_t doca_buf_pool_destroy(struct doca_buf_pool *buf_pool)
Destroy a buffer pool structure.
DOCA_STABLE doca_error_t doca_buf_pool_start(struct doca_buf_pool *buf_pool)
Start a DOCA buffer pool.
DOCA_STABLE doca_error_t doca_buf_pool_get_num_free_elements(const struct doca_buf_pool *buf_pool, uint32_t *num_of_free_elements)
Get the total number of free elements available for allocation in a DOCA buffer pool.
DOCA_STABLE doca_error_t doca_buf_pool_stop(struct doca_buf_pool *buf_pool)
Stop a started DOCA buffer pool.
DOCA_STABLE doca_error_t doca_buf_pool_set_element_alignment(struct doca_buf_pool *buf_pool, size_t element_alignment)
Set an alignment for each element in a DOCA buffer pool.
DOCA_STABLE doca_error_t doca_buf_pool_set_user_data(struct doca_buf_pool *buf_pool, union doca_data user_data)
Set user_data for a DOCA buffer pool.
#define DOCA_STABLE
To set a Symbol (or specifically a function) as stable API, i.e. it won't be changed.
Definition: doca_compat.h:96
enum doca_error doca_error_t
DOCA API return codes.
Convenience type for representing opaque data.
Definition: doca_types.h:56