[dpdk-dev] [PATCH v3 1/2] librte_net: add crc compute APIs

Singh, Jasvinder jasvinder.singh at intel.com
Mon Mar 13 10:05:25 CET 2017


Hi Konstantin,

> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Monday, March 13, 2017 3:06 AM
> To: Singh, Jasvinder <jasvinder.singh at intel.com>; dev at dpdk.org
> Cc: Doherty, Declan <declan.doherty at intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch at intel.com>
> Subject: RE: [dpdk-dev] [PATCH v3 1/2] librte_net: add crc compute APIs
> 
> Hi Jasvinder,
> 
> >
> > APIs for selecting the architecure specific implementation and
> > computing the crc (16-bit and 32-bit CRCs) are added. For CRCs
> > calculation, scalar as well as x86 intrinsic(sse4.2) versions are implemented.
> >
> > The scalar version is based on generic Look-Up Table(LUT) algorithm,
> > while x86 intrinsic version uses carry-less multiplication for fast
> > CRC computation.
> >
> > Signed-off-by: Jasvinder Singh <jasvinder.singh at intel.com>
> > ---
> >  lib/librte_net/Makefile            |   3 +
> >  lib/librte_net/rte_net_crc.c       | 205 ++++++++++++++++++++++
> >  lib/librte_net/rte_net_crc.h       | 104 +++++++++++
> >  lib/librte_net/rte_net_crc_sse.h   | 351
> +++++++++++++++++++++++++++++++++++++
> >  lib/librte_net/rte_net_version.map |   8 +
> >  5 files changed, 671 insertions(+)
> >  create mode 100644 lib/librte_net/rte_net_crc.c  create mode 100644
> > lib/librte_net/rte_net_crc.h  create mode 100644
> > lib/librte_net/rte_net_crc_sse.h
> >
> > +
> > +/**
> > + * CRC compute API
> > + *
> > + * @param mbuf
> > + *  Pointer to the packet mbuf for crc computation
> > + * @param data_offset
> > + *  Offset to the data in the mbuf
> > + * @param data_len
> > + *  length of the data to compute the crc on
> > + * @param type
> > + *  crc type
> > + *
> > + * @return
> > + *  computed crc value
> > + */
> > +uint32_t
> > +rte_net_crc_calc(struct rte_mbuf *mbuf,
> > +	uint32_t data_offset,
> > +	uint32_t data_len,
> > +	enum rte_net_crc_type type);
> 
> 
> I think it will probably be convenient to have this API not dependent on
> mbuf, something like:
> 
> uint32_t rte_net_crc_calc(const void *buf, uint32_t data_len, enum
> rte_net_crc_type type);
> 
> And if we like to have an extra function that would do similar thing for mbuf,
> that's fine too, but I suppose such function would have to handle multi-
> segment case too.
> Konstantin

I will change the api as you suggested. Thanks.



More information about the dev mailing list