DPDK  23.03.0
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_rwlock.h>
40 
41 #define RTE_FBARRAY_NAME_LEN 64
42 
43 struct rte_fbarray {
44  char name[RTE_FBARRAY_NAME_LEN];
45  unsigned int count;
46  unsigned int len;
47  unsigned int elt_sz;
48  void *data;
49  rte_rwlock_t rwlock;
50 };
51 
76 int
77 rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,
78  unsigned int elt_sz);
79 
80 
98 int
99 rte_fbarray_attach(struct rte_fbarray *arr);
100 
101 
119 int
120 rte_fbarray_destroy(struct rte_fbarray *arr);
121 
122 
137 int
138 rte_fbarray_detach(struct rte_fbarray *arr);
139 
140 
154 void *
155 rte_fbarray_get(const struct rte_fbarray *arr, unsigned int idx);
156 
157 
171 int
172 rte_fbarray_find_idx(const struct rte_fbarray *arr, const void *elt);
173 
174 
188 int
189 rte_fbarray_set_used(struct rte_fbarray *arr, unsigned int idx);
190 
191 
205 int
206 rte_fbarray_set_free(struct rte_fbarray *arr, unsigned int idx);
207 
208 
223 int
224 rte_fbarray_is_used(struct rte_fbarray *arr, unsigned int idx);
225 
226 
240 int
241 rte_fbarray_find_next_free(struct rte_fbarray *arr, unsigned int start);
242 
243 
257 int
258 rte_fbarray_find_next_used(struct rte_fbarray *arr, unsigned int start);
259 
260 
277 int
278 rte_fbarray_find_next_n_free(struct rte_fbarray *arr, unsigned int start,
279  unsigned int n);
280 
281 
298 int
299 rte_fbarray_find_next_n_used(struct rte_fbarray *arr, unsigned int start,
300  unsigned int n);
301 
302 
316 int
317 rte_fbarray_find_contig_free(struct rte_fbarray *arr,
318  unsigned int start);
319 
320 
334 int
335 rte_fbarray_find_contig_used(struct rte_fbarray *arr, unsigned int start);
336 
350 int
351 rte_fbarray_find_prev_free(struct rte_fbarray *arr, unsigned int start);
352 
353 
367 int
368 rte_fbarray_find_prev_used(struct rte_fbarray *arr, unsigned int start);
369 
370 
388 int
389 rte_fbarray_find_prev_n_free(struct rte_fbarray *arr, unsigned int start,
390  unsigned int n);
391 
392 
410 int
411 rte_fbarray_find_prev_n_used(struct rte_fbarray *arr, unsigned int start,
412  unsigned int n);
413 
414 
429 int
430 rte_fbarray_find_rev_contig_free(struct rte_fbarray *arr,
431  unsigned int start);
432 
433 
448 int
449 rte_fbarray_find_rev_contig_used(struct rte_fbarray *arr, unsigned int start);
450 
451 
465 int
466 rte_fbarray_find_biggest_free(struct rte_fbarray *arr, unsigned int start);
467 
468 
482 int
483 rte_fbarray_find_biggest_used(struct rte_fbarray *arr, unsigned int start);
484 
485 
500 int
501 rte_fbarray_find_rev_biggest_free(struct rte_fbarray *arr, unsigned int start);
502 
503 
518 int
519 rte_fbarray_find_rev_biggest_used(struct rte_fbarray *arr, unsigned int start);
520 
521 
531 void
532 rte_fbarray_dump_metadata(struct rte_fbarray *arr, FILE *f);
533 
534 #ifdef __cplusplus
535 }
536 #endif
537 
538 #endif /* RTE_FBARRAY_H */
int rte_fbarray_find_contig_free(struct rte_fbarray *arr, unsigned int start)
int rte_fbarray_find_idx(const struct rte_fbarray *arr, const void *elt)
int rte_fbarray_find_biggest_used(struct rte_fbarray *arr, unsigned int start)
int rte_fbarray_find_next_n_used(struct rte_fbarray *arr, unsigned int start, unsigned int n)
int rte_fbarray_find_next_free(struct rte_fbarray *arr, unsigned int start)
int rte_fbarray_attach(struct rte_fbarray *arr)
int rte_fbarray_find_prev_n_used(struct rte_fbarray *arr, unsigned int start, unsigned int n)
int rte_fbarray_find_contig_used(struct rte_fbarray *arr, unsigned int start)
int rte_fbarray_find_prev_n_free(struct rte_fbarray *arr, unsigned int start, unsigned int n)
void rte_fbarray_dump_metadata(struct rte_fbarray *arr, FILE *f)
int rte_fbarray_is_used(struct rte_fbarray *arr, unsigned int idx)
int rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len, unsigned int elt_sz)
int rte_fbarray_set_free(struct rte_fbarray *arr, unsigned int idx)
int rte_fbarray_set_used(struct rte_fbarray *arr, unsigned int idx)
int rte_fbarray_find_rev_biggest_used(struct rte_fbarray *arr, unsigned int start)
int rte_fbarray_find_rev_contig_free(struct rte_fbarray *arr, unsigned int start)
int rte_fbarray_find_prev_used(struct rte_fbarray *arr, unsigned int start)
int rte_fbarray_find_rev_contig_used(struct rte_fbarray *arr, unsigned int start)
int rte_fbarray_detach(struct rte_fbarray *arr)
int rte_fbarray_find_rev_biggest_free(struct rte_fbarray *arr, unsigned int start)
int rte_fbarray_find_next_n_free(struct rte_fbarray *arr, unsigned int start, unsigned int n)
int rte_fbarray_find_biggest_free(struct rte_fbarray *arr, unsigned int start)
void * rte_fbarray_get(const struct rte_fbarray *arr, unsigned int idx)
int rte_fbarray_destroy(struct rte_fbarray *arr)
int rte_fbarray_find_next_used(struct rte_fbarray *arr, unsigned int start)
int rte_fbarray_find_prev_free(struct rte_fbarray *arr, unsigned int start)