From patchwork Fri Jan 19 16:00:52 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: 125190 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp355882ljf; Fri, 19 Jan 2018 08:03:51 -0800 (PST) X-Google-Smtp-Source: ACJfBouLhFyapyPRQ5/0PFf85TDiX38us3gpXEqzRjWcZhAOmkNVJ6E+izvSr0Nc1m3DFMOm5etp X-Received: by 10.200.36.199 with SMTP id t7mr25999760qtt.141.1516377831643; Fri, 19 Jan 2018 08:03:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377831; cv=none; d=google.com; s=arc-20160816; b=hEnazVBgzcqsAD4STcTttBmR1krzvToJ7sLAcX/8I3R00RjlqJTnIWjL7u96u6K81c WmTZfwxVQiA79uqNSHops+KZRYY65y+g5IuIBjByigX+Ei/01wCPk6f3NP2kPDznfoZ9 F7bjUpd0VBLyDBOLRkHiaLL8uOB6pC9NvjRkdYb4qebyWJZBPxSWkyvnHKWLscZDg8NQ 4SxanrsfOozfdw498lJSko6aEk2qA1dqmM+3Zdg3p+17eRBVm+nJtICgyPS+URI3uLxx Otg7FnyeOC8xbbZ+6OEENyXyldcO50ImmORcAEUkGdp4UBz/Ci1Wloldn16x3fayUF6N jjWQ== 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=riyFz2CsqalJO8GLpTQ6wxxklQGggDeM83T2i23C5dA=; b=dDSSbnJ26HSQ25RyqJDi5EbOv+vI5+xCEPG4vE6ebjGpog62MwFdTt5MlGnwRGgpQv 9Z4tyg4PWA9i6CdPIAPNXFLuzikiNNfw67qlaczC7l3rGyAFDaowql5Rrrtg1HjONAnb Ey7xRUihMbr4irdgNh7/aavcrQRn15UGHyutpLUyZs4/aSlfDX0iBsbYyIVMCjjgmmlQ 05KyOuq/JcQwrRfaOxNxGXh7FzoKzGrpDwJvkMi67BmLP8xUnQyMTSLClR82U5eRNoRv u1kXZ1a2oQCapuNJSoIrbCBxl+1qYCg+CQPiBjzCtMUgQPjZePwphZCSM7CGOI6jkaGR RGCg== 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 m80si10434776qkm.319.2018.01.19.08.03.51; Fri, 19 Jan 2018 08:03:51 -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 37D04627F6; Fri, 19 Jan 2018 16:03:51 +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_H3, RCVD_IN_MSPIKE_WL 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 80CFC6285B; Fri, 19 Jan 2018 16:02:37 +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 52D146283E; Fri, 19 Jan 2018 16:02:30 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 7C051617FC for ; Fri, 19 Jan 2018 16:01:14 +0000 (UTC) Received: from mxback16j.mail.yandex.net (mxback16j.mail.yandex.net [IPv6:2a02:6b8:0:1619::92]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 0A8051812AE 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 mxback16j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id IPLTNhtEXU-1CberjTx; Fri, 19 Jan 2018 19:01:13 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id MswDHNv6QY-1BeS7dGW; Fri, 19 Jan 2018 19:01: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: Fri, 19 Jan 2018 19:00:52 +0300 Message-Id: <1516377654-1536-2-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 1/3] linux-gen: remove static_inline header 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 This header file is not referenced anywhere. Remove it. 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 **/ .../include/odp/api/plat/static_inline.h | 43 ---------------------- 1 file changed, 43 deletions(-) delete mode 100644 platform/linux-generic/include/odp/api/plat/static_inline.h diff --git a/platform/linux-generic/include/odp/api/plat/static_inline.h b/platform/linux-generic/include/odp/api/plat/static_inline.h deleted file mode 100644 index 633e2f273..000000000 --- a/platform/linux-generic/include/odp/api/plat/static_inline.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * Macro for static inline functions - */ - -#ifndef ODP_PLAT_STATIC_INLINE_H_ -#define ODP_PLAT_STATIC_INLINE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @internal - * @def ODP_ABI_COMPAT - * Control ABI compatibility - */ - -/** - * @internal - * @def _ODP_INLINE - * Define a function as inlined or not inlined (for ABI compatibility) - */ -#if 1 -#define ODP_ABI_COMPAT 1 -#define _ODP_INLINE -#else -#define ODP_ABI_COMPAT 0 -#define _ODP_INLINE static inline -#endif - -#ifdef __cplusplus -} -#endif - -#endif 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 From patchwork Fri Jan 19 16:00:54 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: 125192 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp356790ljf; Fri, 19 Jan 2018 08:05:36 -0800 (PST) X-Google-Smtp-Source: ACJfBosP0Pn2gta3oce/TtGlGjBTVHtBkkpA/dDZb+pgRT+PHwtGJuhX/zpZXqjRO4f2cfXUcUzk X-Received: by 10.55.64.84 with SMTP id n81mr51625062qka.95.1516377936327; Fri, 19 Jan 2018 08:05:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377936; cv=none; d=google.com; s=arc-20160816; b=ztv+PouZvjU1hnzZiVxJmniktYF0r0QVeg6/jT+TBHSBnTHdT0MTen2KZBADdvvstb zxzy5x81OgcRyUVpDMLmkxvaGov1m5CoO/Vv/JoYW71/yfostlTm0yxbxB6hh4bwKUir XLNGay/YKzIhOlyYehdvTPJtYocF/BxtegIbUngUuprXM9MR5k0p4RwddsKh5L1LH6aj AE77cSZbc7BgA8l+DOhz1OwBQnR/3SNjP3beOBxgEaDMeF7Gfbu3xgMA+uHSA5lEDtfM JCV1wRV3gXN98izTRXyQJoGzpyBVkPbpSoX+4z+yCC4lrhV+tjNHi/uHRG52vt3e1YUk RXDQ== 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=HvIIrgSmJgeDBfWUB+R7fXhsDSc9DOzNzebMT4KjpNI=; b=KdTrJvoXpn3ZKM5qReQRf7y+Hy/0V6RICyjcHurfcz4GGlzw+Bir0PfOCERxqpnPlp NO5cKecywpFSkdGYBQao5YEsm1etL2Ws11UddtHZXAD0Qdtaf8Sc+srCHPsNIvwV50Sb 3GXSyLtm4321tAh8i6RWrHUiGBcQP3U65Nr0Tli8AWLvA804qiPwVXQjj9COsh3wEisy J8i9ozpwtf44YPzHxeyhQ3nuohjYN386XTCu0TiJyFk0KZbQ3ptCpTiAI2IcPJ0RB6eF 8yc/OAF/N8iDZIzF5XUEL8K9kTkPnvMTuopxnypXzjsM73MOp0n3L/PWssw8BrHdKZ33 g2Tw== 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 v1si601998qtv.406.2018.01.19.08.05.36; Fri, 19 Jan 2018 08:05:36 -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 090D1627D5; Fri, 19 Jan 2018 16:05:36 +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 56D5C62835; Fri, 19 Jan 2018 16:03:03 +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 606C16286A; Fri, 19 Jan 2018 16:02:53 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id CD5A062826 for ; Fri, 19 Jan 2018 16:01:15 +0000 (UTC) Received: from mxback9g.mail.yandex.net (mxback9g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:170]) by forward104o.mail.yandex.net (Yandex) with ESMTP id 68778701336 for ; Fri, 19 Jan 2018 19:01:14 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback9g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id hnoQCdDMvL-1Em8qKZu; Fri, 19 Jan 2018 19:01:14 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id MswDHNv6QY-1DeevWeR; 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:54 +0300 Message-Id: <1516377654-1536-4-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 3/3] linux-gen: byteorder: use inlined version internally 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 Use always (also in ABI compat build) inlined version of byteorder conversion functions. 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 **/ .../include/odp_classification_inlines.h | 30 +++++----- platform/linux-generic/include/protocols/thash.h | 8 +-- platform/linux-generic/odp_classification.c | 2 +- platform/linux-generic/odp_ipsec.c | 66 +++++++++++----------- platform/linux-generic/odp_packet.c | 41 +++++++------- platform/linux-generic/odp_traffic_mngr.c | 13 +++-- 6 files changed, 83 insertions(+), 77 deletions(-) diff --git a/platform/linux-generic/include/odp_classification_inlines.h b/platform/linux-generic/include/odp_classification_inlines.h index c2e94c633..df664c705 100644 --- a/platform/linux-generic/include/odp_classification_inlines.h +++ b/platform/linux-generic/include/odp_classification_inlines.h @@ -19,6 +19,8 @@ extern "C" { #endif #include +#include +#include #include #include #include @@ -68,7 +70,7 @@ static inline int verify_pmr_ipv4_saddr(const uint8_t *pkt_addr, if (!pkt_hdr->p.input_flags.ipv4) return 0; ip = (const _odp_ipv4hdr_t *)(pkt_addr + pkt_hdr->p.l3_offset); - ipaddr = odp_be_to_cpu_32(ip->src_addr); + ipaddr = _odp_be_to_cpu_32(ip->src_addr); if (term_value->match.value == (ipaddr & term_value->match.mask)) return 1; @@ -84,7 +86,7 @@ static inline int verify_pmr_ipv4_daddr(const uint8_t *pkt_addr, if (!pkt_hdr->p.input_flags.ipv4) return 0; ip = (const _odp_ipv4hdr_t *)(pkt_addr + pkt_hdr->p.l3_offset); - ipaddr = odp_be_to_cpu_32(ip->dst_addr); + ipaddr = _odp_be_to_cpu_32(ip->dst_addr); if (term_value->match.value == (ipaddr & term_value->match.mask)) return 1; @@ -100,7 +102,7 @@ static inline int verify_pmr_tcp_sport(const uint8_t *pkt_addr, if (!pkt_hdr->p.input_flags.tcp) return 0; tcp = (const _odp_tcphdr_t *)(pkt_addr + pkt_hdr->p.l4_offset); - sport = odp_be_to_cpu_16(tcp->src_port); + sport = _odp_be_to_cpu_16(tcp->src_port); if (term_value->match.value == (sport & term_value->match.mask)) return 1; @@ -116,7 +118,7 @@ static inline int verify_pmr_tcp_dport(const uint8_t *pkt_addr, if (!pkt_hdr->p.input_flags.tcp) return 0; tcp = (const _odp_tcphdr_t *)(pkt_addr + pkt_hdr->p.l4_offset); - dport = odp_be_to_cpu_16(tcp->dst_port); + dport = _odp_be_to_cpu_16(tcp->dst_port); if (term_value->match.value == (dport & term_value->match.mask)) return 1; @@ -132,7 +134,7 @@ static inline int verify_pmr_udp_dport(const uint8_t *pkt_addr, if (!pkt_hdr->p.input_flags.udp) return 0; udp = (const _odp_udphdr_t *)(pkt_addr + pkt_hdr->p.l4_offset); - dport = odp_be_to_cpu_16(udp->dst_port); + dport = _odp_be_to_cpu_16(udp->dst_port); if (term_value->match.value == (dport & term_value->match.mask)) return 1; @@ -149,7 +151,7 @@ static inline int verify_pmr_udp_sport(const uint8_t *pkt_addr, if (!pkt_hdr->p.input_flags.udp) return 0; udp = (const _odp_udphdr_t *)(pkt_addr + pkt_hdr->p.l4_offset); - sport = odp_be_to_cpu_16(udp->src_port); + sport = _odp_be_to_cpu_16(udp->src_port); if (term_value->match.value == (sport & term_value->match.mask)) return 1; @@ -169,9 +171,9 @@ static inline int verify_pmr_dmac(const uint8_t *pkt_addr, eth = (const _odp_ethhdr_t *)(pkt_addr + pkt_hdr->p.l2_offset); memcpy(&dmac_be, eth->dst.addr, _ODP_ETHADDR_LEN); - dmac = odp_be_to_cpu_64(dmac_be); + dmac = _odp_be_to_cpu_64(dmac_be); /* since we are converting a 48 bit ethernet address from BE to cpu - format using odp_be_to_cpu_64() the last 16 bits needs to be right + format using _odp_be_to_cpu_64() the last 16 bits needs to be right shifted */ if (dmac_be != dmac) dmac = dmac >> (64 - (_ODP_ETHADDR_LEN * 8)); @@ -245,7 +247,7 @@ static inline int verify_pmr_vlan_id_0(const uint8_t *pkt_addr, eth = (const _odp_ethhdr_t *)(pkt_addr + pkt_hdr->p.l2_offset); vlan = (const _odp_vlanhdr_t *)(eth + 1); - tci = odp_be_to_cpu_16(vlan->tci); + tci = _odp_be_to_cpu_16(vlan->tci); vlan_id = tci & 0x0fff; if (term_value->match.value == (vlan_id & term_value->match.mask)) @@ -269,7 +271,7 @@ static inline int verify_pmr_vlan_id_x(const uint8_t *pkt_addr ODP_UNUSED, eth = (const _odp_ethhdr_t *)(pkt_addr + pkt_hdr->p.l2_offset); vlan = (const _odp_vlanhdr_t *)(eth + 1); vlan++; - tci = odp_be_to_cpu_16(vlan->tci); + tci = _odp_be_to_cpu_16(vlan->tci); vlan_id = tci & 0x0fff; if (term_value->match.value == (vlan_id & term_value->match.mask)) @@ -289,11 +291,11 @@ static inline int verify_pmr_ipsec_spi(const uint8_t *pkt_addr, if (pkt_hdr->p.input_flags.ipsec_ah) { const _odp_ahhdr_t *ahhdr = (const _odp_ahhdr_t *)pkt_addr; - spi = odp_be_to_cpu_32(ahhdr->spi); + spi = _odp_be_to_cpu_32(ahhdr->spi); } else if (pkt_hdr->p.input_flags.ipsec_esp) { const _odp_esphdr_t *esphdr = (const _odp_esphdr_t *)pkt_addr; - spi = odp_be_to_cpu_32(esphdr->spi); + spi = _odp_be_to_cpu_32(esphdr->spi); } else { return 0; } @@ -343,7 +345,7 @@ static inline int verify_pmr_eth_type_0(const uint8_t *pkt_addr, return 0; eth = (const _odp_ethhdr_t *)(pkt_addr + pkt_hdr->p.l2_offset); - ethtype = odp_be_to_cpu_16(eth->type); + ethtype = _odp_be_to_cpu_16(eth->type); if (term_value->match.value == (ethtype & term_value->match.mask)) return 1; @@ -364,7 +366,7 @@ static inline int verify_pmr_eth_type_x(const uint8_t *pkt_addr, eth = (const _odp_ethhdr_t *)(pkt_addr + pkt_hdr->p.l2_offset); vlan = (const _odp_vlanhdr_t *)(eth + 1); - ethtype = odp_be_to_cpu_16(vlan->type); + ethtype = _odp_be_to_cpu_16(vlan->type); if (term_value->match.value == (ethtype & term_value->match.mask)) return 1; diff --git a/platform/linux-generic/include/protocols/thash.h b/platform/linux-generic/include/protocols/thash.h index c938e67ea..6b07d4e4e 100644 --- a/platform/linux-generic/include/protocols/thash.h +++ b/platform/linux-generic/include/protocols/thash.h @@ -67,10 +67,10 @@ void thash_load_ipv6_addr(const _odp_ipv6hdr_t *ipv6, for (i = 0; i < 4; i++) { *(tuple->v6.src_addr.u32 + i) = - odp_be_to_cpu_32(*(ipv6->src_addr.u32 + i)); + _odp_be_to_cpu_32(*(ipv6->src_addr.u32 + i)); *(tuple->v6.dst_addr.u32 + i) = - odp_be_to_cpu_32(*(ipv6->dst_addr.u32 + i)); + _odp_be_to_cpu_32(*(ipv6->dst_addr.u32 + i)); } } @@ -83,9 +83,9 @@ uint32_t thash_softrss(uint32_t *tuple, uint8_t len, for (j = 0; j < len; j++) { for (i = 0; i < 32; i++) { if (tuple[j] & (1 << (31 - i))) { - ret ^= odp_cpu_to_be_32(((const uint32_t *) + ret ^= _odp_cpu_to_be_32(((const uint32_t *) key.u32)[j]) << i | (uint32_t)((uint64_t) - (odp_cpu_to_be_32(((const uint32_t *)key.u32) + (_odp_cpu_to_be_32(((const uint32_t *)key.u32) [j + 1])) >> (32 - i)); } } diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index 276430923..5aa3b84a1 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -1103,7 +1103,7 @@ cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, const uint8_t *pkt_addr, packet_hdr_has_eth(hdr)) { eth = (const _odp_ethhdr_t *)(pkt_addr + hdr->p.l2_offset); vlan = (const _odp_vlanhdr_t *)(eth + 1); - qos = odp_be_to_cpu_16(vlan->tci); + qos = _odp_be_to_cpu_16(vlan->tci); qos = ((qos >> 13) & 0x07); cos = l2_cos->cos[qos]; } diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index b023d308d..521627f1d 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -10,6 +10,8 @@ #include #include +#include +#include #include #include @@ -304,11 +306,11 @@ static int ipsec_parse_ipv4(ipsec_state_t *state, odp_packet_t pkt) odp_packet_copy_to_mem(pkt, state->ip_offset, _ODP_IPV4HDR_LEN, &ipv4hdr); - if (_ODP_IPV4HDR_IS_FRAGMENT(odp_be_to_cpu_16(ipv4hdr.frag_offset))) + if (_ODP_IPV4HDR_IS_FRAGMENT(_odp_be_to_cpu_16(ipv4hdr.frag_offset))) return -1; state->ip_hdr_len = ipv4_hdr_len(&ipv4hdr); - state->ip_tot_len = odp_be_to_cpu_16(ipv4hdr.tot_len); + state->ip_tot_len = _odp_be_to_cpu_16(ipv4hdr.tot_len); state->ip_next_hdr = ipv4hdr.proto; state->ip_next_hdr_offset = state->ip_offset + _ODP_IPV4HDR_PROTO_OFFSET; @@ -329,7 +331,7 @@ static int ipsec_parse_ipv6(ipsec_state_t *state, odp_packet_t pkt) state->ip_next_hdr = ipv6hdr.next_hdr; state->ip_next_hdr_offset = state->ip_offset + _ODP_IPV6HDR_NHDR_OFFSET; /* FIXME: Jumbo frames */ - state->ip_tot_len = odp_be_to_cpu_16(ipv6hdr.payload_len) + + state->ip_tot_len = _odp_be_to_cpu_16(ipv6hdr.payload_len) + _ODP_IPV6HDR_LEN; memcpy(state->ipv6_addr, &ipv6hdr.dst_addr, _ODP_IPV6ADDR_LEN); @@ -432,8 +434,8 @@ static int ipsec_in_esp(odp_packet_t *pkt, odp_packet_copy_to_mem(*pkt, ipsec_offset, _ODP_UDPHDR_LEN, &udp); - if (udp.dst_port != odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT) || - udp.length != odp_cpu_to_be_16(ip_data_len)) { + if (udp.dst_port != _odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT) || + udp.length != _odp_cpu_to_be_16(ip_data_len)) { status->error.proto = 1; return -1; } @@ -450,7 +452,7 @@ static int ipsec_in_esp(odp_packet_t *pkt, } ipsec_sa = ipsec_get_sa(sa, ODP_IPSEC_ESP, - odp_be_to_cpu_32(esp.spi), + _odp_be_to_cpu_32(esp.spi), state->is_ipv4 ? ODP_IPSEC_IPV4 : ODP_IPSEC_IPV6, &state->ipv4_addr, status); @@ -481,7 +483,7 @@ static int ipsec_in_esp(odp_packet_t *pkt, state->esp.aad.spi = esp.spi; state->esp.aad.seq_no = esp.seq_no; - state->in.seq_no = odp_be_to_cpu_32(esp.seq_no); + state->in.seq_no = _odp_be_to_cpu_32(esp.seq_no); param->aad_ptr = (uint8_t *)&state->esp.aad; @@ -546,7 +548,7 @@ static int ipsec_in_ah(odp_packet_t *pkt, } ipsec_sa = ipsec_get_sa(sa, ODP_IPSEC_AH, - odp_be_to_cpu_32(ah.spi), + _odp_be_to_cpu_32(ah.spi), state->is_ipv4 ? ODP_IPSEC_IPV4 : ODP_IPSEC_IPV6, &state->ipv4_addr, status); @@ -587,11 +589,11 @@ static int ipsec_in_ah(odp_packet_t *pkt, state->ah_ipv6.ver_tc_flow = ipv6hdr->ver_tc_flow; state->ah_ipv6.hop_limit = ipv6hdr->hop_limit; ipv6hdr->ver_tc_flow = - odp_cpu_to_be_32(6 << _ODP_IPV6HDR_VERSION_SHIFT); + _odp_cpu_to_be_32(6 << _ODP_IPV6HDR_VERSION_SHIFT); ipv6hdr->hop_limit = 0; } - state->in.seq_no = odp_be_to_cpu_32(ah.seq_no); + state->in.seq_no = _odp_be_to_cpu_32(ah.seq_no); param->auth_range.offset = state->ip_offset; param->auth_range.length = state->ip_tot_len; @@ -794,7 +796,7 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, _odp_ipv4hdr_t *ipv4hdr = odp_packet_l3_ptr(pkt, NULL); if (ODP_IPSEC_MODE_TRANSPORT == ipsec_sa->mode) - ipv4hdr->tot_len = odp_cpu_to_be_16(state.ip_tot_len); + ipv4hdr->tot_len = _odp_cpu_to_be_16(state.ip_tot_len); else ipv4hdr->ttl -= ipsec_sa->dec_ttl; _odp_ipv4_csum_update(pkt); @@ -803,8 +805,8 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, if (ODP_IPSEC_MODE_TRANSPORT == ipsec_sa->mode) ipv6hdr->payload_len = - odp_cpu_to_be_16(state.ip_tot_len - - _ODP_IPV6HDR_LEN); + _odp_cpu_to_be_16(state.ip_tot_len - + _ODP_IPV6HDR_LEN); else ipv6hdr->hop_limit -= ipsec_sa->dec_ttl; } else { @@ -849,7 +851,7 @@ static int ipsec_out_tunnel_parse_ipv4(ipsec_state_t *state, ipsec_sa_t *ipsec_sa) { _odp_ipv4hdr_t *ipv4hdr = state->ip; - uint16_t flags = odp_be_to_cpu_16(ipv4hdr->frag_offset); + uint16_t flags = _odp_be_to_cpu_16(ipv4hdr->frag_offset); ipv4hdr->ttl -= ipsec_sa->dec_ttl; state->out_tunnel.ip_tos = ipv4hdr->tos; @@ -894,7 +896,7 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, state->ip_tot_len = odp_packet_len(*pkt) - state->ip_offset; state->ip_tot_len += _ODP_IPV4HDR_LEN; - out_ip.tot_len = odp_cpu_to_be_16(state->ip_tot_len); + out_ip.tot_len = _odp_cpu_to_be_16(state->ip_tot_len); /* No need to convert to BE: ID just should not be duplicated */ out_ip.id = odp_atomic_fetch_add_u32(&ipsec_sa->out.tun_ipv4.hdr_id, 1); @@ -902,7 +904,7 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, flags = state->out_tunnel.ip_df; else flags = ((uint16_t)ipsec_sa->out.tun_ipv4.df) << 14; - out_ip.frag_offset = odp_cpu_to_be_16(flags); + out_ip.frag_offset = _odp_cpu_to_be_16(flags); out_ip.ttl = ipsec_sa->out.tun_ipv4.ttl; /* Will be filled later by packet checksum update */ out_ip.chksum = 0; @@ -957,7 +959,7 @@ static int ipsec_out_tunnel_ipv6(odp_packet_t *pkt, out_ip.ver_tc_flow = odp_cpu_to_be_32(ver); state->ip_tot_len = odp_packet_len(*pkt) - state->ip_offset; - out_ip.payload_len = odp_cpu_to_be_16(state->ip_tot_len); + out_ip.payload_len = _odp_cpu_to_be_16(state->ip_tot_len); state->ip_tot_len += _ODP_IPV6HDR_LEN; out_ip.hop_limit = ipsec_sa->out.tun_ipv6.hlimit; @@ -1062,10 +1064,10 @@ static int ipsec_out_esp(odp_packet_t *pkt, if (ipsec_sa->udp_encap) { hdr_len += _ODP_UDPHDR_LEN; proto = _ODP_IPPROTO_UDP; - udphdr.src_port = odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT); - udphdr.dst_port = odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT); - udphdr.length = odp_cpu_to_be_16(ip_data_len + - hdr_len + trl_len); + udphdr.src_port = _odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT); + udphdr.dst_port = _odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT); + udphdr.length = _odp_cpu_to_be_16(ip_data_len + + hdr_len + trl_len); udphdr.chksum = 0; /* should be 0 by RFC */ } @@ -1082,8 +1084,8 @@ static int ipsec_out_esp(odp_packet_t *pkt, param->override_iv_ptr = state->iv; memset(&esp, 0, sizeof(esp)); - esp.spi = odp_cpu_to_be_32(ipsec_sa->spi); - esp.seq_no = odp_cpu_to_be_32(ipsec_seq_no(ipsec_sa)); + esp.spi = _odp_cpu_to_be_32(ipsec_sa->spi); + esp.seq_no = _odp_cpu_to_be_32(ipsec_seq_no(ipsec_sa)); state->esp.aad.spi = esp.spi; state->esp.aad.seq_no = esp.seq_no; @@ -1099,12 +1101,12 @@ static int ipsec_out_esp(odp_packet_t *pkt, if (state->is_ipv4) { _odp_ipv4hdr_t *ipv4hdr = state->ip; - ipv4hdr->tot_len = odp_cpu_to_be_16(state->ip_tot_len); + ipv4hdr->tot_len = _odp_cpu_to_be_16(state->ip_tot_len); } else { _odp_ipv6hdr_t *ipv6hdr = state->ip; - ipv6hdr->payload_len = odp_cpu_to_be_16(state->ip_tot_len - - _ODP_IPV6HDR_LEN); + ipv6hdr->payload_len = _odp_cpu_to_be_16(state->ip_tot_len - + _ODP_IPV6HDR_LEN); } if (odp_packet_extend_tail(pkt, trl_len, NULL, NULL) < 0 || @@ -1187,8 +1189,8 @@ static int ipsec_out_ah(odp_packet_t *pkt, } memset(&ah, 0, sizeof(ah)); - ah.spi = odp_cpu_to_be_32(ipsec_sa->spi); - ah.seq_no = odp_cpu_to_be_32(ipsec_seq_no(ipsec_sa)); + ah.spi = _odp_cpu_to_be_32(ipsec_sa->spi); + ah.seq_no = _odp_cpu_to_be_32(ipsec_seq_no(ipsec_sa)); ah.next_header = state->ip_next_hdr; odp_packet_copy_from_mem(*pkt, state->ip_next_hdr_offset, 1, &proto); @@ -1205,20 +1207,20 @@ static int ipsec_out_ah(odp_packet_t *pkt, ipv4hdr->ttl = 0; hdr_len = IPSEC_PAD_LEN(hdr_len, 4); state->ip_tot_len += hdr_len; - ipv4hdr->tot_len = odp_cpu_to_be_16(state->ip_tot_len); + ipv4hdr->tot_len = _odp_cpu_to_be_16(state->ip_tot_len); } else { _odp_ipv6hdr_t *ipv6hdr = state->ip; state->ah_ipv6.ver_tc_flow = ipv6hdr->ver_tc_flow; state->ah_ipv6.hop_limit = ipv6hdr->hop_limit; ipv6hdr->ver_tc_flow = - odp_cpu_to_be_32(6 << _ODP_IPV6HDR_VERSION_SHIFT); + _odp_cpu_to_be_32(6 << _ODP_IPV6HDR_VERSION_SHIFT); ipv6hdr->hop_limit = 0; hdr_len = IPSEC_PAD_LEN(hdr_len, 8); state->ip_tot_len += hdr_len; - ipv6hdr->payload_len = odp_cpu_to_be_16(state->ip_tot_len - - _ODP_IPV6HDR_LEN); + ipv6hdr->payload_len = _odp_cpu_to_be_16(state->ip_tot_len - + _ODP_IPV6HDR_LEN); } ah.ah_len = hdr_len / 4 - 2; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 77765fb89..a4cd05f62 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -1964,16 +1965,16 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr, eth = (const _odp_ethhdr_t *)*parseptr; /* Handle Ethernet broadcast/multicast addresses */ - macaddr0 = odp_be_to_cpu_16(*((const uint16_t *)(const void *)eth)); + macaddr0 = _odp_be_to_cpu_16(*((const uint16_t *)(const void *)eth)); prs->input_flags.eth_mcast = (macaddr0 & 0x0100) == 0x0100; if (macaddr0 == 0xffff) { macaddr2 = - odp_be_to_cpu_16(*((const uint16_t *) - (const void *)eth + 1)); + _odp_be_to_cpu_16(*((const uint16_t *) + (const void *)eth + 1)); macaddr4 = - odp_be_to_cpu_16(*((const uint16_t *) - (const void *)eth + 2)); + _odp_be_to_cpu_16(*((const uint16_t *) + (const void *)eth + 2)); prs->input_flags.eth_bcast = (macaddr2 == 0xffff) && (macaddr4 == 0xffff); } else { @@ -1981,7 +1982,7 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr, } /* Get Ethertype */ - ethtype = odp_be_to_cpu_16(eth->type); + ethtype = _odp_be_to_cpu_16(eth->type); *offset += sizeof(*eth); *parseptr += sizeof(*eth); @@ -1992,8 +1993,8 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr, prs->error_flags.snap_len = 1; return 0; } - ethtype = odp_be_to_cpu_16(*((const uint16_t *)(uintptr_t) - (parseptr + 6))); + ethtype = _odp_be_to_cpu_16(*((const uint16_t *)(uintptr_t) + (parseptr + 6))); *offset += 8; *parseptr += 8; } @@ -2004,7 +2005,7 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr, prs->input_flags.vlan = 1; vlan = (const _odp_vlanhdr_t *)*parseptr; - ethtype = odp_be_to_cpu_16(vlan->type); + ethtype = _odp_be_to_cpu_16(vlan->type); *offset += sizeof(_odp_vlanhdr_t); *parseptr += sizeof(_odp_vlanhdr_t); } @@ -2012,7 +2013,7 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr, if (ethtype == _ODP_ETHTYPE_VLAN) { prs->input_flags.vlan = 1; vlan = (const _odp_vlanhdr_t *)*parseptr; - ethtype = odp_be_to_cpu_16(vlan->type); + ethtype = _odp_be_to_cpu_16(vlan->type); *offset += sizeof(_odp_vlanhdr_t); *parseptr += sizeof(_odp_vlanhdr_t); } @@ -2030,8 +2031,8 @@ static inline uint8_t parse_ipv4(packet_parser_t *prs, const uint8_t **parseptr, uint8_t ver = _ODP_IPV4HDR_VER(ipv4->ver_ihl); uint8_t ihl = _ODP_IPV4HDR_IHL(ipv4->ver_ihl); uint16_t frag_offset; - uint32_t dstaddr = odp_be_to_cpu_32(ipv4->dst_addr); - uint32_t l3_len = odp_be_to_cpu_16(ipv4->tot_len); + uint32_t dstaddr = _odp_be_to_cpu_32(ipv4->dst_addr); + uint32_t l3_len = _odp_be_to_cpu_16(ipv4->tot_len); if (odp_unlikely(ihl < _ODP_IPV4HDR_IHL_MIN) || odp_unlikely(ver != 4) || @@ -2051,7 +2052,7 @@ static inline uint8_t parse_ipv4(packet_parser_t *prs, const uint8_t **parseptr, * OR * "fragment offset" field is nonzero (all fragments except the first) */ - frag_offset = odp_be_to_cpu_16(ipv4->frag_offset); + frag_offset = _odp_be_to_cpu_16(ipv4->frag_offset); if (odp_unlikely(_ODP_IPV4HDR_IS_FRAGMENT(frag_offset))) prs->input_flags.ipfrag = 1; @@ -2071,12 +2072,12 @@ static inline uint8_t parse_ipv6(packet_parser_t *prs, const uint8_t **parseptr, { const _odp_ipv6hdr_t *ipv6 = (const _odp_ipv6hdr_t *)*parseptr; const _odp_ipv6hdr_ext_t *ipv6ext; - uint32_t dstaddr0 = odp_be_to_cpu_32(ipv6->dst_addr.u8[0]); - uint32_t l3_len = odp_be_to_cpu_16(ipv6->payload_len) + - _ODP_IPV6HDR_LEN; + uint32_t dstaddr0 = _odp_be_to_cpu_32(ipv6->dst_addr.u8[0]); + uint32_t l3_len = _odp_be_to_cpu_16(ipv6->payload_len) + + _ODP_IPV6HDR_LEN; /* Basic sanity checks on IPv6 header */ - if ((odp_be_to_cpu_32(ipv6->ver_tc_flow) >> 28) != 6 || + if ((_odp_be_to_cpu_32(ipv6->ver_tc_flow) >> 28) != 6 || l3_len > frame_len - *offset) { prs->error_flags.ip_err = 1; return 0; @@ -2106,7 +2107,7 @@ static inline uint8_t parse_ipv6(packet_parser_t *prs, const uint8_t **parseptr, *offset < seg_len); if (*offset >= prs->l3_offset + - odp_be_to_cpu_16(ipv6->payload_len)) { + _odp_be_to_cpu_16(ipv6->payload_len)) { prs->error_flags.ip_err = 1; return 0; } @@ -2150,12 +2151,12 @@ static inline void parse_udp(packet_parser_t *prs, const uint8_t **parseptr, uint32_t *offset) { const _odp_udphdr_t *udp = (const _odp_udphdr_t *)*parseptr; - uint32_t udplen = odp_be_to_cpu_16(udp->length); + uint32_t udplen = _odp_be_to_cpu_16(udp->length); if (odp_unlikely(udplen < sizeof(_odp_udphdr_t))) prs->error_flags.udp_err = 1; - if (odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT) == udp->dst_port && + if (_odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT) == udp->dst_port && udplen > 4) { uint32_t val; diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index 556b2a1f2..557e77ba3 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -27,6 +27,7 @@ #include #include #include +#include /* Local vars */ static const @@ -1945,7 +1946,7 @@ static void egress_vlan_marking(tm_vlan_marking_t *vlan_marking, vlan_hdr_ptr = &vlan_hdr; } - old_tci = odp_be_to_cpu_16(vlan_hdr_ptr->tci); + old_tci = _odp_be_to_cpu_16(vlan_hdr_ptr->tci); new_tci = old_tci; if (vlan_marking->drop_eligible_enabled) new_tci |= _ODP_VLANHDR_DEI_MASK; @@ -1953,7 +1954,7 @@ static void egress_vlan_marking(tm_vlan_marking_t *vlan_marking, if (new_tci == old_tci) return; - vlan_hdr_ptr->tci = odp_cpu_to_be_16(new_tci); + vlan_hdr_ptr->tci = _odp_cpu_to_be_16(new_tci); if (split_hdr) odp_packet_copy_from_mem(odp_pkt, _ODP_ETHHDR_LEN, _ODP_VLANHDR_LEN, &vlan_hdr); @@ -2010,7 +2011,7 @@ static void egress_ipv4_tos_marking(tm_tos_marking_t *tos_marking, * in this specific case the carry out check does NOT need to be * repeated since it can be proven that the carry in sum cannot * cause another carry out. */ - old_chksum = (uint32_t)odp_be_to_cpu_16(ipv4_hdr_ptr->chksum); + old_chksum = (uint32_t)_odp_be_to_cpu_16(ipv4_hdr_ptr->chksum); ones_compl_sum = (~old_chksum) & 0xFFFF; tos_diff = ((uint32_t)new_tos) + ((~(uint32_t)old_tos) & 0xFFFF); ones_compl_sum += tos_diff; @@ -2019,7 +2020,7 @@ static void egress_ipv4_tos_marking(tm_tos_marking_t *tos_marking, (ones_compl_sum & 0xFFFF); ipv4_hdr_ptr->tos = new_tos; - ipv4_hdr_ptr->chksum = odp_cpu_to_be_16((~ones_compl_sum) & 0xFFFF); + ipv4_hdr_ptr->chksum = _odp_cpu_to_be_16((~ones_compl_sum) & 0xFFFF); if (split_hdr) odp_packet_copy_from_mem(odp_pkt, l3_offset, _ODP_IPV4HDR_LEN, &ipv4_hdr); @@ -2050,7 +2051,7 @@ static void egress_ipv6_tc_marking(tm_tos_marking_t *tos_marking, ipv6_hdr_ptr = &ipv6_hdr; } - old_ver_tc_flow = odp_be_to_cpu_32(ipv6_hdr_ptr->ver_tc_flow); + old_ver_tc_flow = _odp_be_to_cpu_32(ipv6_hdr_ptr->ver_tc_flow); old_tc = (old_ver_tc_flow & _ODP_IPV6HDR_TC_MASK) >> _ODP_IPV6HDR_TC_SHIFT; new_tc = old_tc; @@ -2071,7 +2072,7 @@ static void egress_ipv6_tc_marking(tm_tos_marking_t *tos_marking, new_ver_tc_flow = (old_ver_tc_flow & ~_ODP_IPV6HDR_TC_MASK) | (new_tc << _ODP_IPV6HDR_TC_SHIFT); - ipv6_hdr_ptr->ver_tc_flow = odp_cpu_to_be_32(new_ver_tc_flow); + ipv6_hdr_ptr->ver_tc_flow = _odp_cpu_to_be_32(new_ver_tc_flow); if (split_hdr) odp_packet_copy_from_mem(odp_pkt, l3_offset,