From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E08CA0561; Thu, 18 Mar 2021 11:26:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 73026140E92; Thu, 18 Mar 2021 11:26:25 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 65EAB140E9B for ; Thu, 18 Mar 2021 11:26:24 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D963E31B; Thu, 18 Mar 2021 03:26:23 -0700 (PDT) Received: from net-arm-n1amp-01.shanghai.arm.com (net-arm-n1amp-01.shanghai.arm.com [10.169.210.137]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 08FCD3F792; Thu, 18 Mar 2021 03:26:20 -0700 (PDT) From: Ruifeng Wang To: jerinj@marvell.com, hemant.agrawal@nxp.com, ferruh.yigit@intel.com, thomas@monjalon.net, david.marchand@redhat.com Cc: dev@dpdk.org, nd@arm.com, honnappa.nagarahalli@arm.com, Ruifeng Wang Date: Thu, 18 Mar 2021 10:25:47 +0000 Message-Id: <20210318102550.59265-2-ruifeng.wang@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210318102550.59265-1-ruifeng.wang@arm.com> References: <20210318102550.59265-1-ruifeng.wang@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/4] examples/l3fwd: tune prefetch for better performance X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Packet header is prefetched before packet processing for better memory access performance. As L2 header will be updated by l3fwd, using of prefetch for store hint will set cache line to proper status and reduce cache maintenance overhead. With this change, 12.9% performance uplift was measured on N1SDP platform with MLX5 NIC. Suggested-by: Honnappa Nagarahalli Signed-off-by: Ruifeng Wang Reviewed-by: Honnappa Nagarahalli --- examples/l3fwd/l3fwd_lpm_neon.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h index d6c0ba64a..ae8840694 100644 --- a/examples/l3fwd/l3fwd_lpm_neon.h +++ b/examples/l3fwd/l3fwd_lpm_neon.h @@ -97,13 +97,13 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, if (k) { for (i = 0; i < FWDSTEP; i++) { - rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i], + rte_prefetch0_write(rte_pktmbuf_mtod(pkts_burst[i], struct rte_ether_hdr *) + 1); } for (j = 0; j != k - FWDSTEP; j += FWDSTEP) { for (i = 0; i < FWDSTEP; i++) { - rte_prefetch0(rte_pktmbuf_mtod( + rte_prefetch0_write(rte_pktmbuf_mtod( pkts_burst[j + i + FWDSTEP], struct rte_ether_hdr *) + 1); } @@ -124,17 +124,17 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, /* Prefetch last up to 3 packets one by one */ switch (m) { case 3: - rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], + rte_prefetch0_write(rte_pktmbuf_mtod(pkts_burst[j], struct rte_ether_hdr *) + 1); j++; /* fallthrough */ case 2: - rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], + rte_prefetch0_write(rte_pktmbuf_mtod(pkts_burst[j], struct rte_ether_hdr *) + 1); j++; /* fallthrough */ case 1: - rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], + rte_prefetch0_write(rte_pktmbuf_mtod(pkts_burst[j], struct rte_ether_hdr *) + 1); j++; } -- 2.25.1