Added capability structure and replaced the config API
definition (odp_config_shm_blocks()) with it.

Signed-off-by: Petri Savolainen <[email protected]>
---
 include/odp/api/spec/config.h              |  8 -------
 include/odp/api/spec/shared_memory.h       | 35 ++++++++++++++++++++++++++++++
 platform/linux-generic/odp_shared_memory.c | 10 +++++++++
 3 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/include/odp/api/spec/config.h b/include/odp/api/spec/config.h
index a6b07b9..4be0b3f 100644
--- a/include/odp/api/spec/config.h
+++ b/include/odp/api/spec/config.h
@@ -64,14 +64,6 @@ int odp_config_sched_grps(void);
  */
 int odp_config_pktio_entries(void);
 
-/** Maximum number of shared memory blocks.
- *
- * This the the number of separate SHM areas that can be reserved concurrently
- *
- * @return The maximum number of shm areas supported by this platform
- */
-int odp_config_shm_blocks(void);
-
 /**
  * @}
  */
diff --git a/include/odp/api/spec/shared_memory.h 
b/include/odp/api/spec/shared_memory.h
index 5d31f41..fbe0fde 100644
--- a/include/odp/api/spec/shared_memory.h
+++ b/include/odp/api/spec/shared_memory.h
@@ -61,6 +61,41 @@ typedef struct odp_shm_info_t {
        uint32_t    flags;     /**< ODP_SHM_* flags */
 } odp_shm_info_t;
 
+/**
+ * Shared memory capabilities
+ */
+typedef struct odp_shm_capability_t {
+       /** Maximum number of shared memory blocks
+        *
+        * This number of separate shared memory blocks can be
+        * reserved concurrently. */
+       unsigned max_blocks;
+
+       /** Maximum memory block size in bytes
+        *
+        * The value of zero means that size is limited only by the available
+        * memory size. */
+       uint64_t max_size;
+
+       /** Maximum memory block alignment in bytes
+        *
+        * The value of zero means that alignment is limited only by the
+        * available memory size. */
+       uint64_t max_align;
+
+} odp_shm_capability_t;
+
+/**
+ * Query shared memory capabilities
+ *
+ * Outputs shared memory capabilities on success.
+ *
+ * @param[out] capa   Pointer to capability structure for output
+ *
+ * @retval 0 on success
+ * @retval <0 on failure
+ */
+int odp_shm_capability(odp_shm_capability_t *capa);
 
 /**
  * Reserve a contiguous block of shared memory
diff --git a/platform/linux-generic/odp_shared_memory.c 
b/platform/linux-generic/odp_shared_memory.c
index a5c5aa3..276a785 100644
--- a/platform/linux-generic/odp_shared_memory.c
+++ b/platform/linux-generic/odp_shared_memory.c
@@ -116,6 +116,16 @@ int odp_shm_init_local(void)
        return 0;
 }
 
+int odp_shm_capability(odp_shm_capability_t *capa)
+{
+       memset(capa, 0, sizeof(odp_shm_capability_t));
+
+       capa->max_blocks = ODP_CONFIG_SHM_BLOCKS;
+       capa->max_size   = 0;
+       capa->max_align  = 0;
+
+       return 0;
+}
 
 static int find_block(const char *name, uint32_t *index)
 {
-- 
2.8.1

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to