DPDK 21.11.9
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
22extern "C" {
23#endif
24
25#include <rte_dev.h>
26
28RTE_TAILQ_HEAD(rte_class_list, rte_class);
29
33struct rte_class {
35 const char *name;
37};
38
54typedef int (*rte_class_cmp_t)(const struct rte_class *cls, const void *data);
55
78__rte_experimental
79struct rte_class *
80rte_class_find(const struct rte_class *start, rte_class_cmp_t cmp,
81 const void *data);
82
86__rte_experimental
87struct rte_class *
89
97__rte_experimental
98void rte_class_register(struct rte_class *cls);
99
107__rte_experimental
109
115#define RTE_REGISTER_CLASS(nm, cls) \
116RTE_INIT_PRIO(classinitfn_ ##nm, CLASS) \
117{\
118 (cls).name = RTE_STR(nm); \
119 rte_class_register(&cls); \
120}
121
122#define RTE_UNREGISTER_CLASS(nm, cls) \
123RTE_FINI_PRIO(classfinifn_ ##nm, CLASS) \
124{ \
125 rte_class_unregister(&cls); \
126}
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif /* _RTE_CLASS_H_ */
__rte_experimental struct rte_class * rte_class_find_by_name(const char *name)
__rte_experimental struct rte_class * rte_class_find(const struct rte_class *start, rte_class_cmp_t cmp, const void *data)
__rte_experimental void rte_class_register(struct rte_class *cls)
__rte_experimental void rte_class_unregister(struct rte_class *cls)
int(* rte_class_cmp_t)(const struct rte_class *cls, const void *data)
Definition: rte_class.h:54
RTE_TAILQ_HEAD(rte_class_list, rte_class)
void *(* rte_dev_iterate_t)(const void *start, const char *devstr, const struct rte_dev_iterator *it)
Definition: rte_dev.h:269
rte_dev_iterate_t dev_iterate
Definition: rte_class.h:36
const char * name
Definition: rte_class.h:35
RTE_TAILQ_ENTRY(rte_class) next