DPDK 25.03.0-rc0
rte_graph_model_mcore_dispatch.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2023 Intel Corporation
3 */
4
5#ifndef _RTE_GRAPH_MODEL_MCORE_DISPATCH_H_
6#define _RTE_GRAPH_MODEL_MCORE_DISPATCH_H_
7
15#include <rte_errno.h>
16#include <rte_mempool.h>
17#include <rte_memzone.h>
18#include <rte_ring.h>
19
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#define RTE_GRAPH_SCHED_WQ_SIZE_MULTIPLIER 8
27#define RTE_GRAPH_SCHED_WQ_SIZE(nb_nodes) \
28 ((typeof(nb_nodes))((nb_nodes) * RTE_GRAPH_SCHED_WQ_SIZE_MULTIPLIER))
29
47bool __rte_noinline __rte_graph_mcore_dispatch_sched_node_enqueue(struct rte_node *node,
48 struct rte_graph_rq_head *rq);
49
62void __rte_graph_mcore_dispatch_sched_wq_process(struct rte_graph *graph);
63
77 unsigned int lcore_id);
78
88static inline void
89rte_graph_walk_mcore_dispatch(struct rte_graph *graph)
90{
91 const rte_graph_off_t *cir_start = graph->cir_start;
92 const rte_node_t mask = graph->cir_mask;
93 uint32_t head = graph->head;
94 struct rte_node *node;
95
96 if (graph->dispatch.wq != NULL)
97 __rte_graph_mcore_dispatch_sched_wq_process(graph);
98
99 while (likely(head != graph->tail)) {
100 node = (struct rte_node *)RTE_PTR_ADD(graph, cir_start[(int32_t)head++]);
101
102 /* skip the src nodes which not bind with current worker */
103 if ((int32_t)head < 1 && node->dispatch.lcore_id != graph->dispatch.lcore_id)
104 continue;
105
106 /* Schedule the node until all task/objs are done */
107 if (node->dispatch.lcore_id != RTE_MAX_LCORE &&
108 graph->dispatch.lcore_id != node->dispatch.lcore_id &&
109 graph->dispatch.rq != NULL &&
110 __rte_graph_mcore_dispatch_sched_node_enqueue(node, graph->dispatch.rq))
111 continue;
112
113 __rte_node_process(graph, node);
114
115 head = likely((int32_t)head > 0) ? head & mask : head;
116 }
117
118 graph->tail = 0;
119}
120
121#ifdef __cplusplus
122}
123#endif
124
125#endif /* _RTE_GRAPH_MODEL_MCORE_DISPATCH_H_ */
#define likely(x)
#define __rte_noinline
Definition: rte_common.h:419
#define RTE_PTR_ADD(ptr, x)
Definition: rte_common.h:469
uint32_t rte_node_t
Definition: rte_graph.h:41
uint32_t rte_graph_off_t
Definition: rte_graph.h:40
int rte_graph_model_mcore_dispatch_node_lcore_affinity_set(const char *name, unsigned int lcore_id)
static void rte_graph_walk_mcore_dispatch(struct rte_graph *graph)