@@ -158,6 +158,8 @@ typedef struct odp_ring {
#define ODP_RING_F_SP_ENQ 0x0001 /* The default enqueue is "single-producer". */
#define ODP_RING_F_SC_DEQ 0x0002 /* The default dequeue is "single-consumer". */
+#define ODP_RING_SHM_PROC 0x0004 /* If set - ring is visible from different
+ processes. Default is thread visible. */
#define ODP_RING_QUOT_EXCEED (1 << 31) /* Quota exceed for burst ops */
#define ODP_RING_SZ_MASK (unsigned)(0x0fffffff) /* Ring size mask */
@@ -158,6 +158,12 @@ odp_ring_create(const char *name, unsigned count, unsigned flags)
char ring_name[ODP_RING_NAMESIZE];
odp_ring_t *r;
size_t ring_size;
+ odp_shm_e shm_flag;
+
+ if (flags & ODP_RING_SHM_PROC)
+ shm_flag = ODP_SHM_PROC;
+ else
+ shm_flag = ODP_SHM_THREAD;
/* count must be a power of 2 */
if (!ODP_VAL_IS_POWER_2(count) || (count > ODP_RING_SZ_MASK)) {
@@ -172,7 +178,7 @@ odp_ring_create(const char *name, unsigned count, unsigned flags)
odp_rwlock_write_lock(&qlock);
/* reserve a memory zone for this ring.*/
r = odp_shm_reserve(ring_name, ring_size, ODP_CACHE_LINE_SIZE,
- ODP_SHM_THREAD);
+ shm_flag);
if (r != NULL) {
/* init the ring structure */
Add flag to put odp_ring to shared memory visible by different processes. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- include/helper/odp_ring.h | 2 ++ platform/linux-generic/odp_ring.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-)