DPDK  18.05.1
rte_fbarray.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017-2018 Intel Corporation
3  */
4 
5 #ifndef RTE_FBARRAY_H
6 #define RTE_FBARRAY_H
7 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #include <stdbool.h>
38 #include <stdio.h>
39 
40 #include <rte_compat.h>
41 #include <rte_rwlock.h>
42 
43 #define RTE_FBARRAY_NAME_LEN 64
44 
45 struct rte_fbarray {
46  char name[RTE_FBARRAY_NAME_LEN];
47  unsigned int count;
48  unsigned int len;
49  unsigned int elt_sz;
50  void *data;
51  rte_rwlock_t rwlock;
52 };
53 
78 int __rte_experimental
79 rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,
80  unsigned int elt_sz);
81 
82 
100 int __rte_experimental
101 rte_fbarray_attach(struct rte_fbarray *arr);
102 
103 
121 int __rte_experimental
122 rte_fbarray_destroy(struct rte_fbarray *arr);
123 
124 
139 int __rte_experimental
140 rte_fbarray_detach(struct rte_fbarray *arr);
141 
142 
156 void * __rte_experimental
157 rte_fbarray_get(const struct rte_fbarray *arr, unsigned int idx);
158 
159 
173 int __rte_experimental
174 rte_fbarray_find_idx(const struct rte_fbarray *arr, const void *elt);
175 
176 
190 int __rte_experimental
191 rte_fbarray_set_used(struct rte_fbarray *arr, unsigned int idx);
192 
193 
207 int __rte_experimental
208 rte_fbarray_set_free(struct rte_fbarray *arr, unsigned int idx);
209 
210 
225 int __rte_experimental
226 rte_fbarray_is_used(struct rte_fbarray *arr, unsigned int idx);
227 
228 
242 int __rte_experimental
243 rte_fbarray_find_next_free(struct rte_fbarray *arr, unsigned int start);
244 
245 
259 int __rte_experimental
260 rte_fbarray_find_next_used(struct rte_fbarray *arr, unsigned int start);
261 
262 
279 int __rte_experimental
280 rte_fbarray_find_next_n_free(struct rte_fbarray *arr, unsigned int start,
281  unsigned int n);
282 
283 
300 int __rte_experimental
301 rte_fbarray_find_next_n_used(struct rte_fbarray *arr, unsigned int start,
302  unsigned int n);
303 
304 
318 int __rte_experimental
319 rte_fbarray_find_contig_free(struct rte_fbarray *arr,
320  unsigned int start);
321 
322 
336 int __rte_experimental
337 rte_fbarray_find_contig_used(struct rte_fbarray *arr, unsigned int start);
338 
339 
349 void __rte_experimental
350 rte_fbarray_dump_metadata(struct rte_fbarray *arr, FILE *f);
351 
352 #ifdef __cplusplus
353 }
354 #endif
355 
356 #endif /* RTE_FBARRAY_H */