[dpdk-dev] [PATCH v12 1/3] mempool: support external mempool operations
Jan Viktorin
viktorin at rehivetech.com
Wed Jun 15 12:14:44 CEST 2016
On Wed, 15 Jun 2016 08:47:02 +0100
David Hunt <david.hunt at intel.com> wrote:
> Until now, the objects stored in a mempool were internally stored in a
> ring. This patch introduces the possibility to register external handlers
> replacing the ring.
>
> The default behavior remains unchanged, but calling the new function
> rte_mempool_set_ops_byname() right after rte_mempool_create_empty() allows
> the user to change the handler that will be used when populating
> the mempool.
>
> This patch also adds a set of default ops (function callbacks) based
> on rte_ring.
>
> Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
> Signed-off-by: David Hunt <david.hunt at intel.com>
> Acked-by: Shreyansh Jain <shreyansh.jain at nxp.com>
> Acked-by: Olivier Matz <olivier.matz at 6wind.com>
> ---
> app/test/test_mempool_perf.c | 1 -
> doc/guides/prog_guide/mempool_lib.rst | 31 +++-
> doc/guides/rel_notes/deprecation.rst | 9 --
> lib/librte_mempool/Makefile | 2 +
> lib/librte_mempool/rte_mempool.c | 66 +++-----
> lib/librte_mempool/rte_mempool.h | 251 ++++++++++++++++++++++++++---
> lib/librte_mempool/rte_mempool_ops.c | 148 +++++++++++++++++
> lib/librte_mempool/rte_mempool_ring.c | 161 ++++++++++++++++++
> lib/librte_mempool/rte_mempool_version.map | 13 +-
> 9 files changed, 601 insertions(+), 81 deletions(-)
> create mode 100644 lib/librte_mempool/rte_mempool_ops.c
> create mode 100644 lib/librte_mempool/rte_mempool_ring.c
>
[...]
> +
> +/** Array of registered ops structs. */
> +extern struct rte_mempool_ops_table rte_mempool_ops_table;
> +
> +/**
> + * @internal Get the mempool ops struct from its index.
> + *
> + * @param ops_index
> + * The index of the ops struct in the ops struct table. It must be a valid
> + * index: (0 <= idx < num_ops).
> + * @return
> + * The pointer to the ops struct in the table.
> + */
> +static inline struct rte_mempool_ops *
> +rte_mempool_ops_get(int ops_index)
Shouldn't this function be called rte_mempool_get/find_ops instead?
Jan
> +{
> + RTE_VERIFY(ops_index < RTE_MEMPOOL_MAX_OPS_IDX);
> +
> + return &rte_mempool_ops_table.ops[ops_index];
> +}
> +
More information about the dev
mailing list