crypto/qat: unify device private data structure
[dpdk.git] / drivers / crypto / qat / qat_crypto.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2021 Intel Corporation
3  */
4
5  #ifndef _QAT_CRYPTO_H_
6  #define _QAT_CRYPTO_H_
7
8 #include <rte_cryptodev.h>
9 #ifdef RTE_LIB_SECURITY
10 #include <rte_security.h>
11 #endif
12
13 #include "qat_device.h"
14
15 extern uint8_t qat_sym_driver_id;
16 extern uint8_t qat_asym_driver_id;
17
18 /** helper macro to set cryptodev capability range **/
19 #define CAP_RNG(n, l, r, i) .n = {.min = l, .max = r, .increment = i}
20
21 #define CAP_RNG_ZERO(n) .n = {.min = 0, .max = 0, .increment = 0}
22 /** helper macro to set cryptodev capability value **/
23 #define CAP_SET(n, v) .n = v
24
25 /** private data structure for a QAT device.
26  * there can be one of these on each qat_pci_device (VF).
27  */
28 struct qat_cryptodev_private {
29         struct qat_pci_device *qat_dev;
30         /**< The qat pci device hosting the service */
31         uint8_t dev_id;
32         /**< Device instance for this rte_cryptodev */
33         const struct rte_cryptodev_capabilities *qat_dev_capabilities;
34         /* QAT device symmetric crypto capabilities */
35         const struct rte_memzone *capa_mz;
36         /* Shared memzone for storing capabilities */
37         uint16_t min_enq_burst_threshold;
38         uint32_t internal_capabilities; /* see flags QAT_SYM_CAP_xxx */
39         enum qat_service_type service_type;
40 };
41
42 struct qat_capabilities_info {
43         struct rte_cryptodev_capabilities *data;
44         uint64_t size;
45 };
46
47 int
48 qat_cryptodev_config(struct rte_cryptodev *dev,
49                 struct rte_cryptodev_config *config);
50
51 int
52 qat_cryptodev_start(struct rte_cryptodev *dev);
53
54 void
55 qat_cryptodev_stop(struct rte_cryptodev *dev);
56
57 int
58 qat_cryptodev_close(struct rte_cryptodev *dev);
59
60 void
61 qat_cryptodev_info_get(struct rte_cryptodev *dev,
62                 struct rte_cryptodev_info *info);
63
64 void
65 qat_cryptodev_stats_get(struct rte_cryptodev *dev,
66                 struct rte_cryptodev_stats *stats);
67
68 void
69 qat_cryptodev_stats_reset(struct rte_cryptodev *dev);
70
71 int
72 qat_cryptodev_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
73         const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
74
75 int
76 qat_cryptodev_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id);
77
78 #endif