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.dohe...@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