aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp/api/plat
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2022-10-07 10:30:42 +0300
committerMatias Elo <matias.elo@nokia.com>2022-10-11 11:57:17 +0300
commit8af6f26b7559964b580c5482c460d204e8cefa40 (patch)
treebfc6dbddaa9633c4319047e56d7461bb076f0266 /platform/linux-generic/include/odp/api/plat
parent5fb9fc0afdef4d4eab3705bea2d72326e114620b (diff)
linux-gen: buffer: inline odp_buffer_size() implementation
Inline implementation of odp_buffer_size() function. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'platform/linux-generic/include/odp/api/plat')
-rw-r--r--platform/linux-generic/include/odp/api/plat/buffer_inlines.h10
-rw-r--r--platform/linux-generic/include/odp/api/plat/pool_inline_types.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/platform/linux-generic/include/odp/api/plat/buffer_inlines.h b/platform/linux-generic/include/odp/api/plat/buffer_inlines.h
index 711324f83..d876f60f4 100644
--- a/platform/linux-generic/include/odp/api/plat/buffer_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/buffer_inlines.h
@@ -15,11 +15,13 @@
#include <odp/api/plat/buffer_inline_types.h>
#include <odp/api/plat/debug_inlines.h>
#include <odp/api/plat/event_inline_types.h>
+#include <odp/api/plat/pool_inline_types.h>
/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
extern const _odp_event_inline_offset_t _odp_event_inline_offset;
extern const _odp_buffer_inline_offset_t _odp_buffer_inline_offset;
+extern const _odp_pool_inline_offset_t _odp_pool_inline;
#ifndef _ODP_NO_INLINE
/* Inline functions by default */
@@ -27,6 +29,7 @@ extern const _odp_buffer_inline_offset_t _odp_buffer_inline_offset;
#define odp_buffer_from_event __odp_buffer_from_event
#define odp_buffer_to_event __odp_buffer_to_event
#define odp_buffer_addr __odp_buffer_addr
+ #define odp_buffer_size __odp_buffer_size
#define odp_buffer_pool __odp_buffer_pool
#define odp_buffer_user_area __odp_buffer_user_area
#else
@@ -50,6 +53,13 @@ _ODP_INLINE void *odp_buffer_addr(odp_buffer_t buf)
return _odp_event_hdr_field((odp_event_t)buf, void *, base_data);
}
+_ODP_INLINE uint32_t odp_buffer_size(odp_buffer_t buf)
+{
+ odp_pool_t pool = _odp_event_hdr_field(buf, odp_pool_t, pool);
+
+ return _odp_pool_get(pool, uint32_t, seg_len);
+}
+
_ODP_INLINE odp_pool_t odp_buffer_pool(odp_buffer_t buf)
{
return _odp_event_hdr_field(buf, odp_pool_t, pool);
diff --git a/platform/linux-generic/include/odp/api/plat/pool_inline_types.h b/platform/linux-generic/include/odp/api/plat/pool_inline_types.h
index b6049ccac..9deec89a1 100644
--- a/platform/linux-generic/include/odp/api/plat/pool_inline_types.h
+++ b/platform/linux-generic/include/odp/api/plat/pool_inline_types.h
@@ -26,6 +26,8 @@ typedef struct _odp_pool_inline_offset_t {
/** @internal field offset */
uint16_t index;
/** @internal field offset */
+ uint16_t seg_len;
+ /** @internal field offset */
uint16_t uarea_size;
/** @internal field offset */
uint16_t ext_head_offset;