From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=YrP4ECqvG5YSSR8XuIOstPdKaBAzcwqKXFdH4CEewIc=; b=AaEvi8lK01jgaevY8OvynKI4GyDyBhslikv2AEuyWVeOSxiyfHQQp9+lDOUIH+2IgL P6xvnKmnbvArsvVwy32E/aBtfFaZOuXTsSO966EP9gJsFj7akY+F9ga2rEESPwh0m1so 0do5KUJzEdY8MbTAnCCyLPCeETlgpFkXVNEp/oxHqePYt710jNvSmdlZ2CHbs6ZfXLKT QeGR6CGDR/sI99Jx+pL2Q5RHiNTir41JkN2jrwBTEoGoym2fA5+/pdhPKp/kVX626ZQ+ qOmzr3yrjaeicoi9AET376L9FR5J6iKlT34frnQ+ROdIQaqXUZzRh0vEhPsFmipBFS5J VlUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=YrP4ECqvG5YSSR8XuIOstPdKaBAzcwqKXFdH4CEewIc=; b=PZ9i6s1A00i5UHgYoT/vnCbSw7qE10CKjmzcGSSKhsCGZrdZO78Sq8FQSEl+s7jZmo eVk7pq3hLqCd3XKYvQxt5nwyYRH8XS492+Pbj8ZT03whd2hL0G4OlCyQlOq5dYi/KLO/ 73i/o7vjGbGAIOd7Q5T2YRBmdIwmVI+yajeEFKYZ7ijyrK5LZ5ufNKmCZAsAb+v68Jg8 bMZHqZijm2t/rSOwliKdSfriHytZ1gPdRN+D5KGCcOB013vDup+8CEdfs1vBsOOMe8yr VWHopyoVssj8GRguXmVVJZZYXWRN6yrhCMvIWzpivnHI7ZVM9mqHsISNrzMvem3cn5oD JOrQ== X-Gm-Message-State: AMCzsaW3BZDjb1T1rNC4/rlppd+eBHiVPkPvNM+UUkc8oW44yc5KWJ67 xG8XAHDrp9T3AGmhuUwtpID0QQ== X-Google-Smtp-Source: ABhQp+SQSfCQjLVXQQU9rbIjGzEoxhTfXz+e28jXDPmZUqJC6IUcuwHrAIdHJeibG+ih48Ijym4d+w== X-Received: by 10.28.130.140 with SMTP id e134mr11656wmd.159.1508893201593; Tue, 24 Oct 2017 18:00:01 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 67sm1422522wmw.22.2017.10.24.18.00.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 18:00:00 -0700 (PDT) Date: Wed, 25 Oct 2017 02:59:49 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Tomasz Duszynski Cc: Declan Doherty , dev@dpdk.org 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20171024140919.GA15441@tdu> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH 1/3] cryptodev: add new APIs to assist PMD initialisation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 01:00:02 -0000 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