aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/odp_stash.c
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linux-generic/odp_stash.c')
-rw-r--r--platform/linux-generic/odp_stash.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/platform/linux-generic/odp_stash.c b/platform/linux-generic/odp_stash.c
index e12f1aed3..15d995eaf 100644
--- a/platform/linux-generic/odp_stash.c
+++ b/platform/linux-generic/odp_stash.c
@@ -166,6 +166,7 @@ odp_stash_t odp_stash_create(const char *name, const odp_stash_param_t *param)
uint64_t i, ring_size, shm_size;
int ring_u64, index;
char shm_name[ODP_STASH_NAME_LEN + 8];
+ uint32_t shm_flags = 0;
if (odp_global_ro.disable.stash) {
ODP_ERR("Stash is disabled\n");
@@ -214,7 +215,10 @@ odp_stash_t odp_stash_create(const char *name, const odp_stash_param_t *param)
else
shm_size = sizeof(stash_t) + (ring_size * sizeof(uint32_t));
- shm = odp_shm_reserve(shm_name, shm_size, ODP_CACHE_LINE_SIZE, 0);
+ if (odp_global_ro.shm_single_va)
+ shm_flags |= ODP_SHM_SINGLE_VA;
+
+ shm = odp_shm_reserve(shm_name, shm_size, ODP_CACHE_LINE_SIZE, shm_flags);
if (shm == ODP_SHM_INVALID) {
ODP_ERR("SHM reserve failed.\n");
@@ -361,7 +365,7 @@ int32_t odp_stash_put(odp_stash_t st, const void *obj, int32_t num)
return -1;
}
-int32_t odp_stash_put_u32(odp_stash_t st, const uint32_t u32[], int32_t num)
+int32_t odp_stash_put_u32(odp_stash_t st, const uint32_t val[], int32_t num)
{
stash_t *stash = (stash_t *)(uintptr_t)st;
@@ -371,11 +375,11 @@ int32_t odp_stash_put_u32(odp_stash_t st, const uint32_t u32[], int32_t num)
ODP_ASSERT(stash->obj_size == sizeof(uint32_t));
ring_u32_enq_multi(&stash->ring_u32.hdr, stash->ring_mask,
- (uint32_t *)(uintptr_t)u32, num);
+ (uint32_t *)(uintptr_t)val, num);
return num;
}
-int32_t odp_stash_put_u64(odp_stash_t st, const uint64_t u64[], int32_t num)
+int32_t odp_stash_put_u64(odp_stash_t st, const uint64_t val[], int32_t num)
{
stash_t *stash = (stash_t *)(uintptr_t)st;
@@ -385,7 +389,7 @@ int32_t odp_stash_put_u64(odp_stash_t st, const uint64_t u64[], int32_t num)
ODP_ASSERT(stash->obj_size == sizeof(uint64_t));
ring_u64_enq_multi(&stash->ring_u64.hdr, stash->ring_mask,
- (uint64_t *)(uintptr_t)u64, num);
+ (uint64_t *)(uintptr_t)val, num);
return num;
}
@@ -466,7 +470,7 @@ int32_t odp_stash_get(odp_stash_t st, void *obj, int32_t num)
return -1;
}
-int32_t odp_stash_get_u32(odp_stash_t st, uint32_t u32[], int32_t num)
+int32_t odp_stash_get_u32(odp_stash_t st, uint32_t val[], int32_t num)
{
stash_t *stash = (stash_t *)(uintptr_t)st;
@@ -475,11 +479,11 @@ int32_t odp_stash_get_u32(odp_stash_t st, uint32_t u32[], int32_t num)
ODP_ASSERT(stash->obj_size == sizeof(uint32_t));
- return ring_u32_deq_multi(&stash->ring_u32.hdr, stash->ring_mask, u32,
+ return ring_u32_deq_multi(&stash->ring_u32.hdr, stash->ring_mask, val,
num);
}
-int32_t odp_stash_get_u64(odp_stash_t st, uint64_t u64[], int32_t num)
+int32_t odp_stash_get_u64(odp_stash_t st, uint64_t val[], int32_t num)
{
stash_t *stash = (stash_t *)(uintptr_t)st;
@@ -488,7 +492,7 @@ int32_t odp_stash_get_u64(odp_stash_t st, uint64_t u64[], int32_t num)
ODP_ASSERT(stash->obj_size == sizeof(uint64_t));
- return ring_u64_deq_multi(&stash->ring_u64.hdr, stash->ring_mask, u64,
+ return ring_u64_deq_multi(&stash->ring_u64.hdr, stash->ring_mask, val,
num);
}