> -----Original Message-----
> From: lng-odp [mailto:[email protected]] On Behalf Of Bill
> Fischofer
> Sent: Thursday, October 13, 2016 3:45 AM
> To: [email protected]
> Subject: [lng-odp] [API-NEXT PATCHv2 2/2] linux-generic: dev: implement
> device id apis
>
> 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 <[email protected]>
> ---
> 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 +
These include API changes and should be introduced in a separate patch(es).
> 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 ++++++
There's no reason to make device IDs CPU architecture specific. Device
specification is ODP implementation specific (odp-linux have only one mapping
from e.g. "dram0" to odp_dev_t).
> 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
No need to mention NUMA. It's just a crypto device (independent of the HW
hierarchy).
"Crypto device to be used for the session."
> */
> } 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;
No need to mention NUMA, just:
/** Pool device */
odp_dev_t pool_dev;
> +
> + /** NUMA id for dram used for this pool */
> + odp_dev_t dram_id;
> +
No need to mention NUMA or even DRAM (since selection may be also some
internal, non-DRAM based memory) just:
/** Memory device */
odp_dev_t memory_dev;
> 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 */
No NUMA, just timer_dev.
> } odp_timer_pool_param_t;
>
> 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;
> +}
Just one implementation for odp-linux.
-Petri