@@ -47,7 +47,7 @@ typedef struct {
int cpu_count; /**< system CPU count */
int if_count; /**< Number of interfaces to be used */
char **if_names; /**< Array of pointers to interface names */
- odp_buffer_pool_t pool; /**< Buffer pool for packet IO */
+ odp_pool_t pool; /**< Pool for packet IO */
odph_ethaddr_t srcmac; /**< src mac addr */
odph_ethaddr_t dstmac; /**< dest mac addr */
unsigned int srcip; /**< src ip addr */
@@ -74,7 +74,7 @@ static struct {
*/
typedef struct {
char *pktio_dev; /**< Interface name to use */
- odp_buffer_pool_t pool; /**< Buffer pool for packet IO */
+ odp_pool_t pool; /**< Pool for packet IO */
int mode; /**< Thread mode */
} thread_args_t;
@@ -173,7 +173,7 @@ static int scan_mac(char *in, odph_ethaddr_t *des)
* @return Handle of created packet
* @retval ODP_PACKET_INVALID Packet could not be created
*/
-static odp_packet_t pack_udp_pkt(odp_buffer_pool_t pool)
+static odp_packet_t pack_udp_pkt(odp_pool_t pool)
{
odp_packet_t pkt;
char *buf;
@@ -229,7 +229,7 @@ static odp_packet_t pack_udp_pkt(odp_buffer_pool_t pool)
* @return Handle of created packet
* @retval ODP_PACKET_INVALID Packet could not be created
*/
-static odp_packet_t pack_icmp_pkt(odp_buffer_pool_t pool)
+static odp_packet_t pack_icmp_pkt(odp_pool_t pool)
{
odp_packet_t pkt;
char *buf;
@@ -287,7 +287,7 @@ static odp_packet_t pack_icmp_pkt(odp_buffer_pool_t pool)
return pkt;
}
-static odp_pktio_t create_pktio(const char *dev, odp_buffer_pool_t pool)
+static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool)
{
odp_queue_param_t qparam;
char inq_name[ODP_QUEUE_NAME_LEN];
@@ -540,7 +540,7 @@ static void *gen_recv_thread(void *arg)
int main(int argc, char *argv[])
{
odph_linux_pthread_t thread_tbl[MAX_WORKERS];
- odp_buffer_pool_t pool;
+ odp_pool_t pool;
int num_workers;
int i;
int first_cpu;
@@ -614,13 +614,13 @@ int main(int argc, char *argv[])
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, ¶ms);
+ pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms);
- if (pool == ODP_BUFFER_POOL_INVALID) {
+ if (pool == ODP_POOL_INVALID) {
EXAMPLE_ERR("Error: packet pool create failed.\n");
exit(EXIT_FAILURE);
}
- odp_buffer_pool_print(pool);
+ odp_pool_print(pool);
for (i = 0; i < args->appl.if_count; ++i)
create_pktio(args->appl.if_names[i], pool);
@@ -53,7 +53,7 @@ typedef struct {
int if_count; /**< Number of interfaces to be used */
char **if_names; /**< Array of pointers to interface names */
crypto_api_mode_e mode; /**< Crypto API preferred mode */
- odp_buffer_pool_t pool; /**< Buffer pool for packet IO */
+ odp_pool_t pool; /**< Buffer pool for packet IO */
} appl_args_t;
/**
@@ -79,7 +79,7 @@ static args_t *args;
#define SHM_PKT_POOL_BUF_SIZE 4096
#define SHM_PKT_POOL_SIZE (SHM_PKT_POOL_BUF_COUNT * SHM_PKT_POOL_BUF_SIZE)
-static odp_buffer_pool_t pkt_pool = ODP_BUFFER_POOL_INVALID;
+static odp_pool_t pkt_pool = ODP_POOL_INVALID;
/**
* Buffer pool for crypto session output packets
@@ -88,7 +88,7 @@ static odp_buffer_pool_t pkt_pool = ODP_BUFFER_POOL_INVALID;
#define SHM_OUT_POOL_BUF_SIZE 4096
#define SHM_OUT_POOL_SIZE (SHM_OUT_POOL_BUF_COUNT * SHM_OUT_POOL_BUF_SIZE)
-static odp_buffer_pool_t out_pool = ODP_BUFFER_POOL_INVALID;
+static odp_pool_t out_pool = ODP_POOL_INVALID;
/** ATOMIC queue for IPsec sequence number assignment */
static odp_queue_t seqnumq;
@@ -155,7 +155,7 @@ typedef struct {
#define SHM_CTX_POOL_BUF_COUNT (SHM_PKT_POOL_BUF_COUNT + SHM_OUT_POOL_BUF_COUNT)
#define SHM_CTX_POOL_SIZE (SHM_CTX_POOL_BUF_COUNT * SHM_CTX_POOL_BUF_SIZE)
-static odp_buffer_pool_t ctx_pool = ODP_BUFFER_POOL_INVALID;
+static odp_pool_t ctx_pool = ODP_POOL_INVALID;
/**
* Get per packet processing context from packet buffer
@@ -404,9 +404,9 @@ void ipsec_init_pre(void)
params.buf.num = SHM_PKT_POOL_BUF_COUNT;
params.type = ODP_EVENT_PACKET;
- out_pool = odp_buffer_pool_create("out_pool", ODP_SHM_NULL, ¶ms);
+ out_pool = odp_pool_create("out_pool", ODP_SHM_NULL, ¶ms);
- if (ODP_BUFFER_POOL_INVALID == out_pool) {
+ if (ODP_POOL_INVALID == out_pool) {
EXAMPLE_ERR("Error: message pool create failed.\n");
exit(EXIT_FAILURE);
}
@@ -1241,10 +1241,10 @@ main(int argc, char *argv[])
params.buf.num = SHM_PKT_POOL_BUF_COUNT;
params.type = ODP_EVENT_PACKET;
- pkt_pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL,
+ pkt_pool = odp_pool_create("packet_pool", ODP_SHM_NULL,
¶ms);
- if (ODP_BUFFER_POOL_INVALID == pkt_pool) {
+ if (ODP_POOL_INVALID == pkt_pool) {
EXAMPLE_ERR("Error: packet pool create failed.\n");
exit(EXIT_FAILURE);
}
@@ -1255,10 +1255,10 @@ main(int argc, char *argv[])
params.buf.num = SHM_CTX_POOL_BUF_COUNT;
params.type = ODP_EVENT_BUFFER;
- ctx_pool = odp_buffer_pool_create("ctx_pool", ODP_SHM_NULL,
+ ctx_pool = odp_pool_create("ctx_pool", ODP_SHM_NULL,
¶ms);
- if (ODP_BUFFER_POOL_INVALID == ctx_pool) {
+ if (ODP_POOL_INVALID == ctx_pool) {
EXAMPLE_ERR("Error: context pool create failed.\n");
exit(EXIT_FAILURE);
}
@@ -41,7 +41,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
crypto_api_mode_e api_mode,
bool in,
odp_queue_t completionq,
- odp_buffer_pool_t out_pool)
+ odp_pool_t out_pool)
{
odp_crypto_session_params_t params;
ipsec_cache_entry_t *entry;
@@ -59,7 +59,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
if (CRYPTO_API_SYNC == api_mode) {
params.pref_mode = ODP_CRYPTO_SYNC;
params.compl_queue = ODP_QUEUE_INVALID;
- params.output_pool = ODP_BUFFER_POOL_INVALID;
+ params.output_pool = ODP_POOL_INVALID;
} else {
params.pref_mode = ODP_CRYPTO_ASYNC;
params.compl_queue = completionq;
@@ -90,7 +90,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
crypto_api_mode_e api_mode,
bool in,
odp_queue_t completionq,
- odp_buffer_pool_t out_pool);
+ odp_pool_t out_pool);
/**
* Find a matching IPsec cache entry for input packet
@@ -42,7 +42,7 @@ void init_loopback_db(void)
void create_loopback_db_entry(int idx,
odp_queue_t inq_def,
odp_queue_t outq_def,
- odp_buffer_pool_t pkt_pool)
+ odp_pool_t pkt_pool)
{
loopback_db_entry_t *entry = &loopback_db->intf[idx];
@@ -19,10 +19,10 @@ extern "C" {
* Loopback database entry structure
*/
typedef struct loopback_db_entry_s {
- odp_queue_t inq_def;
- odp_queue_t outq_def;
- odp_buffer_pool_t pkt_pool;
- uint8_t mac[ODPH_ETHADDR_LEN];
+ odp_queue_t inq_def;
+ odp_queue_t outq_def;
+ odp_pool_t pkt_pool;
+ uint8_t mac[ODPH_ETHADDR_LEN];
} loopback_db_entry_t;
typedef struct loopback_db_s {
@@ -48,7 +48,7 @@ void init_loopback_db(void);
void create_loopback_db_entry(int idx,
odp_queue_t inq_def,
odp_queue_t outq_def,
- odp_buffer_pool_t pkt_pool);
+ odp_pool_t pkt_pool);
/**
* Parse loop interface index
@@ -117,7 +117,7 @@ odp_queue_t query_loopback_db_outq(int idx)
* @return ODP buffer pool
*/
static inline
-odp_buffer_pool_t query_loopback_db_pkt_pool(int idx)
+odp_pool_t query_loopback_db_pkt_pool(int idx)
{
return loopback_db->intf[idx].pkt_pool;
}
@@ -172,7 +172,7 @@ void resolve_stream_db(void)
odp_packet_t create_ipv4_packet(stream_db_entry_t *stream,
uint8_t *dmac,
- odp_buffer_pool_t pkt_pool)
+ odp_pool_t pkt_pool)
{
ipsec_cache_entry_t *entry = stream->input.entry;
odp_packet_t pkt;
@@ -472,12 +472,12 @@ bool verify_ipv4_packet(stream_db_entry_t *stream,
int create_stream_db_inputs(void)
{
int created = 0;
- odp_buffer_pool_t pkt_pool;
+ odp_pool_t pkt_pool;
stream_db_entry_t *stream = NULL;
/* Lookup the packet pool */
- pkt_pool = odp_buffer_pool_lookup("packet_pool");
- if (pkt_pool == ODP_BUFFER_POOL_INVALID) {
+ pkt_pool = odp_pool_lookup("packet_pool");
+ if (pkt_pool == ODP_POOL_INVALID) {
EXAMPLE_ERR("Error: pkt_pool not found\n");
exit(EXIT_FAILURE);
}
@@ -88,7 +88,7 @@ void resolve_stream_db(void);
*/
odp_packet_t create_ipv4_packet(stream_db_entry_t *stream,
uint8_t *dmac,
- odp_buffer_pool_t pkt_pool);
+ odp_pool_t pkt_pool);
/**
* Verify an IPv4 packet received on a loop output queue
@@ -238,7 +238,7 @@ static void *pktio_ifburst_thread(void *arg)
/**
* Create a pktio handle, optionally associating a default input queue.
*/
-static odp_pktio_t create_pktio(const char *dev, odp_buffer_pool_t pool,
+static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool,
int mode)
{
char inq_name[ODP_QUEUE_NAME_LEN];
@@ -286,7 +286,7 @@ static odp_pktio_t create_pktio(const char *dev, odp_buffer_pool_t pool,
int main(int argc, char *argv[])
{
odph_linux_pthread_t thread_tbl[MAX_WORKERS];
- odp_buffer_pool_t pool;
+ odp_pool_t pool;
int i;
int first_cpu;
int cpu_count;
@@ -361,13 +361,13 @@ int main(int argc, char *argv[])
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, ¶ms);
+ pool = odp_pool_create("packet pool", ODP_SHM_NULL, ¶ms);
- if (pool == ODP_BUFFER_POOL_INVALID) {
+ if (pool == ODP_POOL_INVALID) {
EXAMPLE_ERR("Error: packet pool create failed.\n");
exit(EXIT_FAILURE);
}
- odp_buffer_pool_print(pool);
+ odp_pool_print(pool);
for (i = 0; i < gbl_args->appl.if_count; ++i) {
gbl_args->pktios[i] = create_pktio(gbl_args->appl.if_names[i],
@@ -100,7 +100,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args);
static void print_info(char *progname, appl_args_t *appl_args);
static void usage(char *progname);
-static odp_pktio_t create_pktio(const char *dev, odp_buffer_pool_t pool)
+static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool)
{
odp_pktio_t pktio;
odp_queue_t inq_def;
@@ -276,7 +276,7 @@ static void *pktio_ifburst_thread(void *arg)
int main(int argc, char *argv[])
{
odph_linux_pthread_t thread_tbl[MAX_WORKERS];
- odp_buffer_pool_t pool;
+ odp_pool_t pool;
int num_workers;
int i;
int first_cpu;
@@ -335,13 +335,13 @@ int main(int argc, char *argv[])
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, ¶ms);
+ pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms);
- if (pool == ODP_BUFFER_POOL_INVALID) {
+ if (pool == ODP_POOL_INVALID) {
EXAMPLE_ERR("Error: packet pool create failed.\n");
exit(EXIT_FAILURE);
}
- odp_buffer_pool_print(pool);
+ odp_pool_print(pool);
/* Create a pktio instance for each interface */
for (i = 0; i < args->appl.if_count; ++i)
@@ -44,7 +44,7 @@ typedef struct {
static odp_barrier_t test_barrier;
/** @private Buffer pool handle */
-static odp_buffer_pool_t pool;
+static odp_pool_t pool;
/** @private Timer pool handle */
static odp_timer_pool_t tp;
@@ -177,7 +177,7 @@ static void test_abs_timeouts(int thr, test_args_t *args)
static void *run_thread(void *ptr)
{
int thr;
- odp_buffer_pool_t msg_pool;
+ odp_pool_t msg_pool;
test_args_t *args;
args = ptr;
@@ -188,9 +188,9 @@ static void *run_thread(void *ptr)
/*
* Find the buffer pool
*/
- msg_pool = odp_buffer_pool_lookup("msg_pool");
+ msg_pool = odp_pool_lookup("msg_pool");
- if (msg_pool == ODP_BUFFER_POOL_INVALID) {
+ if (msg_pool == ODP_POOL_INVALID) {
EXAMPLE_ERR(" [%i] msg_pool not found\n", thr);
return NULL;
}
@@ -374,9 +374,9 @@ int main(int argc, char *argv[])
params.buf.num = MSG_NUM_BUFS;
params.type = ODP_EVENT_TIMEOUT;
- pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, ¶ms);
+ pool = odp_pool_create("msg_pool", ODP_SHM_NULL, ¶ms);
- if (pool == ODP_BUFFER_POOL_INVALID) {
+ if (pool == ODP_POOL_INVALID) {
EXAMPLE_ERR("Buffer pool create failed.\n");
return -1;
}
@@ -85,7 +85,7 @@ int odp_buffer_is_valid(odp_buffer_t buf);
*
* @return Handle of buffer pool buffer belongs to
*/
-odp_buffer_pool_t odp_buffer_pool(odp_buffer_t buf);
+odp_pool_t odp_buffer_pool(odp_buffer_t buf);
/**
* Print buffer metadata to STDOUT
@@ -109,7 +109,7 @@ typedef struct odp_crypto_session_params {
enum odp_auth_alg auth_alg; /**< Authentication algorithm */
odp_crypto_key_t auth_key; /**< Authentication key */
odp_queue_t compl_queue; /**< Async mode completion event queue */
- odp_buffer_pool_t output_pool; /**< Output buffer pool */
+ odp_pool_t output_pool; /**< Output buffer pool */
} odp_crypto_session_params_t;
/**
@@ -51,7 +51,7 @@ extern "C" {
* Allocate a packet from a buffer pool
*
* Allocates a packet of the requested length from the specified buffer pool.
- * Pool must have been created with buffer type ODP_BUFFER_TYPE_PACKET. The
+ * Pool must have been created with ODP_EVENT_PACKET type. The
* packet is initialized with data pointers and lengths set according to the
* specified len, and the default headroom and tailroom length settings. All
* other packet metadata are set to their default values.
@@ -66,7 +66,7 @@ extern "C" {
* the ODP_CONFIG_PACKET_HEADROOM and ODP_CONFIG_PACKET_TAILROOM defines in
* odp_config.h.
*/
-odp_packet_t odp_packet_alloc(odp_buffer_pool_t pool, uint32_t len);
+odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t len);
/**
* Free packet
@@ -383,7 +383,7 @@ void *odp_packet_offset(odp_packet_t pkt, uint32_t offset, uint32_t *len,
*
* @return Buffer pool handle
*/
-odp_buffer_pool_t odp_packet_pool(odp_packet_t pkt);
+odp_pool_t odp_packet_pool(odp_packet_t pkt);
/**
* Packet input interface
@@ -774,14 +774,14 @@ odp_packet_t odp_packet_rem_data(odp_packet_t pkt, uint32_t offset,
*
* Create a new copy of the packet. The new packet is exact copy of the source
* packet (incl. data and metadata). The pool must have been created with
- * buffer type ODP_BUFFER_TYPE_PACKET.
+ * ODP_EVENT_PACKET type.
*
* @param pkt Packet handle
* @param pool Buffer pool for allocation of the new packet.
*
* @return Handle to the copy of the packet, or ODP_PACKET_INVALID
*/
-odp_packet_t odp_packet_copy(odp_packet_t pkt, odp_buffer_pool_t pool);
+odp_packet_t odp_packet_copy(odp_packet_t pkt, odp_pool_t pool);
/**
* Copy data from packet
@@ -46,7 +46,7 @@ extern "C" {
* device used for testing. Usually it's loop back
* interface.
*/
-odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool);
+odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t pool);
/**
* Close an ODP packet IO instance
@@ -24,10 +24,10 @@
*/
/** ODP Buffer pool */
-typedef uint32_t odp_buffer_pool_t;
+typedef uint32_t odp_pool_t;
/** Invalid buffer pool */
-#define ODP_BUFFER_POOL_INVALID (0xffffffff)
+#define ODP_POOL_INVALID (0xffffffff)
/** ODP buffer */
typedef uint32_t odp_buffer_t;
@@ -67,100 +67,97 @@ typedef struct odp_pool_param_t {
} odp_pool_param_t;
/**
- * Create a buffer pool
- * This routine is used to create a buffer pool. It take three
+ * Create a pool
+ * This routine is used to create a pool. It take three
* arguments: the optional name of the pool to be created, an optional shared
* memory handle, and a parameter struct that describes the pool to be
* created. If a name is not specified the result is an anonymous pool that
- * cannot be referenced by odp_buffer_pool_lookup().
+ * cannot be referenced by odp_pool_lookup().
*
- * @param name Name of the pool, max ODP_BUFFER_POOL_NAME_LEN-1 chars.
+ * @param name Name of the pool, max ODP_POOL_NAME_LEN-1 chars.
* May be specified as NULL for anonymous pools.
*
* @param shm The shared memory object in which to create the pool.
* Use ODP_SHM_NULL to reserve default memory type
- * for the buffer type.
+ * for the pool type.
*
- * @param params Buffer pool parameters.
+ * @param params Pool parameters.
*
- * @return Handle of the created buffer pool
- * @retval ODP_BUFFER_POOL_INVALID Buffer pool could not be created
+ * @return Handle of the created pool
+ * @retval ODP_POOL_INVALID Pool could not be created
*/
-odp_buffer_pool_t odp_buffer_pool_create(const char *name,
- odp_shm_t shm,
- odp_pool_param_t *params);
+odp_pool_t odp_pool_create(const char *name, odp_shm_t shm,
+ odp_pool_param_t *params);
/**
- * Destroy a buffer pool previously created by odp_buffer_pool_create()
+ * Destroy a pool previously created by odp_pool_create()
*
- * @param pool Handle of the buffer pool to be destroyed
+ * @param pool Handle of the pool to be destroyed
*
* @retval 0 Success
* @retval -1 Failure
*
- * @note This routine destroys a previously created buffer pool. This call
+ * @note This routine destroys a previously created pool. This call
* does not destroy any shared memory object passed to
- * odp_buffer_pool_create() used to store the buffer pool contents. The caller
+ * odp_pool_create() used to store the pool contents. The caller
* takes responsibility for that. If no shared memory object was passed as
* part of the create call, then this routine will destroy any internal shared
- * memory objects associated with the buffer pool. Results are undefined if
- * an attempt is made to destroy a buffer pool that contains allocated or
+ * memory objects associated with the pool. Results are undefined if
+ * an attempt is made to destroy a pool that contains allocated or
* otherwise active buffers.
*/
-int odp_buffer_pool_destroy(odp_buffer_pool_t pool);
+int odp_pool_destroy(odp_pool_t pool);
/**
- * Find a buffer pool by name
+ * Find a pool by name
*
* @param name Name of the pool
*
- * @return Handle of found buffer pool
- * @retval ODP_BUFFER_POOL_INVALID Buffer pool could not be found
+ * @return Handle of found pool
+ * @retval ODP_POOL_INVALID Pool could not be found
*
* @note This routine cannot be used to look up an anonymous pool (one created
* with no name).
*/
-odp_buffer_pool_t odp_buffer_pool_lookup(const char *name);
+odp_pool_t odp_pool_lookup(const char *name);
/**
- * Buffer pool information struct
- * Used to get information about a buffer pool.
+ * Pool information struct
+ * Used to get information about a pool.
*/
-typedef struct odp_buffer_pool_info_t {
+typedef struct odp_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 */
+ contain pool, or ODP_SHM_INVALID
+ if this pool is managed by ODP */
odp_pool_param_t params; /**< pool parameters */
-} odp_buffer_pool_info_t;
+} odp_pool_info_t;
/**
- * Retrieve information about a buffer pool
+ * Retrieve information about a pool
*
- * @param pool Buffer pool handle
+ * @param pool Pool handle
*
- * @param[out] info Receives an odp_buffer_pool_info_t object
+ * @param[out] info Receives an odp_pool_info_t object
* that describes the pool.
*
* @retval 0 Success
* @retval -1 Failure. Info could not be retrieved.
*/
-int odp_buffer_pool_info(odp_buffer_pool_t pool,
- odp_buffer_pool_info_t *info);
+int odp_pool_info(odp_pool_t pool, odp_pool_info_t *info);
/**
- * Print buffer pool info
+ * Print pool info
*
* @param pool Pool handle
*
* @note This routine writes implementation-defined information about the
- * specified buffer pool to the ODP log. The intended use is for debugging.
+ * specified pool to the ODP log. The intended use is for debugging.
*/
-void odp_buffer_pool_print(odp_buffer_pool_t pool);
+void odp_pool_print(odp_pool_t pool);
/**
* Buffer alloc
@@ -171,7 +168,7 @@ void odp_buffer_pool_print(odp_buffer_pool_t pool);
* @return Handle of allocated buffer
* @retval ODP_BUFFER_INVALID Buffer could not be allocated
*/
-odp_buffer_t odp_buffer_alloc(odp_buffer_pool_t pool);
+odp_buffer_t odp_buffer_alloc(odp_pool_t pool);
/**
* Buffer free
@@ -121,7 +121,7 @@ typedef struct odp_buffer_hdr_t {
int type; /* buffer type */
uint32_t size; /* max data size */
odp_atomic_u32_t ref_count; /* reference count */
- odp_buffer_pool_t pool_hdl; /* buffer pool handle */
+ odp_pool_t pool_hdl; /* buffer pool handle */
union {
uint64_t buf_u64; /* user u64 */
void *buf_ctx; /* user context */
@@ -152,7 +152,7 @@ typedef struct {
#define ODP_FREEBUF -1
/* Forward declarations */
-odp_buffer_t buffer_alloc(odp_buffer_pool_t pool, size_t size);
+odp_buffer_t buffer_alloc(odp_pool_t pool, size_t size);
/*
@@ -87,7 +87,7 @@ struct pool_entry_s {
char name[ODP_POOL_NAME_LEN];
odp_pool_param_t params;
_odp_buffer_pool_init_t init_params;
- odp_buffer_pool_t pool_hdl;
+ odp_pool_t pool_hdl;
uint32_t pool_id;
odp_shm_t pool_shm;
union {
@@ -333,12 +333,12 @@ static inline void flush_cache(local_cache_t *buf_cache,
buf_cache->buffrees = 0;
}
-static inline odp_buffer_pool_t pool_index_to_handle(uint32_t pool_id)
+static inline odp_pool_t pool_index_to_handle(uint32_t pool_id)
{
return pool_id;
}
-static inline uint32_t pool_handle_to_index(odp_buffer_pool_t pool_hdl)
+static inline uint32_t pool_handle_to_index(odp_pool_t pool_hdl)
{
return pool_hdl;
}
@@ -348,7 +348,7 @@ static inline void *get_pool_entry(uint32_t pool_id)
return pool_entry_ptr[pool_id];
}
-static inline pool_entry_t *odp_pool_to_entry(odp_buffer_pool_t pool)
+static inline pool_entry_t *odp_pool_to_entry(odp_pool_t pool)
{
return (pool_entry_t *)get_pool_entry(pool_handle_to_index(pool));
}
@@ -358,17 +358,17 @@ static inline pool_entry_t *odp_buf_to_pool(odp_buffer_hdr_t *buf)
return odp_pool_to_entry(buf->pool_hdl);
}
-static inline uint32_t odp_buffer_pool_segment_size(odp_buffer_pool_t pool)
+static inline uint32_t odp_buffer_pool_segment_size(odp_pool_t pool)
{
return odp_pool_to_entry(pool)->s.seg_size;
}
-static inline uint32_t odp_buffer_pool_headroom(odp_buffer_pool_t pool)
+static inline uint32_t odp_buffer_pool_headroom(odp_pool_t pool)
{
return odp_pool_to_entry(pool)->s.headroom;
}
-static inline uint32_t odp_buffer_pool_tailroom(odp_buffer_pool_t pool)
+static inline uint32_t odp_buffer_pool_tailroom(odp_pool_t pool)
{
return odp_pool_to_entry(pool)->s.tailroom;
}
@@ -33,7 +33,7 @@ struct odp_crypto_generic_session {
enum odp_crypto_op op;
bool do_cipher_first;
odp_queue_t compl_queue;
- odp_buffer_pool_t output_pool;
+ odp_pool_t output_pool;
struct {
enum odp_cipher_alg alg;
struct {
@@ -253,7 +253,7 @@ int _odp_packet_copy_to_packet(odp_packet_t srcpkt, uint32_t srcoffset,
odp_packet_t dstpkt, uint32_t dstoffset,
uint32_t len);
-odp_packet_t _odp_packet_alloc(odp_buffer_pool_t pool_hdl);
+odp_packet_t _odp_packet_alloc(odp_pool_t pool_hdl);
int _odp_packet_parse(odp_packet_t pkt);
@@ -41,7 +41,7 @@
typedef struct {
int sockfd; /**< socket descriptor */
- odp_buffer_pool_t pool; /**< buffer pool to alloc packets from */
+ odp_pool_t pool; /**< pool to alloc packets from */
size_t buf_size; /**< size of buffer payload in 'pool' */
size_t max_frame_len; /**< max frame len = buf_size - sizeof(pkt_hdr) */
size_t frame_offset; /**< frame start offset from start of pkt buf */
@@ -75,7 +75,7 @@ typedef struct {
struct ring tx_ring ODP_ALIGNED_CACHE;
int sockfd ODP_ALIGNED_CACHE;
- odp_buffer_pool_t pool;
+ odp_pool_t pool;
size_t frame_offset; /**< frame start offset from start of pkt buf */
uint8_t *mmap_base;
unsigned mmap_len;
@@ -88,10 +88,10 @@ typedef struct {
* Open & configure a raw packet socket
*/
int setup_pkt_sock(pkt_sock_t * const pkt_sock, const char *netdev,
- odp_buffer_pool_t pool);
+ odp_pool_t pool);
int setup_pkt_sock_mmap(pkt_sock_mmap_t * const pkt_sock, const char *netdev,
- odp_buffer_pool_t pool, int fanout);
+ odp_pool_t pool, int fanout);
/**
* Close a packet socket
@@ -96,14 +96,14 @@ int odp_buffer_pool_init_global(void)
}
/**
- * Buffer pool creation
+ * Pool creation
*/
-odp_buffer_pool_t odp_buffer_pool_create(const char *name,
+odp_pool_t odp_pool_create(const char *name,
odp_shm_t shm,
odp_pool_param_t *params)
{
- odp_buffer_pool_t pool_hdl = ODP_BUFFER_POOL_INVALID;
+ odp_pool_t pool_hdl = ODP_POOL_INVALID;
pool_entry_t *pool;
uint32_t i, headroom = 0, tailroom = 0;
@@ -117,7 +117,7 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name,
_odp_buffer_pool_init_t *init_params = &default_init_params;
if (params == NULL)
- return ODP_BUFFER_POOL_INVALID;
+ return ODP_POOL_INVALID;
/* Restriction for v1.0: All non-packet buffers are unsegmented */
int unsegmented = 1;
@@ -136,7 +136,7 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name,
/* Validate requested buffer alignment */
if (buf_align > ODP_CONFIG_BUFFER_ALIGN_MAX ||
buf_align != ODP_ALIGN_ROUNDDOWN_POWER_2(buf_align, buf_align))
- return ODP_BUFFER_POOL_INVALID;
+ return ODP_POOL_INVALID;
/* Set correct alignment based on input request */
if (buf_align == 0)
@@ -179,13 +179,13 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name,
break;
default:
- return ODP_BUFFER_POOL_INVALID;
+ return ODP_POOL_INVALID;
}
/* Validate requested number of buffers against addressable limits */
if (params->buf.num >
(ODP_BUFFER_MAX_BUFFERS / (buf_stride / ODP_CACHE_LINE_SIZE)))
- return ODP_BUFFER_POOL_INVALID;
+ return ODP_POOL_INVALID;
/* Find an unused buffer pool slot and iniitalize it as requested */
for (i = 0; i < ODP_CONFIG_BUFFER_POOLS; i++) {
@@ -239,7 +239,7 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name,
ODP_PAGE_SIZE, 0);
if (shm == ODP_SHM_INVALID) {
POOL_UNLOCK(&pool->s.lock);
- return ODP_BUFFER_POOL_INVALID;
+ return ODP_POOL_INVALID;
}
pool->s.pool_base_addr = odp_shm_addr(shm);
} else {
@@ -247,7 +247,7 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name,
if (odp_shm_info(shm, &info) != 0 ||
info.size < pool->s.pool_size) {
POOL_UNLOCK(&pool->s.lock);
- return ODP_BUFFER_POOL_INVALID;
+ return ODP_POOL_INVALID;
}
pool->s.pool_base_addr = odp_shm_addr(shm);
void *page_addr =
@@ -258,7 +258,7 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name,
((size_t)page_addr -
(size_t)pool->s.pool_base_addr)) {
POOL_UNLOCK(&pool->s.lock);
- return ODP_BUFFER_POOL_INVALID;
+ return ODP_POOL_INVALID;
}
pool->s.pool_base_addr = page_addr;
}
@@ -375,7 +375,7 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name,
}
-odp_buffer_pool_t odp_buffer_pool_lookup(const char *name)
+odp_pool_t odp_pool_lookup(const char *name)
{
uint32_t i;
pool_entry_t *pool;
@@ -392,11 +392,10 @@ odp_buffer_pool_t odp_buffer_pool_lookup(const char *name)
POOL_UNLOCK(&pool->s.lock);
}
- return ODP_BUFFER_POOL_INVALID;
+ return ODP_POOL_INVALID;
}
-int odp_buffer_pool_info(odp_buffer_pool_t pool_hdl,
- odp_buffer_pool_info_t *info)
+int odp_pool_info(odp_pool_t pool_hdl, odp_pool_info_t *info)
{
uint32_t pool_id = pool_handle_to_index(pool_hdl);
pool_entry_t *pool = get_pool_entry(pool_id);
@@ -415,7 +414,7 @@ int odp_buffer_pool_info(odp_buffer_pool_t pool_hdl,
return 0;
}
-int odp_buffer_pool_destroy(odp_buffer_pool_t pool_hdl)
+int odp_pool_destroy(odp_pool_t pool_hdl)
{
uint32_t pool_id = pool_handle_to_index(pool_hdl);
pool_entry_t *pool = get_pool_entry(pool_id);
@@ -450,7 +449,7 @@ int odp_buffer_pool_destroy(odp_buffer_pool_t pool_hdl)
return 0;
}
-odp_buffer_t buffer_alloc(odp_buffer_pool_t pool_hdl, size_t size)
+odp_buffer_t buffer_alloc(odp_pool_t pool_hdl, size_t size)
{
uint32_t pool_id = pool_handle_to_index(pool_hdl);
pool_entry_t *pool = get_pool_entry(pool_id);
@@ -505,7 +504,7 @@ odp_buffer_t buffer_alloc(odp_buffer_pool_t pool_hdl, size_t size)
return odp_hdr_to_buf(&buf->buf);
}
-odp_buffer_t odp_buffer_alloc(odp_buffer_pool_t pool_hdl)
+odp_buffer_t odp_buffer_alloc(odp_pool_t pool_hdl)
{
return buffer_alloc(pool_hdl,
odp_pool_to_entry(pool_hdl)->s.params.buf.size);
@@ -532,7 +531,7 @@ void _odp_flush_caches(void)
}
}
-void odp_buffer_pool_print(odp_buffer_pool_t pool_hdl)
+void odp_pool_print(odp_pool_t pool_hdl)
{
pool_entry_t *pool;
uint32_t pool_id;
@@ -600,7 +599,7 @@ void odp_buffer_pool_print(odp_buffer_pool_t pool_hdl)
}
-odp_buffer_pool_t odp_buffer_pool(odp_buffer_t buf)
+odp_pool_t odp_buffer_pool(odp_buffer_t buf)
{
return odp_buf_to_hdr(buf)->pool_hdl;
}
@@ -356,7 +356,7 @@ odp_crypto_operation(odp_crypto_op_params_t *params,
/* Resolve output buffer */
if (ODP_PACKET_INVALID == params->out_pkt)
- if (ODP_BUFFER_POOL_INVALID != session->output_pool)
+ if (ODP_POOL_INVALID != session->output_pool)
params->out_pkt =
odp_packet_alloc(session->output_pool,
odp_packet_len(params->pkt));
@@ -25,7 +25,7 @@
*
*/
-odp_packet_t odp_packet_alloc(odp_buffer_pool_t pool_hdl, uint32_t len)
+odp_packet_t odp_packet_alloc(odp_pool_t pool_hdl, uint32_t len)
{
pool_entry_t *pool = odp_pool_to_entry(pool_hdl);
@@ -209,7 +209,7 @@ void *odp_packet_offset(odp_packet_t pkt, uint32_t offset, uint32_t *len,
*
*/
-odp_buffer_pool_t odp_packet_pool(odp_packet_t pkt)
+odp_pool_t odp_packet_pool(odp_packet_t pkt)
{
return odp_packet_hdr(pkt)->buf_hdr.pool_hdl;
}
@@ -463,7 +463,7 @@ odp_packet_t odp_packet_rem_data(odp_packet_t pkt, uint32_t offset,
*
*/
-odp_packet_t odp_packet_copy(odp_packet_t pkt, odp_buffer_pool_t pool)
+odp_packet_t odp_packet_copy(odp_packet_t pkt, odp_pool_t pool)
{
odp_packet_hdr_t *srchdr = odp_packet_hdr(pkt);
uint32_t pktlen = srchdr->frame_len;
@@ -623,7 +623,7 @@ int _odp_packet_copy_to_packet(odp_packet_t srcpkt, uint32_t srcoffset,
return 0;
}
-odp_packet_t _odp_packet_alloc(odp_buffer_pool_t pool_hdl)
+odp_packet_t _odp_packet_alloc(odp_pool_t pool_hdl)
{
pool_entry_t *pool = odp_pool_to_entry(pool_hdl);
@@ -164,7 +164,7 @@ static int free_pktio_entry(odp_pktio_t id)
}
static int init_socket(pktio_entry_t *entry, const char *dev,
- odp_buffer_pool_t pool)
+ odp_pool_t pool)
{
int fd = -1;
@@ -192,7 +192,7 @@ static int init_socket(pktio_entry_t *entry, const char *dev,
return fd;
}
-static odp_pktio_t setup_pktio_entry(const char *dev, odp_buffer_pool_t pool)
+static odp_pktio_t setup_pktio_entry(const char *dev, odp_pool_t pool)
{
odp_pktio_t id;
pktio_entry_t *pktio_entry;
@@ -252,7 +252,7 @@ static odp_pktio_t setup_pktio_entry(const char *dev, odp_buffer_pool_t pool)
return id;
}
-odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool)
+odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t pool)
{
odp_pktio_t id;
@@ -123,7 +123,7 @@ static int set_pkt_sock_fanout_mmap(pkt_sock_mmap_t *const pkt_sock,
* ODP_PACKET_SOCKET_MMSG:
*/
int setup_pkt_sock(pkt_sock_t *const pkt_sock, const char *netdev,
- odp_buffer_pool_t pool)
+ odp_pool_t pool)
{
int sockfd;
int err;
@@ -131,7 +131,7 @@ int setup_pkt_sock(pkt_sock_t *const pkt_sock, const char *netdev,
struct ifreq ethreq;
struct sockaddr_ll sa_ll;
- if (pool == ODP_BUFFER_POOL_INVALID)
+ if (pool == ODP_POOL_INVALID)
return -1;
pkt_sock->pool = pool;
@@ -468,7 +468,7 @@ static inline void mmap_tx_user_ready(struct tpacket2_hdr *hdr)
static inline unsigned pkt_mmap_v2_rx(int sock, struct ring *ring,
odp_packet_t pkt_table[], unsigned len,
- odp_buffer_pool_t pool,
+ odp_pool_t pool,
unsigned char if_mac[])
{
union frame_map ppd;
@@ -733,14 +733,14 @@ static int mmap_store_hw_addr(pkt_sock_mmap_t *const pkt_sock,
* ODP_PACKET_SOCKET_MMAP:
*/
int setup_pkt_sock_mmap(pkt_sock_mmap_t *const pkt_sock, const char *netdev,
- odp_buffer_pool_t pool, int fanout)
+ odp_pool_t pool, int fanout)
{
int if_idx;
int ret = 0;
memset(pkt_sock, 0, sizeof(*pkt_sock));
- if (pool == ODP_BUFFER_POOL_INVALID)
+ if (pool == ODP_POOL_INVALID)
return -1;
/* Store eth buffer offset for pkt buffers from this pool */
@@ -43,10 +43,10 @@ _ODP_STATIC_ASSERT((8*sizeof(pri_mask_t)) >= QUEUES_PER_PRIO,
typedef struct {
- odp_queue_t pri_queue[ODP_CONFIG_SCHED_PRIOS][QUEUES_PER_PRIO];
- pri_mask_t pri_mask[ODP_CONFIG_SCHED_PRIOS];
- odp_spinlock_t mask_lock;
- odp_buffer_pool_t pool;
+ odp_queue_t pri_queue[ODP_CONFIG_SCHED_PRIOS][QUEUES_PER_PRIO];
+ pri_mask_t pri_mask[ODP_CONFIG_SCHED_PRIOS];
+ odp_spinlock_t mask_lock;
+ odp_pool_t pool;
} sched_t;
typedef struct {
@@ -83,7 +83,7 @@ static inline odp_queue_t select_pri_queue(odp_queue_t queue, int prio)
int odp_schedule_init_global(void)
{
odp_shm_t shm;
- odp_buffer_pool_t pool;
+ odp_pool_t pool;
int i, j;
odp_pool_param_t params;
@@ -105,9 +105,9 @@ int odp_schedule_init_global(void)
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, ¶ms);
+ pool = odp_pool_create("odp_sched_pool", ODP_SHM_NULL, ¶ms);
- if (pool == ODP_BUFFER_POOL_INVALID) {
+ if (pool == ODP_POOL_INVALID) {
ODP_ERR("Schedule init: Pool create failed.\n");
return -1;
}
@@ -88,7 +88,7 @@ static void clear_sched_queues(void)
*
* @return 0 if successful
*/
-static int create_queue(int thr, odp_buffer_pool_t msg_pool, int prio)
+static int create_queue(int thr, odp_pool_t msg_pool, int prio)
{
char name[] = "sched_XX_00";
odp_buffer_t buf;
@@ -128,7 +128,7 @@ static int create_queue(int thr, odp_buffer_pool_t msg_pool, int prio)
*
* @return 0 if successful
*/
-static int create_queues(int thr, odp_buffer_pool_t msg_pool, int prio)
+static int create_queues(int thr, odp_pool_t msg_pool, int prio)
{
char name[] = "sched_XX_YY";
odp_buffer_t buf;
@@ -176,7 +176,7 @@ static int create_queues(int thr, odp_buffer_pool_t msg_pool, int prio)
*
* @return 0 if successful
*/
-static int test_alloc_single(int thr, odp_buffer_pool_t pool)
+static int test_alloc_single(int thr, odp_pool_t pool)
{
int i;
odp_buffer_t temp_buf;
@@ -213,7 +213,7 @@ static int test_alloc_single(int thr, odp_buffer_pool_t pool)
*
* @return 0 if successful
*/
-static int test_alloc_multi(int thr, odp_buffer_pool_t pool)
+static int test_alloc_multi(int thr, odp_pool_t pool)
{
int i, j;
odp_buffer_t temp_buf[MAX_ALLOCS];
@@ -256,7 +256,7 @@ static int test_alloc_multi(int thr, odp_buffer_pool_t pool)
*
* @return 0 if successful
*/
-static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool)
+static int test_poll_queue(int thr, odp_pool_t msg_pool)
{
odp_event_t ev;
odp_buffer_t buf;
@@ -332,7 +332,7 @@ static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool)
* @return 0 if successful
*/
static int test_schedule_single(const char *str, int thr,
- odp_buffer_pool_t msg_pool,
+ odp_pool_t msg_pool,
int prio, odp_barrier_t *barrier)
{
odp_event_t ev;
@@ -408,7 +408,7 @@ static int test_schedule_single(const char *str, int thr,
* @return 0 if successful
*/
static int test_schedule_many(const char *str, int thr,
- odp_buffer_pool_t msg_pool,
+ odp_pool_t msg_pool,
int prio, odp_barrier_t *barrier)
{
odp_event_t ev;
@@ -483,7 +483,7 @@ static int test_schedule_many(const char *str, int thr,
* @return 0 if successful
*/
static int test_schedule_multi(const char *str, int thr,
- odp_buffer_pool_t msg_pool,
+ odp_pool_t msg_pool,
int prio, odp_barrier_t *barrier)
{
odp_event_t ev[MULTI_BUFS_MAX];
@@ -599,7 +599,7 @@ static int test_schedule_multi(const char *str, int thr,
static void *run_thread(void *arg)
{
int thr;
- odp_buffer_pool_t msg_pool;
+ odp_pool_t msg_pool;
odp_shm_t shm;
test_globals_t *globals;
odp_barrier_t *barrier;
@@ -629,9 +629,9 @@ static void *run_thread(void *arg)
/*
* Find the buffer pool
*/
- msg_pool = odp_buffer_pool_lookup("msg_pool");
+ msg_pool = odp_pool_lookup("msg_pool");
- if (msg_pool == ODP_BUFFER_POOL_INVALID) {
+ if (msg_pool == ODP_POOL_INVALID) {
LOG_ERR(" [%i] msg_pool not found\n", thr);
return NULL;
}
@@ -821,7 +821,7 @@ int main(int argc, char *argv[])
odph_linux_pthread_t thread_tbl[MAX_WORKERS];
test_args_t args;
int num_workers;
- odp_buffer_pool_t pool;
+ odp_pool_t pool;
odp_queue_t queue;
int i, j;
int prios;
@@ -916,14 +916,14 @@ int main(int argc, char *argv[])
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, ¶ms);
+ pool = odp_pool_create("msg_pool", ODP_SHM_NULL, ¶ms);
- if (pool == ODP_BUFFER_POOL_INVALID) {
+ if (pool == ODP_POOL_INVALID) {
LOG_ERR("Pool create failed.\n");
return -1;
}
- /* odp_buffer_pool_print(pool); */
+ /* odp_pool_print(pool); */
/*
* Create a queue for direct poll test
Replaced odp_buffer_pool_ prefix in the pool API with odp_pool_. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> --- example/generator/odp_generator.c | 18 +++--- example/ipsec/odp_ipsec.c | 20 +++--- example/ipsec/odp_ipsec_cache.c | 4 +- example/ipsec/odp_ipsec_cache.h | 2 +- example/ipsec/odp_ipsec_loop_db.c | 2 +- example/ipsec/odp_ipsec_loop_db.h | 12 ++-- example/ipsec/odp_ipsec_stream.c | 8 +-- example/ipsec/odp_ipsec_stream.h | 2 +- example/l2fwd/odp_l2fwd.c | 10 +-- example/packet/odp_pktio.c | 10 +-- example/timer/odp_timer_test.c | 12 ++-- platform/linux-generic/include/api/odp_buffer.h | 2 +- platform/linux-generic/include/api/odp_crypto.h | 2 +- platform/linux-generic/include/api/odp_packet.h | 10 +-- platform/linux-generic/include/api/odp_packet_io.h | 2 +- .../linux-generic/include/api/odp_platform_types.h | 4 +- platform/linux-generic/include/api/odp_pool.h | 73 +++++++++++----------- .../linux-generic/include/odp_buffer_internal.h | 4 +- .../include/odp_buffer_pool_internal.h | 14 ++--- .../linux-generic/include/odp_crypto_internal.h | 2 +- .../linux-generic/include/odp_packet_internal.h | 2 +- platform/linux-generic/include/odp_packet_socket.h | 8 +-- platform/linux-generic/odp_buffer_pool.c | 37 ++++++----- platform/linux-generic/odp_crypto.c | 2 +- platform/linux-generic/odp_packet.c | 8 +-- platform/linux-generic/odp_packet_io.c | 6 +- platform/linux-generic/odp_packet_socket.c | 10 +-- platform/linux-generic/odp_schedule.c | 14 ++--- test/performance/odp_scheduling.c | 30 ++++----- 29 files changed, 163 insertions(+), 167 deletions(-)