diff mbox

[13/15] api: pool: Rename pool params and remove buffer types

Message ID 1421336423-19382-14-git-send-email-petri.savolainen@linaro.org
State New
Headers show

Commit Message

Petri Savolainen Jan. 15, 2015, 3:40 p.m. UTC
* 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 pool
  types instead

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
---
 example/generator/odp_generator.c                  | 10 +--
 example/ipsec/odp_ipsec.c                          | 28 ++++----
 example/l2fwd/odp_l2fwd.c                          | 10 +--
 example/packet/odp_pktio.c                         | 10 +--
 example/timer/odp_timer_test.c                     | 10 +--
 platform/linux-generic/include/api/odp_pool.h      | 71 +++++++++++---------
 .../linux-generic/include/odp_buffer_inlines.h     |  2 +-
 .../linux-generic/include/odp_buffer_internal.h    |  6 +-
 .../include/odp_buffer_pool_internal.h             |  6 +-
 platform/linux-generic/odp_buffer_pool.c           | 76 +++++++++++-----------
 platform/linux-generic/odp_event.c                 | 11 +---
 platform/linux-generic/odp_packet.c                | 12 ++--
 platform/linux-generic/odp_schedule.c              | 10 +--
 platform/linux-generic/odp_timer.c                 |  2 +-
 test/performance/odp_scheduling.c                  | 10 +--
 15 files changed, 135 insertions(+), 139 deletions(-)
diff mbox

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index dfc5d2b..68126d9 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -546,7 +546,7 @@  int main(int argc, char *argv[])
 	int first_cpu;
 	int cpu_count;
 	odp_shm_t shm;
-	odp_buffer_pool_param_t params;
+	odp_pool_param_t params;
 
 	/* Init ODP before calling anything else */
 	if (odp_init_global(NULL, NULL)) {
@@ -609,10 +609,10 @@  int main(int argc, char *argv[])
 	printf("First CPU:          %i\n\n", first_cpu);
 
 	/* Create packet pool */
-	params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
-	params.buf_align = 0;
-	params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
-	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
+	params.buf.size  = SHM_PKT_POOL_BUF_SIZE;
+	params.buf.align = 0;
+	params.buf.num   = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
+	params.type      = ODP_EVENT_PACKET;
 
 	pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL, &params);
 
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index faef46d..3ac8629 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -366,7 +366,7 @@  static
 void ipsec_init_pre(void)
 {
 	odp_queue_param_t qparam;
-	odp_buffer_pool_param_t params;
+	odp_pool_param_t params;
 
 	/*
 	 * Create queues
@@ -399,10 +399,10 @@  void ipsec_init_pre(void)
 	}
 
 	/* Create output buffer pool */
-	params.buf_size  = SHM_OUT_POOL_BUF_SIZE;
-	params.buf_align = 0;
-	params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;
-	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
+	params.buf.size  = SHM_OUT_POOL_BUF_SIZE;
+	params.buf.align = 0;
+	params.buf.num   = SHM_PKT_POOL_BUF_COUNT;
+	params.type      = ODP_EVENT_PACKET;
 
 	out_pool = odp_buffer_pool_create("out_pool", ODP_SHM_NULL, &params);
 
@@ -1176,7 +1176,7 @@  main(int argc, char *argv[])
 	int cpu_count;
 	int stream_count;
 	odp_shm_t shm;
-	odp_buffer_pool_param_t params;
+	odp_pool_param_t params;
 
 	/* Init ODP before calling anything else */
 	if (odp_init_global(NULL, NULL)) {
@@ -1236,10 +1236,10 @@  main(int argc, char *argv[])
 	printf("First CPU:         %i\n\n", first_cpu);
 
 	/* Create packet buffer pool */
-	params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
-	params.buf_align = 0;
-	params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;
-	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
+	params.buf.size  = SHM_PKT_POOL_BUF_SIZE;
+	params.buf.align = 0;
+	params.buf.num   = SHM_PKT_POOL_BUF_COUNT;
+	params.type      = ODP_EVENT_PACKET;
 
 	pkt_pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL,
 					  &params);
@@ -1250,10 +1250,10 @@  main(int argc, char *argv[])
 	}
 
 	/* Create context buffer pool */
