From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 8B7563978 for ; Wed, 9 Mar 2016 17:22:14 +0100 (CET) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 7F3E323F82 for ; Wed, 9 Mar 2016 17:21:31 +0100 (CET) From: Olivier Matz To: dev@dpdk.org Date: Wed, 9 Mar 2016 17:19:11 +0100 Message-Id: <1457540381-20274-6-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1457540381-20274-1-git-send-email-olivier.matz@6wind.com> References: <1457540381-20274-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [RFC 05/35] mempool: rename mempool_obj_ctor_t as mempool_obj_cb_t 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, 09 Mar 2016 16:22:15 -0000 In next commits, we will add the ability to populate the mempool and iterate through objects using the same function. We will use the same callback type for that. As the callback is not a constructor anymore, rename it into rte_mempool_obj_cb_t. The rte_mempool_obj_iter_t that was used to iterate over objects will be removed in next commits. No functional change. In this commit, the API is preserved through a compat typedef. Signed-off-by: Olivier Matz --- app/test-pmd/mempool_anon.c | 4 ++-- app/test-pmd/mempool_osdep.h | 2 +- drivers/net/xenvirt/rte_eth_xenvirt.h | 2 +- drivers/net/xenvirt/rte_mempool_gntalloc.c | 4 ++-- lib/librte_mempool/rte_dom0_mempool.c | 2 +- lib/librte_mempool/rte_mempool.c | 8 ++++---- lib/librte_mempool/rte_mempool.h | 27 ++++++++++++++------------- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/app/test-pmd/mempool_anon.c b/app/test-pmd/mempool_anon.c index 4730432..5e23848 100644 --- a/app/test-pmd/mempool_anon.c +++ b/app/test-pmd/mempool_anon.c @@ -86,7 +86,7 @@ struct rte_mempool * mempool_anon_create(const char *name, unsigned elt_num, unsigned elt_size, unsigned cache_size, unsigned private_data_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, - rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg, + rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags) { struct rte_mempool *mp; @@ -190,7 +190,7 @@ mempool_anon_create(__rte_unused const char *name, __rte_unused unsigned private_data_size, __rte_unused rte_mempool_ctor_t *mp_init, __rte_unused void *mp_init_arg, - __rte_unused rte_mempool_obj_ctor_t *obj_init, + __rte_unused rte_mempool_obj_cb_t *obj_init, __rte_unused void *obj_init_arg, __rte_unused int socket_id, __rte_unused unsigned flags) { diff --git a/app/test-pmd/mempool_osdep.h b/app/test-pmd/mempool_osdep.h index 6b8df68..7ce7297 100644 --- a/app/test-pmd/mempool_osdep.h +++ b/app/test-pmd/mempool_osdep.h @@ -48,7 +48,7 @@ struct rte_mempool * mempool_anon_create(const char *name, unsigned n, unsigned elt_size, unsigned cache_size, unsigned private_data_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, - rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg, + rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags); #endif /*_RTE_MEMPOOL_OSDEP_H_ */ diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.h b/drivers/net/xenvirt/rte_eth_xenvirt.h index fc15a63..4995a9b 100644 --- a/drivers/net/xenvirt/rte_eth_xenvirt.h +++ b/drivers/net/xenvirt/rte_eth_xenvirt.h @@ -51,7 +51,7 @@ struct rte_mempool * rte_mempool_gntalloc_create(const char *name, unsigned elt_num, unsigned elt_size, unsigned cache_size, unsigned private_data_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, - rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg, + rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags); diff --git a/drivers/net/xenvirt/rte_mempool_gntalloc.c b/drivers/net/xenvirt/rte_mempool_gntalloc.c index 7bfbfda..69b9231 100644 --- a/drivers/net/xenvirt/rte_mempool_gntalloc.c +++ b/drivers/net/xenvirt/rte_mempool_gntalloc.c @@ -78,7 +78,7 @@ static struct _mempool_gntalloc_info _create_mempool(const char *name, unsigned elt_num, unsigned elt_size, unsigned cache_size, unsigned private_data_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, - rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg, + rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags) { struct _mempool_gntalloc_info mgi; @@ -253,7 +253,7 @@ struct rte_mempool * rte_mempool_gntalloc_create(const char *name, unsigned elt_num, unsigned elt_size, unsigned cache_size, unsigned private_data_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, - rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg, + rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags) { int rv; diff --git a/lib/librte_mempool/rte_dom0_mempool.c b/lib/librte_mempool/rte_dom0_mempool.c index 0d6d750..0051bd5 100644 --- a/lib/librte_mempool/rte_dom0_mempool.c +++ b/lib/librte_mempool/rte_dom0_mempool.c @@ -83,7 +83,7 @@ struct rte_mempool * rte_dom0_mempool_create(const char *name, unsigned elt_num, unsigned elt_size, unsigned cache_size, unsigned private_data_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, - rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg, + rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags) { struct rte_mempool *mp = NULL; diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index ce0470d..83e7ed6 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -128,7 +128,7 @@ static unsigned optimize_object_size(unsigned obj_size) static void mempool_add_elem(struct rte_mempool *mp, void *obj, uint32_t obj_idx, - rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg) + rte_mempool_obj_cb_t *obj_init, void *obj_init_arg) { struct rte_mempool_objhdr *hdr; struct rte_mempool_objtlr *tlr __rte_unused; @@ -224,7 +224,7 @@ rte_mempool_obj_iter(void *vaddr, uint32_t elt_num, size_t total_elt_sz, struct mempool_populate_arg { struct rte_mempool *mp; - rte_mempool_obj_ctor_t *obj_init; + rte_mempool_obj_cb_t *obj_init; void *obj_init_arg; }; @@ -239,7 +239,7 @@ mempool_obj_populate(void *arg, void *start, void *end, uint32_t idx) static void mempool_populate(struct rte_mempool *mp, size_t num, size_t align, - rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg) + rte_mempool_obj_cb_t *obj_init, void *obj_init_arg) { uint32_t elt_sz; struct mempool_populate_arg arg; @@ -429,7 +429,7 @@ struct rte_mempool * rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size, unsigned cache_size, unsigned private_data_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, - rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg, + rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags, void *vaddr, const phys_addr_t paddr[], uint32_t pg_num, uint32_t pg_shift) { diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 6d98cdf..da04021 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -318,6 +318,17 @@ void __mempool_check_cookies(const struct rte_mempool *mp, #endif /* RTE_LIBRTE_MEMPOOL_DEBUG */ /** + * An object callback function for mempool. + * + * Arguments are the mempool, the opaque pointer given by the user in + * rte_mempool_create(), the pointer to the element and the index of + * the element in the pool. + */ +typedef void (rte_mempool_obj_cb_t)(struct rte_mempool *mp, + void *opaque, void *obj, unsigned obj_idx); +typedef rte_mempool_obj_cb_t rte_mempool_obj_ctor_t; /* compat */ + +/** * A mempool object iterator callback function. */ typedef void (*rte_mempool_obj_iter_t)(void * /*obj_iter_arg*/, @@ -366,16 +377,6 @@ uint32_t rte_mempool_obj_iter(void *vaddr, rte_mempool_obj_iter_t obj_iter, void *obj_iter_arg); /** - * An object constructor callback function for mempool. - * - * Arguments are the mempool, the opaque pointer given by the user in - * rte_mempool_create(), the pointer to the element and the index of - * the element in the pool. - */ -typedef void (rte_mempool_obj_ctor_t)(struct rte_mempool *, void *, - void *, unsigned); - -/** * A mempool constructor callback function. * * Arguments are the mempool and the opaque pointer given by the user in @@ -468,7 +469,7 @@ struct rte_mempool * rte_mempool_create(const char *name, unsigned n, unsigned elt_size, unsigned cache_size, unsigned private_data_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, - rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg, + rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags); /** @@ -534,7 +535,7 @@ struct rte_mempool * rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size, unsigned cache_size, unsigned private_data_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, - rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg, + rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags, void *vaddr, const phys_addr_t paddr[], uint32_t pg_num, uint32_t pg_shift); @@ -623,7 +624,7 @@ struct rte_mempool * rte_dom0_mempool_create(const char *name, unsigned n, unsigned elt_size, unsigned cache_size, unsigned private_data_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, - rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg, + rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags); -- 2.1.4