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 F010491BF for ; Wed, 18 May 2016 13:05:19 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 4B93229BA1; Wed, 18 May 2016 13:03:37 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: bruce.richardson@intel.com, stephen@networkplumber.org, keith.wiles@intel.com Date: Wed, 18 May 2016 13:04:26 +0200 Message-Id: <1463569496-31086-6-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: <1463569496-31086-1-git-send-email-olivier.matz@6wind.com> References: <1460629199-32489-1-git-send-email-olivier.matz@6wind.com> <1463569496-31086-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v3 05/35] mempool: rename object constructor typedef 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, 18 May 2016 11:05:20 -0000 This commit renames mempool_obj_ctor_t as mempool_obj_cb_t. 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 e5c681e..73e82f8 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 992edcd..ca609f0 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; @@ -225,7 +225,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; }; @@ -240,7 +240,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; @@ -431,7 +431,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 a6b82cf..d35833a 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -323,6 +323,17 @@ void rte_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*/, @@ -371,16 +382,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 @@ -473,7 +474,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); /** @@ -539,7 +540,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); @@ -628,7 +629,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.8.0.rc3