DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Gaëtan Rivet" <gaetan.rivet@6wind.com>
To: Tomasz Duszynski <tdu@semihalf.com>
Cc: Declan Doherty <declan.doherty@intel.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation
Date: Wed, 25 Oct 2017 02:59:49 +0200	[thread overview]
Message-ID: <20171025005914.GR3596@bidouze.vm.6wind.com> (raw)
In-Reply-To: <20171024140919.GA15441@tdu>

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 <declan.doherty@intel.com>
> > ---
> >  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

  reply	other threads:[~2017-10-25  1:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 21:21 [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Declan Doherty
2017-10-20 21:21 ` [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
2017-10-24 11:03   ` De Lara Guarch, Pablo
2017-10-24 14:09   ` Tomasz Duszynski
2017-10-25  0:59     ` Gaëtan Rivet [this message]
2017-10-20 21:21 ` [dpdk-dev] [PATCH 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
2017-10-24 11:18   ` De Lara Guarch, Pablo
2017-10-24 11:32   ` Akhil Goyal
2017-10-25  6:18   ` Tomasz Duszynski
2017-10-25  7:45     ` De Lara Guarch, Pablo
2017-10-20 21:21 ` [dpdk-dev] [PATCH 3/3] cryptodev: break dependency on rte_pci.h Declan Doherty
2017-10-24 11:23   ` De Lara Guarch, Pablo
2017-10-23  9:21 ` [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Doherty, Declan
2017-10-25  0:50 ` Gaëtan Rivet
2017-10-25 12:00 ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure Declan Doherty
2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
2017-10-25 15:56     ` Trahe, Fiona
2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
2017-10-25 12:00   ` [dpdk-dev] [PATCH v2 3/3] cryptodev: break dependency on PCI " Declan Doherty
2017-10-25 15:55     ` Trahe, Fiona
2017-10-25 14:36   ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure De Lara Guarch, Pablo
2017-10-25 16:06   ` De Lara Guarch, Pablo

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=20171025005914.GR3596@bidouze.vm.6wind.com \
    --to=gaetan.rivet@6wind.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=tdu@semihalf.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).