From: Olivier Matz <olivier.matz@6wind.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
Cc: "Singh, Jasvinder" <jasvinder.singh@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>,
"Doherty, Declan" <declan.doherty@intel.com>,
"De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
Subject: Re: [dpdk-dev] [PATCH v8 1/2] librte_net: add crc compute APIs
Date: Thu, 30 Mar 2017 16:40:48 +0200 [thread overview]
Message-ID: <20170330164048.1c92bf81@platinum> (raw)
In-Reply-To: <2601191342CEEE43887BDE71AB9772583FAE243B@IRSMSX109.ger.corp.intel.com>
Hi Jasvinder,
On Thu, 30 Mar 2017 11:31:54 +0000, "Ananyev, Konstantin" <konstantin.ananyev@intel.com> wrote:
> Hi Jasvinder,
>
> > diff --git a/lib/librte_net/rte_net_crc.h b/lib/librte_net/rte_net_crc.h
> > new file mode 100644
> > index 0000000..dd6c110
> > --- /dev/null
> > +++ b/lib/librte_net/rte_net_crc.h
> > @@ -0,0 +1,104 @@
> > +/*-
> > + * BSD LICENSE
> > + *
> > + * Copyright(c) 2017 Intel Corporation.
> > + * All rights reserved.
> > + *
> > + * Redistribution and use in source and binary forms, with or without
> > + * modification, are permitted provided that the following conditions
> > + * are met:
> > + *
> > + * * Redistributions of source code must retain the above copyright
> > + * notice, this list of conditions and the following disclaimer.
> > + * * Redistributions in binary form must reproduce the above copyright
> > + * notice, this list of conditions and the following disclaimer in
> > + * the documentation and/or other materials provided with the
> > + * distribution.
> > + * * Neither the name of Intel Corporation nor the names of its
> > + * contributors may be used to endorse or promote products derived
> > + * from this software without specific prior written permission.
> > + *
> > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> > + */
> > +
> > +#ifndef _RTE_NET_CRC_H_
> > +#define _RTE_NET_CRC_H_
> > +
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
> > +
> > +#include <stdint.h>
> > +
> > +#include <rte_mbuf.h>
>
> As a nit: you probably don't need that include.
> Konstantin
>
> > +
> > +/** CRC polynomials */
> > +#define CRC32_ETH_POLYNOMIAL 0x04c11db7UL
> > +#define CRC16_CCITT_POLYNOMIAL 0x1021U
> > +
> > +#define CRC_LUT_SIZE 256
> > +
> > +/** CRC types */
> > +enum rte_net_crc_type {
> > + RTE_NET_CRC16_CCITT = 0,
> > + RTE_NET_CRC32_ETH,
> > + RTE_NET_CRC_REQS
> > +};
> > +
> > +/** CRC compute algorithm */
> > +enum rte_net_crc_alg {
> > + RTE_NET_CRC_SCALAR = 0,
> > + RTE_NET_CRC_SSE42,
> > +};
> > +
> > +/**
> > + * This API set the CRC computation algorithm (i.e. scalar version,
> > + * x86 64-bit sse4.2 intrinsic version, etc.) and internal data
> > + * structure.
> > + *
> > + * @param alg
> > + * This parameter is used to select the CRC implementation version.
> > + * - RTE_NET_CRC_SCALAR
> > + * - RTE_NET_CRC_SSE42 (Use 64-bit SSE4.2 intrinsic)
> > + */
> > +void
> > +rte_net_crc_set_alg(enum rte_net_crc_alg alg);
> > +
> > +/**
> > + * CRC compute API
> > + *
> > + * @param data
> > + * Pointer to the packet data for CRC computation
> > + * @param data_len
> > + * Data length for CRC computation
> > + * @param type
> > + * CRC type (enum rte_net_crc_type)
> > + *
> > + * @return
> > + * CRC value
> > + */
> > +uint32_t
> > +rte_net_crc_calc(const void *data,
> > + uint32_t data_len,
> > + enum rte_net_crc_type type);
> > +
> > +#if defined(RTE_ARCH_X86_64) && defined(RTE_MACHINE_CPUFLAG_SSE4_2)
> > +#include <rte_net_crc_sse.h>
> > +#endif
I think this include should not be included from rte_net_crc.h.
From what I see, the API is the same for sse and non-sse, so this include
could be private, included only from the .c file. If you also remove
the include to rte_mbuf.h as suggested by Konstantin, it will require the
following includes in rte_net_crc.c:
#include <stddef.h>
#include <string.h>
#include <rte_common.h>
#include <rte_cpuflags.h>
#include <rte_branch_prediction.h>
#include <rte_vect.h>
#include <rte_net_crc.h>
#if defined(RTE_ARCH_X86_64) && defined(RTE_MACHINE_CPUFLAG_SSE4_2)
#include <rte_net_crc_sse.h>
#endif
If the sse file is only used in the .c, this line could also be
removed in the Makefile:
SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc_sse.h
I'm not very familiar with crc and sse code. Could you add yourself
as maintainer for these files in MAINTAINERS?
Thanks
Olivier
next prev parent reply other threads:[~2017-03-30 14:40 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 20:54 [dpdk-dev] [PATCH 0/2] librte_net: add crc computation support Jasvinder Singh
2017-02-24 20:54 ` [dpdk-dev] [PATCH 1/2] librte_net: add crc init and compute APIs Jasvinder Singh
2017-02-28 12:08 ` [dpdk-dev] [PATCH v2 0/2] librte_net: add crc computation support Jasvinder Singh
2017-02-28 12:08 ` [dpdk-dev] [PATCH v2 1/2] librte_net: add crc init and compute APIs Jasvinder Singh
2017-02-28 12:15 ` Jerin Jacob
2017-03-01 18:46 ` Thomas Monjalon
2017-03-02 13:03 ` Singh, Jasvinder
2017-03-06 15:27 ` Thomas Monjalon
2017-03-08 11:08 ` De Lara Guarch, Pablo
2017-03-15 17:35 ` Thomas Monjalon
2017-03-15 19:03 ` Dumitrescu, Cristian
2017-03-15 20:15 ` Thomas Monjalon
2017-03-15 21:11 ` Dumitrescu, Cristian
2017-03-15 19:09 ` Dumitrescu, Cristian
2017-03-12 21:33 ` [dpdk-dev] [PATCH v3 0/2] librte_net: add crc computation support Jasvinder Singh
2017-03-12 21:33 ` [dpdk-dev] [PATCH v3 1/2] librte_net: add crc compute APIs Jasvinder Singh
2017-03-13 3:06 ` Ananyev, Konstantin
2017-03-13 9:05 ` Singh, Jasvinder
2017-03-20 19:29 ` [dpdk-dev] [PATCH v4 0/2] librte_net: add crc computation support Jasvinder Singh
2017-03-20 19:29 ` [dpdk-dev] [PATCH v4 1/2] librte_net: add crc compute APIs Jasvinder Singh
2017-03-21 14:45 ` [dpdk-dev] [PATCH v5 0/2] librte_net: add crc computation support Jasvinder Singh
2017-03-21 14:45 ` [dpdk-dev] [PATCH v5 1/2] librte_net: add crc compute APIs Jasvinder Singh
2017-03-28 18:04 ` De Lara Guarch, Pablo
2017-03-28 18:07 ` De Lara Guarch, Pablo
2017-03-28 19:21 ` Singh, Jasvinder
2017-03-29 12:42 ` [dpdk-dev] [PATCH v6 0/2] librte_net: add crc computation support Jasvinder Singh
2017-03-29 12:42 ` [dpdk-dev] [PATCH v6 1/2] librte_net: add crc compute APIs Jasvinder Singh
2017-03-29 16:14 ` De Lara Guarch, Pablo
2017-03-29 17:15 ` [dpdk-dev] [PATCH v7 0/2] librte_net: add crc computation support Jasvinder Singh
2017-03-29 17:15 ` [dpdk-dev] [PATCH v7 1/2] librte_net: add crc compute APIs Jasvinder Singh
2017-03-30 11:30 ` [dpdk-dev] [PATCH v8 0/2] librte_net: add crc computation support Jasvinder Singh
2017-03-30 11:30 ` [dpdk-dev] [PATCH v8 1/2] librte_net: add crc compute APIs Jasvinder Singh
2017-03-30 11:31 ` Ananyev, Konstantin
2017-03-30 12:06 ` Singh, Jasvinder
2017-03-30 14:40 ` Olivier Matz [this message]
2017-03-30 15:14 ` Singh, Jasvinder
2017-03-30 16:15 ` [dpdk-dev] [PATCH v9 0/3] librte_net: add crc computation support Jasvinder Singh
2017-03-30 16:15 ` [dpdk-dev] [PATCH v9 1/3] librte_net: add crc compute APIs Jasvinder Singh
2017-04-04 20:00 ` Thomas Monjalon
2017-04-05 14:58 ` [dpdk-dev] [PATCH v10 0/2] librte_net: add crc computation support Jasvinder Singh
2017-04-05 14:58 ` [dpdk-dev] [PATCH v10 1/2] librte_net: add crc compute APIs Jasvinder Singh
2017-04-05 17:49 ` Thomas Monjalon
2017-04-05 19:22 ` Singh, Jasvinder
2017-04-05 20:49 ` [dpdk-dev] [PATCH v11 0/2] librte_net: add crc computation support Jasvinder Singh
2017-04-05 20:49 ` [dpdk-dev] [PATCH v11 1/2] librte_net: add crc compute APIs Jasvinder Singh
2017-04-05 20:49 ` [dpdk-dev] [PATCH v11 2/2] test/test: add unit test for CRC computation Jasvinder Singh
2017-04-05 20:59 ` Thomas Monjalon
2017-04-05 21:00 ` [dpdk-dev] [PATCH v11 0/2] librte_net: add crc computation support Thomas Monjalon
2017-04-05 14:58 ` [dpdk-dev] [PATCH v10 2/2] test/test: add unit test for CRC computation Jasvinder Singh
2017-03-30 16:15 ` [dpdk-dev] [PATCH v9 2/3] " Jasvinder Singh
2017-03-30 16:15 ` [dpdk-dev] [PATCH v9 3/3] maintainers: add packet crc section and claim maintainership Jasvinder Singh
2017-04-04 19:55 ` Thomas Monjalon
2017-04-04 20:02 ` [dpdk-dev] [PATCH v9 0/3] librte_net: add crc computation support Thomas Monjalon
2017-04-05 8:34 ` Singh, Jasvinder
2017-04-05 9:01 ` Thomas Monjalon
2017-04-05 9:37 ` Richardson, Bruce
2017-04-05 12:52 ` Singh, Jasvinder
2017-03-30 11:30 ` [dpdk-dev] [PATCH v8 2/2] test/test: add unit test for CRC computation Jasvinder Singh
2017-03-29 17:15 ` [dpdk-dev] [PATCH v7 " Jasvinder Singh
2017-03-29 12:42 ` [dpdk-dev] [PATCH v6 " Jasvinder Singh
2017-03-29 16:12 ` De Lara Guarch, Pablo
2017-03-21 14:45 ` [dpdk-dev] [PATCH v5 " Jasvinder Singh
2017-03-28 19:23 ` De Lara Guarch, Pablo
2017-03-28 19:27 ` Singh, Jasvinder
2017-03-20 19:29 ` [dpdk-dev] [PATCH v4 2/2] app/test: " Jasvinder Singh
2017-03-21 7:14 ` Peng, Yuan
2017-03-12 21:33 ` [dpdk-dev] [PATCH v3 " Jasvinder Singh
2017-02-28 12:08 ` [dpdk-dev] [PATCH v2 " Jasvinder Singh
2017-02-24 20:54 ` [dpdk-dev] [PATCH " Jasvinder Singh
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=20170330164048.1c92bf81@platinum \
--to=olivier.matz@6wind.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=jasvinder.singh@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=pablo.de.lara.guarch@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).