On 4/5/20 10:55 AM, jer...@marvell.com wrote:
> From: Jerin Jacob <jer...@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 <jer...@marvell.com>
> Signed-off-by: Kiran Kumar K <kirankum...@marvell.com>
> Signed-off-by: Pavan Nikhilesh <pbhagavat...@marvell.com>
> Signed-off-by: Nithin Dabilpuram <ndabilpu...@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.

> +     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

Reply via email to