Add support for the odp_dev_id() API. This is a set of arch-specific
placeholder functions that simply return ODP_DEV_ANY to indicate that any
device will do. This also adds odp_dev_t fields to the various param
structs used to create pools, timer pools, and crypto sessions. These
all default to ODP_DEV_ANY.

Signed-off-by: Bill Fischofer <bill.fischo...@linaro.org>
---
Change in v2:
- Correct doxygen comment typo to enable make doxygen-doc to work properly

 include/odp/api/spec/crypto.h                      |  3 ++
 include/odp/api/spec/pool.h                        |  7 ++++
 include/odp/api/spec/timer.h                       |  3 ++
 include/odp_api.h                                  |  1 +
 platform/linux-generic/Makefile.am                 |  3 ++
 platform/linux-generic/arch/arm/odp_dev.c          | 13 ++++++
 platform/linux-generic/arch/default/odp_dev.c      | 13 ++++++
 platform/linux-generic/arch/mips64/odp_dev.c       | 13 ++++++
 platform/linux-generic/arch/powerpc/odp_dev.c      | 13 ++++++
 platform/linux-generic/arch/x86/odp_dev.c          | 13 ++++++
 platform/linux-generic/include/odp/api/dev.h       | 37 ++++++++++++++++
 .../linux-generic/include/odp/api/plat/dev_types.h | 49 ++++++++++++++++++++++
 12 files changed, 168 insertions(+)
 create mode 100644 platform/linux-generic/arch/arm/odp_dev.c
 create mode 100644 platform/linux-generic/arch/default/odp_dev.c
 create mode 100644 platform/linux-generic/arch/mips64/odp_dev.c
 create mode 100644 platform/linux-generic/arch/powerpc/odp_dev.c
 create mode 100644 platform/linux-generic/arch/x86/odp_dev.c
 create mode 100644 platform/linux-generic/include/odp/api/dev.h
 create mode 100644 platform/linux-generic/include/odp/api/plat/dev_types.h

diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
index 0cb8814..c885a73 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -19,6 +19,8 @@
 extern "C" {
 #endif
 
+#include <odp/api/dev.h>
+
 /** @defgroup odp_crypto ODP CRYPTO
  *  Macros, enums, types and operations to utilise crypto.
  *  @{
@@ -182,6 +184,7 @@ typedef struct odp_crypto_session_params {
        odp_crypto_key_t auth_key;         /**< Authentication key */
        odp_queue_t compl_queue;           /**< Async mode completion event 
queue */
        odp_pool_t output_pool;            /**< Output buffer pool */
+       odp_dev_t dev_id;                  /**< NUMA id of this crypto dev */
 } odp_crypto_session_params_t;
 
 /**
diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h
index c80c98a..0ce8af2 100644
--- a/include/odp/api/spec/pool.h
+++ b/include/odp/api/spec/pool.h
@@ -20,6 +20,7 @@ extern "C" {
 #endif
 
 #include <odp/api/std_types.h>
+#include <odp/api/dev.h>
 
 /** @defgroup odp_pool ODP POOL
  *  Operations on a pool.
@@ -164,6 +165,12 @@ typedef struct odp_pool_param_t {
        /** Pool type */
        int type;
 
