From patchwork Wed Feb 8 12:17:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 93628 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp2702692obz; Wed, 8 Feb 2017 04:24:59 -0800 (PST) X-Received: by 10.107.47.195 with SMTP id v64mr8251858iov.85.1486556699012; Wed, 08 Feb 2017 04:24:59 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 19si14559126ioj.58.2017.02.08.04.24.58; Wed, 08 Feb 2017 04:24:58 -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 6394D634DF; Wed, 8 Feb 2017 12:24:58 +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.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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 18C7A634D0; Wed, 8 Feb 2017 12:19:17 +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 3C9A663489; Wed, 8 Feb 2017 12:19:01 +0000 (UTC) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0111.outbound.protection.outlook.com [104.47.0.111]) by lists.linaro.org (Postfix) with ESMTPS id 5B05F63008 for ; Wed, 8 Feb 2017 12:18:11 +0000 (UTC) Received: from VI1PR07CA0056.eurprd07.prod.outlook.com (10.164.94.152) by DB5PR07MB1622.eurprd07.prod.outlook.com (10.166.12.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.5; Wed, 8 Feb 2017 12:18:08 +0000 Received: from AM1FFO11FD044.protection.gbl (2a01:111:f400:7e00::182) by VI1PR07CA0056.outlook.office365.com (2a01:111:e400:5967::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.5 via Frontend Transport; Wed, 8 Feb 2017 12:18:08 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning linaro.org discourages use of 131.228.2.35 as permitted sender) Received: from hybrid2.ext.net.nokia.com (131.228.2.35) by AM1FFO11FD044.mail.protection.outlook.com (10.174.64.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.7 via Frontend Transport; Wed, 8 Feb 2017 12:18:08 +0000 Received: from fihe3nok1348.nsn-intra.net (10.158.36.136) by fihe3nok1346.nsn-intra.net (10.158.36.134) with Microsoft SMTP Server (TLS) id 15.1.466.34; Wed, 8 Feb 2017 14:18:05 +0200 Received: from mailrelay.int.nokia.com (10.130.128.21) by fihe3nok1348.nsn-intra.net (10.158.36.136) with Microsoft SMTP Server (TLS) id 15.1.466.34 via Frontend Transport; Wed, 8 Feb 2017 14:18:04 +0200 Received: from fihe3nok0734.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id v18CHaWT022765 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 8 Feb 2017 14:17:36 +0200 Received: from 10.144.19.15 ([10.144.104.219]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id v18CHavw022737 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Wed, 8 Feb 2017 14:17:36 +0200 X-HPESVCS-Source-Ip: 10.144.104.219 From: Petri Savolainen To: Date: Wed, 8 Feb 2017 14:17:35 +0200 Message-ID: <1486556256-22167-5-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1486556256-22167-1-git-send-email-petri.savolainen@linaro.org> References: <1486556256-22167-1-git-send-email-petri.savolainen@linaro.org> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.35; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(39850400002)(39450400003)(39410400002)(39860400002)(39840400002)(2980300002)(199003)(189002)(36756003)(76176999)(50986999)(33646002)(47776003)(2351001)(5003940100001)(105596002)(97736004)(189998001)(2950100002)(5660300001)(6916009)(77096006)(92566002)(356003)(626004)(305945005)(81166006)(50226002)(81156014)(8676002)(8936002)(450100001)(48376002)(53936002)(68736007)(50466002)(110136004)(38730400002)(575784001)(2906002)(86362001)(106466001)(22756006); DIR:OUT; SFP:1102; SCL:1; SRVR:DB5PR07MB1622; H:hybrid2.ext.net.nokia.com; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD044; 1:t0XcaYHl8T2TyG/RLZDj3kHY4oNXraf0+vrRrCFQA2LZr4jUL42jCywvI1zXOGEsSTsy4fWkFpQkIWlawMErtDgy/P/EJ+LVdaQAWnK1fUmiwqbsSavhCz+7Lo4a2oc827zLF56G2Ltj4hsVJoVEkEt6RvmScdDZc/tD1L+N62eMKSz2+uNK8Wlt3vBY7abFsxegn+hjFQjV5i4fk6D1rm980AXyKHgL4+rKWT9pVoip63ARkMmWE/SrYb3xzMXo5Xtj65z2G0Hfi6L3AUMvbTRMAePQ9VgJBBfw6txv30bPPe+lI1fupYRLoqwM4LYYf9+jkrOPhZzcZeE3md8BqHxTd/r5+TS0ktHS35IkNk4KjZphivHfIi78fLqP9wCexFGgtPzUdMqIbTH9wzlRG9ljGZJmiDfaArsG/syxOBdKJ7ztoeqvQJ32naOeVhuVjSMQ3nb/wGrcXB/lSC8yvtqFGokyVc13NrbMO6/6v7c6weLPp+8a0Vn245SG6HyiTMSmmNklDRNNo4icrOEu6w== X-MS-Office365-Filtering-Correlation-Id: 1ff64bb7-7efa-4047-3d49-08d4501c8acc X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DB5PR07MB1622; X-Microsoft-Exchange-Diagnostics: 1; DB5PR07MB1622; 3:1c/lceB3ZI0QeIKRiQvgBoa+IGPJ6wtP2DR3sweLnLMOQzs8pMRi0sOOA/09F+mF82kZ93yJcY9Hdo8ZTULmIad2IyWVxyXXXZmdNOLYUtCB4mQGC3UWn7+aoNoNQS3X/B82Iumg99CtSrASmGOorZv5qBk2ittHMHusSFpIKVuqYNDUzScnYvY2A0BDsOlIb2pOjpCz4RpSNFUlECvwSYNRj+VNq5fiYlZ681G5cpasq9dLYsnae4O6h3cQVJCHOxkH5eUWU3BzDVShH7TMeVeNY4G5Ygt8N3v2aaCbyl0co2xfMYkxPg3IVI0ZBLrWtsS000EHHHEGb0JyP4yDwfThnYwjgO+yNOap2KRGN/8=; 25:siRuZGoUDd0MNKuEkIty6mSZnHSte1c9Xh7X4kkGCAv4ruhPuhyB6NMJA/atjjnL13HeL5MsUhHQ0KrVHv2q5QyqlrnX31xRzkFsNQfq+XaDVO3oiEd4l+2G4Xx87quF6gDQJF7Y/4GiIOp4gmZ0DcS6yifVwz2nC6PXhv2fpvXnzVCEs6+PBQ3bkvx1nXfSZPu+Kk4O06RNkq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693QPznVH39MV7NgnuiIrkp/HqXL/XYOVFy0rOEHch0s6phCr0RbEt2NmNmwCv1xZ+vVG8B1o7Qqk54YCb2Vn0YKDYIk7bDs/jIoB6RoBo3nDEWrut72wgvMMnWjBrRIS2y7D7Fa4Jxo8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13016025)(5005006)(20170203043)(8121501046)(2017020702029)(13018025)(10201501046)(3002001)(6055026)(6041248)(20161123558025)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6072148); SRVR:DB5PR07MB1622; BCL:0; PCL:0; RULEID:; SRVR:DB5PR07MB1622; X-Microsoft-Exchange-Diagnostics: 1; DB5PR07MB1622; 4:ZBJfgZYw+kaKfggVZe7buEaBrKRXWYMEbZSQHdJVkfv98E3ovvB3bEd1IYZsxTpzj3AaJ5e/P0T7hBMFTbc2KkwceuM4h3L6Sb5DFB+m8DIbuffOqMWJyFtKMdnK3vp87QO+8CtwzBI5t1X0ixoLnTPEb50fPrCBBlqI44MDYCsvyJxiwP83CJQ9Mf+XNETzJvZYl8oTNXSYhzpBkFOOjKeGU6Y0vdL6PuILyZt+LwIZMTtgsgXscetL4Mz/0C63dpSuiu8J3gcXxBQr7En6ZY+E+g9VIqoqBoL9CQzRWYq9cJ5UxtK0gBh9FNMD1F2W+mKibwoRK4snxWIy2Xiy/aeldICoooFjnm4KBtlhanGRILpb7Zj8X6xCyl/U5CrPGM//4o5mA+jc+Xs9ATcLDWMr0/8oAtTphR/FFw6jbihKcxLdI+64Npr/IGbkb4KRBIksM7CGwSAFb3XcHSaXtwsdhRY5Ih3aDJV62QORJWL6cGbIifs4w67TBWIkqyJJo4JreyOo2Ag1KU35OzLfm7bMpt0JtKb3ag5nT/MyeFo69/x4NCYFBKcKdMkwMHGVoUon3ynUZCgFf4LkdV1Avx0Paj/3vQ5sRTgEJxYbQicMQCxS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ics: 1; DB5PR07MB1622; 7:BWdWkDidP3NySZh4g5auhEJG4DQ/Ehxb9gSP7BwhLUYxr0vBWBE6UlqRetUfwF7pVf11O7ypp2svMMP/qvQq+ADRkn4nCN9ggdXoaE+cp2xH+webf6Ivrru3jSvO2vpfTLKgalC8cXBEp0kllQB4ev5tMiQWnJwFa5FqXnuV1kJcFeJcrqvLvuXKFwhL7IkpalCyy9iXDbZ5acyVwWYw1B3x4NTNhiJ9jBMTogK0DnTvPTwI/biKu37iZbOq1V0UXiIOExebzdKUyudx61OcO4Y0qDhEu81jefaRUAzh5wtEP7A8BSDreTC2M2TQTkbApxz5ahxwrowpweZGkBt6FQnxZZBA0olFDQKaqV8gaKNz9+kgstq0SLQdmWKNGY06zg8pRYq3JGEO7GdD9WTZm1R81wiGS5Lgykh8tT/o+vZmNZEly6e532zDbeFgIU6x7CDQC2XfTw6aHEkK2JWFzV9MX2hM0YbxmeUeWoSnrO9JDw64wn/bSdB/H25gFjVzWaEll5Nebxtd6/kyO7iBiQ== X-OriginatorOrg: nokia.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2017 12:18:08.3405 (UTC) X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.35]; Helo=[hybrid2.ext.net.nokia.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR07MB1622 Subject: [lng-odp] [PATCH v2 4/5] linux-gen: packet: 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" Added first inlined packet functions. Functions are allways used inlined within the implementation. Applications see inlined versions only when ABI compatibility is disabled. Signed-off-by: Petri Savolainen --- platform/linux-generic/Makefile.am | 2 + platform/linux-generic/include/odp/api/packet.h | 11 +- .../include/odp/api/plat/packet_inlines.h | 173 +++++++++++++++++++++ .../include/odp/api/plat/packet_inlines_api.h | 113 ++++++++++++++ .../include/odp/api/plat/packet_types.h | 33 ++++ platform/linux-generic/odp_packet.c | 147 ++++------------- platform/linux-generic/pktio/dpdk.c | 5 +- platform/linux-generic/pktio/netmap.c | 5 +- test/common_plat/performance/Makefile.am | 4 + 9 files changed, 363 insertions(+), 130 deletions(-) create mode 100644 platform/linux-generic/include/odp/api/plat/packet_inlines.h create mode 100644 platform/linux-generic/include/odp/api/plat/packet_inlines_api.h -- 2.8.1 diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 64b0287..812b22c 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -78,6 +78,8 @@ odpapiplatinclude_HEADERS = \ $(srcdir)/include/odp/api/plat/crypto_types.h \ $(srcdir)/include/odp/api/plat/event_types.h \ $(srcdir)/include/odp/api/plat/init_types.h \ + $(srcdir)/include/odp/api/plat/packet_inlines.h \ + $(srcdir)/include/odp/api/plat/packet_inlines_api.h \ $(srcdir)/include/odp/api/plat/packet_types.h \ $(srcdir)/include/odp/api/plat/packet_io_types.h \ $(srcdir)/include/odp/api/plat/pool_types.h \ diff --git a/platform/linux-generic/include/odp/api/packet.h b/platform/linux-generic/include/odp/api/packet.h index ebbeaf1..eff4080 100644 --- a/platform/linux-generic/include/odp/api/packet.h +++ b/platform/linux-generic/include/odp/api/packet.h @@ -24,13 +24,10 @@ extern "C" { #include #include -/** @ingroup odp_packet - * @{ - */ - -/** - * @} - */ +#include +#if ODP_ABI_COMPAT == 0 +#include +#endif #include diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h new file mode 100644 index 0000000..eb36aa9 --- /dev/null +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -0,0 +1,173 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * Packet inline functions + */ + +#ifndef _ODP_PLAT_PACKET_INLINES_H_ +#define _ODP_PLAT_PACKET_INLINES_H_ + +#include +#include +#include +#include + +/** @internal Inline function offsets */ +extern const _odp_packet_inline_offset_t _odp_packet_inline; + +/** @internal Inline function @param pkt @return */ +static inline void *_odp_packet_data(odp_packet_t pkt) +{ + return *(void **)(uintptr_t)((uint8_t *)pkt + _odp_packet_inline.data); +} + +/** @internal Inline function @param pkt @return */ +static inline uint32_t _odp_packet_seg_len(odp_packet_t pkt) +{ + return *(uint32_t *)(uintptr_t)((uint8_t *)pkt + + _odp_packet_inline.seg_len); +} + +/** @internal Inline function @param pkt @return */ +static inline uint32_t _odp_packet_len(odp_packet_t pkt) +{ + return *(uint32_t *)(uintptr_t)((uint8_t *)pkt + + _odp_packet_inline.frame_len); +} + +/** @internal Inline function @param pkt @return */ +static inline uint32_t _odp_packet_headroom(odp_packet_t pkt) +{ + return *(uint32_t *)(uintptr_t)((uint8_t *)pkt + + _odp_packet_inline.headroom); +} + +/** @internal Inline function @param pkt @return */ +static inline uint32_t _odp_packet_tailroom(odp_packet_t pkt) +{ + return *(uint32_t *)(uintptr_t)((uint8_t *)pkt + + _odp_packet_inline.tailroom); +} + +/** @internal Inline function @param pkt @return */ +static inline odp_pool_t _odp_packet_pool(odp_packet_t pkt) +{ + return *(odp_pool_t *)(uintptr_t)((uint8_t *)pkt + + _odp_packet_inline.pool); +} + +/** @internal Inline function @param pkt @return */ +static inline odp_pktio_t _odp_packet_input(odp_packet_t pkt) +{ + return *(odp_pktio_t *)(uintptr_t)((uint8_t *)pkt + + _odp_packet_inline.input); +} + +/** @internal Inline function @param pkt @return */ +static inline int _odp_packet_num_segs(odp_packet_t pkt) +{ + return *(uint8_t *)(uintptr_t)((uint8_t *)pkt + + _odp_packet_inline.segcount); +} + +/** @internal Inline function @param pkt @return */ +static inline void *_odp_packet_user_ptr(odp_packet_t pkt) +{ + return *(void **)(uintptr_t)((uint8_t *)pkt + + _odp_packet_inline.user_ptr); +} + +/** @internal Inline function @param pkt @return */ +static inline void *_odp_packet_user_area(odp_packet_t pkt) +{ + return *(void **)(uintptr_t)((uint8_t *)pkt + + _odp_packet_inline.user_area); +} + +/** @internal Inline function @param pkt @return */ +static inline uint32_t _odp_packet_user_area_size(odp_packet_t pkt) +{ + return *(uint32_t *)(uintptr_t)((uint8_t *)pkt + + _odp_packet_inline.user_area_size); +} + +/** @internal Inline function @param pkt @return */ +static inline uint32_t _odp_packet_flow_hash(odp_packet_t pkt) +{ + return *(uint32_t *)(uintptr_t)((uint8_t *)pkt + + _odp_packet_inline.flow_hash); +} + +/** @internal Inline function @param pkt @return */ +static inline odp_time_t _odp_packet_ts(odp_packet_t pkt) +{ + return *(odp_time_t *)(uintptr_t)((uint8_t *)pkt + + _odp_packet_inline.timestamp); +} + +/** @internal Inline function @param pkt @return */ +static inline void *_odp_packet_head(odp_packet_t pkt) +{ + return (uint8_t *)_odp_packet_data(pkt) - _odp_packet_headroom(pkt); +} + +/** @internal Inline function @param pkt @return */ +static inline int _odp_packet_is_segmented(odp_packet_t pkt) +{ + return _odp_packet_num_segs(pkt) > 1; +} + +/** @internal Inline function @param pkt @return */ +static inline odp_packet_seg_t _odp_packet_first_seg(odp_packet_t pkt) +{ + (void)pkt; + + return 0; +} + +/** @internal Inline function @param pkt @return */ +static inline odp_packet_seg_t _odp_packet_last_seg(odp_packet_t pkt) +{ + return _odp_packet_num_segs(pkt) - 1; +} + +/** @internal Inline function @param pkt @param seg @return */ +static inline odp_packet_seg_t _odp_packet_next_seg(odp_packet_t pkt, + odp_packet_seg_t seg) +{ + if (odp_unlikely(seg >= _odp_packet_last_seg(pkt))) + return ODP_PACKET_SEG_INVALID; + + return seg + 1; +} + +/** @internal Inline function @param pkt @param offset @param len */ +static inline void _odp_packet_prefetch(odp_packet_t pkt, uint32_t offset, + uint32_t len) +{ + (void)pkt; (void)offset; (void)len; +} + +/* Include inlined versions of API functions */ +#include +#if ODP_ABI_COMPAT == 0 + +/** @ingroup odp_packet + * @{ + */ + +#include + +/** + * @} + */ + +#endif + +#endif diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h new file mode 100644 index 0000000..233bc87 --- /dev/null +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h @@ -0,0 +1,113 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * Packet inline functions + */ + +#ifndef _ODP_PLAT_PACKET_INLINES_API_H_ +#define _ODP_PLAT_PACKET_INLINES_API_H_ + +_ODP_INLINE void *odp_packet_data(odp_packet_t pkt) +{ + return _odp_packet_data(pkt); +} + +_ODP_INLINE uint32_t odp_packet_seg_len(odp_packet_t pkt) +{ + return _odp_packet_seg_len(pkt); +} + +_ODP_INLINE uint32_t odp_packet_len(odp_packet_t pkt) +{ + return _odp_packet_len(pkt); +} + +_ODP_INLINE uint32_t odp_packet_headroom(odp_packet_t pkt) +{ + return _odp_packet_headroom(pkt); +} + +_ODP_INLINE uint32_t odp_packet_tailroom(odp_packet_t pkt) +{ + return _odp_packet_tailroom(pkt); +} + +_ODP_INLINE odp_pool_t odp_packet_pool(odp_packet_t pkt) +{ + return _odp_packet_pool(pkt); +} + +_ODP_INLINE odp_pktio_t odp_packet_input(odp_packet_t pkt) +{ + return _odp_packet_input(pkt); +} + +_ODP_INLINE int odp_packet_num_segs(odp_packet_t pkt) +{ + return _odp_packet_num_segs(pkt); +} + +_ODP_INLINE void *odp_packet_user_ptr(odp_packet_t pkt) +{ + return _odp_packet_user_ptr(pkt); +} + +_ODP_INLINE void *odp_packet_user_area(odp_packet_t pkt) +{ + return _odp_packet_user_area(pkt); +} + +_ODP_INLINE uint32_t odp_packet_user_area_size(odp_packet_t pkt) +{ + return _odp_packet_user_area_size(pkt); +} + +_ODP_INLINE uint32_t odp_packet_flow_hash(odp_packet_t pkt) +{ + return _odp_packet_flow_hash(pkt); +} + +_ODP_INLINE odp_time_t odp_packet_ts(odp_packet_t pkt) +{ + return _odp_packet_ts(pkt); +} + +_ODP_INLINE void *odp_packet_head(odp_packet_t pkt) +{ + return _odp_packet_head(pkt); +} + +_ODP_INLINE int odp_packet_is_segmented(odp_packet_t pkt) +{ + return _odp_packet_is_segmented(pkt); +} + +_ODP_INLINE odp_packet_seg_t odp_packet_first_seg(odp_packet_t pkt) +{ + return _odp_packet_first_seg(pkt); +} + +_ODP_INLINE odp_packet_seg_t odp_packet_last_seg(odp_packet_t pkt) +{ + return _odp_packet_last_seg(pkt); +} + +_ODP_INLINE odp_packet_seg_t odp_packet_next_seg(odp_packet_t pkt, + odp_packet_seg_t seg) +{ + return _odp_packet_next_seg(pkt, seg); +} + +_ODP_INLINE void odp_packet_prefetch(odp_packet_t pkt, uint32_t offset, + uint32_t len) +{ + return _odp_packet_prefetch(pkt, offset, len); +} + +#endif diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h b/platform/linux-generic/include/odp/api/plat/packet_types.h index 999130e..a8530bf 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_types.h @@ -18,6 +18,8 @@ extern "C" { #endif +#include + #include #if ODP_ABI_COMPAT == 1 #include @@ -55,6 +57,37 @@ typedef enum { #endif +/** @internal Packet header field offsets for inline functions */ +typedef struct _odp_packet_inline_offset_t { + /** @internal field offset */ + size_t data; + /** @internal field offset */ + size_t seg_len; + /** @internal field offset */ + size_t frame_len; + /** @internal field offset */ + size_t headroom; + /** @internal field offset */ + size_t tailroom; + /** @internal field offset */ + size_t pool; + /** @internal field offset */ + size_t input; + /** @internal field offset */ + size_t segcount; + /** @internal field offset */ + size_t user_ptr; + /** @internal field offset */ + size_t user_area; + /** @internal field offset */ + size_t user_area_size; + /** @internal field offset */ + size_t flow_hash; + /** @internal field offset */ + size_t timestamp; + +} _odp_packet_inline_offset_t; + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 9a8c112..f193ac2 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include #include #include #include @@ -23,6 +24,23 @@ /* Initial packet segment data length */ #define BASE_LEN CONFIG_PACKET_MAX_SEG_LEN +/* Fill in packet header field offsets for inline functions */ +const _odp_packet_inline_offset_t _odp_packet_inline ODP_ALIGNED_CACHE = { + .data = offsetof(odp_packet_hdr_t, buf_hdr.seg[0].data), + .seg_len = offsetof(odp_packet_hdr_t, buf_hdr.seg[0].len), + .frame_len = offsetof(odp_packet_hdr_t, frame_len), + .headroom = offsetof(odp_packet_hdr_t, headroom), + .tailroom = offsetof(odp_packet_hdr_t, tailroom), + .pool = offsetof(odp_packet_hdr_t, buf_hdr.pool_hdl), + .input = offsetof(odp_packet_hdr_t, input), + .segcount = offsetof(odp_packet_hdr_t, buf_hdr.segcount), + .user_ptr = offsetof(odp_packet_hdr_t, buf_hdr.buf_ctx), + .user_area = offsetof(odp_packet_hdr_t, buf_hdr.uarea_addr), + .user_area_size = offsetof(odp_packet_hdr_t, buf_hdr.uarea_size), + .flow_hash = offsetof(odp_packet_hdr_t, flow_hash), + .timestamp = offsetof(odp_packet_hdr_t, timestamp) +}; + static inline odp_packet_hdr_t *packet_hdr(odp_packet_t pkt) { return (odp_packet_hdr_t *)(uintptr_t)pkt; @@ -655,13 +673,6 @@ odp_event_t odp_packet_to_event(odp_packet_t pkt) * */ -void *odp_packet_head(odp_packet_t pkt) -{ - odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - - return pkt_hdr->buf_hdr.seg[0].data - pkt_hdr->headroom; -} - uint32_t odp_packet_buf_len(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); @@ -669,35 +680,6 @@ uint32_t odp_packet_buf_len(odp_packet_t pkt) return pkt_hdr->buf_hdr.size * pkt_hdr->buf_hdr.segcount; } -void *odp_packet_data(odp_packet_t pkt) -{ - odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - - return packet_data(pkt_hdr); -} - -uint32_t odp_packet_seg_len(odp_packet_t pkt) -{ - odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - - return packet_first_seg_len(pkt_hdr); -} - -uint32_t odp_packet_len(odp_packet_t pkt) -{ - return packet_hdr(pkt)->frame_len; -} - -uint32_t odp_packet_headroom(odp_packet_t pkt) -{ - return packet_hdr(pkt)->headroom; -} - -uint32_t odp_packet_tailroom(odp_packet_t pkt) -{ - return packet_hdr(pkt)->tailroom; -} - void *odp_packet_tail(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); @@ -1207,13 +1189,6 @@ void *odp_packet_offset(odp_packet_t pkt, uint32_t offset, uint32_t *len, return addr; } -/* This function is a no-op */ -void odp_packet_prefetch(odp_packet_t pkt ODP_UNUSED, - uint32_t offset ODP_UNUSED, - uint32_t len ODP_UNUSED) -{ -} - /* * * Meta-data @@ -1221,41 +1196,16 @@ void odp_packet_prefetch(odp_packet_t pkt ODP_UNUSED, * */ -odp_pool_t odp_packet_pool(odp_packet_t pkt) -{ - return packet_hdr(pkt)->buf_hdr.pool_hdl; -} - -odp_pktio_t odp_packet_input(odp_packet_t pkt) -{ - return packet_hdr(pkt)->input; -} - int odp_packet_input_index(odp_packet_t pkt) { return odp_pktio_index(packet_hdr(pkt)->input); } -void *odp_packet_user_ptr(odp_packet_t pkt) -{ - return packet_hdr(pkt)->buf_hdr.buf_ctx; -} - void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx) { packet_hdr(pkt)->buf_hdr.buf_cctx = ctx; } -void *odp_packet_user_area(odp_packet_t pkt) -{ - return packet_hdr(pkt)->buf_hdr.uarea_addr; -} - -uint32_t odp_packet_user_area_size(odp_packet_t pkt) -{ - return packet_hdr(pkt)->buf_hdr.uarea_size; -} - void *odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); @@ -1348,13 +1298,6 @@ int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset) return 0; } -uint32_t odp_packet_flow_hash(odp_packet_t pkt) -{ - odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - - return pkt_hdr->flow_hash; -} - void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t flow_hash) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); @@ -1363,13 +1306,6 @@ void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t flow_hash) pkt_hdr->p.input_flags.flow_hash = 1; } -odp_time_t odp_packet_ts(odp_packet_t pkt) -{ - odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - - return pkt_hdr->timestamp; -} - void odp_packet_ts_set(odp_packet_t pkt, odp_time_t timestamp) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); @@ -1378,42 +1314,6 @@ void odp_packet_ts_set(odp_packet_t pkt, odp_time_t timestamp) pkt_hdr->p.input_flags.timestamp = 1; } -int odp_packet_is_segmented(odp_packet_t pkt) -{ - return packet_hdr(pkt)->buf_hdr.segcount > 1; -} - -int odp_packet_num_segs(odp_packet_t pkt) -{ - odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - - return pkt_hdr->buf_hdr.segcount; -} - -odp_packet_seg_t odp_packet_first_seg(odp_packet_t pkt) -{ - (void)pkt; - - return 0; -} - -odp_packet_seg_t odp_packet_last_seg(odp_packet_t pkt) -{ - odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - - return packet_last_seg(pkt_hdr); -} - -odp_packet_seg_t odp_packet_next_seg(odp_packet_t pkt, odp_packet_seg_t seg) -{ - odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - - if (odp_unlikely(seg >= (odp_packet_seg_t)packet_last_seg(pkt_hdr))) - return ODP_PACKET_SEG_INVALID; - - return seg + 1; -} - /* * * Segment level @@ -1542,7 +1442,7 @@ int odp_packet_align(odp_packet_t *pkt, uint32_t offset, uint32_t len, return rc; (void)odp_packet_move_data(*pkt, 0, shift, - odp_packet_len(*pkt) - shift); + _odp_packet_len(*pkt) - shift); (void)odp_packet_trunc_tail(pkt, shift, NULL, NULL); return 1; @@ -1586,7 +1486,7 @@ int odp_packet_concat(odp_packet_t *dst, odp_packet_t src) int odp_packet_split(odp_packet_t *pkt, uint32_t len, odp_packet_t *tail) { - uint32_t pktlen = odp_packet_len(*pkt); + uint32_t pktlen = _odp_packet_len(*pkt); if (len >= pktlen || tail == NULL) return -1; @@ -1627,7 +1527,7 @@ odp_packet_t odp_packet_copy(odp_packet_t pkt, odp_pool_t pool) odp_packet_t odp_packet_copy_part(odp_packet_t pkt, uint32_t offset, uint32_t len, odp_pool_t pool) { - uint32_t pktlen = odp_packet_len(pkt); + uint32_t pktlen = _odp_packet_len(pkt); odp_packet_t newpkt; if (offset >= pktlen || offset + len > pktlen) @@ -2246,3 +2146,8 @@ uint64_t odp_packet_seg_to_u64(odp_packet_seg_t hdl) { return _odp_pri(hdl); } + +/* Include non-inlined versions of API functions */ +#if ODP_ABI_COMPAT == 1 +#include +#endif diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 9a9f7a4..1922109 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -14,6 +14,9 @@ #include +#include +#include + #include #include #include @@ -836,7 +839,7 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry, return 0; } for (i = 0; i < num; i++) { - pkt_len = odp_packet_len(pkt_table[i]); + pkt_len = _odp_packet_len(pkt_table[i]); if (pkt_len > pkt_dpdk->mtu) { if (i == 0) diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index 208984b..ae3db34 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -8,6 +8,9 @@ #include +#include +#include + #include #include #include @@ -806,7 +809,7 @@ static int netmap_send(pktio_entry_t *pktio_entry, int index, for (nb_tx = 0; nb_tx < num; nb_tx++) { pkt = pkt_table[nb_tx]; - pkt_len = odp_packet_len(pkt); + pkt_len = _odp_packet_len(pkt); if (pkt_len > pkt_nm->mtu) { if (nb_tx == 0) diff --git a/test/common_plat/performance/Makefile.am b/test/common_plat/performance/Makefile.am index 1074ade..9111c0c 100644 --- a/test/common_plat/performance/Makefile.am +++ b/test/common_plat/performance/Makefile.am @@ -28,6 +28,10 @@ odp_bench_packet_LDFLAGS = $(AM_LDFLAGS) -static odp_bench_packet_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static odp_crypto_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test +odp_pktio_perf_LDFLAGS = $(AM_LDFLAGS) -static +odp_pktio_perf_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test +odp_l2fwd_LDFLAGS = $(AM_LDFLAGS) -static +odp_l2fwd_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test odp_pktio_ordered_LDFLAGS = $(AM_LDFLAGS) -static odp_pktio_ordered_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test odp_sched_latency_LDFLAGS = $(AM_LDFLAGS) -static