1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2021 Intel Corporation
8 #include <rte_cryptodev.h>
10 #include "qat_device.h"
12 extern uint8_t qat_sym_driver_id;
13 extern uint8_t qat_asym_driver_id;
15 /** helper macro to set cryptodev capability range **/
16 #define CAP_RNG(n, l, r, i) .n = {.min = l, .max = r, .increment = i}
18 #define CAP_RNG_ZERO(n) .n = {.min = 0, .max = 0, .increment = 0}
19 /** helper macro to set cryptodev capability value **/
20 #define CAP_SET(n, v) .n = v
22 /** private data structure for a QAT device.
23 * there can be one of these on each qat_pci_device (VF).
25 struct qat_cryptodev_private {
26 struct qat_pci_device *qat_dev;
27 /**< The qat pci device hosting the service */
29 /**< Device instance for this rte_cryptodev */
30 const struct rte_cryptodev_capabilities *qat_dev_capabilities;
31 /* QAT device symmetric crypto capabilities */
32 const struct rte_memzone *capa_mz;
33 /* Shared memzone for storing capabilities */
34 uint16_t min_enq_burst_threshold;
35 uint32_t internal_capabilities; /* see flags QAT_SYM_CAP_xxx */
36 enum qat_service_type service_type;
39 struct qat_capabilities_info {
40 struct rte_cryptodev_capabilities *data;
44 typedef struct qat_capabilities_info (*get_capabilities_info_t)
45 (struct qat_pci_device *qat_dev);
47 typedef uint64_t (*get_feature_flags_t)(struct qat_pci_device *qat_dev);
49 typedef void * (*create_security_ctx_t)(void *cryptodev);
51 struct qat_crypto_gen_dev_ops {
52 get_feature_flags_t get_feature_flags;
53 get_capabilities_info_t get_capabilities;
54 struct rte_cryptodev_ops *cryptodev_ops;
55 #ifdef RTE_LIB_SECURITY
56 create_security_ctx_t create_security_ctx;
61 qat_cryptodev_config(struct rte_cryptodev *dev,
62 struct rte_cryptodev_config *config);
65 qat_cryptodev_start(struct rte_cryptodev *dev);
68 qat_cryptodev_stop(struct rte_cryptodev *dev);
71 qat_cryptodev_close(struct rte_cryptodev *dev);
74 qat_cryptodev_info_get(struct rte_cryptodev *dev,
75 struct rte_cryptodev_info *info);
78 qat_cryptodev_stats_get(struct rte_cryptodev *dev,
79 struct rte_cryptodev_stats *stats);
82 qat_cryptodev_stats_reset(struct rte_cryptodev *dev);
85 qat_cryptodev_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
86 const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
89 qat_cryptodev_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id);