xref: /dpdk/lib/cryptodev/cryptodev_pmd.h (revision 0a054e8dd5b0960eec4226821137aceb77a2bf22)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2015-2020 Intel Corporation.
3  */
4 
5 #ifndef _CRYPTODEV_PMD_H_
6 #define _CRYPTODEV_PMD_H_
7 
8 /** @file
9  * RTE Crypto PMD APIs
10  *
11  * @note
12  * These API are from crypto PMD only and user applications should not call
13  * them directly.
14  */
15 
16 #include <string.h>
17 
18 #include <dev_driver.h>
19 #include <rte_compat.h>
20 #include <rte_malloc.h>
21 #include <rte_log.h>
22 #include <rte_common.h>
23 
24 #include "rte_crypto.h"
25 #include "rte_cryptodev.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 
32 #define RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS	8
33 
34 #define RTE_CRYPTODEV_PMD_NAME_ARG			("name")
35 #define RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG			("max_nb_queue_pairs")
36 #define RTE_CRYPTODEV_PMD_SOCKET_ID_ARG			("socket_id")
37 
38 
39 static const char * const cryptodev_pmd_valid_params[] = {
40 	RTE_CRYPTODEV_PMD_NAME_ARG,
41 	RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG,
42 	RTE_CRYPTODEV_PMD_SOCKET_ID_ARG,
43 	NULL
44 };
45 
46 /**
47  * @internal
48  * Initialisation parameters for crypto devices
49  */
50 struct rte_cryptodev_pmd_init_params {
51 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
52 	size_t private_data_size;
53 	int socket_id;
54 	unsigned int max_nb_queue_pairs;
55 };
56 
57 /**
58  * @internal
59  * The data part, with no function pointers, associated with each device.
60  *
61  * This structure is safe to place in shared memory to be common among
62  * different processes in a multi-process configuration.
63  */
64 struct __rte_cache_aligned rte_cryptodev_data {
65 	/** Device ID for this instance */
66 	uint8_t dev_id;
67 	/** Socket ID where memory is allocated */
68 	int socket_id;
69 	/** Unique identifier name */
70 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
71 
72 	__extension__
73 	/** Device state: STARTED(1)/STOPPED(0) */
74 	uint8_t dev_started : 1;
75 
76 	/** Session memory pool */
77 	struct rte_mempool *session_pool;
78 	/** Array of pointers to queue pairs. */
79 	void **queue_pairs;
80 	/** Number of device queue pairs. */
81 	uint16_t nb_queue_pairs;
82 
83 	/** PMD-specific private data */
84 	void *dev_private;
85 };
86 
87 /** @internal The data structure associated with each crypto device. */
88 struct __rte_cache_aligned rte_cryptodev {
89 	/** Pointer to PMD dequeue function. */
90 	dequeue_pkt_burst_t dequeue_burst;
91 	/** Pointer to PMD enqueue function. */
92 	enqueue_pkt_burst_t enqueue_burst;
93 
94 	/** Pointer to device data */
95 	struct rte_cryptodev_data *data;
96 	/** Functions exported by PMD */
97 	struct rte_cryptodev_ops *dev_ops;
98 	/** Feature flags exposes HW/SW features for the given device */
99 	uint64_t feature_flags;
100 	/** Backing device */
101 	struct rte_device *device;
102 
103 	/** Crypto driver identifier*/
104 	uint8_t driver_id;
105 
106 	/** User application callback for interrupts if present */
107 	struct rte_cryptodev_cb_list link_intr_cbs;
108 
109 	/** Context for security ops */
110 	void *security_ctx;
111 
112 	__extension__
113 	/** Flag indicating the device is attached */
114 	uint8_t attached : 1;
115 
116 	/** User application callback for pre enqueue processing */
117 	struct rte_cryptodev_cb_rcu *enq_cbs;
118 	/** User application callback for post dequeue processing */
119 	struct rte_cryptodev_cb_rcu *deq_cbs;
120 	/** Pointer to PMD function to get used queue pair depth */
121 	crypto_qp_depth_used_t qp_depth_used;
122 };
123 
124 /** Global structure used for maintaining state of allocated crypto devices */
125 struct rte_cryptodev_global {
126 	struct rte_cryptodev *devs;	/**< Device information array */
127 	struct rte_cryptodev_data *data[RTE_CRYPTO_MAX_DEVS];
128 	/**< Device private data */
129 	uint8_t nb_devs;		/**< Number of devices found */
130 };
131 
132 /* Cryptodev driver, containing the driver ID */
133 struct cryptodev_driver {
134 	RTE_TAILQ_ENTRY(cryptodev_driver) next; /**< Next in list. */
135 	const struct rte_driver *driver;
136 	uint8_t id;
137 };
138 
139 /** Cryptodev symmetric crypto session
140  * Each session is derived from a fixed xform chain. Therefore each session
141  * has a fixed algo, key, op-type, digest_len etc.
142  */
143 struct rte_cryptodev_sym_session {
144 	uint64_t opaque_data;
145 	/**< Can be used for external metadata */
146 	uint32_t sess_data_sz;
147 	/**< Pointer to the user data stored after sess data */
148 	uint16_t user_data_sz;
149 	/**< Session user data will be placed after sess data */
150 	uint8_t driver_id;
151 	/**< Driver id to get the session priv */
152 	rte_iova_t driver_priv_data_iova;
153 	/**< Session driver data IOVA address */
154 
155 	alignas(RTE_CACHE_LINE_MIN_SIZE)
156 	/**< Second cache line - start of the driver session data */
157 	uint8_t driver_priv_data[];
158 	/**< Driver specific session data, variable size */
159 };
160 
161 /**
162  * Helper macro to get driver private data
163  */
164 #define CRYPTODEV_GET_SYM_SESS_PRIV(s) \
165 	((void *)(((struct rte_cryptodev_sym_session *)s)->driver_priv_data))
166 #define CRYPTODEV_GET_SYM_SESS_PRIV_IOVA(s) \
167 	(((struct rte_cryptodev_sym_session *)s)->driver_priv_data_iova)
168 
169 
170 /**
171  * Get the rte_cryptodev structure device pointer for the device. Assumes a
172  * valid device index.
173  *
174  * @param	dev_id	Device ID value to select the device structure.
175  *
176  * @return
177  *   - The rte_cryptodev structure pointer for the given device ID.
178  */
179 __rte_internal
180 struct rte_cryptodev *
181 rte_cryptodev_pmd_get_dev(uint8_t dev_id);
182 
183 /**
184  * Get the rte_cryptodev structure device pointer for the named device.
185  *
186  * @param	name	device name to select the device structure.
187  *
188  * @return
189  *   - The rte_cryptodev structure pointer for the given device ID.
190  */
191 __rte_internal
192 struct rte_cryptodev *
193 rte_cryptodev_pmd_get_named_dev(const char *name);
194 
195 /**
196  * Definitions of all functions exported by a driver through the
197  * generic structure of type *crypto_dev_ops* supplied in the
198  * *rte_cryptodev* structure associated with a device.
199  */
200 
201 /**
202  *	Function used to configure device.
203  *
204  * @param	dev	Crypto device pointer
205  * @param	config	Crypto device configurations
206  *
207  * @return	Returns 0 on success
208  */
209 typedef int (*cryptodev_configure_t)(struct rte_cryptodev *dev,
210 		struct rte_cryptodev_config *config);
211 
212 /**
213  * Function used to start a configured device.
214  *
215  * @param	dev	Crypto device pointer
216  *
217  * @return	Returns 0 on success
218  */
219 typedef int (*cryptodev_start_t)(struct rte_cryptodev *dev);
220 
221 /**
222  * Function used to stop a configured device.
223  *
224  * @param	dev	Crypto device pointer
225  */
226 typedef void (*cryptodev_stop_t)(struct rte_cryptodev *dev);
227 
228 /**
229  * Function used to close a configured device.
230  *
231  * @param	dev	Crypto device pointer
232  * @return
233  * - 0 on success.
234  * - EAGAIN if can't close as device is busy
235  */
236 typedef int (*cryptodev_close_t)(struct rte_cryptodev *dev);
237 
238 
239 /**
240  * Function used to get statistics of a device.
241  *
242  * @param	dev	Crypto device pointer
243  * @param	stats	Pointer to crypto device stats structure to populate
244  */
245 typedef void (*cryptodev_stats_get_t)(struct rte_cryptodev *dev,
246 				struct rte_cryptodev_stats *stats);
247 
248 
249 /**
250  * Function used to reset statistics of a device.
251  *
252  * @param	dev	Crypto device pointer
253  */
254 typedef void (*cryptodev_stats_reset_t)(struct rte_cryptodev *dev);
255 
256 
257 /**
258  * Function used to get specific information of a device.
259  *
260  * @param	dev		Crypto device pointer
261  * @param	dev_info	Pointer to infos structure to populate
262  */
263 typedef void (*cryptodev_info_get_t)(struct rte_cryptodev *dev,
264 				struct rte_cryptodev_info *dev_info);
265 
266 /**
267  * Setup a queue pair for a device.
268  *
269  * @param	dev		Crypto device pointer
270  * @param	qp_id		Queue Pair Index
271  * @param	qp_conf		Queue configuration structure
272  * @param	socket_id	Socket Index
273  *
274  * @return	Returns 0 on success.
275  */
276 typedef int (*cryptodev_queue_pair_setup_t)(struct rte_cryptodev *dev,
277 		uint16_t qp_id,	const struct rte_cryptodev_qp_conf *qp_conf,
278 		int socket_id);
279 
280 /**
281  * Release memory resources allocated by given queue pair.
282  *
283  * @param	dev	Crypto device pointer
284  * @param	qp_id	Queue Pair Index
285  *
286  * @return
287  * - 0 on success.
288  * - EAGAIN if can't close as device is busy
289  */
290 typedef int (*cryptodev_queue_pair_release_t)(struct rte_cryptodev *dev,
291 		uint16_t qp_id);
292 
293 /**
294  * Reset or reconfigure a queue pair for a device.
295  *
296  * @param	dev		Crypto device pointer
297  * @param	qp_id		Queue pair index
298  * @param	qp_conf		Queue configuration structure
299  * @param	socket_id	Socket index
300  *
301  * @return
302  *  - 0: on success.
303  *  - ENOTSUP: if crypto device does not support the operation.
304  */
305 typedef int (*cryptodev_queue_pair_reset_t)(struct rte_cryptodev *dev,
306 		uint16_t qp_id,	const struct rte_cryptodev_qp_conf *qp_conf,
307 		int socket_id);
308 
309 /**
310  * Create a session mempool to allocate sessions from
311  *
312  * @param	dev		Crypto device pointer
313  * @param	nb_objs		number of sessions objects in mempool
314  * @param	obj_cache_size	l-core object cache size, see *rte_ring_create*
315  * @param	socket_id	Socket Id to allocate  mempool on.
316  *
317  * @return
318  * - On success returns a pointer to a rte_mempool
319  * - On failure returns a NULL pointer
320  */
321 typedef int (*cryptodev_sym_create_session_pool_t)(
322 		struct rte_cryptodev *dev, unsigned nb_objs,
323 		unsigned obj_cache_size, int socket_id);
324 
325 
326 /**
327  * Get the size of a cryptodev session
328  *
329  * @param	dev		Crypto device pointer
330  *
331  * @return
332  *  - On success returns the size of the session structure for device
333  *  - On failure returns 0
334  */
335 typedef unsigned (*cryptodev_sym_get_session_private_size_t)(
336 		struct rte_cryptodev *dev);
337 /**
338  * Get the size of a asymmetric cryptodev session
339  *
340  * @param	dev		Crypto device pointer
341  *
342  * @return
343  *  - On success returns the size of the session structure for device
344  *  - On failure returns 0
345  */
346 typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
347 		struct rte_cryptodev *dev);
348 
349 /**
350  * Configure a Crypto session on a device.
351  *
352  * @param	dev		Crypto device pointer
353  * @param	xform		Single or chain of crypto xforms
354  * @param	session		Pointer to cryptodev's private session structure
355  *
356  * @return
357  *  - Returns 0 if private session structure have been created successfully.
358  *  - Returns -EINVAL if input parameters are invalid.
359  *  - Returns -ENOTSUP if crypto device does not support the crypto transform.
360  *  - Returns -ENOMEM if the private session could not be allocated.
361  */
362 typedef int (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev,
363 		struct rte_crypto_sym_xform *xform,
364 		struct rte_cryptodev_sym_session *session);
365 
366 /**
367  * Configure a Crypto asymmetric session on a device.
368  *
369  * @param	dev		Crypto device pointer
370  * @param	xform		Single or chain of crypto xforms
371  * @param	session		Pointer to cryptodev's private session structure
372  *
373  * @return
374  *  - Returns 0 if private session structure have been created successfully.
375  *  - Returns -EINVAL if input parameters are invalid.
376  *  - Returns -ENOTSUP if crypto device does not support the crypto transform.
377  *  - Returns -ENOMEM if the private session could not be allocated.
378  */
379 typedef int (*cryptodev_asym_configure_session_t)(struct rte_cryptodev *dev,
380 		struct rte_crypto_asym_xform *xform,
381 		struct rte_cryptodev_asym_session *session);
382 /**
383  * Free driver private session data.
384  *
385  * @param	dev		Crypto device pointer
386  * @param	sess		Cryptodev session structure
387  */
388 typedef void (*cryptodev_sym_free_session_t)(struct rte_cryptodev *dev,
389 		struct rte_cryptodev_sym_session *sess);
390 
391 /**
392  * Clear asymmetric session private data.
393  *
394  * @param	dev		Crypto device pointer
395  * @param	sess		Cryptodev session structure
396  */
397 typedef void (*cryptodev_asym_clear_session_t)(struct rte_cryptodev *dev,
398 		struct rte_cryptodev_asym_session *sess);
399 /**
400  * Perform actual crypto processing (encrypt/digest or auth/decrypt)
401  * on user provided data.
402  *
403  * @param	dev	Crypto device pointer
404  * @param	sess	Cryptodev session structure
405  * @param	ofs	Start and stop offsets for auth and cipher operations
406  * @param	vec	Vectorized operation descriptor
407  *
408  * @return
409  *  - Returns number of successfully processed packets.
410  */
411 typedef uint32_t (*cryptodev_sym_cpu_crypto_process_t)
412 	(struct rte_cryptodev *dev, struct rte_cryptodev_sym_session *sess,
413 	union rte_crypto_sym_ofs ofs, struct rte_crypto_sym_vec *vec);
414 
415 /**
416  * Typedef that the driver provided to get service context private date size.
417  *
418  * @param	dev	Crypto device pointer.
419  *
420  * @return
421  *   - On success return the size of the device's service context private data.
422  *   - On failure return negative integer.
423  */
424 typedef int (*cryptodev_sym_get_raw_dp_ctx_size_t)(struct rte_cryptodev *dev);
425 
426 /**
427  * Typedef that the driver provided to configure raw data-path context.
428  *
429  * @param	dev		Crypto device pointer.
430  * @param	qp_id		Crypto device queue pair index.
431  * @param	ctx		The raw data-path context data.
432  * @param	sess_type	session type.
433  * @param	session_ctx	Session context data. If NULL the driver
434  *				shall only configure the drv_ctx_data in
435  *				ctx buffer. Otherwise the driver shall only
436  *				parse the session_ctx to set appropriate
437  *				function pointers in ctx.
438  * @param	is_update	Set 0 if it is to initialize the ctx.
439  *				Set 1 if ctx is initialized and only to update
440  *				session context data.
441  * @return
442  *   - On success return 0.
443  *   - On failure return negative integer.
444  */
445 typedef int (*cryptodev_sym_configure_raw_dp_ctx_t)(
446 	struct rte_cryptodev *dev, uint16_t qp_id,
447 	struct rte_crypto_raw_dp_ctx *ctx,
448 	enum rte_crypto_op_sess_type sess_type,
449 	union rte_cryptodev_session_ctx session_ctx, uint8_t is_update);
450 
451 /**
452  * Typedef that the driver provided to set event crypto meta data.
453  *
454  * @param	dev		Crypto device pointer.
455  * @param	sess		Crypto or security session.
456  * @param	op_type		Operation type.
457  * @param	sess_type	Session type.
458  * @param	ev_mdata	Pointer to the event crypto meta data
459  *				(aka *union rte_event_crypto_metadata*)
460  * @return
461  *   - On success return 0.
462  *   - On failure return negative integer.
463  */
464 typedef int (*cryptodev_session_event_mdata_set_t)(
465 	struct rte_cryptodev *dev, void *sess,
466 	enum rte_crypto_op_type op_type,
467 	enum rte_crypto_op_sess_type sess_type,
468 	void *ev_mdata);
469 
470 /**
471  * @internal Query queue pair error interrupt event.
472  * @see rte_cryptodev_queue_pair_event_error_query()
473  */
474 typedef int (*cryptodev_queue_pair_event_error_query_t)(struct rte_cryptodev *dev,
475 					uint16_t qp_id);
476 
477 /** Crypto device operations function pointer table */
478 struct rte_cryptodev_ops {
479 	cryptodev_configure_t dev_configure;	/**< Configure device. */
480 	cryptodev_start_t dev_start;		/**< Start device. */
481 	cryptodev_stop_t dev_stop;		/**< Stop device. */
482 	cryptodev_close_t dev_close;		/**< Close device. */
483 
484 	cryptodev_info_get_t dev_infos_get;	/**< Get device info. */
485 
486 	cryptodev_stats_get_t stats_get;
487 	/**< Get device statistics. */
488 	cryptodev_stats_reset_t stats_reset;
489 	/**< Reset device statistics. */
490 
491 	cryptodev_queue_pair_setup_t queue_pair_setup;
492 	/**< Set up a device queue pair. */
493 	cryptodev_queue_pair_release_t queue_pair_release;
494 	/**< Release a queue pair. */
495 	cryptodev_queue_pair_reset_t queue_pair_reset;
496 	/**< Reset a queue pair. */
497 
498 	cryptodev_sym_get_session_private_size_t sym_session_get_size;
499 	/**< Return private session. */
500 	cryptodev_asym_get_session_private_size_t asym_session_get_size;
501 	/**< Return asym session private size. */
502 	cryptodev_sym_configure_session_t sym_session_configure;
503 	/**< Configure a Crypto session. */
504 	cryptodev_asym_configure_session_t asym_session_configure;
505 	/**< Configure asymmetric Crypto session. */
506 	cryptodev_sym_free_session_t sym_session_clear;
507 	/**< Clear a Crypto sessions private data. */
508 	cryptodev_asym_clear_session_t asym_session_clear;
509 	/**< Clear a Crypto sessions private data. */
510 	union {
511 		cryptodev_sym_cpu_crypto_process_t sym_cpu_process;
512 		/**< process input data synchronously (cpu-crypto). */
513 		__extension__
514 		struct {
515 			cryptodev_sym_get_raw_dp_ctx_size_t
516 				sym_get_raw_dp_ctx_size;
517 			/**< Get raw data path service context data size. */
518 			cryptodev_sym_configure_raw_dp_ctx_t
519 				sym_configure_raw_dp_ctx;
520 			/**< Initialize raw data path context data. */
521 		};
522 	};
523 	cryptodev_session_event_mdata_set_t session_ev_mdata_set;
524 	/**< Set a Crypto or Security session even meta data. */
525 	cryptodev_queue_pair_event_error_query_t queue_pair_event_error_query;
526 	/**< Query queue error interrupt event */
527 };
528 
529 
530 /**
531  * Function for internal use by dummy drivers primarily, e.g. ring-based
532  * driver.
533  * Allocates a new cryptodev slot for an crypto device and returns the pointer
534  * to that slot for the driver to use.
535  *
536  * @param	name		Unique identifier name for each device
537  * @param	socket_id	Socket to allocate resources on.
538  * @return
539  *   - Slot in the rte_dev_devices array for a new device;
540  */
541 __rte_internal
542 struct rte_cryptodev *
543 rte_cryptodev_pmd_allocate(const char *name, int socket_id);
544 
545 /**
546  * Function for internal use by dummy drivers primarily, e.g. ring-based
547  * driver.
548  * Release the specified cryptodev device.
549  *
550  * @param cryptodev
551  * The *cryptodev* pointer is the address of the *rte_cryptodev* structure.
552  * @return
553  *   - 0 on success, negative on error
554  */
555 __rte_internal
556 int
557 rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
558 
559 
560 /**
561  * @internal
562  *
563  * PMD assist function to parse initialisation arguments for crypto driver
564  * when creating a new crypto PMD device instance.
565  *
566  * PMD should set default values for that PMD before calling function,
567  * these default values will be over-written with successfully parsed values
568  * from args string.
569  *
570  * @param	params	parsed PMD initialisation parameters
571  * @param	args	input argument string to parse
572  *
573  * @return
574  *  - 0 on success
575  *  - errno on failure
576  */
577 __rte_internal
578 int
579 rte_cryptodev_pmd_parse_input_args(
580 		struct rte_cryptodev_pmd_init_params *params,
581 		const char *args);
582 
583 /**
584  * @internal
585  *
586  * PMD assist function to provide boiler plate code for crypto driver to create
587  * and allocate resources for a new crypto PMD device instance.
588  *
589  * @param	name	crypto device name.
590  * @param	device	base device instance
591  * @param	params	PMD initialisation parameters
592  *
593  * @return
594  *  - crypto device instance on success
595  *  - NULL on creation failure
596  */
597 __rte_internal
598 struct rte_cryptodev *
599 rte_cryptodev_pmd_create(const char *name,
600 		struct rte_device *device,
601 		struct rte_cryptodev_pmd_init_params *params);
602 
603 /**
604  * @internal
605  *
606  * PMD assist function to provide boiler plate code for crypto driver to
607  * destroy and free resources associated with a crypto PMD device instance.
608  *
609  * @param	cryptodev	crypto device handle.
610  *
611  * @return
612  *  - 0 on success
613  *  - errno on failure
614  */
615 __rte_internal
616 int
617 rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev);
618 
619 /**
620  * Executes all the user application registered callbacks for the specific
621  * device.
622  *  *
623  * @param	dev	Pointer to cryptodev struct
624  * @param	event	Crypto device interrupt event type.
625  *
626  * @return
627  *  void
628  */
629 __rte_internal
630 void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
631 				enum rte_cryptodev_event_type event);
632 
633 /**
634  * @internal
635  * Create unique device name
636  */
637 __rte_internal
638 int
639 rte_cryptodev_pmd_create_dev_name(char *name, const char *dev_name_prefix);
640 
641 /**
642  * @internal
643  * Allocate Cryptodev driver.
644  *
645  * @param crypto_drv
646  *   Pointer to cryptodev_driver.
647  * @param drv
648  *   Pointer to rte_driver.
649  *
650  * @return
651  *  The driver type identifier
652  */
653 __rte_internal
654 uint8_t rte_cryptodev_allocate_driver(struct cryptodev_driver *crypto_drv,
655 		const struct rte_driver *drv);
656 
657 /**
658  * @internal
659  * This is the last step of device probing. It must be called after a
660  * cryptodev is allocated and initialized successfully.
661  *
662  * @param	dev	Pointer to cryptodev struct
663  *
664  * @return
665  *  void
666  */
667 __rte_internal
668 void
669 rte_cryptodev_pmd_probing_finish(struct rte_cryptodev *dev);
670 
671 #define RTE_PMD_REGISTER_CRYPTO_DRIVER(crypto_drv, drv, driver_id)\
672 RTE_INIT(init_ ##driver_id)\
673 {\
674 	driver_id = rte_cryptodev_allocate_driver(&crypto_drv, &(drv));\
675 }
676 
677 /* Reset crypto device fastpath APIs to dummy values. */
678 __rte_internal
679 void
680 cryptodev_fp_ops_reset(struct rte_crypto_fp_ops *fp_ops);
681 
682 /* Setup crypto device fastpath APIs. */
683 __rte_internal
684 void
685 cryptodev_fp_ops_set(struct rte_crypto_fp_ops *fp_ops,
686 		     const struct rte_cryptodev *dev);
687 
688 /**
689  * Get session event meta data (aka *union rte_event_crypto_metadata*)
690  *
691  * @param	op            pointer to *rte_crypto_op* structure.
692  *
693  * @return
694  *  - On success, pointer to event crypto metadata
695  *  - On failure, NULL.
696  */
697 __rte_internal
698 void *
699 rte_cryptodev_session_event_mdata_get(struct rte_crypto_op *op);
700 
701 /**
702  * @internal
703  * Cryptodev asymmetric crypto session.
704  */
705 struct rte_cryptodev_asym_session {
706 	uint8_t driver_id;
707 	/**< Session driver ID. */
708 	uint16_t max_priv_data_sz;
709 	/**< Size of private data used when creating mempool */
710 	uint16_t user_data_sz;
711 	/**< Session user data will be placed after sess_data */
712 	uint8_t padding[3];
713 	void *event_mdata;
714 	/**< Event metadata (aka *union rte_event_crypto_metadata*) */
715 	uint8_t sess_private_data[];
716 };
717 
718 #ifdef __cplusplus
719 }
720 #endif
721 
722 #endif /* _CRYPTODEV_PMD_H_ */
723