DPDK
22.11.5
lib
eal
include
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
15
extern
"C"
{
16
#endif
17
18
#include <stdio.h>
19
#include <
rte_debug.h
>
20
22
struct
rte_tailq_entry
{
23
RTE_TAILQ_ENTRY
(
rte_tailq_entry
) next;
24
void
*
data
;
25
};
27
RTE_TAILQ_HEAD
(rte_tailq_entry_head,
rte_tailq_entry
);
28
29
#define RTE_TAILQ_NAMESIZE 32
30
39
struct
rte_tailq_head
{
40
struct
rte_tailq_entry_head
tailq_head
;
41
char
name[RTE_TAILQ_NAMESIZE];
42
};
43
44
struct
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
85
void
rte_dump_tailq
(FILE *f);
86
100
struct
rte_tailq_head
*
rte_eal_tailq_lookup
(
const
char
*name);
101
118
int
rte_eal_tailq_register
(
struct
rte_tailq_elem *t);
119
120
#define EAL_REGISTER_TAILQ(t) \
121
RTE_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_ */
rte_debug.h
rte_dump_tailq
void rte_dump_tailq(FILE *f)
rte_eal_tailq_register
int rte_eal_tailq_register(struct rte_tailq_elem *t)
rte_eal_tailq_lookup
struct rte_tailq_head * rte_eal_tailq_lookup(const char *name)
RTE_TAILQ_HEAD
RTE_TAILQ_HEAD(rte_tailq_entry_head, rte_tailq_entry)
rte_tailq_entry
Definition:
rte_tailq.h:22
rte_tailq_entry::RTE_TAILQ_ENTRY
RTE_TAILQ_ENTRY(rte_tailq_entry) next
rte_tailq_entry::data
void * data
Definition:
rte_tailq.h:24
rte_tailq_head
Definition:
rte_tailq.h:39
rte_tailq_head::tailq_head
struct rte_tailq_entry_head tailq_head
Definition:
rte_tailq.h:40
Generated by
1.9.4