DPDK  19.11.14
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 <stdio.h>
38 
39 #include <rte_compat.h>
40 #include <rte_rwlock.h>
41 
42 #define RTE_FBARRAY_NAME_LEN 64
43 
44 struct rte_fbarray {
45  char name[RTE_FBARRAY_NAME_LEN];
46  unsigned int count;
47  unsigned int len;
48  unsigned int elt_sz;
49  void *data;
50  rte_rwlock_t rwlock;
51 };
52 
77 __rte_experimental
78 int
79 rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,
80  unsigned int elt_sz);
81 
82 
100 __rte_experimental
101 int
102 rte_fbarray_attach(struct rte_fbarray *arr);
103 
104 
122 __rte_experimental
123 int
124 rte_fbarray_destroy(struct rte_fbarray *arr);
125 
126 
141 __rte_experimental
142 int
143 rte_fbarray_detach(struct rte_fbarray *arr);
144 
145 
159 __rte_experimental
160 void *
161 rte_fbarray_get(const struct rte_fbarray *arr, unsigned int idx);
162 
163 
177 __rte_experimental
178 int
179 rte_fbarray_find_idx(const struct rte_fbarray *arr, const void *elt);
180 
181 
195 __rte_experimental
196 int
197 rte_fbarray_set_used(struct rte_fbarray *arr, unsigned int idx);
198 
199 
213 __rte_experimental
214 int
215 rte_fbarray_set_free(struct rte_fbarray *arr, unsigned int idx);
216 
217 
232 __rte_experimental
233 int
234 rte_fbarray_is_used(struct rte_fbarray *arr, unsigned int idx);
235 
236 
250 __rte_experimental
251 int
252 rte_fbarray_find_next_free(struct rte_fbarray *arr, unsigned int start);
253 
254 
268 __rte_experimental
269 int
270 rte_fbarray_find_next_used(struct rte_fbarray *arr, unsigned int start);
271 
272 
289 __rte_experimental
290 int
291 rte_fbarray_find_next_n_free(struct rte_fbarray *arr, unsigned int start,
292  unsigned int n);
293 
294 
311 __rte_experimental
312 int
313 rte_fbarray_find_next_n_used(struct rte_fbarray *arr, unsigned int start,
314  unsigned int n);
315 
316 
330 __rte_experimental
331 int
332 rte_fbarray_find_contig_free(struct rte_fbarray *arr,
333  unsigned int start);
334 
335 
349 __rte_experimental
350 int
351 rte_fbarray_find_contig_used(struct rte_fbarray *arr, unsigned int start);
352 
366 __rte_experimental
367 int
368 rte_fbarray_find_prev_free(struct rte_fbarray *arr, unsigned int start);
369 
370 
384 __rte_experimental
385 int
386 rte_fbarray_find_prev_used(struct rte_fbarray *arr, unsigned int start);
387 
388 
406 __rte_experimental
407 int
408 rte_fbarray_find_prev_n_free(struct rte_fbarray *arr, unsigned int start,
409  unsigned int n);
410 
411 
429 __rte_experimental
430 int
431 rte_fbarray_find_prev_n_used(struct rte_fbarray *arr, unsigned int start,
432  unsigned int n);
433 
434 
449 __rte_experimental
450 int
451 rte_fbarray_find_rev_contig_free(struct rte_fbarray *arr,
452  unsigned int start);
453 
454 
469 __rte_experimental
470 int
471 rte_fbarray_find_rev_contig_used(struct rte_fbarray *arr, unsigned int start);
472 
473 
487 __rte_experimental
488 int
489 rte_fbarray_find_biggest_free(struct rte_fbarray *arr, unsigned int start);
490 
491 
505 __rte_experimental
506 int
507 rte_fbarray_find_biggest_used(struct rte_fbarray *arr, unsigned int start);
508 
509 
524 __rte_experimental
525 int
526 rte_fbarray_find_rev_biggest_free(struct rte_fbarray *arr, unsigned int start);
527 
528 
543 __rte_experimental
544 int
545 rte_fbarray_find_rev_biggest_used(struct rte_fbarray *arr, unsigned int start);
546 
547 
557 __rte_experimental
558 void
559 rte_fbarray_dump_metadata(struct rte_fbarray *arr, FILE *f);
560 
561 #ifdef __cplusplus
562 }
563 #endif
564 
565 #endif /* RTE_FBARRAY_H */
__rte_experimental int rte_fbarray_find_next_n_free(struct rte_fbarray *arr, unsigned int start, unsigned int n)
__rte_experimental int rte_fbarray_find_biggest_free(struct rte_fbarray *arr, unsigned int start)
__rte_experimental int rte_fbarray_find_contig_free(struct rte_fbarray *arr, unsigned int start)
__rte_experimental int rte_fbarray_find_rev_biggest_used(struct rte_fbarray *arr, unsigned int start)
__rte_experimental int rte_fbarray_find_prev_n_free(struct rte_fbarray *arr, unsigned int start, unsigned int n)
__rte_experimental int rte_fbarray_find_next_n_used(struct rte_fbarray *arr, unsigned int start, unsigned int n)
__rte_experimental int rte_fbarray_find_rev_biggest_free(struct rte_fbarray *arr, unsigned int start)
__rte_experimental int rte_fbarray_find_next_free(struct rte_fbarray *arr, unsigned int start)
__rte_experimental int rte_fbarray_set_free(struct rte_fbarray *arr, unsigned int idx)
__rte_experimental int rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len, unsigned int elt_sz)
__rte_experimental int rte_fbarray_find_prev_n_used(struct rte_fbarray *arr, unsigned int start, unsigned int n)
__rte_experimental int rte_fbarray_find_biggest_used(struct rte_fbarray *arr, unsigned int start)
__rte_experimental int rte_fbarray_find_contig_used(struct rte_fbarray *arr, unsigned int start)
__rte_experimental int rte_fbarray_find_rev_contig_used(struct rte_fbarray *arr, unsigned int start)
__rte_experimental void rte_fbarray_dump_metadata(struct rte_fbarray *arr, FILE *f)
__rte_experimental int rte_fbarray_find_prev_free(struct rte_fbarray *arr, unsigned int start)
__rte_experimental int rte_fbarray_find_next_used(struct rte_fbarray *arr, unsigned int start)
__rte_experimental int rte_fbarray_destroy(struct rte_fbarray *arr)
__rte_experimental int rte_fbarray_find_prev_used(struct rte_fbarray *arr, unsigned int start)
__rte_experimental int rte_fbarray_attach(struct rte_fbarray *arr)
__rte_experimental int rte_fbarray_is_used(struct rte_fbarray *arr, unsigned int idx)
__rte_experimental void * rte_fbarray_get(const struct rte_fbarray *arr, unsigned int idx)
__rte_experimental int rte_fbarray_find_rev_contig_free(struct rte_fbarray *arr, unsigned int start)
__rte_experimental int rte_fbarray_set_used(struct rte_fbarray *arr, unsigned int idx)
__rte_experimental int rte_fbarray_detach(struct rte_fbarray *arr)
__rte_experimental int rte_fbarray_find_idx(const struct rte_fbarray *arr, const void *elt)