From: "Stanisław Kardach" <kda@semihalf.com>
To: "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>
Cc: Michal Mazurek <maz@semihalf.com>, dev <dev@dpdk.org>,
Frank Zhao <Frank.Zhao@starfivetech.com>,
Sam Grove <sam.grove@sifive.com>,
Marcin Wojtas <mw@semihalf.com>,
upstream@semihalf.com
Subject: Re: [PATCH v3 2/2] lpm: add a scalar version of lookupx4 function
Date: Wed, 1 Jun 2022 12:32:24 +0200 [thread overview]
Message-ID: <CALVGJWKAsu3769dWTcuJyykzOzTqTZrnCOAomubv4Jij5+-PGA@mail.gmail.com> (raw)
In-Reply-To: <2970634c-5274-e63c-c16c-b53c1a099496@intel.com>
Hi Vladimir,
On Wed, Jun 1, 2022 at 11:41 AM Medvedkin, Vladimir
<vladimir.medvedkin@intel.com> wrote:
>
> Hi Stanislaw,
>
>
> On 30/05/2022 19:24, Stanislaw Kardach wrote:
> > From: Michal Mazurek <maz@semihalf.com>
> >
> > 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 <maz@semihalf.com>
> > Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
> > ---
> > 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 <rte_branch_prediction.h>
> > +#include <rte_byteorder.h>
> > +#include <rte_common.h>
>
> 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 <rte_vect.h>
> > +
> > +#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 <vladimir.medvedkin@intel.com>
>
> --
> Regards,
> Vladimir
next prev parent reply other threads:[~2022-06-01 10:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-10 11:58 [PATCH 1/1] " Stanislaw Kardach
2022-05-19 17:02 ` Medvedkin, Vladimir
2022-05-24 16:28 ` Stanisław Kardach
2022-05-27 11:16 ` Stanisław Kardach
2022-05-27 13:16 ` Medvedkin, Vladimir
2022-05-27 18:18 ` [PATCH v2 1/2] lpm: add const to lpm arg of rte_lpm_lookup Stanislaw Kardach
2022-05-27 18:18 ` [PATCH v2 2/2] lpm: add a scalar version of lookupx4 function Stanislaw Kardach
2022-05-27 20:15 ` Stephen Hemminger
2022-05-30 7:52 ` Bruce Richardson
2022-05-30 8:00 ` Morten Brørup
2022-05-30 10:42 ` Bruce Richardson
2022-05-30 11:20 ` Stanisław Kardach
2022-05-30 12:46 ` Bruce Richardson
2022-05-30 18:24 ` [PATCH v3 1/2] lpm: add const to lpm arg of rte_lpm_lookup Stanislaw Kardach
2022-05-30 18:24 ` [PATCH v3 2/2] lpm: add a scalar version of lookupx4 function Stanislaw Kardach
2022-06-01 9:41 ` Medvedkin, Vladimir
2022-06-01 10:32 ` Stanisław Kardach [this message]
2022-05-30 20:38 ` [PATCH v3 1/2] lpm: add const to lpm arg of rte_lpm_lookup Stephen Hemminger
2022-06-01 9:35 ` Medvedkin, Vladimir
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALVGJWKAsu3769dWTcuJyykzOzTqTZrnCOAomubv4Jij5+-PGA@mail.gmail.com \
--to=kda@semihalf.com \
--cc=Frank.Zhao@starfivetech.com \
--cc=dev@dpdk.org \
--cc=maz@semihalf.com \
--cc=mw@semihalf.com \
--cc=sam.grove@sifive.com \
--cc=upstream@semihalf.com \
--cc=vladimir.medvedkin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).