@@ -53,6 +53,20 @@ void *odp_buffer_addr(odp_buffer_t buf);
size_t odp_buffer_size(odp_buffer_t buf);
/**
+ * Buffer type
+ *
+ * @param buf Buffer handle
+ *
+ * @return Buffer type
+ */
+int odp_buffer_type(odp_buffer_t buf);
+
+#define ODP_BUFFER_TYPE_INVALID (-1) /**< Buffer type invalid */
+#define ODP_BUFFER_TYPE_RAW 0 /**< Raw buffer */
+#define ODP_BUFFER_TYPE_PACKET 1 /**< Packet buffer */
+#define ODP_BUFFER_TYPE_TIMER 2 /**< Timer buffer */
+
+/**
* Tests if buffer is part of a scatter/gather list
*
* @param buf Buffer handle
@@ -70,7 +84,6 @@ int odp_buffer_is_scatter(odp_buffer_t buf);
*/
int odp_buffer_is_valid(odp_buffer_t buf);
-
/**
* Print buffer metadata to STDOUT
*
@@ -26,8 +26,6 @@ extern "C" {
#define ODP_BUFFER_POOL_NAME_LEN 32
#define ODP_BUFFER_POOL_INVALID (0xffffffff)
-#define ODP_BUFFER_TYPE_RAW 0
-#define ODP_BUFFER_TYPE_PACKET 1
typedef uint32_t odp_buffer_pool_t;
@@ -33,6 +33,14 @@ size_t odp_buffer_size(odp_buffer_t buf)
}
+int odp_buffer_type(odp_buffer_t buf)
+{
+ odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf);
+
+ return hdr->type;
+}
+
+
int odp_buffer_is_scatter(odp_buffer_t buf)
{
odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf);
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> --- include/odp_buffer.h | 15 ++++++++++++++- include/odp_buffer_pool.h | 2 -- platform/linux-generic/source/odp_buffer.c | 8 ++++++++ 3 files changed, 22 insertions(+), 3 deletions(-)