diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ad6e28de..3612185d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,9 @@ The parameter `free_space` has been added to spdk_ring_enqueue() to wait when the ring is almost full and resume when there is enough space available in the ring. +A new API `spdk_mempool_lookup` has been added to lookup the memory pool created +by the primary process. + ## v19.04: ### nvme diff --git a/include/spdk/env.h b/include/spdk/env.h index 4f3bb9bea..19f260126 100644 --- a/include/spdk/env.h +++ b/include/spdk/env.h @@ -442,6 +442,15 @@ size_t spdk_mempool_count(const struct spdk_mempool *pool); uint32_t spdk_mempool_obj_iter(struct spdk_mempool *mp, spdk_mempool_obj_cb_t obj_cb, void *obj_cb_arg); +/** + * Lookup the memory pool identified by the given name. + * + * \param name Name of the memory pool. + * + * \return a pointer to the memory pool on success, or NULL on failure. + */ +struct spdk_mempool *spdk_mempool_lookup(const char *name); + /** * Get the number of dedicated CPU cores utilized by this env abstraction. * diff --git a/lib/env_dpdk/env.c b/lib/env_dpdk/env.c index dbd746dc8..e74f2ee4d 100644 --- a/lib/env_dpdk/env.c +++ b/lib/env_dpdk/env.c @@ -296,6 +296,12 @@ spdk_mempool_obj_iter(struct spdk_mempool *mp, spdk_mempool_obj_cb_t obj_cb, obj_cb_arg); } +struct spdk_mempool * +spdk_mempool_lookup(const char *name) +{ + return (struct spdk_mempool *)rte_mempool_lookup(name); +} + bool spdk_process_is_primary(void) {