-	params.buf_size  = SHM_CTX_POOL_BUF_SIZE;
-	params.buf_align = 0;
-	params.num_bufs  = SHM_CTX_POOL_BUF_COUNT;
-	params.buf_type  = ODP_BUFFER_TYPE_RAW;
+	params.buf.size  = SHM_CTX_POOL_BUF_SIZE;
+	params.buf.align = 0;
+	params.buf.num   = SHM_CTX_POOL_BUF_COUNT;
+	params.type      = ODP_EVENT_BUFFER;
 
 	ctx_pool = odp_buffer_pool_create("ctx_pool", ODP_SHM_NULL,
 					  &params);
diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index 195d329..b5386e8 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -292,7 +292,7 @@  int main(int argc, char *argv[])
 	int cpu_count;
 	int num_workers;
 	odp_shm_t shm;
-	odp_buffer_pool_param_t params;
+	odp_pool_param_t params;
 
 	/* Init ODP before calling anything else */
 	if (odp_init_global(NULL, NULL)) {
@@ -356,10 +356,10 @@  int main(int argc, char *argv[])
 	printf("First cpu:         %i\n\n", first_cpu);
 
 	/* Create packet pool */
-	params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
-	params.buf_align = 0;
-	params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
-	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
+	params.buf.size  = SHM_PKT_POOL_BUF_SIZE;
+	params.buf.align = 0;
+	params.buf.num   = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
+	params.type      = ODP_EVENT_PACKET;
 
 	pool = odp_buffer_pool_create("packet pool", ODP_SHM_NULL, &params);
 
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 2251aad..7670dc4 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -281,7 +281,7 @@  int main(int argc, char *argv[])
 	int i;
 	int first_cpu;
 	int cpu_count;
-	odp_buffer_pool_param_t params;
+	odp_pool_param_t params;
 
 	args = calloc(1, sizeof(args_t));
 	if (args == NULL) {
@@ -330,10 +330,10 @@  int main(int argc, char *argv[])
 	printf("First CPU:         %i\n\n", first_cpu);
 
 	/* Create packet pool */
-	params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
-	params.buf_align = 0;
-	params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
-	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
+	params.buf.size  = SHM_PKT_POOL_BUF_SIZE;
+	params.buf.align = 0;
+	params.buf.num   = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
+	params.type      = ODP_EVENT_PACKET;
 
 	pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL, &params);
 
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 944ef9e..897179b 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -305,7 +305,7 @@  int main(int argc, char *argv[])
 	int first_cpu;
 	uint64_t cycles, ns;
 	odp_queue_param_t param;
-	odp_buffer_pool_param_t params;
+	odp_pool_param_t params;
 	odp_timer_pool_param_t tparams;
 	odp_timer_pool_info_t tpinfo;
 
@@ -369,10 +369,10 @@  int main(int argc, char *argv[])
 	/*
 	 * Create buffer pool for timeouts
 	 */
-	params.buf_size  = 0;
-	params.buf_align = 0;
-	params.num_bufs  = MSG_NUM_BUFS;
-	params.buf_type  = ODP_BUFFER_TYPE_TIMEOUT;
+	params.buf.size  = 0;
+	params.buf.align = 0;
+	params.buf.num   = MSG_NUM_BUFS;
+	params.type      = ODP_EVENT_TIMEOUT;
 
 	pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, &params);
 
diff --git a/platform/linux-generic/include/api/odp_pool.h b/platform/linux-generic/include/api/odp_pool.h
index 30a805f..657cee7 100644
--- a/platform/linux-generic/include/api/odp_pool.h
+++ b/platform/linux-generic/include/api/odp_pool.h
@@ -23,37 +23,48 @@  extern "C" {
 #include <odp_std_types.h>
 #include <odp_platform_types.h>
 #include <odp_buffer.h>
+#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       1  /**< Raw buffer, no additional metadata */
-#define ODP_BUFFER_TYPE_PACKET    2  /**< Packet buffer */
-#define ODP_BUFFER_TYPE_TIMEOUT   3  /**< Timeout buffer */
+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;  /**< Event type */
+
+} odp_pool_param_t;
 
 /**
  * Create a buffer pool
@@ -78,7 +89,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()
@@ -117,13 +128,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 ee264a6..000e673 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 c3784ba..14c32c1 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,11 +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_INVALID (-1) /**< Buffer type invalid */
-#define _ODP_BUFFER_TYPE_ANY       0  /**< Buffer that can hold any other
-					  buffer type */
-
-
 
 #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 b0e696e..4ace3c3 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],
diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c
index d243045..53f468c 100644
--- a/platform/linux-generic/odp_buffer_pool.c
+++ b/platform/linux-generic/odp_buffer_pool.c
@@ -101,7 +101,7 @@  int odp_buffer_pool_init_global(void)
 
 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)
 {
 	odp_buffer_pool_t pool_hdl = ODP_BUFFER_POOL_INVALID;
 	pool_entry_t *pool;
@@ -131,7 +131,7 @@  odp_buffer_pool_t odp_buffer_pool_create(const char *name,
 		0;
 
 	uint32_t blk_size, buf_stride;
-	uint32_t buf_align = params->buf_align;
+	uint32_t buf_align = params->buf.align;
 
 	/* Validate requested buffer alignment */
 	if (buf_align > ODP_CONFIG_BUFFER_ALIGN_MAX ||
@@ -145,36 +145,35 @@  odp_buffer_pool_t odp_buffer_pool_create(const char *name,
 		buf_align = ODP_CONFIG_BUFFER_ALIGN_MIN;
 
 	/* Calculate space needed for buffer blocks and metadata */
-	switch (params->buf_type) {
-	case ODP_BUFFER_TYPE_RAW:
-	case ODP_BUFFER_TYPE_TIMEOUT:
-		blk_size = params->buf_size;
+	switch (params->type) {
+	case ODP_EVENT_BUFFER:
+	case ODP_EVENT_TIMEOUT:
+		blk_size = params->buf.size;
 
 		/* Optimize small raw buffers */
-		if (blk_size > ODP_MAX_INLINE_BUF || params->buf_align != 0)
+		if (blk_size > ODP_MAX_INLINE_BUF || params->buf.align != 0)
 			blk_size = ODP_ALIGN_ROUNDUP(blk_size, buf_align);
 
-		buf_stride = params->buf_type == ODP_BUFFER_TYPE_RAW ?
+		buf_stride = params->type == ODP_EVENT_BUFFER ?
 			sizeof(odp_buffer_hdr_stride) :
 			sizeof(odp_timeout_hdr_stride);
 		break;
 
-	case ODP_BUFFER_TYPE_PACKET:
-	case _ODP_BUFFER_TYPE_ANY:
+	case ODP_EVENT_PACKET:
 		headroom = ODP_CONFIG_PACKET_HEADROOM;
 		tailroom = ODP_CONFIG_PACKET_TAILROOM;
-		unsegmented = params->buf_size > ODP_CONFIG_PACKET_BUF_LEN_MAX;
+		unsegmented = params->buf.size > ODP_CONFIG_PACKET_BUF_LEN_MAX;
 
 		if (unsegmented)
 			blk_size = ODP_ALIGN_ROUNDUP(
-				headroom + params->buf_size + tailroom,
+				headroom + params->buf.size + tailroom,
 				buf_align);
 		else
 			blk_size = ODP_ALIGN_ROUNDUP(
-				headroom + params->buf_size + tailroom,
+				headroom + params->buf.size + tailroom,
 				ODP_CONFIG_PACKET_BUF_LEN_MIN);
 
-		buf_stride = params->buf_type == ODP_BUFFER_TYPE_PACKET ?
+		buf_stride = params->type == ODP_EVENT_PACKET ?
 			sizeof(odp_packet_hdr_stride) :
 			sizeof(odp_any_hdr_stride);
 		break;
@@ -184,7 +183,7 @@  odp_buffer_pool_t odp_buffer_pool_create(const char *name,
 	}
 
 	/* Validate requested number of buffers against addressable limits */
-	if (params->num_bufs >
+	if (params->buf.num >
 	    (ODP_BUFFER_MAX_BUFFERS / (buf_stride / ODP_CACHE_LINE_SIZE)))
 		return ODP_BUFFER_POOL_INVALID;
 
@@ -207,8 +206,8 @@  odp_buffer_pool_t odp_buffer_pool_create(const char *name,
 			pool->s.name[0] = 0;
 		} else {
 			strncpy(pool->s.name, name,
-				ODP_BUFFER_POOL_NAME_LEN - 1);
-			pool->s.name[ODP_BUFFER_POOL_NAME_LEN - 1] = 0;
+				ODP_POOL_NAME_LEN - 1);
+			pool->s.name[ODP_POOL_NAME_LEN - 1] = 0;
 			pool->s.flags.has_name = 1;
 		}
 
@@ -221,13 +220,13 @@  odp_buffer_pool_t odp_buffer_pool_create(const char *name,
 			block_size = 0;
 			pool->s.buf_align = blk_size == 0 ? 0 : sizeof(void *);
 		} else {
-			block_size = params->num_bufs * blk_size;
+			block_size = params->buf.num * blk_size;
 			pool->s.buf_align = buf_align;
 		}
 
 		pad_size = ODP_CACHE_LINE_SIZE_ROUNDUP(block_size) - block_size;
-		mdata_size = params->num_bufs * buf_stride;
-		udata_size = params->num_bufs * udata_stride;
+		mdata_size = params->buf.num * buf_stride;
+		udata_size = params->buf.num * udata_stride;
 
 		pool->s.pool_size = ODP_PAGE_SIZE_ROUNDUP(block_size +
 							  pad_size +
@@ -310,7 +309,7 @@  odp_buffer_pool_t odp_buffer_pool_create(const char *name,
 			tmp->flags.zeroized = zeroized;
 			tmp->size = 0;
 			odp_atomic_store_u32(&tmp->ref_count, 0);
-			tmp->type = params->buf_type;
+			tmp->type = params->type;
 			tmp->pool_hdl = pool->s.pool_hdl;
 			tmp->udata_addr = (void *)udat;
 			tmp->udata_size = init_params->udata_size;
@@ -365,8 +364,8 @@  odp_buffer_pool_t odp_buffer_pool_create(const char *name,
 		pool->s.tailroom = tailroom;
 
 		/* Watermarks are hard-coded for now to control caching */
-		pool->s.high_wm = params->num_bufs / 2;
-		pool->s.low_wm = params->num_bufs / 4;
+		pool->s.high_wm = params->buf.num / 2;
+		pool->s.low_wm = params->buf.num / 4;
 
 		pool_hdl = pool->s.pool_hdl;
 		break;
@@ -408,10 +407,10 @@  int odp_buffer_pool_info(odp_buffer_pool_t pool_hdl,
 	info->name = pool->s.name;
 	info->shm  = pool->s.flags.user_supplied_shm ?
 		pool->s.pool_shm : ODP_SHM_INVALID;
-	info->params.buf_size  = pool->s.params.buf_size;
-	info->params.buf_align = pool->s.params.buf_align;
-	info->params.num_bufs  = pool->s.params.num_bufs;
-	info->params.buf_type  = pool->s.params.buf_type;
+	info->params.buf.size  = pool->s.params.buf.size;
+	info->params.buf.align = pool->s.params.buf.align;
+	info->params.buf.num   = pool->s.params.buf.num;
+	info->params.type      = pool->s.params.type;
 
 	return 0;
 }
@@ -437,7 +436,7 @@  int odp_buffer_pool_destroy(odp_buffer_pool_t pool_hdl)
 	flush_cache(&local_cache[pool_id], &pool->s);
 
 	/* Call fails if pool has allocated buffers */
-	if (odp_atomic_load_u32(&pool->s.bufcount) < pool->s.params.num_bufs) {
+	if (odp_atomic_load_u32(&pool->s.bufcount) < pool->s.params.buf.num) {
 		POOL_UNLOCK(&pool->s.lock);
 		return -1;
 	}
@@ -494,7 +493,7 @@  odp_buffer_t buffer_alloc(odp_buffer_pool_t pool_hdl, size_t size)
 	/* By default, buffers inherit their pool's zeroization setting */
 	buf->buf.flags.zeroized = pool->s.flags.zeroized;
 
-	if (buf->buf.type == ODP_BUFFER_TYPE_PACKET) {
+	if (buf->buf.type == ODP_EVENT_PACKET) {
 		packet_init(pool, &buf->pkt, size);
 
 		if (pool->s.init_params.buf_init != NULL)
@@ -509,7 +508,7 @@  odp_buffer_t buffer_alloc(odp_buffer_pool_t pool_hdl, size_t size)
 odp_buffer_t odp_buffer_alloc(odp_buffer_pool_t pool_hdl)
 {
 	return buffer_alloc(pool_hdl,
-			    odp_pool_to_entry(pool_hdl)->s.params.buf_size);
+			    odp_pool_to_entry(pool_hdl)->s.params.buf.size);
 }
 
 void odp_buffer_free(odp_buffer_t buf)
@@ -558,11 +557,10 @@  void odp_buffer_pool_print(odp_buffer_pool_t pool_hdl)
 	ODP_DBG(" name            %s\n",
 		pool->s.flags.has_name ? pool->s.name : "Unnamed Pool");
 	ODP_DBG(" pool type       %s\n",
-		pool->s.params.buf_type == ODP_BUFFER_TYPE_RAW ? "raw" :
-	       (pool->s.params.buf_type == ODP_BUFFER_TYPE_PACKET ? "packet" :
-	       (pool->s.params.buf_type == ODP_BUFFER_TYPE_TIMEOUT ? "timeout" :
-	       (pool->s.params.buf_type == _ODP_BUFFER_TYPE_ANY ? "any" :
-		"unknown"))));
+		pool->s.params.type == ODP_EVENT_BUFFER ? "buffer" :
+	       (pool->s.params.type == ODP_EVENT_PACKET ? "packet" :
+	       (pool->s.params.type == ODP_EVENT_TIMEOUT ? "timeout" :
+		"unknown")));
 	ODP_DBG(" pool storage    %sODP managed\n",
 		pool->s.flags.user_supplied_shm ?
 		"application provided, " : "");
@@ -578,14 +576,14 @@  void odp_buffer_pool_print(odp_buffer_pool_t pool_hdl)
 	ODP_DBG(" pool mdata base %p\n",  pool->s.pool_mdata_addr);
 	ODP_DBG(" udata size      %zu\n", pool->s.init_params.udata_size);
 	ODP_DBG(" headroom        %u\n",  pool->s.headroom);
-	ODP_DBG(" buf size        %zu\n", pool->s.params.buf_size);
+	ODP_DBG(" buf size        %zu\n", pool->s.params.buf.size);
 	ODP_DBG(" tailroom        %u\n",  pool->s.tailroom);
 	ODP_DBG(" buf align       %u requested, %u used\n",
-		pool->s.params.buf_align, pool->s.buf_align);
-	ODP_DBG(" num bufs        %u\n",  pool->s.params.num_bufs);
+		pool->s.params.buf.align, pool->s.buf_align);
+	ODP_DBG(" num bufs        %u\n",  pool->s.params.buf.num);
 	ODP_DBG(" bufs available  %u %s\n", bufcount,
 		pool->s.low_wm_assert ? " **low wm asserted**" : "");
-	ODP_DBG(" bufs in use     %u\n",  pool->s.params.num_bufs - bufcount);
+	ODP_DBG(" bufs in use     %u\n",  pool->s.params.buf.num - bufcount);
 	ODP_DBG(" buf allocs      %lu\n", bufallocs);
 	ODP_DBG(" buf frees       %lu\n", buffrees);
 	ODP_DBG(" buf empty       %lu\n", bufempty);
diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c
index f3e70b9..c4291f8 100644
--- a/platform/linux-generic/odp_event.c
+++ b/platform/linux-generic/odp_event.c
@@ -15,14 +15,5 @@  int odp_event_type(odp_event_t event)
 
 	buf = odp_buffer_from_event(event);
 
-	switch (_odp_buffer_type(buf)) {
-	case ODP_BUFFER_TYPE_RAW:
-		return ODP_EVENT_BUFFER;
-	case ODP_BUFFER_TYPE_PACKET:
-		return ODP_EVENT_PACKET;
-	case ODP_BUFFER_TYPE_TIMEOUT:
-		return ODP_EVENT_TIMEOUT;
-	default:
-		return ODP_EVENT_TYPE_INVALID;
-	}
+	return _odp_buffer_type(buf);
 }
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 3ce6f47..6c4bb25 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -29,17 +29,17 @@  odp_packet_t odp_packet_alloc(odp_buffer_pool_t pool_hdl, uint32_t len)
 {
 	pool_entry_t *pool = odp_pool_to_entry(pool_hdl);
 
-	if (pool->s.params.buf_type != ODP_BUFFER_TYPE_PACKET)
+	if (pool->s.params.type != ODP_EVENT_PACKET)
 		return ODP_PACKET_INVALID;
 
 	/* Handle special case for zero-length packets */
 	if (len == 0) {
 		odp_packet_t pkt =
 			(odp_packet_t)buffer_alloc(pool_hdl,
-						   pool->s.params.buf_size);
+						   pool->s.params.buf.size);
 		if (pkt != ODP_PACKET_INVALID)
 			pull_tail(odp_packet_hdr(pkt),
-				  pool->s.params.buf_size);
+				  pool->s.params.buf.size);
 
 		return pkt;
 	}
@@ -581,7 +581,7 @@  int odp_packet_is_valid(odp_packet_t pkt)
 {
 	odp_buffer_hdr_t *buf = validate_buf((odp_buffer_t)pkt);
 
-	return (buf != NULL && buf->type == ODP_BUFFER_TYPE_PACKET);
+	return (buf != NULL && buf->type == ODP_EVENT_PACKET);
 }
 
 /*
@@ -627,11 +627,11 @@  odp_packet_t _odp_packet_alloc(odp_buffer_pool_t pool_hdl)
 {
 	pool_entry_t *pool = odp_pool_to_entry(pool_hdl);
 
-	if (pool->s.params.buf_type != ODP_BUFFER_TYPE_PACKET)
+	if (pool->s.params.type != ODP_EVENT_PACKET)
 		return ODP_PACKET_INVALID;
 
 	return (odp_packet_t)buffer_alloc(pool_hdl,
-					  pool->s.params.buf_size);
+					  pool->s.params.buf.size);
 }
 
 /**
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index 9ca08b7..9e7aed1 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -85,7 +85,7 @@  int odp_schedule_init_global(void)
 	odp_shm_t shm;
 	odp_buffer_pool_t pool;
 	int i, j;
-	odp_buffer_pool_param_t params;
+	odp_pool_param_t params;
 
 	ODP_DBG("Schedule init ... ");
 
@@ -100,10 +100,10 @@  int odp_schedule_init_global(void)
 		return -1;
 	}
 
-	params.buf_size  = sizeof(queue_desc_t);
-	params.buf_align = 0;
-	params.num_bufs  = SCHED_POOL_SIZE/sizeof(queue_desc_t);
-	params.buf_type  = ODP_BUFFER_TYPE_RAW;
+	params.buf.size  = sizeof(queue_desc_t);
+	params.buf.align = 0;
+	params.buf.num   = SCHED_POOL_SIZE/sizeof(queue_desc_t);
+	params.type      = ODP_EVENT_BUFFER;
 
 	pool = odp_buffer_pool_create("odp_sched_pool", ODP_SHM_NULL, &params);
 
diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index 6a89cc2..bc8b0da 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -557,7 +557,7 @@  static unsigned timer_expire(odp_timer_pool *tp, uint32_t idx, uint64_t tick)
 #endif
 	if (odp_likely(tmo_buf != ODP_BUFFER_INVALID)) {
 		/* Fill in metadata fields in system timeout buffer */
-		if (_odp_buffer_type(tmo_buf) == ODP_BUFFER_TYPE_TIMEOUT) {
+		if (_odp_buffer_type(tmo_buf) == ODP_EVENT_TIMEOUT) {
 			/* Convert from buffer to timeout hdr */
 			odp_timeout_hdr_t *tmo_hdr =
 				timeout_hdr_from_buf(tmo_buf);
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index e12da56..c979e1c 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -828,7 +828,7 @@  int main(int argc, char *argv[])
 	int first_cpu;
 	odp_shm_t shm;
 	test_globals_t *globals;
-	odp_buffer_pool_param_t params;
+	odp_pool_param_t params;
 
 	printf("\nODP example starts\n\n");
 
@@ -911,10 +911,10 @@  int main(int argc, char *argv[])
 	 * Create message pool
 	 */
 
-	params.buf_size  = sizeof(test_message_t);
-	params.buf_align = 0;
-	params.num_bufs  = MSG_POOL_SIZE/sizeof(test_message_t);
-	params.buf_type  = ODP_BUFFER_TYPE_RAW;
+	params.buf.size  = sizeof(test_message_t);
+	params.buf.align = 0;
+	params.buf.num   = MSG_POOL_SIZE/sizeof(test_message_t);
+	params.type      = ODP_EVENT_BUFFER;
 
 	pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, &params);