[dpdk-dev] [RFC PATCH 1/5] graph: introduce graph subsystem
Jerin Jacob
jerinjacobk at gmail.com
Sun Feb 2 12:08:55 CET 2020
On Sun, Feb 2, 2020 at 4:05 PM Stephen Hemminger
<stephen at networkplumber.org> wrote:
>
> On Fri, 31 Jan 2020 22:31:57 +0530
> <jerinj at marvell.com> wrote:
>
> > + /* Create graph object */
> > + graph = calloc(1, sizeof(*graph));
> > + if (graph == NULL)
> > + set_err(ENOMEM, fail, "failed to calloc graph object");
>
> This won't be safe if used in primary/secondary process model.
> You would need to use rte_calloc etc to allow this.
That memory used only local housekeeping purposes. Down in the
function, it creates a graph reel from
the memzone with all the required data for fast path. see graph_fp_mem_create()
workers/secondary process get the real fast path graph object through
rte_graph_lookup() which
returns the "struct rte_graph *". Followed by invoking
rte_graph_walk(struct rte_graph *graph)
for the graph walk.
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);
}
More information about the dev
mailing list