DPDK  23.07.0
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 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include <rte_errno.h>
24 #include <rte_mempool.h>
25 #include <rte_memzone.h>
26 #include <rte_ring.h>
27 
29 
30 #define RTE_GRAPH_SCHED_WQ_SIZE_MULTIPLIER 8
31 #define RTE_GRAPH_SCHED_WQ_SIZE(nb_nodes) \
32  ((typeof(nb_nodes))((nb_nodes) * RTE_GRAPH_SCHED_WQ_SIZE_MULTIPLIER))
33 
51 __rte_experimental
52 bool __rte_noinline __rte_graph_mcore_dispatch_sched_node_enqueue(struct rte_node *node,
53  struct rte_graph_rq_head *rq);
54 
67 __rte_experimental
68 void __rte_graph_mcore_dispatch_sched_wq_process(struct rte_graph *graph);
69 
82 __rte_experimental
84  unsigned int lcore_id);
85 
95 __rte_experimental
96 static inline void
97 rte_graph_walk_mcore_dispatch(struct rte_graph *graph)
98 {
99  const rte_graph_off_t *cir_start = graph->cir_start;
100  const rte_node_t mask = graph->cir_mask;
101  uint32_t head = graph->head;
102  struct rte_node *node;
103 
104  if (graph->dispatch.wq != NULL)
105  __rte_graph_mcore_dispatch_sched_wq_process(graph);
106 
107  while (likely(head != graph->tail)) {
108  node = (struct rte_node *)RTE_PTR_ADD(graph, cir_start[(int32_t)head++]);
109 
110  /* skip the src nodes which not bind with current worker */
111  if ((int32_t)head < 0 && node->dispatch.lcore_id != graph->dispatch.lcore_id)
112  continue;
113 
114  /* Schedule the node until all task/objs are done */
115  if (node->dispatch.lcore_id != RTE_MAX_LCORE &&
116  graph->dispatch.lcore_id != node->dispatch.lcore_id &&
117  graph->dispatch.rq != NULL &&
118  __rte_graph_mcore_dispatch_sched_node_enqueue(node, graph->dispatch.rq))
119  continue;
120 
121  __rte_node_process(graph, node);
122 
123  head = likely((int32_t)head > 0) ? head & mask : head;
124  }
125 
126  graph->tail = 0;
127 }
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #endif /* _RTE_GRAPH_MODEL_MCORE_DISPATCH_H_ */
uint32_t rte_node_t
Definition: rte_graph.h:45
#define likely(x)
#define __rte_noinline
Definition: rte_common.h:260
#define RTE_PTR_ADD(ptr, x)
Definition: rte_common.h:290
__rte_experimental int rte_graph_model_mcore_dispatch_node_lcore_affinity_set(const char *name, unsigned int lcore_id)
static __rte_experimental void rte_graph_walk_mcore_dispatch(struct rte_graph *graph)
uint32_t rte_graph_off_t
Definition: rte_graph.h:44