[EXTERNAL] [PATCH] graph: avoid accessing graph list when getting stats
Robin Jarry
rjarry at redhat.com
Fri Mar 29 10:32:43 CET 2024
Kiran Kumar Kokkilagadda, Mar 29, 2024 at 08:44:
> > +167,16 @@ stats_mem_init(struct cluster *cluster,
> >
> > /* Fix up callback */
> > fn = prm->fn;
> > - if (fn == NULL)
> > - fn = graph_cluster_stats_cb;
> > + if (fn == NULL) {
> > + for (int i = 0; i < cluster->nb_graphs; i++) {
> > + const struct rte_graph *graph = cluster->graphs[i]- graph;
> > + if (graph->model == RTE_GRAPH_MODEL_MCORE_DISPATCH)
> > + fn = graph_cluster_stats_cb_dispatch;
> > + else
> > + fn = graph_cluster_stats_cb_rtc;
> > + break;
> > + }
> > + }
> >
>
> Do we need loop here? Just take cluster->graphs[0] and remove break?
I wasn't sure if the cluster could be empty at this point. If it is
guaranteed to contain at least one graph, I'll send a v2 without this
loop.
Thanks!
More information about the dev
mailing list