xref: /dpdk/lib/cryptodev/rte_cryptodev_core.h (revision 23d6f76d31474eeaafed752e377c109f803c287b)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4 
5 #ifndef _RTE_CRYPTODEV_CORE_H_
6 #define _RTE_CRYPTODEV_CORE_H_
7 
8 /**
9  * @file
10  *
11  * RTE Crypto Device internal header.
12  *
13  * This header contains internal data types. But they are still part of the
14  * public API because they are used by inline functions in the published API.
15  *
16  * Applications should not use these directly.
17  */
18 
19 typedef uint16_t (*dequeue_pkt_burst_t)(void *qp,
20 		struct rte_crypto_op **ops,	uint16_t nb_ops);
21 /**< Dequeue processed packets from queue pair of a device. */
22 
23 typedef uint16_t (*enqueue_pkt_burst_t)(void *qp,
24 		struct rte_crypto_op **ops,	uint16_t nb_ops);
25 /**< Enqueue packets for processing on queue pair of a device. */
26 
27 typedef uint32_t (*crypto_qp_depth_used_t)(void *qp);
28 /**< Get used descriptor depth in a queue pair of a device. */
29 
30 /**
31  * @internal
32  * Structure used to hold opaque pointers to internal ethdev Rx/Tx
33  * queues data.
34  * The main purpose to expose these pointers at all - allow compiler
35  * to fetch this data for fast-path cryptodev inline functions in advance.
36  */
37 struct rte_cryptodev_qpdata {
38 	/** points to array of internal queue pair data pointers. */
39 	void **data;
40 	/** points to array of enqueue callback data pointers */
41 	struct rte_cryptodev_cb_rcu *enq_cb;
42 	/** points to array of dequeue callback data pointers */
43 	struct rte_cryptodev_cb_rcu *deq_cb;
44 };
45 
46 struct __rte_cache_aligned rte_crypto_fp_ops {
47 	/** PMD enqueue burst function. */
48 	enqueue_pkt_burst_t enqueue_burst;
49 	/** PMD dequeue burst function. */
50 	dequeue_pkt_burst_t dequeue_burst;
51 	/** Internal queue pair data pointers. */
52 	struct rte_cryptodev_qpdata qp;
53 	/** Get the number of used queue pair descriptors. */
54 	crypto_qp_depth_used_t qp_depth_used;
55 	/** Reserved for future ops. */
56 	uintptr_t reserved[2];
57 };
58 
59 extern struct rte_crypto_fp_ops rte_crypto_fp_ops[RTE_CRYPTO_MAX_DEVS];
60 
61 /**
62  * The pool of rte_cryptodev structures.
63  */
64 extern struct rte_cryptodev *rte_cryptodevs;
65 
66 #endif /* _RTE_CRYPTODEV_CORE_H_ */
67