On Mon, Jun 5, 2023 at 4:57 PM Zhirun Yan <zhirun....@intel.com> wrote: > > Add new parameter "model" to choose mcore dispatch or rtc model. > And in dispatch model, the node will affinity to worker core successively. > > Note: > RTE_GRAPH_MODEL_SELECT is set to GRAPH_MODEL_RTC by default. Must set > model the same as RTE_GRAPH_MODEL_SELECT If set it as rtc or mcore > dispatch explicitly. GRAPH_MODEL_MCORE_RUNTIME_SELECT means it could > choose by model in runtime. > Only support one RX node for mcore dispatch model in current > implementation. > > ./dpdk-l3fwd-graph -l 8,9,10,11 -n 4 -- -p 0x1 --config="(0,0,9)" -P > --model="dispatch" > > 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> > --- > examples/l3fwd-graph/main.c | 231 +++++++++++++++++++++++++++++------ > lib/graph/rte_graph_worker.h | 3 + > 2 files changed, 196 insertions(+), 38 deletions(-) > > diff --git a/examples/l3fwd-graph/main.c b/examples/l3fwd-graph/main.c > index 5feeab4f0f..4ecc6c9af4 100644 > --- a/examples/l3fwd-graph/main.c > +++ b/examples/l3fwd-graph/main.c > @@ -23,6 +23,12 @@ > #include <rte_cycles.h> > #include <rte_eal.h> > #include <rte_ethdev.h> > +#define GRAPH_MODEL_RTC 0 /* Run-to-completion model, set by default. */ > +#define GRAPH_MODEL_MCORE_DISPATCH 1 /* Dispatch model. */ > +#define GRAPH_MODEL_MCORE_RUNTIME_SELECT 2 /* Support to select model by */ > + /* parsing model in cmdline. */
After moving model to graph->model, Can you check the performance. This may not be needed for l3fwd or if there is not much code duplication, Do the following remove the limitation, #define RTE_GRAPH_MODEL_SELECT RTE_GRAPH_MODEL_RTC. graph_main_loop change to graph_main_rtc_loop #define RTE_GRAPH_MODEL_SELECT GRAPH_MODEL_MCORE_DISPATCH graph_main_loop change to graph_main_mcore_loop Select the following based on runtime option /* Launch per-lcore init on every worker lcore */ rte_eal_mp_remote_launch(graph_main_rtc_loop, NULL, SKIP_MAIN); or rte_eal_mp_remote_launch(graph_main_mcore_loop, NULL, SKIP_MAIN); > memset(&rewrite_data, 0, sizeof(rewrite_data)); > rewrite_len = sizeof(rewrite_data); > diff --git a/lib/graph/rte_graph_worker.h b/lib/graph/rte_graph_worker.h > index 541c373cb1..19b4c1514f 100644 > --- a/lib/graph/rte_graph_worker.h > +++ b/lib/graph/rte_graph_worker.h > @@ -26,6 +26,9 @@ __rte_experimental > static inline void > rte_graph_walk(struct rte_graph *graph) > { > +#define RTE_GRAPH_MODEL_RTC 0 > +#define RTE_GRAPH_MODEL_MCORE_DISPATCH 1 No need for duplicate enum. Please remove enum make this as in public header file. > + Add comment here, On how application uses this, aka. before inlcuding the worker header file #define RTE_GRAPH_MODEL_SELECT RTE_GRAPH_MODEL_RTC. Please change the text as needed. > #if !defined(RTE_GRAPH_MODEL_SELECT) || RTE_GRAPH_MODEL_SELECT == > RTE_GRAPH_MODEL_RTC > rte_graph_walk_rtc(graph); > #elif RTE_GRAPH_MODEL_SELECT == RTE_GRAPH_MODEL_MCORE_DISPATCH > -- > 2.37.2 >