From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0053.outbound.protection.outlook.com [65.55.169.53]) by dpdk.org (Postfix) with ESMTP id 2B3DA8D99 for ; Tue, 1 Dec 2015 17:42:08 +0100 (CET) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@caviumnetworks.com; Received: from localhost.localdomain (111.93.218.67) by BLUPR0701MB1716.namprd07.prod.outlook.com (10.163.85.142) with Microsoft SMTP Server (TLS) id 15.1.331.20; Tue, 1 Dec 2015 16:42:04 +0000 Date: Tue, 1 Dec 2015 22:11:42 +0530 From: Jerin Jacob To: Jianbo Liu Message-ID: <20151201164139.GA12144@localhost.localdomain> References: <1448995276-9599-1-git-send-email-jianbo.liu@linaro.org> <1448995276-9599-4-git-send-email-jianbo.liu@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1448995276-9599-4-git-send-email-jianbo.liu@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0047.INDPRD01.PROD.OUTLOOK.COM (25.164.116.147) To BLUPR0701MB1716.namprd07.prod.outlook.com (25.163.85.142) X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 2:/GWLxuBAmpi3uvctfEZXp4nx+n7b88sT0DHttttwmwJ7wvCjgYWi18btzdIr9Yk1QV9iRduw33sCYzwhEDo+qPLLIHBrDjkzpiTGLcdhIz43TRo4ZwMSaSobGFI2A0ysAuRQ/KgZOljRp4b41QUFLw==; 3:ptybe+oGPzlIlDKtUJQhGzXTa+kzAgk49g+uHUgiiIRU36NfKnG8UEeeVIo9mKkqEIncKR8rfuYP81zBCUlZ+Hf5MlHtYw25vugIEyFyIj5SUI+lEf7M51z8bmdVpc31; 25:UcRlGbfrYDOXRk00Jq/Dr7D3sWSiDYYN8dINigQEHWj/SUxFP6dzS2vs9BhqN8CLSI3aNCuopkTd8N+RkEQ58b06NKskkK9782THpsalj4jBb+iqAyLDUsLPuNu7aRZPdE3PRnwMLRxVmi9JiGdGPDleTlm8Asq1BOLfOa45HlO9VTY0wEPnlYO4LsBTNYUZAtReEG5HZds+VVzu5iBrk0rpFcg41dZq9CSz1GMMuteJNvU8+bFrLZoTh1MRkfLRnNm0HtpgvlyV6YOWa/eMHw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0701MB1716; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 20:KV78VJ+4B0nuJ2YtOrZoVez/4XCvGyEo7mAv8YmMxskKFxoJSG4fkjuW7hvTwcZY0Jg70nNMSRW9gx4LBT32PUMiR5l1gHk2vWTY4qKcCWwg2QGCR3AuO96Jj6toZ0cTa2HbFkWUByrW5LnC6cqvjMPAELXclqmQOOGPndJSEDOnWA6kyj7iv0RVIThySFRYKpwrSiae7VNKgd8vGOYqYD3vE7bJMfPLsLF58b2/M0yy/6u0ekb0H09B2L4mguyo9skT2IlZ1gWAut/OiNolkwdEzTzwPPreZf/wYW5S24f9ivNhOIwhrJpWb4EFdcbX+K0qi6Y5NX/txdD+yoUk7kpXapGB8U5lxnf7F4q7fgkCOiTJPSZT6VDmbpV64cLzt1NlAAJXr6wQeIvpXjPDyGh4UrIK2qKX5+htS+0xET0YzKakt1hTVtrxPOUdhgmGzJTBQLyfJGhxoUwansxpynKv34Pc4ocpZ3pvDpS35X3TYynJI2ur17B/TcfdJf85BJ+CtIlGkJUWgSwyNA4LjVHJYtpC5Bd40DMzPbXrcZTXLTgsdXoBjTIzmtjl8is87sd8GXDs4J1rAdyRrwYMp2TeB9R/5WLXHOhUudMkXTk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046); SRVR:BLUPR0701MB1716; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1716; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 4:oN+ehWH2EInPOF0OPsiJKveB9ggT4UjyIrqDHA8NC4l+iBQ1tLuE7hOfAPavSlIZUZofng/xjyKc7zPReWsJNDowT7StJ1N6zTQ62e6IxQwInhi1bji3tiCxeTXQYbA0efPvEzAV13WjLHXrxPSEH6oh5sbI7pXD+Za6T5PUbcu7kdfntlLP00feyhFg9lPi0sLQhZGSt+Cx8G3bFB3PsgOCVO43tXavpZp31Rv6u2AnJuWXGhrr/c2J2VWOfNT5dMjJYD0rpj/GYkWbKiTwt32QDXVtahNOTfV4vGf6x3BqeeCFBDU0g7rbUzG/T4qbMFDQOMCyzq3GrK/T8xt35W/FpTE1Ijanu7c6a/6RgQi+e5zRbn49IQLFF2KfKSqG X-Forefront-PRVS: 07778E4001 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(199003)(24454002)(189002)(50986999)(6116002)(33656002)(23726003)(5009440100003)(46406003)(1076002)(76176999)(5008740100001)(1096002)(3846002)(47776003)(50466002)(66066001)(97736004)(77096005)(5001960100002)(105586002)(101416001)(40100003)(586003)(106356001)(122386002)(61506002)(92566002)(54356999)(83506001)(5004730100002)(87976001)(189998001)(19580395003)(2950100001)(4001350100001)(42186005)(97756001)(86362001)(110136002)(81156007)(19580405001)(7099028)(357404004); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1716; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1716; 23:vglkmvHamhFhr8VW9Wv1ovXdUFJJ59/mfXS1YX+?= =?us-ascii?Q?p/Xvahu2n43tpH8KDurPbYFOmuv2AAK/RslxA/T6QoON+lMhZ74YsoduglxB?= =?us-ascii?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/MDJ4JU2PltHFKgpH/?= =?us-ascii?Q?sO8j7BTUYjFqMT00997vSJoWr8mHYO8M6v2s7+U4byW6q/QKuFm7aZz5LDSS?= =?us-ascii?Q?0RBId26/PMSVHZi3+mdmHT4MwR0/CFf8U2wNwXmz2aA08RH8p3YFykJ2z9pT?= =?us-ascii?Q?PJbGud+IVOmiGf5FiLwV2Avpdf4e/CHEmVVXC71EsDm3Uoi39cgBUcrnP9KH?= =?us-ascii?Q?fYQ3FBZrWlGqmxSIwtpwjGW+TeHD3lYe2KZhP?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 5:F2K1vT6/gJjbU30iWrynnYRoMQLnXS4VlosO/K7XqnErCtJZm3R1ycqaTqwIALM24ceh7JcpCIP97qDXhtZCleEJFbJD+jlukSOw2Evf5D7WR7ohM9zjA79oK+ZQpRsXtiNc4AbHdtcT09LotGbtXw==; 24:g832fNO+hxNxuO2qEflHq7qRaerfiK9Eg8f40ULlo6dmQI0CqSHdlLOUOfVF61bJg3pQHFC1LLzIvTbsyjeNfGVou/1rwJK9mrbdTVGpcd4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2015 16:42:04.8590 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1716 Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 3/4] eal/arm: Enable lpm/table/pipeline libs 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, 01 Dec 2015 16:42:08 -0000 On Tue, Dec 01, 2015 at 01:41:15PM -0500, Jianbo Liu wrote: > Adds ARM NEON support for lpm. > And enables table/pipeline libraries which depend on lpm. I already sent the patch on the same yesterday. We can converge the patches after the discussion. Please check "[dpdk-dev] [PATCH 0/3] add lpm support for NEON" on ml > > Signed-off-by: Jianbo Liu > --- > config/defconfig_arm-armv7a-linuxapp-gcc | 3 - > config/defconfig_arm64-armv8a-linuxapp-gcc | 3 - > lib/librte_eal/common/include/arch/arm/rte_vect.h | 28 ++++++++++ > lib/librte_lpm/rte_lpm.h | 68 ++++++++++++++++------- > 4 files changed, 77 insertions(+), 25 deletions(-) > > diff --git a/config/defconfig_arm-armv7a-linuxapp-gcc b/config/defconfig_arm-armv7a-linuxapp-gcc > index cbebd64..efffa1f 100644 > --- a/config/defconfig_arm-armv7a-linuxapp-gcc > +++ b/config/defconfig_arm-armv7a-linuxapp-gcc > @@ -53,9 +53,6 @@ CONFIG_RTE_LIBRTE_KNI=n > CONFIG_RTE_EAL_IGB_UIO=n > > # fails to compile on ARM > -CONFIG_RTE_LIBRTE_LPM=n > -CONFIG_RTE_LIBRTE_TABLE=n > -CONFIG_RTE_LIBRTE_PIPELINE=n > CONFIG_RTE_SCHED_VECTOR=n > > # cannot use those on ARM > diff --git a/config/defconfig_arm64-armv8a-linuxapp-gcc b/config/defconfig_arm64-armv8a-linuxapp-gcc > index 504f3ed..57f7941 100644 > --- a/config/defconfig_arm64-armv8a-linuxapp-gcc > +++ b/config/defconfig_arm64-armv8a-linuxapp-gcc > @@ -51,7 +51,4 @@ CONFIG_RTE_LIBRTE_IVSHMEM=n > CONFIG_RTE_LIBRTE_FM10K_PMD=n > CONFIG_RTE_LIBRTE_I40E_PMD=n > > -CONFIG_RTE_LIBRTE_LPM=n > -CONFIG_RTE_LIBRTE_TABLE=n > -CONFIG_RTE_LIBRTE_PIPELINE=n > CONFIG_RTE_SCHED_VECTOR=n > diff --git a/lib/librte_eal/common/include/arch/arm/rte_vect.h b/lib/librte_eal/common/include/arch/arm/rte_vect.h > index a33c054..7437711 100644 > --- a/lib/librte_eal/common/include/arch/arm/rte_vect.h > +++ b/lib/librte_eal/common/include/arch/arm/rte_vect.h > @@ -41,6 +41,8 @@ extern "C" { > > typedef int32x4_t xmm_t; > > +typedef int32x4_t __m128i; > + > #define XMM_SIZE (sizeof(xmm_t)) > #define XMM_MASK (XMM_SIZE - 1) > > @@ -53,6 +55,32 @@ typedef union rte_xmm { > double pd[XMM_SIZE / sizeof(double)]; > } __attribute__((aligned(16))) rte_xmm_t; > > +static __inline __m128i > +_mm_set_epi32(int i3, int i2, int i1, int i0) > +{ > + int32_t r[4] = {i0, i1, i2, i3}; > + > + return vld1q_s32(r); > +} > + > +static __inline __m128i > +_mm_loadu_si128(__m128i *p) > +{ > + return vld1q_s32((int32_t *)p); > +} > + > +static __inline __m128i > +_mm_set1_epi32(int i) > +{ > + return vdupq_n_s32(i); > +} > + > +static __inline __m128i > +_mm_and_si128(__m128i a, __m128i b) > +{ > + return vandq_s32(a, b); > +} > + IMO, it makes sense to not emulate the SSE intrinsics with NEON Let's create the rte_vect_* as required. look at the existing patch. > #ifdef RTE_ARCH_ARM > /* NEON intrinsic vqtbl1q_u8() is not supported in ARMv7-A(AArch32) */ > static __inline uint8x16_t > diff --git a/lib/librte_lpm/rte_lpm.h b/lib/librte_lpm/rte_lpm.h > index c299ce2..c76c07d 100644 > --- a/lib/librte_lpm/rte_lpm.h > +++ b/lib/librte_lpm/rte_lpm.h > @@ -361,6 +361,47 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t * ips, > /* Mask four results. */ > #define RTE_LPM_MASKX4_RES UINT64_C(0x00ff00ff00ff00ff) > > +#if defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64) Separate out arm implementation to the different header file. Too many ifdef looks odd in the header file and difficult to manage. > +static inline void > +rte_lpm_tbl24_val4(const struct rte_lpm *lpm, int32x4_t ip, uint16_t tbl[4]) > +{ > + uint32x4_t i24; > + uint32_t idx[4]; > + > + /* get 4 indexes for tbl24[]. */ > + i24 = vshrq_n_u32(vreinterpretq_u32_s32(ip), CHAR_BIT); > + vst1q_u32(idx, i24); > + > + /* extract values from tbl24[] */ > + tbl[0] = *(const uint16_t *)&lpm->tbl24[idx[0]]; > + tbl[1] = *(const uint16_t *)&lpm->tbl24[idx[1]]; > + tbl[2] = *(const uint16_t *)&lpm->tbl24[idx[2]]; > + tbl[3] = *(const uint16_t *)&lpm->tbl24[idx[3]]; > +} Nice. There is an improvement in this portion code wrt my patch. This is a candidate for convergence. > +#else > +static inline void > +rte_lpm_tbl24_val4(const struct rte_lpm *lpm, __m128i ip, uint16_t tbl[4]) > +{ > + __m128i i24; > + uint64_t idx; > + > + /* get 4 indexes for tbl24[]. */ > + i24 = _mm_srli_epi32(ip, CHAR_BIT); > + > + /* extract values from tbl24[] */ > + idx = _mm_cvtsi128_si64(i24); > + i24 = _mm_srli_si128(i24, sizeof(uint64_t)); > + > + tbl[0] = *(const uint16_t *)&lpm->tbl24[(uint32_t)idx]; > + tbl[1] = *(const uint16_t *)&lpm->tbl24[idx >> 32]; > + > + idx = _mm_cvtsi128_si64(i24); > + > + tbl[2] = *(const uint16_t *)&lpm->tbl24[(uint32_t)idx]; > + tbl[3] = *(const uint16_t *)&lpm->tbl24[idx >> 32]; > +} > +#endif > + > /** > * Lookup four IP addresses in an LPM table. > * > @@ -381,17 +422,19 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t * ips, > * if lookup would fail. > */ > static inline void > +#if defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64) > +rte_lpm_lookupx4(const struct rte_lpm *lpm, int32x4_t ip, uint16_t hop[4], > + uint16_t defv) This would call for change in the change the ABI, IMO, __m128i can be used to represent 128bit vector to avoid ABI chang > +#else separate out arm implementation to the different header file. Too many ifdef looks odd in the header file. Could you rebase your patch based on existing patch and send the improvement portion as separate patch or I can send update patch with your improvements and with your signoff. > rte_lpm_lookupx4(const struct rte_lpm *lpm, __m128i ip, uint16_t hop[4], > uint16_t defv) > +#endif > { > - __m128i i24; > rte_xmm_t i8; > uint16_t tbl[4]; > - uint64_t idx, pt; > - > - const __m128i mask8 = > - _mm_set_epi32(UINT8_MAX, UINT8_MAX, UINT8_MAX, UINT8_MAX); > + uint64_t pt; > > + const __m128i mask8 = _mm_set1_epi32(UINT8_MAX); > /* > * RTE_LPM_VALID_EXT_ENTRY_BITMASK for 4 LPM entries > * as one 64-bit value (0x0300030003000300). > @@ -412,20 +455,7 @@ rte_lpm_lookupx4(const struct rte_lpm *lpm, __m128i ip, uint16_t hop[4], > (uint64_t)RTE_LPM_LOOKUP_SUCCESS << 32 | > (uint64_t)RTE_LPM_LOOKUP_SUCCESS << 48); > > - /* get 4 indexes for tbl24[]. */ > - i24 = _mm_srli_epi32(ip, CHAR_BIT); > - > - /* extract values from tbl24[] */ > - idx = _mm_cvtsi128_si64(i24); > - i24 = _mm_srli_si128(i24, sizeof(uint64_t)); > - > - tbl[0] = *(const uint16_t *)&lpm->tbl24[(uint32_t)idx]; > - tbl[1] = *(const uint16_t *)&lpm->tbl24[idx >> 32]; > - > - idx = _mm_cvtsi128_si64(i24); > - > - tbl[2] = *(const uint16_t *)&lpm->tbl24[(uint32_t)idx]; > - tbl[3] = *(const uint16_t *)&lpm->tbl24[idx >> 32]; > + rte_lpm_tbl24_val4(lpm, ip, tbl); > > /* get 4 indexes for tbl8[]. */ > i8.x = _mm_and_si128(ip, mask8); > -- > 1.8.3.1 >