[PATCH v1 03/13] graph: add macro to walk on graph circular buffer
Yan, Zhirun
zhirun.yan at intel.com
Fri Feb 24 07:30:13 CET 2023
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk at gmail.com>
> Sent: Monday, February 20, 2023 9:45 PM
> To: Yan, Zhirun <zhirun.yan at intel.com>
> Cc: dev at dpdk.org; jerinj at marvell.com; kirankumark at marvell.com;
> ndabilpuram at marvell.com; Liang, Cunming <cunming.liang at intel.com>; Wang,
> Haiyue <haiyue.wang at intel.com>
> Subject: Re: [PATCH v1 03/13] graph: add macro to walk on graph circular buffer
>
> On Thu, Nov 17, 2022 at 10:40 AM Zhirun Yan <zhirun.yan at intel.com> wrote:
> >
> > It is common to walk on graph circular buffer and use macro to make it
> > reusable for other worker models.
> >
> > Signed-off-by: Haiyue Wang <haiyue.wang at intel.com>
> > Signed-off-by: Cunming Liang <cunming.liang at intel.com>
> > Signed-off-by: Zhirun Yan <zhirun.yan at intel.com>
> > ---
> > lib/graph/rte_graph_model_rtc.h | 23 ++---------------------
> > lib/graph/rte_graph_worker_common.h | 23 +++++++++++++++++++++++
> > 2 files changed, 25 insertions(+), 21 deletions(-)
>
> > +/**
> > + * Macro to walk on the source node(s) ((cir_start - head) ->
> > +cir_start)
> > + * and then on the pending streams
> > + * (cir_start -> (cir_start + mask) -> cir_start)
> > + * in a circular buffer fashion.
> > + *
> > + * +-----+ <= cir_start - head [number of source nodes]
> > + * | |
> > + * | ... | <= source nodes
> > + * | |
> > + * +-----+ <= cir_start [head = 0] [tail = 0]
> > + * | |
> > + * | ... | <= pending streams
> > + * | |
> > + * +-----+ <= cir_start + mask
> > + */
> > +#define rte_graph_walk_node(graph, head, node) \
> > + for ((node) = RTE_PTR_ADD((graph), (graph)->cir_start[(int32_t)(head)]);
> \
> > + likely((head) != (graph)->tail); \
> > + (head)++, \
> > + (node) = RTE_PTR_ADD((graph), (graph)->cir_start[(int32_t)(head)]),
> \
>
> This is an additional assignment compare to original while() based version. Right?
> No need to generalize with performance impact.
Yes, you are right. I will change the macro to use the original while loop.
>
>
> > + (head) = likely((int32_t)(head) > 0) ? (head) &
> > + (graph)->cir_mask : (head))
> > +
> > /**
> > * @internal
> > *
> > --
> > 2.25.1
> >
More information about the dev
mailing list