From patchwork Fri Jan 19 16:00:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 125191 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp356198ljf; Fri, 19 Jan 2018 08:04:33 -0800 (PST) X-Google-Smtp-Source: ACJfBosInagOBIg9TW7IpZAE/qhAXqX/SPE+dNaFPaUTO4dc3pSoKFJ6cvJTL99lx2zT2sCvnJot X-Received: by 10.129.76.68 with SMTP id z65mr10215540ywa.513.1516377872859; Fri, 19 Jan 2018 08:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377872; cv=none; d=google.com; s=arc-20160816; b=dy229TsTL8w0vdB1QBI7DWUrxryXaY4IjPLcK+4HHBYMlbUy26jxApxLw9wi6pS62m YSdj24rdrxMVi91pA0aTt8j5FJwHafY6Qs9QHLOEB2hnYF7p7WhjtZPKIsQvQ165rw+J Y+F7BkbbjorMcFCGbBwFie+nXjlYAmRpMuhMeWv377kucEzbNdM2Yon0Gxmr5HWx+UkH Oz3yAMWYm4l+F6k1H7HGEfnD+dvthagb0d5uzj0bUCRmQN3q54Ee8t9dryGqL0Cso2kT dI9vAwfmMHRNEuEXrUvpJf+HRpCfJEeMqNAD2aF0Tpk6+4t+uVtNsjCPsP8kUb7SY0uH syWQ== 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=ptTOijwVKBwePJt45ygDSdL1fLUVfLnGpkaqK9/UX9Q=; b=leui9PaDissDU+wKbEUNZhjvVMDazm3bHbZrrlby/9I0zai4CepJGgPa6SYYTWaJX1 46WA7LFb+ZhwDKJfpDPaCcx3Z7K54V4uMmUTGodUuiWZ0DpuMr33Dl12YkopwojoSHo/ 2iAOLvNPQQRUT088V9q7TNmF7jByLQGMef6MuO8nmkX6XYx7Pv2TQlApwUBtr3nxZPwd yEdJJssW1ehrn/rciRkaDPnCM5cy+AATBnmK/Vr5Ll3hsoSYrMNZNr2U+xOcqALuaJcv MEB91yBHbG5FgWakRU4nrk2xpNmqRFVLrKLOam0AWTqhRCXFs8BW/x6ECegQ/qxzd1OJ /6cg== 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 e4si5652246qkf.275.2018.01.19.08.04.32; Fri, 19 Jan 2018 08:04:32 -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 7995462815; Fri, 19 Jan 2018 16:04:32 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id D920F62862; Fri, 19 Jan 2018 16:02:51 +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 26FEE6281F; Fri, 19 Jan 2018 16:02:43 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 0C22362837 for ; Fri, 19 Jan 2018 16:01:15 +0000 (UTC) Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 8428B4303A13 for ; Fri, 19 Jan 2018 19:01:13 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id m8ojzlbxND-1DjiV0UR; Fri, 19 Jan 2018 19:01:13 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id MswDHNv6QY-1DeeSpvp; Fri, 19 Jan 2018 19:01:13 +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: Fri, 19 Jan 2018 19:00:53 +0300 Message-Id: <1516377654-1536-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516377654-1536-1-git-send-email-odpbot@yandex.ru> References: <1516377654-1536-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 409 Subject: [lng-odp] [PATCH v1 2/3] linux-gen: byteorder: internal inline functions 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 Define inline functions for internal use. Implementation uses always internally inlined version. Application uses inlined version only in non ABI compatible mode. Signed-off-by: Petri Savolainen --- /** Email created from pull request 409 (psavol:master-byteorder-inline) ** https://github.com/Linaro/odp/pull/409 ** Patch: https://github.com/Linaro/odp/pull/409.patch ** Base sha: 5a4502fc6bc53e6503169da3028f456b64811a0b ** Merge commit sha: 7bc84d4d2e3971744d4dd9194ac9e8ec3182af09 **/ platform/linux-generic/Makefile.am | 1 + .../include-abi/odp/api/abi/byteorder.h | 1 + .../include/odp/api/plat/byteorder_inlines.h | 24 +++--- .../include/odp/api/plat/byteorder_inlines_api.h | 88 ++++++++++++++++++++++ platform/linux-generic/odp_byteorder.c | 1 + 5 files changed, 103 insertions(+), 12 deletions(-) create mode 100644 platform/linux-generic/include/odp/api/plat/byteorder_inlines_api.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 9b7ee37e5..8585080df 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -24,6 +24,7 @@ odpapiplatincludedir= $(includedir)/odp/api/plat odpapiplatinclude_HEADERS = \ include/odp/api/plat/atomic_inlines.h \ include/odp/api/plat/byteorder_inlines.h \ + include/odp/api/plat/byteorder_inlines_api.h \ include/odp/api/plat/packet_flag_inlines.h \ include/odp/api/plat/packet_flag_inlines_api.h \ include/odp/api/plat/packet_inline_types.h \ diff --git a/platform/linux-generic/include-abi/odp/api/abi/byteorder.h b/platform/linux-generic/include-abi/odp/api/abi/byteorder.h index da07c0eb0..ee03a17be 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/byteorder.h +++ b/platform/linux-generic/include-abi/odp/api/abi/byteorder.h @@ -77,6 +77,7 @@ typedef uint32_t __odp_bitwise odp_u32sum_t; #define _ODP_INLINE static inline #include +#include /** * @} diff --git a/platform/linux-generic/include/odp/api/plat/byteorder_inlines.h b/platform/linux-generic/include/odp/api/plat/byteorder_inlines.h index 2f96863b7..b559d4f04 100644 --- a/platform/linux-generic/include/odp/api/plat/byteorder_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/byteorder_inlines.h @@ -43,7 +43,7 @@ extern "C" { #define __odp_builtin_bswap16(u16) __builtin_bswap16(u16) #endif -_ODP_INLINE uint16_t odp_be_to_cpu_16(odp_u16be_t be16) +static inline uint16_t _odp_be_to_cpu_16(odp_u16be_t be16) { #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN return __odp_builtin_bswap16((__odp_force uint16_t)be16); @@ -52,7 +52,7 @@ _ODP_INLINE uint16_t odp_be_to_cpu_16(odp_u16be_t be16) #endif } -_ODP_INLINE uint32_t odp_be_to_cpu_32(odp_u32be_t be32) +static inline uint32_t _odp_be_to_cpu_32(odp_u32be_t be32) { #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN return __builtin_bswap32((__odp_force uint32_t)be32); @@ -61,7 +61,7 @@ _ODP_INLINE uint32_t odp_be_to_cpu_32(odp_u32be_t be32) #endif } -_ODP_INLINE uint64_t odp_be_to_cpu_64(odp_u64be_t be64) +static inline uint64_t _odp_be_to_cpu_64(odp_u64be_t be64) { #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN return __builtin_bswap64((__odp_force uint64_t)be64); @@ -70,7 +70,7 @@ _ODP_INLINE uint64_t odp_be_to_cpu_64(odp_u64be_t be64) #endif } -_ODP_INLINE odp_u16be_t odp_cpu_to_be_16(uint16_t cpu16) +static inline odp_u16be_t _odp_cpu_to_be_16(uint16_t cpu16) { #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN return (__odp_force odp_u16be_t)__odp_builtin_bswap16(cpu16); @@ -79,7 +79,7 @@ _ODP_INLINE odp_u16be_t odp_cpu_to_be_16(uint16_t cpu16) #endif } -_ODP_INLINE odp_u32be_t odp_cpu_to_be_32(uint32_t cpu32) +static inline odp_u32be_t _odp_cpu_to_be_32(uint32_t cpu32) { #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN return (__odp_force odp_u32be_t)__builtin_bswap32(cpu32); @@ -88,7 +88,7 @@ _ODP_INLINE odp_u32be_t odp_cpu_to_be_32(uint32_t cpu32) #endif } -_ODP_INLINE odp_u64be_t odp_cpu_to_be_64(uint64_t cpu64) +static inline odp_u64be_t _odp_cpu_to_be_64(uint64_t cpu64) { #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN return (__odp_force odp_u64be_t)__builtin_bswap64(cpu64); @@ -97,7 +97,7 @@ _ODP_INLINE odp_u64be_t odp_cpu_to_be_64(uint64_t cpu64) #endif } -_ODP_INLINE uint16_t odp_le_to_cpu_16(odp_u16le_t le16) +static inline uint16_t _odp_le_to_cpu_16(odp_u16le_t le16) { #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN return (__odp_force uint16_t)le16; @@ -106,7 +106,7 @@ _ODP_INLINE uint16_t odp_le_to_cpu_16(odp_u16le_t le16) #endif } -_ODP_INLINE uint32_t odp_le_to_cpu_32(odp_u32le_t le32) +static inline uint32_t _odp_le_to_cpu_32(odp_u32le_t le32) { #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN return (__odp_force uint32_t)le32; @@ -115,7 +115,7 @@ _ODP_INLINE uint32_t odp_le_to_cpu_32(odp_u32le_t le32) #endif } -_ODP_INLINE uint64_t odp_le_to_cpu_64(odp_u64le_t le64) +static inline uint64_t _odp_le_to_cpu_64(odp_u64le_t le64) { #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN return (__odp_force uint64_t)le64; @@ -124,7 +124,7 @@ _ODP_INLINE uint64_t odp_le_to_cpu_64(odp_u64le_t le64) #endif } -_ODP_INLINE odp_u16le_t odp_cpu_to_le_16(uint16_t cpu16) +static inline odp_u16le_t _odp_cpu_to_le_16(uint16_t cpu16) { #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN return (__odp_force odp_u16le_t)cpu16; @@ -133,7 +133,7 @@ _ODP_INLINE odp_u16le_t odp_cpu_to_le_16(uint16_t cpu16) #endif } -_ODP_INLINE odp_u32le_t odp_cpu_to_le_32(uint32_t cpu32) +static inline odp_u32le_t _odp_cpu_to_le_32(uint32_t cpu32) { #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN return (__odp_force odp_u32le_t)cpu32; @@ -142,7 +142,7 @@ _ODP_INLINE odp_u32le_t odp_cpu_to_le_32(uint32_t cpu32) #endif } -_ODP_INLINE odp_u64le_t odp_cpu_to_le_64(uint64_t cpu64) +static inline odp_u64le_t _odp_cpu_to_le_64(uint64_t cpu64) { #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN return (__odp_force odp_u64le_t)cpu64; diff --git a/platform/linux-generic/include/odp/api/plat/byteorder_inlines_api.h b/platform/linux-generic/include/odp/api/plat/byteorder_inlines_api.h new file mode 100644 index 000000000..ef81d74db --- /dev/null +++ b/platform/linux-generic/include/odp/api/plat/byteorder_inlines_api.h @@ -0,0 +1,88 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP byteorder + */ + +#ifndef ODP_PLAT_BYTEORDER_INLINES_API_H_ +#define ODP_PLAT_BYTEORDER_INLINES_API_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +_ODP_INLINE uint16_t odp_be_to_cpu_16(odp_u16be_t be16) +{ + return _odp_be_to_cpu_16(be16); +} + +_ODP_INLINE uint32_t odp_be_to_cpu_32(odp_u32be_t be32) +{ + return _odp_be_to_cpu_32(be32); +} + +_ODP_INLINE uint64_t odp_be_to_cpu_64(odp_u64be_t be64) +{ + return _odp_be_to_cpu_64(be64); +} + +_ODP_INLINE odp_u16be_t odp_cpu_to_be_16(uint16_t cpu16) +{ + return _odp_cpu_to_be_16(cpu16); +} + +_ODP_INLINE odp_u32be_t odp_cpu_to_be_32(uint32_t cpu32) +{ + return _odp_cpu_to_be_32(cpu32); +} + +_ODP_INLINE odp_u64be_t odp_cpu_to_be_64(uint64_t cpu64) +{ + return _odp_cpu_to_be_64(cpu64); +} + +_ODP_INLINE uint16_t odp_le_to_cpu_16(odp_u16le_t le16) +{ + return _odp_le_to_cpu_16(le16); +} + +_ODP_INLINE uint32_t odp_le_to_cpu_32(odp_u32le_t le32) +{ + return _odp_le_to_cpu_32(le32); +} + +_ODP_INLINE uint64_t odp_le_to_cpu_64(odp_u64le_t le64) +{ + return _odp_le_to_cpu_64(le64); +} + +_ODP_INLINE odp_u16le_t odp_cpu_to_le_16(uint16_t cpu16) +{ + return _odp_cpu_to_le_16(cpu16); +} + +_ODP_INLINE odp_u32le_t odp_cpu_to_le_32(uint32_t cpu32) +{ + return _odp_cpu_to_le_32(cpu32); +} + +_ODP_INLINE odp_u64le_t odp_cpu_to_le_64(uint64_t cpu64) +{ + return _odp_cpu_to_le_64(cpu64); +} + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/odp_byteorder.c b/platform/linux-generic/odp_byteorder.c index ff0b74b23..9cfb05d3e 100644 --- a/platform/linux-generic/odp_byteorder.c +++ b/platform/linux-generic/odp_byteorder.c @@ -11,3 +11,4 @@ /* Include non-inlined versions of API functions */ #define _ODP_INLINE #include +#include