On 4/5/20 10:55 AM, [email protected] wrote:
> From: Jerin Jacob <[email protected]>
>
> Adding node debug API implementation support to dump
> single or all the node objects to the given file.
>
> Signed-off-by: Jerin Jacob <[email protected]>
> Signed-off-by: Kiran Kumar K <[email protected]>
> Signed-off-by: Pavan Nikhilesh <[email protected]>
> Signed-off-by: Nithin Dabilpuram <[email protected]>
[...]
> 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