diff mbox

Buffer type added

Message ID 1392800451-3359-1-git-send-email-petri.savolainen@linaro.org
State Accepted, archived
Commit ab883023161072cf1d714337358926daeddd8d43
Headers show

Commit Message

Petri Savolainen Feb. 19, 2014, 9 a.m. UTC
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(-)
diff mbox

Patch

diff --git a/include/odp_buffer.h b/include/odp_buffer.h
index 9f0811a..d8e4779 100644
--- a/include/odp_buffer.h
+++ b/include/odp_buffer.h
@@ -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
  *
diff --git a/include/odp_buffer_pool.h b/include/odp_buffer_pool.h
index 20fbf04..15f0be4 100644
--- a/include/odp_buffer_pool.h
+++ b/include/odp_buffer_pool.h
@@ -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;
 
diff --git a/platform/linux-generic/source/odp_buffer.c b/platform/linux-generic/source/odp_buffer.c
index 9d5997a..f5b02fd 100644
--- a/platform/linux-generic/source/odp_buffer.c
+++ b/platform/linux-generic/source/odp_buffer.c
@@ -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);