@@ -28,8 +28,6 @@ typedef enum {
ODP_SHM_THREAD = 1, /**< Memory accessible by threads. */
ODP_SHM_PROC = 2, /**< Memory accessible by processes.
Will be created if not exist. */
- ODP_SHM_PROC_NOCREAT = 3, /**< Memory accessible by processes.
- Has to be created before usage.*/
} odp_shm_e;
/**
new file mode 100644
@@ -0,0 +1,35 @@
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP shared memory internal
+ */
+
+#ifndef ODP_SHARED_MEMORY_INTERNAL_H_
+#define ODP_SHARED_MEMORY_INTERNAL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp_shared_memory.h>
+
+/*Extend odp_shm_e:
+ * ODP_SHM_PROC_NOCREAT - Memory accessible by processes has to be created
+ * before real usage.
+ */
+#define ODP_SHM_PROC_NOCREAT (ODP_SHM_PROC + 1)
+void *plat_odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
+ odp_shm_e flag);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
@@ -11,6 +11,7 @@
#include <odp_packet_internal.h>
#include <odp_timer_internal.h>
#include <odp_shared_memory.h>
+#include <odp_shared_memory_internal.h>
#include <odp_align.h>
#include <odp_internal.h>
#include <odp_config.h>
@@ -13,6 +13,7 @@
#include <odp_buffer_pool_internal.h>
#include <odp_internal.h>
#include <odp_shared_memory.h>
+#include <odp_shared_memory_internal.h>
#include <odp_schedule_internal.h>
#include <odp_config.h>
#include <odp_packet_io_internal.h>
@@ -100,7 +101,7 @@ static void queue_init(queue_entry_t *queue, const char *name,
if (odp_shm_lookup_ipc(name) == 1) {
size_t ring_size = QUEUE_IPC_ENTRIES * sizeof(void *)
+ sizeof(odph_ring_t);
- queue->s.r = odp_shm_reserve(name, ring_size,
+ queue->s.r = plat_odp_shm_reserve(name, ring_size,
ODP_CACHE_LINE_SIZE,
ODP_SHM_PROC_NOCREAT);
if (queue->s.r == NULL)
@@ -11,6 +11,8 @@
#include <odp_system_info.h>
#include <odp_debug.h>
+#include <odp_shared_memory_internal.h>
+
#include <sys/mman.h>
#include <asm/mman.h>
#include <fcntl.h>
@@ -98,7 +100,7 @@ static int find_block(const char *name)
}
-void *odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
+void *plat_odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
odp_shm_e flag)
{
int i, ret, shm_open_flags;
@@ -203,6 +205,11 @@ void *odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
return addr;
}
+void *odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
+ odp_shm_e flag)
+{
+ return plat_odp_shm_reserve(name, size, align, flag);
+}
void *odp_shm_lookup(const char *name)
{
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- .../linux-generic/include/api/odp_shared_memory.h | 2 -- .../include/odp_shared_memory_internal.h | 35 ++++++++++++++++++++++ platform/linux-generic/odp_buffer_pool.c | 1 + platform/linux-generic/odp_queue.c | 3 +- platform/linux-generic/odp_shared_memory.c | 9 +++++- 5 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 platform/linux-generic/include/odp_shared_memory_internal.h