diff mbox

[PATCHv2,2/3] Add odp_buffer_pool_info() implementation

Message ID 1417547823-16522-2-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Dec. 2, 2014, 7:17 p.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/odp_buffer_pool.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c
index f545090..fa72972 100644
--- a/platform/linux-generic/odp_buffer_pool.c
+++ b/platform/linux-generic/odp_buffer_pool.c
@@ -353,6 +353,27 @@  odp_buffer_pool_t odp_buffer_pool_lookup(const char *name)
 	return ODP_BUFFER_POOL_INVALID;
 }
 
+int odp_buffer_pool_info(odp_buffer_pool_t pool_hdl,
+			 odp_shm_t *shm,
+			 odp_buffer_pool_info_t *info)
+{
+	uint32_t pool_id = pool_handle_to_index(pool_hdl);
+	pool_entry_t *pool = get_pool_entry(pool_id);
+
+	if (pool == NULL || info == NULL)
+		return -1;
+
+	*shm = pool->s.flags.user_supplied_shm ?
+		pool->s.pool_shm : ODP_SHM_NULL;
+	info->name = pool->s.name;
+	info->params.buf_size  = pool->s.params.buf_size;
+	info->params.buf_align = pool->s.params.buf_align;
+	info->params.num_bufs  = pool->s.params.num_bufs;
+	info->params.buf_type  = pool->s.params.buf_type;
+
+	return 0;
+}
+
 odp_buffer_t buffer_alloc(odp_buffer_pool_t pool_hdl, size_t size)
 {
 	pool_entry_t *pool = odp_pool_to_entry(pool_hdl);