crypto/qat: add device files

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>
This commit is contained in:
Fiona Trahe 2018-06-13 14:13:46 +02:00 committed by Pablo de Lara
parent 2d09292e46
commit 0a01574db4
6 changed files with 97 additions and 73 deletions

View 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

View 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

View 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)
{

View 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);

View File

@ -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);
}
}

View File

@ -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_ */