From patchwork Mon Nov 20 08:00:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 119263 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3534448qgn; Mon, 20 Nov 2017 00:01:59 -0800 (PST) X-Google-Smtp-Source: AGs4zMYYs+19p05q+K7MWPbKQYYnaQ2JDEIGfgD5LsuP0petOrppdmN3/h0tuQE0xgVAPBTJ9uX1 X-Received: by 10.237.53.39 with SMTP id a36mr7676373qte.88.1511164919744; Mon, 20 Nov 2017 00:01:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511164919; cv=none; d=google.com; s=arc-20160816; b=hQerMVc0vLalX3TNv8ebktcDxUaeOJSyV0b3vFILz+/d4PK1QpPrLzyEe64ZbEXFb3 p8fvN1bIr0W7W9mb+C+rAqEBfmn1p22Xh99tvak+2hC+Kh9rLY/9seHSCY7qHbSEGBrk BZVl5adFnBj3xDnL1rxOKvIbimIxqJe8NorEIdf8NTZlV0UrwZ3+QQ+7MXpyZjTGs6VD 3Ss2zQ5wZ0Nag98DHzvKO7uLKsiop92d3guhZpQI11GAY7h0SQBEp3KyUy1Cn3GG941v t+qO3oHhsklgPyDyRk5P65gV6e9n0y2Eq4E1tpjtnyoRj8K0HKfW+R5JK3EqA6mqZtjh 7Bew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=qgm668t6H2KiiNK85iANr8fha7iuGUuSUGU/0fxJ0Ao=; b=TwJWPGBEa4LBhJcJCztEnTUcQ5xao1tLIety0OFHlIJ8/fNSObLXiE9ixppm3+e+iE JEh/ldbvYrPLQYCz4UkizW0Tjd9E+WTavEQEB+6ZQF+P2mgpJhJhTz3tKhz9KjdYWKha Hfo6o2SJ+SHsM358+ZD4JJI5GtmFwynfmNA9jzX8MVM+XCHZBiMLceFBtI4pNcfQMtTe J4X5Y93+9QLk1uDZ+MJzcpr6aabGCCDkuNF/vlUi2Afa+tX3HyIUBMR46PLvoiVvvC+Q RKzM5MVW3fi/aCk+obHZNjmyI88piuO+9OkJen2yfk8Voj7t0MYNzqHyWU8+oWJjVF7Y K+0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id 10si2537843qko.338.2017.11.20.00.01.59; Mon, 20 Nov 2017 00:01:59 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 6FF2160888; Mon, 20 Nov 2017 08:01:59 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED 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 1111A6038B; Mon, 20 Nov 2017 08:00: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 3339560888; Mon, 20 Nov 2017 08:00:38 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id C5299608AC for ; Mon, 20 Nov 2017 08:00:13 +0000 (UTC) Received: from mxback1j.mail.yandex.net (mxback1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10a]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 028772D835E1 for ; Mon, 20 Nov 2017 11:00:12 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id yjKeIQ1fE2-0Bke65xG; Mon, 20 Nov 2017 11:00:11 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id CZnTikvrH1-0Bbqbuax; Mon, 20 Nov 2017 11:00:11 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 20 Nov 2017 11:00:06 +0300 Message-Id: <1511164807-22019-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511164807-22019-1-git-send-email-odpbot@yandex.ru> References: <1511164807-22019-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 300 Subject: [lng-odp] [PATCH v1] [RFC 1/2] temporarily disable DDF validations and samples 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" From: Yi He Signed-off-by: Yi He --- /** Email created from pull request 300 (heyi-linaro:native-drivers) ** https://github.com/Linaro/odp/pull/300 ** Patch: https://github.com/Linaro/odp/pull/300.patch ** Base sha: 4bd608048e6fa77d3154b8d90b85fc2b66c6bf1a ** Merge commit sha: 271cc8133b1e637126d59ea9c1b71c02d68ad4a3 **/ example/Makefile.am | 4 +--- example/m4/configure.m4 | 2 -- test/m4/configure.m4 | 6 +----- test/validation/Makefile.am | 3 +-- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/example/Makefile.am b/example/Makefile.am index b6e8d81fe..695e029c9 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -9,8 +9,6 @@ SUBDIRS = classifier \ switch \ time \ timer \ - traffic_mgmt \ - ddf_ifs \ - ddf_app + traffic_mgmt noinst_HEADERS = example_debug.h diff --git a/example/m4/configure.m4 b/example/m4/configure.m4 index 208c5d6d7..cab7f8b8c 100644 --- a/example/m4/configure.m4 +++ b/example/m4/configure.m4 @@ -19,6 +19,4 @@ AC_CONFIG_FILES([example/classifier/Makefile example/time/Makefile example/timer/Makefile example/traffic_mgmt/Makefile - example/ddf_ifs/Makefile - example/ddf_app/Makefile example/Makefile]) diff --git a/test/m4/configure.m4 b/test/m4/configure.m4 index a9e345bf6..ef6096e87 100644 --- a/test/m4/configure.m4 +++ b/test/m4/configure.m4 @@ -32,8 +32,4 @@ AC_CONFIG_FILES([test/Makefile test/validation/api/thread/Makefile test/validation/api/time/Makefile test/validation/api/timer/Makefile - test/validation/api/traffic_mngr/Makefile - test/validation/drv/Makefile - test/validation/drv/drvatomic/Makefile - test/validation/drv/drvdriver/Makefile - test/validation/drv/drvshmem/Makefile]) + test/validation/api/traffic_mngr/Makefile]) diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 17e0444be..328543780 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -1,4 +1,3 @@ if test_vald - SUBDIRS = api \ - drv + SUBDIRS = api endif From patchwork Mon Nov 20 08:00:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 119264 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3535663qgn; Mon, 20 Nov 2017 00:03:11 -0800 (PST) X-Google-Smtp-Source: AGs4zMYEsB9P1FSvuh5zCpi7Kz+y+fZ/hJI88G8cXPx8LlxF8pmTC1OemQ1Q3idKVckrW9Md8Lmz X-Received: by 10.200.3.65 with SMTP id w1mr20471495qtg.297.1511164990979; Mon, 20 Nov 2017 00:03:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511164990; cv=none; d=google.com; s=arc-20160816; b=Zg5QeehiOgCEVmJMN8+yqjFJvLVM8oMzCh6DtBPOOsiHKJd99X0GDhtJUIWTAX5pLH 4Ne9w8TxOg81Mdc5YKA/ZWo31Fed8vNyjeaeI84pWYeEuzwxLM3uosoLU6PKFFuyPDGF FeFczIMXGcA/HlUMqPDFRvoSucbNt+JcC+Pw4idVUaUrdwbuefdDKxfyDwyNxuzIWTHG 7Rf3ZApZN4Na+AnLKWZ9dVcjRtJ39A2KjJqUfyCoRSayrgSuD7AZe294gwOjn7y8f2Wp vpUx/JKLtWOMxRyElKfhSx3HeyWjM8s9am2qNNOtUus4XAco1WCSnyIBpAWU8AZ2Sj+M rPnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=QwKf7ImNFl9m6HojtZ8eAbjIBvcjD21e0KbAySb7+oY=; b=fvc+Ymos7gMXkFyKp6KiTGuKkglz4TKm9g1O3UCC4eP/fXnT5uCiea0+uT2MuMQtk/ 7KBmgRgxjhdHh+lIKKQv5CwkbUk1DRnptrSVAAlmQFLd/9l+DoQsT1yNB7rXz0zDFnub MyOrNtpghkNEg2pVH0hE87uh9Adh8KFVNL7rf3QbWCmM9I3Ogyz/FN1OG6KKfNnJ3IhS 2DwKZuXl6JbP0QUr3bv+PLgVKFyrFpPzxfysSFM7l9SrHQ9yUpyflCa95cJTM9aBdtBy pUglRyRo0sh+KO0RhUqj1ESNxxmujMR9sNGPqtVEumDweIb+j8jwUAd2Ps78J6/pZ5cP uplg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id 131si4572915qkj.246.2017.11.20.00.03.10; Mon, 20 Nov 2017 00:03:10 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 7EA96608B7; Mon, 20 Nov 2017 08:03:10 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED 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 885E46084B; Mon, 20 Nov 2017 08:01:15 +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 DE58760890; Mon, 20 Nov 2017 08:01:00 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 9F69860607 for ; Mon, 20 Nov 2017 08:00:15 +0000 (UTC) Received: from mxback11g.mail.yandex.net (mxback11g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:90]) by forward105o.mail.yandex.net (Yandex) with ESMTP id DE4704442DA2 for ; Mon, 20 Nov 2017 11:00:13 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback11g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id wKqOJSvzie-0DL8ps4r; Mon, 20 Nov 2017 11:00:13 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id CZnTikvrH1-0CbiVxDc; Mon, 20 Nov 2017 11:00:12 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 20 Nov 2017 11:00:07 +0300 Message-Id: <1511164807-22019-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511164807-22019-1-git-send-email-odpbot@yandex.ru> References: <1511164807-22019-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 300 Subject: [lng-odp] [PATCH v1] [RFC 2/2] DDF cleanup and movement 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" From: Yi He Cleanup DDF duplicated align, atomic, barrier, byteorder, compiler, hints, shm, spinlock, std_types and sync, driver can use ODP APIs directly, move DDF into frameworks/driver. Signed-off-by: Yi He --- /** Email created from pull request 300 (heyi-linaro:native-drivers) ** https://github.com/Linaro/odp/pull/300 ** Patch: https://github.com/Linaro/odp/pull/300.patch ** Base sha: 4bd608048e6fa77d3154b8d90b85fc2b66c6bf1a ** Merge commit sha: 271cc8133b1e637126d59ea9c1b71c02d68ad4a3 **/ {include/odp/drv/spec => frameworks/driver}/README | 0 .../drv_driver.c => frameworks/driver/driver.c | 5 +- .../spec => frameworks/driver/include}/driver.h | 3 + .../driver/include/driver_internal.h | 0 frameworks/driver/include/driver_types.h | 52 ++ .../driver/include/pci_internal.h | 2 + .../drv_pci.c => frameworks/driver/pci.c | 2 +- .../drv_pci_uio.c => frameworks/driver/pci_uio.c | 3 +- include/Makefile.am | 17 +- include/odp/drv/spec/align.h | 78 --- include/odp/drv/spec/atomic.h | 634 --------------------- include/odp/drv/spec/barrier.h | 66 --- include/odp/drv/spec/byteorder.h | 181 ------ include/odp/drv/spec/compiler.h | 51 -- include/odp/drv/spec/hints.h | 119 ---- include/odp/drv/spec/shm.h | 330 ----------- include/odp/drv/spec/spinlock.h | 86 --- include/odp/drv/spec/std_types.h | 40 -- include/odp/drv/spec/sync.h | 91 --- include/odp_drv.h | 36 -- platform/linux-dpdk/Makefile.am | 46 +- platform/linux-generic/Makefile.am | 52 +- platform/linux-generic/_ishm.c | 1 - platform/linux-generic/_ishmpool.c | 1 - platform/linux-generic/_modules.c | 2 +- platform/linux-generic/drv_atomic.c | 26 - platform/linux-generic/drv_barrier.c | 50 -- platform/linux-generic/drv_shm.c | 146 ----- platform/linux-generic/drv_spinlock.c | 39 -- platform/linux-generic/include/odp/drv/README | 2 - platform/linux-generic/include/odp/drv/align.h | 58 -- platform/linux-generic/include/odp/drv/atomic.h | 430 -------------- platform/linux-generic/include/odp/drv/barrier.h | 30 - platform/linux-generic/include/odp/drv/byteorder.h | 146 ----- platform/linux-generic/include/odp/drv/compiler.h | 34 -- platform/linux-generic/include/odp/drv/driver.h | 37 -- platform/linux-generic/include/odp/drv/hints.h | 34 -- .../include/odp/drv/plat/atomic_types.h | 88 --- .../include/odp/drv/plat/barrier_types.h | 38 -- .../include/odp/drv/plat/byteorder_types.h | 84 --- .../include/odp/drv/plat/driver_types.h | 52 -- .../linux-generic/include/odp/drv/plat/shm_types.h | 49 -- .../include/odp/drv/plat/spinlock_types.h | 33 -- .../include/odp/drv/plat/strong_types.h | 35 -- platform/linux-generic/include/odp/drv/shm.h | 36 -- platform/linux-generic/include/odp/drv/spinlock.h | 28 - platform/linux-generic/include/odp/drv/std_types.h | 42 -- platform/linux-generic/include/odp/drv/sync.h | 49 -- .../linux-generic/include/odp_pktio_ops_virtio.h | 2 +- platform/linux-generic/pktio/{ => virtio}/virtio.c | 2 +- .../linux-generic/pktio/{ => virtio}/virtio_pci.c | 16 +- .../linux-generic/pktio/{ => virtio}/virtio_pci.h | 2 +- 52 files changed, 100 insertions(+), 3386 deletions(-) rename {include/odp/drv/spec => frameworks/driver}/README (100%) rename platform/linux-generic/drv_driver.c => frameworks/driver/driver.c (99%) rename {include/odp/drv/spec => frameworks/driver/include}/driver.h (99%) rename platform/linux-generic/include/drv_driver_internal.h => frameworks/driver/include/driver_internal.h (100%) create mode 100644 frameworks/driver/include/driver_types.h rename platform/linux-generic/include/drv_pci_internal.h => frameworks/driver/include/pci_internal.h (99%) rename platform/linux-generic/drv_pci.c => frameworks/driver/pci.c (99%) rename platform/linux-generic/drv_pci_uio.c => frameworks/driver/pci_uio.c (99%) delete mode 100644 include/odp/drv/spec/align.h delete mode 100644 include/odp/drv/spec/atomic.h delete mode 100644 include/odp/drv/spec/barrier.h delete mode 100644 include/odp/drv/spec/byteorder.h delete mode 100644 include/odp/drv/spec/compiler.h delete mode 100644 include/odp/drv/spec/hints.h delete mode 100644 include/odp/drv/spec/shm.h delete mode 100644 include/odp/drv/spec/spinlock.h delete mode 100644 include/odp/drv/spec/std_types.h delete mode 100644 include/odp/drv/spec/sync.h delete mode 100644 include/odp_drv.h delete mode 100644 platform/linux-generic/drv_atomic.c delete mode 100644 platform/linux-generic/drv_barrier.c delete mode 100644 platform/linux-generic/drv_shm.c delete mode 100644 platform/linux-generic/drv_spinlock.c delete mode 100644 platform/linux-generic/include/odp/drv/README delete mode 100644 platform/linux-generic/include/odp/drv/align.h delete mode 100644 platform/linux-generic/include/odp/drv/atomic.h delete mode 100644 platform/linux-generic/include/odp/drv/barrier.h delete mode 100644 platform/linux-generic/include/odp/drv/byteorder.h delete mode 100644 platform/linux-generic/include/odp/drv/compiler.h delete mode 100644 platform/linux-generic/include/odp/drv/driver.h delete mode 100644 platform/linux-generic/include/odp/drv/hints.h delete mode 100644 platform/linux-generic/include/odp/drv/plat/atomic_types.h delete mode 100644 platform/linux-generic/include/odp/drv/plat/barrier_types.h delete mode 100644 platform/linux-generic/include/odp/drv/plat/byteorder_types.h delete mode 100644 platform/linux-generic/include/odp/drv/plat/driver_types.h delete mode 100644 platform/linux-generic/include/odp/drv/plat/shm_types.h delete mode 100644 platform/linux-generic/include/odp/drv/plat/spinlock_types.h delete mode 100644 platform/linux-generic/include/odp/drv/plat/strong_types.h delete mode 100644 platform/linux-generic/include/odp/drv/shm.h delete mode 100644 platform/linux-generic/include/odp/drv/spinlock.h delete mode 100644 platform/linux-generic/include/odp/drv/std_types.h delete mode 100644 platform/linux-generic/include/odp/drv/sync.h rename platform/linux-generic/pktio/{ => virtio}/virtio.c (99%) rename platform/linux-generic/pktio/{ => virtio}/virtio_pci.c (98%) rename platform/linux-generic/pktio/{ => virtio}/virtio_pci.h (99%) diff --git a/include/odp/drv/spec/README b/frameworks/driver/README similarity index 100% rename from include/odp/drv/spec/README rename to frameworks/driver/README diff --git a/platform/linux-generic/drv_driver.c b/frameworks/driver/driver.c similarity index 99% rename from platform/linux-generic/drv_driver.c rename to frameworks/driver/driver.c index ecf75ab9d..1abd442d2 100644 --- a/platform/linux-generic/drv_driver.c +++ b/frameworks/driver/driver.c @@ -7,18 +7,17 @@ #include #include +#include #include #include <_ishmpool_internal.h> +#include #include #include #include #include -#include -#include #include -#include static enum {UNDONE, IN_PROGRESS, DONE} init_global_status; diff --git a/include/odp/drv/spec/driver.h b/frameworks/driver/include/driver.h similarity index 99% rename from include/odp/drv/spec/driver.h rename to frameworks/driver/include/driver.h index 224baf4fe..ac1eeb52f 100644 --- a/include/odp/drv/spec/driver.h +++ b/frameworks/driver/include/driver.h @@ -14,6 +14,9 @@ #define ODPDRV_DRIVER_H_ #include +#include "driver_types.h" +#include "driver_internal.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/platform/linux-generic/include/drv_driver_internal.h b/frameworks/driver/include/driver_internal.h similarity index 100% rename from platform/linux-generic/include/drv_driver_internal.h rename to frameworks/driver/include/driver_internal.h diff --git a/frameworks/driver/include/driver_types.h b/frameworks/driver/include/driver_types.h new file mode 100644 index 000000000..181f54920 --- /dev/null +++ b/frameworks/driver/include/driver_types.h @@ -0,0 +1,52 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP shared memory + */ + +#ifndef ODPDRV_DRIVER_TYPES_H_ +#define ODPDRV_DRIVER_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/** @addtogroup odpdrv_driver ODPDRV DRIVER + * Operations on driver related items (enumerator class, enumerators, + * devios and drivers). + * @{ + */ + +typedef ODP_HANDLE_T(odpdrv_enumr_class_t); +#define ODPDRV_ENUMR_CLASS_INVALID _odp_cast_scalar(odpdrv_enumr_class_t, 0) + +typedef ODP_HANDLE_T(odpdrv_enumr_t); +#define ODPDRV_ENUMR_INVALID _odp_cast_scalar(odpdrv_enumr_t, 0) + +typedef ODP_HANDLE_T(odpdrv_device_t); +#define ODPDRV_DEVICE_INVALID _odp_cast_scalar(odpdrv_device_t, 0) + +typedef ODP_HANDLE_T(odpdrv_devio_t); +#define ODPDRV_DEVIO_INVALID _odp_cast_scalar(odpdrv_devio_t, 0) + +typedef ODP_HANDLE_T(odpdrv_driver_t); +#define ODPDRV_DRIVER_INVALID _odp_cast_scalar(odpdrv_driver_t, 0) + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/drv_pci_internal.h b/frameworks/driver/include/pci_internal.h similarity index 99% rename from platform/linux-generic/include/drv_pci_internal.h rename to frameworks/driver/include/pci_internal.h index fca7d2efe..d40cbc48e 100644 --- a/platform/linux-generic/include/drv_pci_internal.h +++ b/frameworks/driver/include/pci_internal.h @@ -7,6 +7,8 @@ #ifndef DRV_PCI_INTERNAL_H_ #define DRV_PCI_INTERNAL_H_ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/platform/linux-generic/drv_pci.c b/frameworks/driver/pci.c similarity index 99% rename from platform/linux-generic/drv_pci.c rename to frameworks/driver/pci.c index 065ba33db..2e371ef7b 100644 --- a/platform/linux-generic/drv_pci.c +++ b/frameworks/driver/pci.c @@ -44,7 +44,7 @@ #include #include -#include +#include #define MAX_PCI_DEVICES 16 diff --git a/platform/linux-generic/drv_pci_uio.c b/frameworks/driver/pci_uio.c similarity index 99% rename from platform/linux-generic/drv_pci_uio.c rename to frameworks/driver/pci_uio.c index d11c868c9..6a1f8cb3f 100644 --- a/platform/linux-generic/drv_pci_uio.c +++ b/frameworks/driver/pci_uio.c @@ -47,10 +47,9 @@ #include #include #include -#include #include -#include +#include typedef struct user_access_context_t { int uio_num; /**< device number assigned by UIO: /dev/uioX */ diff --git a/include/Makefile.am b/include/Makefile.am index 376916723..4e2d748b0 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,7 +1,6 @@ include_HEADERS = \ odp.h \ - odp_api.h \ - odp_drv.h + odp_api.h odpapispecincludedir= $(includedir)/odp/api/spec odpapispecinclude_HEADERS = \ @@ -54,20 +53,6 @@ nodist_odpapispecinclude_HEADERS = \ odp/api/spec/deprecated.h \ odp/api/spec/version.h -odpdrvspecincludedir= $(includedir)/odp/drv/spec -odpdrvspecinclude_HEADERS = \ - odp/drv/spec/align.h \ - odp/drv/spec/atomic.h \ - odp/drv/spec/barrier.h \ - odp/drv/spec/byteorder.h \ - odp/drv/spec/compiler.h \ - odp/drv/spec/driver.h \ - odp/drv/spec/hints.h \ - odp/drv/spec/shm.h \ - odp/drv/spec/spinlock.h \ - odp/drv/spec/std_types.h \ - odp/drv/spec/sync.h - odpapiabidefaultincludedir= $(includedir)/odp/arch/default/api/abi odpapiabidefaultinclude_HEADERS = \ odp/arch/default/api/abi/buffer.h \ diff --git a/include/odp/drv/spec/align.h b/include/odp/drv/spec/align.h deleted file mode 100644 index 2b2f32c53..000000000 --- a/include/odp/drv/spec/align.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV alignments - */ - -#ifndef ODPDRV_API_ALIGN_H_ -#define ODPDRV_API_ALIGN_H_ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odpdrv_compiler_optim - * Macros that allow cache line size configuration, check that - * alignment is a power of two etc. - * @{ - */ - -/* Checkpatch complains, but cannot use __aligned(size) for this purpose. */ - -/** - * @def ODPDRV_ALIGNED - * Defines type/struct/variable alignment in bytes - */ - -/** - * @def ODPDRV_PACKED - * Defines type/struct to be packed - */ - -/** - * @def ODPDRV_OFFSETOF - * Returns offset of member in type - */ - -/** - * @def ODPDRV_FIELD_SIZEOF - * Returns sizeof member - */ - -/** - * @def ODPDRV_CACHE_LINE_SIZE - * Cache line size - */ - -/** - * @def ODPDRV_PAGE_SIZE - * Page size - */ - -/** - * @def ODPDRV_ALIGNED_CACHE - * Defines type/struct/variable to be cache line size aligned - */ - -/** - * @def ODPDRV_ALIGNED_PAGE - * Defines type/struct/variable to be page size aligned - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#include -#endif diff --git a/include/odp/drv/spec/atomic.h b/include/odp/drv/spec/atomic.h deleted file mode 100644 index 3cb6e9bbf..000000000 --- a/include/odp/drv/spec/atomic.h +++ /dev/null @@ -1,634 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV atomic operations - */ - -#ifndef ODPDRV_API_ATOMIC_H_ -#define ODPDRV_API_ATOMIC_H_ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup odpdrv_atomic ODPDRV ATOMIC - * @details - * Atomic integers using relaxed memory ordering - * - * Atomic integer types (odpdrv_atomic_u32_t and odpdrv_atomic_u64_t) can be - * used to implement e.g. shared counters. If not otherwise documented, - * operations in this API are implemented using RELAXED memory ordering - * (see memory order descriptions in the C11 specification). Relaxed operations - * do not provide synchronization or ordering for other memory accesses - * (initiated before or after the operation), only atomicity of the operation - * itself is guaranteed. - * - * Operations with non-relaxed memory ordering - * - * An operation with RELEASE memory ordering - * (odpdrv_atomic_xxx_rel_xxx()) ensures that other threads loading the same - * atomic variable with ACQUIRE memory ordering see all stores (from the - * calling thread) that happened before this releasing store. - * - * An operation with ACQUIRE memory ordering - * (odpdrv_atomic_xxx_acq_xxx()) ensures that the calling thread sees all stores - * (done by the releasing thread) that happened before a RELEASE memory ordered - * store to the same atomic variable. - * - * An operation with ACQUIRE-and-RELEASE memory ordering - * (odpdrv_atomic_xxx_acq_rel_xxx()) combines the effects of ACQUIRE and RELEASE - * memory orders. A single operation acts as both an acquiring load and - * a releasing store. - * - * @{ - */ - -/** - * @typedef odpdrv_atomic_u64_t - * Atomic 64-bit unsigned integer - * - * @typedef odpdrv_atomic_u32_t - * Atomic 32-bit unsigned integer - */ - -/* - * 32-bit operations in RELAXED memory ordering - * -------------------------------------------- - */ - -/** - * Initialize atomic uint32 variable - * - * Initializes the atomic variable with 'val'. This operation is not atomic. - * Drivers must ensure that there's no race condition while initializing - * the variable. - * - * @param atom Pointer to atomic variable - * @param val Value to initialize the variable with - */ -void odpdrv_atomic_init_u32(odpdrv_atomic_u32_t *atom, uint32_t val); - -/** - * Load value of atomic uint32 variable - * - * @param atom Pointer to atomic variable - * - * @return Value of the variable - */ -uint32_t odpdrv_atomic_load_u32(odpdrv_atomic_u32_t *atom); - -/** - * Store value to atomic uint32 variable - * - * @param atom Pointer to atomic variable - * @param val Value to store in the variable - */ -void odpdrv_atomic_store_u32(odpdrv_atomic_u32_t *atom, uint32_t val); - -/** - * Fetch and add to atomic uint32 variable - * - * @param atom Pointer to atomic variable - * @param val Value to be added to the variable - * - * @return Value of the variable before the addition - */ -uint32_t odpdrv_atomic_fetch_add_u32(odpdrv_atomic_u32_t *atom, uint32_t val); - -/** - * Add to atomic uint32 variable - * - * @param atom Pointer to atomic variable - * @param val Value to be added to the variable - */ -void odpdrv_atomic_add_u32(odpdrv_atomic_u32_t *atom, uint32_t val); - -/** - * Fetch and subtract from atomic uint32 variable - * - * @param atom Pointer to atomic variable - * @param val Value to be subracted from the variable - * - * @return Value of the variable before the subtraction - */ -uint32_t odpdrv_atomic_fetch_sub_u32(odpdrv_atomic_u32_t *atom, uint32_t val); - -/** - * Subtract from atomic uint32 variable - * - * @param atom Pointer to atomic variable - * @param val Value to be subtracted from the variable - */ -void odpdrv_atomic_sub_u32(odpdrv_atomic_u32_t *atom, uint32_t val); - -/** - * Fetch and increment atomic uint32 variable - * - * @param atom Pointer to atomic variable - * - * @return Value of the variable before the increment - */ -uint32_t odpdrv_atomic_fetch_inc_u32(odpdrv_atomic_u32_t *atom); - -/** - * Increment atomic uint32 variable - * - * @param atom Pointer to atomic variable - */ -void odpdrv_atomic_inc_u32(odpdrv_atomic_u32_t *atom); - -/** - * Fetch and decrement atomic uint32 variable - * - * @param atom Pointer to atomic variable - * - * @return Value of the variable before the subtraction - */ -uint32_t odpdrv_atomic_fetch_dec_u32(odpdrv_atomic_u32_t *atom); - -/** - * Decrement atomic uint32 variable - * - * @param atom Pointer to atomic variable - */ -void odpdrv_atomic_dec_u32(odpdrv_atomic_u32_t *atom); - -/** - * Update maximum value of atomic uint32 variable - * - * Compares value of atomic variable to the new maximum value. If the new value - * is greater than the current value, writes the new value into the variable. - * - * @param atom Pointer to atomic variable - * @param new_max New maximum value to be written into the atomic variable - */ -void odpdrv_atomic_max_u32(odpdrv_atomic_u32_t *atom, uint32_t new_max); - -/** - * Update minimum value of atomic uint32 variable - * - * Compares value of atomic variable to the new minimum value. If the new value - * is less than the current value, writes the new value into the variable. - * - * @param atom Pointer to atomic variable - * @param new_min New minimum value to be written into the atomic variable - */ -void odpdrv_atomic_min_u32(odpdrv_atomic_u32_t *atom, uint32_t new_min); - -/** - * Compare and swap atomic uint32 variable - * - * Compares value of atomic variable to the value pointed by 'old_val'. - * If values are equal, the operation writes 'new_val' into the atomic variable - * and returns success. If they are not equal, the operation writes current - * value of atomic variable into 'old_val' and returns failure. - * - * @param atom Pointer to atomic variable - * @param[in,out] old_val Pointer to the old value of the atomic variable. - * Operation updates this value on failure. - * @param new_val New value to be written into the atomic variable - * - * @return 0 on failure, !0 on success - * - */ -int odpdrv_atomic_cas_u32(odpdrv_atomic_u32_t *atom, uint32_t *old_val, - uint32_t new_val); - -/** - * Exchange value of atomic uint32 variable - * - * Atomically replaces the value of atomic variable with the new value. Returns - * the old value. - * - * @param atom Pointer to atomic variable - * @param new_val New value of the atomic variable - * - * @return Value of the variable before the operation - */ -uint32_t odpdrv_atomic_xchg_u32(odpdrv_atomic_u32_t *atom, uint32_t new_val); - -/* - * 64-bit operations in RELAXED memory ordering - * -------------------------------------------- - */ - -/** - * Initialize atomic uint64 variable - * - * Initializes the atomic variable with 'val'. This operation is not atomic. - * Drivers must ensure that there's no race condition while initializing - * the variable. - * - * @param atom Pointer to atomic variable - * @param val Value to initialize the variable with - */ -void odpdrv_atomic_init_u64(odpdrv_atomic_u64_t *atom, uint64_t val); - -/** - * Load value of atomic uint64 variable - * - * @param atom Pointer to atomic variable - * - * @return Value of the variable - */ -uint64_t odpdrv_atomic_load_u64(odpdrv_atomic_u64_t *atom); - -/** - * Store value to atomic uint64 variable - * - * @param atom Pointer to atomic variable - * @param val Value to store in the variable - */ -void odpdrv_atomic_store_u64(odpdrv_atomic_u64_t *atom, uint64_t val); - -/** - * Fetch and add to atomic uint64 variable - * - * @param atom Pointer to atomic variable - * @param val Value to be added to the variable - * - * @return Value of the variable before the addition - */ -uint64_t odpdrv_atomic_fetch_add_u64(odpdrv_atomic_u64_t *atom, uint64_t val); - -/** - * Add to atomic uint64 variable - * - * @param atom Pointer to atomic variable - * @param val Value to be added to the variable - */ -void odpdrv_atomic_add_u64(odpdrv_atomic_u64_t *atom, uint64_t val); - -/** - * Fetch and subtract from atomic uint64 variable - * - * @param atom Pointer to atomic variable - * @param val Value to be subtracted from the variable - * - * @return Value of the variable before the subtraction - */ -uint64_t odpdrv_atomic_fetch_sub_u64(odpdrv_atomic_u64_t *atom, uint64_t val); - -/** - * Subtract from atomic uint64 variable - * - * @param atom Pointer to atomic variable - * @param val Value to be subtracted from the variable - */ -void odpdrv_atomic_sub_u64(odpdrv_atomic_u64_t *atom, uint64_t val); - -/** - * Fetch and increment atomic uint64 variable - * - * @param atom Pointer to atomic variable - * - * @return Value of the variable before the increment - */ -uint64_t odpdrv_atomic_fetch_inc_u64(odpdrv_atomic_u64_t *atom); - -/** - * Increment atomic uint64 variable - * - * @param atom Pointer to atomic variable - */ -void odpdrv_atomic_inc_u64(odpdrv_atomic_u64_t *atom); - -/** - * Fetch and decrement atomic uint64 variable - * - * @param atom Pointer to atomic variable - * - * @return Value of the variable before the decrement - */ -uint64_t odpdrv_atomic_fetch_dec_u64(odpdrv_atomic_u64_t *atom); - -/** - * Decrement atomic uint64 variable - * - * @param atom Pointer to atomic variable - */ -void odpdrv_atomic_dec_u64(odpdrv_atomic_u64_t *atom); - -/** - * Update maximum value of atomic uint64 variable - * - * Compares value of atomic variable to the new maximum value. If the new value - * is greater than the current value, writes the new value into the variable. - * - * @param atom Pointer to atomic variable - * @param new_max New maximum value to be written into the atomic variable - */ -void odpdrv_atomic_max_u64(odpdrv_atomic_u64_t *atom, uint64_t new_max); - -/** - * Update minimum value of atomic uint64 variable - * - * Compares value of atomic variable to the new minimum value. If the new value - * is less than the current value, writes the new value into the variable. - * - * @param atom Pointer to atomic variable - * @param new_min New minimum value to be written into the atomic variable - */ -void odpdrv_atomic_min_u64(odpdrv_atomic_u64_t *atom, uint64_t new_min); - -/** - * Compare and swap atomic uint64 variable - * - * Compares value of atomic variable to the value pointed by 'old_val'. - * If values are equal, the operation writes 'new_val' into the atomic variable - * and returns success. If they are not equal, the operation writes current - * value of atomic variable into 'old_val' and returns failure. - * - * @param atom Pointer to atomic variable - * @param[in,out] old_val Pointer to the old value of the atomic variable. - * Operation updates this value on failure. - * @param new_val New value to be written into the atomic variable - * - * @return 0 on failure, !0 on success - */ -int odpdrv_atomic_cas_u64(odpdrv_atomic_u64_t *atom, uint64_t *old_val, - uint64_t new_val); - -/** - * Exchange value of atomic uint64 variable - * - * Atomically replaces the value of atomic variable with the new value. Returns - * the old value. - * - * @param atom Pointer to atomic variable - * @param new_val New value of the atomic variable - * - * @return Value of the variable before the operation - */ -uint64_t odpdrv_atomic_xchg_u64(odpdrv_atomic_u64_t *atom, uint64_t new_val); - -/* - * 32-bit operations in non-RELAXED memory ordering - * ------------------------------------------------ - */ - -/** - * Load value of atomic uint32 variable using ACQUIRE memory ordering - * - * Otherwise identical to odpdrv_atomic_load_u32() but ensures ACQUIRE memory - * ordering. - * - * @param atom Pointer to atomic variable - * - * @return Value of the variable - */ -uint32_t odpdrv_atomic_load_acq_u32(odpdrv_atomic_u32_t *atom); - -/** - * Store value to atomic uint32 variable using RELEASE memory ordering - * - * Otherwise identical to odpdrv_atomic_store_u32() but ensures RELEASE memory - * ordering. - * - * @param atom Pointer to atomic variable - * @param val Value to store in the variable - */ -void odpdrv_atomic_store_rel_u32(odpdrv_atomic_u32_t *atom, uint32_t val); - -/** - * Add to atomic uint32 variable using RELEASE memory ordering - * - * Otherwise identical to odpdrv_atomic_add_u32() but ensures RELEASE memory - * ordering. - * - * @param atom Pointer to atomic variable - * @param val Value to be added to the variable - */ -void odpdrv_atomic_add_rel_u32(odpdrv_atomic_u32_t *atom, uint32_t val); - -/** - * Subtract from atomic uint32 variable using RELEASE memory ordering - * - * Otherwise identical to odpdrv_atomic_sub_u32() but ensures RELEASE memory - * ordering. - * - * @param atom Pointer to atomic variable - * @param val Value to be subtracted from the variable - */ -void odpdrv_atomic_sub_rel_u32(odpdrv_atomic_u32_t *atom, uint32_t val); - -/** - * Compare and swap atomic uint32 variable using ACQUIRE memory ordering - * - * Otherwise identical to odpdrv_atomic_cas_u32() but ensures ACQUIRE memory - * ordering on success. Memory ordering is RELAXED on failure. - * - * @param atom Pointer to atomic variable - * @param[in,out] old_val Pointer to the old value of the atomic variable. - * Operation updates this value on failure. - * @param new_val New value to be written into the atomic variable - * - * @return 0 on failure, !0 on success - */ -int odpdrv_atomic_cas_acq_u32(odpdrv_atomic_u32_t *atom, uint32_t *old_val, - uint32_t new_val); - -/** - * Compare and swap atomic uint32 variable using RELEASE memory ordering - * - * Otherwise identical to odpdrv_atomic_cas_u32() but ensures RELEASE memory - * ordering on success. Memory ordering is RELAXED on failure. - * - * @param atom Pointer to atomic variable - * @param[in,out] old_val Pointer to the old value of the atomic variable. - * Operation updates this value on failure. - * @param new_val New value to be written into the atomic variable - * - * @return 0 on failure, !0 on success - */ -int odpdrv_atomic_cas_rel_u32(odpdrv_atomic_u32_t *atom, uint32_t *old_val, - uint32_t new_val); - -/** - * Compare and swap atomic uint32 variable using ACQUIRE-and-RELEASE memory - * ordering - * - * Otherwise identical to odpdrv_atomic_cas_u32() but ensures - * ACQUIRE-and-RELEASE memory ordering on success. - * Memory ordering is RELAXED on failure. - * - * @param atom Pointer to atomic variable - * @param[in,out] old_val Pointer to the old value of the atomic variable. - * Operation updates this value on failure. - * @param new_val New value to be written into the atomic variable - * - * @return 0 on failure, !0 on success - */ -int odpdrv_atomic_cas_acq_rel_u32(odpdrv_atomic_u32_t *atom, uint32_t *old_val, - uint32_t new_val); - -/* - * 64-bit operations in non-RELAXED memory ordering - * ------------------------------------------------ - */ - -/** - * Load value of atomic uint64 variable using ACQUIRE memory ordering - * - * Otherwise identical to odpdrv_atomic_load_u64() but ensures ACQUIRE memory - * ordering. - * - * @param atom Pointer to atomic variable - * - * @return Value of the variable - */ -uint64_t odpdrv_atomic_load_acq_u64(odpdrv_atomic_u64_t *atom); - -/** - * Store value to atomic uint64 variable using RELEASE memory ordering - * - * Otherwise identical to odpdrv_atomic_store_u64() but ensures RELEASE memory - * ordering. - * - * @param atom Pointer to atomic variable - * @param val Value to store in the variable - */ -void odpdrv_atomic_store_rel_u64(odpdrv_atomic_u64_t *atom, uint64_t val); - -/** - * Add to atomic uint64 variable using RELEASE memory ordering - * - * Otherwise identical to odpdrv_atomic_add_u64() but ensures RELEASE memory - * ordering. - * - * @param atom Pointer to atomic variable - * @param val Value to be added to the variable - */ -void odpdrv_atomic_add_rel_u64(odpdrv_atomic_u64_t *atom, uint64_t val); - -/** - * Subtract from atomic uint64 variable using RELEASE memory ordering - * - * Otherwise identical to odpdrv_atomic_sub_u64() but ensures RELEASE memory - * ordering. - * - * @param atom Pointer to atomic variable - * @param val Value to be subtracted from the variable - */ -void odpdrv_atomic_sub_rel_u64(odpdrv_atomic_u64_t *atom, uint64_t val); - -/** - * Compare and swap atomic uint64 variable using ACQUIRE memory ordering - * - * Otherwise identical to odpdrv_atomic_cas_u64() but ensures ACQUIRE memory - * ordering on success. Memory ordering is RELAXED on failure. - * - * @param atom Pointer to atomic variable - * @param[in,out] old_val Pointer to the old value of the atomic variable. - * Operation updates this value on failure. - * @param new_val New value to be written into the atomic variable - * - * @return 0 on failure, !0 on success - */ -int odpdrv_atomic_cas_acq_u64(odpdrv_atomic_u64_t *atom, uint64_t *old_val, - uint64_t new_val); - -/** - * Compare and swap atomic uint64 variable using RELEASE memory ordering - * - * Otherwise identical to odpdrv_atomic_cas_u64() but ensures RELEASE memory - * ordering on success. Memory ordering is RELAXED on failure. - * - * @param atom Pointer to atomic variable - * @param[in,out] old_val Pointer to the old value of the atomic variable. - * Operation updates this value on failure. - * @param new_val New value to be written into the atomic variable - * - * @return 0 on failure, !0 on success - */ -int odpdrv_atomic_cas_rel_u64(odpdrv_atomic_u64_t *atom, uint64_t *old_val, - uint64_t new_val); - -/** - * Compare and swap atomic uint64 variable using ACQUIRE-and-RELEASE memory - * ordering - * - * Otherwise identical to odpdrv_atomic_cas_u64() but ensures - * ACQUIRE-and-RELEASE memory ordering on success. Memory ordering is RELAXED - * on failure. - * - * @param atom Pointer to atomic variable - * @param[in,out] old_val Pointer to the old value of the atomic variable. - * Operation updates this value on failure. - * @param new_val New value to be written into the atomic variable - * - * @return 0 on failure, !0 on success - */ -int odpdrv_atomic_cas_acq_rel_u64(odpdrv_atomic_u64_t *atom, uint64_t *old_val, - uint64_t new_val); - -/** - * Atomic operations - * - * Atomic operations listed in a bit field structure. - */ -typedef union odpdrv_atomic_op_t { - /** Operation flags */ - struct { - uint32_t init : 1; /**< Init atomic variable */ - uint32_t load : 1; /**< Atomic load */ - uint32_t store : 1; /**< Atomic store */ - uint32_t fetch_add : 1; /**< Atomic fetch and add */ - uint32_t add : 1; /**< Atomic add */ - uint32_t fetch_sub : 1; /**< Atomic fetch and subtract */ - uint32_t sub : 1; /**< Atomic subtract */ - uint32_t fetch_inc : 1; /**< Atomic fetch and increment */ - uint32_t inc : 1; /**< Atomic increment */ - uint32_t fetch_dec : 1; /**< Atomic fetch and decrement */ - uint32_t dec : 1; /**< Atomic decrement */ - uint32_t min : 1; /**< Atomic minimum */ - uint32_t max : 1; /**< Atomic maximum */ - uint32_t cas : 1; /**< Atomic compare and swap */ - uint32_t xchg : 1; /**< Atomic exchange */ - } op; - - /** All bits of the bit field structure. - * Operation flag mapping is architecture specific. This field can be - * used to set/clear all flags, or bitwise operations over the entire - * structure. */ - uint32_t all_bits; -} odpdrv_atomic_op_t; - -/** - * Query which atomic uint64 operations are lock-free - * - * Lock-free implementations have higher performance and scale better than - * implementations using locks. User can decide to use e.g. uint32 atomic - * variables instead of uint64 to optimize performance on platforms that - * implement a performance critical operation using locks. - * - * Init operations (e.g. odpdrv_atomic_init_64()) are not atomic. This function - * clears the op.init bit but will never set it to one. - * - * @param atomic_op Pointer to atomic operation structure for storing - * operation flags. All bits are initialized to zero during - * the operation. The parameter is ignored when NULL. - * @retval 0 None of the operations are lock-free - * @retval 1 Some of the operations are lock-free - * @retval 2 All operations are lock-free - */ -int odpdrv_atomic_lock_free_u64(odpdrv_atomic_op_t *atomic_op); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#include -#endif diff --git a/include/odp/drv/spec/barrier.h b/include/odp/drv/spec/barrier.h deleted file mode 100644 index 5ac65a30f..000000000 --- a/include/odp/drv/spec/barrier.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV execution barriers - */ - -#ifndef ODPDRV_API_BARRIER_H_ -#define ODPDRV_API_BARRIER_H_ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup odpdrv_barrier ODPDRV BARRIER - * Thread execution and memory ordering barriers. - * - * @details - * Thread execution barrier (odpdrv_barrier_t) - * - * Thread execution barrier synchronizes a group of threads to wait on the - * barrier until the entire group has reached the barrier. - * @{ - */ - -/** - * @typedef odpdrv_barrier_t - * ODPDRV thread synchronization barrier - */ - -/** - * Initialize barrier with thread count. - * - * @param barr Pointer to a barrier variable - * @param count Thread count - */ -void odpdrv_barrier_init(odpdrv_barrier_t *barr, int count); - -/** - * Synchronize thread execution on barrier. - * Wait for all threads to arrive at the barrier until they are let loose again. - * Threads will block (spin) until the last thread has arrived at the barrier. - * All memory operations before the odpdrv_barrier_wait() call will be visible - * to all threads when they leave the barrier. - * - * @param barr Pointer to a barrier variable - */ -void odpdrv_barrier_wait(odpdrv_barrier_t *barr); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#include -#endif diff --git a/include/odp/drv/spec/byteorder.h b/include/odp/drv/spec/byteorder.h deleted file mode 100644 index bf363f59e..000000000 --- a/include/odp/drv/spec/byteorder.h +++ /dev/null @@ -1,181 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV byteorder - */ - -#ifndef ODPDRV_BYTEORDER_H_ -#define ODPDRV_BYTEORDER_H_ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odpdrv_compiler_optim ODPDRV COMPILER / OPTIMIZATION - * Macros that check byte order and operations for byte order conversion. - * @{ - */ - -/** - * @def ODPDRV_BIG_ENDIAN - * Big endian byte order - * - * @def ODPDRV_LITTLE_ENDIAN - * Little endian byte order - * - * @def ODPDRV_BIG_ENDIAN_BITFIELD - * Big endian bit field - * - * @def ODPDRV_LITTLE_ENDIAN_BITFIELD - * Little endian bit field - * - * @def ODPDRV_BYTE_ORDER - * Selected byte order - * - * @def ODPDRV_BITFIELD_ORDER - * Selected bitfield order - */ - -/** - * @typedef odpdrv_u16le_t - * unsigned 16bit little endian - * - * @typedef odpdrv_u16be_t - * unsigned 16bit big endian - * - * @typedef odpdrv_u32le_t - * unsigned 32bit little endian - * - * @typedef odpdrv_u32be_t - * unsigned 32bit big endian - * - * @typedef odpdrv_u64le_t - * unsigned 64bit little endian - * - * @typedef odpdrv_u64be_t - * unsigned 64bit big endian - * - * @typedef odpdrv_u16sum_t - * unsigned 16bit bitwise - * - * @typedef odpdrv_u32sum_t - * unsigned 32bit bitwise - */ - -/* - * Big Endian -> CPU byte order: - */ - -/** - * Convert 16bit big endian to cpu native uint16_t - * @param be16 big endian 16bit - * @return cpu native uint16_t - */ -uint16_t odpdrv_be_to_cpu_16(odpdrv_u16be_t be16); - -/** - * Convert 32bit big endian to cpu native uint32_t - * @param be32 big endian 32bit - * @return cpu native uint32_t - */ -uint32_t odpdrv_be_to_cpu_32(odpdrv_u32be_t be32); - -/** - * Convert 64bit big endian to cpu native uint64_t - * @param be64 big endian 64bit - * @return cpu native uint64_t - */ -uint64_t odpdrv_be_to_cpu_64(odpdrv_u64be_t be64); - -/* - * CPU byte order -> Big Endian: - */ - -/** - * Convert cpu native uint16_t to 16bit big endian - * @param cpu16 uint16_t in cpu native format - * @return big endian 16bit - */ -odpdrv_u16be_t odpdrv_cpu_to_be_16(uint16_t cpu16); - -/** - * Convert cpu native uint32_t to 32bit big endian - * @param cpu32 uint32_t in cpu native format - * @return big endian 32bit - */ -odpdrv_u32be_t odpdrv_cpu_to_be_32(uint32_t cpu32); - -/** - * Convert cpu native uint64_t to 64bit big endian - * @param cpu64 uint64_t in cpu native format - * @return big endian 64bit - */ -odpdrv_u64be_t odpdrv_cpu_to_be_64(uint64_t cpu64); - -/* - * Little Endian -> CPU byte order: - */ - -/** - * Convert 16bit little endian to cpu native uint16_t - * @param le16 little endian 16bit - * @return cpu native uint16_t - */ -uint16_t odpdrv_le_to_cpu_16(odpdrv_u16le_t le16); - -/** - * Convert 32bit little endian to cpu native uint32_t - * @param le32 little endian 32bit - * @return cpu native uint32_t - */ -uint32_t odpdrv_le_to_cpu_32(odpdrv_u32le_t le32); - -/** - * Convert 64bit little endian to cpu native uint64_t - * @param le64 little endian 64bit - * @return cpu native uint64_t - */ -uint64_t odpdrv_le_to_cpu_64(odpdrv_u64le_t le64); - -/* - * CPU byte order -> Little Endian: - */ - -/** - * Convert cpu native uint16_t to 16bit little endian - * @param cpu16 uint16_t in cpu native format - * @return little endian 16bit - */ -odpdrv_u16le_t odpdrv_cpu_to_le_16(uint16_t cpu16); - -/** - * Convert cpu native uint32_t to 32bit little endian - * @param cpu32 uint32_t in cpu native format - * @return little endian 32bit - */ -odpdrv_u32le_t odpdrv_cpu_to_le_32(uint32_t cpu32); - -/** - * Convert cpu native uint64_t to 64bit little endian - * @param cpu64 uint64_t in cpu native format - * @return little endian 64bit - */ -odpdrv_u64le_t odpdrv_cpu_to_le_64(uint64_t cpu64); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#include -#endif diff --git a/include/odp/drv/spec/compiler.h b/include/odp/drv/spec/compiler.h deleted file mode 100644 index 3198d21e8..000000000 --- a/include/odp/drv/spec/compiler.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * Compiler related for ODP driver interface - */ - -#ifndef ODPDRV_COMPILER_H_ -#define ODPDRV_COMPILER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odpdrv_compiler_optim ODPDRV COMPILER / OPTIMIZATION - * Macro for old compilers - * @{ - */ - -/** @internal GNU compiler version */ -#define GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) - -/** - * @internal - * Compiler __builtin_bswap16() is not available on all platforms - * until GCC 4.8.0 - work around this by offering __odpdrv_builtin_bswap16() - * Don't use this function directly, instead see odpdrv byteorder.h - */ -#if GCC_VERSION < 40800 -#define __odpdrv_builtin_bswap16(u16) \ - ((((u16)&0x00ff) << 8) | (((u16)&0xff00) >> 8)) -#else -#define __odpdrv_builtin_bswap16(u16) __builtin_bswap16(u16) -#endif - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp/drv/spec/hints.h b/include/odp/drv/spec/hints.h deleted file mode 100644 index f29dcd886..000000000 --- a/include/odp/drv/spec/hints.h +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright (c) 2017, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV compiler hints - */ - -#ifndef ODPDRV_API_HINTS_H_ -#define ODPDRV_API_HINTS_H_ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odpdrv_compiler_optim - * Macros that will give hints to the compiler. - * @{ - */ - -#ifdef __GNUC__ - -/** Define a function that should be run at early init (constructor) - */ -#define ODPDRV_CONSTRUCTOR __attribute__((__constructor__)) - -/** Define a function that does not return - */ -#define ODPDRV_NORETURN __attribute__((__noreturn__)) - -/** Define a weak symbol - * This is primarily useful in defining library functions that can be - * overridden in user code. - */ -#define ODPDRV_WEAK_SYMBOL __attribute__((__weak__)) - -/** - * Hot code section - */ -#define ODPDRV_HOT_CODE __attribute__((__hot__)) - -/** - * Cold code section - */ -#define ODPDRV_COLD_CODE __attribute__((__cold__)) - -/** - * Printf format attribute - */ -#define ODPDRV_PRINTF_FORMAT(x, y) __attribute__((format(printf, (x), (y)))) - -/** - * Indicate deprecated variables, functions or types - */ -#define ODPDRV_DEPRECATED __attribute__((__deprecated__)) - -/** - * Intentionally unused variables of functions - */ -#define ODPDRV_UNUSED __attribute__((__unused__)) - -/** - * Branch likely taken - */ -#define odpdrv_likely(x) __builtin_expect((x), 1) - -/** - * Branch unlikely taken - */ -#define odpdrv_unlikely(x) __builtin_expect((x), 0) - -/* - * __builtin_prefetch (const void *addr, rw, locality) - * - * rw 0..1 (0: read, 1: write) - * locality 0..3 (0: don't leave to cache, 3: leave on all cache levels) - */ - -/** - * Cache prefetch address - */ -#define odpdrv_prefetch(x) __builtin_prefetch((x), 0, 3) - -/** - * Cache prefetch address for storing - */ -#define odpdrv_prefetch_store(x) __builtin_prefetch((x), 1, 3) - -#else - -#define ODPDRV_CONSTRUCTOR -#define ODPDRV_NORETURN -#define ODPDRV_WEAK_SYMBOL -#define ODPDRV_HOT_CODE -#define ODPDRV_COLD_CODE -#define ODPDRV_DEPRECATED -#define ODPDRV_UNUSED -#define odpdrv_likely(x) (x) -#define odpdrv_unlikely(x) (x) -#define odpdrv_prefetch(x) -#define odpdrv_prefetch_store(x) - -#endif - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#include -#endif diff --git a/include/odp/drv/spec/shm.h b/include/odp/drv/spec/shm.h deleted file mode 100644 index ee8181f27..000000000 --- a/include/odp/drv/spec/shm.h +++ /dev/null @@ -1,330 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPRDV shared memory (shm) - */ - -#ifndef ODPDRV_SHM_H_ -#define ODPDRV_SHM_H_ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odpdrv_shm ODPDRV SHARED MEMORY - * Operations on driver shared memory. - * @{ - */ - -/** - * @typedef odpdrv_shm_t - * odpdrv shared memory block - */ - -/** - * @def ODPDRV_SHM_INVALID - * Invalid odpdrv shared memory block - */ - -/** Maximum shared memory block name length in chars */ -#define ODPDRV_SHM_NAME_LEN 32 - -/* - * Shared memory flags - */ -#define ODPDRV_SHM_SINGLE_VA 0x01 /**< Memory shall be mapped at same VA */ -#define ODPDRV_SHM_LOCK 0x02 /**< Memory shall be locked (no swap) */ - -/** - * Shared memory block info - */ -typedef struct odpdrv_shm_info_t { - const char *name; /**< Block name */ - void *addr; /**< Block address */ - uint64_t size; /**< Block size in bytes */ - uint64_t page_size; /**< Memory page size */ - uint32_t flags; /**< ODPDRV_SHM_* flags */ -} odpdrv_shm_info_t; - -/** - * Shared memory capabilities - */ -typedef struct odpdrv_shm_capability_t { - /** Maximum number of shared memory blocks - * - * This number of separate shared memory blocks can be - * reserved concurrently. */ - unsigned max_blocks; - - /** Maximum memory block size in bytes - * - * The value of zero means that size is limited only by the available - * memory size. */ - uint64_t max_size; - - /** Maximum memory block alignment in bytes - * - * The value of zero means that alignment is limited only by the - * available memory size. */ - uint64_t max_align; - -} odpdrv_shm_capability_t; - -/** - * Query shared memory capabilities - * - * Outputs shared memory capabilities on success. - * - * @param[out] capa Pointer to capability structure for output - * - * @retval 0 on success - * @retval <0 on failure - */ -int odpdrv_shm_capability(odpdrv_shm_capability_t *capa); - -/** - * Reserve a contiguous block of shared memory - * - * @param[in] name Name of the block (maximum ODPDRV_SHM_NAME_LEN - 1 chars) - * @param[in] size Block size in bytes - * @param[in] align Block alignment in bytes - * @param[in] flags Shared memory parameter flags (ODPDRV_SHM_*). - * Default value is 0. - * - * @return Handle of the reserved block - * @retval ODPDRV_SHM_INVALID on failure - */ -odpdrv_shm_t odpdrv_shm_reserve(const char *name, uint64_t size, uint64_t align, - uint32_t flags); - -/** - * Free a contiguous block of shared memory - * - * Frees a previously reserved block of shared memory (found by its handle). - * @note Freeing memory that is in use will result in UNDEFINED behavior - * - * @param[in] shm odpdrv_shm Block handle - * - * @retval 0 on success - * @retval <0 on failure - */ -int odpdrv_shm_free_by_handle(odpdrv_shm_t shm); - -/** - * Free a contiguous block of shared memory (found from its name) - * - * Frees a previously reserved block of shared memory. - * @note Freeing memory that is in use will result in UNDEFINED behavior - * - * @param[in] name odpdrv_shm Block name - * - * @retval 0 on success - * @retval <0 on failure - */ -int odpdrv_shm_free_by_name(const char *name); - -/** - * Free a contiguous block of shared memory (found from its address) - * - * Frees a previously reserved block of shared memory. - * @note Freeing memory that is in use will result in UNDEFINED behavior - * - * @param[in] address odpdrv_shm Block address - * - * @retval 0 on success - * @retval <0 on failure - */ -int odpdrv_shm_free_by_address(void *address); - -/** - * Lookup and map a block of shared memory (identified by its handle) - * - * @param[in] shm odpdrv_shm Block handle - * - * @return The address of the newly mapped block. - * @retval NULL on failure - */ -void *odpdrv_shm_lookup_by_handle(odpdrv_shm_t shm); - -/** - * Lookup and map a block of shared memory (identified by its name) - * - * @param[in] name odpdrv_shm Block name - * - * @return The handle of the newly mapped block. - * @retval ODPDRV_SHM_INVALID on failure - */ -odpdrv_shm_t odpdrv_shm_lookup_by_name(const char *name); - -/** - * Lookup and map a block of shared memory (identified by its address) - * - * @note This only works when the flag ODPDRV_SHM_SINGLE_VA was set, - * as otherwise addresses are odp-thread local and hence meaningless to - * identify the block between odp-threads. - * - * @param[in] address odpdrv_shm Block address - * - * @return The handle of the newly mapped block. - * @retval ODPDRV_SHM_INVALID on failure - */ -odpdrv_shm_t odpdrv_shm_lookup_by_address(void *address); - -/** - * Get a Shared memory block address - * - * @param[in] shm odpdrv_shm Block handle - * - * @return Memory block address - * @retval NULL on failure - */ -void *odpdrv_shm_addr(odpdrv_shm_t shm); - -/** - * Shared memory block info - * - * @param[in] shm Odpdrv_shm block handle - * @param[out] info Block info pointer for output - * - * @retval 0 on success - * @retval <0 on failure - */ -int odpdrv_shm_info(odpdrv_shm_t shm, odpdrv_shm_info_t *info); - -/** - * Print all shared memory blocks and returns the number of allocated blocks. - * This function is meant for debug. - * @param title A string to be printed before the shared memory status - * @return The total number of allocated blocks - */ -int odpdrv_shm_print_all(const char *title); - -/** - * Get printable value for an odpdrv_shm_t - * - * @param hdl odpdrv_shm_t handle to be printed - * @return uint64_t value that can be used to print/display this - * handle - * - * @note This routine is intended to be used for diagnostic purposes - * to enable applications to generate a printable value that represents - * an odpdrv_shm_t handle. - */ -uint64_t odpdrv_shm_to_u64(odpdrv_shm_t hdl); - -/** - * drv shm pool parameters - * Used to communicate pool creation options. - */ -typedef struct { - /** Sum of all (simultaneous) allocs (bytes)*/ - uint64_t pool_size; - - /** Minimum alloc size user will request from pool (bytes)*/ - uint64_t min_alloc; - - /** Maximum alloc size user will request from pool (bytes)*/ - uint64_t max_alloc; -} odpdrv_shm_pool_param_t; - -/** - * @typedef odpdrv_shm_pool_t - * odpdrv shared memory pool - */ - -/** - * @def ODPDRV_SHM_POOL_INVALID - * Invalid odpdrv shared memory pool - */ - -/** - * Create a memory pool - * - * This routine is used to create a memory pool. The use of pool name is - * optional. - * Unique names are not required. However, odpdrv_shm_pool_lookup() - * returns only a single matching pool. - * - * @param pool_name Name of the pool or NULL. - * @param param Pool parameters. - * - * @return Handle of the created drv shm memory pool - * @retval ODPDRV_SHM_POOL_INVALID Pool could not be created - */ -odpdrv_shm_pool_t odpdrv_shm_pool_create(const char *pool_name, - odpdrv_shm_pool_param_t *param); - -/** - * Destroy a pool previously created by odpdrv_shm_pool_create() - * - * @param pool Handle of the pool to be destroyed - * - * @retval 0 Success - * @retval <0 Failure - * - * @note This routine destroys a previously created pool, and will destroy any - * internal shared memory objects associated with the pool. Results are - * undefined if an attempt is made to destroy a pool that contains allocated - * or otherwise active allocations. - */ -int odpdrv_shm_pool_destroy(odpdrv_shm_pool_t pool); - -/** - * Find a memory pool by name - * - * @param name Name of the pool - * - * @return Handle of the first matching pool - * @retval ODPDRV_SHM_POOL_INVALID Pool could not be found - */ -odpdrv_shm_pool_t odpdrv_shm_pool_lookup(const char *name); - -/** - * Allocate memory from a memory pool - * - * @param pool Memory pool handle - * @param size Number of bytes to allocate (bytes) - * - * @return A pointer to the allocated memory - * @retval NULL on error. - */ -void *odpdrv_shm_pool_alloc(odpdrv_shm_pool_t pool, uint64_t size); - -/** - * Free memory back to a memory pool - * - * @param pool Memory pool handle - * @param addr pointer to a previously allocated memory - * (as returned by a previous call to odpdrv_shm_pool_alloc) - */ -void odpdrv_shm_pool_free(odpdrv_shm_pool_t pool, void *addr); - -/** - * Print memory pool info - * - * @param title A string to be printed as a title (e.g. location) - * @param pool Memory pool handle - * - * @return 0 on success, negative value if pool inconsistency is detected. - * - * @note This routine writes implementation-defined information about the - * specified pool to the ODP log. The intended use is for debugging. - */ -int odpdrv_shm_pool_print(const char *title, odpdrv_shm_pool_t pool); -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#include -#endif diff --git a/include/odp/drv/spec/spinlock.h b/include/odp/drv/spec/spinlock.h deleted file mode 100644 index 52efb565e..000000000 --- a/include/odp/drv/spec/spinlock.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV spinlock - */ - -#ifndef ODPDRV_API_SPINLOCK_H_ -#define ODPDRV_API_SPINLOCK_H_ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup odpdrv_locks - * @details - * Spin lock (odpdrv_spinlock_t) - * - * Spinlock simply re-tries to acquire the lock as long as takes to succeed. - * Spinlock is not fair since some threads may succeed more often than others. - * @{ - */ - -/** - * @typedef odpdrv_spinlock_t - * ODPDRV spinlock - */ - -/** - * Initialize spin lock. - * - * @param splock Pointer to a spin lock - */ -void odpdrv_spinlock_init(odpdrv_spinlock_t *splock); - -/** - * Acquire spin lock. - * - * @param splock Pointer to a spin lock - */ -void odpdrv_spinlock_lock(odpdrv_spinlock_t *splock); - -/** - * Try to acquire spin lock. - * - * @param splock Pointer to a spin lock - * - * @retval 0 lock not acquired - * @retval !0 lock acquired - */ -int odpdrv_spinlock_trylock(odpdrv_spinlock_t *splock); - -/** - * Release spin lock. - * - * @param splock Pointer to a spin lock - */ -void odpdrv_spinlock_unlock(odpdrv_spinlock_t *splock); - -/** - * Check if spin lock is busy (locked). - * - * @param splock Pointer to a spin lock - * - * @retval 1 lock busy (locked) - * @retval 0 lock not busy. - */ -int odpdrv_spinlock_is_locked(odpdrv_spinlock_t *splock); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#include -#endif diff --git a/include/odp/drv/spec/std_types.h b/include/odp/drv/spec/std_types.h deleted file mode 100644 index 904a385b1..000000000 --- a/include/odp/drv/spec/std_types.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * Standard C language types and definitions for ODP driver interface. - * - */ - -#ifndef ODPDRV_STD_TYPES_H_ -#define ODPDRV_STD_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odpdrv_system ODPDRV SYSTEM - * @{ - */ - -/** - * @typedef odpdrv_bool_t - * Use odpdrv boolean type to have it well-defined and known size, - * regardless which compiler is used as this facilities interoperability - * between e.g. different compilers. - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp/drv/spec/sync.h b/include/odp/drv/spec/sync.h deleted file mode 100644 index ea6068552..000000000 --- a/include/odp/drv/spec/sync.h +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV memory barriers - */ - -#ifndef ODPDRV_API_SYNC_H_ -#define ODPDRV_API_SYNC_H_ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup odpdrv_barrier - * @details - * Memory barriers - * - * Memory barriers enforce ordering of memory load and store operations - * specified before and after the barrier. These barriers may affect both - * compiler optimizations and CPU out-of-order execution. All ODPDRV - * synchronization mechanisms (e.g. execution barriers, locks, queues, etc ) - * include all necessary memory barriers, so these calls are not needed when - * using those. Also ODPDRV atomic operations have memory ordered versions. - * These explicit barriers may be needed when thread synchronization is based on - * a non-ODPDRV defined mechanism. Depending on the HW platform, heavy usage of - * memory barriers may cause significant performance degradation. - * - * @{ - */ - -/** - * Memory barrier for release operations - * - * This memory barrier has release semantics. It synchronizes with a pairing - * barrier for acquire operations. The releasing and acquiring threads - * synchronize through shared memory. The releasing thread must call this - * barrier before signaling the acquiring thread. After the acquiring thread - * receives the signal, it must call odpdrv_mb_acquire() before it reads the - * memory written by the releasing thread. - * - * This call is not needed when using ODPDRV defined synchronization mechanisms. - * - * @see odpdrv_mb_acquire() - */ -void odpdrv_mb_release(void); - -/** - * Memory barrier for acquire operations - * - * This memory barrier has acquire semantics. It synchronizes with a pairing - * barrier for release operations. The releasing and acquiring threads - * synchronize through shared memory. The releasing thread must call - * odpdrv_mb_release() before signaling the acquiring thread. After the - * acquiring thread receives the signal, it must call this barrier before it - * read the memory written by the releasing thread. - * - * This call is not needed when using ODPDRV defined synchronization mechanisms. - * - * @see odpdrv_mb_release() - */ -void odpdrv_mb_acquire(void); - -/** - * Full memory barrier - * - * This is a full memory barrier. It guarantees that all load and store - * operations specified before it are visible to other threads before - * all load and store operations specified after it. - * - * This call is not needed when using ODPDRV defined synchronization mechanisms. - */ -void odpdrv_mb_full(void); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#include -#endif diff --git a/include/odp_drv.h b/include/odp_drv.h deleted file mode 100644 index cdba2262c..000000000 --- a/include/odp_drv.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * The OpenDataPlane nic driver programming interface - * - */ - -#ifndef ODP_DRV_H_ -#define ODP_DRV_H_ - -#ifdef __cplusplus -extern C { -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -} -#endif -#endif diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am index f27d2b50c..beffb1cc7 100644 --- a/platform/linux-dpdk/Makefile.am +++ b/platform/linux-dpdk/Makefile.am @@ -23,6 +23,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/platform/linux-generic/include AM_CPPFLAGS += -I$(srcdir)/include AM_CPPFLAGS += -I$(top_srcdir)/include AM_CPPFLAGS += -I$(top_srcdir)/frameworks/modular +AM_CPPFLAGS += -I$(top_srcdir)/frameworks/driver/include AM_CPPFLAGS += -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ AM_CPPFLAGS += -I$(top_builddir)/include AM_CPPFLAGS += -Iinclude @@ -37,8 +38,7 @@ AM_CPPFLAGS += $(LIBCONFIG_CFLAGS) include_HEADERS = \ $(top_srcdir)/include/odp.h \ - $(top_srcdir)/include/odp_api.h \ - $(top_srcdir)/include/odp_drv.h + $(top_srcdir)/include/odp_api.h odpincludedir= $(includedir)/odp odpinclude_HEADERS = \ @@ -148,39 +148,12 @@ odpapiplatinclude_HEADERS = \ $(srcdir)/include/odp/api/plat/traffic_mngr_types.h \ $(srcdir)/include/odp/api/plat/version_types.h -odpdrvincludedir = $(includedir)/odp/drv -odpdrvinclude_HEADERS = \ - $(srcdir)/include/odp/drv/align.h \ - $(srcdir)/include/odp/drv/atomic.h \ - $(srcdir)/include/odp/drv/barrier.h \ - $(srcdir)/include/odp/drv/byteorder.h \ - $(srcdir)/include/odp/drv/compiler.h \ - $(srcdir)/include/odp/drv/driver.h \ - $(srcdir)/include/odp/drv/hints.h \ - $(srcdir)/include/odp/drv/shm.h \ - $(srcdir)/include/odp/drv/spinlock.h \ - $(srcdir)/include/odp/drv/std_types.h \ - $(srcdir)/include/odp/drv/sync.h - -odpdrvplatincludedir = $(includedir)/odp/drv/plat -odpdrvplatinclude_HEADERS = \ - $(srcdir)/include/odp/drv/plat/atomic_types.h \ - $(srcdir)/include/odp/drv/plat/barrier_types.h \ - $(srcdir)/include/odp/drv/plat/byteorder_types.h \ - $(srcdir)/include/odp/drv/compiler.h \ - $(srcdir)/include/odp/drv/plat/driver_types.h \ - $(srcdir)/include/odp/drv/plat/shm_types.h \ - $(srcdir)/include/odp/drv/plat/spinlock_types.h \ - $(srcdir)/include/odp/drv/plat/strong_types.h - - noinst_HEADERS = \ ${top_srcdir}/platform/linux-generic/include/odp_buffer_subsystem.h \ ${top_srcdir}/platform/linux-generic/include/_fdserver_internal.h \ ${top_srcdir}/platform/linux-generic/include/_ishm_internal.h \ ${top_srcdir}/platform/linux-generic/include/_ishmphy_internal.h \ ${top_srcdir}/platform/linux-generic/include/_ishmpool_internal.h \ - ${top_srcdir}/platform/linux-generic/include/drv_driver_internal.h\ ${top_srcdir}/platform/linux-generic/include/odp_align_internal.h \ ${top_srcdir}/platform/linux-generic/include/odp_atomic_internal.h \ ${srcdir}/include/odp_buffer_inlines.h \ @@ -293,12 +266,7 @@ __LIB__libodp_dpdk_la_SOURCES = \ ../linux-generic/odp_timer_wheel.c \ ../linux-generic/odp_traffic_mngr.c \ ../linux-generic/odp_version.c \ - ../linux-generic/odp_weak.c \ - ../linux-generic/drv_atomic.c \ - ../linux-generic/drv_barrier.c \ - ../linux-generic/drv_driver.c \ - ../linux-generic/drv_shm.c \ - ../linux-generic/drv_spinlock.c + ../linux-generic/odp_weak.c if ARCH_IS_ARM __LIB__libodp_dpdk_la_SOURCES += arch/arm/odp_cpu_arch.c \ @@ -360,6 +328,14 @@ noinst_HEADERS += $(modularframeworkdir)/list.h \ __LIB__libodp_dpdk_la_SOURCES += ../../frameworks/modular/odp_module.c +# Build driver framework into odp-linux library +driverframeworkdir = $(top_srcdir)/frameworks/driver +noinst_HEADERS += $(driverframeworkdir)/include/driver.h \ + $(driverframeworkdir)/include/driver_types.h \ + $(driverframeworkdir)/include/driver_internal.h + +__LIB__libodp_dpdk_la_SOURCES += ../../frameworks/driver/driver.c + __LIB__libodp_dpdk_la_LIBADD = $(ATOMIC_LIBS) __LIB__libodp_dpdk_la_LIBADD += $(DPDK_LIBS) __LIB__libodp_dpdk_la_LIBADD += $(OPENSSL_LIBS) diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 2b1e41435..90e0356e4 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -11,6 +11,7 @@ lib_LTLIBRARIES = $(LIB)/libodp-linux.la AM_CPPFLAGS = -I$(srcdir)/include AM_CPPFLAGS += -I$(top_srcdir)/include AM_CPPFLAGS += -I$(top_srcdir)/frameworks/modular +AM_CPPFLAGS += -I$(top_srcdir)/frameworks/driver/include AM_CPPFLAGS += -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ AM_CPPFLAGS += -I$(top_builddir)/include AM_CPPFLAGS += -Iinclude @@ -123,39 +124,12 @@ odpapiplatinclude_HEADERS = \ nodist_odpapiplatinclude_HEADERS = \ include/odp/api/plat/static_inline.h -odpdrvincludedir = $(includedir)/odp/drv -odpdrvinclude_HEADERS = \ - include/odp/drv/align.h \ - include/odp/drv/atomic.h \ - include/odp/drv/barrier.h \ - include/odp/drv/byteorder.h \ - include/odp/drv/compiler.h \ - include/odp/drv/driver.h \ - include/odp/drv/hints.h \ - include/odp/drv/shm.h \ - include/odp/drv/spinlock.h \ - include/odp/drv/std_types.h \ - include/odp/drv/sync.h - -odpdrvplatincludedir = $(includedir)/odp/drv/plat -odpdrvplatinclude_HEADERS = \ - include/odp/drv/plat/atomic_types.h \ - include/odp/drv/plat/barrier_types.h \ - include/odp/drv/plat/byteorder_types.h \ - include/odp/drv/compiler.h \ - include/odp/drv/plat/driver_types.h \ - include/odp/drv/plat/shm_types.h \ - include/odp/drv/plat/spinlock_types.h \ - include/odp/drv/plat/strong_types.h - noinst_HEADERS = \ include/_fdserver_internal.h \ include/_ishm_internal.h \ include/_ishmphy_internal.h \ include/_ishmpool_internal.h \ include/_str_functions_internal.h \ - include/drv_driver_internal.h \ - include/drv_pci_internal.h \ include/odp_align_internal.h \ include/odp_atomic_internal.h \ include/odp_buffer_inlines.h \ @@ -259,8 +233,8 @@ __LIB__libodp_linux_la_SOURCES = \ pktio/socket_mmap.c \ pktio/sysfs.c \ pktio/tap.c \ - pktio/virtio.c \ - pktio/virtio_pci.c \ + pktio/virtio/virtio.c \ + pktio/virtio/virtio_pci.c \ pktio/ring.c \ pool/generic.c \ pool/subsystem.c \ @@ -286,14 +260,7 @@ __LIB__libodp_linux_la_SOURCES = \ odp_timer_wheel.c \ odp_traffic_mngr.c \ odp_version.c \ - odp_weak.c \ - drv_atomic.c \ - drv_barrier.c \ - drv_driver.c \ - drv_pci.c \ - drv_pci_uio.c \ - drv_shm.c \ - drv_spinlock.c + odp_weak.c if ARCH_IS_ARM __LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \ @@ -393,6 +360,17 @@ noinst_HEADERS += $(modularframeworkdir)/list.h \ __LIB__libodp_linux_la_SOURCES += ../../frameworks/modular/odp_module.c +# Build driver framework into odp-linux library +driverframeworkdir = $(top_srcdir)/frameworks/driver +noinst_HEADERS += $(driverframeworkdir)/include/driver.h \ + $(driverframeworkdir)/include/driver_types.h \ + $(driverframeworkdir)/include/driver_internal.h \ + $(driverframeworkdir)/include/pci_internal.h + +__LIB__libodp_linux_la_SOURCES += ../../frameworks/driver/driver.c \ + ../../frameworks/driver/pci.c \ + ../../frameworks/driver/pci_uio.c + __LIB__libodp_linux_la_LIBADD = $(ATOMIC_LIBS) __LIB__libodp_linux_la_LIBADD += $(OPENSSL_LIBS) __LIB__libodp_linux_la_LIBADD += $(DPDK_LIBS) $(DPDK_PMDS) diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c index 238efb81a..405bf5c04 100644 --- a/platform/linux-generic/_ishm.c +++ b/platform/linux-generic/_ishm.c @@ -54,7 +54,6 @@ #include #include #include -#include #include #include #include diff --git a/platform/linux-generic/_ishmpool.c b/platform/linux-generic/_ishmpool.c index f196a6d82..c72209d90 100644 --- a/platform/linux-generic/_ishmpool.c +++ b/platform/linux-generic/_ishmpool.c @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include diff --git a/platform/linux-generic/_modules.c b/platform/linux-generic/_modules.c index 1fdaf6049..c2bc04ffc 100644 --- a/platform/linux-generic/_modules.c +++ b/platform/linux-generic/_modules.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include diff --git a/platform/linux-generic/drv_atomic.c b/platform/linux-generic/drv_atomic.c deleted file mode 100644 index 72c85e84e..000000000 --- a/platform/linux-generic/drv_atomic.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include - -int odpdrv_atomic_lock_free_u64(odpdrv_atomic_op_t *atomic_op) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - /* All operations have locks */ - if (atomic_op) - atomic_op->all_bits = 0; - - return 0; -#else - /* All operations are lock-free */ - if (atomic_op) { - atomic_op->all_bits = ~((uint32_t)0); - atomic_op->op.init = 0; - } - - return 2; -#endif -} diff --git a/platform/linux-generic/drv_barrier.c b/platform/linux-generic/drv_barrier.c deleted file mode 100644 index 7a83981ff..000000000 --- a/platform/linux-generic/drv_barrier.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include -#include -#include - -void odpdrv_barrier_init(odpdrv_barrier_t *barrier, int count) -{ - barrier->count = (uint32_t)count; - odpdrv_atomic_init_u32(&barrier->bar, 0); -} - -/* - * Efficient barrier_sync - - * - * Barriers are initialized with a count of the number of callers - * that must sync on the barrier before any may proceed. - * - * To avoid race conditions and to permit the barrier to be fully - * reusable, the barrier value cycles between 0..2*count-1. When - * synchronizing the wasless variable simply tracks which half of - * the cycle the barrier was in upon entry. Exit is when the - * barrier crosses to the other half of the cycle. - */ -void odpdrv_barrier_wait(odpdrv_barrier_t *barrier) -{ - uint32_t count; - int wasless; - - odpdrv_mb_full(); - - count = odpdrv_atomic_fetch_inc_u32(&barrier->bar); - wasless = count < barrier->count; - - if (count == 2 * barrier->count - 1) { - /* Wrap around *atomically* */ - odpdrv_atomic_sub_u32(&barrier->bar, 2 * barrier->count); - } else { - while ((odpdrv_atomic_load_u32(&barrier->bar) < barrier->count) - == wasless) - odp_cpu_pause(); - } - - odpdrv_mb_full(); -} diff --git a/platform/linux-generic/drv_shm.c b/platform/linux-generic/drv_shm.c deleted file mode 100644 index 325632e18..000000000 --- a/platform/linux-generic/drv_shm.c +++ /dev/null @@ -1,146 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include -#include -#include <_ishm_internal.h> -#include <_ishmpool_internal.h> - -static inline uint32_t from_handle(odpdrv_shm_t shm) -{ - return _odpdrv_typeval(shm) - 1; -} - -static inline odpdrv_shm_t to_handle(uint32_t index) -{ - return _odpdrv_cast_scalar(odpdrv_shm_t, index + 1); -} - -int odpdrv_shm_capability(odpdrv_shm_capability_t *capa) -{ - capa->max_blocks = ODPDRV_CONFIG_SHM_BLOCKS; - capa->max_size = 0; - capa->max_align = 0; - - return 0; -} - -odpdrv_shm_t odpdrv_shm_reserve(const char *name, uint64_t size, uint64_t align, - uint32_t flags) -{ - int block_index; - int flgs = 0; /* internal ishm flags */ - - /* set internal ishm flags according to API flags: */ - flgs |= (flags & ODPDRV_SHM_SINGLE_VA) ? _ODP_ISHM_SINGLE_VA : 0; - flgs |= (flags & ODPDRV_SHM_LOCK) ? _ODP_ISHM_LOCK : 0; - - block_index = _odp_ishm_reserve(name, size, -1, align, flgs, flags); - if (block_index >= 0) - return to_handle(block_index); - else - return ODPDRV_SHM_INVALID; -} - -int odpdrv_shm_free_by_handle(odpdrv_shm_t shm) -{ - return _odp_ishm_free_by_index(from_handle(shm)); -} - -int odpdrv_shm_free_by_name(const char *name) -{ - return _odp_ishm_free_by_name(name); -} - -int odpdrv_shm_free_by_address(void *address) -{ - return _odp_ishm_free_by_address(address); -} - -void *odpdrv_shm_lookup_by_handle(odpdrv_shm_t shm) -{ - return _odp_ishm_lookup_by_index(from_handle(shm)); -} - -odpdrv_shm_t odpdrv_shm_lookup_by_name(const char *name) -{ - return to_handle(_odp_ishm_lookup_by_name(name)); -} - -odpdrv_shm_t odpdrv_shm_lookup_by_address(void *address) -{ - return to_handle(_odp_ishm_lookup_by_address(address)); -} - -void *odpdrv_shm_addr(odpdrv_shm_t shm) -{ - return _odp_ishm_address(from_handle(shm)); -} - -int odpdrv_shm_info(odpdrv_shm_t shm, odpdrv_shm_info_t *info) -{ - _odp_ishm_info_t ishm_info; - - if (_odp_ishm_info(from_handle(shm), &ishm_info)) - return -1; - - info->name = ishm_info.name; - info->addr = ishm_info.addr; - info->size = ishm_info.size; - info->page_size = ishm_info.page_size; - info->flags = ishm_info.user_flags; - - return 0; -} - -int odpdrv_shm_print_all(const char *title) -{ - return _odp_ishm_status(title); -} - -odpdrv_shm_pool_t odpdrv_shm_pool_create(const char *pool_name, - odpdrv_shm_pool_param_t *param) -{ - int flags; - - /* force unique address for all ODP threads */ - flags = _ODP_ISHM_SINGLE_VA; - return (odpdrv_shm_pool_t)_odp_ishm_pool_create(pool_name, - param->pool_size, - param->min_alloc, - param->max_alloc, - flags); -} - -int odpdrv_shm_pool_destroy(odpdrv_shm_pool_t pool) -{ - return _odp_ishm_pool_destroy((_odp_ishm_pool_t *)(void*)pool); -} - -odpdrv_shm_pool_t odpdrv_shm_pool_lookup(const char *name) -{ - return (odpdrv_shm_pool_t)_odp_ishm_pool_lookup(name); -} - -void *odpdrv_shm_pool_alloc(odpdrv_shm_pool_t pool, uint64_t size) -{ - return _odp_ishm_pool_alloc((_odp_ishm_pool_t *)(void*)pool, size); -} - -void odpdrv_shm_pool_free(odpdrv_shm_pool_t pool, void *addr) -{ - (void)_odp_ishm_pool_free((_odp_ishm_pool_t *)(void*)pool, addr); -} - -int odpdrv_shm_pool_print(const char *title, odpdrv_shm_pool_t pool) -{ - return _odp_ishm_pool_status(title, (_odp_ishm_pool_t *)(void*)pool); -} - -/** - * @} - */ diff --git a/platform/linux-generic/drv_spinlock.c b/platform/linux-generic/drv_spinlock.c deleted file mode 100644 index 69e3da769..000000000 --- a/platform/linux-generic/drv_spinlock.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include - -void odpdrv_spinlock_init(odpdrv_spinlock_t *spinlock) -{ - _odp_atomic_flag_init(&spinlock->lock, 0); -} - -void odpdrv_spinlock_lock(odpdrv_spinlock_t *spinlock) -{ - /* While the lock is already taken... */ - while (_odp_atomic_flag_tas(&spinlock->lock)) - /* ...spin reading the flag (relaxed MM), - * the loop will exit when the lock becomes available - * and we will retry the TAS operation above */ - while (_odp_atomic_flag_load(&spinlock->lock)) - odp_cpu_pause(); -} - -int odpdrv_spinlock_trylock(odpdrv_spinlock_t *spinlock) -{ - return (_odp_atomic_flag_tas(&spinlock->lock) == 0); -} - -void odpdrv_spinlock_unlock(odpdrv_spinlock_t *spinlock) -{ - _odp_atomic_flag_clear(&spinlock->lock); -} - -int odpdrv_spinlock_is_locked(odpdrv_spinlock_t *spinlock) -{ - return _odp_atomic_flag_load(&spinlock->lock) != 0; -} diff --git a/platform/linux-generic/include/odp/drv/README b/platform/linux-generic/include/odp/drv/README deleted file mode 100644 index fd38e8e57..000000000 --- a/platform/linux-generic/include/odp/drv/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory contains the files defining the ODP driver interface, -for linux-generic. diff --git a/platform/linux-generic/include/odp/drv/align.h b/platform/linux-generic/include/odp/drv/align.h deleted file mode 100644 index 7636f8938..000000000 --- a/platform/linux-generic/include/odp/drv/align.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV alignments - */ - -#ifndef ODPDRV_PLAT_ALIGN_H_ -#define ODPDRV_PLAT_ALIGN_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @ingroup odpdrv_compiler_optim - * @{ - */ - -#ifdef __GNUC__ - -#define ODPDRV_ALIGNED(x) __attribute__((__aligned__(x))) - -#define ODPDRV_PACKED __attribute__((__packed__)) - -#define ODPDRV_OFFSETOF(type, member) __builtin_offsetof(type, member) - -#define ODPDRV_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member) - -#else -#error Non-gcc compatible compiler -#endif - -#define ODPDRV_CACHE_LINE_SIZE _ODP_CACHE_LINE_SIZE - -#define ODPDRV_PAGE_SIZE 4096 - -#define ODPDRV_ALIGNED_CACHE ODPDRV_ALIGNED(ODPDRV_CACHE_LINE_SIZE) - -#define ODPDRV_ALIGNED_PAGE ODPDRV_ALIGNED(ODPDRV_PAGE_SIZE) - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/atomic.h b/platform/linux-generic/include/odp/drv/atomic.h deleted file mode 100644 index 7d922da21..000000000 --- a/platform/linux-generic/include/odp/drv/atomic.h +++ /dev/null @@ -1,430 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV atomic operations - */ - -#ifndef ODPDRV_PLAT_ATOMIC_H_ -#define ODPDRV_PLAT_ATOMIC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** @ingroup odpdrv_atomic - * @{ - */ - -static inline void odpdrv_atomic_init_u32(odpdrv_atomic_u32_t *atom, - uint32_t val) -{ - __atomic_store_n(&atom->v, val, __ATOMIC_RELAXED); -} - -static inline uint32_t odpdrv_atomic_load_u32(odpdrv_atomic_u32_t *atom) -{ - return __atomic_load_n(&atom->v, __ATOMIC_RELAXED); -} - -static inline void odpdrv_atomic_store_u32(odpdrv_atomic_u32_t *atom, - uint32_t val) -{ - __atomic_store_n(&atom->v, val, __ATOMIC_RELAXED); -} - -static inline uint32_t odpdrv_atomic_fetch_add_u32(odpdrv_atomic_u32_t *atom, - uint32_t val) -{ - return __atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); -} - -static inline void odpdrv_atomic_add_u32(odpdrv_atomic_u32_t *atom, - uint32_t val) -{ - (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); -} - -static inline uint32_t odpdrv_atomic_fetch_sub_u32(odpdrv_atomic_u32_t *atom, - uint32_t val) -{ - return __atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); -} - -static inline void odpdrv_atomic_sub_u32(odpdrv_atomic_u32_t *atom, - uint32_t val) -{ - (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); -} - -static inline uint32_t odpdrv_atomic_fetch_inc_u32(odpdrv_atomic_u32_t *atom) -{ - return __atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); -} - -static inline void odpdrv_atomic_inc_u32(odpdrv_atomic_u32_t *atom) -{ - (void)__atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); -} - -static inline uint32_t odpdrv_atomic_fetch_dec_u32(odpdrv_atomic_u32_t *atom) -{ - return __atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); -} - -static inline void odpdrv_atomic_dec_u32(odpdrv_atomic_u32_t *atom) -{ - (void)__atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); -} - -static inline int odpdrv_atomic_cas_u32(odpdrv_atomic_u32_t *atom, - uint32_t *old_val, uint32_t new_val) -{ - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_RELAXED, - __ATOMIC_RELAXED); -} - -static inline uint32_t odpdrv_atomic_xchg_u32(odpdrv_atomic_u32_t *atom, - uint32_t new_val) -{ - return __atomic_exchange_n(&atom->v, new_val, __ATOMIC_RELAXED); -} - -static inline void odpdrv_atomic_max_u32(odpdrv_atomic_u32_t *atom, - uint32_t new_max) -{ - uint32_t old_val; - - old_val = odpdrv_atomic_load_u32(atom); - - while (new_max > old_val) { - if (odpdrv_atomic_cas_u32(atom, &old_val, new_max)) - break; - } -} - -static inline void odpdrv_atomic_min_u32(odpdrv_atomic_u32_t *atom, - uint32_t new_min) -{ - uint32_t old_val; - - old_val = odpdrv_atomic_load_u32(atom); - - while (new_min < old_val) { - if (odpdrv_atomic_cas_u32(atom, &old_val, new_min)) - break; - } -} - -static inline void odpdrv_atomic_init_u64(odpdrv_atomic_u64_t *atom, - uint64_t val) -{ - atom->v = val; -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - __atomic_clear(&atom->lock, __ATOMIC_RELAXED); -#endif -} - -static inline uint64_t odpdrv_atomic_load_u64(odpdrv_atomic_u64_t *atom) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, (void)0); -#else - return __atomic_load_n(&atom->v, __ATOMIC_RELAXED); -#endif -} - -static inline void odpdrv_atomic_store_u64(odpdrv_atomic_u64_t *atom, - uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v = val); -#else - __atomic_store_n(&atom->v, val, __ATOMIC_RELAXED); -#endif -} - -static inline uint64_t odpdrv_atomic_fetch_add_u64(odpdrv_atomic_u64_t *atom, - uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, atom->v += val); -#else - return __atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); -#endif -} - -static inline void odpdrv_atomic_add_u64(odpdrv_atomic_u64_t *atom, - uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v += val); -#else - (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); -#endif -} - -static inline uint64_t odpdrv_atomic_fetch_sub_u64(odpdrv_atomic_u64_t *atom, - uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, atom->v -= val); -#else - return __atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); -#endif -} - -static inline void odpdrv_atomic_sub_u64(odpdrv_atomic_u64_t *atom, - uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v -= val); -#else - (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); -#endif -} - -static inline uint64_t odpdrv_atomic_fetch_inc_u64(odpdrv_atomic_u64_t *atom) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, atom->v++); -#else - return __atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); -#endif -} - -static inline void odpdrv_atomic_inc_u64(odpdrv_atomic_u64_t *atom) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v++); -#else - (void)__atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); -#endif -} - -static inline uint64_t odpdrv_atomic_fetch_dec_u64(odpdrv_atomic_u64_t *atom) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, atom->v--); -#else - return __atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); -#endif -} - -static inline void odpdrv_atomic_dec_u64(odpdrv_atomic_u64_t *atom) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v--); -#else - (void)__atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); -#endif -} - -static inline int odpdrv_atomic_cas_u64(odpdrv_atomic_u64_t *atom, - uint64_t *old_val, uint64_t new_val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - int ret; - *old_val = ATOMIC_OP(atom, ATOMIC_CAS_OP(&ret, *old_val, new_val)); - return ret; -#else - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_RELAXED, - __ATOMIC_RELAXED); -#endif -} - -static inline uint64_t odpdrv_atomic_xchg_u64(odpdrv_atomic_u64_t *atom, - uint64_t new_val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, atom->v = new_val); -#else - return __atomic_exchange_n(&atom->v, new_val, __ATOMIC_RELAXED); -#endif -} - -static inline void odpdrv_atomic_max_u64(odpdrv_atomic_u64_t *atom, - uint64_t new_max) -{ - uint64_t old_val; - - old_val = odpdrv_atomic_load_u64(atom); - - while (new_max > old_val) { - if (odpdrv_atomic_cas_u64(atom, &old_val, new_max)) - break; - } -} - -static inline void odpdrv_atomic_min_u64(odpdrv_atomic_u64_t *atom, - uint64_t new_min) -{ - uint64_t old_val; - - old_val = odpdrv_atomic_load_u64(atom); - - while (new_min < old_val) { - if (odpdrv_atomic_cas_u64(atom, &old_val, new_min)) - break; - } -} - -static inline uint32_t odpdrv_atomic_load_acq_u32(odpdrv_atomic_u32_t *atom) -{ - return __atomic_load_n(&atom->v, __ATOMIC_ACQUIRE); -} - -static inline void odpdrv_atomic_store_rel_u32(odpdrv_atomic_u32_t *atom, - uint32_t val) -{ - __atomic_store_n(&atom->v, val, __ATOMIC_RELEASE); -} - -static inline void odpdrv_atomic_add_rel_u32(odpdrv_atomic_u32_t *atom, - uint32_t val) -{ - (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELEASE); -} - -static inline void odpdrv_atomic_sub_rel_u32(odpdrv_atomic_u32_t *atom, - uint32_t val) -{ - (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELEASE); -} - -static inline int odpdrv_atomic_cas_acq_u32(odpdrv_atomic_u32_t *atom, - uint32_t *old_val, uint32_t new_val) -{ - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_ACQUIRE, - __ATOMIC_RELAXED); -} - -static inline int odpdrv_atomic_cas_rel_u32(odpdrv_atomic_u32_t *atom, - uint32_t *old_val, uint32_t new_val) -{ - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_RELEASE, - __ATOMIC_RELAXED); -} - -static inline int odpdrv_atomic_cas_acq_rel_u32(odpdrv_atomic_u32_t *atom, - uint32_t *old_val, - uint32_t new_val) -{ - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_ACQ_REL, - __ATOMIC_RELAXED); -} - -static inline uint64_t odpdrv_atomic_load_acq_u64(odpdrv_atomic_u64_t *atom) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, (void)0); -#else - return __atomic_load_n(&atom->v, __ATOMIC_ACQUIRE); -#endif -} - -static inline void odpdrv_atomic_store_rel_u64(odpdrv_atomic_u64_t *atom, - uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v = val); -#else - __atomic_store_n(&atom->v, val, __ATOMIC_RELEASE); -#endif -} - -static inline void odpdrv_atomic_add_rel_u64(odpdrv_atomic_u64_t *atom, - uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v += val); -#else - (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELEASE); -#endif -} - -static inline void odpdrv_atomic_sub_rel_u64(odpdrv_atomic_u64_t *atom, - uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v -= val); -#else - (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELEASE); -#endif -} - -static inline int odpdrv_atomic_cas_acq_u64(odpdrv_atomic_u64_t *atom, - uint64_t *old_val, uint64_t new_val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - int ret; - *old_val = ATOMIC_OP(atom, ATOMIC_CAS_OP(&ret, *old_val, new_val)); - return ret; -#else - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_ACQUIRE, - __ATOMIC_RELAXED); -#endif -} - -static inline int odpdrv_atomic_cas_rel_u64(odpdrv_atomic_u64_t *atom, - uint64_t *old_val, uint64_t new_val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - int ret; - *old_val = ATOMIC_OP(atom, ATOMIC_CAS_OP(&ret, *old_val, new_val)); - return ret; -#else - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_RELEASE, - __ATOMIC_RELAXED); -#endif -} - -static inline int odpdrv_atomic_cas_acq_rel_u64(odpdrv_atomic_u64_t *atom, - uint64_t *old_val, - uint64_t new_val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - int ret; - *old_val = ATOMIC_OP(atom, ATOMIC_CAS_OP(&ret, *old_val, new_val)); - return ret; -#else - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_ACQ_REL, - __ATOMIC_RELAXED); -#endif -} - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/barrier.h b/platform/linux-generic/include/odp/drv/barrier.h deleted file mode 100644 index 877cacf8b..000000000 --- a/platform/linux-generic/include/odp/drv/barrier.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV execution barriers - */ - -#ifndef ODPDRV_PLAT_BARRIER_H_ -#define ODPDRV_PLAT_BARRIER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/byteorder.h b/platform/linux-generic/include/odp/drv/byteorder.h deleted file mode 100644 index 3991b2656..000000000 --- a/platform/linux-generic/include/odp/drv/byteorder.h +++ /dev/null @@ -1,146 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV byteorder - */ - -#ifndef ODPDRV_PLAT_BYTEORDER_H_ -#define ODPDRV_PLAT_BYTEORDER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -/** @ingroup odpdrv_compiler_optim - * @{ - */ - -static inline uint16_t odpdrv_be_to_cpu_16(odpdrv_u16be_t be16) -{ -#if ODPDRV_BYTE_ORDER == ODPDRV_LITTLE_ENDIAN - return __odpdrv_builtin_bswap16((__odpdrv_force uint16_t)be16); -#else - return (__odpdrv_force uint16_t)be16; -#endif -} - -static inline uint32_t odpdrv_be_to_cpu_32(odpdrv_u32be_t be32) -{ -#if ODPDRV_BYTE_ORDER == ODPDRV_LITTLE_ENDIAN - return __builtin_bswap32((__odpdrv_force uint32_t)be32); -#else - return (__odpdrv_force uint32_t)be32; -#endif -} - -static inline uint64_t odpdrv_be_to_cpu_64(odpdrv_u64be_t be64) -{ -#if ODPDRV_BYTE_ORDER == ODPDRV_LITTLE_ENDIAN - return __builtin_bswap64((__odpdrv_force uint64_t)be64); -#else - return (__odpdrv_force uint64_t)be64; -#endif -} - -static inline odpdrv_u16be_t odpdrv_cpu_to_be_16(uint16_t cpu16) -{ -#if ODPDRV_BYTE_ORDER == ODPDRV_LITTLE_ENDIAN - return (__odpdrv_force odpdrv_u16be_t)__odpdrv_builtin_bswap16(cpu16); -#else - return (__odpdrv_force odpdrv_u16be_t)cpu16; -#endif -} - -static inline odpdrv_u32be_t odpdrv_cpu_to_be_32(uint32_t cpu32) -{ -#if ODPDRV_BYTE_ORDER == ODPDRV_LITTLE_ENDIAN - return (__odpdrv_force odpdrv_u32be_t)__builtin_bswap32(cpu32); -#else - return (__odpdrv_force odpdrv_u32be_t)cpu32; -#endif -} - -static inline odpdrv_u64be_t odpdrv_cpu_to_be_64(uint64_t cpu64) -{ -#if ODPDRV_BYTE_ORDER == ODPDRV_LITTLE_ENDIAN - return (__odpdrv_force odpdrv_u64be_t)__builtin_bswap64(cpu64); -#else - return (__odpdrv_force odpdrv_u64be_t)cpu64; -#endif -} - -static inline uint16_t odpdrv_le_to_cpu_16(odpdrv_u16le_t le16) -{ -#if ODPDRV_BYTE_ORDER == ODPDRV_LITTLE_ENDIAN - return (__odpdrv_force uint16_t)le16; -#else - return __odpdrv_builtin_bswap16((__odpdrv_force uint16_t)le16); -#endif -} - -static inline uint32_t odpdrv_le_to_cpu_32(odpdrv_u32le_t le32) -{ -#if ODPDRV_BYTE_ORDER == ODPDRV_LITTLE_ENDIAN - return (__odpdrv_force uint32_t)le32; -#else - return __builtin_bswap32((__odpdrv_force uint32_t)le32); -#endif -} - -static inline uint64_t odpdrv_le_to_cpu_64(odpdrv_u64le_t le64) -{ -#if ODPDRV_BYTE_ORDER == ODPDRV_LITTLE_ENDIAN - return (__odpdrv_force uint64_t)le64; -#else - return __builtin_bswap64((__odpdrv_force uint64_t)le64); -#endif -} - -static inline odpdrv_u16le_t odpdrv_cpu_to_le_16(uint16_t cpu16) -{ -#if ODPDRV_BYTE_ORDER == ODPDRV_LITTLE_ENDIAN - return (__odpdrv_force odpdrv_u16le_t)cpu16; -#else - return (__odpdrv_force odpdrv_u16le_t)__odpdrv_builtin_bswap16(cpu16); -#endif -} - -static inline odpdrv_u32le_t odpdrv_cpu_to_le_32(uint32_t cpu32) -{ -#if ODPDRV_BYTE_ORDER == ODPDRV_LITTLE_ENDIAN - return (__odpdrv_force odpdrv_u32le_t)cpu32; -#else - return (__odpdrv_force odpdrv_u32le_t)__builtin_bswap32(cpu32); -#endif -} - -static inline odpdrv_u64le_t odpdrv_cpu_to_le_64(uint64_t cpu64) -{ -#if ODPDRV_BYTE_ORDER == ODPDRV_LITTLE_ENDIAN - return (__odpdrv_force odpdrv_u64le_t)cpu64; -#else - return (__odpdrv_force odpdrv_u64le_t)__builtin_bswap64(cpu64); -#endif -} - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/compiler.h b/platform/linux-generic/include/odp/drv/compiler.h deleted file mode 100644 index 24e84c554..000000000 --- a/platform/linux-generic/include/odp/drv/compiler.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * Compiler related - */ - -#ifndef ODPDRV_PLAT_COMPILER_H_ -#define ODPDRV_PLAT_COMPILER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odpdrv_compiler_optim ODPDRV COMPILER / OPTIMIZATION - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/driver.h b/platform/linux-generic/include/odp/drv/driver.h deleted file mode 100644 index b12c83da6..000000000 --- a/platform/linux-generic/include/odp/drv/driver.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 2017, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV drivers - */ - -#ifndef ODPDRV_PLAT_DRIVER_H_ -#define ODPDRV_PLAT_DRIVER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @ingroup odpdrv_driver - * @{ - */ - -/** - * @} - */ - -#include -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/hints.h b/platform/linux-generic/include/odp/drv/hints.h deleted file mode 100644 index 808c22ca3..000000000 --- a/platform/linux-generic/include/odp/drv/hints.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2017, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV compiler hints - */ - -#ifndef ODPDRV_PLAT_HINTS_H_ -#define ODPDRV_PLAT_HINTS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup odpdrv_compiler_optim - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/plat/atomic_types.h b/platform/linux-generic/include/odp/drv/plat/atomic_types.h deleted file mode 100644 index 6a7ff0d7e..000000000 --- a/platform/linux-generic/include/odp/drv/plat/atomic_types.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV atomic operations - */ - -#ifndef ODPDRV_ATOMIC_TYPES_H_ -#define ODPDRV_ATOMIC_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** - * @internal - * Atomic 64-bit unsigned integer - */ -struct odpdrv_atomic_u64_s { - uint64_t v; /**< Actual storage for the atomic variable */ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - /* Some architectures do not support lock-free operations on 64-bit - * data types. We use a spin lock to ensure atomicity. */ - char lock; /**< Spin lock (if needed) used to ensure atomic access */ -#endif -} ODPDRV_ALIGNED(sizeof(uint64_t)); /* Enforce alignement! */; - -/** - * @internal - * Atomic 32-bit unsigned integer - */ -struct odpdrv_atomic_u32_s { - uint32_t v; /**< Actual storage for the atomic variable */ -} ODPDRV_ALIGNED(sizeof(uint32_t)); /* Enforce alignement! */; - -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - -/** - * @internal - * CAS operation expression for the ATOMIC_OP macro - */ -#define ATOMIC_CAS_OP(ret_ptr, old_val, new_val) \ -({ \ - if (atom->v == (old_val)) { \ - atom->v = (new_val); \ - *(ret_ptr) = 1; \ - } else { \ - *(ret_ptr) = 0; \ - } \ -}) - -/** - * @internal - * Helper macro for lock-based atomic operations on 64-bit integers - * @param[in,out] atom Pointer to the 64-bit atomic variable - * @param expr Expression used update the variable. - * @return The old value of the variable. - */ -#define ATOMIC_OP(atom, expr) \ -({ \ - uint64_t _old_val; \ - /* Loop while lock is already taken, stop when lock becomes clear */ \ - while (__atomic_test_and_set(&(atom)->lock, __ATOMIC_ACQUIRE)) \ - (void)0; \ - _old_val = (atom)->v; \ - (expr); /* Perform whatever update is desired */ \ - __atomic_clear(&(atom)->lock, __ATOMIC_RELEASE); \ - _old_val; /* Return old value */ \ -}) -#endif - -typedef struct odpdrv_atomic_u64_s odpdrv_atomic_u64_t; - -typedef struct odpdrv_atomic_u32_s odpdrv_atomic_u32_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/plat/barrier_types.h b/platform/linux-generic/include/odp/drv/plat/barrier_types.h deleted file mode 100644 index 32264a134..000000000 --- a/platform/linux-generic/include/odp/drv/plat/barrier_types.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV barrier - */ - -#ifndef ODPDRV_BARRIER_TYPES_H_ -#define ODPDRV_BARRIER_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** - * @internal - * ODPDRV thread synchronization barrier - */ -struct odpdrv_barrier_s { - uint32_t count; /**< Thread count */ - odpdrv_atomic_u32_t bar; /**< Barrier counter */ -}; - -typedef struct odpdrv_barrier_s odpdrv_barrier_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/plat/byteorder_types.h b/platform/linux-generic/include/odp/drv/plat/byteorder_types.h deleted file mode 100644 index 5dd182d9b..000000000 --- a/platform/linux-generic/include/odp/drv/plat/byteorder_types.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV byteorder - */ - -#ifndef ODPDRV_BYTEORDER_TYPES_H_ -#define ODPDRV_BYTEORDER_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __BYTE_ORDER__ -#error __BYTE_ORDER not defined! -#endif - -#ifndef __ORDER_BIG_ENDIAN__ -#error __BIG_ENDIAN not defined! -#endif - -#ifndef __ORDER_LITTLE_ENDIAN__ -#error __LITTLE_ENDIAN not defined! -#endif - -/* for use with type checkers such as sparse */ -#ifdef __CHECKER__ -/** @internal bitwise attribute */ -#define __odpdrv_bitwise __attribute__((bitwise)) -/** @internal force attribute */ -#define __odpdrv_force __attribute__((force)) -#else -/** @internal bitwise attribute */ -#define __odpdrv_bitwise -/** @internal force attribute */ -#define __odpdrv_force -#endif - -/** @addtogroup odpdrv_compiler_optim - * @{ - */ -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - #define ODPDRV_LITTLE_ENDIAN 1 - #define ODPDRV_BIG_ENDIAN 0 - #define ODPDRV_BYTE_ORDER ODPDRV_LITTLE_ENDIAN - #define ODPDRV_LITTLE_ENDIAN_BITFIELD 1 - #define ODPDRV_BIG_ENDIAN_BITFIELD 0 - #define ODPDRV_BITFIELD_ORDER ODPDRV_LITTLE_ENDIAN_BITFIELD -#else - #define ODPDRV_LITTLE_ENDIAN 0 - #define ODPDRV_BIG_ENDIAN 1 - #define ODPDRV_BYTE_ORDER ODPDRV_BIG_ENDIAN - #define ODPDRV_LITTLE_ENDIAN_BITFIELD 0 - #define ODPDRV_BIG_ENDIAN_BITFIELD 1 - #define ODPDRV_BITFIELD_ORDER ODPDRV_BIG_ENDIAN_BITFIELD -#endif - -typedef uint16_t __odpdrv_bitwise odpdrv_u16le_t; -typedef uint16_t __odpdrv_bitwise odpdrv_u16be_t; - -typedef uint32_t __odpdrv_bitwise odpdrv_u32le_t; -typedef uint32_t __odpdrv_bitwise odpdrv_u32be_t; - -typedef uint64_t __odpdrv_bitwise odpdrv_u64le_t; -typedef uint64_t __odpdrv_bitwise odpdrv_u64be_t; - -typedef uint16_t __odpdrv_bitwise odpdrv_u16sum_t; -typedef uint32_t __odpdrv_bitwise odpdrv_u32sum_t; - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/plat/driver_types.h b/platform/linux-generic/include/odp/drv/plat/driver_types.h deleted file mode 100644 index 6c611bd94..000000000 --- a/platform/linux-generic/include/odp/drv/plat/driver_types.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2017, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP shared memory - */ - -#ifndef ODPDRV_DRIVER_TYPES_H_ -#define ODPDRV_DRIVER_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** @addtogroup odpdrv_driver ODPDRV DRIVER - * Operations on driver related items (enumerator class, enumerators, - * devios and drivers). - * @{ - */ - -typedef ODPDRV_HANDLE_T(odpdrv_enumr_class_t); -#define ODPDRV_ENUMR_CLASS_INVALID _odpdrv_cast_scalar(odpdrv_enumr_class_t, 0) - -typedef ODPDRV_HANDLE_T(odpdrv_enumr_t); -#define ODPDRV_ENUMR_INVALID _odpdrv_cast_scalar(odpdrv_enumr_t, 0) - -typedef ODPDRV_HANDLE_T(odpdrv_device_t); -#define ODPDRV_DEVICE_INVALID _odpdrv_cast_scalar(odpdrv_device_t, 0) - -typedef ODPDRV_HANDLE_T(odpdrv_devio_t); -#define ODPDRV_DEVIO_INVALID _odpdrv_cast_scalar(odpdrv_devio_t, 0) - -typedef ODPDRV_HANDLE_T(odpdrv_driver_t); -#define ODPDRV_DRIVER_INVALID _odpdrv_cast_scalar(odpdrv_driver_t, 0) - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/plat/shm_types.h b/platform/linux-generic/include/odp/drv/plat/shm_types.h deleted file mode 100644 index 50a083778..000000000 --- a/platform/linux-generic/include/odp/drv/plat/shm_types.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP shared memory - */ - -#ifndef ODPDRV_SHM_TYPES_H_ -#define ODPDRV_SHM_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** @addtogroup odpdrv_shm ODPDRV SHARED MEMORY - * Operations on driver shared memory. - * @{ - */ - -typedef ODPDRV_HANDLE_T(odpdrv_shm_t); - -#define ODPDRV_SHM_INVALID _odpdrv_cast_scalar(odpdrv_shm_t, 0) - -/** Get printable format of odpdrv_shm_t */ -static inline uint64_t odpdrv_shm_to_u64(odpdrv_shm_t hdl) -{ - return _odpdrv_pri(hdl); -} - -typedef ODPDRV_HANDLE_T(odpdrv_shm_pool_t); - -#define ODPDRV_SHM_POOL_INVALID _odpdrv_cast_scalar(odpdrv_shm_pool_t, NULL) -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/plat/spinlock_types.h b/platform/linux-generic/include/odp/drv/plat/spinlock_types.h deleted file mode 100644 index 41dd9acc2..000000000 --- a/platform/linux-generic/include/odp/drv/plat/spinlock_types.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV spinlock - */ - -#ifndef ODPDRV_SPINLOCK_TYPES_H_ -#define ODPDRV_SPINLOCK_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @internal */ -struct odpdrv_spinlock_s { - char lock; /**< lock flag, should match odpdrv_atomic_flag_t */ -}; - -typedef struct odpdrv_spinlock_s odpdrv_spinlock_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/plat/strong_types.h b/platform/linux-generic/include/odp/drv/plat/strong_types.h deleted file mode 100644 index a9c48efbe..000000000 --- a/platform/linux-generic/include/odp/drv/plat/strong_types.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV Strong Types. Common macros for implementing strong typing - * for ODPDRV abstract data types - */ - -#ifndef ODPDRV_STRONG_TYPES_H_ -#define ODPDRV_STRONG_TYPES_H_ - -/** Use strong typing for ODPDRV types */ -#ifdef __cplusplus -#define ODPDRV_HANDLE_T(type) struct _##type { uint8_t unused_dummy_var; } *type -#else -#define odpdrv_handle_t struct { uint8_t unused_dummy_var; } * -/** C/C++ helper macro for strong typing */ -#define ODPDRV_HANDLE_T(type) odpdrv_handle_t type -#endif - -/** Internal macro to get value of an ODPDRV handle */ -#define _odpdrv_typeval(handle) ((uint32_t)(uintptr_t)(handle)) - -/** Internal macro to get printable value of an ODPDRV handle */ -#define _odpdrv_pri(handle) ((uint64_t)_odpdrv_typeval(handle)) - -/** Internal macro to convert a scalar to a typed handle */ -#define _odpdrv_cast_scalar(type, val) ((type)(uintptr_t)(val)) - -#endif diff --git a/platform/linux-generic/include/odp/drv/shm.h b/platform/linux-generic/include/odp/drv/shm.h deleted file mode 100644 index 644b03668..000000000 --- a/platform/linux-generic/include/odp/drv/shm.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV shared memory - */ - -#ifndef ODPDRV_PLAT_SHM_H_ -#define ODPDRV_PLAT_SHM_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @ingroup odpdrv_shm - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/spinlock.h b/platform/linux-generic/include/odp/drv/spinlock.h deleted file mode 100644 index dd05f8c60..000000000 --- a/platform/linux-generic/include/odp/drv/spinlock.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV spinlock - */ - -#ifndef ODPDRV_PLAT_SPINLOCK_H_ -#define ODPDRV_PLAT_SPINLOCK_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/std_types.h b/platform/linux-generic/include/odp/drv/std_types.h deleted file mode 100644 index 4fe4affda..000000000 --- a/platform/linux-generic/include/odp/drv/std_types.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * Standard C language types and definitions for ODP driver interface. - */ - -#ifndef ODPDRV_PLAT_STD_TYPES_H_ -#define ODPDRV_PLAT_STD_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include - -/** @addtogroup odpdrv_system ODPDRV SYSTEM - * @{ - */ - -typedef int odpdrv_bool_t; - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/drv/sync.h b/platform/linux-generic/include/odp/drv/sync.h deleted file mode 100644 index 58521382d..000000000 --- a/platform/linux-generic/include/odp/drv/sync.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODPDRV synchronisation - */ - -#ifndef ODPDRV_PLAT_SYNC_H_ -#define ODPDRV_PLAT_SYNC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup odpdrv_barrier - * @{ - */ - -static inline void odpdrv_mb_release(void) -{ - __atomic_thread_fence(__ATOMIC_RELEASE); -} - -static inline void odpdrv_mb_acquire(void) -{ - __atomic_thread_fence(__ATOMIC_ACQUIRE); -} - -static inline void odpdrv_mb_full(void) -{ - __atomic_thread_fence(__ATOMIC_SEQ_CST); -} - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp_pktio_ops_virtio.h b/platform/linux-generic/include/odp_pktio_ops_virtio.h index 93e7f000d..9e299fe97 100644 --- a/platform/linux-generic/include/odp_pktio_ops_virtio.h +++ b/platform/linux-generic/include/odp_pktio_ops_virtio.h @@ -7,7 +7,7 @@ #ifndef ODP_PACKET_VIRTIO_H #define ODP_PACKET_VIRTIO_H -#include +#include typedef struct { struct pci_dev_t *pci_dev; diff --git a/platform/linux-generic/pktio/virtio.c b/platform/linux-generic/pktio/virtio/virtio.c similarity index 99% rename from platform/linux-generic/pktio/virtio.c rename to platform/linux-generic/pktio/virtio/virtio.c index ddeb46f18..29e658b1e 100644 --- a/platform/linux-generic/pktio/virtio.c +++ b/platform/linux-generic/pktio/virtio/virtio.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include "virtio_pci.h" diff --git a/platform/linux-generic/pktio/virtio_pci.c b/platform/linux-generic/pktio/virtio/virtio_pci.c similarity index 98% rename from platform/linux-generic/pktio/virtio_pci.c rename to platform/linux-generic/pktio/virtio/virtio_pci.c index 376ddbea3..3b83c34a7 100644 --- a/platform/linux-generic/pktio/virtio_pci.c +++ b/platform/linux-generic/pktio/virtio/virtio_pci.c @@ -45,9 +45,9 @@ #include #include -#include +#include #include -#include +#include #include "virtio_pci.h" @@ -435,8 +435,8 @@ static void virtio_get_hwaddr(struct virtio_hw *hw) { if (vtpci_with_feature(hw, VIRTIO_NET_F_MAC)) { vtpci_read_dev_config(hw, - ODPDRV_OFFSETOF(struct virtio_net_config, - mac), + ODP_OFFSETOF(struct virtio_net_config, + mac), &hw->mac_addr, 6); ODP_PRINT("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", @@ -461,8 +461,8 @@ static void virtio_get_status(struct virtio_hw *hw) } vtpci_read_dev_config(hw, - ODPDRV_OFFSETOF(struct virtio_net_config, - status), + ODP_OFFSETOF(struct virtio_net_config, + status), &config.status, sizeof(config.status)); ODP_PRINT("Status is %u\n", config.status); @@ -478,8 +478,8 @@ static uint16_t virtio_get_num_queues(struct virtio_hw *hw) } vtpci_read_dev_config(hw, - ODPDRV_OFFSETOF(struct virtio_net_config, - max_virtqueue_pairs), + ODP_OFFSETOF(struct virtio_net_config, + max_virtqueue_pairs), &max_pairs, sizeof(max_pairs)); ODP_PRINT("Device supports maximum of %u virtqueue pairs\n", max_pairs); diff --git a/platform/linux-generic/pktio/virtio_pci.h b/platform/linux-generic/pktio/virtio/virtio_pci.h similarity index 99% rename from platform/linux-generic/pktio/virtio_pci.h rename to platform/linux-generic/pktio/virtio/virtio_pci.h index 3e1763157..7945e7d0e 100644 --- a/platform/linux-generic/pktio/virtio_pci.h +++ b/platform/linux-generic/pktio/virtio/virtio_pci.h @@ -36,7 +36,7 @@ #include -#include +#include struct virtqueue; struct virtnet_ctl;