crypto/qat: add device files
authorFiona Trahe <fiona.trahe@intel.com>
Wed, 13 Jun 2018 12:13:46 +0000 (14:13 +0200)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Wed, 27 Jun 2018 23:25:33 +0000 (01:25 +0200)
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: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
drivers/crypto/qat/Makefile
drivers/crypto/qat/meson.build
drivers/crypto/qat/qat_crypto.c
drivers/crypto/qat/qat_crypto.h
drivers/crypto/qat/qat_device.c [new file with mode: 0644]
drivers/crypto/qat/qat_device.h [new file with mode: 0644]

index 07266a5..6bdd116 100644 (file)
@@ -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
index 006cd65..51630e3 100644 (file)
@@ -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
index d9ce2a1..928a504 100644 (file)
@@ -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)
 {
index 5190d25..46f03cc 100644 (file)
@@ -9,6 +9,7 @@
 #include <rte_memzone.h>
 
 #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 (file)
index 0000000..c2bf9b7
--- /dev/null
@@ -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 (file)
index 0000000..5c48fdb
--- /dev/null
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+#ifndef _QAT_DEVICE_H_
+#define _QAT_DEVICE_H_
+
+#include <rte_cryptodev_pmd.h>
+#include <rte_bus_pci.h>
+#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_ */