From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 599211CE31 for ; Fri, 6 Apr 2018 20:52:20 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Apr 2018 11:52:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,416,1517904000"; d="scan'208";a="189275599" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by orsmga004.jf.intel.com with ESMTP; 06 Apr 2018 11:52:18 -0700 From: Fiona Trahe To: dev@dpdk.org, pablo.de.lara.guarch@intel.com Cc: fiona.trahe@intel.com, tomaszx.jozwiak@intel.com Date: Fri, 6 Apr 2018 19:51:45 +0100 Message-Id: <1523040732-3290-4-git-send-email-fiona.trahe@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1523040732-3290-1-git-send-email-fiona.trahe@intel.com> References: <1523040732-3290-1-git-send-email-fiona.trahe@intel.com> Subject: [dpdk-dev] [PATCH 03/30] crypto/qat: add qat device files 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: Fri, 06 Apr 2018 18:52:20 -0000 This commit adds new qat_device file. Following objects were moved: qat_crypto.h => qat_device.h - struct qat_pmd_private - uint8_t cryptodev_qat_driver_id - int qat_crypto_sym_qp_release (EXTERN) - int qat_dev_config() - int qat_dev_start() - void qat_dev_stop() - int qat_dev_close() - void qat_dev_info_get() qat_crypto.c => qat_device.c - int qat_dev_config() - int qat_dev_start() - void qat_dev_stop() - int qat_dev_close() - void qat_dev_info_get() Signed-off-by: ArkadiuszX Kusztal Signed-off-by: Fiona Trahe --- drivers/crypto/qat/Makefile | 1 + drivers/crypto/qat/meson.build | 3 ++- drivers/crypto/qat/qat_crypto.c | 51 ------------------------------------ drivers/crypto/qat/qat_crypto.h | 22 +--------------- drivers/crypto/qat/qat_device.c | 57 +++++++++++++++++++++++++++++++++++++++++ drivers/crypto/qat/qat_device.h | 36 ++++++++++++++++++++++++++ 6 files changed, 97 insertions(+), 73 deletions(-) create mode 100644 drivers/crypto/qat/qat_device.c create mode 100644 drivers/crypto/qat/qat_device.h diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile index 07266a5e9..6bdd11679 100644 --- a/drivers/crypto/qat/Makefile +++ b/drivers/crypto/qat/Makefile @@ -22,6 +22,7 @@ LDLIBS += -lrte_pci -lrte_bus_pci # library source files SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_crypto.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_device.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_qp.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_adf/qat_algs_build_desc.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += rte_qat_cryptodev.c diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build index 006cd6557..51630e31b 100644 --- a/drivers/crypto/qat/meson.build +++ b/drivers/crypto/qat/meson.build @@ -7,7 +7,8 @@ if not dep.found() endif sources = files('qat_crypto.c', 'qat_qp.c', 'qat_adf/qat_algs_build_desc.c', - 'rte_qat_cryptodev.c') + 'rte_qat_cryptodev.c', + 'qat_device.c') includes += include_directories('qat_adf') deps += ['bus_pci'] ext_deps += dep diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index d9ce2a136..928a50475 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -1609,57 +1609,6 @@ static inline uint32_t adf_modulo(uint32_t data, uint32_t shift) return data - mult; } -int qat_dev_config(__rte_unused struct rte_cryptodev *dev, - __rte_unused struct rte_cryptodev_config *config) -{ - PMD_INIT_FUNC_TRACE(); - return 0; -} - -int qat_dev_start(__rte_unused struct rte_cryptodev *dev) -{ - PMD_INIT_FUNC_TRACE(); - return 0; -} - -void qat_dev_stop(__rte_unused struct rte_cryptodev *dev) -{ - PMD_INIT_FUNC_TRACE(); -} - -int qat_dev_close(struct rte_cryptodev *dev) -{ - int i, ret; - - PMD_INIT_FUNC_TRACE(); - - for (i = 0; i < dev->data->nb_queue_pairs; i++) { - ret = qat_crypto_sym_qp_release(dev, i); - if (ret < 0) - return ret; - } - - return 0; -} - -void qat_dev_info_get(struct rte_cryptodev *dev, - struct rte_cryptodev_info *info) -{ - struct qat_pmd_private *internals = dev->data->dev_private; - - PMD_INIT_FUNC_TRACE(); - if (info != NULL) { - info->max_nb_queue_pairs = - ADF_NUM_SYM_QPS_PER_BUNDLE * - ADF_NUM_BUNDLES_PER_DEV; - info->feature_flags = dev->feature_flags; - info->capabilities = internals->qat_dev_capabilities; - info->sym.max_nb_sessions = internals->max_nb_sessions; - info->driver_id = cryptodev_qat_driver_id; - info->pci_dev = RTE_DEV_TO_PCI(dev->device); - } -} - void qat_crypto_sym_stats_get(struct rte_cryptodev *dev, struct rte_cryptodev_stats *stats) { diff --git a/drivers/crypto/qat/qat_crypto.h b/drivers/crypto/qat/qat_crypto.h index 5190d25e5..46f03ccde 100644 --- a/drivers/crypto/qat/qat_crypto.h +++ b/drivers/crypto/qat/qat_crypto.h @@ -9,6 +9,7 @@ #include #include "qat_common.h" +#include "qat_device.h" #include "qat_crypto_capabilities.h" /* @@ -64,27 +65,6 @@ struct qat_qp { enum qat_device_gen qat_dev_gen; } __rte_cache_aligned; -/** private data structure for each QAT device */ -struct qat_pmd_private { - unsigned max_nb_queue_pairs; - /**< Max number of queue pairs supported by device */ - unsigned max_nb_sessions; - /**< Max number of sessions supported by device */ - enum qat_device_gen qat_dev_gen; - /**< QAT device generation */ - const struct rte_cryptodev_capabilities *qat_dev_capabilities; -}; - -extern uint8_t cryptodev_qat_driver_id; - -int qat_dev_config(struct rte_cryptodev *dev, - struct rte_cryptodev_config *config); -int qat_dev_start(struct rte_cryptodev *dev); -void qat_dev_stop(struct rte_cryptodev *dev); -int qat_dev_close(struct rte_cryptodev *dev); -void qat_dev_info_get(struct rte_cryptodev *dev, - struct rte_cryptodev_info *info); - void qat_crypto_sym_stats_get(struct rte_cryptodev *dev, struct rte_cryptodev_stats *stats); void qat_crypto_sym_stats_reset(struct rte_cryptodev *dev); diff --git a/drivers/crypto/qat/qat_device.c b/drivers/crypto/qat/qat_device.c new file mode 100644 index 000000000..c2bf9b7a7 --- /dev/null +++ b/drivers/crypto/qat/qat_device.c @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Intel Corporation + */ + +#include "qat_device.h" +#include "adf_transport_access_macros.h" + +int qat_dev_config(__rte_unused struct rte_cryptodev *dev, + __rte_unused struct rte_cryptodev_config *config) +{ + PMD_INIT_FUNC_TRACE(); + return 0; +} + +int qat_dev_start(__rte_unused struct rte_cryptodev *dev) +{ + PMD_INIT_FUNC_TRACE(); + return 0; +} + +void qat_dev_stop(__rte_unused struct rte_cryptodev *dev) +{ + PMD_INIT_FUNC_TRACE(); +} + +int qat_dev_close(struct rte_cryptodev *dev) +{ + int i, ret; + + PMD_INIT_FUNC_TRACE(); + + for (i = 0; i < dev->data->nb_queue_pairs; i++) { + ret = qat_crypto_sym_qp_release(dev, i); + if (ret < 0) + return ret; + } + + return 0; +} + +void qat_dev_info_get(struct rte_cryptodev *dev, + struct rte_cryptodev_info *info) +{ + struct qat_pmd_private *internals = dev->data->dev_private; + + PMD_INIT_FUNC_TRACE(); + if (info != NULL) { + info->max_nb_queue_pairs = + ADF_NUM_SYM_QPS_PER_BUNDLE * + ADF_NUM_BUNDLES_PER_DEV; + info->feature_flags = dev->feature_flags; + info->capabilities = internals->qat_dev_capabilities; + info->sym.max_nb_sessions = internals->max_nb_sessions; + info->driver_id = cryptodev_qat_driver_id; + info->pci_dev = RTE_DEV_TO_PCI(dev->device); + } +} diff --git a/drivers/crypto/qat/qat_device.h b/drivers/crypto/qat/qat_device.h new file mode 100644 index 000000000..5c48fdb93 --- /dev/null +++ b/drivers/crypto/qat/qat_device.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Intel Corporation + */ +#ifndef _QAT_DEVICE_H_ +#define _QAT_DEVICE_H_ + +#include +#include +#include "qat_common.h" +#include "qat_logs.h" + +extern uint8_t cryptodev_qat_driver_id; + +extern int qat_crypto_sym_qp_release(struct rte_cryptodev *dev, + uint16_t queue_pair_id); + +/** private data structure for each QAT device */ +struct qat_pmd_private { + unsigned int max_nb_queue_pairs; + /**< Max number of queue pairs supported by device */ + unsigned int max_nb_sessions; + /**< Max number of sessions supported by device */ + enum qat_device_gen qat_dev_gen; + /**< QAT device generation */ + const struct rte_cryptodev_capabilities *qat_dev_capabilities; +}; + +int qat_dev_config(struct rte_cryptodev *dev, + struct rte_cryptodev_config *config); +int qat_dev_start(struct rte_cryptodev *dev); +void qat_dev_stop(struct rte_cryptodev *dev); +int qat_dev_close(struct rte_cryptodev *dev); +void qat_dev_info_get(struct rte_cryptodev *dev, + struct rte_cryptodev_info *info); + +#endif /* _QAT_DEVICE_H_ */ -- 2.13.6