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 <[email protected]> Reviewed-by: Petri Savolainen <[email protected]> --- platform/linux-generic/include/odp_buffer_internal.h | 2 ++ platform/linux-generic/odp_pool.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 7f3fa1c..b37069d 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); /* diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 76a4aa5..9117cc8 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, -- 2.6.1.3.g8d02103 _______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
