@@ -103,7 +103,7 @@ extern "C" {
#include <errno.h>
#include <sys/queue.h>
-enum odph_ring_queue_behavior {
+enum shm_ring_queue_behavior {
ODPH_RING_QUEUE_FIXED = 0, /**< Enq/Deq a fixed number
of items from a ring */
ODPH_RING_QUEUE_VARIABLE /**< Enq/Deq as many items
@@ -123,9 +123,9 @@ enum odph_ring_queue_behavior {
* values in a modulo-32bit base: that's why the overflow of the indexes is not
* a problem.
*/
-typedef struct odph_ring {
+typedef struct shm_ring {
/** @private Next in list. */
- TAILQ_ENTRY(odph_ring) next;
+ TAILQ_ENTRY(shm_ring) next;
/** @private Name of the ring. */
char name[ODPH_RING_NAMESIZE];
@@ -153,7 +153,7 @@ typedef struct odph_ring {
/** @private Memory space of ring starts here. */
void *ring[0] ODP_ALIGNED_CACHE;
-} odph_ring_t;
+} shm_ring_t;
#define ODPH_RING_F_SP_ENQ (1 << 0) /* The default enqueue is "single-producer".*/
@@ -194,7 +194,7 @@ typedef struct odph_ring {
* - EEXIST - a memzone with the same name already exists
* - ENOMEM - no appropriate memory area found in which to create memzone
*/
-odph_ring_t *odph_ring_create(const char *name, unsigned count,
+shm_ring_t *shm_ring_create(const char *name, unsigned count,
unsigned flags);
@@ -213,14 +213,14 @@ odph_ring_t *odph_ring_create(const char *name, unsigned count,
* @return 0: Success; water mark changed.
* -EINVAL: Invalid water mark value.
*/
-int odph_ring_set_water_mark(odph_ring_t *r, unsigned count);
+int shm_ring_set_water_mark(shm_ring_t *r, unsigned count);
/**
* Dump the status of the ring to the console.
*
* @param r A pointer to the ring structure.
*/
-void odph_ring_dump(const odph_ring_t *r);
+void shm_ring_dump(const shm_ring_t *r);
/**
* Enqueue several objects on the ring (multi-producers safe).
@@ -247,9 +247,9 @@ void odph_ring_dump(const odph_ring_t *r);
* if behavior = ODP_RING_QUEUE_VARIABLE
* - n: Actual number of objects enqueued.
*/
-int __odph_ring_mp_do_enqueue(odph_ring_t *r, void * const *obj_table,
+int __shm_ring_mp_do_enqueue(shm_ring_t *r, void * const *obj_table,
unsigned n,
- enum odph_ring_queue_behavior behavior);
+ enum shm_ring_queue_behavior behavior);
/**
* Enqueue several objects on a ring (NOT multi-producers safe).
@@ -273,9 +273,9 @@ int __odph_ring_mp_do_enqueue(odph_ring_t *r, void * const *obj_table,
* if behavior = ODP_RING_QUEUE_VARIABLE
* - n: Actual number of objects enqueued.
*/
-int __odph_ring_sp_do_enqueue(odph_ring_t *r, void * const *obj_table,
+int __shm_ring_sp_do_enqueue(shm_ring_t *r, void * const *obj_table,
unsigned n,
- enum odph_ring_queue_behavior behavior);
+ enum shm_ring_queue_behavior behavior);
/**
* Dequeue several objects from a ring (multi-consumers safe). When
@@ -304,9 +304,9 @@ int __odph_ring_sp_do_enqueue(odph_ring_t *r, void * const *obj_table,
* - n: Actual number of objects dequeued.
*/
-int __odph_ring_mc_do_dequeue(odph_ring_t *r, void **obj_table,
+int __shm_ring_mc_do_dequeue(shm_ring_t *r, void **obj_table,
unsigned n,
- enum odph_ring_queue_behavior behavior);
+ enum shm_ring_queue_behavior behavior);
/**
* Dequeue several objects from a ring (NOT multi-consumers safe).
@@ -331,9 +331,9 @@ int __odph_ring_mc_do_dequeue(odph_ring_t *r, void **obj_table,
* if behavior = ODP_RING_QUEUE_VARIABLE
* - n: Actual number of objects dequeued.
*/
-int __odph_ring_sc_do_dequeue(odph_ring_t *r, void **obj_table,
+int __shm_ring_sc_do_dequeue(shm_ring_t *r, void **obj_table,
unsigned n,
- enum odph_ring_queue_behavior behavior);
+ enum shm_ring_queue_behavior behavior);
/**
* Enqueue several objects on the ring (multi-producers safe).
@@ -353,7 +353,7 @@ int __odph_ring_sc_do_dequeue(odph_ring_t *r, void **obj_table,
* high water mark is exceeded.
* - -ENOBUFS: Not enough room in the ring to enqueue, no object is enqueued.
*/
-int odph_ring_mp_enqueue_bulk(odph_ring_t *r, void * const *obj_table,
+int shm_ring_mp_enqueue_bulk(shm_ring_t *r, void * const *obj_table,
unsigned n);
/**
@@ -371,7 +371,7 @@ int odph_ring_mp_enqueue_bulk(odph_ring_t *r, void * const *obj_table,
* high water mark is exceeded.
* - -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
*/
-int odph_ring_sp_enqueue_bulk(odph_ring_t *r, void * const *obj_table,
+int shm_ring_sp_enqueue_bulk(shm_ring_t *r, void * const *obj_table,
unsigned n);
/**
@@ -391,7 +391,7 @@ int odph_ring_sp_enqueue_bulk(odph_ring_t *r, void * const *obj_table,
* - -ENOENT: Not enough entries in the ring to dequeue; no object is
* dequeued.
*/
-int odph_ring_mc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n);
+int shm_ring_mc_dequeue_bulk(shm_ring_t *r, void **obj_table, unsigned n);
/**
* Dequeue several objects from a ring (NOT multi-consumers safe).
@@ -408,7 +408,7 @@ int odph_ring_mc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n);
* - -ENOENT: Not enough entries in the ring to dequeue; no object is
* dequeued.
*/
-int odph_ring_sc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n);
+int shm_ring_sc_dequeue_bulk(shm_ring_t *r, void **obj_table, unsigned n);
/**
* Test if a ring is full.
@@ -419,7 +419,7 @@ int odph_ring_sc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n);
* - 1: The ring is full.
* - 0: The ring is not full.
*/
-int odph_ring_full(const odph_ring_t *r);
+int shm_ring_full(const shm_ring_t *r);
/**
* Test if a ring is empty.
@@ -430,7 +430,7 @@ int odph_ring_full(const odph_ring_t *r);
* - 1: The ring is empty.
* - 0: The ring is not empty.
*/
-int odph_ring_empty(const odph_ring_t *r);
+int shm_ring_empty(const shm_ring_t *r);
/**
* Return the number of entries in a ring.
@@ -440,7 +440,7 @@ int odph_ring_empty(const odph_ring_t *r);
* @return
* The number of entries in the ring.
*/
-unsigned odph_ring_count(const odph_ring_t *r);
+unsigned shm_ring_count(const shm_ring_t *r);
/**
* Return the number of free entries in a ring.
@@ -450,14 +450,14 @@ unsigned odph_ring_count(const odph_ring_t *r);
* @return
* The number of free entries in the ring.
*/
-unsigned odph_ring_free_count(const odph_ring_t *r);
+unsigned shm_ring_free_count(const shm_ring_t *r);
/**
* search ring by name
* @param name ring name to search
* @return pointer to ring otherwise NULL
*/
-odph_ring_t *odph_ring_lookup(const char *name);
+shm_ring_t *shm_ring_lookup(const char *name);
/**
* Enqueue several objects on the ring (multi-producers safe).
@@ -474,7 +474,7 @@ odph_ring_t *odph_ring_lookup(const char *name);
* @return
* - n: Actual number of objects enqueued.
*/
-int odph_ring_mp_enqueue_burst(odph_ring_t *r, void * const *obj_table,
+int shm_ring_mp_enqueue_burst(shm_ring_t *r, void * const *obj_table,
unsigned n);
/**
@@ -489,7 +489,7 @@ int odph_ring_mp_enqueue_burst(odph_ring_t *r, void * const *obj_table,
* @return
* - n: Actual number of objects enqueued.
*/
-int odph_ring_sp_enqueue_burst(odph_ring_t *r, void * const *obj_table,
+int shm_ring_sp_enqueue_burst(shm_ring_t *r, void * const *obj_table,
unsigned n);
/**
* Enqueue several objects on a ring.
@@ -507,7 +507,7 @@ int odph_ring_sp_enqueue_burst(odph_ring_t *r, void * const *obj_table,
* @return
* - n: Actual number of objects enqueued.
*/
-int odph_ring_enqueue_burst(odph_ring_t *r, void * const *obj_table,
+int shm_ring_enqueue_burst(shm_ring_t *r, void * const *obj_table,
unsigned n);
/**
@@ -527,7 +527,7 @@ int odph_ring_enqueue_burst(odph_ring_t *r, void * const *obj_table,
* @return
* - n: Actual number of objects dequeued, 0 if ring is empty
*/
-int odph_ring_mc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n);
+int shm_ring_mc_dequeue_burst(shm_ring_t *r, void **obj_table, unsigned n);
/**
* Dequeue several objects from a ring (NOT multi-consumers safe).When the
@@ -543,7 +543,7 @@ int odph_ring_mc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n);
* @return
* - n: Actual number of objects dequeued, 0 if ring is empty
*/
-int odph_ring_sc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n);
+int shm_ring_sc_dequeue_burst(shm_ring_t *r, void **obj_table, unsigned n);
/**
* Dequeue multiple objects from a ring up to a maximum number.
@@ -561,17 +561,17 @@ int odph_ring_sc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n);
* @return
* - Number of objects dequeued, or a negative error code on error
*/
-int odph_ring_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n);
+int shm_ring_dequeue_burst(shm_ring_t *r, void **obj_table, unsigned n);
/**
* dump the status of all rings on the console
*/
-void odph_ring_list_dump(void);
+void shm_ring_list_dump(void);
/**
* initialise ring tailq
*/
-void odph_ring_tailq_init(void);
+void shm_ring_tailq_init(void);
#ifdef __cplusplus
}
@@ -80,7 +80,7 @@
#include <odp_ring_internal.h>
#include <odph_debug.h>
-static TAILQ_HEAD(, odph_ring) odp_ring_list;
+static TAILQ_HEAD(, shm_ring) odp_ring_list;
#define RING_VAL_IS_POWER_2(x) ((((x) - 1) & (x)) == 0)
@@ -145,18 +145,18 @@ static TAILQ_HEAD(, odph_ring) odp_ring_list;
static odp_rwlock_t qlock; /* rings tailq lock */
/* init tailq_ring */
-void odph_ring_tailq_init(void)
+void shm_ring_tailq_init(void)
{
TAILQ_INIT(&odp_ring_list);
odp_rwlock_init(&qlock);
}
/* create the ring */
-odph_ring_t *
-odph_ring_create(const char *name, unsigned count, unsigned flags)
+shm_ring_t *
+shm_ring_create(const char *name, unsigned count, unsigned flags)
{
char ring_name[ODPH_RING_NAMESIZE];
- odph_ring_t *r;
+ shm_ring_t *r;
size_t ring_size;
uint32_t shm_flag;
odp_shm_t shm;
@@ -174,7 +174,7 @@ odph_ring_create(const char *name, unsigned count, unsigned flags)
}
snprintf(ring_name, sizeof(ring_name), "%s", name);
- ring_size = count*sizeof(void *)+sizeof(odph_ring_t);
+ ring_size = count*sizeof(void *)+sizeof(shm_ring_t);
odp_rwlock_write_lock(&qlock);
/* reserve a memory zone for this ring.*/
@@ -213,7 +213,7 @@ odph_ring_create(const char *name, unsigned count, unsigned flags)
* change the high water mark. If *count* is 0, water marking is
* disabled
*/
-int odph_ring_set_water_mark(odph_ring_t *r, unsigned count)
+int shm_ring_set_water_mark(shm_ring_t *r, unsigned count)
{
if (count >= r->prod.size)
return -EINVAL;
@@ -229,8 +229,8 @@ int odph_ring_set_water_mark(odph_ring_t *r, unsigned count)
/**
* Enqueue several objects on the ring (multi-producers safe).
*/
-int __odph_ring_mp_do_enqueue(odph_ring_t *r, void * const *obj_table,
- unsigned n, enum odph_ring_queue_behavior behavior)
+int __shm_ring_mp_do_enqueue(shm_ring_t *r, void * const *obj_table,
+ unsigned n, enum shm_ring_queue_behavior behavior)
{
uint32_t prod_head, prod_next;
uint32_t cons_tail, free_entries;
@@ -302,8 +302,8 @@ int __odph_ring_mp_do_enqueue(odph_ring_t *r, void * const *obj_table,
/**
* Enqueue several objects on a ring (NOT multi-producers safe).
*/
-int __odph_ring_sp_do_enqueue(odph_ring_t *r, void * const *obj_table,
- unsigned n, enum odph_ring_queue_behavior behavior)
+int __shm_ring_sp_do_enqueue(shm_ring_t *r, void * const *obj_table,
+ unsigned n, enum shm_ring_queue_behavior behavior)
{
uint32_t prod_head, cons_tail;
uint32_t prod_next, free_entries;
@@ -356,8 +356,8 @@ int __odph_ring_sp_do_enqueue(odph_ring_t *r, void * const *obj_table,
* Dequeue several objects from a ring (multi-consumers safe).
*/
-int __odph_ring_mc_do_dequeue(odph_ring_t *r, void **obj_table,
- unsigned n, enum odph_ring_queue_behavior behavior)
+int __shm_ring_mc_do_dequeue(shm_ring_t *r, void **obj_table,
+ unsigned n, enum shm_ring_queue_behavior behavior)
{
uint32_t cons_head, prod_tail;
uint32_t cons_next, entries;
@@ -420,8 +420,8 @@ int __odph_ring_mc_do_dequeue(odph_ring_t *r, void **obj_table,
/**
* Dequeue several objects from a ring (NOT multi-consumers safe).
*/
-int __odph_ring_sc_do_dequeue(odph_ring_t *r, void **obj_table,
- unsigned n, enum odph_ring_queue_behavior behavior)
+int __shm_ring_sc_do_dequeue(shm_ring_t *r, void **obj_table,
+ unsigned n, enum shm_ring_queue_behavior behavior)
{
uint32_t cons_head, prod_tail;
uint32_t cons_next, entries;
@@ -462,45 +462,45 @@ int __odph_ring_sc_do_dequeue(odph_ring_t *r, void **obj_table,
/**
* Enqueue several objects on the ring (multi-producers safe).
*/
-int odph_ring_mp_enqueue_bulk(odph_ring_t *r, void * const *obj_table,
+int shm_ring_mp_enqueue_bulk(shm_ring_t *r, void * const *obj_table,
unsigned n)
{
- return __odph_ring_mp_do_enqueue(r, obj_table, n,
+ return __shm_ring_mp_do_enqueue(r, obj_table, n,
ODPH_RING_QUEUE_FIXED);
}
/**
* Enqueue several objects on a ring (NOT multi-producers safe).
*/
-int odph_ring_sp_enqueue_bulk(odph_ring_t *r, void * const *obj_table,
+int shm_ring_sp_enqueue_bulk(shm_ring_t *r, void * const *obj_table,
unsigned n)
{
- return __odph_ring_sp_do_enqueue(r, obj_table, n,
+ return __shm_ring_sp_do_enqueue(r, obj_table, n,
ODPH_RING_QUEUE_FIXED);
}
/**
* Dequeue several objects from a ring (multi-consumers safe).
*/
-int odph_ring_mc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n)
+int shm_ring_mc_dequeue_bulk(shm_ring_t *r, void **obj_table, unsigned n)
{
- return __odph_ring_mc_do_dequeue(r, obj_table, n,
+ return __shm_ring_mc_do_dequeue(r, obj_table, n,
ODPH_RING_QUEUE_FIXED);
}
/**
* Dequeue several objects from a ring (NOT multi-consumers safe).
*/
-int odph_ring_sc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n)
+int shm_ring_sc_dequeue_bulk(shm_ring_t *r, void **obj_table, unsigned n)
{
- return __odph_ring_sc_do_dequeue(r, obj_table, n,
+ return __shm_ring_sc_do_dequeue(r, obj_table, n,
ODPH_RING_QUEUE_FIXED);
}
/**
* Test if a ring is full.
*/
-int odph_ring_full(const odph_ring_t *r)
+int shm_ring_full(const shm_ring_t *r)
{
uint32_t prod_tail = r->prod.tail;
uint32_t cons_tail = r->cons.tail;
@@ -510,7 +510,7 @@ int odph_ring_full(const odph_ring_t *r)
/**
* Test if a ring is empty.
*/
-int odph_ring_empty(const odph_ring_t *r)
+int shm_ring_empty(const shm_ring_t *r)
{
uint32_t prod_tail = r->prod.tail;
uint32_t cons_tail = r->cons.tail;
@@ -520,7 +520,7 @@ int odph_ring_empty(const odph_ring_t *r)
/**
* Return the number of entries in a ring.
*/
-unsigned odph_ring_count(const odph_ring_t *r)
+unsigned shm_ring_count(const shm_ring_t *r)
{
uint32_t prod_tail = r->prod.tail;
uint32_t cons_tail = r->cons.tail;
@@ -530,7 +530,7 @@ unsigned odph_ring_count(const odph_ring_t *r)
/**
* Return the number of free entries in a ring.
*/
-unsigned odph_ring_free_count(const odph_ring_t *r)
+unsigned shm_ring_free_count(const shm_ring_t *r)
{
uint32_t prod_tail = r->prod.tail;
uint32_t cons_tail = r->cons.tail;
@@ -538,7 +538,7 @@ unsigned odph_ring_free_count(const odph_ring_t *r)
}
/* dump the status of the ring on the console */
-void odph_ring_dump(const odph_ring_t *r)
+void shm_ring_dump(const shm_ring_t *r)
{
ODPH_DBG("ring <%s>@%p\n", r->name, r);
ODPH_DBG(" flags=%x\n", r->flags);
@@ -547,8 +547,8 @@ void odph_ring_dump(const odph_ring_t *r)
ODPH_DBG(" ch=%" PRIu32 "\n", r->cons.head);
ODPH_DBG(" pt=%" PRIu32 "\n", r->prod.tail);
ODPH_DBG(" ph=%" PRIu32 "\n", r->prod.head);
- ODPH_DBG(" used=%u\n", odph_ring_count(r));
- ODPH_DBG(" avail=%u\n", odph_ring_free_count(r));
+ ODPH_DBG(" used=%u\n", shm_ring_count(r));
+ ODPH_DBG(" avail=%u\n", shm_ring_free_count(r));
if (r->prod.watermark == r->prod.size)
ODPH_DBG(" watermark=0\n");
else
@@ -556,23 +556,23 @@ void odph_ring_dump(const odph_ring_t *r)
}
/* dump the status of all rings on the console */
-void odph_ring_list_dump(void)
+void shm_ring_list_dump(void)
{
- const odph_ring_t *mp = NULL;
+ const shm_ring_t *mp = NULL;
odp_rwlock_read_lock(&qlock);
TAILQ_FOREACH(mp, &odp_ring_list, next) {
- odph_ring_dump(mp);
+ shm_ring_dump(mp);
}
odp_rwlock_read_unlock(&qlock);
}
/* search a ring from its name */
-odph_ring_t *odph_ring_lookup(const char *name)
+shm_ring_t *shm_ring_lookup(const char *name)
{
- odph_ring_t *r;
+ shm_ring_t *r;
odp_rwlock_read_lock(&qlock);
TAILQ_FOREACH(r, &odp_ring_list, next) {
@@ -587,60 +587,60 @@ odph_ring_t *odph_ring_lookup(const char *name)
/**
* Enqueue several objects on the ring (multi-producers safe).
*/
-int odph_ring_mp_enqueue_burst(odph_ring_t *r, void * const *obj_table,
+int shm_ring_mp_enqueue_burst(shm_ring_t *r, void * const *obj_table,
unsigned n)
{
- return __odph_ring_mp_do_enqueue(r, obj_table, n,
+ return __shm_ring_mp_do_enqueue(r, obj_table, n,
ODPH_RING_QUEUE_VARIABLE);
}
/**
* Enqueue several objects on a ring (NOT multi-producers safe).
*/
-int odph_ring_sp_enqueue_burst(odph_ring_t *r, void * const *obj_table,
+int shm_ring_sp_enqueue_burst(shm_ring_t *r, void * const *obj_table,
unsigned n)
{
- return __odph_ring_sp_do_enqueue(r, obj_table, n,
+ return __shm_ring_sp_do_enqueue(r, obj_table, n,
ODPH_RING_QUEUE_VARIABLE);
}
/**
* Enqueue several objects on a ring.
*/
-int odph_ring_enqueue_burst(odph_ring_t *r, void * const *obj_table,
+int shm_ring_enqueue_burst(shm_ring_t *r, void * const *obj_table,
unsigned n)
{
if (r->prod.sp_enqueue)
- return odph_ring_sp_enqueue_burst(r, obj_table, n);
+ return shm_ring_sp_enqueue_burst(r, obj_table, n);
else
- return odph_ring_mp_enqueue_burst(r, obj_table, n);
+ return shm_ring_mp_enqueue_burst(r, obj_table, n);
}
/**
* Dequeue several objects from a ring (multi-consumers safe).
*/
-int odph_ring_mc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n)
+int shm_ring_mc_dequeue_burst(shm_ring_t *r, void **obj_table, unsigned n)
{
- return __odph_ring_mc_do_dequeue(r, obj_table, n,
+ return __shm_ring_mc_do_dequeue(r, obj_table, n,
ODPH_RING_QUEUE_VARIABLE);
}
/**
* Dequeue several objects from a ring (NOT multi-consumers safe).
*/
-int odph_ring_sc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n)
+int shm_ring_sc_dequeue_burst(shm_ring_t *r, void **obj_table, unsigned n)
{
- return __odph_ring_sc_do_dequeue(r, obj_table, n,
+ return __shm_ring_sc_do_dequeue(r, obj_table, n,
ODPH_RING_QUEUE_VARIABLE);
}
/**
* Dequeue multiple objects from a ring up to a maximum number.
*/
-int odph_ring_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n)
+int shm_ring_dequeue_burst(shm_ring_t *r, void **obj_table, unsigned n)
{
if (r->cons.sc_dequeue)
- return odph_ring_sc_dequeue_burst(r, obj_table, n);
+ return shm_ring_sc_dequeue_burst(r, obj_table, n);
else
- return odph_ring_mc_dequeue_burst(r, obj_table, n);
+ return shm_ring_mc_dequeue_burst(r, obj_table, n);
}
@@ -57,7 +57,7 @@
#define RING_TEST_BASIC
-static int test_ring_basic(odph_ring_t *r)
+static int test_ring_basic(shm_ring_t *r)
{
void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL;
int ret;
@@ -86,7 +86,7 @@ static int test_ring_basic(odph_ring_t *r)
printf("Test SP & SC basic functions\n");
printf("enqueue 1 obj\n");
- ret = odph_ring_sp_enqueue_burst(r, cur_src, 1);
+ ret = shm_ring_sp_enqueue_burst(r, cur_src, 1);
cur_src += 1;
if ((ret & ODPH_RING_SZ_MASK) != 1) {
LOG_ERR("sp_enq for 1 obj failed\n");
@@ -94,7 +94,7 @@ static int test_ring_basic(odph_ring_t *r)
}
printf("enqueue 2 objs\n");
- ret = odph_ring_sp_enqueue_burst(r, cur_src, 2);
+ ret = shm_ring_sp_enqueue_burst(r, cur_src, 2);
cur_src += 2;
if ((ret & ODPH_RING_SZ_MASK) != 2) {
LOG_ERR("sp_enq for 2 obj failed\n");
@@ -102,14 +102,14 @@ static int test_ring_basic(odph_ring_t *r)
}
printf("enqueue MAX_BULK objs\n");
- ret = odph_ring_sp_enqueue_burst(r, cur_src, MAX_BULK);
+ ret = shm_ring_sp_enqueue_burst(r, cur_src, MAX_BULK);
if ((ret & ODPH_RING_SZ_MASK) != MAX_BULK) {
LOG_ERR("sp_enq for %d obj failed\n", MAX_BULK);
goto fail;
}
printf("dequeue 1 obj\n");
- ret = odph_ring_sc_dequeue_burst(r, cur_dst, 1);
+ ret = shm_ring_sc_dequeue_burst(r, cur_dst, 1);
cur_dst += 1;
if ((ret & ODPH_RING_SZ_MASK) != 1) {
LOG_ERR("sc_deq for 1 obj failed\n");
@@ -117,7 +117,7 @@ static int test_ring_basic(odph_ring_t *r)
}
printf("dequeue 2 objs\n");
- ret = odph_ring_sc_dequeue_burst(r, cur_dst, 2);
+ ret = shm_ring_sc_dequeue_burst(r, cur_dst, 2);
cur_dst += 2;
if ((ret & ODPH_RING_SZ_MASK) != 2) {
LOG_ERR("sc_deq for 2 obj failed\n");
@@ -125,7 +125,7 @@ static int test_ring_basic(odph_ring_t *r)
}
printf("dequeue MAX_BULK objs\n");
- ret = odph_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK);
+ ret = shm_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK);
cur_dst += MAX_BULK;
if ((ret & ODPH_RING_SZ_MASK) != MAX_BULK) {
LOG_ERR("sc_deq for %d obj failed\n", MAX_BULK);
@@ -144,41 +144,41 @@ static int test_ring_basic(odph_ring_t *r)
printf("Test MP & MC basic functions\n");
printf("enqueue 1 obj\n");
- ret = odph_ring_mp_enqueue_bulk(r, cur_src, 1);
+ ret = shm_ring_mp_enqueue_bulk(r, cur_src, 1);
cur_src += 1;
if (ret != 0) {
LOG_ERR("mp_enq for 1 obj failed\n");
goto fail;
}
printf("enqueue 2 objs\n");
- ret = odph_ring_mp_enqueue_bulk(r, cur_src, 2);
+ ret = shm_ring_mp_enqueue_bulk(r, cur_src, 2);
cur_src += 2;
if (ret != 0) {
LOG_ERR("mp_enq for 2 obj failed\n");
goto fail;
}
printf("enqueue MAX_BULK objs\n");
- ret = odph_ring_mp_enqueue_bulk(r, cur_src, MAX_BULK);
+ ret = shm_ring_mp_enqueue_bulk(r, cur_src, MAX_BULK);
if (ret != 0) {
LOG_ERR("mp_enq for %d obj failed\n", MAX_BULK);
goto fail;
}
printf("dequeue 1 obj\n");
- ret = odph_ring_mc_dequeue_bulk(r, cur_dst, 1);
+ ret = shm_ring_mc_dequeue_bulk(r, cur_dst, 1);
cur_dst += 1;
if (ret != 0) {
LOG_ERR("mc_deq for 1 obj failed\n");
goto fail;
}
printf("dequeue 2 objs\n");
- ret = odph_ring_mc_dequeue_bulk(r, cur_dst, 2);
+ ret = shm_ring_mc_dequeue_bulk(r, cur_dst, 2);
cur_dst += 2;
if (ret != 0) {
LOG_ERR("mc_deq for 2 obj failed\n");
goto fail;
}
printf("dequeue MAX_BULK objs\n");
- ret = odph_ring_mc_dequeue_bulk(r, cur_dst, MAX_BULK);
+ ret = shm_ring_mc_dequeue_bulk(r, cur_dst, MAX_BULK);
cur_dst += MAX_BULK;
if (ret != 0) {
LOG_ERR("mc_deq for %d obj failed\n", MAX_BULK);
@@ -191,30 +191,30 @@ static int test_ring_basic(odph_ring_t *r)
}
printf("test watermark and default bulk enqueue / dequeue\n");
- odph_ring_set_water_mark(r, 20);
+ shm_ring_set_water_mark(r, 20);
num_elems = 16;
cur_src = src;
cur_dst = dst;
- ret = odph_ring_mp_enqueue_bulk(r, cur_src, num_elems);
+ ret = shm_ring_mp_enqueue_bulk(r, cur_src, num_elems);
cur_src += num_elems;
if (ret != 0) {
LOG_ERR("Cannot enqueue\n");
goto fail;
}
- ret = odph_ring_mp_enqueue_bulk(r, cur_src, num_elems);
+ ret = shm_ring_mp_enqueue_bulk(r, cur_src, num_elems);
if (ret != -EDQUOT) {
LOG_ERR("Watermark not exceeded\n");
goto fail;
}
- ret = odph_ring_mc_dequeue_bulk(r, cur_dst, num_elems);
+ ret = shm_ring_mc_dequeue_bulk(r, cur_dst, num_elems);
cur_dst += num_elems;
if (ret != 0) {
LOG_ERR("Cannot dequeue\n");
goto fail;
}
- ret = odph_ring_mc_dequeue_bulk(r, cur_dst, num_elems);
+ ret = shm_ring_mc_dequeue_bulk(r, cur_dst, num_elems);
cur_dst += num_elems;
if (ret != 0) {
LOG_ERR("Cannot dequeue2\n");
@@ -241,7 +241,7 @@ fail:
}
/* global shared ring used for stress testing */
-static odph_ring_t *r_stress;
+static shm_ring_t *r_stress;
/* Stress func for Multi producer only */
static int producer_fn(void)
@@ -260,7 +260,7 @@ static int producer_fn(void)
src[i] = (void *)(unsigned long)i;
do {
- i = odph_ring_mp_enqueue_bulk(r_stress, src, MAX_BULK);
+ i = shm_ring_mp_enqueue_bulk(r_stress, src, MAX_BULK);
if (i == 0) {
free(src);
return 0;
@@ -282,7 +282,7 @@ static int consumer_fn(void)
}
do {
- i = odph_ring_mc_dequeue_bulk(r_stress, src, MAX_BULK);
+ i = shm_ring_mc_dequeue_bulk(r_stress, src, MAX_BULK);
if (i == 0) {
for (i = 0; i < MAX_BULK; i++) {
if (src[i] != (void *)(unsigned long)i) {
@@ -356,7 +356,7 @@ static void *test_ring(void *arg)
ring_arg_t *parg = (ring_arg_t *)arg;
int thr;
char ring_name[ODPH_RING_NAMESIZE];
- odph_ring_t *r;
+ shm_ring_t *r;
int result = 0;
thr = odp_thread_id();
@@ -367,7 +367,7 @@ static void *test_ring(void *arg)
case ODP_RING_TEST_BASIC:
snprintf(ring_name, sizeof(ring_name), "test_ring_%i", thr);
- r = odph_ring_create(ring_name, RING_SIZE,
+ r = shm_ring_create(ring_name, RING_SIZE,
0 /* not used, alignement
taken care inside func : todo */);
if (r == NULL) {
@@ -376,7 +376,7 @@ static void *test_ring(void *arg)
break;
}
/* lookup ring from its name */
- if (odph_ring_lookup(ring_name) != r) {
+ if (shm_ring_lookup(ring_name) != r) {
LOG_ERR("ring lookup failed\n");
result = -1;
break;
@@ -389,7 +389,7 @@ static void *test_ring(void *arg)
}
/* dump ring stats */
- odph_ring_list_dump();
+ shm_ring_list_dump();
break;
@@ -397,7 +397,7 @@ static void *test_ring(void *arg)
test_ring_stress(parg->stress_type);
/* dump ring stats */
- odph_ring_list_dump();
+ shm_ring_list_dump();
break;
default:
@@ -428,7 +428,7 @@ int main(int argc __attribute__((__unused__)),
odp_print_system_info();
- odph_ring_tailq_init();
+ shm_ring_tailq_init();
rarg.thrdarg.numthrds = odp_cpu_count();
@@ -444,7 +444,7 @@ int main(int argc __attribute__((__unused__)),
/* create a ring */
snprintf(ring_name, sizeof(ring_name), "test_ring_stress");
- r_stress = odph_ring_create(ring_name, RING_SIZE,
+ r_stress = shm_ring_create(ring_name, RING_SIZE,
0 /* not used, alignement
taken care inside func : todo */);
if (r_stress == NULL) {
@@ -452,7 +452,7 @@ int main(int argc __attribute__((__unused__)),
goto fail;
}
/* lookup ring from its name */
- if (odph_ring_lookup(ring_name) != r_stress) {
+ if (shm_ring_lookup(ring_name) != r_stress) {
LOG_ERR("ring lookup failed\n");
goto fail;
}
Drop odph_ prefix due to it's not helper anymore and do not add odp_ prefix because it's not api. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- platform/linux-generic/include/odp_ring_internal.h | 64 +++++++------- platform/linux-generic/pktio/ring.c | 98 +++++++++++----------- platform/linux-generic/test/ring/odp_ring_test.c | 58 ++++++------- 3 files changed, 110 insertions(+), 110 deletions(-)