1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2022 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 typedef int (*set_session_t)(void *cryptodev, void *session);
53 struct qat_crypto_gen_dev_ops {
54 get_feature_flags_t get_feature_flags;
55 get_capabilities_info_t get_capabilities;
56 struct rte_cryptodev_ops *cryptodev_ops;
57 set_session_t set_session;
58 #ifdef RTE_LIB_SECURITY
59 create_security_ctx_t create_security_ctx;
63 extern struct qat_crypto_gen_dev_ops qat_sym_gen_dev_ops[];
64 extern struct qat_crypto_gen_dev_ops qat_asym_gen_dev_ops[];
67 qat_cryptodev_config(struct rte_cryptodev *dev,
68 struct rte_cryptodev_config *config);
71 qat_cryptodev_start(struct rte_cryptodev *dev);
74 qat_cryptodev_stop(struct rte_cryptodev *dev);
77 qat_cryptodev_close(struct rte_cryptodev *dev);
80 qat_cryptodev_info_get(struct rte_cryptodev *dev,
81 struct rte_cryptodev_info *info);
84 qat_cryptodev_stats_get(struct rte_cryptodev *dev,
85 struct rte_cryptodev_stats *stats);
88 qat_cryptodev_stats_reset(struct rte_cryptodev *dev);
91 qat_cryptodev_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
92 const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
95 qat_cryptodev_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id);