From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wes1-so1.wedos.net (wes1-so1.wedos.net [46.28.106.15]) by dpdk.org (Postfix) with ESMTP id 9507CC54A for ; Wed, 15 Jun 2016 12:19:50 +0200 (CEST) Received: from pcviktorin.fit.vutbr.cz (pcviktorin.fit.vutbr.cz [147.229.13.147]) by wes1-so1.wedos.net (Postfix) with ESMTPSA id 3rV2ZG2gGLzB85; Wed, 15 Jun 2016 12:19:50 +0200 (CEST) Date: Wed, 15 Jun 2016 12:14:44 +0200 From: Jan Viktorin To: David Hunt Cc: dev@dpdk.org, olivier.matz@6wind.com, jerin.jacob@caviumnetworks.com, shreyansh.jain@nxp.com Message-ID: <20160615121444.3db1d573@pcviktorin.fit.vutbr.cz> In-Reply-To: <1465976824-83823-2-git-send-email-david.hunt@intel.com> References: <1465919341-3209-1-git-send-email-david.hunt@intel.com> <1465976824-83823-1-git-send-email-david.hunt@intel.com> <1465976824-83823-2-git-send-email-david.hunt@intel.com> Organization: RehiveTech MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v12 1/3] mempool: support external mempool operations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jun 2016 10:19:50 -0000 On Wed, 15 Jun 2016 08:47:02 +0100 David Hunt 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 > Signed-off-by: David Hunt > Acked-by: Shreyansh Jain > Acked-by: Olivier Matz > --- > 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]; > +} > +