]> git.proxmox.com Git - ceph.git/blob - ceph/src/dpdk/drivers/crypto/qat/qat_crypto.h
bump version to 12.2.12-pve1
[ceph.git] / ceph / src / dpdk / drivers / crypto / qat / qat_crypto.h
1 /*-
2 * BSD LICENSE
3 *
4 * Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef _QAT_CRYPTO_H_
35 #define _QAT_CRYPTO_H_
36
37 #include <rte_cryptodev_pmd.h>
38 #include <rte_memzone.h>
39
40 /*
41 * This macro rounds up a number to a be a multiple of
42 * the alignment when the alignment is a power of 2
43 */
44 #define ALIGN_POW2_ROUNDUP(num, align) \
45 (((num) + (align) - 1) & ~((align) - 1))
46
47 /**
48 * Structure associated with each queue.
49 */
50 struct qat_queue {
51 char memz_name[RTE_MEMZONE_NAMESIZE];
52 void *base_addr; /* Base address */
53 phys_addr_t base_phys_addr; /* Queue physical address */
54 uint32_t head; /* Shadow copy of the head */
55 uint32_t tail; /* Shadow copy of the tail */
56 uint32_t modulo;
57 uint32_t msg_size;
58 uint16_t max_inflights;
59 uint32_t queue_size;
60 uint8_t hw_bundle_number;
61 uint8_t hw_queue_number;
62 /* HW queue aka ring offset on bundle */
63 };
64
65 struct qat_qp {
66 void *mmap_bar_addr;
67 rte_atomic16_t inflights16;
68 struct qat_queue tx_q;
69 struct qat_queue rx_q;
70 struct rte_cryptodev_stats stats;
71 } __rte_cache_aligned;
72
73 /** private data structure for each QAT device */
74 struct qat_pmd_private {
75 char sess_mp_name[RTE_MEMPOOL_NAMESIZE];
76 struct rte_mempool *sess_mp;
77
78 unsigned max_nb_queue_pairs;
79 /**< Max number of queue pairs supported by device */
80 unsigned max_nb_sessions;
81 /**< Max number of sessions supported by device */
82 };
83
84 int qat_dev_config(struct rte_cryptodev *dev);
85 int qat_dev_start(struct rte_cryptodev *dev);
86 void qat_dev_stop(struct rte_cryptodev *dev);
87 int qat_dev_close(struct rte_cryptodev *dev);
88 void qat_dev_info_get(struct rte_cryptodev *dev,
89 struct rte_cryptodev_info *info);
90
91 void qat_crypto_sym_stats_get(struct rte_cryptodev *dev,
92 struct rte_cryptodev_stats *stats);
93 void qat_crypto_sym_stats_reset(struct rte_cryptodev *dev);
94
95 int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
96 const struct rte_cryptodev_qp_conf *rx_conf, int socket_id);
97 int qat_crypto_sym_qp_release(struct rte_cryptodev *dev,
98 uint16_t queue_pair_id);
99
100 int
101 qat_pmd_session_mempool_create(struct rte_cryptodev *dev,
102 unsigned nb_objs, unsigned obj_cache_size, int socket_id);
103
104 extern unsigned
105 qat_crypto_sym_get_session_private_size(struct rte_cryptodev *dev);
106
107 extern void
108 qat_crypto_sym_session_init(struct rte_mempool *mempool, void *priv_sess);
109
110 extern void *
111 qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
112 struct rte_crypto_sym_xform *xform, void *session_private);
113
114 struct qat_session *
115 qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
116 struct rte_crypto_sym_xform *xform,
117 struct qat_session *session_private);
118
119 void *
120 qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
121 struct rte_crypto_sym_xform *xform, void *session_private);
122
123
124 extern void
125 qat_crypto_sym_clear_session(struct rte_cryptodev *dev, void *session);
126
127
128 extern uint16_t
129 qat_pmd_enqueue_op_burst(void *qp, struct rte_crypto_op **ops,
130 uint16_t nb_ops);
131
132 extern uint16_t
133 qat_pmd_dequeue_op_burst(void *qp, struct rte_crypto_op **ops,
134 uint16_t nb_ops);
135
136 #endif /* _QAT_CRYPTO_H_ */