]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/test/unit/lib/bdev/crypto.c/rte_cryptodev.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / spdk / test / unit / lib / bdev / crypto.c / rte_cryptodev.h
1 /*-
2 *
3 * Copyright(c) 2015-2017 Intel Corporation. All rights reserved.
4 * Copyright 2014 6WIND S.A.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Intel Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #ifndef _RTE_CRYPTODEV_H_
34 #define _RTE_CRYPTODEV_H_
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 /* In order to mock some DPDK functions, we place headers here with the name name as the DPDK headers
41 * so these definitions wil be picked up. Only what's mocked is included.
42 */
43
44 uint8_t dummy[16];
45 #define rte_crypto_op_ctod_offset(c, t, o) &dummy[0]
46
47 #define RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER (1ULL << 9)
48
49 struct rte_cryptodev_info {
50 const char *driver_name;
51 uint8_t driver_id;
52 struct rte_pci_device *pci_dev;
53 uint64_t feature_flags;
54 const struct rte_cryptodev_capabilities *capabilities;
55 unsigned max_nb_queue_pairs;
56 struct {
57 unsigned max_nb_sessions;
58 unsigned int max_nb_sessions_per_qp;
59 } sym;
60 };
61
62 enum rte_cryptodev_event_type {
63 RTE_CRYPTODEV_EVENT_UNKNOWN,
64 RTE_CRYPTODEV_EVENT_ERROR,
65 RTE_CRYPTODEV_EVENT_MAX
66 };
67
68 struct rte_cryptodev_qp_conf {
69 uint32_t nb_descriptors;
70 };
71
72 struct rte_cryptodev_stats {
73 uint64_t enqueued_count;
74 uint64_t dequeued_count;
75 uint64_t enqueue_err_count;
76 uint64_t dequeue_err_count;
77 };
78
79 #define RTE_CRYPTODEV_NAME_MAX_LEN (64)
80
81 extern uint8_t
82 rte_cryptodev_count(void);
83
84 extern uint8_t
85 rte_cryptodev_device_count_by_driver(uint8_t driver_id);
86
87 extern int
88 rte_cryptodev_socket_id(uint8_t dev_id);
89
90 struct rte_cryptodev_config {
91 int socket_id;
92 uint16_t nb_queue_pairs;
93 };
94
95 extern int
96 rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config);
97
98 extern int
99 rte_cryptodev_start(uint8_t dev_id);
100
101 extern void
102 rte_cryptodev_stop(uint8_t dev_id);
103
104 extern int
105 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
106 const struct rte_cryptodev_qp_conf *qp_conf, int socket_id,
107 struct rte_mempool *session_pool);
108
109 extern void
110 rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info);
111
112 static inline uint16_t
113 rte_cryptodev_dequeue_burst(uint8_t dev_id, uint16_t qp_id,
114 struct rte_crypto_op **ops, uint16_t nb_ops);
115
116 static inline uint16_t
117 rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
118 struct rte_crypto_op **ops, uint16_t nb_ops);
119
120 struct rte_cryptodev_sym_session {
121 __extension__ void *sess_private_data[0];
122 };
123
124 struct rte_cryptodev_asym_session {
125 __extension__ void *sess_private_data[0];
126 };
127
128 struct rte_crypto_asym_xform;
129
130 struct rte_cryptodev_sym_session *
131 rte_cryptodev_sym_session_create(struct rte_mempool *mempool);
132
133 int
134 rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess);
135
136 int
137 rte_cryptodev_sym_session_init(uint8_t dev_id,
138 struct rte_cryptodev_sym_session *sess,
139 struct rte_crypto_sym_xform *xforms,
140 struct rte_mempool *mempool);
141
142 int
143 rte_cryptodev_sym_session_clear(uint8_t dev_id,
144 struct rte_cryptodev_sym_session *sess);
145
146 unsigned int
147 rte_cryptodev_sym_get_private_session_size(uint8_t dev_id);
148
149 #ifdef __cplusplus
150 }
151 #endif
152
153 #endif