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,