aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@linaro.org>2015-01-26 15:05:47 +0200
committerMaxim Uvarov <maxim.uvarov@linaro.org>2015-01-27 15:34:30 +0300
commit8d0f8982236b400b11b2e712e3bbd289694e6f2b (patch)
tree0d4fc7575ee10c44812dd71910b029b293d41693 /platform/linux-generic/include
parent9cb80344f017193a3c432c2a12fe7af348881396 (diff)
api: pool: Rename pool params and remove buffer types
* Renamed odp_buffer_pool_param_t to odp_pool_param_t * Moved buffer pool parameters into "buf" struct * Left other structs for other types (pkt and tmo) to be added and implemented * Pool type field is common to all pool types * Removed buffer types and use ODP_EVENT_XXX for event type and ODP_POOL_XXX for pool type instead. So event types may not be assosiated to a pool (and may not have a corresponding pool type). Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic/include')
-rw-r--r--platform/linux-generic/include/api/odp_pool.h79
-rw-r--r--platform/linux-generic/include/odp_buffer_inlines.h2
-rw-r--r--platform/linux-generic/include/odp_buffer_internal.h3
-rw-r--r--platform/linux-generic/include/odp_buffer_pool_internal.h6
4 files changed, 54 insertions, 36 deletions
diff --git a/platform/linux-generic/include/api/odp_pool.h b/platform/linux-generic/include/api/odp_pool.h
index 3b9b38412..eba7b833d 100644
--- a/platform/linux-generic/include/api/odp_pool.h
+++ b/platform/linux-generic/include/api/odp_pool.h
@@ -26,35 +26,54 @@ extern "C" {
#include <odp_event.h>
/** @addtogroup odp_buffer
- * Operations on a buffer pool.
+ * Operations on a pool.
* @{
*/
/** Maximum queue name lenght in chars */
-#define ODP_BUFFER_POOL_NAME_LEN 32
+#define ODP_POOL_NAME_LEN 32
/**
- * Buffer pool parameters
- * Used to communicate buffer pool creation options.
+ * Pool parameters
+ * Used to communicate pool creation options.
*/
-typedef struct odp_buffer_pool_param_t {
- uint32_t buf_size; /**< Buffer size in bytes. The maximum
- number of bytes application will
- store in each buffer. For packets, this
- is the maximum packet data length, and
- configured headroom and tailroom will be
- added to this number */
- uint32_t buf_align; /**< Minimum buffer alignment in bytes.
- Valid values are powers of two. Use 0
- for default alignment. Default will
- always be a multiple of 8. */
- uint32_t num_bufs; /**< Number of buffers in the pool */
- int buf_type; /**< Buffer type */
-} odp_buffer_pool_param_t;
-
-#define ODP_BUFFER_TYPE_RAW ODP_EVENT_BUFFER
-#define ODP_BUFFER_TYPE_PACKET ODP_EVENT_PACKET
-#define ODP_BUFFER_TYPE_TIMEOUT ODP_EVENT_TIMEOUT
+typedef struct odp_pool_param_t {
+ union {
+ struct {
+ uint32_t size; /**< Buffer size in bytes. The
+ maximum number of bytes
+ application will store in each
+ buffer. */
+ uint32_t align; /**< Minimum buffer alignment in bytes.
+ Valid values are powers of two.
+ Use 0 for default alignment.
+ Default will always be a multiple
+ of 8. */
+ uint32_t num; /**< Number of buffers in the pool */
+ } buf;
+/* Reserved for packet and timeout specific params
+ struct {
+ uint32_t seg_size;
+ uint32_t seg_align;
+ uint32_t num;
+ } pkt;
+ struct {
+ } tmo;
+*/
+ };
+
+ int type; /**< Pool type */
+
+} odp_pool_param_t;
+
+/** Invalid pool type */
+#define ODP_POOL_TYPE_INVALID ODP_EVENT_TYPE_INVALID
+/** Packet pool*/
+#define ODP_POOL_PACKET ODP_EVENT_PACKET
+/** Buffer pool */
+#define ODP_POOL_BUFFER ODP_EVENT_BUFFER
+/** Timeout pool */
+#define ODP_POOL_TIMEOUT ODP_EVENT_TIMEOUT
/**
* Create a buffer pool
@@ -79,7 +98,7 @@ typedef struct odp_buffer_pool_param_t {
odp_buffer_pool_t odp_buffer_pool_create(const char *name,
odp_shm_t shm,
- odp_buffer_pool_param_t *params);
+ odp_pool_param_t *params);
/**
* Destroy a buffer pool previously created by odp_buffer_pool_create()
@@ -118,13 +137,13 @@ odp_buffer_pool_t odp_buffer_pool_lookup(const char *name);
* Used to get information about a buffer pool.
*/
typedef struct odp_buffer_pool_info_t {
- const char *name; /**< pool name */
- odp_shm_t shm; /**< handle of shared memory area
- supplied by application to
- contain buffer pool, or
- ODP_SHM_INVALID if this pool is
- managed by ODP */
- odp_buffer_pool_param_t params; /**< pool parameters */
+ const char *name; /**< pool name */
+ odp_shm_t shm; /**< handle of shared memory area
+ supplied by application to
+ contain buffer pool, or
+ ODP_SHM_INVALID if this pool is
+ managed by ODP */
+ odp_pool_param_t params; /**< pool parameters */
} odp_buffer_pool_info_t;
/**
diff --git a/platform/linux-generic/include/odp_buffer_inlines.h b/platform/linux-generic/include/odp_buffer_inlines.h
index ee264a656..000e67377 100644
--- a/platform/linux-generic/include/odp_buffer_inlines.h
+++ b/platform/linux-generic/include/odp_buffer_inlines.h
@@ -116,7 +116,7 @@ static inline odp_buffer_hdr_t *validate_buf(odp_buffer_t buf)
/* A valid buffer index must be on stride, and must be in range */
if ((handle.index % buf_stride != 0) ||
- ((uint32_t)(handle.index / buf_stride) >= pool->s.params.num_bufs))
+ ((uint32_t)(handle.index / buf_stride) >= pool->s.params.buf.num))
return NULL;
buf_hdr = (odp_buffer_hdr_t *)(void *)
diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h
index 9475c8bd0..14c32c191 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -28,6 +28,7 @@ extern "C" {
#include <odp_config.h>
#include <odp_byteorder.h>
#include <odp_thread.h>
+#include <odp_event.h>
#define ODP_BITSIZE(x) \
@@ -163,8 +164,6 @@ odp_buffer_t buffer_alloc(odp_buffer_pool_t pool, size_t size);
*/
int _odp_buffer_type(odp_buffer_t buf);
-#define _ODP_BUFFER_TYPE_ANY 0
-
#ifdef __cplusplus
}
diff --git a/platform/linux-generic/include/odp_buffer_pool_internal.h b/platform/linux-generic/include/odp_buffer_pool_internal.h
index b0e696e45..4ace3c380 100644
--- a/platform/linux-generic/include/odp_buffer_pool_internal.h
+++ b/platform/linux-generic/include/odp_buffer_pool_internal.h
@@ -84,8 +84,8 @@ struct pool_entry_s {
odp_spinlock_t lock ODP_ALIGNED_CACHE;
#endif
- char name[ODP_BUFFER_POOL_NAME_LEN];
- odp_buffer_pool_param_t params;
+ char name[ODP_POOL_NAME_LEN];
+ odp_pool_param_t params;
_odp_buffer_pool_init_t init_params;
odp_buffer_pool_t pool_hdl;
uint32_t pool_id;
@@ -239,7 +239,7 @@ static inline void ret_buf(struct pool_entry_s *pool, odp_buffer_hdr_t *buf)
buf->allocator = ODP_FREEBUF; /* Mark buffer free */
- if (!buf->flags.hdrdata && buf->type != ODP_BUFFER_TYPE_RAW) {
+ if (!buf->flags.hdrdata && buf->type != ODP_EVENT_BUFFER) {
while (buf->segcount > 0) {
if (buffer_is_secure(buf) || pool_is_secure(pool))
memset(buf->addr[buf->segcount - 1],