From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet Subject: Re: [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation Date: Wed, 25 Oct 2017 02:59:49 +0200 Message-ID: <20171025005914.GR3596@bidouze.vm.6wind.com> References: <20171020212113.4543-1-declan.doherty@intel.com> <20171020212113.4543-2-declan.doherty@intel.com> <20171024140919.GA15441@tdu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: Declan Doherty , dev@dpdk.org To: Tomasz Duszynski Return-path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 2206A1B8A1 for ; Wed, 25 Oct 2017 03:00:02 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id b189so18632508wmd.4 for ; Tue, 24 Oct 2017 18:00:02 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20171024140919.GA15441@tdu> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Oct 24, 2017 at 04:09:19PM +0200, Tomasz Duszynski wrote: > Hi Declan, > > Some comments inline. > > On Fri, Oct 20, 2017 at 10:21:11PM +0100, Declan Doherty wrote: > > Adds new PMD assist functions which are bus independent for driver to > > create and destroy new device instances. > > > > Also includes function to parse parameters which can be passed to > > driver on device initialisation. > > > > Signed-off-by: Declan Doherty > > --- > > lib/librte_cryptodev/rte_cryptodev.h | 8 +- > > lib/librte_cryptodev/rte_cryptodev_pmd.c | 169 +++++++++++++++++++++++++ > > lib/librte_cryptodev/rte_cryptodev_pmd.h | 88 +++++++++++++ > > lib/librte_cryptodev/rte_cryptodev_version.map | 3 + > > 4 files changed, 264 insertions(+), 4 deletions(-) > > > > diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h > > index fd0e3f1..86257b0 100644 > > --- a/lib/librte_cryptodev/rte_cryptodev.h > > +++ b/lib/librte_cryptodev/rte_cryptodev.h > > @@ -60,10 +60,10 @@ extern const char **rte_cyptodev_names; > > RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ > > __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) > > > > -#define CDEV_PMD_LOG_ERR(dev, ...) \ > > - RTE_LOG(ERR, CRYPTODEV, \ > > - RTE_FMT("[%s] %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ > > - dev, __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) > > +#define CDEV_LOG_INFO(...) \ > > + RTE_LOG(INFO, CRYPTODEV, \ > > + RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ > > + __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) > > > > #ifdef RTE_LIBRTE_CRYPTODEV_DEBUG > > #define CDEV_LOG_DEBUG(...) \ > > diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c > > index a57faad..6cb4419 100644 > > --- a/lib/librte_cryptodev/rte_cryptodev_pmd.c > > +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c > > @@ -40,6 +40,175 @@ > > * Parse name from argument > > */ > > static int > > +rte_cryptodev_pmd_parse_name_arg(const char *key __rte_unused, > > + const char *value, void *extra_args) > > +{ > > + struct rte_cryptodev_pmd_init_params *params = extra_args; > > + > > + if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) { > > + CDEV_LOG_ERR("Invalid name %s, should be less than " > > + "%u bytes", value, > > + RTE_CRYPTODEV_NAME_MAX_LEN - 1); > > + return -1; > > + } > > + > > + strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN); > > Would strcpy() do here? At this point we already know that name will > fit into params->name. > snprintf should be preferred to str(n)cpy, in order to ensure having the terminating null byte. > > -- > > 2.9.4 > > > > -- > - Tomasz Duszyński -- Gaëtan Rivet 6WIND