From patchwork Thu Feb 9 11:53:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 93697 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp209711qgi; Thu, 9 Feb 2017 04:00:05 -0800 (PST) X-Received: by 10.55.203.213 with SMTP id u82mr2213378qkl.10.1486641605043; Thu, 09 Feb 2017 04:00:05 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id m30si7804419qtg.253.2017.02.09.04.00.04; Thu, 09 Feb 2017 04:00:05 -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 A86EA634E6; Thu, 9 Feb 2017 12:00:04 +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 3BF5A634CD; Thu, 9 Feb 2017 11:54:42 +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 3FFE6634C9; Thu, 9 Feb 2017 11:54:09 +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 986F660EC2 for ; Thu, 9 Feb 2017 11:54:00 +0000 (UTC) Received: by mail-ot0-f176.google.com with SMTP id f9so978041otd.1 for ; Thu, 09 Feb 2017 03:54:00 -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=K8oXyJPN4nQdnsbLT8OkAOxtBVIk/XfKz7g5s3j6S1k=; b=Koofzv/SQQAQUAtIeKYhjpdxkOrr7bMA4wNGbGEfvdmojDpsGU5l8M9RVXT0S/4vDf e9dRLLiANEyOpvT3jk/tVslqSjUd2/p8bp6lCiNlaROq8nVSout+cJXgZc/yFc8VbOer D6+Q2Qo5y7AVkRgwSLkDc9dFTK8ezca625wOGd9u6Hctjqu+SS3Q1HZLdbrLxZyyUIvT tWr3rLYZBH6lxOfwMa1jihyhwrKMu8mEv7vhsjL409kBgPSok6OZdsYUyRen6WersF2w h5TIPQx4hFkzMihbr79kN9BY40qEKt0mGpmRMCVOQlwxrpmkNaWCbOerw+aC3l+sZKh+ tQPQ== X-Gm-Message-State: AMke39m24x6dsAfOlh8zCAIH7BlBh9NLNYUnemM6QQxLeAIy0DhMId4NCb8aAQNuAK06Vb4MJbg= X-Received: by 10.157.38.165 with SMTP id l34mr1285009otb.97.1486641239925; Thu, 09 Feb 2017 03:53:59 -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.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2017 03:53:59 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 9 Feb 2017 05:53:51 -0600 Message-Id: <20170209115352.16271-5-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 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" From: Petri Savolainen 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 Signed-off-by: Bill Fischofer --- platform/linux-generic/Makefile.am | 2 + platform/linux-generic/include/odp/api/packet.h | 11 +- .../include/odp/api/plat/packet_inlines.h | 156 +++++++++++++++++++++ .../include/odp/api/plat/packet_inlines_api.h | 97 +++++++++++++ .../include/odp/api/plat/packet_types.h | 41 ++++++ .../linux-generic/include/odp_packet_internal.h | 19 ++- platform/linux-generic/odp_packet.c | 127 ++++------------- platform/linux-generic/pktio/dpdk.c | 5 +- platform/linux-generic/pktio/netmap.c | 5 +- test/common_plat/performance/Makefile.am | 4 + 10 files changed, 350 insertions(+), 117 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.11.0.295.gd7dffce diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 63d5cbc0..a782b28c 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -82,6 +82,8 @@ odpapiplatinclude_HEADERS = \ $(srcdir)/include/odp/api/plat/event_types.h \ $(srcdir)/include/odp/api/plat/init_types.h \ $(srcdir)/include/odp/api/plat/ipsec_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 ebbeaf1b..eff40803 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 00000000..8bfd85fe --- /dev/null +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -0,0 +1,156 @@ +/* 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 Packet field accessor */ +#define _odp_pkt_get(pkt, cast, field) \ + (*(cast *)(uintptr_t)((uint8_t *)pkt + _odp_packet_inline.field)) + +/** @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 _odp_pkt_get(pkt, void *, data); +} + +/** @internal Inline function @param pkt @return */ +static inline uint32_t _odp_packet_seg_len(odp_packet_t pkt) +{ + return _odp_pkt_get(pkt, uint32_t, seg_len); +} + +/** @internal Inline function @param pkt @return */ +static inline uint32_t _odp_packet_len(odp_packet_t pkt) +{ + uint32_t pkt_len = _odp_pkt_get(pkt, uint32_t, frame_len); + void *ref_nxt = _odp_pkt_get(pkt, void *, ref_hdr); + void *ref_pkt = (void *)pkt; + + while (ref_nxt) { + pkt_len += _odp_pkt_get(ref_pkt, uint32_t, ref_len) - + _odp_pkt_get(ref_pkt, uint32_t, ref_offset); + + ref_pkt = ref_nxt; + ref_nxt = _odp_pkt_get(ref_nxt, void *, ref_hdr); + } + + return pkt_len; +} + +/** @internal Inline function @param pkt @return */ +static inline uint32_t _odp_packet_headroom(odp_packet_t pkt) +{ + return _odp_pkt_get(pkt, uint32_t, headroom); +} + +/** @internal Inline function @param pkt @return */ +static inline uint32_t _odp_packet_tailroom(odp_packet_t pkt) +{ + return _odp_pkt_get(pkt, uint32_t, tailroom); +} + +/** @internal Inline function @param pkt @return */ +static inline odp_pool_t _odp_packet_pool(odp_packet_t pkt) +{ + return _odp_pkt_get(pkt, odp_pool_t, pool); +} + +/** @internal Inline function @param pkt @return */ +static inline odp_pktio_t _odp_packet_input(odp_packet_t pkt) +{ + return _odp_pkt_get(pkt, odp_pktio_t, input); +} + +/** @internal Inline function @param pkt @return */ +static inline void *_odp_packet_user_ptr(odp_packet_t pkt) +{ + return _odp_pkt_get(pkt, void *, user_ptr); +} + +/** @internal Inline function @param pkt @return */ +static inline void *_odp_packet_user_area(odp_packet_t pkt) +{ + return _odp_pkt_get(pkt, void *, user_area); +} + +/** @internal Inline function @param pkt @return */ +static inline uint32_t _odp_packet_user_area_size(odp_packet_t pkt) +{ + return _odp_pkt_get(pkt, uint32_t, user_area_size); +} + +/** @internal Inline function @param pkt @return */ +static inline uint32_t _odp_packet_flow_hash(odp_packet_t pkt) +{ + return _odp_pkt_get(pkt, uint32_t, flow_hash); +} + +/** @internal Inline function @param pkt @return */ +static inline odp_time_t _odp_packet_ts(odp_packet_t pkt) +{ + return _odp_pkt_get(pkt, odp_time_t, 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_pkt_get(pkt, uint8_t, segcount) > 1 || + _odp_pkt_get(pkt, void *, ref_hdr) != NULL; +} + +/** @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 @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 00000000..f818f820 --- /dev/null +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h @@ -0,0 +1,97 @@ +/* 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 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 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 999130ec..9efb5165 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,45 @@ 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 unshared_len; + /** @internal field offset */ + size_t ref_hdr; + /** @internal field offset */ + size_t ref_offset; + /** *internal field offset */ + size_t ref_len; + /** @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/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index d1c6d456..875c376a 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -292,17 +292,14 @@ static inline void pull_tail(odp_packet_hdr_t *pkt_hdr, uint32_t len) static inline uint32_t packet_len(odp_packet_hdr_t *pkt_hdr) { - uint32_t pkt_len = 0; - uint32_t offset = 0; - - do { - pkt_len += pkt_hdr->frame_len - offset; - offset = pkt_hdr->ref_offset; - if (pkt_hdr->ref_hdr) - offset += (pkt_hdr->ref_hdr->frame_len - - pkt_hdr->ref_len); - pkt_hdr = pkt_hdr->ref_hdr; - } while (pkt_hdr); + uint32_t pkt_len = pkt_hdr->frame_len; + odp_packet_hdr_t *ref_hdr = pkt_hdr->ref_hdr; + + while (ref_hdr) { + pkt_len += pkt_hdr->ref_offset - pkt_hdr->ref_len; + pkt_hdr = ref_hdr; + ref_hdr = ref_hdr->ref_hdr; + } return pkt_len; } diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index cfed3d9b..a925e722 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,27 @@ /* 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), + .unshared_len = offsetof(odp_packet_hdr_t, unshared_len), + .ref_hdr = offsetof(odp_packet_hdr_t, ref_hdr), + .ref_offset = offsetof(odp_packet_hdr_t, ref_offset), + .ref_len = offsetof(odp_packet_hdr_t, ref_len), + .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; @@ -775,13 +797,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); @@ -795,25 +810,6 @@ uint32_t odp_packet_buf_len(odp_packet_t pkt) return buf_len; } -void *odp_packet_data(odp_packet_t pkt) -{ - odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - - return packet_map(pkt_hdr, 0, NULL, NULL); -} - -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_len(packet_hdr(pkt)); -} - uint32_t odp_packet_unshared_len(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); @@ -839,16 +835,6 @@ uint32_t odp_packet_unshared_len(odp_packet_t pkt) return pkt_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_last_hdr(pkt, NULL)->tailroom; -} - void *odp_packet_tail(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = packet_last_hdr(pkt, NULL); @@ -1452,13 +1438,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 @@ -1466,41 +1445,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); @@ -1593,13 +1547,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); @@ -1608,13 +1555,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); @@ -1623,13 +1563,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) -{ - odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - - return pkt_hdr->buf_hdr.segcount > 1 || pkt_hdr->ref_hdr != NULL; -} - int odp_packet_num_segs(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); @@ -1654,11 +1587,6 @@ int odp_packet_num_segs(odp_packet_t pkt) return segcount; } -odp_packet_seg_t odp_packet_first_seg(odp_packet_t pkt ODP_UNUSED) -{ - return 0; -} - odp_packet_seg_t odp_packet_last_seg(odp_packet_t pkt) { return (odp_packet_seg_t)(odp_packet_num_segs(pkt) - 1); @@ -1836,7 +1764,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; @@ -1884,7 +1812,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; @@ -2028,7 +1956,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) @@ -2651,3 +2579,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 9a9f7a4e..1922109a 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 208984b6..ae3db34d 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 1074ade8..9111c0c2 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