xref: /dpdk/lib/graph/rte_graph_worker.h (revision a8ca598cd8e696b4135f04cdd86a93b12fd5642a)
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 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #include "rte_graph_model_rtc.h"
14 #include "rte_graph_model_mcore_dispatch.h"
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 __rte_experimental
26 static inline void
27 rte_graph_walk(struct rte_graph *graph)
28 {
29 #if defined(RTE_GRAPH_MODEL_SELECT) && (RTE_GRAPH_MODEL_SELECT == RTE_GRAPH_MODEL_RTC)
30 	rte_graph_walk_rtc(graph);
31 #elif defined(RTE_GRAPH_MODEL_SELECT) && (RTE_GRAPH_MODEL_SELECT == RTE_GRAPH_MODEL_MCORE_DISPATCH)
32 	rte_graph_walk_mcore_dispatch(graph);
33 #else
34 	switch (rte_graph_worker_model_no_check_get(graph)) {
35 	case RTE_GRAPH_MODEL_MCORE_DISPATCH:
36 		rte_graph_walk_mcore_dispatch(graph);
37 		break;
38 	default:
39 		rte_graph_walk_rtc(graph);
40 	}
41 #endif
42 }
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 
48 #endif /* _RTE_GRAPH_WORKER_H_ */
49