aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorNicolas Morey-Chaisemartin <nmorey@kalray.eu>2015-10-28 16:32:04 +0100
committerMaxim Uvarov <maxim.uvarov@linaro.org>2015-11-25 17:52:49 +0300
commit5fe9da3fe06fb3dbd6e41617c7e73c4dcdb21c7a (patch)
treedfcae427a8f90b4b3b37e216204dfdfc1a058b99 /platform
parent0926289765b59471f63311384106220cde0209e5 (diff)
linux-generic: pool: add buffer_alloc_multi function
For the moment just a simple wrapper around buffer_alloc to be used by odp_buffer_alloc_multi and odp_packet_alloc_multi Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform')
-rw-r--r--platform/linux-generic/include/odp_buffer_internal.h2
-rw-r--r--platform/linux-generic/odp_pool.c14
2 files changed, 16 insertions, 0 deletions
diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h
index 462f4bf3b..74a0b5c4f 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -166,6 +166,8 @@ typedef struct {
/* Forward declarations */
odp_buffer_t buffer_alloc(odp_pool_t pool, size_t size);
+int buffer_alloc_multi(odp_pool_t pool_hdl, size_t size,
+ odp_buffer_t buf[], int num);
#ifdef __cplusplus
}
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index 76a4aa585..9117cc81e 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -529,6 +529,20 @@ odp_buffer_t buffer_alloc(odp_pool_t pool_hdl, size_t size)
return odp_hdr_to_buf(&buf->buf);
}
+int buffer_alloc_multi(odp_pool_t pool_hdl, size_t size,
+ odp_buffer_t buf[], int num)
+{
+ int count;
+
+ for (count = 0; count < num; ++count) {
+ buf[count] = buffer_alloc(pool_hdl, size);
+ if (buf[count] == ODP_BUFFER_INVALID)
+ break;
+ }
+
+ return count;
+}
+
odp_buffer_t odp_buffer_alloc(odp_pool_t pool_hdl)
{
return buffer_alloc(pool_hdl,