graph: implement node registration
[dpdk.git] / lib / librte_graph / graph_private.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2020 Marvell International Ltd.
3  */
4
5 #ifndef _RTE_GRAPH_PRIVATE_H_
6 #define _RTE_GRAPH_PRIVATE_H_
7
8 #include <inttypes.h>
9 #include <sys/queue.h>
10
11 #include <rte_common.h>
12 #include <rte_eal.h>
13
14 #include "rte_graph.h"
15
16 /**
17  * @internal
18  *
19  * Structure that holds node internal data.
20  */
21 struct node {
22         STAILQ_ENTRY(node) next;      /**< Next node in the list. */
23         char name[RTE_NODE_NAMESIZE]; /**< Name of the node. */
24         uint64_t flags;               /**< Node configuration flag. */
25         rte_node_process_t process;   /**< Node process function. */
26         rte_node_init_t init;         /**< Node init function. */
27         rte_node_fini_t fini;         /**< Node fini function. */
28         rte_node_t id;                /**< Allocated identifier for the node. */
29         rte_node_t parent_id;         /**< Parent node identifier. */
30         rte_edge_t nb_edges;          /**< Number of edges from this node. */
31         char next_nodes[][RTE_NODE_NAMESIZE]; /**< Names of next nodes. */
32 };
33
34 /* Node functions */
35 STAILQ_HEAD(node_head, node);
36
37 /**
38  * @internal
39  *
40  * Get the head of the node list.
41  *
42  * @return
43  *   Pointer to the node head.
44  */
45 struct node_head *node_list_head_get(void);
46
47 /**
48  * @internal
49  *
50  * Get node pointer from node name.
51  *
52  * @param name
53  *   Pointer to character string containing the node name.
54  *
55  * @return
56  *   Pointer to the node.
57  */
58 struct node *node_from_name(const char *name);
59
60 /* Lock functions */
61 /**
62  * @internal
63  *
64  * Take a lock on the graph internal spin lock.
65  */
66 void graph_spinlock_lock(void);
67
68 /**
69  * @internal
70  *
71  * Release a lock on the graph internal spin lock.
72  */
73 void graph_spinlock_unlock(void);
74
75 #endif /* _RTE_GRAPH_PRIVATE_H_ */