]> git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/dpdk/lib/librte_security/rte_security_driver.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / seastar / dpdk / lib / librte_security / rte_security_driver.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2017 NXP.
3 * Copyright(c) 2017 Intel Corporation.
4 */
5
6 #ifndef _RTE_SECURITY_DRIVER_H_
7 #define _RTE_SECURITY_DRIVER_H_
8
9 /**
10 * @file rte_security_driver.h
11 *
12 * RTE Security Common Definitions
13 *
14 */
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 #include "rte_security.h"
21
22 /**
23 * Configure a security session on a device.
24 *
25 * @param device Crypto/eth device pointer
26 * @param conf Security session configuration
27 * @param sess Pointer to Security private session structure
28 * @param mp Mempool where the private session is allocated
29 *
30 * @return
31 * - Returns 0 if private session structure have been created successfully.
32 * - Returns -EINVAL if input parameters are invalid.
33 * - Returns -ENOTSUP if crypto device does not support the crypto transform.
34 * - Returns -ENOMEM if the private session could not be allocated.
35 */
36 typedef int (*security_session_create_t)(void *device,
37 struct rte_security_session_conf *conf,
38 struct rte_security_session *sess,
39 struct rte_mempool *mp);
40
41 /**
42 * Free driver private session data.
43 *
44 * @param dev Crypto/eth device pointer
45 * @param sess Security session structure
46 */
47 typedef int (*security_session_destroy_t)(void *device,
48 struct rte_security_session *sess);
49
50 /**
51 * Update driver private session data.
52 *
53 * @param device Crypto/eth device pointer
54 * @param sess Pointer to Security private session structure
55 * @param conf Security session configuration
56 *
57 * @return
58 * - Returns 0 if private session structure have been updated successfully.
59 * - Returns -EINVAL if input parameters are invalid.
60 * - Returns -ENOTSUP if crypto device does not support the crypto transform.
61 */
62 typedef int (*security_session_update_t)(void *device,
63 struct rte_security_session *sess,
64 struct rte_security_session_conf *conf);
65
66 /**
67 * Get the size of a security session
68 *
69 * @param device Crypto/eth device pointer
70 *
71 * @return
72 * - On success returns the size of the session structure for device
73 * - On failure returns 0
74 */
75 typedef unsigned int (*security_session_get_size)(void *device);
76
77 /**
78 * Get stats from the PMD.
79 *
80 * @param device Crypto/eth device pointer
81 * @param sess Pointer to Security private session structure
82 * @param stats Security stats of the driver
83 *
84 * @return
85 * - Returns 0 if private session structure have been updated successfully.
86 * - Returns -EINVAL if session parameters are invalid.
87 */
88 typedef int (*security_session_stats_get_t)(void *device,
89 struct rte_security_session *sess,
90 struct rte_security_stats *stats);
91
92 /**
93 * Update the mbuf with provided metadata.
94 *
95 * @param sess Security session structure
96 * @param mb Packet buffer
97 * @param mt Metadata
98 *
99 * @return
100 * - Returns 0 if metadata updated successfully.
101 * - Returns -ve value for errors.
102 */
103 typedef int (*security_set_pkt_metadata_t)(void *device,
104 struct rte_security_session *sess, struct rte_mbuf *m,
105 void *params);
106
107 /**
108 * Get application specific userdata associated with the security session.
109 * Device specific metadata provided would be used to uniquely identify
110 * the security session being referred to.
111 *
112 * @param device Crypto/eth device pointer
113 * @param md Metadata
114 * @param userdata Pointer to receive userdata
115 *
116 * @return
117 * - Returns 0 if userdata is retrieved successfully.
118 * - Returns -ve value for errors.
119 */
120 typedef int (*security_get_userdata_t)(void *device,
121 uint64_t md, void **userdata);
122
123 /**
124 * Get security capabilities of the device.
125 *
126 * @param device crypto/eth device pointer
127 *
128 * @return
129 * - Returns rte_security_capability pointer on success.
130 * - Returns NULL on error.
131 */
132 typedef const struct rte_security_capability *(*security_capabilities_get_t)(
133 void *device);
134
135 /** Security operations function pointer table */
136 struct rte_security_ops {
137 security_session_create_t session_create;
138 /**< Configure a security session. */
139 security_session_update_t session_update;
140 /**< Update a security session. */
141 security_session_get_size session_get_size;
142 /**< Return size of security session. */
143 security_session_stats_get_t session_stats_get;
144 /**< Get security session statistics. */
145 security_session_destroy_t session_destroy;
146 /**< Clear a security sessions private data. */
147 security_set_pkt_metadata_t set_pkt_metadata;
148 /**< Update mbuf metadata. */
149 security_get_userdata_t get_userdata;
150 /**< Get userdata associated with session which processed the packet. */
151 security_capabilities_get_t capabilities_get;
152 /**< Get security capabilities. */
153 };
154
155 #ifdef __cplusplus
156 }
157 #endif
158
159 #endif /* _RTE_SECURITY_DRIVER_H_ */