From patchwork Fri Oct 6 08:39:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Blunck X-Patchwork-Id: 29795 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 996A81B2AC; Fri, 6 Oct 2017 10:40:22 +0200 (CEST) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 965CC1B2A3 for ; Fri, 6 Oct 2017 10:40:20 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id l10so8300536wmg.1 for ; Fri, 06 Oct 2017 01:40:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=pFFjbZPKpqbD7LiaXb30neQUF4MRXQ5FiWPsZLzSN58=; b=FX2Z0w/UfX04MzYDFV2ot7mmY1KB6CV/1hOC9RfFra6hDRCZMAt8Y5i+ryjRi8Vn/Y Tg3Atplk/ZfgcSKtu+ifSlQTLeOcXHdmSWKwVb2qvGsMFMlpC6FzK0KS6jXSLXFQyrjy o/LfjjnKZb8UYBQq186v6E4maBR7CRWm69vefX1ydDlPm6Do6oDcGZdgxqYFuBaEhlZp +CS781B4sLznoPmi3j5qf45vVWhoWNmcyXkQvqoJrus5KRzgx2xuTR0gd/N/XKuSnL9K HVAVJ6Gb/O17gkzp/GPOKX1VACQ4P8CijuwCWTLIQBzl0j0tYTh5AgLTjITdECsuclvw nGiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=pFFjbZPKpqbD7LiaXb30neQUF4MRXQ5FiWPsZLzSN58=; b=muTYuAAlxLFE4yiuFqVTmLWUkOup5KnP9AK7pCVFXvRmxJBuhI9rsM7tSy4xuVNL4G fOPdi6ygUJ6Aa5TPZBWh4+JW2DvXf1AXDA/y+YFuG/JoiLVu+1RATlZbadjUGo/wA2Nf E2ZzRl2KrYCpuHuRw/caXYNAU19ghpaQ1EFF+sdXcLwN+F/FoUNCQs5QDvlBebralqek ZPQt1p9lsIfmFMns/iovsD1zSek3G/9r3qfwcNT2S+4hGXWJNuu1srubwwR0PKPqnjzs FJy8k2L0WDchWXQzfuK5c/N8aT1RsHYmA1DfXmw8iBt9qWEZnSDQvWIr1P9SdmKYOrCw vcvg== X-Gm-Message-State: AMCzsaV6xHxB00D1wWLIhZhcSYzr5exQK9ShiVpLtLbQI3ED0miu0eGW Ub8JwMJQ/Jk+yvpyXqMHqyyk2dx8Fcg= X-Google-Smtp-Source: AOwi7QAcTOKspxW43H12Ww4FSOLvK9OToBYDF34Za3KRe1R9wPp/cvDbGwIV87gGpYm0gOLdIzQfLQ== X-Received: by 10.80.184.21 with SMTP id j21mr2142477ede.160.1507279220101; Fri, 06 Oct 2017 01:40:20 -0700 (PDT) Received: from localhost.localdomain ([37.228.147.16]) by smtp.gmail.com with ESMTPSA id e2sm622871edi.65.2017.10.06.01.40.18 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 06 Oct 2017 01:40:19 -0700 (PDT) From: Jan Blunck To: dev@dpdk.org Cc: declan.doherty@intel.com, pablo.de.lara.guarch@intel.com Date: Fri, 6 Oct 2017 10:39:34 +0200 Message-Id: <20171006083934.34819-5-jblunck@infradead.org> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20171006083934.34819-1-jblunck@infradead.org> References: <20171006083934.34819-1-jblunck@infradead.org> In-Reply-To: <20170712195846.65286-1-jblunck@infradead.org> References: <20170712195846.65286-1-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v3 4/4] cryptodev: move parameter parsing to its own header 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This moves the parameter parsing functions out of the rte_cryptodev_vdev.h header to not require the rte_vdev.h header at build time of the library. Signed-off-by: Jan Blunck Acked-by: Pablo de Lara --- lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/rte_cryptodev_pmd.c | 2 +- lib/librte_cryptodev/rte_cryptodev_vdev.h | 42 +---------- lib/librte_cryptodev/rte_cryptodev_vdev_params.h | 89 ++++++++++++++++++++++++ 4 files changed, 92 insertions(+), 42 deletions(-) create mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev_params.h diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile index 6ac331bc9..59d9a4e2e 100644 --- a/lib/librte_cryptodev/Makefile +++ b/lib/librte_cryptodev/Makefile @@ -49,6 +49,7 @@ SYMLINK-y-include += rte_crypto_sym.h SYMLINK-y-include += rte_cryptodev.h SYMLINK-y-include += rte_cryptodev_pmd.h SYMLINK-y-include += rte_cryptodev_vdev.h +SYMLINK-y-include += rte_cryptodev_vdev_params.h SYMLINK-y-include += rte_cryptodev_pci.h # versioning export map diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c index eaeddf74b..d6eaa2a90 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.c +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c @@ -32,7 +32,7 @@ #include -#include "rte_cryptodev_vdev.h" +#include "rte_cryptodev_vdev_params.h" #include "rte_cryptodev_pci.h" #include "rte_cryptodev_pmd.h" diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.h b/lib/librte_cryptodev/rte_cryptodev_vdev.h index c6bafd01b..94df46cab 100644 --- a/lib/librte_cryptodev/rte_cryptodev_vdev.h +++ b/lib/librte_cryptodev/rte_cryptodev_vdev.h @@ -37,32 +37,7 @@ #include #include "rte_cryptodev_pmd.h" - -#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS 8 -#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS 2048 - -#define RTE_CRYPTODEV_VDEV_NAME ("name") -#define RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG ("max_nb_queue_pairs") -#define RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG ("max_nb_sessions") -#define RTE_CRYPTODEV_VDEV_SOCKET_ID ("socket_id") - -static const char * const cryptodev_vdev_valid_params[] = { - RTE_CRYPTODEV_VDEV_NAME, - RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG, - RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG, - RTE_CRYPTODEV_VDEV_SOCKET_ID -}; - -/** - * @internal - * Initialisation parameters for virtual crypto devices - */ -struct rte_crypto_vdev_init_params { - unsigned int max_nb_queue_pairs; - unsigned int max_nb_sessions; - uint8_t socket_id; - char name[RTE_CRYPTODEV_NAME_MAX_LEN]; -}; +#include "rte_cryptodev_vdev_params.h" /** * @internal @@ -107,19 +82,4 @@ rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size, return cryptodev; } -/** - * @internal - * Parse virtual device initialisation parameters input arguments - * - * @params params Initialisation parameters with defaults set. - * @params input_args Command line arguments - * - * @return - * 0 on successful parse - * <0 on failure to parse - */ -int -rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params, - const char *input_args); - #endif /* _RTE_CRYPTODEV_VDEV_H_ */ diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev_params.h b/lib/librte_cryptodev/rte_cryptodev_vdev_params.h new file mode 100644 index 000000000..66ba0d482 --- /dev/null +++ b/lib/librte_cryptodev/rte_cryptodev_vdev_params.h @@ -0,0 +1,89 @@ +/*- + * 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 the copyright holder 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_CRYPTODEV_VDEV_PARAMS_H_ +#define _RTE_CRYPTODEV_VDEV_PARAMS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "rte_cryptodev.h" + +#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS 8 +#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS 2048 + +#define RTE_CRYPTODEV_VDEV_NAME ("name") +#define RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG ("max_nb_queue_pairs") +#define RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG ("max_nb_sessions") +#define RTE_CRYPTODEV_VDEV_SOCKET_ID ("socket_id") + +static const char * const cryptodev_vdev_valid_params[] = { + RTE_CRYPTODEV_VDEV_NAME, + RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG, + RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG, + RTE_CRYPTODEV_VDEV_SOCKET_ID +}; + +/** + * @internal + * Initialisation parameters for virtual crypto devices + */ +struct rte_crypto_vdev_init_params { + unsigned int max_nb_queue_pairs; + unsigned int max_nb_sessions; + uint8_t socket_id; + char name[RTE_CRYPTODEV_NAME_MAX_LEN]; +}; + +/** + * @internal + * Parse virtual device initialisation parameters input arguments + * + * @params params Initialisation parameters with defaults set. + * @params input_args Command line arguments + * + * @return + * 0 on successful parse + * <0 on failure to parse + */ +int +rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params, + const char *input_args); + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_CRYPTODEV_VDEV_PARAMS_H_ */