xref: /dpdk/lib/graph/rte_graph_worker.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2020 Marvell International Ltd.
3  * Copyright(C) 2023 Intel Corporation
4  */
5 
6 #ifndef _RTE_GRAPH_WORKER_H_
7 #define _RTE_GRAPH_WORKER_H_
8 
9 #include "rte_graph_model_rtc.h"
10 #include "rte_graph_model_mcore_dispatch.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /**
17  * Perform graph walk on the circular buffer and invoke the process function
18  * of the nodes and collect the stats.
19  *
20  * @param graph
21  *   Graph pointer returned from rte_graph_lookup function.
22  *
23  * @see rte_graph_lookup()
24  */
25 static inline void
26 rte_graph_walk(struct rte_graph *graph)
27 {
28 #if defined(RTE_GRAPH_MODEL_SELECT) && (RTE_GRAPH_MODEL_SELECT == RTE_GRAPH_MODEL_RTC)
29 	rte_graph_walk_rtc(graph);
30 #elif defined(RTE_GRAPH_MODEL_SELECT) && (RTE_GRAPH_MODEL_SELECT == RTE_GRAPH_MODEL_MCORE_DISPATCH)
31 	rte_graph_walk_mcore_dispatch(graph);
32 #else
33 	switch (rte_graph_worker_model_no_check_get(graph)) {
34 	case RTE_GRAPH_MODEL_MCORE_DISPATCH:
35 		rte_graph_walk_mcore_dispatch(graph);
36 		break;
37 	default:
38 		rte_graph_walk_rtc(graph);
39 	}
40 #endif
41 }
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 
47 #endif /* _RTE_GRAPH_WORKER_H_ */
48