[dpdk-dev] [PATCH v4 04/29] graph: implement node debug routines

Jerin Jacob jerinjacobk at gmail.com
Tue Apr 7 12:22:51 CEST 2020


On Mon, Apr 6, 2020 at 11:47 PM Andrzej Ostruszka <amo at semihalf.com> wrote:
>
> On 4/5/20 10:55 AM, jerinj at marvell.com wrote:
> > From: Jerin Jacob <jerinj at marvell.com>
> >
> > Adding node debug API implementation support to dump
> > single or all the node objects to the given file.
> >
> > Signed-off-by: Jerin Jacob <jerinj at marvell.com>
> > Signed-off-by: Kiran Kumar K <kirankumark at marvell.com>
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula at marvell.com>
> > Signed-off-by: Nithin Dabilpuram <ndabilpuram at marvell.com>
> [...]
> > diff --git a/lib/librte_graph/node.c b/lib/librte_graph/node.c
> > index d04a0fce0..8592c1221 100644
> > --- a/lib/librte_graph/node.c
> > +++ b/lib/librte_graph/node.c
> > @@ -377,6 +377,38 @@ rte_node_edge_get(rte_node_t id, char *next_nodes[])
> >       return rc;
> >  }
> >
> > +static void
> > +node_scan_dump(FILE *f, rte_node_t id, bool all)
> > +{
> > +     struct node *node;
> > +
> > +     RTE_ASSERT(f != NULL);
>
> Why the assert?  Below this is used in public (I guess) functions so
> user can provide wrong input - in that case I'd expect warning/error not
> an assert.

Public API rte_node_dump() and node_scan_dump() calls this API without
any check.

>
> > +     NODE_ID_CHECK(id);
> > +
> > +     STAILQ_FOREACH(node, &node_list, next) {
> > +             if (all == true) {
> > +                     node_dump(f, node);
> > +             } else if (node->id == id) {
> > +                     node_dump(f, node);
> > +                     return;
> > +             }
> > +     }
> > +fail:
> > +     return;
> > +}
> > +
> > +void
> > +rte_node_dump(FILE *f, rte_node_t id)
> > +{
> > +     node_scan_dump(f, id, false);
> > +}
> > +
> > +void
> > +rte_node_list_dump(FILE *f)
> > +{
> > +     node_scan_dump(f, 0, true);
> > +}
> > +
> [...]
>
> With regards
> Andrzej Ostruszka


More information about the dev mailing list