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 58DF0A0548; Wed, 1 Jun 2022 11:41:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0037C40689; Wed, 1 Jun 2022 11:41:21 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 9D4E14003F for ; Wed, 1 Jun 2022 11:41:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654076480; x=1685612480; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=QUeX0bXHQ7Us0mgLM5Pm8au+seGyFRkp4GGm8pu5YqU=; b=JCDTc/gdPWNbvR3VgWScjuOZzGT7+GYrelS3Z4MVRxxj2AOpFdUjLJ0S VyxxzwB2ykyqOzjzhW40pgZUbxQAA8Qr6XAIUJozOb655H4ClZygzp//C ZOd4wR8DEPEd+X3jpgz/9tTj0R6SWcNnA6KESp6T4EoXC9DJgiIv+MGE5 W+gN1Ha6ArHO4SeeZGh/ExocXGY9LtNYOJbtYY9wA3hzquqKU+opMwY77 klc8h7cT6qnJPzdZhnZMeRQ6SuNWpwtkSE4bX5i+8WsjyouT7T6JoargP 8ynTY71jnmMZiG7iJI07T2kfDcQHKUlvkQBHkRceVYxrKg0KRkY3ScRYp w==; X-IronPort-AV: E=McAfee;i="6400,9594,10364"; a="257603754" X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="257603754" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2022 02:41:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="529989026" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga003.jf.intel.com with ESMTP; 01 Jun 2022 02:41:19 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 1 Jun 2022 02:41:18 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 1 Jun 2022 02:41:18 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.174) 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; Wed, 1 Jun 2022 02:41:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RKYD9VRpul/Ykr6D59Vyfxhd+CeYa0Czs5mUr60UD6RRngNnN/Ob4fNR0xVW/p79gpcyFRxBrdit2fQbGyLFS+yXdEQ7WQHapvyxVIsoyoqtgUm8JPLk+QbS42gsEUgKrGncZaWSaA1e323qnw4yqzRgFrqOdQ4TLXYOaPSpaJ0GwOoRHnstZBBkGK7uEn+uvryAtnpSTWv4bMgjr9mwkG3qgohiTJdulnOuH/yr1CMQ2oUBsFVrH3NuIZ9/jvMULlI3+QN16sM+XuETRX8ouf/qisbHr5dY3S6a71aCmbfX5b7ckR7/IIqzT1/U+kNXbV3Stb9chXdfFBygKI2P2Q== 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=rK9xyQaDOYjWphlkRnAY9bRk+cToyn2oFmy6r06FzQA=; b=eLv4wiOAfoCn2uqEZN9OW8iv7G/eGc5KTgCqUz/c3g506B8zxDscX4te06b+JnVCw2f6sHXb/K4Sgn9UCp4i868eqVxQINYRFU56qw3V7uxGBo+qZTtcZNP/3zkIbkisKqQQimkp/xeXWZQfWB6uhpk8hrh1ct+9bTS/pztgH3L0R9zvpRyKZn2IsJRKhV7qGlxl1G5PBNsApiZvvozmSTjEmW5i7hoGy/+b1QxLDF2gc3QudjMdIM/zv58fNQ2HYw+BX/+onD/7YaZP+nTlhz0uCx0XHNXOwA/wqb7drsarLWrlJytLTEOx0u51pPaCvhsETxRgRNBpBjOmM3JrRQ== 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 PH7PR11MB5765.namprd11.prod.outlook.com (2603:10b6:510:139::7) by BL1PR11MB5237.namprd11.prod.outlook.com (2603:10b6:208:310::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Wed, 1 Jun 2022 09:41:07 +0000 Received: from PH7PR11MB5765.namprd11.prod.outlook.com ([fe80::c8b7:8aa7:c8eb:34eb]) by PH7PR11MB5765.namprd11.prod.outlook.com ([fe80::c8b7:8aa7:c8eb:34eb%6]) with mapi id 15.20.5273.023; Wed, 1 Jun 2022 09:41:07 +0000 Message-ID: <2970634c-5274-e63c-c16c-b53c1a099496@intel.com> Date: Wed, 1 Jun 2022 10:41:01 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.9.1 Subject: Re: [PATCH v3 2/2] lpm: add a scalar version of lookupx4 function Content-Language: en-US To: Stanislaw Kardach CC: Michal Mazurek , , Frank Zhao , Sam Grove , , References: <20220527181822.716758-1-kda@semihalf.com> <20220530182437.56853-1-kda@semihalf.com> <20220530182437.56853-2-kda@semihalf.com> From: "Medvedkin, Vladimir" In-Reply-To: <20220530182437.56853-2-kda@semihalf.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0238.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b::34) To PH7PR11MB5765.namprd11.prod.outlook.com (2603:10b6:510:139::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: af01ee36-cb11-4a16-9fde-08da43b2da0e X-MS-TrafficTypeDiagnostic: BL1PR11MB5237:EE_ 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: SKMRIAg2S4mNfk7/wnewQFiQux2mrH+XxWRw1XM3/APM7qRDRutTIaeEq2qg0I9nUrhZ5Na/8sGxNDJa/IEMWr7DgZwys8YpEedA92FyEdyDgCzcFmwJjknBivUf1Z68ShNvcY3kc54L2+IPwj38ltgOufalxiqbFnbZbvwx0EsF5cQghpvO7LZLdRzagl0g42sTkI0r6QXiojdbZSPfTQiJ9yU6XSxcsy7iTbbo4EcQc0TErNAB4pDd/ehim3Ne2t9NXxxryV+YdOe3sJBnloWjrNpxblgy6QhbqoeV+Q4rZF2DEJVfEAaNhvKKOD9ISJRqABAC+/DLlXKtDR7jmWOOPcZdr9HMq1yJsClTjMll2tnsQaN/KgINbm203XgsSFjc6hcno2rqFVQ+nVwQjng0W6cIVyrXcGLx4HiRf4Oo1bj6UuTsEGjiu5nYEd4IxWSHcZ6ziR23VH9XQtT822gZ7g6W4FrRQBwx6SaopBzHWVhvviV0Ew37t5WLYR1x+GMuGL6t6xlhB9YxLk0ckOs7Ju3veCXMCZXvjI4jXByrancTh9M9P0tjryyQcR056oK0fkoOfNDzLJ3/Z3ewml7to27jjLjlNrg11lmF7r1WwPoXwrfDeGUQWe0ljVOFys6dnjP+hWETIIRUZ8dxSmPQlhtzM1r2t5APfGOlnrdbDusAwMkThDWZ1gdWUWXd83jLk5FdXCL5HdkfcxfDbzOH3+uybfB0jZjzvoUNsadaZKK6g+6c/LWsIfNpc2Qv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR11MB5765.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(2616005)(54906003)(66476007)(66946007)(6916009)(66556008)(508600001)(316002)(8936002)(6506007)(53546011)(6512007)(36756003)(86362001)(31696002)(38100700002)(6666004)(26005)(31686004)(8676002)(2906002)(4326008)(186003)(82960400001)(5660300002)(83380400001)(6486002)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N2JUYlRNRjVBQlQ4bVhXQTIwVGJKU1NRR0UweWpXQStIR2s1bHpsdzVmU0Ru?= =?utf-8?B?VjJON1ZSZG9Sb0ZjS1hwZUJ6MXpwY2x0TG9lU3RGSUluZVFtQkVDczZpZ1M5?= =?utf-8?B?blowZGdmeFlnR3N2Qno1SXFCMTB3YVhGYzUxcVpLYkRiSTdvZmE4a2NRVWx1?= =?utf-8?B?azRoRDFFRXM4TWE4RWZqWlpleVA0TzJ4UVljaVVmWXA2eDE2clVjd2pLaGZW?= =?utf-8?B?eFc1OThwOGFYUkw0VWoyS3pjVTJBTXZadG10c0lYUGlOTkZyaGpyYVhmTisx?= =?utf-8?B?enF1NlRxR2JvbzNhZHhqcURLclE0c0hKUU43QmhVamtyaDA1bXRlM2dRRFlw?= =?utf-8?B?dVBKd0ZIM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Q1dBTlZuTDA0WmU3WExJ?= =?utf-8?B?TW56bHgrTHdKeStwYnRnbTdrSjBUMm9jU0FsU25CVzZiMlhBNGlSclJ5QVFK?= =?utf-8?B?OVJ2YVFzbkNCQlg2a283V1BVV3F5eGdJZWUxc1IvQkhhbURKVnJMVW0wa1J3?= =?utf-8?B?REIwTkQ1c1lHaldDb3FzRXNXbklMWmpQT1RkN05Od0NvUDVVOFIyaTRSZjNn?= =?utf-8?Q?NQZhPU6fZ6OBG0LIq7E8UD5eiLlN8xIzpVjXL?= X-MS-Exchange-CrossTenant-Network-Message-Id: af01ee36-cb11-4a16-9fde-08da43b2da0e X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB5765.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2022 09:41:06.9239 (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: K40oTcHmyXMaOCK2kGvhqHOotq3JN9/zZL5fJ8wm66+qJxr5TtxXoknGIxiY9egHT/r4P/ZLvzNfXSUrj4cbofFJVvhDA3KMHIduXBJP4vE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR11MB5237 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, On 30/05/2022 19:24, 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 | 40 ++++++++++++++++++++++++++ > 4 files changed, 49 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 e49cacecef..0cf3f71269 100644 > --- a/doc/guides/rel_notes/release_22_07.rst > +++ b/doc/guides/rel_notes/release_22_07.rst > @@ -104,6 +104,11 @@ New Features > * ``RTE_EVENT_QUEUE_ATTR_WEIGHT`` > * ``RTE_EVENT_QUEUE_ATTR_AFFINITY`` > > +* **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 1cf863a146..4f38864fde 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..4ae1b6f0b8 > --- /dev/null > +++ b/lib/lpm/rte_lpm_scalar.h > @@ -0,0 +1,40 @@ > +/* 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 Just a one nit, I think these 3 headers are not needed and can be removed. Apart from it looks good to me. Thanks! > +#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) > +{ > + uint32_t nh; > + int ret; > + > + ret = rte_lpm_lookup(lpm, ((rte_xmm_t)ip).u32[0], &nh); > + hop[0] = (ret == 0) ? nh : defv; > + ret = rte_lpm_lookup(lpm, ((rte_xmm_t)ip).u32[1], &nh); > + hop[1] = (ret == 0) ? nh : defv; > + ret = rte_lpm_lookup(lpm, ((rte_xmm_t)ip).u32[2], &nh); > + hop[2] = (ret == 0) ? nh : defv; > + ret = rte_lpm_lookup(lpm, ((rte_xmm_t)ip).u32[3], &nh); > + hop[3] = (ret == 0) ? nh : defv; > +} > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _RTE_LPM_SCALAR_H_ */ Acked-by: Vladimir Medvedkin -- Regards, Vladimir