[dpdk-dev] [PATCH v4 05/29] graph: implement internal graph operation helpers

Jerin Jacob jerinjacobk at gmail.com
Tue Apr 7 15:31:28 CEST 2020


On Tue, Apr 7, 2020 at 6:24 PM Andrzej Ostruszka <amo at semihalf.com> wrote:

> >
> >>> +
> >>> +     STAILQ_FOREACH(graph_node, &graph->node_list, next) {
> >>> +             if (graph_node->node->flags & RTE_NODE_SOURCE_F) {
> >>> +                     if (graph_node->node->nb_edges == 0)
> >>> +                             SET_ERR_JMP(EINVAL, fail,
> >>> +                                         "%s node needs minimum one edge",
> >>> +                                         graph_node->node->name);
> >>> +                     if (graph_bfs(graph, graph_node))
> >>> +                             goto fail;
> >>> +             }
> >>> +     }
> >>> +
> >>> +     STAILQ_FOREACH(graph_node, &graph->node_list, next)
> >>> +             if (graph_node->visited == false)
> >>> +                     SET_ERR_JMP(EINVAL, fail, "Found isolated node %s",
> >>> +                                 graph_node->node->name);> +
> >>> +     return 0;
> >>
> >> You don't want to clear visited because it will not be used or cleared
> >> on next call?
> >
> > See above graph_mark_nodes_as_not_visited() function.
>
> Yes I noticed that and referred to it in the question.  My intention was
> to ask whether you are fine with graph having visited=true for the rest
> of its life, or should we clear them again at the end of this function.

Got it. For now, visted=true is OK for the rest of it its life.

Since it needs to go over all the nodes to clear it again. As an optimization,
I thought of exposing  graph_mark_nodes_as_not_visited() and
 graph_bfs() is exported in graph_private.h. Those primitives would be enough
to make other use cases when needed.


>
> With regards
> Andrzej Ostruszka


More information about the dev mailing list