DPDK  21.11.8
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 int
78 rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,
79  unsigned int elt_sz);
80 
81 
99 int
100 rte_fbarray_attach(struct rte_fbarray *arr);
101 
102 
120 int
121 rte_fbarray_destroy(struct rte_fbarray *arr);
122 
123 
138 int
139 rte_fbarray_detach(struct rte_fbarray *arr);
140 
141 
155 void *
156 rte_fbarray_get(const struct rte_fbarray *arr, unsigned int idx);
157 
158 
172 int
173 rte_fbarray_find_idx(const struct rte_fbarray *arr, const void *elt);
174 
175 
189 int
190 rte_fbarray_set_used(struct rte_fbarray *arr, unsigned int idx);
191 
192 
206 int
207 rte_fbarray_set_free(struct rte_fbarray *arr, unsigned int idx);
208 
209 
224 int
225 rte_fbarray_is_used(struct rte_fbarray *arr, unsigned int idx);
226 
227 
241 int
242 rte_fbarray_find_next_free(struct rte_fbarray *arr, unsigned int start);
243 
244 
258 int
259 rte_fbarray_find_next_used(struct rte_fbarray *arr, unsigned int start);
260 
261 
278 int
279 rte_fbarray_find_next_n_free(struct rte_fbarray *arr, unsigned int start,
280  unsigned int n);
281 
282 
299 int
300 rte_fbarray_find_next_n_used(struct rte_fbarray *arr, unsigned int start,
301  unsigned int n);
302 
303 
317 int
318 rte_fbarray_find_contig_free(struct rte_fbarray *arr,
319  unsigned int start);
320 
321 
335 int
336 rte_fbarray_find_contig_used(struct rte_fbarray *arr, unsigned int start);
337 
351 int
352 rte_fbarray_find_prev_free(struct rte_fbarray *arr, unsigned int start);
353 
354 
368 int
369 rte_fbarray_find_prev_used(struct rte_fbarray *arr, unsigned int start);
370 
371 
389 int
390 rte_fbarray_find_prev_n_free(struct rte_fbarray *arr, unsigned int start,
391  unsigned int n);
392 
393 
411 int
412 rte_fbarray_find_prev_n_used(struct rte_fbarray *arr, unsigned int start,
413  unsigned int n);
414 
415 
430 int
431 rte_fbarray_find_rev_contig_free(struct rte_fbarray *arr,
432  unsigned int start);
433 
434 
449 int
450 rte_fbarray_find_rev_contig_used(struct rte_fbarray *arr, unsigned int start);
451 
452 
466 int
467 rte_fbarray_find_biggest_free(struct rte_fbarray *arr, unsigned int start);
468 
469 
483 int
484 rte_fbarray_find_biggest_used(struct rte_fbarray *arr, unsigned int start);
485 
486 
501 int
502 rte_fbarray_find_rev_biggest_free(struct rte_fbarray *arr, unsigned int start);
503 
504 
519 int
520 rte_fbarray_find_rev_biggest_used(struct rte_fbarray *arr, unsigned int start);
521 
522 
532 void
533 rte_fbarray_dump_metadata(struct rte_fbarray *arr, FILE *f);
534 
535 #ifdef __cplusplus
536 }
537 #endif
538 
539 #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)