diff options
author | Petri Savolainen <petri.savolainen@nokia.com> | 2022-06-13 14:57:22 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2022-07-14 13:35:45 +0300 |
commit | 8829376e7cbdc665590fc10e29b6e421325185b8 (patch) | |
tree | 52e7123d0d01a5489656f9ef1170b35361e2c88a /include | |
parent | a94e7d40a79c12a07e3f71b994219ff7ba59f1e2 (diff) |
api: stash: split header files
Split stash API into separate header files for functions and
types. This enables inline implementation of API functions
in the future.
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Ashwin Sekhar T K <asekhar@marvell.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.am | 9 | ||||
-rw-r--r-- | include/odp/api/abi-default/stash.h | 17 | ||||
-rw-r--r-- | include/odp/api/abi-default/stash_types.h | 35 | ||||
-rw-r--r-- | include/odp/api/spec/stash.h | 177 | ||||
-rw-r--r-- | include/odp/api/spec/stash_types.h | 211 | ||||
-rw-r--r-- | include/odp/api/stash_types.h | 28 | ||||
-rw-r--r-- | include/odp/arch/arm32-linux/odp/api/abi/stash_types.h | 7 | ||||
-rw-r--r-- | include/odp/arch/arm64-linux/odp/api/abi/stash_types.h | 7 | ||||
-rw-r--r-- | include/odp/arch/default-linux/odp/api/abi/stash_types.h | 7 | ||||
-rw-r--r-- | include/odp/arch/power64-linux/odp/api/abi/stash_types.h | 7 | ||||
-rw-r--r-- | include/odp/arch/x86_32-linux/odp/api/abi/stash_types.h | 7 | ||||
-rw-r--r-- | include/odp/arch/x86_64-linux/odp/api/abi/stash_types.h | 7 |
12 files changed, 327 insertions, 192 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index 510154753..1c714bfd0 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -55,6 +55,7 @@ odpapiinclude_HEADERS = \ odp/api/spinlock.h \ odp/api/spinlock_recursive.h \ odp/api/stash.h \ + odp/api/stash_types.h \ odp/api/std.h \ odp/api/std_types.h \ odp/api/sync.h \ @@ -116,6 +117,7 @@ odpapispecinclude_HEADERS = \ odp/api/spec/spinlock.h \ odp/api/spec/spinlock_recursive.h \ odp/api/spec/stash.h \ + odp/api/spec/stash_types.h \ odp/api/spec/std.h \ odp/api/spec/std_types.h \ odp/api/spec/sync.h \ @@ -174,6 +176,7 @@ odpapiabidefaultinclude_HEADERS = \ odp/api/abi-default/spinlock.h \ odp/api/abi-default/spinlock_recursive.h \ odp/api/abi-default/stash.h \ + odp/api/abi-default/stash_types.h \ odp/api/abi-default/std.h \ odp/api/abi-default/std_types.h \ odp/api/abi-default/sync.h \ @@ -230,6 +233,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/arm32-linux/odp/api/abi/spinlock.h \ odp/arch/arm32-linux/odp/api/abi/spinlock_recursive.h \ odp/arch/arm32-linux/odp/api/abi/stash.h \ + odp/arch/arm32-linux/odp/api/abi/stash_types.h \ odp/arch/arm32-linux/odp/api/abi/std.h \ odp/arch/arm32-linux/odp/api/abi/std_types.h \ odp/arch/arm32-linux/odp/api/abi/sync.h \ @@ -282,6 +286,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/arm64-linux/odp/api/abi/spinlock.h \ odp/arch/arm64-linux/odp/api/abi/spinlock_recursive.h \ odp/arch/arm64-linux/odp/api/abi/stash.h \ + odp/arch/arm64-linux/odp/api/abi/stash_types.h \ odp/arch/arm64-linux/odp/api/abi/std.h \ odp/arch/arm64-linux/odp/api/abi/std_types.h \ odp/arch/arm64-linux/odp/api/abi/sync.h \ @@ -334,6 +339,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/default-linux/odp/api/abi/spinlock.h \ odp/arch/default-linux/odp/api/abi/spinlock_recursive.h \ odp/arch/default-linux/odp/api/abi/stash.h \ + odp/arch/default-linux/odp/api/abi/stash_types.h \ odp/arch/default-linux/odp/api/abi/std.h \ odp/arch/default-linux/odp/api/abi/std_types.h \ odp/arch/default-linux/odp/api/abi/sync.h \ @@ -386,6 +392,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/power64-linux/odp/api/abi/spinlock.h \ odp/arch/power64-linux/odp/api/abi/spinlock_recursive.h \ odp/arch/power64-linux/odp/api/abi/stash.h \ + odp/arch/power64-linux/odp/api/abi/stash_types.h \ odp/arch/power64-linux/odp/api/abi/std.h \ odp/arch/power64-linux/odp/api/abi/std_types.h \ odp/arch/power64-linux/odp/api/abi/sync.h \ @@ -438,6 +445,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/x86_32-linux/odp/api/abi/spinlock.h \ odp/arch/x86_32-linux/odp/api/abi/spinlock_recursive.h \ odp/arch/x86_32-linux/odp/api/abi/stash.h \ + odp/arch/x86_32-linux/odp/api/abi/stash_types.h \ odp/arch/x86_32-linux/odp/api/abi/std.h \ odp/arch/x86_32-linux/odp/api/abi/std_types.h \ odp/arch/x86_32-linux/odp/api/abi/sync.h \ @@ -490,6 +498,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/x86_64-linux/odp/api/abi/spinlock.h \ odp/arch/x86_64-linux/odp/api/abi/spinlock_recursive.h \ odp/arch/x86_64-linux/odp/api/abi/stash.h \ + odp/arch/x86_64-linux/odp/api/abi/stash_types.h \ odp/arch/x86_64-linux/odp/api/abi/std.h \ odp/arch/x86_64-linux/odp/api/abi/std_types.h \ odp/arch/x86_64-linux/odp/api/abi/sync.h \ diff --git a/include/odp/api/abi-default/stash.h b/include/odp/api/abi-default/stash.h index 51927c143..db4469124 100644 --- a/include/odp/api/abi-default/stash.h +++ b/include/odp/api/abi-default/stash.h @@ -11,22 +11,7 @@ extern "C" { #endif -/** @internal Dummy type for strong typing */ -typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_stash_t; - -/** @ingroup odp_stash - * @{ - */ - -typedef _odp_abi_stash_t *odp_stash_t; - -#define ODP_STASH_INVALID ((odp_stash_t)0) - -#define ODP_STASH_NAME_LEN 32 - -/** - * @} - */ +/* Empty header required due to the inline functions */ #ifdef __cplusplus } diff --git a/include/odp/api/abi-default/stash_types.h b/include/odp/api/abi-default/stash_types.h new file mode 100644 index 000000000..30bc3ca5f --- /dev/null +++ b/include/odp/api/abi-default/stash_types.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2022, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef ODP_ABI_STASH_TYPES_H_ +#define ODP_ABI_STASH_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @internal Dummy type for strong typing */ +typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_stash_t; + +/** @ingroup odp_stash + * @{ + */ + +typedef _odp_abi_stash_t *odp_stash_t; + +#define ODP_STASH_INVALID ((odp_stash_t)0) + +#define ODP_STASH_NAME_LEN 32 + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/odp/api/spec/stash.h b/include/odp/api/spec/stash.h index 81a6281fa..ba260c140 100644 --- a/include/odp/api/spec/stash.h +++ b/include/odp/api/spec/stash.h @@ -18,7 +18,7 @@ extern "C" { #endif -#include <odp/api/std_types.h> +#include <odp/api/stash_types.h> /** @defgroup odp_stash ODP STASH * Stash for storing object handles @@ -26,181 +26,6 @@ extern "C" { */ /** - * @typedef odp_stash_t - * Stash handle - */ - -/** - * @def ODP_STASH_INVALID - * Invalid stash handle - */ - -/** - * @def ODP_STASH_NAME_LEN - * Maximum stash name length in chars including null char - */ - -/** - * Stash types - */ -typedef enum odp_stash_type_t { - /** The default stash type - * - * It is implementation specific in which order odp_stash_get() calls - * return object handles from the stash. The order may be FIFO, LIFO - * or something else. Use this for the best performance when any - * particular ordering is not required. - */ - ODP_STASH_TYPE_DEFAULT = 0, - - /** Stash type FIFO - * - * Stash is implemented as a FIFO. A stash maintains object handle - * order of consecutive odp_stash_put() calls. Object handles stored - * first in the stash are received first by following odp_stash_get() - * calls. To maintain (strict) FIFO ordering of object handles, - * application needs to ensure that odp_stash_put() - * (or odp_stash_get()) operations are not performed concurrently from - * multiple threads. When multiple threads put (or get) object handles - * concurrently in the stash, object handles from different threads - * may be interleaved on output. - */ - ODP_STASH_TYPE_FIFO - -} odp_stash_type_t; - -/** - * Stash operation mode - */ -typedef enum odp_stash_op_mode_t { - /** Multi-thread safe operation - * - * Multiple threads operate on the stash. A stash operation - * (odp_stash_put() or odp_stash_get()) may be performed concurrently - * from multiple threads. - */ - ODP_STASH_OP_MT = 0, - - /** Single thread operation - * - * Multiple threads operate on the stash, but application ensures that - * a stash operation (odp_stash_put() or odp_stash_get()) is not - * performed concurrently from multiple threads. - */ - ODP_STASH_OP_ST, - - /** Thread local operation - * - * Only a single thread operates on the stash. Both stash operations - * (odp_stash_put() and odp_stash_get()) are always performed from the - * same thread. - */ - ODP_STASH_OP_LOCAL - -} odp_stash_op_mode_t; - -/** - * Stash capabilities (per stash type) - */ -typedef struct odp_stash_capability_t { - /** Maximum number of stashes of any type */ - uint32_t max_stashes_any_type; - - /** Maximum number of stashes of this type - * - * The value of zero means that the requested stash type is not - * supported. - */ - uint32_t max_stashes; - - /** Maximum number of object handles per stash - * - * The value of zero means that limited only by the available - * memory size. - */ - uint64_t max_num_obj; - - /** Maximum object handle size in bytes - * - * At least 4 byte object handle size is always supported. - */ - uint32_t max_obj_size; - - /** Maximum size of thread local cache */ - uint32_t max_cache_size; - -} odp_stash_capability_t; - -/** - * Stash parameters - */ -typedef struct odp_stash_param_t { - /** Stash type - * - * Select type of the stash to be created. The default value is - * ODP_STASH_TYPE_DEFAULT. Use stash capability to check if additional - * types are supported. - */ - odp_stash_type_t type; - - /** Put operation mode - * - * The default value is ODP_STASH_OP_MT. Usage of ODP_STASH_OP_ST or - * ODP_STASH_OP_LOCAL mode may improve performance when applicable. - * If ODP_STASH_OP_LOCAL is used, it must be set to both put_mode and - * get_mode. - */ - odp_stash_op_mode_t put_mode; - - /** Get operation mode - * - * The default value is ODP_STASH_OP_MT. Usage of ODP_STASH_OP_ST or - * ODP_STASH_OP_LOCAL mode may improve performance when applicable. - * If ODP_STASH_OP_LOCAL is used, it must be set to both put_mode and - * get_mode. - */ - odp_stash_op_mode_t get_mode; - - /** Maximum number of object handles - * - * This is the maximum number of object handles application will store - * in the stash. The value must not exceed 'max_num_obj' capability. - */ - uint64_t num_obj; - - /** Object handle size in bytes - * - * Application uses object handles of this size in put and get - * operations. Valid values are powers of two (1, 2, 4, 8, ... bytes) - * and must not exceed 'max_obj_size' capability. - */ - uint32_t obj_size; - - /** Maximum number of object handles cached locally per thread - * - * A non-zero value allows implementation to cache object handles - * locally per each thread. Thread local caching may improve - * performance, but requires application to take into account that - * some object handles may be stored locally per thread and thus are - * not available to odp_stash_get() calls from other threads. - * - * Strict FIFO ordering of object handles cannot be maintained with - * thread local caching. If application does not require strict - * ordering, it may allow caching also with ODP_STASH_TYPE_FIFO type - * stashes. - * - * This is the maximum number of handles to be cached per thread. The - * actual cache size and how it is divided between put and get - * operations is implementation specific. The value must not exceed - * 'max_cache_size' capability. The default value is 0. - * - * Thread local cache may be emptied with odp_stash_flush_cache(). - */ - uint32_t cache_size; - -} odp_stash_param_t; - -/** * Query stash capabilities * * Outputs capabilities of the given stash type on success. The stash type diff --git a/include/odp/api/spec/stash_types.h b/include/odp/api/spec/stash_types.h new file mode 100644 index 000000000..70ccce990 --- /dev/null +++ b/include/odp/api/spec/stash_types.h @@ -0,0 +1,211 @@ +/* Copyright (c) 2020-2022, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP stash types + */ + +#ifndef ODP_API_SPEC_STASH_TYPES_H_ +#define ODP_API_SPEC_STASH_TYPES_H_ +#include <odp/visibility_begin.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp/api/std_types.h> + +/** @addtogroup odp_stash + * @{ + */ + +/** + * @typedef odp_stash_t + * Stash handle + */ + +/** + * @def ODP_STASH_INVALID + * Invalid stash handle + */ + +/** + * @def ODP_STASH_NAME_LEN + * Maximum stash name length in chars including null char + */ + +/** + * Stash types + */ +typedef enum odp_stash_type_t { + /** The default stash type + * + * It is implementation specific in which order odp_stash_get() calls + * return object handles from the stash. The order may be FIFO, LIFO + * or something else. Use this for the best performance when any + * particular ordering is not required. + */ + ODP_STASH_TYPE_DEFAULT = 0, + + /** Stash type FIFO + * + * Stash is implemented as a FIFO. A stash maintains object handle + * order of consecutive odp_stash_put() calls. Object handles stored + * first in the stash are received first by following odp_stash_get() + * calls. To maintain (strict) FIFO ordering of object handles, + * application needs to ensure that odp_stash_put() + * (or odp_stash_get()) operations are not performed concurrently from + * multiple threads. When multiple threads put (or get) object handles + * concurrently in the stash, object handles from different threads + * may be interleaved on output. + */ + ODP_STASH_TYPE_FIFO + +} odp_stash_type_t; + +/** + * Stash operation mode + */ +typedef enum odp_stash_op_mode_t { + /** Multi-thread safe operation + * + * Multiple threads operate on the stash. A stash operation + * (odp_stash_put() or odp_stash_get()) may be performed concurrently + * from multiple threads. + */ + ODP_STASH_OP_MT = 0, + + /** Single thread operation + * + * Multiple threads operate on the stash, but application ensures that + * a stash operation (odp_stash_put() or odp_stash_get()) is not + * performed concurrently from multiple threads. + */ + ODP_STASH_OP_ST, + + /** Thread local operation + * + * Only a single thread operates on the stash. Both stash operations + * (odp_stash_put() and odp_stash_get()) are always performed from the + * same thread. + */ + ODP_STASH_OP_LOCAL + +} odp_stash_op_mode_t; + +/** + * Stash capabilities (per stash type) + */ +typedef struct odp_stash_capability_t { + /** Maximum number of stashes of any type */ + uint32_t max_stashes_any_type; + + /** Maximum number of stashes of this type + * + * The value of zero means that the requested stash type is not + * supported. + */ + uint32_t max_stashes; + + /** Maximum number of object handles per stash + * + * The value of zero means that limited only by the available + * memory size. + */ + uint64_t max_num_obj; + + /** Maximum object handle size in bytes + * + * At least 4 byte object handle size is always supported. + */ + uint32_t max_obj_size; + + /** Maximum size of thread local cache */ + uint32_t max_cache_size; + +} odp_stash_capability_t; + +/** + * Stash parameters + */ +typedef struct odp_stash_param_t { + /** Stash type + * + * Select type of the stash to be created. The default value is + * ODP_STASH_TYPE_DEFAULT. Use stash capability to check if additional + * types are supported. + */ + odp_stash_type_t type; + + /** Put operation mode + * + * The default value is ODP_STASH_OP_MT. Usage of ODP_STASH_OP_ST or + * ODP_STASH_OP_LOCAL mode may improve performance when applicable. + * If ODP_STASH_OP_LOCAL is used, it must be set to both put_mode and + * get_mode. + */ + odp_stash_op_mode_t put_mode; + + /** Get operation mode + * + * The default value is ODP_STASH_OP_MT. Usage of ODP_STASH_OP_ST or + * ODP_STASH_OP_LOCAL mode may improve performance when applicable. + * If ODP_STASH_OP_LOCAL is used, it must be set to both put_mode and + * get_mode. + */ + odp_stash_op_mode_t get_mode; + + /** Maximum number of object handles + * + * This is the maximum number of object handles application will store + * in the stash. The value must not exceed 'max_num_obj' capability. + */ + uint64_t num_obj; + + /** Object handle size in bytes + * + * Application uses object handles of this size in put and get + * operations. Valid values are powers of two (1, 2, 4, 8, ... bytes) + * and must not exceed 'max_obj_size' capability. + */ + uint32_t obj_size; + + /** Maximum number of object handles cached locally per thread + * + * A non-zero value allows implementation to cache object handles + * locally per each thread. Thread local caching may improve + * performance, but requires application to take into account that + * some object handles may be stored locally per thread and thus are + * not available to odp_stash_get() calls from other threads. + * + * Strict FIFO ordering of object handles cannot be maintained with + * thread local caching. If application does not require strict + * ordering, it may allow caching also with ODP_STASH_TYPE_FIFO type + * stashes. + * + * This is the maximum number of handles to be cached per thread. The + * actual cache size and how it is divided between put and get + * operations is implementation specific. The value must not exceed + * 'max_cache_size' capability. The default value is 0. + * + * Thread local cache may be emptied with odp_stash_flush_cache(). + */ + uint32_t cache_size; + +} odp_stash_param_t; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#include <odp/visibility_end.h> +#endif diff --git a/include/odp/api/stash_types.h b/include/odp/api/stash_types.h new file mode 100644 index 000000000..3d227d958 --- /dev/null +++ b/include/odp/api/stash_types.h @@ -0,0 +1,28 @@ +/* Copyright (c) 2022, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP stash + */ + +#ifndef ODP_API_STASH_TYPES_H_ +#define ODP_API_STASH_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp/api/abi/stash_types.h> + +#include <odp/api/spec/stash_types.h> + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/odp/arch/arm32-linux/odp/api/abi/stash_types.h b/include/odp/arch/arm32-linux/odp/api/abi/stash_types.h new file mode 100644 index 000000000..998f75432 --- /dev/null +++ b/include/odp/arch/arm32-linux/odp/api/abi/stash_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2022, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/stash_types.h> diff --git a/include/odp/arch/arm64-linux/odp/api/abi/stash_types.h b/include/odp/arch/arm64-linux/odp/api/abi/stash_types.h new file mode 100644 index 000000000..998f75432 --- /dev/null +++ b/include/odp/arch/arm64-linux/odp/api/abi/stash_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2022, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/stash_types.h> diff --git a/include/odp/arch/default-linux/odp/api/abi/stash_types.h b/include/odp/arch/default-linux/odp/api/abi/stash_types.h new file mode 100644 index 000000000..998f75432 --- /dev/null +++ b/include/odp/arch/default-linux/odp/api/abi/stash_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2022, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/stash_types.h> diff --git a/include/odp/arch/power64-linux/odp/api/abi/stash_types.h b/include/odp/arch/power64-linux/odp/api/abi/stash_types.h new file mode 100644 index 000000000..998f75432 --- /dev/null +++ b/include/odp/arch/power64-linux/odp/api/abi/stash_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2022, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/stash_types.h> diff --git a/include/odp/arch/x86_32-linux/odp/api/abi/stash_types.h b/include/odp/arch/x86_32-linux/odp/api/abi/stash_types.h new file mode 100644 index 000000000..998f75432 --- /dev/null +++ b/include/odp/arch/x86_32-linux/odp/api/abi/stash_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2022, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/stash_types.h> diff --git a/include/odp/arch/x86_64-linux/odp/api/abi/stash_types.h b/include/odp/arch/x86_64-linux/odp/api/abi/stash_types.h new file mode 100644 index 000000000..998f75432 --- /dev/null +++ b/include/odp/arch/x86_64-linux/odp/api/abi/stash_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2022, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/stash_types.h> |