DPDK  21.11.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_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 int
103 rte_sec_fbarray_attach(struct rte_fbarray *arr,
104  const int switch_pri_and_sec, const int sec_idx);
105 
106 
124 int
125 rte_fbarray_destroy(struct rte_fbarray *arr);
126 
127 int
128 rte_sec_fbarray_destroy(struct rte_fbarray *arr, const int sec_idx);
129 
144 int
145 rte_fbarray_detach(struct rte_fbarray *arr);
146 
147 
161 void *
162 rte_fbarray_get(const struct rte_fbarray *arr, unsigned int idx);
163 
164 
178 int
179 rte_fbarray_find_idx(const struct rte_fbarray *arr, const void *elt);
180 
181 
195 int
196 rte_fbarray_set_used(struct rte_fbarray *arr, unsigned int idx);
197 
198 
212 int
213 rte_fbarray_set_free(struct rte_fbarray *arr, unsigned int idx);
214 
215 
230 int
231 rte_fbarray_is_used(struct rte_fbarray *arr, unsigned int idx);
232 
233 
247 int
248 rte_fbarray_find_next_free(struct rte_fbarray *arr, unsigned int start);
249 
250 
264 int
265 rte_fbarray_find_next_used(struct rte_fbarray *arr, unsigned int start);
266 
267 
284 int
285 rte_fbarray_find_next_n_free(struct rte_fbarray *arr, unsigned int start,
286  unsigned int n);
287 
288 
305 int
306 rte_fbarray_find_next_n_used(struct rte_fbarray *arr, unsigned int start,
307  unsigned int n);
308 
309 
323 int
324 rte_fbarray_find_contig_free(struct rte_fbarray *arr,
325  unsigned int start);
326 
327 
341 int
342 rte_fbarray_find_contig_used(struct rte_fbarray *arr, unsigned int start);
343 
357 int
358 rte_fbarray_find_prev_free(struct rte_fbarray *arr, unsigned int start);
359 
360 
374 int
375 rte_fbarray_find_prev_used(struct rte_fbarray *arr, unsigned int start);
376 
377 
395 int
396 rte_fbarray_find_prev_n_free(struct rte_fbarray *arr, unsigned int start,
397  unsigned int n);
398 
399 
417 int
418 rte_fbarray_find_prev_n_used(struct rte_fbarray *arr, unsigned int start,
419  unsigned int n);
420 
421 
436 int
437 rte_fbarray_find_rev_contig_free(struct rte_fbarray *arr,
438  unsigned int start);
439 
440 
455 int
456 rte_fbarray_find_rev_contig_used(struct rte_fbarray *arr, unsigned int start);
457 
458 
472 int
473 rte_fbarray_find_biggest_free(struct rte_fbarray *arr, unsigned int start);
474 
475 
489 int
490 rte_fbarray_find_biggest_used(struct rte_fbarray *arr, unsigned int start);
491 
492 
507 int
508 rte_fbarray_find_rev_biggest_free(struct rte_fbarray *arr, unsigned int start);
509 
510 
525 int
526 rte_fbarray_find_rev_biggest_used(struct rte_fbarray *arr, unsigned int start);
527 
528 
538 void
539 rte_fbarray_dump_metadata(struct rte_fbarray *arr, FILE *f);
540 
541 #ifdef __cplusplus
542 }
543 #endif
544 
545 #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)