From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 6B46F5908 for ; Tue, 3 May 2016 11:48:57 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 03 May 2016 02:48:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,572,1455004800"; d="scan'208";a="945046686" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by orsmga001.jf.intel.com with ESMTP; 03 May 2016 02:48:36 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.238]) by IRSMSX106.ger.corp.intel.com ([169.254.8.172]) with mapi id 14.03.0248.002; Tue, 3 May 2016 10:48:35 +0100 From: "De Lara Guarch, Pablo" To: "Richardson, Bruce" , Jerin Jacob CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] app/testpmd: add packet data prefetch in macswap loop Thread-Index: AQHRpGo45P/QjXDI7ES0+F+BQvxmz5+m52YAgAAQ/pA= Date: Tue, 3 May 2016 09:48:34 +0000 Message-ID: References: <1462190377-26865-1-git-send-email-jerin.jacob@caviumnetworks.com> <20160503094516.GC21300@bricha3-MOBL3> In-Reply-To: <20160503094516.GC21300@bricha3-MOBL3> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZWM3ZDYyYzEtNDQ2ZC00MWZiLTk5NTktMTg5NTVjMDNlOTg1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkNJditERGJBZ05GU0JQWjlzOVpxNFdVbmkyMW1vWURxajJKSjl2RkN4QW89In0= x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] app/testpmd: add packet data prefetch in macswap loop X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2016 09:48:57 -0000 > -----Original Message----- > From: Richardson, Bruce > Sent: Tuesday, May 03, 2016 10:45 AM > To: Jerin Jacob > Cc: dev@dpdk.org; De Lara Guarch, Pablo > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: add packet data prefetch in > macswap loop >=20 > On Mon, May 02, 2016 at 05:29:37PM +0530, Jerin Jacob wrote: > > prefetch the next packet data address in advance in macswap loop > > for performance improvement. > > > > Signed-off-by: Jerin Jacob > > --- > > app/test-pmd/macswap.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c > > index 154889d..c10f4b5 100644 > > --- a/app/test-pmd/macswap.c > > +++ b/app/test-pmd/macswap.c > > @@ -113,6 +113,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs) > > if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) > > ol_flags |=3D PKT_TX_QINQ_PKT; > > for (i =3D 0; i < nb_rx; i++) { > > + if (likely(i < nb_rx - 1)) > > + rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1], > > + void *)); >=20 > At least on IA platforms, there is no issue with prefetching beyond the e= nd of > the array, since it's only a hint to the cpu. If this is true for other p= latforms, > then I suggest we just drop the conditional and just always prefetch. That's what I thought when I saw this patch, but the problem is that the pr= efetch is not for pkts_burst, but for rte_pktmbuf_mtod(pkts_burst...), so there must be a limit in nb_rx = - 2, or there will be a seg fault. Pablo >=20 > /Bruce >=20 > > mb =3D pkts_burst[i]; > > eth_hdr =3D rte_pktmbuf_mtod(mb, struct ether_hdr *); > > > > -- > > 2.1.0 > >