From patchwork Thu Feb 9 11:53:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 93693 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp208273qgi; Thu, 9 Feb 2017 03:55:30 -0800 (PST) X-Received: by 10.200.42.182 with SMTP id b51mr2171952qta.101.1486641330739; Thu, 09 Feb 2017 03:55:30 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id v27si7813986qkv.65.2017.02.09.03.55.30; Thu, 09 Feb 2017 03:55:30 -0800 (PST) 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 sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 72D49608D2; Thu, 9 Feb 2017 11:55:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 E2A5F62EB3; Thu, 9 Feb 2017 11:54:08 +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 9B88662EB2; Thu, 9 Feb 2017 11:54:02 +0000 (UTC) Received: from mail-ot0-f176.google.com (mail-ot0-f176.google.com [74.125.82.176]) by lists.linaro.org (Postfix) with ESMTPS id A694B62C7E for ; Thu, 9 Feb 2017 11:53:58 +0000 (UTC) Received: by mail-ot0-f176.google.com with SMTP id 32so923175oth.3 for ; Thu, 09 Feb 2017 03:53:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1y60NwbbKq6eZW4Xsegu9CcufRoymTdhbck2JDqoCww=; b=Hj64OvkgDD+imZ+vnEP/6atH6iQO10S0NZZCRcOik0mJvzWdB4kMlSAoRKXWjdA4XP q9R+9HiQ0R2FFZk3L6B0YXh3G3zD+r5XwKfPDuJPMSk8TJ8W87IDk6OCsYN69Kk1MQYH 5HVHiRgWwgue6iRQd4KjNy5AUTTiT7JOPBACjf3ojHsWCMusjmNopAYiUh4eqxxFSSqH imweZ+PjaVMxnB71zs/s15JtBkuDBDNPNsIJ4AKNAEElQVY90vtQySXFamhtT57MfsM4 NoAQagB8XWXfZAsYwoxudPl+l2k0XoXF6jBFERgSn5PKi2Q0t6/ix+bZ9MRlZqECPlMY +0lw== X-Gm-Message-State: AMke39kUOFw2fRx+HUFzGBZAGrdk0oXTU8rspS8LrGXzRNqaakLgS108C6wWooFER3nalaCPAjY= X-Received: by 10.157.2.39 with SMTP id 36mr1345693otb.150.1486641238122; Thu, 09 Feb 2017 03:53:58 -0800 (PST) Received: from localhost.localdomain (cpe-70-121-83-241.austin.res.rr.com. [70.121.83.241]) by smtp.gmail.com with ESMTPSA id t53sm5767383otd.6.2017.02.09.03.53.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2017 03:53:57 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 9 Feb 2017 05:53:49 -0600 Message-Id: <20170209115352.16271-3-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.11.0.295.gd7dffce In-Reply-To: <20170209115352.16271-1-bill.fischofer@linaro.org> References: <20170209115352.16271-1-bill.fischofer@linaro.org> Cc: Petri Savolainen Subject: [lng-odp] [API-NEXT PATCHv3 2/5] linux-gen: ticketlock: inline also in application 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: Petri Savolainen Enable ticketlock function inlining in applications when not building for ABI compatibility. Signed-off-by: Petri Savolainen Signed-off-by: Bill Fischofer --- platform/linux-generic/Makefile.am | 1 + .../include/odp/api/plat/ticketlock_inlines.h | 19 +++++++++++- .../include/odp/api/plat/ticketlock_inlines_api.h | 36 ++++++++++++++++++++++ .../linux-generic/include/odp/api/ticketlock.h | 4 +++ platform/linux-generic/odp_ticketlock.c | 24 +++------------ 5 files changed, 64 insertions(+), 20 deletions(-) create mode 100644 platform/linux-generic/include/odp/api/plat/ticketlock_inlines_api.h -- 2.11.0.295.gd7dffce diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 66ff53d5..63d5cbc0 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -98,6 +98,7 @@ odpapiplatinclude_HEADERS = \ $(srcdir)/include/odp/api/plat/thread_types.h \ $(srcdir)/include/odp/api/plat/thrmask_types.h \ $(srcdir)/include/odp/api/plat/ticketlock_inlines.h \ + $(srcdir)/include/odp/api/plat/ticketlock_inlines_api.h \ $(srcdir)/include/odp/api/plat/ticketlock_types.h \ $(srcdir)/include/odp/api/plat/time_types.h \ $(srcdir)/include/odp/api/plat/timer_types.h \ diff --git a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h b/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h index 87432a71..ecbea7c4 100644 --- a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h @@ -13,11 +13,12 @@ #ifndef _ODP_PLAT_TICKETLOCK_INLINES_H_ #define _ODP_PLAT_TICKETLOCK_INLINES_H_ -#include #include #include #include +#include + /** @internal * Acquire ticket lock. * @@ -110,4 +111,20 @@ static inline int _odp_ticketlock_is_locked(odp_ticketlock_t *ticketlock) odp_atomic_load_u32(&ticketlock->next_ticket); } +/* Include inlined versions of API functions */ +#include +#if ODP_ABI_COMPAT == 0 + +/** @ingroup odp_locks + * @{ + */ + +#include + +/** + * @} + */ + +#endif + #endif diff --git a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines_api.h b/platform/linux-generic/include/odp/api/plat/ticketlock_inlines_api.h new file mode 100644 index 00000000..5efe696f --- /dev/null +++ b/platform/linux-generic/include/odp/api/plat/ticketlock_inlines_api.h @@ -0,0 +1,36 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * Ticketlock inline functions + */ + +#ifndef _ODP_PLAT_TICKETLOCK_INLINES_API_H_ +#define _ODP_PLAT_TICKETLOCK_INLINES_API_H_ + +_ODP_INLINE void odp_ticketlock_lock(odp_ticketlock_t *lock) +{ + return _odp_ticketlock_lock(lock); +} + +_ODP_INLINE int odp_ticketlock_trylock(odp_ticketlock_t *lock) +{ + return _odp_ticketlock_trylock(lock); +} + +_ODP_INLINE void odp_ticketlock_unlock(odp_ticketlock_t *lock) +{ + _odp_ticketlock_unlock(lock); +} + +_ODP_INLINE int odp_ticketlock_is_locked(odp_ticketlock_t *lock) +{ + return _odp_ticketlock_is_locked(lock); +} + +#endif diff --git a/platform/linux-generic/include/odp/api/ticketlock.h b/platform/linux-generic/include/odp/api/ticketlock.h index 85be4bc5..e0f5d81f 100644 --- a/platform/linux-generic/include/odp/api/ticketlock.h +++ b/platform/linux-generic/include/odp/api/ticketlock.h @@ -19,6 +19,10 @@ extern "C" { #include +#if ODP_ABI_COMPAT == 0 +#include +#endif + #include #ifdef __cplusplus diff --git a/platform/linux-generic/odp_ticketlock.c b/platform/linux-generic/odp_ticketlock.c index f18d78f5..f73dd9ab 100644 --- a/platform/linux-generic/odp_ticketlock.c +++ b/platform/linux-generic/odp_ticketlock.c @@ -5,6 +5,7 @@ */ #include +#include void odp_ticketlock_init(odp_ticketlock_t *ticketlock) { @@ -12,22 +13,7 @@ void odp_ticketlock_init(odp_ticketlock_t *ticketlock) odp_atomic_init_u32(&ticketlock->cur_ticket, 0); } -void odp_ticketlock_lock(odp_ticketlock_t *lock) -{ - return _odp_ticketlock_lock(lock); -} - -int odp_ticketlock_trylock(odp_ticketlock_t *lock) -{ - return _odp_ticketlock_trylock(lock); -} - -void odp_ticketlock_unlock(odp_ticketlock_t *lock) -{ - _odp_ticketlock_unlock(lock); -} - -int odp_ticketlock_is_locked(odp_ticketlock_t *lock) -{ - return _odp_ticketlock_is_locked(lock); -} +/* Include non-inlined versions of API functions */ +#if ODP_ABI_COMPAT == 1 +#include +#endif