From patchwork Tue Jan 30 15:59:59 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: 126266 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3484608ljd; Tue, 30 Jan 2018 08:00:37 -0800 (PST) X-Google-Smtp-Source: AH8x226Y80xTWYlPy0M/3EBY5SYHmcqFIlVA+hwk7Bm7PkFVYPz8QMYy8gvIzChuVF5E+zQ+0LsJ X-Received: by 10.129.183.8 with SMTP id v8mr20325935ywh.68.1517328037026; Tue, 30 Jan 2018 08:00:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517328037; cv=none; d=google.com; s=arc-20160816; b=X6YyWb+Ckk/MiiYcwiew1jFAJS3Tw02JhtFPzjkOgRMFbq81y0xWXwUX/aJ3FK+sOz YJABrJ99U/iAIR6by7luik5R4ymZeJMomZW8wMeTdlk4rt30oP0rc3pKDWV7/WlGY18i edAPcSMRaECR8Ymz3Foen13bnNydGwc9ig+HzkHikaFkqzjjkndOTaFpg9y62TsZEq4x j4ZFlnWhPNc7M6SgWy/z+XtZSbgRk+sVA5Lzx9STv5I1qIsctQVN0AsQsF8ueKB589HP EN413knASMw456dy+IQm1kMufdVe7nibHg27kMAbu1NiD36WzapDZkWQL5ktNXkwYVBR 10gw== 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=6CWwJlXk//Uh2ypzXYhgCxq7M8lwlyieHz3Yl9TT9u8=; b=RpvY2pOIcE8/vC8+F2D92MRYQmbs8IMXEJxS5oSy5L/hMVi0z5pDsvg5bmlFOIuiF9 rdIjG2cCXi2+ZNkqkisUx8VIROde2jAlXZjZZKzpY9+hBF5pdR9u0mMORXSJ53AT6czT Ak4qrBN+C0sINnnMvAju8HBylx0HkTvy7YX+0lEClrqqZwkVUVcMLDUsKHvVkTTCig6d 16EI+tYkCLM4SMEwmDLMPLkW1EI+Rvyj81P/c3KOOsEuAjRa/2ryJw45oSlld9yPgYXV bkXVnNtkNVXEkMe1wLw8mg+Sk35VrcsvOqDgf1s16u1erOnlWIyb2cTqaX/Nn6kWzNNB u6NQ== 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 s65si121149qks.124.2018.01.30.08.00.36; Tue, 30 Jan 2018 08:00: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 981D161704; Tue, 30 Jan 2018 16:00: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 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 5525061508; Tue, 30 Jan 2018 16:00:24 +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 292516104E; Tue, 30 Jan 2018 16:00:16 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id BCAC960A6E for ; Tue, 30 Jan 2018 16:00:13 +0000 (UTC) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 1FE9C182C99 for ; Tue, 30 Jan 2018 19:00:12 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id wI4360CiMR-0CnuO3OY; Tue, 30 Jan 2018 19:00:12 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Nz8CQ597Mi-0BRC6GuA; Tue, 30 Jan 2018 19:00:11 +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: Tue, 30 Jan 2018 18:59:59 +0300 Message-Id: <1517328009-16379-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> References: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v1 1/11] linux-gen: packet: use inlined flow hash set 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 inlined version of flow hash set function. Also changed API to use inlined timestamp function, so that the same function is not implemented twice. Signed-off-by: Petri Savolainen --- /** Email created from pull request 437 (psavol:master-packet-optim) ** https://github.com/Linaro/odp/pull/437 ** Patch: https://github.com/Linaro/odp/pull/437.patch ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd ** Merge commit sha: ab7875c186fe80cfe103c5be5634b0eda312aed4 **/ platform/linux-generic/include/odp_packet_internal.h | 7 +++++++ platform/linux-generic/odp_packet.c | 6 ++---- platform/linux-generic/pktio/dpdk.c | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 01e0cae17..32e41d7f5 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -331,6 +331,13 @@ static inline int packet_hdr_has_ipv6(odp_packet_hdr_t *pkt_hdr) return pkt_hdr->p.input_flags.ipv6; } +static inline void packet_set_flow_hash(odp_packet_hdr_t *pkt_hdr, + uint32_t flow_hash) +{ + pkt_hdr->flow_hash = flow_hash; + pkt_hdr->p.input_flags.flow_hash = 1; +} + static inline void packet_set_ts(odp_packet_hdr_t *pkt_hdr, odp_time_t *ts) { if (ts != NULL) { diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index a4cd05f62..8d6185987 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -1352,16 +1352,14 @@ void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t flow_hash) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - pkt_hdr->flow_hash = flow_hash; - pkt_hdr->p.input_flags.flow_hash = 1; + packet_set_flow_hash(pkt_hdr, flow_hash); } void odp_packet_ts_set(odp_packet_t pkt, odp_time_t timestamp) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - pkt_hdr->timestamp = timestamp; - pkt_hdr->p.input_flags.timestamp = 1; + packet_set_ts(pkt_hdr, ×tamp); } /* diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 6fd4b1924..4ae72e10a 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -483,7 +483,7 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, pktio_entry->s.config.parser.layer); if (mbuf->ol_flags & PKT_RX_RSS_HASH) - odp_packet_flow_hash_set(pkt, mbuf->hash.rss); + packet_set_flow_hash(pkt_hdr, mbuf->hash.rss); packet_set_ts(pkt_hdr, ts); @@ -723,7 +723,7 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t *pktio_entry, pktio_entry->s.config.parser.layer); if (mbuf->ol_flags & PKT_RX_RSS_HASH) - odp_packet_flow_hash_set(pkt, mbuf->hash.rss); + packet_set_flow_hash(pkt_hdr, mbuf->hash.rss); packet_set_ts(pkt_hdr, ts); From patchwork Tue Jan 30 16:00:00 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: 126268 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3487864ljd; Tue, 30 Jan 2018 08:03:36 -0800 (PST) X-Google-Smtp-Source: AH8x227T6XTRDUVBhwgK1+wG0tD5TFcS7GzfjSnQubYDSAgArULD7oMoB5/olyLbJli2OyFHnlEw X-Received: by 10.37.139.16 with SMTP id i16mr3999296ybl.77.1517328216328; Tue, 30 Jan 2018 08:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517328216; cv=none; d=google.com; s=arc-20160816; b=cmaBUUP2E4btCo1VbdB1vJbqaxKne98hIcgtmpbDahB5J0OmyO7NKn+iic/ZIBSedm DjXZgk67DSsTx3jCGQRtAne+yMU1pqWmyTpiXrHOBRuwg36aQswC1P2u91Gj0za0478s PTSubmYpBl3fd01FU8cjVCBz9xzN+0OmCtO7mDnGDK/x7QUCX/LA1G0JOwHpiuE1PYDv iQoQWokpW+vI7E+NKztfIFn3Lcoo9tRhZKRYjhSehiXP117/0sOonBWvEKb/1PUPd1/K ZFJNCodTpBLohAaH35e4WHYYuEK882kiiQ8bbitcwnhpazB5o/wgC9DPrmvDV0Q88HXl 5s0Q== 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=pNwxe09/3dUEsXpT5V2HhchpP0ltH1nhBZzXrOF3a7U=; b=l4JlnyFqxEgaoo69XzsqKR+J9uVgBhhAocEfsom4LQTJKLeheotrxw2ED5Y5x0mOd4 cUySVwyDiw5Crb0J9FRSNY/Yicd81hW9pPz6ojEKklFM60wEqeJPyYzMirP42l7rU9yj gW87mn9aLwHlBW+LYtwlP3e4W2cQga3o8tqzdvr6HME59LvWuyLGdKMUQAhBc/Q4VXU+ GP7NTd8teMgpPfOsNhQnf0Ar3HBJ2XxheWRsWq48Typn3C0wmmI+29VDjJmgqsfWsoH3 sIOjtieKonZ6h+dSknqRnudCNIc97mSMPI0qsVhBTQXmsEBUZLD3a6rvQvFGfYU4BURU ywDA== 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 f70si2671232ywh.747.2018.01.30.08.03.36; Tue, 30 Jan 2018 08:03: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 EBC72616E1; Tue, 30 Jan 2018 16:03:35 +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 4F9B660B0E; Tue, 30 Jan 2018 16:00:44 +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 7F076616E1; Tue, 30 Jan 2018 16:00:24 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id 62BCA60B0E for ; Tue, 30 Jan 2018 16:00:14 +0000 (UTC) Received: from mxback17j.mail.yandex.net (mxback17j.mail.yandex.net [IPv6:2a02:6b8:0:1619::93]) by forward106o.mail.yandex.net (Yandex) with ESMTP id CABBA783183 for ; Tue, 30 Jan 2018 19:00:12 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback17j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id MhvGfC6qvU-0CnC6UFj; Tue, 30 Jan 2018 19:00:12 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Nz8CQ597Mi-0CRubENo; Tue, 30 Jan 2018 19:00: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: Tue, 30 Jan 2018 19:00:00 +0300 Message-Id: <1517328009-16379-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> References: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v1 2/11] linux-gen: packet: remove dummy doxygen documentation 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 @cond tag to hide internal functions from Doxygen. Signed-off-by: Petri Savolainen --- /** Email created from pull request 437 (psavol:master-packet-optim) ** https://github.com/Linaro/odp/pull/437 ** Patch: https://github.com/Linaro/odp/pull/437.patch ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd ** Merge commit sha: ab7875c186fe80cfe103c5be5634b0eda312aed4 **/ .../include/odp/api/plat/packet_inlines.h | 39 +++------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index fb9c524fb..765bafb4f 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -23,63 +23,52 @@ #include #include -/** @internal Inline function @param pkt_ptr @param offset @param seg_len - * @param seg_idx @return */ +/** @cond _ODP_HIDE_FROM_DOXYGEN_ */ + void *_odp_packet_map(void *pkt_ptr, uint32_t offset, uint32_t *seg_len, int *seg_idx); -/** @internal Inline function offsets */ extern const _odp_packet_inline_offset_t _odp_packet_inline; - -/** @internal Pool inline function offsets */ -extern const _odp_pool_inline_offset_t _odp_pool_inline; +extern const _odp_pool_inline_offset_t _odp_pool_inline; #ifndef _ODP_HAVE_PACKET_SEG_NDX #include -/** @internal Inline function @param seg @return */ static inline uint32_t _odp_packet_seg_to_ndx(odp_packet_seg_t seg) { return _odp_typeval(seg); } -/** @internal Inline function @param ndx @return */ static inline odp_packet_seg_t _odp_packet_seg_from_ndx(uint32_t ndx) { return _odp_cast_scalar(odp_packet_seg_t, ndx); } #endif -/** @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) { return _odp_pkt_get(pkt, uint32_t, frame_len); } -/** @internal Inline function @param pkt @return */ static inline uint32_t _odp_packet_headroom(odp_packet_t pkt) { return _odp_pkt_get(pkt, uint16_t, headroom); } -/** @internal Inline function @param pkt @return */ static inline uint32_t _odp_packet_tailroom(odp_packet_t pkt) { return _odp_pkt_get(pkt, uint16_t, tailroom); } -/** @internal Inline function @param pkt @return */ static inline odp_pool_t _odp_packet_pool(odp_packet_t pkt) { void *pool = _odp_pkt_get(pkt, void *, pool); @@ -87,31 +76,26 @@ static inline odp_pool_t _odp_packet_pool(odp_packet_t pkt) return _odp_pool_get(pool, odp_pool_t, pool_hdl); } -/** @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 int _odp_packet_num_segs(odp_packet_t pkt) { return _odp_pkt_get(pkt, uint8_t, segcount); } -/** @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) { void *pool = _odp_pkt_get(pkt, void *, pool); @@ -119,25 +103,21 @@ static inline uint32_t _odp_packet_user_area_size(odp_packet_t pkt) return _odp_pool_get(pool, uint32_t, uarea_size); } -/** @internal Inline function @param pkt @return */ static inline uint32_t _odp_packet_l2_offset(odp_packet_t pkt) { return _odp_pkt_get(pkt, uint16_t, l2_offset); } -/** @internal Inline function @param pkt @return */ static inline uint32_t _odp_packet_l3_offset(odp_packet_t pkt) { return _odp_pkt_get(pkt, uint16_t, l3_offset); } -/** @internal Inline function @param pkt @return */ static inline uint32_t _odp_packet_l4_offset(odp_packet_t pkt) { return _odp_pkt_get(pkt, uint16_t, l4_offset); } -/** @internal Inline function @param pkt @param len @return */ static inline void *_odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len) { uint32_t offset = _odp_packet_l2_offset(pkt); @@ -156,7 +136,6 @@ static inline void *_odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len) return data + offset; } -/** @internal Inline function @param pkt @param len @return */ static inline void *_odp_packet_l3_ptr(odp_packet_t pkt, uint32_t *len) { uint32_t offset = _odp_packet_l3_offset(pkt); @@ -175,7 +154,6 @@ static inline void *_odp_packet_l3_ptr(odp_packet_t pkt, uint32_t *len) return data + offset; } -/** @internal Inline function @param pkt @param len @return */ static inline void *_odp_packet_l4_ptr(odp_packet_t pkt, uint32_t *len) { uint32_t offset = _odp_packet_l4_offset(pkt); @@ -194,31 +172,26 @@ static inline void *_odp_packet_l4_ptr(odp_packet_t pkt, uint32_t *len) return data + offset; } -/** @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; } -/** @internal Inline function @param pkt @return */ static inline odp_packet_seg_t _odp_packet_first_seg(odp_packet_t pkt) { (void)pkt; @@ -226,13 +199,11 @@ static inline odp_packet_seg_t _odp_packet_first_seg(odp_packet_t pkt) return _odp_packet_seg_from_ndx(0); } -/** @internal Inline function @param pkt @return */ static inline odp_packet_seg_t _odp_packet_last_seg(odp_packet_t pkt) { return _odp_packet_seg_from_ndx(_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) { @@ -243,17 +214,17 @@ static inline odp_packet_seg_t _odp_packet_next_seg(odp_packet_t pkt, 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; } -/** @internal Inline function @param pkt @return */ static inline odp_buffer_t packet_to_buffer(odp_packet_t pkt) { return (odp_buffer_t)pkt; } +/** @endcond */ + #endif From patchwork Tue Jan 30 16:00:01 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: 126267 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3485903ljd; Tue, 30 Jan 2018 08:01:44 -0800 (PST) X-Google-Smtp-Source: AH8x225Orc/6idQZhuZ2yvAc4phdYDciRg8QL/fIZ/48smcH5SRc/6hnwIfVCqxtcjOezu2zLNw6 X-Received: by 10.55.121.130 with SMTP id u124mr42279474qkc.329.1517328104392; Tue, 30 Jan 2018 08:01:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517328104; cv=none; d=google.com; s=arc-20160816; b=p/vtEx4DXPPWzBkTJdiwZIptDvZlKWyVwOvYFSF/aLESJbfF9usGFKEaBFoK8RI0w/ JWqjjdtL9zznZNTKmbtMaP0hucLLBwSvnjtD8u1Q1AzlubIr29vpBiFZ2JXMqlv2IjfR J7Rl/bXZ6u0FeUTdnPWlfAoC9zioW7s4hDwWpaLV2VGb2J4kN9O5Cu6pgxl2cngGzFfH U2BqUCz+iy47tAbBtu+mjkqCPyZC5r6ZmdFHCJzKjKixQqyVJZXZrQOM4TwfVluyM/dF kRLGcpicXHEek0D+rpWyH6GQperLlMbH3yJrXSR/Icdk8A1imLtTA3V29geBnbVjULyf lgCg== 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=Y3dVULvkketJkFVXcnWgeVGpBm8/JZhGolPeSVvzlhA=; b=HjY9EC6mbm3BEtuC2lonodBw2fxBWwXhP9PV703DMyx4k6qYUmMSply6hvHUgIrPdv xfwFqJOQ/v09lMPux0TnepCWFzMirKoZYjL5OnZ8VkdPDL1gqo5e1dGYUmzmTw/9LOVP MRDqQYVu7dd62KbNDctegrCFx9BGTpRGIi0n0eewyOcMppoWT7KHivB87vkw9qsSgb0v zFnk1rfGDEWmoBkmAiJ43Odv2eTvzBlnvDlBVGiakWU2+UO0RZH5ET4kqsnmesWSaTFp W6ti3EmSQ3x5Fy7vFvQC0MKgGE+Uf645Pk3YTN0N/cTpa7eBBvi57v0sLCAyomTtH7rm Gp9Q== 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 y11si1512976qtb.118.2018.01.30.08.01.44; Tue, 30 Jan 2018 08:01:44 -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 0666A61512; Tue, 30 Jan 2018 16:01:44 +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 BBE026104E; Tue, 30 Jan 2018 16:00:31 +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 A728B61512; Tue, 30 Jan 2018 16:00:19 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 0372E60C5E for ; Tue, 30 Jan 2018 16:00:16 +0000 (UTC) Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 7BD7F1841A8 for ; Tue, 30 Jan 2018 19:00:13 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id u3B6ky2PNa-0DhSNXcR; Tue, 30 Jan 2018 19:00:13 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Nz8CQ597Mi-0CRifAUx; Tue, 30 Jan 2018 19:00: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: Tue, 30 Jan 2018 19:00:01 +0300 Message-Id: <1517328009-16379-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> References: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v1 3/11] linux-gen: packet: inline copy 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 Inline commonly used packet to/from memory copy functions. Signed-off-by: Petri Savolainen --- /** Email created from pull request 437 (psavol:master-packet-optim) ** https://github.com/Linaro/odp/pull/437 ** Patch: https://github.com/Linaro/odp/pull/437.patch ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd ** Merge commit sha: ab7875c186fe80cfe103c5be5634b0eda312aed4 **/ .../include/odp/api/plat/packet_inlines.h | 36 ++++++++ .../include/odp/api/plat/packet_inlines_api.h | 12 +++ platform/linux-generic/odp_packet.c | 96 +++++++++++----------- 3 files changed, 96 insertions(+), 48 deletions(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index 765bafb4f..90e205fd4 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -23,11 +23,19 @@ #include #include +#include + /** @cond _ODP_HIDE_FROM_DOXYGEN_ */ void *_odp_packet_map(void *pkt_ptr, uint32_t offset, uint32_t *seg_len, int *seg_idx); +int _odp_packet_copy_from_mem_seg(odp_packet_t pkt, uint32_t offset, + uint32_t len, const void *src); + +int _odp_packet_copy_to_mem_seg(odp_packet_t pkt, uint32_t offset, + uint32_t len, void *dst); + extern const _odp_packet_inline_offset_t _odp_packet_inline; extern const _odp_pool_inline_offset_t _odp_pool_inline; @@ -225,6 +233,34 @@ static inline odp_buffer_t packet_to_buffer(odp_packet_t pkt) return (odp_buffer_t)pkt; } +static inline int _odp_packet_copy_from_mem(odp_packet_t pkt, uint32_t offset, + uint32_t len, const void *src) +{ + uint32_t seg_len = _odp_packet_seg_len(pkt); + uint8_t *data = (uint8_t *)_odp_packet_data(pkt); + + if (odp_unlikely(offset + len > seg_len)) + return _odp_packet_copy_from_mem_seg(pkt, offset, len, src); + + memcpy(data + offset, src, len); + + return 0; +} + +static inline int _odp_packet_copy_to_mem(odp_packet_t pkt, uint32_t offset, + uint32_t len, void *dst) +{ + uint32_t seg_len = _odp_packet_seg_len(pkt); + uint8_t *data = (uint8_t *)_odp_packet_data(pkt); + + if (odp_unlikely(offset + len > seg_len)) + return _odp_packet_copy_to_mem_seg(pkt, offset, len, dst); + + memcpy(dst, data + offset, len); + + return 0; +} + /** @endcond */ #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 index c90a69c52..9b31c923f 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h @@ -140,4 +140,16 @@ _ODP_INLINE void odp_packet_prefetch(odp_packet_t pkt, uint32_t offset, return _odp_packet_prefetch(pkt, offset, len); } +_ODP_INLINE int odp_packet_copy_from_mem(odp_packet_t pkt, uint32_t offset, + uint32_t len, const void *src) +{ + return _odp_packet_copy_from_mem(pkt, offset, len, src); +} + +_ODP_INLINE int odp_packet_copy_to_mem(odp_packet_t pkt, uint32_t offset, + uint32_t len, void *dst) +{ + return _odp_packet_copy_to_mem(pkt, offset, len, dst); +} + #endif diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 8d6185987..2867e67e9 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -334,6 +334,54 @@ void *_odp_packet_map(void *pkt_ptr, uint32_t offset, uint32_t *seg_len, return packet_map(pkt_ptr, offset, seg_len, seg_idx); } +int _odp_packet_copy_from_mem_seg(odp_packet_t pkt, uint32_t offset, + uint32_t len, const void *src) +{ + void *mapaddr; + uint32_t seglen = 0; /* GCC */ + uint32_t cpylen; + const uint8_t *srcaddr = (const uint8_t *)src; + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + + if (offset + len > pkt_hdr->frame_len) + return -1; + + while (len > 0) { + mapaddr = packet_map(pkt_hdr, offset, &seglen, NULL); + cpylen = len > seglen ? seglen : len; + memcpy(mapaddr, srcaddr, cpylen); + offset += cpylen; + srcaddr += cpylen; + len -= cpylen; + } + + return 0; +} + +int _odp_packet_copy_to_mem_seg(odp_packet_t pkt, uint32_t offset, + uint32_t len, void *dst) +{ + void *mapaddr; + uint32_t seglen = 0; /* GCC */ + uint32_t cpylen; + uint8_t *dstaddr = (uint8_t *)dst; + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + + if (offset + len > pkt_hdr->frame_len) + return -1; + + while (len > 0) { + mapaddr = packet_map(pkt_hdr, offset, &seglen, NULL); + cpylen = len > seglen ? seglen : len; + memcpy(dstaddr, mapaddr, cpylen); + offset += cpylen; + dstaddr += cpylen; + len -= cpylen; + } + + return 0; +} + #include void packet_parse_reset(odp_packet_hdr_t *pkt_hdr) @@ -1595,54 +1643,6 @@ odp_packet_t odp_packet_copy_part(odp_packet_t pkt, uint32_t offset, return newpkt; } -int odp_packet_copy_to_mem(odp_packet_t pkt, uint32_t offset, - uint32_t len, void *dst) -{ - void *mapaddr; - uint32_t seglen = 0; /* GCC */ - uint32_t cpylen; - uint8_t *dstaddr = (uint8_t *)dst; - odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - - if (offset + len > pkt_hdr->frame_len) - return -1; - - while (len > 0) { - mapaddr = packet_map(pkt_hdr, offset, &seglen, NULL); - cpylen = len > seglen ? seglen : len; - memcpy(dstaddr, mapaddr, cpylen); - offset += cpylen; - dstaddr += cpylen; - len -= cpylen; - } - - return 0; -} - -int odp_packet_copy_from_mem(odp_packet_t pkt, uint32_t offset, - uint32_t len, const void *src) -{ - void *mapaddr; - uint32_t seglen = 0; /* GCC */ - uint32_t cpylen; - const uint8_t *srcaddr = (const uint8_t *)src; - odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - - if (offset + len > pkt_hdr->frame_len) - return -1; - - while (len > 0) { - mapaddr = packet_map(pkt_hdr, offset, &seglen, NULL); - cpylen = len > seglen ? seglen : len; - memcpy(mapaddr, srcaddr, cpylen); - offset += cpylen; - srcaddr += cpylen; - len -= cpylen; - } - - return 0; -} - int odp_packet_copy_from_pkt(odp_packet_t dst, uint32_t dst_offset, odp_packet_t src, uint32_t src_offset, uint32_t len) From patchwork Tue Jan 30 16:00:02 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: 126269 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3488893ljd; Tue, 30 Jan 2018 08:04:45 -0800 (PST) X-Google-Smtp-Source: AH8x227TvJQECKhWKsaQwDwaiT5goLfibyV8I2/CnK9pN8nHvdFCrVvm6F0XBogo9ib0Y6nybWOp X-Received: by 10.55.168.137 with SMTP id r131mr42979495qke.27.1517328285559; Tue, 30 Jan 2018 08:04:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517328285; cv=none; d=google.com; s=arc-20160816; b=u1bwTPCnqFWZkQ1sGaRt2bUUMJWyRFd233yGzBSP66y6RVRAXOxDSWkns7HaTnKWpJ +OjNQWqHdZcGzyFG8bFxWXUhrdM2pq/iS8jrY9DdRAe2BmxxGOZpwKXZBDg49BnY46Gn uVJOBTcRMozUnoqf+YY2ONJKZkvgZMSrNVdS0lmB8F9pi4EEdoDtnqAOWyGVpYd4VJHo h7f5/cc8570IeoCKubFvCOiktV3HlI4ngYxLncet9Wx5J3KasudjTKerbkR1GO8g7upa kv293wihQUyR5nguLpm6rXYH2tx1ibem/qJQ51vQXtROSLPmiZ3um3uPgB1gP8E8UsOi KEJA== 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=mrHFt9NQw/vi8LL5el6FZWmYwwE00pJX7PcTVue+Dm4=; b=WBWgDpalZsSKzuKtxvDIatTZUkm6vXrZKC4u1o2LH2pBp7ZKh8gxfDUunCQWY0NEyT TnMp7kdkKzBg/50nKeTTRVHHK9G3jbls7Yv/q8rNjwZwtTus5Y226VP31A7+eiUkTA7q 0zQnEljsSmkO6Q0qnDvwgHj2Uc3VeNiqtn1xNgaIgD2zJ4znX0n4BCiV+qavXn1sVxCR YjrLa8XdYDr/jTgpXfEt35zvS+cZ1wmywazjW7m03OiLVe7qzIC7Vutw/Sztm6V6g9AO QKVvPejli7vqW8DrQHGWBLIYjM9YlaL+on0xhwqHU1HupWbuHKBX3bAS25put7mbS9kf q3eQ== 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 h45si4328545qtk.47.2018.01.30.08.04.45; Tue, 30 Jan 2018 08:04:45 -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 3CF2961756; Tue, 30 Jan 2018 16:04:45 +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 8059261744; Tue, 30 Jan 2018 16:00:53 +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 AFEED616E3; Tue, 30 Jan 2018 16:00:24 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 5750460C5D for ; Tue, 30 Jan 2018 16:00:15 +0000 (UTC) Received: from mxback6j.mail.yandex.net (mxback6j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10f]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 2C8394444537 for ; Tue, 30 Jan 2018 19:00:14 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback6j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id VIAIEoZcIv-0EEqR4Gw; Tue, 30 Jan 2018 19:00:14 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Nz8CQ597Mi-0DR8bE5P; Tue, 30 Jan 2018 19:00: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: Tue, 30 Jan 2018 19:00:02 +0300 Message-Id: <1517328009-16379-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> References: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v1 4/11] linux-gen: packet: use inlined copy 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 Use always inlined versions of packet to/from memory copy functions. Signed-off-by: Petri Savolainen --- /** Email created from pull request 437 (psavol:master-packet-optim) ** https://github.com/Linaro/odp/pull/437 ** Patch: https://github.com/Linaro/odp/pull/437.patch ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd ** Merge commit sha: ab7875c186fe80cfe103c5be5634b0eda312aed4 **/ platform/linux-generic/odp_traffic_mngr.c | 24 ++++++++++++------------ platform/linux-generic/pktio/dpdk.c | 4 ++-- platform/linux-generic/pktio/netmap.c | 4 ++-- platform/linux-generic/pktio/pcap.c | 5 +++-- platform/linux-generic/pktio/socket_mmap.c | 7 ++++--- platform/linux-generic/pktio/tap.c | 5 +++-- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index 557e77ba3..03094cc37 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -1941,8 +1941,8 @@ static void egress_vlan_marking(tm_vlan_marking_t *vlan_marking, * correctness rather then performance. */ split_hdr = hdr_len < (_ODP_ETHHDR_LEN + _ODP_VLANHDR_LEN); if (split_hdr) { - odp_packet_copy_to_mem(odp_pkt, _ODP_ETHHDR_LEN, - _ODP_VLANHDR_LEN, &vlan_hdr); + _odp_packet_copy_to_mem(odp_pkt, _ODP_ETHHDR_LEN, + _ODP_VLANHDR_LEN, &vlan_hdr); vlan_hdr_ptr = &vlan_hdr; } @@ -1956,8 +1956,8 @@ static void egress_vlan_marking(tm_vlan_marking_t *vlan_marking, 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); + _odp_packet_copy_from_mem(odp_pkt, _ODP_ETHHDR_LEN, + _ODP_VLANHDR_LEN, &vlan_hdr); } static void egress_ipv4_tos_marking(tm_tos_marking_t *tos_marking, @@ -1980,8 +1980,8 @@ static void egress_ipv4_tos_marking(tm_tos_marking_t *tos_marking, * correctness rather then performance. */ split_hdr = hdr_len < 12; if (split_hdr) { - odp_packet_copy_to_mem(odp_pkt, l3_offset, - _ODP_IPV4HDR_LEN, &ipv4_hdr); + _odp_packet_copy_to_mem(odp_pkt, l3_offset, + _ODP_IPV4HDR_LEN, &ipv4_hdr); ipv4_hdr_ptr = &ipv4_hdr; } @@ -2022,8 +2022,8 @@ static void egress_ipv4_tos_marking(tm_tos_marking_t *tos_marking, ipv4_hdr_ptr->tos = new_tos; 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); + _odp_packet_copy_from_mem(odp_pkt, l3_offset, + _ODP_IPV4HDR_LEN, &ipv4_hdr); } static void egress_ipv6_tc_marking(tm_tos_marking_t *tos_marking, @@ -2046,8 +2046,8 @@ static void egress_ipv6_tc_marking(tm_tos_marking_t *tos_marking, * correctness rather then performance. */ split_hdr = hdr_len < 4; if (split_hdr) { - odp_packet_copy_to_mem(odp_pkt, l3_offset, - _ODP_IPV6HDR_LEN, &ipv6_hdr); + _odp_packet_copy_to_mem(odp_pkt, l3_offset, + _ODP_IPV6HDR_LEN, &ipv6_hdr); ipv6_hdr_ptr = &ipv6_hdr; } @@ -2075,8 +2075,8 @@ static void egress_ipv6_tc_marking(tm_tos_marking_t *tos_marking, 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, - _ODP_IPV6HDR_LEN, &ipv6_hdr); + _odp_packet_copy_from_mem(odp_pkt, l3_offset, + _ODP_IPV6HDR_LEN, &ipv6_hdr); } static void tm_egress_marking(tm_system_t *tm_system, odp_packet_t odp_pkt) diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 4ae72e10a..86d7a4513 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -471,7 +471,7 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, pkt_hdr = odp_packet_hdr(pkt); pull_tail(pkt_hdr, alloc_len - pkt_len); - if (odp_packet_copy_from_mem(pkt, 0, pkt_len, data) != 0) + if (_odp_packet_copy_from_mem(pkt, 0, pkt_len, data) != 0) goto fail; pkt_hdr->input = pktio_entry->s.handle; @@ -649,7 +649,7 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry, /* Packet always fits in mbuf */ data = rte_pktmbuf_append(mbuf_table[i], pkt_len); - odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, data); + _odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, data); if (odp_unlikely(pktio_entry->s.chksum_insert_ena)) { odp_pktout_config_opt_t *pktout_capa = diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index a7c479001..c03564f4e 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -652,7 +652,7 @@ static inline int netmap_pkt_to_odp(pktio_entry_t *pktio_entry, /* For now copy the data in the mbuf, worry about zero-copy later */ - if (odp_packet_copy_from_mem(pkt, 0, len, slot.buf) != 0) + if (_odp_packet_copy_from_mem(pkt, 0, len, slot.buf) != 0) goto fail; pkt_hdr->input = pktio_entry->s.handle; @@ -938,7 +938,7 @@ static int netmap_send(pktio_entry_t *pktio_entry, int index, buf = NETMAP_BUF(ring, ring->slot[slot_id].buf_idx); - if (odp_packet_copy_to_mem(pkt, 0, pkt_len, buf)) { + if (_odp_packet_copy_to_mem(pkt, 0, pkt_len, buf)) { i = NM_INJECT_RETRIES; break; } diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c index 7fc925149..76cbf9eef 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -249,7 +250,7 @@ static int pcapif_recv_pkt(pktio_entry_t *pktio_entry, int index ODP_UNUSED, pkt_hdr = odp_packet_hdr(pkt); - if (odp_packet_copy_from_mem(pkt, 0, hdr->caplen, data) != 0) { + if (_odp_packet_copy_from_mem(pkt, 0, hdr->caplen, data) != 0) { ODP_ERR("failed to copy packet data\n"); break; } @@ -283,7 +284,7 @@ static int _pcapif_dump_pkt(pkt_pcap_t *pcap, odp_packet_t pkt) hdr.len = hdr.caplen; (void)gettimeofday(&hdr.ts, NULL); - if (odp_packet_copy_to_mem(pkt, 0, hdr.len, pcap->buf) != 0) + if (_odp_packet_copy_to_mem(pkt, 0, hdr.len, pcap->buf) != 0) return -1; pcap_dump(pcap->tx_dump, &hdr, pcap->buf); diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index b53173d29..2ace1a597 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -243,8 +244,8 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, continue; } hdr = odp_packet_hdr(pkt_table[nb_rx]); - ret = odp_packet_copy_from_mem(pkt_table[nb_rx], 0, - pkt_len, pkt_buf); + ret = _odp_packet_copy_from_mem(pkt_table[nb_rx], 0, + pkt_len, pkt_buf); if (ret != 0) { odp_packet_free(pkt_table[nb_rx]); mmap_rx_user_ready(ppd.raw); /* drop */ @@ -345,7 +346,7 @@ static inline unsigned pkt_mmap_v2_tx(int sock, struct ring *ring, buf = (uint8_t *)ppd.raw + TPACKET2_HDRLEN - sizeof(struct sockaddr_ll); - odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, buf); + _odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, buf); mmap_tx_user_ready(ppd.raw); diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c index ebd4d94be..ccfa19b25 100644 --- a/platform/linux-generic/pktio/tap.c +++ b/platform/linux-generic/pktio/tap.c @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -273,7 +274,7 @@ static odp_packet_t pack_odp_pkt(pktio_entry_t *pktio_entry, const void *data, if (num != 1) return ODP_PACKET_INVALID; - if (odp_packet_copy_from_mem(pkt, 0, len, data) < 0) { + if (_odp_packet_copy_from_mem(pkt, 0, len, data) < 0) { ODP_ERR("failed to copy packet data\n"); odp_packet_free(pkt); return ODP_PACKET_INVALID; @@ -352,7 +353,7 @@ static int tap_pktio_send_lockless(pktio_entry_t *pktio_entry, break; } - if (odp_packet_copy_to_mem(pkts[i], 0, pkt_len, buf) < 0) { + if (_odp_packet_copy_to_mem(pkts[i], 0, pkt_len, buf) < 0) { ODP_ERR("failed to copy packet data\n"); break; } From patchwork Tue Jan 30 16:00:03 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: 126270 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3490127ljd; Tue, 30 Jan 2018 08:06:04 -0800 (PST) X-Google-Smtp-Source: AH8x224h0NH28ltlCuHHLobukkrXytZgUABLA+ZBHcJLp/8PuY00EYgu8Rp1PS8BChIJAgHwc5P+ X-Received: by 10.237.61.66 with SMTP id h2mr46570427qtf.268.1517328363939; Tue, 30 Jan 2018 08:06:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517328363; cv=none; d=google.com; s=arc-20160816; b=Hm+k06NMApk+XVIUSLJ8j/udXdpSEZKACs8XWhmDpHq+WoWPXR06MIKD9PRJK4ff6b MyBFiBuwXHwSuoPhkhwBad6+wajPoMyRGmMWkixTeizwu0YnFX/acSFq51cmoF4YrNql wh7WT+HiWHUpJCGGC8wTEeIRTAqeuw/aQw5DTACJ3lHDLqznuoV2lN/IA8BeCDiEUbw3 ibUDFuZyCqLy1rC3Ng7nEZkKz/pk5rEF7/YXrf0xK2d9feBnhFcyI5irLF4F7H0ql+/t 21H5N57nA30NErmtR+aZ2N5r56/noC0YG26xtL6cMKMUicb+pPUa+Q9M7Ifv8EEVkxL6 zEXQ== 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=CFcc7HJPnyTSue+9OH36ly1PlxpZte5vMo0NPRwMYh0=; b=zUpBtMYXiNZbB0h1rjorUthHwDawTP3qfCRYUP+B2a0X2iHRcVdKeZ51iiMjLhjaMq CvT7KhJlF8x25MzAZVxW7And4LSoH3n1NLPXR2UhsQY1OgGwCyKgi6XzGdHcRqnjLscl I5faa6gs5sFrqDwrh0Fj86xWrcvPY6ByvKQX70kjuX2J4XkNmDF6aaA1r7s3AkxJJODW WBLkL/72/c3JiAeBOT5uUvv+lkDKdp5bEGgZ+RlHiqLog6M4c433DHSPc5pFmMEpYsU5 qOjSwU4e6n74oHcpLApNdES4JoMxEtHI7ybElbic79tUAZHokvj+JEG7mRdqmRzWJr1A N9Ug== 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 m8si4732468qte.189.2018.01.30.08.06.03; Tue, 30 Jan 2018 08:06:03 -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 96CC861763; Tue, 30 Jan 2018 16:06:03 +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 C482161741; Tue, 30 Jan 2018 16:01:01 +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 7BF6561527; Tue, 30 Jan 2018 16:00:25 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id A197A60A6E for ; Tue, 30 Jan 2018 16:00:16 +0000 (UTC) Received: from mxback13j.mail.yandex.net (mxback13j.mail.yandex.net [IPv6:2a02:6b8:0:1619::88]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 0DDF01843B7 for ; Tue, 30 Jan 2018 19:00:15 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback13j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 2spVxGpYOV-0EXOGDtJ; Tue, 30 Jan 2018 19:00:14 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Nz8CQ597Mi-0EROJla6; Tue, 30 Jan 2018 19:00:14 +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: Tue, 30 Jan 2018 19:00:03 +0300 Message-Id: <1517328009-16379-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> References: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v1 5/11] linux-gen: packet: remove odp_packet_hdr function 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 only one function (packet_hdr) in handle to header pointer conversion. odp_packet_hdr is bad name for an implementation internal function as API function prefix is odp_packet_. Signed-off-by: Petri Savolainen --- /** Email created from pull request 437 (psavol:master-packet-optim) ** https://github.com/Linaro/odp/pull/437 ** Patch: https://github.com/Linaro/odp/pull/437.patch ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd ** Merge commit sha: ab7875c186fe80cfe103c5be5634b0eda312aed4 **/ .../include/odp/api/plat/packet_inlines.h | 5 ----- .../linux-generic/include/odp_packet_internal.h | 8 ++++---- platform/linux-generic/odp_crypto.c | 4 ++-- platform/linux-generic/odp_ipsec.c | 8 ++++---- platform/linux-generic/odp_packet.c | 10 +++++----- platform/linux-generic/odp_packet_flags.c | 22 +++++++++++----------- platform/linux-generic/odp_packet_io.c | 4 ++-- platform/linux-generic/pktio/dpdk.c | 12 ++++++------ platform/linux-generic/pktio/ipc.c | 14 +++++++------- platform/linux-generic/pktio/loop.c | 2 +- platform/linux-generic/pktio/netmap.c | 2 +- platform/linux-generic/pktio/pcap.c | 2 +- platform/linux-generic/pktio/socket.c | 2 +- platform/linux-generic/pktio/socket_mmap.c | 2 +- platform/linux-generic/pktio/tap.c | 2 +- 15 files changed, 47 insertions(+), 52 deletions(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index 90e205fd4..dee8f71ce 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -228,11 +228,6 @@ static inline void _odp_packet_prefetch(odp_packet_t pkt, uint32_t offset, (void)pkt; (void)offset; (void)len; } -static inline odp_buffer_t packet_to_buffer(odp_packet_t pkt) -{ - return (odp_buffer_t)pkt; -} - static inline int _odp_packet_copy_from_mem(odp_packet_t pkt, uint32_t offset, uint32_t len, const void *src) { diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 32e41d7f5..89009a021 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -169,7 +169,7 @@ typedef struct { /** * Return the packet header */ -static inline odp_packet_hdr_t *odp_packet_hdr(odp_packet_t pkt) +static inline odp_packet_hdr_t *packet_hdr(odp_packet_t pkt) { return (odp_packet_hdr_t *)(uintptr_t)pkt; } @@ -181,7 +181,7 @@ static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr) static inline odp_buffer_hdr_t *packet_to_buf_hdr(odp_packet_t pkt) { - return &odp_packet_hdr(pkt)->buf_hdr; + return &packet_hdr(pkt)->buf_hdr; } static inline odp_packet_t packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr) @@ -201,12 +201,12 @@ static inline seg_entry_t *seg_entry_last(odp_packet_hdr_t *hdr) static inline odp_event_subtype_t packet_subtype(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->subtype; + return packet_hdr(pkt)->subtype; } static inline void packet_subtype_set(odp_packet_t pkt, int ev) { - odp_packet_hdr(pkt)->subtype = ev; + packet_hdr(pkt)->subtype = ev; } /** diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 8ae484fd8..325a9d066 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -1434,7 +1434,7 @@ odp_event_t odp_crypto_packet_to_event(odp_packet_t pkt) static odp_crypto_packet_result_t *get_op_result_from_packet(odp_packet_t pkt) { - odp_packet_hdr_t *hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *hdr = packet_hdr(pkt); return &hdr->crypto_op_result; } @@ -1520,7 +1520,7 @@ int odp_crypto_int(odp_packet_t pkt_in, (rc_cipher == ODP_CRYPTO_ALG_ERR_NONE) && (rc_auth == ODP_CRYPTO_ALG_ERR_NONE); - pkt_hdr = odp_packet_hdr(out_pkt); + pkt_hdr = packet_hdr(out_pkt); pkt_hdr->p.error_flags.crypto_err = !op_result->ok; /* Synchronous, simply return results */ diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 521627f1d..586653d4e 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -158,7 +158,7 @@ static odp_ipsec_packet_result_t *ipsec_pkt_result(odp_packet_t packet) ODP_ASSERT(ODP_EVENT_PACKET_IPSEC == odp_event_subtype(odp_packet_to_event(packet))); - return &odp_packet_hdr(packet)->ipsec_ctx; + return &packet_hdr(packet)->ipsec_ctx; } static inline int _odp_ipv4_csum(odp_packet_t pkt, @@ -829,7 +829,7 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, return ipsec_sa; err: - pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr = packet_hdr(pkt); pkt_hdr->p.error_flags.ipsec_err = 1; *pkt_out = pkt; @@ -1404,7 +1404,7 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, return ipsec_sa; err: - pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr = packet_hdr(pkt); pkt_hdr->p.error_flags.ipsec_err = 1; @@ -1652,7 +1652,7 @@ int _odp_ipsec_try_inline(odp_packet_t pkt) result->sa = ipsec_sa->ipsec_sa_hdl; result->flag.inline_mode = 1; - pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr = packet_hdr(pkt); pkt_hdr->p.input_flags.dst_queue = 1; pkt_hdr->dst_queue = queue_fn->from_ext(ipsec_sa->queue); diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 2867e67e9..043e4cb5c 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -49,11 +49,6 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE _odp_packet_inline = { #include -static inline odp_packet_hdr_t *packet_hdr(odp_packet_t pkt) -{ - return (odp_packet_hdr_t *)(uintptr_t)pkt; -} - static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr) { return (odp_buffer_t)pkt_hdr; @@ -69,6 +64,11 @@ odp_packet_t _odp_packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr) return (odp_packet_t)buf_hdr; } +static inline odp_buffer_t packet_to_buffer(odp_packet_t pkt) +{ + return (odp_buffer_t)pkt; +} + static inline seg_entry_t *seg_entry(odp_packet_hdr_t *hdr, uint32_t seg_idx) { diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 96507c664..2909703f3 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -11,18 +11,18 @@ #include #define retflag(pkt, x) do { \ - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); \ + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); \ return pkt_hdr->p.x; \ } while (0) #define setflag(pkt, x, v) do { \ - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); \ + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); \ pkt_hdr->p.x = (v) & 1; \ } while (0) int odp_packet_has_error(odp_packet_t pkt) { - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); return pkt_hdr->p.error_flags.all != 0; } @@ -31,7 +31,7 @@ int odp_packet_has_error(odp_packet_t pkt) int odp_packet_has_l2_error(odp_packet_t pkt) { - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); /* L2 parsing is always done by default and hence no additional check is required */ return pkt_hdr->p.error_flags.frame_len @@ -46,7 +46,7 @@ int odp_packet_has_l3(odp_packet_t pkt) int odp_packet_has_l3_error(odp_packet_t pkt) { - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); return pkt_hdr->p.error_flags.ip_err; } @@ -58,7 +58,7 @@ int odp_packet_has_l4(odp_packet_t pkt) int odp_packet_has_l4_error(odp_packet_t pkt) { - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); return pkt_hdr->p.error_flags.tcp_err | pkt_hdr->p.error_flags.udp_err; } @@ -150,14 +150,14 @@ odp_packet_color_t odp_packet_color(odp_packet_t pkt) void odp_packet_color_set(odp_packet_t pkt, odp_packet_color_t color) { - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); pkt_hdr->p.input_flags.color = color; } odp_bool_t odp_packet_drop_eligible(odp_packet_t pkt) { - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); return !pkt_hdr->p.input_flags.nodrop; } @@ -174,7 +174,7 @@ int8_t odp_packet_shaper_len_adjust(odp_packet_t pkt) void odp_packet_shaper_len_adjust_set(odp_packet_t pkt, int8_t adj) { - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); pkt_hdr->p.output_flags.shaper_len_adj = adj; } @@ -288,14 +288,14 @@ void odp_packet_has_icmp_set(odp_packet_t pkt, int val) void odp_packet_has_flow_hash_clr(odp_packet_t pkt) { - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); pkt_hdr->p.input_flags.flow_hash = 0; } void odp_packet_has_ts_clr(odp_packet_t pkt) { - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); pkt_hdr->p.input_flags.timestamp = 0; } diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index b8dd7c90d..460891d06 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -570,7 +570,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, for (i = 0; i < pkts; i++) { pkt = packets[i]; - pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr = packet_hdr(pkt); buf_hdr = packet_to_buf_hdr(pkt); if (pkt_hdr->p.input_flags.dst_queue) { @@ -698,7 +698,7 @@ int sched_cb_pktin_poll_one(int pktio_index, num_rx = 0; for (i = 0; i < num_pkts; i++) { pkt = packets[i]; - pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr = packet_hdr(pkt); if (odp_unlikely(pkt_hdr->p.input_flags.dst_queue)) { queue = pkt_hdr->dst_queue; buf_hdr = packet_to_buf_hdr(pkt); diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 86d7a4513..bd6920e6a 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -262,7 +262,7 @@ static int pool_dequeue_bulk(struct rte_mempool *mp, void **obj_table, for (i = 0; i < pkts; i++) { odp_packet_t pkt = packet_tbl[i]; - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); struct rte_mbuf *mbuf = (struct rte_mbuf *) (uintptr_t)pkt_hdr->extra; if (pkt_hdr->extra_type != PKT_EXTRA_TYPE_DPDK) @@ -468,7 +468,7 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, } pkt = pkt_table[i]; - pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr = packet_hdr(pkt); pull_tail(pkt_hdr, alloc_len - pkt_len); if (_odp_packet_copy_from_mem(pkt, 0, pkt_len, data) != 0) @@ -636,7 +636,7 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry, return 0; } for (i = 0; i < num; i++) { - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt_table[i]); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt_table[i]); pkt_len = packet_len(pkt_hdr); @@ -697,7 +697,7 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t *pktio_entry, pkt_len = rte_pktmbuf_pkt_len(mbuf); pkt = (odp_packet_t)mbuf->userdata; - pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr = packet_hdr(pkt); if (pktio_cls_enabled(pktio_entry)) { if (cls_classify_packet(pktio_entry, @@ -754,7 +754,7 @@ static inline int pkt_to_mbuf_zero(pktio_entry_t *pktio_entry, for (i = 0; i < num; i++) { odp_packet_t pkt = pkt_table[i]; - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); struct rte_mbuf *mbuf = (struct rte_mbuf *) (uintptr_t)pkt_hdr->extra; uint16_t pkt_len = odp_packet_len(pkt); @@ -1606,7 +1606,7 @@ static int dpdk_send(pktio_entry_t *pktio_entry, int index, for (i = 0; i < mbufs && freed != copy_count; i++) { odp_packet_t pkt = pkt_table[i]; - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); if (pkt_hdr->buf_hdr.segcount > 1) { if (odp_likely(i < tx_pkts)) diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c index b6c493ea0..95b526646 100644 --- a/platform/linux-generic/pktio/ipc.c +++ b/platform/linux-generic/pktio/ipc.c @@ -507,14 +507,14 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry, memcpy(pkt_data, rmt_data_ptr, phdr->frame_len); /* Copy packets L2, L3 parsed offsets and size */ - copy_packet_cls_metadata(phdr, odp_packet_hdr(pkt)); + copy_packet_cls_metadata(phdr, packet_hdr(pkt)); - odp_packet_hdr(pkt)->frame_len = phdr->frame_len; - odp_packet_hdr(pkt)->headroom = phdr->headroom; - odp_packet_hdr(pkt)->tailroom = phdr->tailroom; + packet_hdr(pkt)->frame_len = phdr->frame_len; + packet_hdr(pkt)->headroom = phdr->headroom; + packet_hdr(pkt)->tailroom = phdr->tailroom; /* Take classification fields */ - odp_packet_hdr(pkt)->p = phdr->p; + packet_hdr(pkt)->p = phdr->p; pkt_table[i] = pkt; } @@ -604,7 +604,7 @@ static int ipc_pktio_send_lockless(pktio_entry_t *pktio_entry, odp_packet_hdr_t *pkt_hdr; pool_t *pool; - pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr = packet_hdr(pkt); pool = pkt_hdr->buf_hdr.pool_ptr; if (pool->pool_idx != ipc_pool->pool_idx || @@ -626,7 +626,7 @@ static int ipc_pktio_send_lockless(pktio_entry_t *pktio_entry, for (i = 0; i < num; i++) { uint64_t data_pool_off; odp_packet_t pkt = pkt_table_mapped[i]; - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); odp_pool_t pool_hdl = odp_packet_pool(pkt); pool_t *pool = pool_entry_from_hdl(pool_hdl); diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index aecb0263a..0cf45acbd 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -101,7 +101,7 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED, pkt = packet_from_buf_hdr(hdr_tbl[i]); pkt_len = odp_packet_len(pkt); - pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr = packet_hdr(pkt); packet_parse_reset(pkt_hdr); if (pktio_cls_enabled(pktio_entry)) { diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index c03564f4e..66fe247d3 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -647,7 +647,7 @@ static inline int netmap_pkt_to_odp(pktio_entry_t *pktio_entry, } pkt = pkt_tbl[i]; - pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr = packet_hdr(pkt); pull_tail(pkt_hdr, alloc_len - len); /* For now copy the data in the mbuf, diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c index 76cbf9eef..889903ddd 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -248,7 +248,7 @@ static int pcapif_recv_pkt(pktio_entry_t *pktio_entry, int index ODP_UNUSED, if (ts != NULL) ts_val = odp_time_global(); - pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr = packet_hdr(pkt); if (_odp_packet_copy_from_mem(pkt, 0, hdr->caplen, data) != 0) { ODP_ERR("failed to copy packet data\n"); diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 71980b540..749377c09 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -639,7 +639,7 @@ static int sock_mmsg_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED, void *base = msgvec[i].msg_hdr.msg_iov->iov_base; struct ethhdr *eth_hdr = base; odp_packet_t pkt = pkt_table[i]; - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); uint16_t pkt_len = msgvec[i].msg_len; int ret; diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 2ace1a597..852bc7669 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -243,7 +243,7 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, frame_num = next_frame_num; continue; } - hdr = odp_packet_hdr(pkt_table[nb_rx]); + hdr = packet_hdr(pkt_table[nb_rx]); ret = _odp_packet_copy_from_mem(pkt_table[nb_rx], 0, pkt_len, pkt_buf); if (ret != 0) { diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c index ccfa19b25..56f90b31b 100644 --- a/platform/linux-generic/pktio/tap.c +++ b/platform/linux-generic/pktio/tap.c @@ -280,7 +280,7 @@ static odp_packet_t pack_odp_pkt(pktio_entry_t *pktio_entry, const void *data, return ODP_PACKET_INVALID; } - pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr = packet_hdr(pkt); if (pktio_cls_enabled(pktio_entry)) copy_packet_cls_metadata(&parsed_hdr, pkt_hdr); From patchwork Tue Jan 30 16:00:04 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: 126275 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3494904ljd; Tue, 30 Jan 2018 08:11:25 -0800 (PST) X-Google-Smtp-Source: AH8x224VpPqMRLi5b8nTCiFqKK+VqUj5EaBam4p1MrEAxuAtxet07hYEzqiKZBZpwGVplBaeS3KT X-Received: by 10.55.20.155 with SMTP id 27mr42780959qku.58.1517328685577; Tue, 30 Jan 2018 08:11:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517328685; cv=none; d=google.com; s=arc-20160816; b=voTQ13kCCo4IJj+0GrlKXUVpoTW6VWKiHtjcIQM6+DgEeEOb5lgWC9u5CnFT9s5HIq T6lrdib/gjOcQS9AGOXysaV7BEki49XB4fy1wBh2JQksBtXLRUkQwCMGGkmxTnjm0irf +xIb3LMrubc8Qm9L3mVbxsYttABNzWIBw0C+OO3HDlSAJBhj38/HyL/+cqvzyvAszKLR tDZt0jats+hB96DUZhDrY02L8rpO063wam47+g/ha4/wNk3x7Te+JStJXne60mx+sak0 4eSBvM3X7osvQNN0KV+B/oriRq3chw5a0bZarvqNBDRT3VudY78eEUL3PElVDviFYCLR iFZg== 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=WaBFDsHYqpz97eZSRMc+mlJZuhy/APT43Pz++cW73uc=; b=EML3x4PjPqSKrPoT8LN+2aJnpR/QKdQMZhV2bIVhzlUeoouYCh+pzshWy70NakODH5 oxobK7K+5/MyeoeUBUtKttyJVA4POMw1dkQKGrPPBfJDHBr1hF5A8zDSbS0RrDrueI16 MnTVLAeXt+KASLKqTSVeoZ1+QeIwxBASvQ3miMcU7Hu6tEdWbnuPI30+xgyjiXxbr3It hMT9VRnmXab1PRfKN7jV38NDYO+pmvFqMm1W0Eufm3YpXweaETxgV+olkqHG0urT2t4n 7bjyobH8WmhjQnXINIvK0d+VQynb9/Ej17YOuoBieN16Vt4FsQ6BM6JUofYvxM1mESwl J82Q== 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 s204si1924957qke.396.2018.01.30.08.11.25; Tue, 30 Jan 2018 08:11:25 -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 1A0C2617E6; Tue, 30 Jan 2018 16:11:25 +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 4F22461778; Tue, 30 Jan 2018 16:01:26 +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 2746C61527; Tue, 30 Jan 2018 16:00:32 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id E645A60CBD for ; Tue, 30 Jan 2018 16:00:16 +0000 (UTC) Received: from mxback19j.mail.yandex.net (mxback19j.mail.yandex.net [IPv6:2a02:6b8:0:1619::95]) by forward106o.mail.yandex.net (Yandex) with ESMTP id A934C7849A2 for ; Tue, 30 Jan 2018 19:00:15 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback19j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id wBjoXeWtiD-0FFiCdKs; Tue, 30 Jan 2018 19:00:15 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Nz8CQ597Mi-0FRaWZNl; Tue, 30 Jan 2018 19:00:15 +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: Tue, 30 Jan 2018 19:00:04 +0300 Message-Id: <1517328009-16379-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> References: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v1 6/11] linux-gen: packet: implement packet prefetch 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 For minimal code complexity and negative impact, prefetch only when the requested address is in the first segment and prefetch only one cache line. Signed-off-by: Petri Savolainen --- /** Email created from pull request 437 (psavol:master-packet-optim) ** https://github.com/Linaro/odp/pull/437 ** Patch: https://github.com/Linaro/odp/pull/437.patch ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd ** Merge commit sha: ab7875c186fe80cfe103c5be5634b0eda312aed4 **/ platform/linux-generic/include/odp/api/plat/packet_inlines.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index dee8f71ce..4c0f88aa2 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -225,7 +225,14 @@ static inline odp_packet_seg_t _odp_packet_next_seg(odp_packet_t pkt, static inline void _odp_packet_prefetch(odp_packet_t pkt, uint32_t offset, uint32_t len) { - (void)pkt; (void)offset; (void)len; + uint32_t seg_len = _odp_packet_seg_len(pkt); + uint8_t *data = (uint8_t *)_odp_packet_data(pkt); + (void)len; + + if (odp_unlikely(offset >= seg_len)) + return; + + odp_prefetch(data + offset); } static inline int _odp_packet_copy_from_mem(odp_packet_t pkt, uint32_t offset, From patchwork Tue Jan 30 16:00:05 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: 126274 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3493917ljd; Tue, 30 Jan 2018 08:10:18 -0800 (PST) X-Google-Smtp-Source: AH8x226eSJejo1V+F4dAuWPbur3St6qoXoI2kgA0EDKLdDPgkJQJmajH6qrkpqiweG6BTiihl4R2 X-Received: by 10.200.3.150 with SMTP id t22mr44573160qtg.19.1517328618035; Tue, 30 Jan 2018 08:10:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517328618; cv=none; d=google.com; s=arc-20160816; b=nQR1cnoCvs0R9w5hpzGtAPthCaPi0gZeVv8ghRjEDwIsKWnOz260E8gVyI+H2z5PMN zLHkKyITKkaH8IY2biwRWkCqYQjnyohEBYBjkzZ2zrpJn6oy3Ea01CKUwkjIpNPCC83E TkVKxWBRbFinX4+ZpkBX0htorO1JuOO+pkRyLd4dOoMDDeZbi91KRtD50+wP/NfkZnQ/ 4D+yoiE9AGvQ4C0UGmBWu2qnHSbohn4Sfkb5AkRtbTlRMvszYqLH9+M2uNZqYvuCEEVl UXRYJGv/tjlLBoUDDtJX11nnPXm5ZN4ueu7QkVCGEHtCLvUIG6L7AViHmJwHyxS3Vb9Z H0mQ== 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=wMUEmg/IEiQqe+wkdDnc3fB3VQJBNC/WJYwD4EhwA8g=; b=01mDCMlSkH4opSSKWC104FZmb7BMoh2JgkxGNb5bw8pGkli/TZFmyEy2h/RlrFNVJi tkDSrVHEmlYsIOFjCWI0+DQYZQY4skMd719kexOf+qbKQyX6I971cHs7TTNWPq39gnOH EvnU8k/X7FvrWV4KloTWdPyhxV/9g1a76f62WIUTKJtDEU438Jc5DAkMwwKtvFRqImjX DqcC9sBTEbvdydT2g9X5Zz8Sqa0rdv3xrHnoS5LNbMQFvdFOhK9Sq6mL2gdqN1y4zkfD h5rBPQVeG+cDjwQMBXMlWyt7iENP6pcTrOiEhjCXrmg9rwIiBssH4v0LV7VbVRulyqHm 1MkQ== 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 e12si2618688qtk.68.2018.01.30.08.10.17; Tue, 30 Jan 2018 08:10:18 -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 A665A616E1; Tue, 30 Jan 2018 16:10:17 +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 0C4B261775; Tue, 30 Jan 2018 16:01:23 +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 4BD1660C5E; Tue, 30 Jan 2018 16:00:31 +0000 (UTC) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by lists.linaro.org (Postfix) with ESMTPS id CDE1F6104E for ; Tue, 30 Jan 2018 16:00:17 +0000 (UTC) Received: from mxback2g.mail.yandex.net (mxback2g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:163]) by forward105p.mail.yandex.net (Yandex) with ESMTP id 59F574081AE1 for ; Tue, 30 Jan 2018 19:00:16 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback2g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id y54mKcCO1d-0Gd8QFbq; Tue, 30 Jan 2018 19:00:16 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Nz8CQ597Mi-0FRWcAbR; Tue, 30 Jan 2018 19:00:15 +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: Tue, 30 Jan 2018 19:00:05 +0300 Message-Id: <1517328009-16379-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> References: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v1 7/11] linux-gen: packet: inline conversions between packet and event 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 Inline implementation of packet_from_event and packet_to_event functions. Signed-off-by: Petri Savolainen --- /** Email created from pull request 437 (psavol:master-packet-optim) ** https://github.com/Linaro/odp/pull/437 ** Patch: https://github.com/Linaro/odp/pull/437.patch ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd ** Merge commit sha: ab7875c186fe80cfe103c5be5634b0eda312aed4 **/ include/odp/api/abi-default/buffer.h | 2 +- include/odp/api/abi-default/event.h | 2 +- include/odp/api/abi-default/packet.h | 2 +- .../linux-generic/include-abi/odp/api/abi/buffer.h | 2 +- .../linux-generic/include-abi/odp/api/abi/event.h | 2 +- .../include/odp/api/plat/packet_inlines.h | 29 ++++++++++++ .../include/odp/api/plat/packet_inlines_api.h | 21 +++++++++ platform/linux-generic/odp_packet.c | 51 ++++------------------ 8 files changed, 63 insertions(+), 48 deletions(-) diff --git a/include/odp/api/abi-default/buffer.h b/include/odp/api/abi-default/buffer.h index d8bfc9131..980528ba7 100644 --- a/include/odp/api/abi-default/buffer.h +++ b/include/odp/api/abi-default/buffer.h @@ -20,7 +20,7 @@ typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_buffer_t; typedef _odp_abi_buffer_t *odp_buffer_t; -#define ODP_BUFFER_INVALID ((odp_buffer_t)NULL) +#define ODP_BUFFER_INVALID ((odp_buffer_t)0) /** * @} diff --git a/include/odp/api/abi-default/event.h b/include/odp/api/abi-default/event.h index b52a1a222..0ed6dd094 100644 --- a/include/odp/api/abi-default/event.h +++ b/include/odp/api/abi-default/event.h @@ -22,7 +22,7 @@ typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_event_t; typedef _odp_abi_event_t *odp_event_t; -#define ODP_EVENT_INVALID ((odp_event_t)NULL) +#define ODP_EVENT_INVALID ((odp_event_t)0) typedef enum odp_event_type_t { ODP_EVENT_BUFFER = 1, diff --git a/include/odp/api/abi-default/packet.h b/include/odp/api/abi-default/packet.h index 15cf081bf..086c4d3bd 100644 --- a/include/odp/api/abi-default/packet.h +++ b/include/odp/api/abi-default/packet.h @@ -26,7 +26,7 @@ typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_seg_t; typedef _odp_abi_packet_t *odp_packet_t; typedef _odp_abi_packet_seg_t *odp_packet_seg_t; -#define ODP_PACKET_INVALID ((odp_packet_t)0xffffffff) +#define ODP_PACKET_INVALID ((odp_packet_t)0) #define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)0xffffffff) #define ODP_PACKET_OFFSET_INVALID 0xffff diff --git a/platform/linux-generic/include-abi/odp/api/abi/buffer.h b/platform/linux-generic/include-abi/odp/api/abi/buffer.h index 90b6653a6..879c88afa 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/buffer.h +++ b/platform/linux-generic/include-abi/odp/api/abi/buffer.h @@ -26,7 +26,7 @@ extern "C" { typedef ODP_HANDLE_T(odp_buffer_t); -#define ODP_BUFFER_INVALID _odp_cast_scalar(odp_buffer_t, NULL) +#define ODP_BUFFER_INVALID _odp_cast_scalar(odp_buffer_t, 0) /** * @} diff --git a/platform/linux-generic/include-abi/odp/api/abi/event.h b/platform/linux-generic/include-abi/odp/api/abi/event.h index 802e431f3..49dde956c 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/event.h +++ b/platform/linux-generic/include-abi/odp/api/abi/event.h @@ -26,7 +26,7 @@ extern "C" { typedef ODP_HANDLE_T(odp_event_t); -#define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t, NULL) +#define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t, 0) typedef enum odp_event_type_t { ODP_EVENT_BUFFER = 1, diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index 4c0f88aa2..dc7d464f2 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -263,6 +263,35 @@ static inline int _odp_packet_copy_to_mem(odp_packet_t pkt, uint32_t offset, return 0; } +static inline odp_packet_t _odp_packet_from_event(odp_event_t ev) +{ + return (odp_packet_t)ev; +} + +static inline odp_event_t _odp_packet_to_event(odp_packet_t pkt) +{ + return (odp_event_t)pkt; +} + +static inline void _odp_packet_from_event_multi(odp_packet_t pkt[], + const odp_event_t ev[], + int num) +{ + int i; + + for (i = 0; i < num; i++) + pkt[i] = _odp_packet_from_event(ev[i]); +} + +static inline void _odp_packet_to_event_multi(const odp_packet_t pkt[], + odp_event_t ev[], int num) +{ + int i; + + for (i = 0; i < num; i++) + ev[i] = _odp_packet_to_event(pkt[i]); +} + /** @endcond */ #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 index 9b31c923f..95adec66f 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h @@ -152,4 +152,25 @@ _ODP_INLINE int odp_packet_copy_to_mem(odp_packet_t pkt, uint32_t offset, return _odp_packet_copy_to_mem(pkt, offset, len, dst); } +_ODP_INLINE odp_packet_t odp_packet_from_event(odp_event_t ev) +{ + return _odp_packet_from_event(ev); +} + +_ODP_INLINE odp_event_t odp_packet_to_event(odp_packet_t pkt) +{ + return _odp_packet_to_event(pkt); +} + +_ODP_INLINE void odp_packet_from_event_multi(odp_packet_t pkt[], + const odp_event_t ev[], int num) +{ + return _odp_packet_from_event_multi(pkt, ev, num); +} + +_ODP_INLINE void odp_packet_to_event_multi(const odp_packet_t pkt[], + odp_event_t ev[], int num) +{ + return _odp_packet_to_event_multi(pkt, ev, num); +} #endif diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 043e4cb5c..488dcbddf 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -49,15 +49,14 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE _odp_packet_inline = { #include -static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr) -{ - return (odp_buffer_t)pkt_hdr; -} - -static inline odp_packet_hdr_t *buf_to_packet_hdr(odp_buffer_t buf) -{ - return (odp_packet_hdr_t *)buf_hdl_to_hdr(buf); -} +/* Check that invalid values are the same. Some versions of Clang have trouble + * with the strong type casting, and complain that these invalid values are not + * integral constants. */ +#ifndef __clang__ +ODP_STATIC_ASSERT(ODP_PACKET_INVALID == 0, "Packet invalid not 0"); +ODP_STATIC_ASSERT(ODP_BUFFER_INVALID == 0, "Buffer invalid not 0"); +ODP_STATIC_ASSERT(ODP_EVENT_INVALID == 0, "Event invalid not 0"); +#endif odp_packet_t _odp_packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr) { @@ -998,40 +997,6 @@ int odp_packet_reset(odp_packet_t pkt, uint32_t len) return 0; } -odp_packet_t odp_packet_from_event(odp_event_t ev) -{ - if (odp_unlikely(ev == ODP_EVENT_INVALID)) - return ODP_PACKET_INVALID; - - return (odp_packet_t)buf_to_packet_hdr((odp_buffer_t)ev); -} - -odp_event_t odp_packet_to_event(odp_packet_t pkt) -{ - if (odp_unlikely(pkt == ODP_PACKET_INVALID)) - return ODP_EVENT_INVALID; - - return (odp_event_t)buffer_handle(packet_hdr(pkt)); -} - -void odp_packet_from_event_multi(odp_packet_t pkt[], const odp_event_t ev[], - int num) -{ - int i; - - for (i = 0; i < num; i++) - pkt[i] = odp_packet_from_event(ev[i]); -} - -void odp_packet_to_event_multi(const odp_packet_t pkt[], odp_event_t ev[], - int num) -{ - int i; - - for (i = 0; i < num; i++) - ev[i] = odp_packet_to_event(pkt[i]); -} - int odp_event_filter_packet(const odp_event_t event[], odp_packet_t packet[], odp_event_t remain[], int num) From patchwork Tue Jan 30 16:00:06 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: 126271 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3490165ljd; Tue, 30 Jan 2018 08:06:06 -0800 (PST) X-Google-Smtp-Source: AH8x226szBwagtojbEUH4EUDzSOicgx/fyzkOSwSPxLOAIWA6eOzFFcWnzVMmBLPZO6hARC/kt1g X-Received: by 10.200.52.70 with SMTP id v6mr44042226qtb.63.1517328366009; Tue, 30 Jan 2018 08:06:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517328366; cv=none; d=google.com; s=arc-20160816; b=sO37S8yXZ13oTw+pqPkCHHE/AD0i7tRFxBR0HkVUvKMh8reG5WOL+70/7FJbZmpmPJ bLW9xnNEwroZkXSgboQmLBUNbEAIBViukexPowO9z7WtVFMXjciH+5SEfHHL1Taocg8/ +m8jPpdRnu3cmBqHo103CHEf/epWOoTKN2qoJO8lAHw6fSb2Rh3+d/7i7s40LZSo0QQy ugR8+xyktONNXVHzBPhnMECYkIA1Rv8FM5RfIt7RaV0DElDGxIGAuNjLEccu9v+aRZeU u4fUyk9ww+YrOps00ecQvXp3UJ8m2Z6fMSe2qfekjbDebNEsPSAnnvWi5b/XG/AuKADR NflA== 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=x8m2bPnCdq8I3+AANWD8+whDkVggL9kVfzQd0iFtqT8=; b=pP4JYlSy/c/VfHDqidGYn6o3JivmmpiYCLNvbDkcaV9v/plNdldp+9JE3YabrsPKu/ zkbe6q7lHaNaJ6KJwnupaNi+hqo+vvNu6+zxbPOyXHhzdLQyIP+DMmX4wEQxyV1rNK/7 +JMQBNB2pLtfoD2fnQeJhi2eKheqGq6WMSmMlNhJQmM+yEub+i1sBvpu+PNoJWkpOpCm n091hvY+tnYj7wHjT83n7kGiHeid7sPkm+xC6s863cbV9h8iyf+6bAzrncpvztzKq1K2 fa7MTXCJkCzSSAWml4F6zMR4Jv9nunXk50Kf1B57x+QZUaRMSCn5CINxuY4B7FUCVV05 kpjg== 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 x33si2974439qtb.183.2018.01.30.08.06.05; Tue, 30 Jan 2018 08:06:05 -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 B4FDC61749; Tue, 30 Jan 2018 16:06:05 +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 2ED376175E; Tue, 30 Jan 2018 16:01:02 +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 0054860C5D; Tue, 30 Jan 2018 16:00:26 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 28A9D610B9 for ; Tue, 30 Jan 2018 16:00:18 +0000 (UTC) Received: from mxback10g.mail.yandex.net (mxback10g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:171]) by forward105j.mail.yandex.net (Yandex) with ESMTP id DA467183C12 for ; Tue, 30 Jan 2018 19:00:16 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback10g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 9QXIJwWuMC-0GpOPbag; Tue, 30 Jan 2018 19:00:16 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Nz8CQ597Mi-0GRuonAH; Tue, 30 Jan 2018 19:00:16 +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: Tue, 30 Jan 2018 19:00:06 +0300 Message-Id: <1517328009-16379-9-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> References: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v1 8/11] test: l2fwd: use multi conversion 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 Use multi versions of packet / event conversion functions. Signed-off-by: Petri Savolainen --- /** Email created from pull request 437 (psavol:master-packet-optim) ** https://github.com/Linaro/odp/pull/437 ** Patch: https://github.com/Linaro/odp/pull/437.patch ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd ** Merge commit sha: ab7875c186fe80cfe103c5be5634b0eda312aed4 **/ test/performance/odp_l2fwd.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 09a12b050..a2b9a9ca0 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -270,12 +270,10 @@ static inline int event_queue_send(odp_queue_t queue, odp_packet_t *pkt_tbl, unsigned pkts) { int ret; - unsigned i; unsigned sent = 0; odp_event_t ev_tbl[pkts]; - for (i = 0; i < pkts; i++) - ev_tbl[i] = odp_packet_to_event(pkt_tbl[i]); + odp_packet_to_event_multi(pkt_tbl, ev_tbl, pkts); while (sent < pkts) { ret = odp_queue_enq_multi(queue, &ev_tbl[sent], pkts - sent); @@ -373,8 +371,7 @@ static int run_worker_sched_mode(void *arg) if (pkts <= 0) continue; - for (i = 0; i < pkts; i++) - pkt_tbl[i] = odp_packet_from_event(ev_tbl[i]); + odp_packet_from_event_multi(pkt_tbl, ev_tbl, pkts); if (odp_unlikely(gbl_args->appl.extra_check)) { if (gbl_args->appl.chksum) @@ -499,8 +496,7 @@ static int run_worker_plain_queue_mode(void *arg) if (odp_unlikely(pkts <= 0)) continue; - for (i = 0; i < pkts; i++) - pkt_tbl[i] = odp_packet_from_event(event[i]); + odp_packet_from_event_multi(pkt_tbl, event, pkts); if (odp_unlikely(gbl_args->appl.extra_check)) { if (gbl_args->appl.chksum) From patchwork Tue Jan 30 16:00:07 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: 126272 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3492147ljd; Tue, 30 Jan 2018 08:08:14 -0800 (PST) X-Google-Smtp-Source: AH8x225NZagWYEYdyo9saMMFLHiwKNfe4zfISNX0Hv/KodqRGZcYHmWPQ2UiprZZTf+8GhEZNaUo X-Received: by 10.200.22.53 with SMTP id p50mr45541522qtj.284.1517328494554; Tue, 30 Jan 2018 08:08:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517328494; cv=none; d=google.com; s=arc-20160816; b=cx+NgzkYfu1NcuvbPXjh+WRZm8z+scezSN0etK7ZdfMo//07wPJmJc4PSZJ66dxmfV 1MTqXheD7Tvv/VAnHnQ46Q8RUMo+hb/CqUCIH45mw2iRZJGhhJ84txysrN02pkwtu18d f1tluX3M2myJtgyKfn5WQe8I6xsSOlORneGUfAQSfm4eKluaHppGlh0yReNEmMmCWCn6 ZOJBiu5VZYwCmNe7VacoQqh1+ogOnp6WPepYVG3swkaAxEBaMNXfiltFJKp52NvGQrDX DlyJ7XhHkQRWCBFwH3UwD80aH5A8n8bgax2AbE2eTpK8IkJhtcPMu3VD2PIUJyLnoG2y QoUw== 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=ZN1y7m9bCit0SPKiP7BZEfdsQFA0fUrJuz8sYglIO5I=; b=iXoTcZYiEibAuCvNf5daHXksyWh6WUoBX0kBWgctc0zv5RF3d6k6btK7UxLMd8iqep SgLIGgLyE/Cg8fxcLdM4JMhqopg72w7qWx4dPZ++NylzqsE5Fv66vYDIQeRp4TbXEBtp I1VCGA3oqUH65ofoHNjoUItP7tmF8fgTlpQkj9pz4e9RgxCXKO7dzMocQ74uZcGSbK2l DcgUlWauawN/wvsi8L3WXYighyVvqQjjLz1qxQXvhbW1Cshh4jAUZ/YSmNydi3oIsE0y uO3zqpU9BId/+EQUlBIK78rbjv+xyh/ltMeA1XWC0h5ndO/2EJdxdBJQ9IviJx+gr9Wy MC5Q== 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 p6si5440420qtk.282.2018.01.30.08.08.14; Tue, 30 Jan 2018 08:08:14 -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 27A6B617AD; Tue, 30 Jan 2018 16:08:14 +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 80D9361761; Tue, 30 Jan 2018 16:01:05 +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 6819360C5D; Tue, 30 Jan 2018 16:00:27 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 1829F614E3 for ; Tue, 30 Jan 2018 16:00:19 +0000 (UTC) Received: from mxback7o.mail.yandex.net (mxback7o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::21]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 6480F5104C19 for ; Tue, 30 Jan 2018 19:00:17 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback7o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id CdRIPcWAua-0HKGKxdv; Tue, 30 Jan 2018 19:00:17 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Nz8CQ597Mi-0GRCuN1k; Tue, 30 Jan 2018 19:00:16 +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: Tue, 30 Jan 2018 19:00:07 +0300 Message-Id: <1517328009-16379-10-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> References: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v1 9/11] validation: pktio: don't pass invalid handle to index conversion 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 Fast path functions cannot be expected to always check against invalid handles. Also a handle that has been closed (or destroyed) must not be passed to any API function. Signed-off-by: Petri Savolainen --- /** Email created from pull request 437 (psavol:master-packet-optim) ** https://github.com/Linaro/odp/pull/437 ** Patch: https://github.com/Linaro/odp/pull/437.patch ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd ** Merge commit sha: ab7875c186fe80cfe103c5be5634b0eda312aed4 **/ test/validation/api/pktio/pktio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/validation/api/pktio/pktio.c b/test/validation/api/pktio/pktio.c index a23641036..b20272ffc 100644 --- a/test/validation/api/pktio/pktio.c +++ b/test/validation/api/pktio/pktio.c @@ -1183,7 +1183,7 @@ void pktio_test_lookup(void) void pktio_test_index(void) { - odp_pktio_t pktio, pktio_inval = ODP_PKTIO_INVALID; + odp_pktio_t pktio; odp_pktio_param_t pktio_param; int ndx; @@ -1195,10 +1195,8 @@ void pktio_test_index(void) ndx = odp_pktio_index(pktio); CU_ASSERT(ndx >= 0); - CU_ASSERT(odp_pktio_index(pktio_inval) < 0); CU_ASSERT(odp_pktio_close(pktio) == 0); - CU_ASSERT(odp_pktio_index(pktio) < 0); } static void pktio_test_print(void) From patchwork Tue Jan 30 16:00:08 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: 126273 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3492949ljd; Tue, 30 Jan 2018 08:09:08 -0800 (PST) X-Google-Smtp-Source: AH8x226yLiDvY3+gemUf8EM+XOtCjDMVRp17CyYQeXG+IUzM+dw0s0bVe1Oe6xuHB38Qtfhahq8i X-Received: by 10.55.141.198 with SMTP id p189mr39719254qkd.65.1517328548427; Tue, 30 Jan 2018 08:09:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517328548; cv=none; d=google.com; s=arc-20160816; b=cLr9WyUT3CMS5I/kIbOrLvzCRCfDc836Z7YsBzhuUD2la8OuCVlb+0KfdUl5ZcgCRx PPF00jxcDBBIOKoSzU/5JZ/GAAOIeRDaL2m6mh16ChdNfzaG6cY0xB49AMnSPs8qqHtw F4o7d/HJYTi8+CNN7p7V2sVpVUOi9Ugeod72KAf5xCQRtoV/YAMkt+FvSNP/wZrFrvcW YKzbbgfLxESmjTx61Me0mAE3JYoTHCfNd5BWOxGbzvEL3U66PccBKb0SoHtsJE5NP4de qDGTsBFRmn2sQu41ZdN+P8Sfh6cX/FO6xZfxCVH7+KWGdnSlmcHSbHx+51ZqhqGll8UA 0T9Q== 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=o5BBQxD03rwY94WbhcgWPBkBQyEstkp1gmmgE9xyqXA=; b=Ej3fnrq7/K70RdiKGpomiB5frWNcaA9FoWIDxV/r2STGLCig4L1AQ/7Wm/1bGvxTo3 nJ02gJr3gyTmTyXD/vG4tUVNJBDPbxt7eehqv8iFV5WfiKx4ZR++Gq3ndNh2/8aoGEiz pgu0CVJ6n77NUrlD4+CFWCO01D40HMwhzK0+ZhjKmJmaESaeM3s0IOEMsdRrTJCt8vHw amEluuzHsElBgs0JS24RxA3PM9R9iDNb1QfM+utOJj9ZhoLD/jF5Akc4PiXYhuRGwBwR zuLWAzxd6h2oYPlIqPOpEHuLzvJpEHCMhjviq0xBgkwXrenyO9x6USrHDpBET0dUH0qj hotg== 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 y1si1420074qtk.162.2018.01.30.08.09.08; Tue, 30 Jan 2018 08:09:08 -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 1299F617C4; Tue, 30 Jan 2018 16:09:08 +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 CEA1161767; Tue, 30 Jan 2018 16:01:14 +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 483ED60C5E; Tue, 30 Jan 2018 16:00:29 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id 81B6761506 for ; Tue, 30 Jan 2018 16:00:19 +0000 (UTC) Received: from mxback6g.mail.yandex.net (mxback6g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:167]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 13BC9560373D for ; Tue, 30 Jan 2018 19:00:18 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback6g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id BFPONncvQq-0H2Wjbv8; Tue, 30 Jan 2018 19:00:17 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Nz8CQ597Mi-0HRaeXfm; Tue, 30 Jan 2018 19:00:17 +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: Tue, 30 Jan 2018 19:00:08 +0300 Message-Id: <1517328009-16379-11-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> References: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v1 10/11] linux-gen: pktio: inline pktio index function 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 Inline packet IO interface handle to index conversion function which may be used frequently. Signed-off-by: Petri Savolainen --- /** Email created from pull request 437 (psavol:master-packet-optim) ** https://github.com/Linaro/odp/pull/437 ** Patch: https://github.com/Linaro/odp/pull/437.patch ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd ** Merge commit sha: ab7875c186fe80cfe103c5be5634b0eda312aed4 **/ platform/linux-generic/Makefile.am | 3 +++ .../include-abi/odp/api/abi/packet_io.h | 4 +++ .../include/odp/api/plat/pktio_inlines.h | 27 +++++++++++++++++++ .../include/odp/api/plat/pktio_inlines_api.h | 31 ++++++++++++++++++++++ .../linux-generic/include/odp_packet_io_internal.h | 13 ++++----- platform/linux-generic/odp_packet.c | 4 ++- platform/linux-generic/odp_packet_io.c | 17 +++--------- platform/linux-generic/odp_pktio_api.c | 14 ++++++++++ 8 files changed, 93 insertions(+), 20 deletions(-) create mode 100644 platform/linux-generic/include/odp/api/plat/pktio_inlines.h create mode 100644 platform/linux-generic/include/odp/api/plat/pktio_inlines_api.h create mode 100644 platform/linux-generic/odp_pktio_api.c diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 10e38ac3c..1c2b625cb 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -30,6 +30,8 @@ odpapiplatinclude_HEADERS = \ include/odp/api/plat/packet_inline_types.h \ include/odp/api/plat/packet_inlines.h \ include/odp/api/plat/packet_inlines_api.h \ + include/odp/api/plat/pktio_inlines.h \ + include/odp/api/plat/pktio_inlines_api.h \ include/odp/api/plat/pool_inline_types.h \ include/odp/api/plat/std_clib_inlines.h \ include/odp/api/plat/strong_types.h \ @@ -205,6 +207,7 @@ __LIB__libodp_linux_la_SOURCES += \ odp_byteorder.c \ odp_packet_api.c \ odp_packet_flags_api.c \ + odp_pktio_api.c \ odp_std_clib.c \ odp_sync.c \ odp_thread_api.c \ diff --git a/platform/linux-generic/include-abi/odp/api/abi/packet_io.h b/platform/linux-generic/include-abi/odp/api/abi/packet_io.h index a84e858e6..07931b817 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/packet_io.h +++ b/platform/linux-generic/include-abi/odp/api/abi/packet_io.h @@ -51,6 +51,10 @@ typedef struct odp_pktout_queue_t { * @} */ +#define _ODP_INLINE static inline +#include +#include + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/include/odp/api/plat/pktio_inlines.h b/platform/linux-generic/include/odp/api/plat/pktio_inlines.h new file mode 100644 index 000000000..6a2aa72d8 --- /dev/null +++ b/platform/linux-generic/include/odp/api/plat/pktio_inlines.h @@ -0,0 +1,27 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef ODP_PLAT_PKTIO_INLINES_H_ +#define ODP_PLAT_PKTIO_INLINES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @cond _ODP_HIDE_FROM_DOXYGEN_ */ + +static inline int _odp_pktio_index(odp_pktio_t pktio) +{ + return (int)(uintptr_t)pktio - 1; +} + +/** @endcond */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp/api/plat/pktio_inlines_api.h b/platform/linux-generic/include/odp/api/plat/pktio_inlines_api.h new file mode 100644 index 000000000..5b59a4378 --- /dev/null +++ b/platform/linux-generic/include/odp/api/plat/pktio_inlines_api.h @@ -0,0 +1,31 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + */ + +#ifndef ODP_PLAT_PKTIO_INLINES_API_H_ +#define ODP_PLAT_PKTIO_INLINES_API_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +_ODP_INLINE int odp_pktio_index(odp_pktio_t pktio) +{ + return _odp_pktio_index(pktio); +} + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index ad34e964a..1de0cbf90 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -18,6 +18,8 @@ extern "C" { #endif +#include +#include #include #include #include @@ -235,13 +237,10 @@ typedef struct pktio_if_ops { extern void *pktio_entry_ptr[]; -static inline int pktio_to_id(odp_pktio_t pktio) -{ - return _odp_typeval(pktio) - 1; -} - static inline pktio_entry_t *get_pktio_entry(odp_pktio_t pktio) { + int idx; + if (odp_unlikely(pktio == ODP_PKTIO_INVALID)) return NULL; @@ -251,7 +250,9 @@ static inline pktio_entry_t *get_pktio_entry(odp_pktio_t pktio) return NULL; } - return pktio_entry_ptr[pktio_to_id(pktio)]; + idx = _odp_pktio_index(pktio); + + return pktio_entry_ptr[idx]; } static inline int pktio_cls_enabled(pktio_entry_t *entry) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 488dcbddf..1909bae25 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include #include @@ -1269,7 +1271,7 @@ void *odp_packet_offset(odp_packet_t pkt, uint32_t offset, uint32_t *len, int odp_packet_input_index(odp_packet_t pkt) { - return odp_pktio_index(packet_hdr(pkt)->input); + return _odp_pktio_index(packet_hdr(pkt)->input); } void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 460891d06..4eae4ed1e 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -481,7 +482,7 @@ int odp_pktio_start(odp_pktio_t hdl) } } - sched_fn->pktio_start(pktio_to_id(hdl), num, index, odpq); + sched_fn->pktio_start(_odp_pktio_index(hdl), num, index, odpq); } return res; @@ -1022,16 +1023,6 @@ int odp_pktio_info(odp_pktio_t hdl, odp_pktio_info_t *info) return 0; } -int odp_pktio_index(odp_pktio_t pktio) -{ - pktio_entry_t *entry = get_pktio_entry(pktio); - - if (!entry || is_free(entry)) - return -1; - - return pktio_to_id(pktio); -} - uint64_t odp_pktin_ts_res(odp_pktio_t hdl) { pktio_entry_t *entry; @@ -1361,7 +1352,7 @@ int odp_pktin_queue_config(odp_pktio_t pktio, mode == ODP_PKTIN_MODE_SCHED) { odp_queue_param_t queue_param; char name[ODP_QUEUE_NAME_LEN]; - int pktio_id = pktio_to_id(pktio); + int pktio_id = _odp_pktio_index(pktio); snprintf(name, sizeof(name), "odp-pktin-%i-%i", pktio_id, i); @@ -1496,7 +1487,7 @@ int odp_pktout_queue_config(odp_pktio_t pktio, odp_queue_param_t queue_param; queue_t q_int; char name[ODP_QUEUE_NAME_LEN]; - int pktio_id = pktio_to_id(pktio); + int pktio_id = _odp_pktio_index(pktio); snprintf(name, sizeof(name), "odp-pktout-%i-%i", pktio_id, i); diff --git a/platform/linux-generic/odp_pktio_api.c b/platform/linux-generic/odp_pktio_api.c new file mode 100644 index 000000000..f4dc33466 --- /dev/null +++ b/platform/linux-generic/odp_pktio_api.c @@ -0,0 +1,14 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "config.h" + +#include +#include + +/* Include non-inlined versions of API functions */ +#define _ODP_INLINE +#include From patchwork Tue Jan 30 16:00:09 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: 126276 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3495892ljd; Tue, 30 Jan 2018 08:12:33 -0800 (PST) X-Google-Smtp-Source: AH8x2256HCy6fAq+yjLN9rLhyT8X6Rn1XNHrF9g32oVynCp1StMdYF0UxQml8sb2cQ93RscoUYwa X-Received: by 10.55.7.2 with SMTP id 2mr27676155qkh.244.1517328753211; Tue, 30 Jan 2018 08:12:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517328753; cv=none; d=google.com; s=arc-20160816; b=ikmRHyW8QALKBNk2Ne9ZfEgyLkvtet6vNbO9E6LnboHk8qRR4bcAED5FVOtJIueqxa 7Ji2RtMxL7RKXNrFaxyebD5rOdQSwSjYspNzKW80qm1A7s/yN9qUmY5IqshndsvYAzoE AFj4KciQGXkVrnlCHvGdglangV0gm9R9XV4bRIRXr0SodUpSNjp4n2KUOZLt+DjG6Peb A3IEpFEpGwG1gPYJt93KETOOHcrH3S8SBj4g6//bY1aBTu62iKf1SrBDt3dznKZZavpP BGpDT7Yksg7a2CikLO1VspK/uGWNNYd3uTlgP/WzWzP7OE2ZSLI07Ck5uR9vjuEhQEtw +hDw== 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=6sfYmBdOcJLXGbJEmxkTWap9yGD+vbofksnWNNcwQ8g=; b=wiaz6Xc+Tt7rWb8YnkRn+GpsOQw9G6afzDL5q2j7SW02uK8OoCUqeq9WJ3pD43MaUA y9/k7I73UX4OgDHEyuF830rSXcmCEqsW5f9Yu5UwwY4GmshSpn/CYPOyAMlfiByX9nYM onZQlZjmJdY4qxYkY3ugmvlMBfZ20/j4piIzi75dK85Sl2XoxqsMlZB7yuYm+7BIU86J c+jkPcgs5X0huj1COB/C1jm+W6AVcDlx6yRog1wkWJji5qgcsNseoTFmiFbEEysZk+gA 322LrgDCgBO7MIeuwa41xd+hqQeu8UlQEBXhp39+y7tJg0DcbgC/2HULQgXt8VVn3YKQ iMHw== 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 w33si827938qtj.345.2018.01.30.08.12.32; Tue, 30 Jan 2018 08:12:33 -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 DB41061807; Tue, 30 Jan 2018 16:12: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 AFDB661780; Tue, 30 Jan 2018 16:01:29 +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 80973616E3; Tue, 30 Jan 2018 16:00:37 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id B931F6077E for ; Tue, 30 Jan 2018 16:00:23 +0000 (UTC) Received: from mxback7g.mail.yandex.net (mxback7g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:168]) by forward100o.mail.yandex.net (Yandex) with ESMTP id B81622A224E5 for ; Tue, 30 Jan 2018 19:00:18 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback7g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id NizUsJP8DF-0IGikoYd; Tue, 30 Jan 2018 19:00:18 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Nz8CQ597Mi-0IRusqat; Tue, 30 Jan 2018 19:00:18 +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: Tue, 30 Jan 2018 19:00:09 +0300 Message-Id: <1517328009-16379-12-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> References: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v1 11/11] linux-gen: packet: inline packet input index function 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 Inline packet input interface index function which may be used frequently. Signed-off-by: Petri Savolainen --- /** Email created from pull request 437 (psavol:master-packet-optim) ** https://github.com/Linaro/odp/pull/437 ** Patch: https://github.com/Linaro/odp/pull/437.patch ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd ** Merge commit sha: ab7875c186fe80cfe103c5be5634b0eda312aed4 **/ platform/linux-generic/include/odp/api/plat/packet_inlines.h | 8 ++++++++ platform/linux-generic/include/odp/api/plat/packet_inlines_api.h | 5 +++++ platform/linux-generic/odp_packet.c | 5 ----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index dc7d464f2..0704abb2f 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -22,6 +22,7 @@ #include #include +#include #include @@ -89,6 +90,13 @@ static inline odp_pktio_t _odp_packet_input(odp_packet_t pkt) return _odp_pkt_get(pkt, odp_pktio_t, input); } +static inline int _odp_packet_input_index(odp_packet_t pkt) +{ + odp_pktio_t pktio = _odp_packet_input(pkt); + + return _odp_pktio_index(pktio); +} + static inline int _odp_packet_num_segs(odp_packet_t pkt) { return _odp_pkt_get(pkt, uint8_t, segcount); 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 index 95adec66f..c451c4d6c 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h @@ -48,6 +48,11 @@ _ODP_INLINE odp_pktio_t odp_packet_input(odp_packet_t pkt) return _odp_packet_input(pkt); } +_ODP_INLINE int odp_packet_input_index(odp_packet_t pkt) +{ + return _odp_packet_input_index(pkt); +} + _ODP_INLINE int odp_packet_num_segs(odp_packet_t pkt) { return _odp_packet_num_segs(pkt); diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 1909bae25..9c3be1bcc 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -1269,11 +1269,6 @@ void *odp_packet_offset(odp_packet_t pkt, uint32_t offset, uint32_t *len, * */ -int odp_packet_input_index(odp_packet_t pkt) -{ - return _odp_pktio_index(packet_hdr(pkt)->input); -} - void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx) { packet_hdr(pkt)->buf_hdr.buf_cctx = ctx;