From patchwork Mon Jul 18 17:49:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 72226 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp211255qga; Mon, 18 Jul 2016 09:57:03 -0700 (PDT) X-Received: by 10.55.140.1 with SMTP id o1mr46002548qkd.143.1468861023847; Mon, 18 Jul 2016 09:57:03 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id m22si3732190qtc.21.2016.07.18.09.57.03; Mon, 18 Jul 2016 09:57:03 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 730C56878F; Mon, 18 Jul 2016 16:57:03 +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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 7E3236881C; Mon, 18 Jul 2016 16:51:19 +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 289146808D; Mon, 18 Jul 2016 16:50:50 +0000 (UTC) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) by lists.linaro.org (Postfix) with ESMTPS id AA44D6808D for ; Mon, 18 Jul 2016 16:50:46 +0000 (UTC) Received: by mail-lf0-f51.google.com with SMTP id l69so79250125lfg.1 for ; Mon, 18 Jul 2016 09:50:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=b87NCkalRVcL/r+f9n9U9wLpQRngLZmwue15jj+P7hU=; b=AEvnVXJrfkhjHLY2tdtJMhIgdIPgLgpY9jx0SDM2xQuyTIUeBYYao1Puyv+4hWn1Yr 3OKsn8D031YfE92uFdl/O2vowE2wIKzuvw2R43i+QRNJssUonqelMBR0Xfgjq37ZRxVv pGfnOKxX2T26GuUPI1vaWIf8+zod3f1VZnD0ktYNqViZniEA39ML31p9oeHAofMPgyOJ AMImOIPoGPX7kNiKZDVB3TBuqNIUVwGg1l9coL2e3ojsf36Bj3Gmic92gVjte0J5q2as vKUNNNov9VNXmu7x5P7TeLSwQ1vl5sXvOjJv3FoHe2TAl0fGAKJRSbT0+GMeaxXosa9e nIFQ== X-Gm-Message-State: ALyK8tKfE4RFNmG2qMpIXLU9kGAhWQbm0BpQj7ocXGAsSsXW+WT5zPtJmiSlH60gULRvQJyLKDU= X-Received: by 10.25.126.6 with SMTP id z6mr14354061lfc.155.1468860645536; Mon, 18 Jul 2016 09:50:45 -0700 (PDT) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id y200sm2226229lfd.12.2016.07.18.09.50.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jul 2016 09:50:44 -0700 (PDT) From: Christophe Milard To: mike.holmes@linaro.org, yi.he@linaro.org, balakrishna.garapati@linaro.org, lng-odp@lists.linaro.org Date: Mon, 18 Jul 2016 19:49:28 +0200 Message-Id: <1468864178-43721-9-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1468864178-43721-1-git-send-email-christophe.milard@linaro.org> References: <1468864178-43721-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 08/18] linux-generic: drv: adding sync.h 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" duplicated from the API side (hash: 77a27212b563299959fb2a609b86bb9117a8f918) Signed-off-by: Christophe Milard --- include/odp_drv.h | 1 + platform/linux-generic/Makefile.am | 3 +- platform/linux-generic/include/odp/drv/sync.h | 49 +++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 platform/linux-generic/include/odp/drv/sync.h -- 2.7.4 diff --git a/include/odp_drv.h b/include/odp_drv.h index 1956e8c..e2c3bda 100644 --- a/include/odp_drv.h +++ b/include/odp_drv.h @@ -21,6 +21,7 @@ extern C { #include #include #include +#include #ifdef __cplusplus } diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 5b70fb4..4ef8ac1 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -94,7 +94,8 @@ odpapiplatinclude_HEADERS = \ odpdrvincludedir = $(includedir)/odp/drv odpdrvinclude_HEADERS = \ $(srcdir)/include/odp/drv/byteorder.h \ - $(srcdir)/include/odp/drv/compiler.h + $(srcdir)/include/odp/drv/compiler.h \ + $(srcdir)/include/odp/drv/sync.h odpdrvplatincludedir = $(includedir)/odp/drv/plat odpdrvplatinclude_HEADERS = \ diff --git a/platform/linux-generic/include/odp/drv/sync.h b/platform/linux-generic/include/odp/drv/sync.h new file mode 100644 index 0000000..5852138 --- /dev/null +++ b/platform/linux-generic/include/odp/drv/sync.h @@ -0,0 +1,49 @@ +/* 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