From patchwork Wed Jan 31 14: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: 126335 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp759708ljc; Wed, 31 Jan 2018 06:04:31 -0800 (PST) X-Google-Smtp-Source: AH8x2240BZ3XFCDTsoA9q4UxWtjcR9pSfKLaZ2kJvd5eAQOcPR/segcfWlpbOmDXK+P3yHmYqgzy X-Received: by 10.129.93.139 with SMTP id r133mr9995280ywb.422.1517407471685; Wed, 31 Jan 2018 06:04:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517407471; cv=none; d=google.com; s=arc-20160816; b=fD020wbjoHSe+90cC0AJMs0aNg0yF0WVDdEE2wKXeR/GV6/TzOYAfVt35+8eUrmj3R Ok8N8nIMVx4HDNvwBl2rRlnOdpGL2CksVIBmG2PlDrnMDDoyz46x5fUOU03QxIT9pkUO Y2qZJZ5FjLq0vkez73gSqrM6AFvGY9YDHAUPRjXV9mzKshzoN+ollvtbxOaQcE0T6U1Y pBsnLOAvQEp33Jq8Gp01Kymq7+2w3NnM1ks2oh+dWD/QWGl0UXZ/NmuVA8w+OsHUeoBX 0005q0/h0b4N4cId3Fz+uTP3OvNgh1JLnJyHudpB1+O8V6lu6X40MA/9txFQosbIg95P 9aRA== 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=NwGgkeYBZqPSbysPWKM5nWdVZUHYTC+wgjbY2/7A7qk=; b=WaU/Yehcf01dIUmUB7MM7BnRFAB0QoJIlROxtmW6zquiVHo3ySg7iq4VFZgH/5hQdv QCl/proORy90+Kg/Vy8TDKKtwSOJKRVFIS7H2YFZ+dJSeMZEnQCopmbjfEyYuGx3LZS0 0iWFoQPBkV0D73NkjNZW7KQMg/RTNWDIyRjhbCcMolGce8HgJN9g6HWUvCBa+tEbKF2q Rt+kVLRaUU7WwxmOHUwR6egzIpUakXrXtB6RcBZgTBSbB+b1ceg5AC5/0zWwRbHccbKL 9+oR8aERyKObhmuUM3askiz+6bS0u8P1t/JEwNe242cI9LS4FlAUKaHpp2lH5D8D9ki+ Dfhw== 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 l63si610994ybf.633.2018.01.31.06.04.31; Wed, 31 Jan 2018 06:04:31 -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 4A216617E8; Wed, 31 Jan 2018 14:04:31 +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 6626E61790; Wed, 31 Jan 2018 14:00:42 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id DF7DF60C4C; Wed, 31 Jan 2018 14:00:29 +0000 (UTC) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [37.140.190.182]) by lists.linaro.org (Postfix) with ESMTPS id AF9CB60C56 for ; Wed, 31 Jan 2018 14:00:19 +0000 (UTC) Received: from mxback3g.mail.yandex.net (mxback3g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:164]) by forward102o.mail.yandex.net (Yandex) with ESMTP id 3C20D5A04138 for ; Wed, 31 Jan 2018 17:00:17 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback3g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 7gpuqOUPaY-0HDukY6I; Wed, 31 Jan 2018 17:00:17 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id nmVaH0g7bK-0GVKails; Wed, 31 Jan 2018 17: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: Wed, 31 Jan 2018 17:00:06 +0300 Message-Id: <1517407211-19105-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517407211-19105-1-git-send-email-odpbot@yandex.ru> References: <1517407211-19105-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v2 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: 3c2134ecc18e4fd52cd526b5c067815ca73864cc **/ 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,