diff mbox

[PATCHv15,3/9] helper: flag to not link ring to linked list

Message ID 1448044865-8229-4-git-send-email-maxim.uvarov@linaro.org
State Superseded
Headers show

Commit Message

Maxim Uvarov Nov. 20, 2015, 6:40 p.m. UTC
Add flag ODPH_RING_NO_LIST to ring to not link it to linked list.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 helper/include/odp/helper/ring.h | 21 +++++++++++++--------
 helper/ring.c                    |  3 ++-
 2 files changed, 15 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/helper/include/odp/helper/ring.h b/helper/include/odp/helper/ring.h
index 5e640a7..541a466 100644
--- a/helper/include/odp/helper/ring.h
+++ b/helper/include/odp/helper/ring.h
@@ -155,14 +155,19 @@  typedef struct odph_ring {
 	void *ring[0] ODP_ALIGNED_CACHE;
 } odph_ring_t;
 
-
-#define ODPH_RING_F_SP_ENQ 0x0001 /* The default enqueue is "single-producer".*/
-#define ODPH_RING_F_SC_DEQ 0x0002 /* The default dequeue is "single-consumer".*/
-#define ODPH_RING_SHM_PROC 0x0004 /* If set - ring is visible from different
-				    processes. Default is thread visible.     */
-#define ODPH_RING_QUOT_EXCEED (1 << 31)  /* Quota exceed for burst ops */
-#define ODPH_RING_SZ_MASK  (unsigned)(0x0fffffff) /* Ring size mask */
-
+/* The default enqueue is "single-producer".*/
+#define ODPH_RING_F_SP_ENQ (1 << 0)
+/* The default dequeue is "single-consumer".*/
+#define ODPH_RING_F_SC_DEQ (1 << 1)
+/* If set - ring is visible from different processes.
+ * Default is thread visible.*/
+#define ODPH_RING_SHM_PROC (1 << 2)
+ /* Do not link ring to linked list. */
+#define ODPH_RING_NO_LIST  (1 << 3)
+/* Quota exceed for burst ops */
+#define ODPH_RING_QUOT_EXCEED (1 << 31)
+/* Ring size mask */
+#define ODPH_RING_SZ_MASK  (unsigned)(0x0fffffff)
 
 /**
  * Create a new ring named *name* in memory.
diff --git a/helper/ring.c b/helper/ring.c
index 844abf7..e113606 100644
--- a/helper/ring.c
+++ b/helper/ring.c
@@ -199,7 +199,8 @@  odph_ring_create(const char *name, unsigned count, unsigned flags)
 		r->prod.tail = 0;
 		r->cons.tail = 0;
 
-		TAILQ_INSERT_TAIL(&odp_ring_list, r, next);
+		if (!(flags & ODPH_RING_NO_LIST))
+			TAILQ_INSERT_TAIL(&odp_ring_list, r, next);
 	} else {
 		ODPH_ERR("Cannot reserve memory\n");
 	}