DPDK 22.11.6
rte_tailq.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
3 */
4
5#ifndef _RTE_TAILQ_H_
6#define _RTE_TAILQ_H_
7
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#include <stdio.h>
19#include <rte_debug.h>
20
24 void *data;
25};
27RTE_TAILQ_HEAD(rte_tailq_entry_head, rte_tailq_entry);
28
29#define RTE_TAILQ_NAMESIZE 32
30
40 struct rte_tailq_entry_head tailq_head;
41 char name[RTE_TAILQ_NAMESIZE];
42};
43
44struct rte_tailq_elem {
49 struct rte_tailq_head *head;
50 RTE_TAILQ_ENTRY(rte_tailq_elem) next;
51 const char name[RTE_TAILQ_NAMESIZE];
52};
53
57#define RTE_TAILQ_CAST(tailq_entry, struct_name) \
58 (struct struct_name *)&(tailq_entry)->tailq_head
59
76#define RTE_TAILQ_LOOKUP(name, struct_name) \
77 RTE_TAILQ_CAST(rte_eal_tailq_lookup(name), struct_name)
78
85void rte_dump_tailq(FILE *f);
86
100struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
101
118int rte_eal_tailq_register(struct rte_tailq_elem *t);
119
120#define EAL_REGISTER_TAILQ(t) \
121RTE_INIT(tailqinitfn_ ##t) \
122{ \
123 if (rte_eal_tailq_register(&t) < 0) \
124 rte_panic("Cannot initialize tailq: %s\n", t.name); \
125}
126
127/* This macro permits both remove and free var within the loop safely.*/
128#define RTE_TAILQ_FOREACH_SAFE(var, head, field, tvar) \
129 for ((var) = RTE_TAILQ_FIRST((head)); \
130 (var) && ((tvar) = RTE_TAILQ_NEXT((var), field), 1); \
131 (var) = (tvar))
132
133#ifdef __cplusplus
134}
135#endif
136
137#endif /* _RTE_TAILQ_H_ */
void rte_dump_tailq(FILE *f)
int rte_eal_tailq_register(struct rte_tailq_elem *t)
struct rte_tailq_head * rte_eal_tailq_lookup(const char *name)
RTE_TAILQ_HEAD(rte_tailq_entry_head, rte_tailq_entry)
Definition: rte_tailq.h:22
RTE_TAILQ_ENTRY(rte_tailq_entry) next
void * data
Definition: rte_tailq.h:24
struct rte_tailq_entry_head tailq_head
Definition: rte_tailq.h:40