From patchwork Mon Oct 24 21:29:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 79085 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp2794784qge; Mon, 24 Oct 2016 14:29:43 -0700 (PDT) X-Received: by 10.31.114.71 with SMTP id n68mr10621926vkc.129.1477344583738; Mon, 24 Oct 2016 14:29:43 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 4si6263176uar.217.2016.10.24.14.29.43; Mon, 24 Oct 2016 14:29:43 -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 1FB3761DFE; Mon, 24 Oct 2016 21:29:43 +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_H2 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 28D10616DA; Mon, 24 Oct 2016 21:29:35 +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 B251B61723; Mon, 24 Oct 2016 21:29:32 +0000 (UTC) Received: from mail-oi0-f48.google.com (mail-oi0-f48.google.com [209.85.218.48]) by lists.linaro.org (Postfix) with ESMTPS id AB8C6616DA for ; Mon, 24 Oct 2016 21:29:31 +0000 (UTC) Received: by mail-oi0-f48.google.com with SMTP id y2so61108621oie.0 for ; Mon, 24 Oct 2016 14:29:31 -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=bEwPRrwvY1wh9sEwmy33Azb1mxmGwzRPIa9n8Kh2XRc=; b=Y/wdDiqG0KntuGvsIXhKobCui2aTqgdRHx6A+iBHrMzAMYUdRDG/KvDfxlpiFhDFhE XbIWTBi9JUX+SC5IRiHWygJqxsEJTQvZf3/JJoChCL9tPmAv+9vcxJNWjUEYoeOXnkbL wsS4nEb30uCEFAGj+W+Uup5ajPYSzqlA5j79m7duwKkpgwzzh/7HEWWnu9e0j16Zq/zK sGGDMKOx+6hje854catAxxB89U48A8o6t2iSsRmwrx0eFaNsJ4pqnaeMRi5m44P44U7f b/4wfpfFCfd9VaVvMgkyCi8YULdZKSbrN+84/Ahjk6n5WUnb61X0qCsPCUDUiBYo1f6M e2LQ== X-Gm-Message-State: ABUngvcyWfBM2CZgdEFh6jbcxPej3WwSYP4wTS5m2O1eZ53EZ5mAIEYj+B3iNEE9Qw2/W8ebrNg= X-Received: by 10.157.56.98 with SMTP id r31mr2691362otd.201.1477344570700; Mon, 24 Oct 2016 14:29:30 -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 l37sm5868103otd.33.2016.10.24.14.29.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Oct 2016 14:29:30 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Mon, 24 Oct 2016 16:29:26 -0500 Message-Id: <1477344567-2561-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477344567-2561-1-git-send-email-bill.fischofer@linaro.org> References: <1477344567-2561-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv3 2/3] linux-generic: dev: implement odp_dev_id() api 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" Signed-off-by: Bill Fischofer --- Changes for v2: - incorporate changes suggested by Petri platform/linux-generic/Makefile.am | 3 ++ platform/linux-generic/include/odp/api/dev.h | 37 ++++++++++++++++ .../linux-generic/include/odp/api/plat/dev_types.h | 49 ++++++++++++++++++++++ platform/linux-generic/odp_dev.c | 13 ++++++ 4 files changed, 102 insertions(+) create mode 100644 platform/linux-generic/include/odp/api/dev.h create mode 100644 platform/linux-generic/include/odp/api/plat/dev_types.h create mode 100644 platform/linux-generic/odp_dev.c -- 2.7.4 diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index dc2486c..0cc9c3d 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 \ @@ -178,6 +180,7 @@ __LIB__libodp_linux_la_SOURCES = \ odp_cpumask.c \ odp_cpumask_task.c \ odp_crypto.c \ + odp_dev.c \ odp_errno.c \ odp_event.c \ odp_hash.c \ 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..c596c10 --- /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_DEFAULT _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 dev) +{ + return _odp_pri(dev); +} + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/odp_dev.c b/platform/linux-generic/odp_dev.c new file mode 100644 index 0000000..cb400ec --- /dev/null +++ b/platform/linux-generic/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_DEFAULT; +}