From patchwork Wed Oct 12 22:02:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 77593 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp639416qge; Wed, 12 Oct 2016 15:03:30 -0700 (PDT) X-Received: by 10.200.33.184 with SMTP id 53mr3637615qty.17.1476309810669; Wed, 12 Oct 2016 15:03:30 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j59si4905386qtb.16.2016.10.12.15.03.30; Wed, 12 Oct 2016 15:03:30 -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 5041260970; Wed, 12 Oct 2016 22:03:30 +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_DNSWL_NONE, 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 7DFA7608EE; Wed, 12 Oct 2016 22:02:59 +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 2DDE5608C7; Wed, 12 Oct 2016 22:02:57 +0000 (UTC) Received: from mail-oi0-f51.google.com (mail-oi0-f51.google.com [209.85.218.51]) by lists.linaro.org (Postfix) with ESMTPS id 8D8F260898 for ; Wed, 12 Oct 2016 22:02:55 +0000 (UTC) Received: by mail-oi0-f51.google.com with SMTP id t73so77158756oie.1 for ; Wed, 12 Oct 2016 15:02:55 -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=hVMltiHLpkzHncls4uAibJQrO2Vtv05dgAaPUACkO6Q=; b=dJmDwfFjfWLICj5JHWk90LG87VPV2umyjSl/SHz4pO2UOD0HwoYhrWnyymKprXEGLr RZC6sovcWV8FeXa8pcbUaqVO0FOVDvum1WbIMHli6x3DG9v8mV/mu5ZFuNFRfWLugNXk ijYE0Z1TotEUsGf2f9qfHaSeXUU7hfVqCt8rUhcItQXpBToctZ/XG4xMc1CvvgsGIQfu WezcvzYk7zAL3MUo5HTkprp997br8GDMLcY9sXpuPW79rSK3rMFKwPI6kGJ9WSfic2ED YVIvIaS34G+gnVaM7LG9xoW3zNaOKFnq/e1QpmOAy4xdRqjrpKlv7GAh4ohumu2miMFi yHfA== X-Gm-Message-State: AA6/9Rn8xThCysvT/iK62KQepeRUPcv/iUdFPElclxSfHDEGBiYOG2sNU5QBc0G1nlGYVpBjOck= X-Received: by 10.157.18.178 with SMTP id g47mr1535583otg.230.1476309775015; Wed, 12 Oct 2016 15:02:55 -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 n8sm3493444oia.29.2016.10.12.15.02.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Oct 2016 15:02:54 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 12 Oct 2016 17:02:51 -0500 Message-Id: <1476309771-29533-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476309771-29533-1-git-send-email-bill.fischofer@linaro.org> References: <1476309771-29533-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 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 --- 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..b8062a5 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