aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic
diff options
context:
space:
mode:
authorBill Fischofer <bill.fischofer@linaro.org>2014-12-15 19:09:51 +0200
committerMaxim Uvarov <maxim.uvarov@linaro.org>2014-12-16 01:26:35 +0300
commit28e82826152d2444ab8d5a8244a76f71878f114f (patch)
tree944b82ebcf587a9747df62c7b28b2d7e1ff35fc0 /platform/linux-generic
parent86e0b5f8e29cc3bdbc14db0c90b104cdbbbbb564 (diff)
api: buffer: add pool info query
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic')
-rw-r--r--platform/linux-generic/include/api/odp_buffer_pool.h28
-rw-r--r--platform/linux-generic/odp_buffer_pool.c20
2 files changed, 48 insertions, 0 deletions
diff --git a/platform/linux-generic/include/api/odp_buffer_pool.h b/platform/linux-generic/include/api/odp_buffer_pool.h
index 312b5f6ec..e6bf5a74a 100644
--- a/platform/linux-generic/include/api/odp_buffer_pool.h
+++ b/platform/linux-generic/include/api/odp_buffer_pool.h
@@ -104,6 +104,34 @@ int odp_buffer_pool_destroy(odp_buffer_pool_t pool);
*/
odp_buffer_pool_t odp_buffer_pool_lookup(const char *name);
+/**
+ * Buffer pool information struct
+ * Used to get information about a buffer pool.
+ */
+typedef struct odp_buffer_pool_info_t {
+ const char *name; /**< pool name */
+ odp_shm_t shm; /**< handle of shared memory area
+ supplied by application to
+ contain buffer pool, or
+ ODP_SHM_NULL if this pool is
+ managed by ODP */
+ odp_buffer_pool_param_t params; /**< pool parameters */
+} odp_buffer_pool_info_t;
+
+/**
+ * Retrieve information about a buffer pool
+ *
+ * @param pool Buffer pool handle
+ *
+ * @param[out] info Receives an odp_buffer_pool_info_t object
+ * that describes the pool.
+ *
+ * @retval 0 Success
+ * @retval -1 Failure. Info could not be retrieved.
+ */
+
+int odp_buffer_pool_info(odp_buffer_pool_t pool,
+ odp_buffer_pool_info_t *info);
/**
* Print buffer pool info
diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c
index e2511afd0..e947dde1b 100644
--- a/platform/linux-generic/odp_buffer_pool.c
+++ b/platform/linux-generic/odp_buffer_pool.c
@@ -390,6 +390,26 @@ 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_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;
+
+ info->name = pool->s.name;
+ info->shm = pool->s.flags.user_supplied_shm ?
+ pool->s.pool_shm : ODP_SHM_NULL;
+ 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;
+}
+
int odp_buffer_pool_destroy(odp_buffer_pool_t pool_hdl)
{
uint32_t pool_id = pool_handle_to_index(pool_hdl);