xref: /dpdk/lib/cryptodev/rte_cryptodev_core.h (revision 23d6f76d31474eeaafed752e377c109f803c287b)
1691e1f4dSAkhil Goyal /* SPDX-License-Identifier: BSD-3-Clause
2691e1f4dSAkhil Goyal  * Copyright(C) 2021 Marvell.
3691e1f4dSAkhil Goyal  */
4691e1f4dSAkhil Goyal 
5691e1f4dSAkhil Goyal #ifndef _RTE_CRYPTODEV_CORE_H_
6691e1f4dSAkhil Goyal #define _RTE_CRYPTODEV_CORE_H_
7691e1f4dSAkhil Goyal 
8691e1f4dSAkhil Goyal /**
9691e1f4dSAkhil Goyal  * @file
10691e1f4dSAkhil Goyal  *
11691e1f4dSAkhil Goyal  * RTE Crypto Device internal header.
12691e1f4dSAkhil Goyal  *
13691e1f4dSAkhil Goyal  * This header contains internal data types. But they are still part of the
14691e1f4dSAkhil Goyal  * public API because they are used by inline functions in the published API.
15691e1f4dSAkhil Goyal  *
16691e1f4dSAkhil Goyal  * Applications should not use these directly.
17691e1f4dSAkhil Goyal  */
18691e1f4dSAkhil Goyal 
19691e1f4dSAkhil Goyal typedef uint16_t (*dequeue_pkt_burst_t)(void *qp,
20691e1f4dSAkhil Goyal 		struct rte_crypto_op **ops,	uint16_t nb_ops);
21691e1f4dSAkhil Goyal /**< Dequeue processed packets from queue pair of a device. */
22691e1f4dSAkhil Goyal 
23691e1f4dSAkhil Goyal typedef uint16_t (*enqueue_pkt_burst_t)(void *qp,
24691e1f4dSAkhil Goyal 		struct rte_crypto_op **ops,	uint16_t nb_ops);
25691e1f4dSAkhil Goyal /**< Enqueue packets for processing on queue pair of a device. */
26691e1f4dSAkhil Goyal 
27*23d6f76dSAkhil Goyal typedef uint32_t (*crypto_qp_depth_used_t)(void *qp);
28*23d6f76dSAkhil Goyal /**< Get used descriptor depth in a queue pair of a device. */
29*23d6f76dSAkhil Goyal 
30691e1f4dSAkhil Goyal /**
31691e1f4dSAkhil Goyal  * @internal
322fd66f75SAkhil Goyal  * Structure used to hold opaque pointers to internal ethdev Rx/Tx
332fd66f75SAkhil Goyal  * queues data.
342fd66f75SAkhil Goyal  * The main purpose to expose these pointers at all - allow compiler
352fd66f75SAkhil Goyal  * to fetch this data for fast-path cryptodev inline functions in advance.
362fd66f75SAkhil Goyal  */
372fd66f75SAkhil Goyal struct rte_cryptodev_qpdata {
382fd66f75SAkhil Goyal 	/** points to array of internal queue pair data pointers. */
392fd66f75SAkhil Goyal 	void **data;
402fd66f75SAkhil Goyal 	/** points to array of enqueue callback data pointers */
412fd66f75SAkhil Goyal 	struct rte_cryptodev_cb_rcu *enq_cb;
422fd66f75SAkhil Goyal 	/** points to array of dequeue callback data pointers */
432fd66f75SAkhil Goyal 	struct rte_cryptodev_cb_rcu *deq_cb;
442fd66f75SAkhil Goyal };
452fd66f75SAkhil Goyal 
46c6552d9aSTyler Retzlaff struct __rte_cache_aligned rte_crypto_fp_ops {
472fd66f75SAkhil Goyal 	/** PMD enqueue burst function. */
482fd66f75SAkhil Goyal 	enqueue_pkt_burst_t enqueue_burst;
492fd66f75SAkhil Goyal 	/** PMD dequeue burst function. */
502fd66f75SAkhil Goyal 	dequeue_pkt_burst_t dequeue_burst;
512fd66f75SAkhil Goyal 	/** Internal queue pair data pointers. */
522fd66f75SAkhil Goyal 	struct rte_cryptodev_qpdata qp;
53*23d6f76dSAkhil Goyal 	/** Get the number of used queue pair descriptors. */
54*23d6f76dSAkhil Goyal 	crypto_qp_depth_used_t qp_depth_used;
552fd66f75SAkhil Goyal 	/** Reserved for future ops. */
56*23d6f76dSAkhil Goyal 	uintptr_t reserved[2];
57c6552d9aSTyler Retzlaff };
582fd66f75SAkhil Goyal 
592fd66f75SAkhil Goyal extern struct rte_crypto_fp_ops rte_crypto_fp_ops[RTE_CRYPTO_MAX_DEVS];
602fd66f75SAkhil Goyal 
612fd66f75SAkhil Goyal /**
62691e1f4dSAkhil Goyal  * The pool of rte_cryptodev structures.
63691e1f4dSAkhil Goyal  */
64691e1f4dSAkhil Goyal extern struct rte_cryptodev *rte_cryptodevs;
65691e1f4dSAkhil Goyal 
66691e1f4dSAkhil Goyal #endif /* _RTE_CRYPTODEV_CORE_H_ */
67