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 B3E4EA0548; Wed, 1 Jun 2022 12:33:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 63AD140694; Wed, 1 Jun 2022 12:33:02 +0200 (CEST) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by mails.dpdk.org (Postfix) with ESMTP id 016E240689 for ; Wed, 1 Jun 2022 12:33:00 +0200 (CEST) Received: by mail-lj1-f170.google.com with SMTP id m26so1540615ljb.0 for ; Wed, 01 Jun 2022 03:33:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6FIS2R5Lak5IxcbghdqMJt2JZsUtuLrK070R+8P7S2o=; b=QiTFRt0MBhJxwhfXU9UQAYJuE1FwuUy9odWos8sQEkDXKMwThh2asIVAhlynIFKZKv fAsSCsVG6F7JqyggqagS5AUlgfv0Q2jpMukJSzm5MQpssijzTyZFlOV12y7Eq7zsxDrm 5eKXURT1tGdzVMSz+nWA33y0K+zHGVUdLVcI6CTrDyHmRkgKD9U41Wy96+FiMN1cSSki 7SKK3+97lk6mLLvCjE2emlXBFDeRToNMqkl0MY1yZyidOqAVkYu3a9MBJ5GSNKYPhAQW EBHLIcPdZnwDcRAmiOdDdhhetT0YI2nlr25zwOOjcva6QK0WIt76aOH09WMUQ/HK7sxW 5k6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6FIS2R5Lak5IxcbghdqMJt2JZsUtuLrK070R+8P7S2o=; b=razOtZj/f9NHkt8wwgxMj9pb5NeMEXYeS7MNUDF9Rx+kA+IJYZX90CuFiXm++xzlKX aANt6dcRYJiw0le4eBhU0m9H7g9UgEmJoAPLrzA4jeIJ+7OY9jL8CH1O/HQLKsTQSXD2 A3v5ag/hdMsozxTAvWHHFnqxJAtZYE8Ht30gnt+p/RInSMs5jIRtNqSV6eBqvzMBJvCM 8MYDbIfC++oBUmusMJxFdIQA0cm5bsjqM20nbatFNz9M3e9/le9JIoAblpC1gc9kJ9iq ZQZoLKMR5lHaRH2jW+BW5DHGZXorJgI8zj7BjJTuDOaCcZDDRIUGYaY0YNEuEA2QSBfQ TmhA== X-Gm-Message-State: AOAM5339QD4TGmTOCGjbeVpRoiIoAmdCW3VpPjNqX8XRMlZR0J1gWtk9 QLWRO7XPJuN/E9VNqX1HwdAcOu0Df8RkmfvNH7vUtA== X-Google-Smtp-Source: ABdhPJxl0tFW08bESFG6vT/1PoWW4wqEq7p52cAFxzkagMaL3beE6wU4O9DS5aPfsDGdILEHp0/F7RBJzE2wg77Olic= X-Received: by 2002:a05:651c:b29:b0:255:6ecc:96f with SMTP id b41-20020a05651c0b2900b002556ecc096fmr548593ljr.176.1654079580417; Wed, 01 Jun 2022 03:33:00 -0700 (PDT) MIME-Version: 1.0 References: <20220527181822.716758-1-kda@semihalf.com> <20220530182437.56853-1-kda@semihalf.com> <20220530182437.56853-2-kda@semihalf.com> <2970634c-5274-e63c-c16c-b53c1a099496@intel.com> In-Reply-To: <2970634c-5274-e63c-c16c-b53c1a099496@intel.com> From: =?UTF-8?Q?Stanis=C5=82aw_Kardach?= Date: Wed, 1 Jun 2022 12:32:24 +0200 Message-ID: Subject: Re: [PATCH v3 2/2] lpm: add a scalar version of lookupx4 function To: "Medvedkin, Vladimir" Cc: Michal Mazurek , dev , Frank Zhao , Sam Grove , Marcin Wojtas , upstream@semihalf.com Content-Type: text/plain; charset="UTF-8" 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 Vladimir, On Wed, Jun 1, 2022 at 11:41 AM Medvedkin, Vladimir wrote: > > 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! Thanks for catching this. I'll send a followup right away. > > > +#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