From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 57F552B9E; Tue, 20 Nov 2018 18:26:20 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2018 09:26:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,257,1539673200"; d="scan'208";a="93554684" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga008.jf.intel.com with ESMTP; 20 Nov 2018 09:26:18 -0800 Received: from irsmsx106.ger.corp.intel.com ([169.254.8.8]) by IRSMSX154.ger.corp.intel.com ([169.254.12.166]) with mapi id 14.03.0415.000; Tue, 20 Nov 2018 17:26:17 +0000 From: "Ananyev, Konstantin" To: "Zhang, Qi Z" , "Richardson, Bruce" , "Wiles, Keith" CC: "dev@dpdk.org" , "Lu, Wenzhuo" , "Iremonger, Bernard" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] app/testpmd: improve MAC swap performance Thread-Index: AQHUgIvCSKoZvPnjN0eggi2tlA1D3KVYYfvggACBU4CAAAdaIA== Date: Tue, 20 Nov 2018 17:26:16 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258010CEBA382@IRSMSX106.ger.corp.intel.com> References: <20181120044537.9495-1-qi.z.zhang@intel.com> <2601191342CEEE43887BDE71AB977258010CEBA106@IRSMSX106.ger.corp.intel.com> <039ED4275CED7440929022BC67E70611532E8AAD@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <039ED4275CED7440929022BC67E70611532E8AAD@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiY2MwZjc1NGMtYjNjNi00MzU5LTk0MGUtZmZiN2VmZDc2ZThhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoianFTVTFzNWJtaTNmTlpoNlhCTEtIUzFpcXJyd29CMDhsOFdQbmo2V1wvM0RqZ3RQMjFCcFVHQkM0djRSR29EU2gifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] app/testpmd: improve MAC swap performance X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Nov 2018 17:26:21 -0000 > -----Original Message----- > From: Zhang, Qi Z > Sent: Tuesday, November 20, 2018 4:58 PM > To: Ananyev, Konstantin ; Richardson, Bruce= ; Wiles, Keith > > Cc: dev@dpdk.org; Lu, Wenzhuo ; Iremonger, Bernard = ; stable@dpdk.org > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: improve MAC swap performance >=20 >=20 >=20 > > -----Original Message----- > > From: Ananyev, Konstantin > > Sent: Tuesday, November 20, 2018 1:17 AM > > To: Zhang, Qi Z ; Richardson, Bruce > > ; Wiles, Keith > > Cc: dev@dpdk.org; Lu, Wenzhuo ; Iremonger, Bernar= d > > ; Zhang, Qi Z ; > > stable@dpdk.org > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: improve MAC swap performan= ce > > > > Hi Qi, > > > > > -----Original Message----- > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qi Zhang > > > Sent: Tuesday, November 20, 2018 4:46 AM > > > To: Richardson, Bruce ; Wiles, Keith > > > > > > Cc: dev@dpdk.org; Lu, Wenzhuo ; Iremonger, > > > Bernard ; Zhang, Qi Z > > > ; stable@dpdk.org > > > Subject: [dpdk-dev] [PATCH] app/testpmd: improve MAC swap performance > > > > > > The patch optimizes the mac swap operation by taking advantage of SSE > > > instructions, it only impacts x86 platform. > > > > > > Cc: stable@dpdk.org > > > > > > Signed-off-by: Qi Zhang > > > --- > > > app/test-pmd/macswap.c | 16 +++++++++++++++- > > > 1 file changed, 15 insertions(+), 1 deletion(-) > > > > > > diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index > > > a8384d5b8..0722782b0 100644 > > > --- a/app/test-pmd/macswap.c > > > +++ b/app/test-pmd/macswap.c > > > @@ -78,7 +78,6 @@ pkt_burst_mac_swap(struct fwd_stream *fs) > > > struct rte_port *txp; > > > struct rte_mbuf *mb; > > > struct ether_hdr *eth_hdr; > > > - struct ether_addr addr; > > > uint16_t nb_rx; > > > uint16_t nb_tx; > > > uint16_t i; > > > @@ -95,6 +94,15 @@ pkt_burst_mac_swap(struct fwd_stream *fs) > > > start_tsc =3D rte_rdtsc(); > > > #endif > > > > > > +#ifdef RTE_ARCH_X86 > > > + __m128i addr; > > > + __m128i shfl_msk =3D _mm_set_epi8(15, 14, 13, 12, > > > + 5, 4, 3, 2, > > > + 1, 0, 11, 10, > > > + 9, 8, 7, 6); > > > +#else > > > + struct ether_addr addr; > > > +#endif > > > > I think it would better to place IA specific code into a separate fncti= on (and > > probably into a separate .h file). >=20 > OK, I will think about how to rework this. Ideally would be good to have an generic one, and IA optimized version. >=20 > > BTW, just curious what % of improvement it gives? >=20 > So far , the only server I can test is a 1.6GHz Broadwell server with 2 p= orts on 1 i40e 25G. > The macswap performance is increase from 16.8mpps to 20mpps (about 19% im= provement) Quite a lot, definitely looks like worth it. >=20 > > Konstantin > > > > > > > /* > > > * Receive a burst of packets and forward them. > > > */ > > > @@ -123,9 +131,15 @@ pkt_burst_mac_swap(struct fwd_stream *fs) > > > eth_hdr =3D rte_pktmbuf_mtod(mb, struct ether_hdr *); > > > > > > /* Swap dest and src mac addresses. */ > > > +#ifdef RTE_ARCH_X86 > > > + addr =3D _mm_loadu_si128((__m128i *)eth_hdr); > > > + addr =3D _mm_shuffle_epi8(addr, shfl_msk); > > > + _mm_storeu_si128((__m128i *)eth_hdr, addr); #else > > > ether_addr_copy(ð_hdr->d_addr, &addr); > > > ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); > > > ether_addr_copy(&addr, ð_hdr->s_addr); > > > +#endif > > > > > > mb->ol_flags &=3D IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; > > > mb->ol_flags |=3D ol_flags; > > > -- > > > 2.13.6