From: Olivier Matz Date: Wed, 18 May 2016 11:04:26 +0000 (+0200) Subject: mempool: rename object constructor typedef X-Git-Tag: spdx-start~6896 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f49e858580fa966eebedfc08f3578aba1d00f926;p=dpdk.git mempool: rename object constructor typedef 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 --- diff --git a/app/test-pmd/mempool_anon.c b/app/test-pmd/mempool_anon.c index 4730432975..5e23848417 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 6b8df68a5b..7ce7297b64 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 fc15a636a7..4995a9b4c2 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 e5c681ea9d..73e82f808a 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 0d6d7504ff..0051bd53c7 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 992edcd936..ca609f0d2e 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 a6b82cfe98..d35833a0e0 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -322,6 +322,17 @@ void rte_mempool_check_cookies(const struct rte_mempool *mp, #define __mempool_check_cookies(mp, obj_table_const, n, free) do {} while(0) #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. */ @@ -370,16 +381,6 @@ uint32_t rte_mempool_obj_iter(void *vaddr, const phys_addr_t paddr[], uint32_t pg_num, uint32_t pg_shift, 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. * @@ -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);