> Node process is a single and reusable block, move the code into an inline > function. > > Signed-off-by: Haiyue Wang <haiyue.w...@intel.com> > Signed-off-by: Cunming Liang <cunming.li...@intel.com> > Signed-off-by: Zhirun Yan <zhirun....@intel.com> > --- > lib/graph/rte_graph_model_rtc.h | 20 ++--------------- > lib/graph/rte_graph_worker_common.h | 33 > +++++++++++++++++++++++++++++ > 2 files changed, 35 insertions(+), 18 deletions(-) > > diff --git a/lib/graph/rte_graph_model_rtc.h > b/lib/graph/rte_graph_model_rtc.h > index 665560f831..0dcb7151e9 100644 > --- a/lib/graph/rte_graph_model_rtc.h > +++ b/lib/graph/rte_graph_model_rtc.h > @@ -20,9 +20,6 @@ rte_graph_walk_rtc(struct rte_graph *graph) > const rte_node_t mask = graph->cir_mask; > uint32_t head = graph->head; > struct rte_node *node; > - uint64_t start; > - uint16_t rc; > - void **objs; > > /* > * Walk on the source node(s) ((cir_start - head) -> cir_start) and > then > @@ -41,21 +38,8 @@ rte_graph_walk_rtc(struct rte_graph *graph) > */ > while (likely(head != graph->tail)) { > node = (struct rte_node *)RTE_PTR_ADD(graph, > cir_start[(int32_t)head++]); > - RTE_ASSERT(node->fence == RTE_GRAPH_FENCE); > - objs = node->objs; > - rte_prefetch0(objs); > - > - if (rte_graph_has_stats_feature()) { > - start = rte_rdtsc();
Since we are refactoring this function could you change rte_rdtsc() to rte_rdtsc_precise(). > - rc = node->process(graph, node, objs, node->idx); > - node->total_cycles += rte_rdtsc() - start; > - node->total_calls++; > - node->total_objs += rc; > - } else { > - node->process(graph, node, objs, node->idx); > - } > - node->idx = 0; > - head = likely((int32_t)head > 0) ? head & mask : > head; > + __rte_node_process(graph, node); > + head = likely((int32_t)head > 0) ? head & mask : head; > } > graph->tail = 0; > } > diff --git a/lib/graph/rte_graph_worker_common.h > b/lib/graph/rte_graph_worker_common.h > index b58f8f6947..41428974db 100644 > --- a/lib/graph/rte_graph_worker_common.h > +++ b/lib/graph/rte_graph_worker_common.h > @@ -130,6 +130,39 @@ void __rte_node_stream_alloc_size(struct > rte_graph *graph, > > /* Fast path helper functions */ > > +/** > + * @internal > + * > + * Enqueue a given node to the tail of the graph reel. > + * > + * @param graph > + * Pointer Graph object. > + * @param node > + * Pointer to node object to be enqueued. > + */ > +static __rte_always_inline void > +__rte_node_process(struct rte_graph *graph, struct rte_node *node) > +{ > + uint64_t start; > + uint16_t rc; > + void **objs; > + > + RTE_ASSERT(node->fence == RTE_GRAPH_FENCE); > + objs = node->objs; > + rte_prefetch0(objs); > + > + if (rte_graph_has_stats_feature()) { > + start = rte_rdtsc(); > + rc = node->process(graph, node, objs, node->idx); > + node->total_cycles += rte_rdtsc() - start; > + node->total_calls++; > + node->total_objs += rc; > + } else { > + node->process(graph, node, objs, node->idx); > + } > + node->idx = 0; > +} > + > /** > * @internal > * > -- > 2.37.2