On Wed, Apr 8, 2020 at 11:19 PM Andrzej Ostruszka <a...@semihalf.com> wrote:
>
> On 4/5/20 10:55 AM, jer...@marvell.com wrote:
> > From: Jerin Jacob <jer...@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 <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>
> > ---
> >  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.

In the multiprocess model,

# The primary process( using rte_graph_create() API), it will create
the graph object
in hugepage memory
# Secondary process calls rte_graph_lookup() to get the graph object, created
by the primary process. Internally it uses rte_memzone_lookup() to get
the hugepage memory
populated by the primary process.
# The ONLY data that need to be updated in the secondary process context is the
process() function pointer. graph_mem_fixup_node_ctx(), do name-based
lookup with
node name and replace with function pointer in secondary process 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?

I will fix it v5.

Reply via email to