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 C47B411A4; Tue, 20 Nov 2018 15:49:04 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2018 06:49:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,257,1539673200"; d="scan'208";a="281525432" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga005.fm.intel.com with ESMTP; 20 Nov 2018 06:49:03 -0800 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 20 Nov 2018 06:48:44 -0800 Received: from fmsmsx118.amr.corp.intel.com ([169.254.1.160]) by fmsmsx122.amr.corp.intel.com ([169.254.5.168]) with mapi id 14.03.0415.000; Tue, 20 Nov 2018 06:48:44 -0800 From: "Wiles, Keith" To: "Ananyev, Konstantin" CC: "Zhang, Qi Z" , "Richardson, Bruce" , "dev@dpdk.org" , "Lu, Wenzhuo" , "Iremonger, Bernard" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] app/testpmd: improve MAC swap performance Thread-Index: AQHUgIu2WDX9Iwc3dkmCSNxM+XXwtKVY6JSAgABctIA= Date: Tue, 20 Nov 2018 14:48:43 +0000 Message-ID: <370D42AF-375C-416D-98E6-2EAF4B77260E@intel.com> References: <20181120044537.9495-1-qi.z.zhang@intel.com> <2601191342CEEE43887BDE71AB977258010CEBA106@IRSMSX106.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB977258010CEBA106@IRSMSX106.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.254.187.243] Content-Type: text/plain; charset="us-ascii" Content-ID: <9898825C5DAE354C838F36FA43558575@intel.com> 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 14:49:05 -0000 > On Nov 20, 2018, at 3:16 AM, Ananyev, Konstantin wrote: >=20 > Hi Qi, >=20 >> -----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 >>=20 >> The patch optimizes the mac swap operation by taking advantage >> of SSE instructions, it only impacts x86 platform. >>=20 >> Cc: stable@dpdk.org >>=20 >> Signed-off-by: Qi Zhang >> --- >> app/test-pmd/macswap.c | 16 +++++++++++++++- >> 1 file changed, 15 insertions(+), 1 deletion(-) >>=20 >> 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 >>=20 >> +#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 >=20 > I think it would better to place IA specific code into a separate fnction > (and probably into a separate .h file). > BTW, just curious what % of improvement it gives? > Konstantin >=20 If we are going to the trouble of moving the code out of the .c into a .h t= hen I suggest it be placed into the rte_ethdev headers for everyone to use. >=20 >> /* >> * 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 *); >>=20 >> /* 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 >>=20 >> mb->ol_flags &=3D IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; >> mb->ol_flags |=3D ol_flags; >> -- >> 2.13.6 Regards, Keith