[dpdk-dev] [PATCH v4 04/29] graph: implement node debug routines
Andrzej Ostruszka
amo at semihalf.com
Mon Apr 6 20:17:17 CEST 2020
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.
> + 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