DPDK  19.08.2
rte_class.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2018 GaĆ«tan Rivet
3  */
4 
5 #ifndef _RTE_CLASS_H_
6 #define _RTE_CLASS_H_
7 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #include <sys/queue.h>
26 
27 #include <rte_dev.h>
28 
30 TAILQ_HEAD(rte_class_list, rte_class);
31 
35 struct rte_class {
36  TAILQ_ENTRY(rte_class) next;
37  const char *name;
39 };
40 
56 typedef int (*rte_class_cmp_t)(const struct rte_class *cls, const void *data);
57 
80 __rte_experimental
81 struct rte_class *
82 rte_class_find(const struct rte_class *start, rte_class_cmp_t cmp,
83  const void *data);
84 
88 __rte_experimental
89 struct rte_class *
90 rte_class_find_by_name(const char *name);
91 
99 __rte_experimental
100 void rte_class_register(struct rte_class *cls);
101 
109 __rte_experimental
110 void rte_class_unregister(struct rte_class *cls);
111 
117 #define RTE_REGISTER_CLASS(nm, cls) \
118 RTE_INIT_PRIO(classinitfn_ ##nm, CLASS) \
119 {\
120  (cls).name = RTE_STR(nm); \
121  rte_class_register(&cls); \
122 }
123 
124 #define RTE_UNREGISTER_CLASS(nm, cls) \
125 RTE_FINI_PRIO(classfinifn_ ##nm, CLASS) \
126 { \
127  rte_class_unregister(&cls); \
128 }
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif /* _RTE_CLASS_H_ */
void *(* rte_dev_iterate_t)(const void *start, const char *devstr, const struct rte_dev_iterator *it)
Definition: rte_dev.h:288
rte_dev_iterate_t dev_iterate
Definition: rte_class.h:38
const char * name
Definition: rte_class.h:37
int(* rte_class_cmp_t)(const struct rte_class *cls, const void *data)
Definition: rte_class.h:56
__rte_experimental struct rte_class * rte_class_find(const struct rte_class *start, rte_class_cmp_t cmp, const void *data)
TAILQ_HEAD(rte_class_list, rte_class)
__rte_experimental void rte_class_register(struct rte_class *cls)
__rte_experimental void rte_class_unregister(struct rte_class *cls)
__rte_experimental struct rte_class * rte_class_find_by_name(const char *name)
TAILQ_ENTRY(rte_class) next