[dpdk-dev] [PATCH v4 08/29] graph: implement graph operation APIs

Andrzej Ostruszka amo at semihalf.com
Wed Apr 8 19:49:36 CEST 2020


On 4/5/20 10:55 AM, jerinj at marvell.com wrote:
> From: Jerin Jacob <jerinj at marvell.com>
> 
> Adding support for graph specific API implementation like
> Graph lookup to get graph object, retrieving graph ID
> From name and graph name from ID.
> 
> 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>
> ---
>  lib/librte_graph/graph.c               | 131 +++++++++++++++++++++++++
>  lib/librte_graph/rte_graph_version.map |   8 ++
>  2 files changed, 139 insertions(+)
> 
> diff --git a/lib/librte_graph/graph.c b/lib/librte_graph/graph.c
> index dc373231e..7c6a7897d 100644
> --- a/lib/librte_graph/graph.c
> +++ b/lib/librte_graph/graph.c
> @@ -210,6 +210,54 @@ graph_node_fini(struct graph *graph)
>  						       graph_node->node->name));
>  }
>  
> +static struct rte_graph *
> +graph_mem_fixup_node_ctx(struct rte_graph *graph)

How is this function fixing context?  It only updates process pointer
never touching context.

> +{
> +	struct rte_node *node;
> +	struct node *node_db;
> +	rte_graph_off_t off;
> +	rte_node_t count;
> +	const char *name;
> +
> +	rte_graph_foreach_node(count, off, graph, node) {
> +		if (node->parent_id == RTE_NODE_ID_INVALID) /* Static node */
> +			name = node->name;
> +		else /* Cloned node */
> +			name = node->parent;
> +
> +		node_db = node_from_name(name);
> +		if (node_db == NULL)
> +			SET_ERR_JMP(ENOLINK, fail, "Node %s not found", name);
> +		node->process = node_db->process;
> +	}
> +
> +	return graph;
> +fail:
> +	return NULL;
> +}
> +
> +static struct rte_graph *
> +graph_mem_fixup_secondray(struct rte_graph *graph)

Typo here?

> +{
> +	if (graph == NULL || rte_eal_process_type() == RTE_PROC_PRIMARY)
> +		return graph;
> +
> +	return graph_mem_fixup_node_ctx(graph);
> +}
> +
> +struct rte_graph *
> +rte_graph_lookup(const char *name)
> +{
> +	const struct rte_memzone *mz;
> +	struct rte_graph *rc = NULL;
> +
> +	mz = rte_memzone_lookup(name);
> +	if (mz)
> +		rc = mz->addr;
> +
> +	return graph_mem_fixup_secondray(rc);
> +}
[...]

With regards
Andrzej Ostruszka


More information about the dev mailing list