1633e55889f1984f854e609d8075c0fa63890e65
[dpdk.git] / lib / cryptodev / rte_cryptodev_core.h
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
20 typedef uint16_t (*dequeue_pkt_burst_t)(void *qp,
21                 struct rte_crypto_op **ops,     uint16_t nb_ops);
22 /**< Dequeue processed packets from queue pair of a device. */
23
24 typedef uint16_t (*enqueue_pkt_burst_t)(void *qp,
25                 struct rte_crypto_op **ops,     uint16_t nb_ops);
26 /**< Enqueue packets for processing on queue pair of a device. */
27
28 /**
29  * @internal
30  * The data part, with no function pointers, associated with each device.
31  *
32  * This structure is safe to place in shared memory to be common among
33  * different processes in a multi-process configuration.
34  */
35 struct rte_cryptodev_data {
36         uint8_t dev_id;
37         /**< Device ID for this instance */
38         uint8_t socket_id;
39         /**< Socket ID where memory is allocated */
40         char name[RTE_CRYPTODEV_NAME_MAX_LEN];
41         /**< Unique identifier name */
42
43         __extension__
44         uint8_t dev_started : 1;
45         /**< Device state: STARTED(1)/STOPPED(0) */
46
47         struct rte_mempool *session_pool;
48         /**< Session memory pool */
49         void **queue_pairs;
50         /**< Array of pointers to queue pairs. */
51         uint16_t nb_queue_pairs;
52         /**< Number of device queue pairs. */
53
54         void *dev_private;
55         /**< PMD-specific private data */
56 } __rte_cache_aligned;
57
58
59 /** @internal The data structure associated with each crypto device. */
60 struct rte_cryptodev {
61         dequeue_pkt_burst_t dequeue_burst;
62         /**< Pointer to PMD receive function. */
63         enqueue_pkt_burst_t enqueue_burst;
64         /**< Pointer to PMD transmit function. */
65
66         struct rte_cryptodev_data *data;
67         /**< Pointer to device data */
68         struct rte_cryptodev_ops *dev_ops;
69         /**< Functions exported by PMD */
70         uint64_t feature_flags;
71         /**< Feature flags exposes HW/SW features for the given device */
72         struct rte_device *device;
73         /**< Backing device */
74
75         uint8_t driver_id;
76         /**< Crypto driver identifier*/
77
78         struct rte_cryptodev_cb_list link_intr_cbs;
79         /**< User application callback for interrupts if present */
80
81         void *security_ctx;
82         /**< Context for security ops */
83
84         __extension__
85         uint8_t attached : 1;
86         /**< Flag indicating the device is attached */
87
88         struct rte_cryptodev_cb_rcu *enq_cbs;
89         /**< User application callback for pre enqueue processing */
90
91         struct rte_cryptodev_cb_rcu *deq_cbs;
92         /**< User application callback for post dequeue processing */
93 } __rte_cache_aligned;
94
95 /**
96  * The pool of rte_cryptodev structures.
97  */
98 extern struct rte_cryptodev *rte_cryptodevs;
99
100 #endif /* _RTE_CRYPTODEV_CORE_H_ */