+       /** NUMA id for this pool */
+       odp_dev_t pool_id;
+
+       /** NUMA id for dram used for this pool */
+       odp_dev_t dram_id;
+
        union {
                struct {
                        /** Number of buffers in the pool */
diff --git a/include/odp/api/spec/timer.h b/include/odp/api/spec/timer.h
index df37189..459a030 100644
--- a/include/odp/api/spec/timer.h
+++ b/include/odp/api/spec/timer.h
@@ -19,6 +19,8 @@
 extern "C" {
 #endif
 
+#include <odp/api/dev.h>
+
 /** @defgroup odp_timer ODP TIMER
  *  @{
  */
@@ -103,6 +105,7 @@ typedef struct {
        uint32_t num_timers; /**< (Minimum) number of supported timers */
        int priv; /**< Shared (false) or private (true) timer pool */
        odp_timer_clk_src_t clk_src; /**< Clock source for timers */
+       odp_dev_t dev_id; /**< NUMA id of this timer resource */
 } odp_timer_pool_param_t;
 
 /**
diff --git a/include/odp_api.h b/include/odp_api.h
index ec7fcd2..89a99ae 100644
--- a/include/odp_api.h
+++ b/include/odp_api.h
@@ -25,6 +25,7 @@ extern "C" {
 #include <odp/api/hash.h>
 #include <odp/api/hints.h>
 #include <odp/api/debug.h>
+#include <odp/api/dev.h>
 #include <odp/api/byteorder.h>
 #include <odp/api/cpu.h>
 #include <odp/api/cpumask.h>
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 0d59877..9ab7378 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -31,6 +31,7 @@ odpapiinclude_HEADERS = \
                  $(srcdir)/include/odp/api/cpumask.h \
                  $(srcdir)/include/odp/api/crypto.h \
                  $(srcdir)/include/odp/api/debug.h \
+                 $(srcdir)/include/odp/api/dev.h \
                  $(srcdir)/include/odp/api/errno.h \
                  $(srcdir)/include/odp/api/event.h \
                  $(srcdir)/include/odp/api/hash.h \
@@ -75,6 +76,7 @@ odpapiplatinclude_HEADERS = \
                  $(srcdir)/include/odp/api/plat/classification_types.h \
                  $(srcdir)/include/odp/api/plat/cpumask_types.h \
                  $(srcdir)/include/odp/api/plat/crypto_types.h \
+                 $(srcdir)/include/odp/api/plat/dev_types.h \
                  $(srcdir)/include/odp/api/plat/event_types.h \
                  $(srcdir)/include/odp/api/plat/init_types.h \
                  $(srcdir)/include/odp/api/plat/packet_types.h \
@@ -228,6 +230,7 @@ __LIB__libodp_linux_la_SOURCES = \
                           drv_shm.c \
                           drv_spinlock.c \
                           arch/@ARCH_DIR@/odp_cpu_arch.c \
+                          arch/@ARCH_DIR@/odp_dev.c \
                           arch/@ARCH_DIR@/odp_sysinfo_parse.c
 
 if HAVE_PCAP
diff --git a/platform/linux-generic/arch/arm/odp_dev.c 
b/platform/linux-generic/arch/arm/odp_dev.c
new file mode 100644
index 0000000..b136a37
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_dev.c
@@ -0,0 +1,13 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/api/dev.h>
+#include <odp/api/hints.h>
+
+odp_dev_t odp_dev_id(const char *name ODP_UNUSED)
+{
+       return ODP_DEV_ANY;
+}
diff --git a/platform/linux-generic/arch/default/odp_dev.c 
b/platform/linux-generic/arch/default/odp_dev.c
new file mode 100644
index 0000000..b136a37
--- /dev/null
+++ b/platform/linux-generic/arch/default/odp_dev.c
@@ -0,0 +1,13 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/api/dev.h>
+#include <odp/api/hints.h>
+
+odp_dev_t odp_dev_id(const char *name ODP_UNUSED)
+{
+       return ODP_DEV_ANY;
+}
diff --git a/platform/linux-generic/arch/mips64/odp_dev.c 
b/platform/linux-generic/arch/mips64/odp_dev.c
new file mode 100644
index 0000000..b136a37
--- /dev/null
+++ b/platform/linux-generic/arch/mips64/odp_dev.c
@@ -0,0 +1,13 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/api/dev.h>
+#include <odp/api/hints.h>
+
+odp_dev_t odp_dev_id(const char *name ODP_UNUSED)
+{
+       return ODP_DEV_ANY;
+}
diff --git a/platform/linux-generic/arch/powerpc/odp_dev.c 
b/platform/linux-generic/arch/powerpc/odp_dev.c
new file mode 100644
index 0000000..b136a37
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp_dev.c
@@ -0,0 +1,13 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/api/dev.h>
+#include <odp/api/hints.h>
+
+odp_dev_t odp_dev_id(const char *name ODP_UNUSED)
+{
+       return ODP_DEV_ANY;
+}
diff --git a/platform/linux-generic/arch/x86/odp_dev.c 
b/platform/linux-generic/arch/x86/odp_dev.c
new file mode 100644
index 0000000..b136a37
--- /dev/null
+++ b/platform/linux-generic/arch/x86/odp_dev.c
@@ -0,0 +1,13 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/api/dev.h>
+#include <odp/api/hints.h>
+
+odp_dev_t odp_dev_id(const char *name ODP_UNUSED)
+{
+       return ODP_DEV_ANY;
+}
diff --git a/platform/linux-generic/include/odp/api/dev.h 
b/platform/linux-generic/include/odp/api/dev.h
new file mode 100644
index 0000000..f8faddd
--- /dev/null
+++ b/platform/linux-generic/include/odp/api/dev.h
@@ -0,0 +1,37 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP Device
+ */
+
+#ifndef ODP_PLAT_DEV_H_
+#define ODP_PLAT_DEV_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/api/std_types.h>
+#include <odp/api/plat/dev_types.h>
+
+/** @ingroup odp_dev
+ *  @{
+ */
+
+/**
+ * @}
+ */
+
+#include <odp/api/spec/dev.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/api/plat/dev_types.h 
b/platform/linux-generic/include/odp/api/plat/dev_types.h
new file mode 100644
index 0000000..669069d
--- /dev/null
+++ b/platform/linux-generic/include/odp/api/plat/dev_types.h
@@ -0,0 +1,49 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP device
+ */
+
+#ifndef ODP_DEV_TYPES_H_
+#define ODP_DEV_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/api/std_types.h>
+#include <odp/api/plat/strong_types.h>
+
+/** @addtogroup odp_dev ODP DEVICE
+ *  Macros and operation on a device.
+ *  @{
+ */
+
+typedef ODP_HANDLE_T(odp_dev_t);
+
+#define ODP_DEV_ANY      _odp_cast_scalar(odp_dev_t, 0)
+#define ODP_DEV_INVALID  _odp_cast_scalar(odp_dev_t, 0xffffffff)
+
+#define ODP_DEV_NAME_LEN 32
+
+/** Get printable format of odp_dev_t */
+static inline uint64_t odp_dev_id_to_u64(odp_dev_t hdl)
+{
+       return _odp_pri(hdl);
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
-- 
2.7.4

Reply via email to