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 12FC6A0503; Thu, 19 May 2022 19:03:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF03840223; Thu, 19 May 2022 19:03:01 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id B07DC40156 for ; Thu, 19 May 2022 19:02:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652979779; x=1684515779; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=bH2kxNe04EvY8pW9zqH8CKtqYDOfZsRMMBWIXbNKC00=; b=DhxOL29A3lppz+USCO6M2jap/XvKNTryqFYG4fILz1TlGmirXm405FFu /vkp+0WMhwH4rkgm6OK92deLkGJiAtoWjK5lhAesGhmpNvSWEH7UTkBWG CDrxb8qPBB3wqELFxfIGyfOV04KhjEuGhYSZ4FChOcPme3Qm4MnqKGwvZ OH5pWStmKP5mPw/BasfrEQhPay9SF3mH2JwKaX5MdCg8unBtFrl3IaJab 0QIZxVnbntrzzUheISJH1nn0+41CzMyiRwtTO4Addc7LoDajBvyuqwgcW UXLs/3BRBV/l359iyZtEHdhSlQ4W84u9YiNXaZG3RbYjqu9GjX7O6tH+o A==; X-IronPort-AV: E=McAfee;i="6400,9594,10352"; a="297587985" X-IronPort-AV: E=Sophos;i="5.91,237,1647327600"; d="scan'208";a="297587985" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2022 10:02:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,237,1647327600"; d="scan'208";a="674120162" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga002.fm.intel.com with ESMTP; 19 May 2022 10:02:44 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 19 May 2022 10:02:44 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 19 May 2022 10:02:43 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Thu, 19 May 2022 10:02:43 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.104) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Thu, 19 May 2022 10:02:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dszZho+nLw46TWTungirnNuWTx8/g2H4xnrU+lh7P/qY0FcgBmlz6ii6Mv62zzqI9vUUZzK3chwKoYHFEw5PLyA6+R1reYwbsECKY91olqhicm5nYSoS3wyw/IsD1OgkwVd06ik+rw5R+TRMiHCJJanbikTZ1FoznXSBB6X7Pu9GCWbdKqFpthk27rmdwEJB1hdvRkFxDpSsmiET7w0Kk/+u5D08pkvMy6wjKfaz2uW00TGac/Xc9knxD13czO/hsyDZTwuFaIhtoMOQmrHU0q00u9t8Z60bmOiGYOpVPTQUfTEjOdPohLTfroRRvd1mZjWX/hUshiSO6IO6KNk80w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tsWE/f1EMEoeCMfwgKDCdqjC+tsFVfl7hxTK6hSkClk=; b=iqNxf/ZvaggwVnqLX6blCKXCur3Me+5fw2l9KP/QMV7XqmkzULyuu7RtQ633t/3FC/+/9jekkq9T/C9r/Qo13jFlFRIJu5dmttBhruHSAeCw4DH3sDO+vPeeryBG+iSl+oi2nWmpfDJcnf8FwzNdxcvld/wTvkYKH3TwGrwlX8vU7AhDLjJqpvUe8gW4cL7maOydVvfctFlNK27c25hhUsEyF4dtF5eWJ2IAPK8L0Vpy4Q6yfSTs+2mw0H0+IKLBdi6s5SkM3MXpGYh7FlxlxQ/wXt3MJ1BAFEtSIVe8IDdXYmaSWLFv6k44ApHvE2VleWZsAv8Z7hKrXsgH7vK++Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) by BL3PR11MB6340.namprd11.prod.outlook.com (2603:10b6:208:3b4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.13; Thu, 19 May 2022 17:02:42 +0000 Received: from SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::68f7:d54a:e930:bf77]) by SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::68f7:d54a:e930:bf77%5]) with mapi id 15.20.5273.016; Thu, 19 May 2022 17:02:42 +0000 Message-ID: Date: Thu, 19 May 2022 18:02:36 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.9.0 Subject: Re: [PATCH 1/1] lpm: add a scalar version of lookupx4 function Content-Language: en-US To: Stanislaw Kardach CC: Michal Mazurek , , Frank Zhao , Sam Grove , , , Bruce Richardson References: <20220510115824.457885-1-kda@semihalf.com> From: "Medvedkin, Vladimir" In-Reply-To: <20220510115824.457885-1-kda@semihalf.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0342.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:d::18) To SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0d23c80e-dc71-4bb8-43d2-08da39b96304 X-MS-TrafficTypeDiagnostic: BL3PR11MB6340:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0jup9XQHdfJPARRMd0cO4q2sW7F9y36IUkzmhkePwxKCGuWmxTFrBJomaJY6A69AwavjWWwjZKY7BZLGDDsel8Flw3/4VOVT0es/MT3qgHixglrfUT2oPuBD5Bd2yWd6qBfMPRp/mofSK4ywCmTm0NQy0SWBdgiRHg3w0zohh9fT1TKlDLYmzeh0fwIaFmIy3qxLaT+ePpaiGcmapOcCW2LocLxushwhr/z8kLF7P7oMtFaujjUVWLt39HPXKJ2uLUko4UyEJ8FqM2ogeiUk8zBCJACcY5E1GwXpcNwg979Iz3I47TrnLjp5Gez5aMB+s6i0IltK3Ze9BLJjj0yR01gpdxhhBsiI5tsdqiQExxlQgj5jL+T6RcicVwNpei96/biYF4A9IrTYhGd/EE0rzArZ8GyId/NO72jAIY9VronHTPfrerARvRXfBzMWjwSI6IM7XJPk3TONugvBlj1GVcf3Rg5n87IlKqy13oSsH9a9whb73gtJGMPdoCuWKKD/YKAtbUI9T0RdABjiaDi6Jkc5PunIlyuxg5YJFFUCMWuL5beWGLg+oddbUULBrZhYzXtLpC35iwsFcum8PKKnKOYhoWj2s+kIGvuCB653JTB68KrmDHFbdVG9p007e8nR4Gw1JsuXyUkWsxJkHXx99D3GtjxvG2HmHP9s9xG0O8KjATPbMTdq2FMLBHn2T3TSp5iTyCfK+Ik6BP+N9rusa+IJBDHcZS4aONvfwycqx28= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5772.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(186003)(53546011)(107886003)(86362001)(2616005)(31696002)(83380400001)(82960400001)(5660300002)(316002)(508600001)(8676002)(4326008)(66476007)(66556008)(6512007)(31686004)(36756003)(66946007)(8936002)(2906002)(54906003)(6506007)(6486002)(6666004)(26005)(38100700002)(6916009)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aks1MHpBdDlKbjE0d1F3bWdjWU1ZUE5LckRxYUFIQThxUXoyenErUVRIMCtw?= =?utf-8?B?dTdVeERHaUQ4ZmpxNHlmU05Sc0I4dlVjK1NiZXBvSHFvTmw4ekhSWUNkK1ox?= =?utf-8?B?MGdZeEt0dTZsRkZtUHJaMGlpdmtCbmV3SWtRWFBzc0g1NVZaTW02YU9ZaExM?= =?utf-8?B?ZVVLK1dhT1JMb09rM091U2lSUGpzSm9DS1h1eUp3QWd0c3VianpncTVaRnJ3?= =?utf-8?B?QUlZcEpLSkRLZzNpS3lzKzhKZmdneGlPY3BwQlFOMnRKVWRGUDZpWmNEcjV4?= =?utf-8?B?d09sVkpGL0dsaXZr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VVC?= =?utf-8?B?SWlKM3NRNEppYndOeUdNbUZXV1lnMlpORU1FNUROVmJVZzdYelpwWFNxTnFQ?= =?utf-8?B?ZW81ajN3TVFCSjJlOG5VeW9ESFlLSnhUWXJSZVh2Y0t1YnUxb3JYN0U4cGdl?= =?utf-8?B?WDNXT3htVk9leS9ET3hMeVYySzJIOWJ1bGY3RWtHWC9yVHc0MDJ6RkpHeXR4?= =?utf-8?B?SkdqSmtpVjBYelkxR1gxRDR0dDVGMURycGQ0M2MwOWw1TkRMZm1zRlc0UUNz?= =?utf-8?Q?5W/42d/sdt9OTYrE=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 0d23c80e-dc71-4bb8-43d2-08da39b96304 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5772.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 17:02:42.0553 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: B7fPl8TL4jymUpLKdER+IrjYSAWZbYMI9umR5/20Mz0r/XGKZqb1aEt9kPKwZHG0fpxRTC/kns1pYHcFV0//Uo+x0M9E6wP6Uj3+tLjl558= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR11MB6340 X-OriginatorOrg: intel.com 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 Hi Stanislaw, Michal, As far as I can see, this implementation almost completely repeats other lookupx4() implementations, except for the use of vector instructions. On my board (x86_64) in lpm_perf_autotest your implementation takes about: LPM LookupX4: 29.5 cycles (fails = 12.5%) replacing this code with a simple loop with rte_lpm_lookup(): uint32_t nh; int i, ret; for (i = 0; i < 4; i++) { ret = rte_lpm_lookup((struct rte_lpm *)lpm, ((rte_xmm_t)ip).u32[i], &nh); hop[i] = (ret == 0) ? nh : defv; } works faster: LPM LookupX4: 22.2 cycles (fails = 12.5%) I'm wondering if this will work faster on your board (I assume it it RISC-V arch)? Thanks! On 10/05/2022 12:58, Stanislaw Kardach wrote: > From: Michal Mazurek > > Add an implementation of the rte_lpm_lookupx4() function for platforms > without support for vector operations. > > This will be useful in the upcoming RISC-V port as well as any platform > which may want to start with a basic level of LPM support. > > Signed-off-by: Michal Mazurek > Signed-off-by: Stanislaw Kardach > --- > doc/guides/rel_notes/release_22_07.rst | 5 + > lib/lpm/meson.build | 1 + > lib/lpm/rte_lpm.h | 4 +- > lib/lpm/rte_lpm_scalar.h | 122 +++++++++++++++++++++++++ > 4 files changed, 131 insertions(+), 1 deletion(-) > create mode 100644 lib/lpm/rte_lpm_scalar.h > > diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst > index 4ae91dd94d..73e8d632f2 100644 > --- a/doc/guides/rel_notes/release_22_07.rst > +++ b/doc/guides/rel_notes/release_22_07.rst > @@ -70,6 +70,11 @@ New Features > * Added AH mode support in lookaside protocol (IPsec) for CN9K & CN10K. > * Added AES-GMAC support in lookaside protocol (IPsec) for CN9K & CN10K. > > +* **Added scalar version of the LPM library.** > + > + * Added scalar implementation of ``rte_lpm_lookupx4``. This is a fall-back > + implementation for platforms that don't support vector operations. > + > > Removed Items > ------------- > diff --git a/lib/lpm/meson.build b/lib/lpm/meson.build > index 78d91d3421..6b47361fce 100644 > --- a/lib/lpm/meson.build > +++ b/lib/lpm/meson.build > @@ -14,6 +14,7 @@ headers = files('rte_lpm.h', 'rte_lpm6.h') > indirect_headers += files( > 'rte_lpm_altivec.h', > 'rte_lpm_neon.h', > + 'rte_lpm_scalar.h', > 'rte_lpm_sse.h', > 'rte_lpm_sve.h', > ) > diff --git a/lib/lpm/rte_lpm.h b/lib/lpm/rte_lpm.h > index eb91960e81..b5db6a353a 100644 > --- a/lib/lpm/rte_lpm.h > +++ b/lib/lpm/rte_lpm.h > @@ -405,8 +405,10 @@ rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4], > #endif > #elif defined(RTE_ARCH_PPC_64) > #include "rte_lpm_altivec.h" > -#else > +#elif defined(RTE_ARCH_X86) > #include "rte_lpm_sse.h" > +#else > +#include "rte_lpm_scalar.h" > #endif > > #ifdef __cplusplus > diff --git a/lib/lpm/rte_lpm_scalar.h b/lib/lpm/rte_lpm_scalar.h > new file mode 100644 > index 0000000000..991b94e687 > --- /dev/null > +++ b/lib/lpm/rte_lpm_scalar.h > @@ -0,0 +1,122 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2022 StarFive > + * Copyright(c) 2022 SiFive > + * Copyright(c) 2022 Semihalf > + */ > + > +#ifndef _RTE_LPM_SCALAR_H_ > +#define _RTE_LPM_SCALAR_H_ > + > +#include > +#include > +#include > +#include > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +static inline void > +rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4], > + uint32_t defv) > +{ > + rte_xmm_t i24; > + rte_xmm_t i8; > + uint32_t tbl[4]; > + uint64_t pt, pt2; > + const uint32_t *ptbl; > + > + const rte_xmm_t mask8 = { > + .u32 = {UINT8_MAX, UINT8_MAX, UINT8_MAX, UINT8_MAX}}; > + > + /* > + * RTE_LPM_VALID_EXT_ENTRY_BITMASK for 2 LPM entries > + * as one 64-bit value (0x0300000003000000). > + */ > + const uint64_t mask_xv = > + ((uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK | > + (uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK << 32); > + > + /* > + * RTE_LPM_LOOKUP_SUCCESS for 2 LPM entries > + * as one 64-bit value (0x0100000001000000). > + */ > + const uint64_t mask_v = > + ((uint64_t)RTE_LPM_LOOKUP_SUCCESS | > + (uint64_t)RTE_LPM_LOOKUP_SUCCESS << 32); > + > + /* get 4 indexes for tbl24[]. */ > + i24.x = ip; > + i24.u32[0] >>= CHAR_BIT; > + i24.u32[1] >>= CHAR_BIT; > + i24.u32[2] >>= CHAR_BIT; > + i24.u32[3] >>= CHAR_BIT; > + > + /* extract values from tbl24[] */ > + ptbl = (const uint32_t *)&lpm->tbl24[i24.u32[0]]; > + tbl[0] = *ptbl; > + ptbl = (const uint32_t *)&lpm->tbl24[i24.u32[1]]; > + tbl[1] = *ptbl; > + ptbl = (const uint32_t *)&lpm->tbl24[i24.u32[2]]; > + tbl[2] = *ptbl; > + ptbl = (const uint32_t *)&lpm->tbl24[i24.u32[3]]; > + tbl[3] = *ptbl; > + > + /* get 4 indexes for tbl8[]. */ > + i8.x = ip; > + i8.u64[0] &= mask8.u64[0]; > + i8.u64[1] &= mask8.u64[1]; > + > + pt = (uint64_t)tbl[0] | > + (uint64_t)tbl[1] << 32; > + pt2 = (uint64_t)tbl[2] | > + (uint64_t)tbl[3] << 32; > + > + /* search successfully finished for all 4 IP addresses. */ > + if (likely((pt & mask_xv) == mask_v) && > + likely((pt2 & mask_xv) == mask_v)) { > + *(uint64_t *)hop = pt & RTE_LPM_MASKX4_RES; > + *(uint64_t *)(hop + 2) = pt2 & RTE_LPM_MASKX4_RES; > + return; > + } > + > + if (unlikely((pt & RTE_LPM_VALID_EXT_ENTRY_BITMASK) == > + RTE_LPM_VALID_EXT_ENTRY_BITMASK)) { > + i8.u32[0] = i8.u32[0] + > + (tbl[0] & 0x00FFFFFF) * RTE_LPM_TBL8_GROUP_NUM_ENTRIES; > + ptbl = (const uint32_t *)&lpm->tbl8[i8.u32[0]]; > + tbl[0] = *ptbl; > + } > + if (unlikely((pt >> 32 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) == > + RTE_LPM_VALID_EXT_ENTRY_BITMASK)) { > + i8.u32[1] = i8.u32[1] + > + (tbl[1] & 0x00FFFFFF) * RTE_LPM_TBL8_GROUP_NUM_ENTRIES; > + ptbl = (const uint32_t *)&lpm->tbl8[i8.u32[1]]; > + tbl[1] = *ptbl; > + } > + if (unlikely((pt2 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) == > + RTE_LPM_VALID_EXT_ENTRY_BITMASK)) { > + i8.u32[2] = i8.u32[2] + > + (tbl[2] & 0x00FFFFFF) * RTE_LPM_TBL8_GROUP_NUM_ENTRIES; > + ptbl = (const uint32_t *)&lpm->tbl8[i8.u32[2]]; > + tbl[2] = *ptbl; > + } > + if (unlikely((pt2 >> 32 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) == > + RTE_LPM_VALID_EXT_ENTRY_BITMASK)) { > + i8.u32[3] = i8.u32[3] + > + (tbl[3] & 0x00FFFFFF) * RTE_LPM_TBL8_GROUP_NUM_ENTRIES; > + ptbl = (const uint32_t *)&lpm->tbl8[i8.u32[3]]; > + tbl[3] = *ptbl; > + } > + > + hop[0] = (tbl[0] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[0] & 0x00FFFFFF : defv; > + hop[1] = (tbl[1] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[1] & 0x00FFFFFF : defv; > + hop[2] = (tbl[2] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[2] & 0x00FFFFFF : defv; > + hop[3] = (tbl[3] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[3] & 0x00FFFFFF : defv; > +} > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _RTE_LPM_SCALAR_H_ */ -- Regards, Vladimir