From: Kevin Wang <kevin.w...@arm.com> Signed-off-by: Kevin Wang <kevin.w...@arm.com> --- /** Email created from pull request 120 (kevinwangsk:cloud-dev-pool-modular) ** https://github.com/Linaro/odp/pull/120 ** Patch: https://github.com/Linaro/odp/pull/120.patch ** Base sha: 863d61cc3ed82f9f0725c792910e8a05cc5d5a82 ** Merge commit sha: b484e3f4f3b7b1a5cc823b03e970999483c0bf2d **/ platform/linux-generic/Makefile.am | 2 + .../linux-generic/include/odp_pool_subsystem.h | 50 ++++++++++++++++++++++ platform/linux-generic/pool/subsystem.c | 17 ++++++++ 3 files changed, 69 insertions(+) create mode 100644 platform/linux-generic/include/odp_pool_subsystem.h create mode 100644 platform/linux-generic/pool/subsystem.c
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 1d703cea..d74e2e31 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -190,6 +190,7 @@ noinst_HEADERS = \ ${srcdir}/include/odp_packet_tap.h \ ${srcdir}/include/odp_pkt_queue_internal.h \ ${srcdir}/include/odp_pool_internal.h \ + ${srcdir}/include/odp_pool_subsystem.h \ ${srcdir}/include/odp_posix_extensions.h \ ${srcdir}/include/odp_queue_internal.h \ ${srcdir}/include/odp_queue_scalable_internal.h \ @@ -267,6 +268,7 @@ __LIB__libodp_linux_la_SOURCES = \ pktio/sysfs.c \ pktio/tap.c \ pktio/ring.c \ + pool/subsystem.c \ odp_pkt_queue.c \ odp_pool.c \ odp_queue.c \ diff --git a/platform/linux-generic/include/odp_pool_subsystem.h b/platform/linux-generic/include/odp_pool_subsystem.h new file mode 100644 index 00000000..45537a86 --- /dev/null +++ b/platform/linux-generic/include/odp_pool_subsystem.h @@ -0,0 +1,50 @@ +/* Copyright (c) 2017, ARM Limited. All rights reserved. + * + * Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef ODP_POOL_SUBSYSTEM_H_ +#define ODP_POOL_SUBSYSTEM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp_module.h> +#include <odp/api/pool.h> + +/* ODP pool public APIs subsystem */ +ODP_SUBSYSTEM_DECLARE(pool); + +/* Subsystem APIs declarations */ +ODP_SUBSYSTEM_API(pool, int, capability, odp_pool_capability_t *capa); +ODP_SUBSYSTEM_API(pool, odp_pool_t, create, const char *name, + odp_pool_param_t *params); +ODP_SUBSYSTEM_API(pool, int, destroy, odp_pool_t pool); +ODP_SUBSYSTEM_API(pool, odp_pool_t, lookup, const char *name); +ODP_SUBSYSTEM_API(pool, int, info, odp_pool_t pool, odp_pool_info_t *info); +ODP_SUBSYSTEM_API(pool, void, print, odp_pool_t pool); +ODP_SUBSYSTEM_API(pool, uint64_t, to_u64, odp_pool_t pool); +ODP_SUBSYSTEM_API(pool, void, param_init, odp_pool_param_t *params); + +typedef ODP_MODULE_CLASS(pool) { + odp_module_base_t base; + + odp_api_proto(pool, capability) capability; + odp_api_proto(pool, create) create; + odp_api_proto(pool, destroy) destroy; + odp_api_proto(pool, lookup) lookup; + odp_api_proto(pool, info) info; + odp_api_proto(pool, print) print; + odp_api_proto(pool, to_u64) to_u64; + odp_api_proto(pool, param_init) param_init; +} pool_module_t; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/pool/subsystem.c b/platform/linux-generic/pool/subsystem.c new file mode 100644 index 00000000..2750149c --- /dev/null +++ b/platform/linux-generic/pool/subsystem.c @@ -0,0 +1,17 @@ +/* Copyright (c) 2017, ARM Limited. All rights reserved. + * + * Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ +#include <odp_module.h> + +#define SUBSYSTEM_VERSION 0x00010000UL +ODP_SUBSYSTEM_DEFINE(pool, "memory pool public APIs", SUBSYSTEM_VERSION); + +ODP_SUBSYSTEM_CONSTRUCTOR(pool) +{ + odp_subsystem_constructor(pool); +} +