DPDK  22.11.5
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 <rte_compat.h>
26 #include <rte_dev.h>
27 
29 RTE_TAILQ_HEAD(rte_class_list, rte_class);
30 
34 struct rte_class {
36  const char *name;
38 };
39 
55 typedef int (*rte_class_cmp_t)(const struct rte_class *cls, const void *data);
56 
79 __rte_experimental
80 struct rte_class *
81 rte_class_find(const struct rte_class *start, rte_class_cmp_t cmp,
82  const void *data);
83 
87 __rte_experimental
88 struct rte_class *
89 rte_class_find_by_name(const char *name);
90 
98 __rte_experimental
99 void rte_class_register(struct rte_class *cls);
100 
108 __rte_experimental
109 void rte_class_unregister(struct rte_class *cls);
110 
116 #define RTE_REGISTER_CLASS(nm, cls) \
117 RTE_INIT_PRIO(classinitfn_ ##nm, CLASS) \
118 {\
119  (cls).name = RTE_STR(nm); \
120  rte_class_register(&cls); \
121 }
122 
123 #define RTE_UNREGISTER_CLASS(nm, cls) \
124 RTE_FINI_PRIO(classfinifn_ ##nm, CLASS) \
125 { \
126  rte_class_unregister(&cls); \
127 }
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #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:333
rte_dev_iterate_t dev_iterate
Definition: rte_class.h:37
const char * name
Definition: rte_class.h:36
int(* rte_class_cmp_t)(const struct rte_class *cls, const void *data)
Definition: rte_class.h:55
__rte_experimental struct rte_class * rte_class_find(const struct rte_class *start, rte_class_cmp_t cmp, const void *data)
RTE_TAILQ_ENTRY(rte_class) next
RTE_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)