3 * Copyright(c) 2015-2017 Intel Corporation. All rights reserved.
4 * Copyright 2014 6WIND S.A.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
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
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.
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.
33 #ifndef _RTE_CRYPTODEV_H_
34 #define _RTE_CRYPTODEV_H_
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.
45 #define rte_crypto_op_ctod_offset(c, t, o) &dummy[0]
47 #define RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER (1ULL << 9)
49 struct rte_cryptodev_info
{
50 const char *driver_name
;
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
;
57 unsigned max_nb_sessions
;
58 unsigned int max_nb_sessions_per_qp
;
62 enum rte_cryptodev_event_type
{
63 RTE_CRYPTODEV_EVENT_UNKNOWN
,
64 RTE_CRYPTODEV_EVENT_ERROR
,
65 RTE_CRYPTODEV_EVENT_MAX
68 struct rte_cryptodev_qp_conf
{
69 uint32_t nb_descriptors
;
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
;
79 #define RTE_CRYPTODEV_NAME_MAX_LEN (64)
82 rte_cryptodev_count(void);
85 rte_cryptodev_device_count_by_driver(uint8_t driver_id
);
88 rte_cryptodev_socket_id(uint8_t dev_id
);
90 struct rte_cryptodev_config
{
92 uint16_t nb_queue_pairs
;
96 rte_cryptodev_configure(uint8_t dev_id
, struct rte_cryptodev_config
*config
);
99 rte_cryptodev_start(uint8_t dev_id
);
102 rte_cryptodev_stop(uint8_t dev_id
);
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
);
110 rte_cryptodev_info_get(uint8_t dev_id
, struct rte_cryptodev_info
*dev_info
);
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
);
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
);
120 struct rte_cryptodev_sym_session
{
121 __extension__
void *sess_private_data
[0];
124 struct rte_cryptodev_asym_session
{
125 __extension__
void *sess_private_data
[0];
128 struct rte_crypto_asym_xform
;
130 struct rte_cryptodev_sym_session
*
131 rte_cryptodev_sym_session_create(struct rte_mempool
*mempool
);
134 rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session
*sess
);
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
);
143 rte_cryptodev_sym_session_clear(uint8_t dev_id
,
144 struct rte_cryptodev_sym_session
*sess
);
147 rte_cryptodev_sym_get_private_session_size(uint8_t dev_id
);