aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-dpdk/include/api/odp_buffer_pool.h
blob: 382f4f06413c22592df0e3460bad470cabb40f5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/* Copyright (c) 2013, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */


/**
 * @file
 *
 * ODP buffer pool
 */

#ifndef ODP_BUFFER_POOL_H_
#define ODP_BUFFER_POOL_H_

#ifdef __cplusplus
extern "C" {
#endif



#include <odp_std_types.h>
#include <odp_buffer.h>

/** Maximum queue name lenght in chars */
#define ODP_BUFFER_POOL_NAME_LEN  32

/** Invalid buffer pool */
#define ODP_BUFFER_POOL_INVALID  (unsigned long)(-1L)

/** ODP buffer pool */
typedef unsigned long odp_buffer_pool_t;


/**
 * Create a buffer pool
 *
 * @param name      Name of the pool (max ODP_BUFFER_POOL_NAME_LEN - 1 chars)
 * @param base_addr Pool base address
 * @param size      Pool size in bytes
 * @param buf_size  Buffer size in bytes
 * @param buf_align Minimum buffer alignment
 * @param buf_type  Buffer type
 *
 * @return Buffer pool handle
 */
odp_buffer_pool_t odp_buffer_pool_create(const char *name,
					 void *base_addr, uint64_t size,
					 size_t buf_size, size_t buf_align,
					 int buf_type);


/**
 * Find a buffer pool by name
 *
 * @param name      Name of the pool
 *
 * @return Buffer pool handle, or ODP_BUFFER_POOL_INVALID if not found.
 */
odp_buffer_pool_t odp_buffer_pool_lookup(const char *name);


/**
 * Print buffer pool info
 *
 * @param pool      Pool handle
 *
 */
void odp_buffer_pool_print(odp_buffer_pool_t pool);



/**
 * Buffer alloc
 *
 * @param pool      Pool handle
 *
 * @return Buffer handle or ODP_BUFFER_INVALID
 */
odp_buffer_t odp_buffer_alloc(odp_buffer_pool_t pool);


/**
 * Buffer free
 *
 * @param buf       Buffer handle
 *
 */
void odp_buffer_free(odp_buffer_t buf);




#ifdef __cplusplus
}
#endif

#endif