From patchwork Thu Oct 13 00:44:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 77595 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp681941qge; Wed, 12 Oct 2016 17:45:15 -0700 (PDT) X-Received: by 10.55.53.68 with SMTP id c65mr625930qka.182.1476319515460; Wed, 12 Oct 2016 17:45:15 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e36si5104747qkh.300.2016.10.12.17.45.14; Wed, 12 Oct 2016 17:45:15 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 5C87A60DA0; Thu, 13 Oct 2016 00:45:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id DC78161736; Thu, 13 Oct 2016 00:44:48 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 2014B60DA0; Thu, 13 Oct 2016 00:44:42 +0000 (UTC) Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by lists.linaro.org (Postfix) with ESMTPS id 8EC3F60ACB for ; Thu, 13 Oct 2016 00:44:40 +0000 (UTC) Received: by mail-oi0-f52.google.com with SMTP id d132so80567556oib.2 for ; Wed, 12 Oct 2016 17:44:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bpee8038NUxFtmqgpUqLiP4kZtoPgC0Job3yvYPpVbs=; b=Hk3K2WNtz1lfaHeja6B6RDxKHm+pvuEjMkSGLpb1vzssCTa7UAef/TU6G+6wvqD+5j THBQKZNcPqir+Txg10ru/HroVH2E3zSiA9pXcrP7RMWt27miPo0zmS7OHlkQ9B99LbHg USJkuqkIadeqHYK4b6aY9K4SqiHIelRxfSQKkNI0mGJ7YplEUb8HdAbB7zJQ5dFrDyc9 k+HN5CmfkHA6aIzc+zlW3NgpqOljXlkHGzzpTgKdF1ETTUgyVnsZYPtL1Ub1CfKEpQ2M pY4tEPcU8WpG7xjvhObalSCooAhY80uc5blQecNJVvb2cexfsB5f7vtmy6dQccTMJP3c 9CwA== X-Gm-Message-State: AA6/9RnCriCXSCK+13eFCMjjWX2qOkMCdPO82Q4AywvzFMtS4wQVzWK2XcyGZBl/gm2WfkPREDg= X-Received: by 10.202.192.5 with SMTP id q5mr2622366oif.71.1476319479783; Wed, 12 Oct 2016 17:44:39 -0700 (PDT) Received: from localhost.localdomain (cpe-70-121-83-241.austin.res.rr.com. [70.121.83.241]) by smtp.gmail.com with ESMTPSA id i18sm3742525oib.12.2016.10.12.17.44.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Oct 2016 17:44:39 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 12 Oct 2016 19:44:36 -0500 Message-Id: <1476319476-18500-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476319476-18500-1-git-send-email-bill.fischofer@linaro.org> References: <1476319476-18500-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv2 2/2] linux-generic: dev: implement device id apis X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" 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 --- 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 -- 2.7.4 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 + /** @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 +#include /** @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 + /** @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 #include #include +#include #include #include #include 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 +#include + +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 +#include + +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 +#include + +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 +#include + +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 +#include + +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 +#include + +/** @ingroup odp_dev + * @{ + */ + +/** + * @} + */ + +#include + +#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 +#include + +/** @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