DPDK 26.11.0-rc1
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
92static inline void
93rte_graph_walk_mcore_dispatch(struct rte_graph *graph)
94{
95 const uint16_t nwords = graph->nb_sched_words;
96 struct rte_node *node;
97 uint16_t word, bit;
98
99 if (graph->dispatch.wq != NULL)
100 __rte_graph_mcore_dispatch_sched_wq_process(graph);
101
102 /* Seed pending bitmap with source nodes bound to this lcore */
103 for (word = 0; word < nwords; word++)
104 graph->pending[word] |= graph->src_pending[word];
105
106 for (;;) {
107 /* find first word with any pending bit */
108 for (word = 0; word < nwords; word++)
109 if (graph->pending[word])
110 break;
111 if (word == nwords)
112 break; /* no more pending nodes */
113
114 bit = rte_ctz64(graph->pending[word]);
115 graph->pending[word] &= ~(1ULL << bit);
116 node = __rte_graph_pending_node(graph, word, bit);
117
118 /* Schedule the node until all task/objs are done */
119 if (node->dispatch.lcore_id != RTE_MAX_LCORE &&
120 graph->dispatch.lcore_id != node->dispatch.lcore_id &&
121 graph->dispatch.rq != NULL &&
122 __rte_graph_mcore_dispatch_sched_node_enqueue(node, graph->dispatch.rq))
123 continue;
124
125 __rte_node_process(graph, node);
126 }
127}
128
129#ifdef __cplusplus
130}
131#endif
132
133#endif /* _RTE_GRAPH_MODEL_MCORE_DISPATCH_H_ */
static unsigned int rte_ctz64(uint64_t v)
Definition: rte_bitops.h:1006
#define __rte_noinline
Definition: rte_common.h:547
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)