3 * Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
15 * * Neither the name of Intel Corporation nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _RTE_CRYPTODEV_H_
33 #define _RTE_CRYPTODEV_H_
36 * @file rte_cryptodev.h
38 * RTE Cryptographic Device APIs
40 * Defines RTE Crypto Device APIs for the provisioning of cipher and
41 * authentication operations.
48 #include "rte_kvargs.h"
49 #include "rte_crypto.h"
51 #include <rte_common.h>
53 #define CRYPTODEV_NAME_NULL_PMD cryptodev_null_pmd
54 /**< Null crypto PMD device name */
55 #define CRYPTODEV_NAME_AESNI_MB_PMD cryptodev_aesni_mb_pmd
56 /**< AES-NI Multi buffer PMD device name */
57 #define CRYPTODEV_NAME_AESNI_GCM_PMD cryptodev_aesni_gcm_pmd
58 /**< AES-NI GCM PMD device name */
59 #define CRYPTODEV_NAME_QAT_SYM_PMD cryptodev_qat_sym_pmd
60 /**< Intel QAT Symmetric Crypto PMD device name */
61 #define CRYPTODEV_NAME_SNOW3G_PMD cryptodev_snow3g_pmd
62 /**< SNOW 3G PMD device name */
63 #define CRYPTODEV_NAME_KASUMI_PMD cryptodev_kasumi_pmd
64 /**< KASUMI PMD device name */
66 /** Crypto device type */
67 enum rte_cryptodev_type {
68 RTE_CRYPTODEV_NULL_PMD = 1, /**< Null crypto PMD */
69 RTE_CRYPTODEV_AESNI_GCM_PMD, /**< AES-NI GCM PMD */
70 RTE_CRYPTODEV_AESNI_MB_PMD, /**< AES-NI multi buffer PMD */
71 RTE_CRYPTODEV_QAT_SYM_PMD, /**< QAT PMD Symmetric Crypto */
72 RTE_CRYPTODEV_SNOW3G_PMD, /**< SNOW 3G PMD */
73 RTE_CRYPTODEV_KASUMI_PMD, /**< KASUMI PMD */
76 extern const char **rte_cyptodev_names;
80 #define CDEV_LOG_ERR(fmt, args...) \
81 RTE_LOG(ERR, CRYPTODEV, "%s() line %u: " fmt "\n", \
82 __func__, __LINE__, ## args)
84 #define CDEV_PMD_LOG_ERR(dev, fmt, args...) \
85 RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
86 dev, __func__, __LINE__, ## args)
88 #ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
89 #define CDEV_LOG_DEBUG(fmt, args...) \
90 RTE_LOG(DEBUG, CRYPTODEV, "%s() line %u: " fmt "\n", \
91 __func__, __LINE__, ## args) \
93 #define CDEV_PMD_TRACE(fmt, args...) \
94 RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s: " fmt "\n", \
95 dev, __func__, ## args)
98 #define CDEV_LOG_DEBUG(fmt, args...)
99 #define CDEV_PMD_TRACE(fmt, args...)
103 * Symmetric Crypto Capability
105 struct rte_cryptodev_symmetric_capability {
106 enum rte_crypto_sym_xform_type xform_type;
107 /**< Transform type : Authentication / Cipher */
111 enum rte_crypto_auth_algorithm algo;
112 /**< authentication algorithm */
114 /**< algorithm block size */
116 uint16_t min; /**< minimum key size */
117 uint16_t max; /**< maximum key size */
119 /**< if a range of sizes are supported,
120 * this parameter is used to indicate
121 * increments in byte size that are supported
122 * between the minimum and maximum */
124 /**< auth key size range */
126 uint16_t min; /**< minimum digest size */
127 uint16_t max; /**< maximum digest size */
129 /**< if a range of sizes are supported,
130 * this parameter is used to indicate
131 * increments in byte size that are supported
132 * between the minimum and maximum */
134 /**< digest size range */
136 uint16_t min; /**< minimum aad size */
137 uint16_t max; /**< maximum aad size */
139 /**< if a range of sizes are supported,
140 * this parameter is used to indicate
141 * increments in byte size that are supported
142 * between the minimum and maximum */
144 /**< Additional authentication data size range */
146 /**< Symmetric Authentication transform capabilities */
148 enum rte_crypto_cipher_algorithm algo;
149 /**< cipher algorithm */
151 /**< algorithm block size */
153 uint16_t min; /**< minimum key size */
154 uint16_t max; /**< maximum key size */
156 /**< if a range of sizes are supported,
157 * this parameter is used to indicate
158 * increments in byte size that are supported
159 * between the minimum and maximum */
161 /**< cipher key size range */
163 uint16_t min; /**< minimum iv size */
164 uint16_t max; /**< maximum iv size */
166 /**< if a range of sizes are supported,
167 * this parameter is used to indicate
168 * increments in byte size that are supported
169 * between the minimum and maximum */
171 /**< Initialisation vector data size range */
173 /**< Symmetric Cipher transform capabilities */
177 /** Structure used to capture a capability of a crypto device */
178 struct rte_cryptodev_capabilities {
179 enum rte_crypto_op_type op;
180 /**< Operation type */
184 struct rte_cryptodev_symmetric_capability sym;
185 /**< Symmetric operation capability parameters */
189 /** Macro used at end of crypto PMD list */
190 #define RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() \
191 { RTE_CRYPTO_OP_TYPE_UNDEFINED }
195 * Crypto device supported feature flags
198 * New features flags should be added to the end of the list
200 * Keep these flags synchronised with rte_cryptodev_get_feature_name()
202 #define RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO (1ULL << 0)
203 /**< Symmetric crypto operations are supported */
204 #define RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO (1ULL << 1)
205 /**< Asymmetric crypto operations are supported */
206 #define RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING (1ULL << 2)
207 /**< Chaining symmetric crypto operations are supported */
208 #define RTE_CRYPTODEV_FF_CPU_SSE (1ULL << 3)
209 /**< Utilises CPU SIMD SSE instructions */
210 #define RTE_CRYPTODEV_FF_CPU_AVX (1ULL << 4)
211 /**< Utilises CPU SIMD AVX instructions */
212 #define RTE_CRYPTODEV_FF_CPU_AVX2 (1ULL << 5)
213 /**< Utilises CPU SIMD AVX2 instructions */
214 #define RTE_CRYPTODEV_FF_CPU_AESNI (1ULL << 6)
215 /**< Utilises CPU AES-NI instructions */
216 #define RTE_CRYPTODEV_FF_HW_ACCELERATED (1ULL << 7)
217 /**< Operations are off-loaded to an external hardware accelerator */
221 * Get the name of a crypto device feature flag
223 * @param flag The mask describing the flag.
226 * The name of this flag, or NULL if it's not a valid feature flag.
230 rte_cryptodev_get_feature_name(uint64_t flag);
232 /** Crypto device information */
233 struct rte_cryptodev_info {
234 const char *driver_name; /**< Driver name. */
235 enum rte_cryptodev_type dev_type; /**< Device type */
236 struct rte_pci_device *pci_dev; /**< PCI information. */
238 uint64_t feature_flags; /**< Feature flags */
240 const struct rte_cryptodev_capabilities *capabilities;
241 /**< Array of devices supported capabilities */
243 unsigned max_nb_queue_pairs;
244 /**< Maximum number of queues pairs supported by device. */
247 unsigned max_nb_sessions;
248 /**< Maximum number of sessions supported by device. */
252 #define RTE_CRYPTODEV_DETACHED (0)
253 #define RTE_CRYPTODEV_ATTACHED (1)
255 /** Definitions of Crypto device event types */
256 enum rte_cryptodev_event_type {
257 RTE_CRYPTODEV_EVENT_UNKNOWN, /**< unknown event type */
258 RTE_CRYPTODEV_EVENT_ERROR, /**< error interrupt event */
259 RTE_CRYPTODEV_EVENT_MAX /**< max value of this enum */
262 /** Crypto device queue pair configuration structure. */
263 struct rte_cryptodev_qp_conf {
264 uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
268 * Typedef for application callback function to be registered by application
269 * software for notification of device events
271 * @param dev_id Crypto device identifier
272 * @param event Crypto device event to register for notification of.
273 * @param cb_arg User specified parameter to be passed as to passed to
274 * users callback function.
276 typedef void (*rte_cryptodev_cb_fn)(uint8_t dev_id,
277 enum rte_cryptodev_event_type event, void *cb_arg);
280 /** Crypto Device statistics */
281 struct rte_cryptodev_stats {
282 uint64_t enqueued_count;
283 /**< Count of all operations enqueued */
284 uint64_t dequeued_count;
285 /**< Count of all operations dequeued */
287 uint64_t enqueue_err_count;
288 /**< Total error count on operations enqueued */
289 uint64_t dequeue_err_count;
290 /**< Total error count on operations dequeued */
293 #define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS 8
294 #define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS 2048
298 * Initialisation parameters for virtual crypto devices
300 struct rte_crypto_vdev_init_params {
301 unsigned max_nb_queue_pairs;
302 unsigned max_nb_sessions;
307 * Parse virtual device initialisation parameters input arguments
310 * @params params Initialisation parameters with defaults set.
311 * @params input_args Command line arguments
314 * 0 on successful parse
315 * <0 on failure to parse
318 rte_cryptodev_parse_vdev_init_params(
319 struct rte_crypto_vdev_init_params *params,
320 const char *input_args);
323 * Create a virtual crypto device
325 * @param name Cryptodev PMD name of device to be created.
326 * @param args Options arguments for device.
329 * - On successful creation of the cryptodev the device index is returned,
330 * which will be between 0 and rte_cryptodev_count().
331 * - In the case of a failure, returns -1.
334 rte_cryptodev_create_vdev(const char *name, const char *args);
337 * Get the device identifier for the named crypto device.
339 * @param name device name to select the device structure.
342 * - Returns crypto device identifier on success.
343 * - Return -1 on failure to find named crypto device.
346 rte_cryptodev_get_dev_id(const char *name);
349 * Get the total number of crypto devices that have been successfully
353 * - The total number of usable crypto devices.
356 rte_cryptodev_count(void);
359 rte_cryptodev_count_devtype(enum rte_cryptodev_type type);
361 * Return the NUMA socket to which a device is connected
364 * The identifier of the device
366 * The NUMA socket id to which the device is connected or
367 * a default of zero if the socket could not be determined.
368 * -1 if returned is the dev_id value is out of range.
371 rte_cryptodev_socket_id(uint8_t dev_id);
373 /** Crypto device configuration structure */
374 struct rte_cryptodev_config {
375 int socket_id; /**< Socket to allocate resources on */
376 uint16_t nb_queue_pairs;
377 /**< Number of queue pairs to configure on device */
380 uint32_t nb_objs; /**< Number of objects in mempool */
381 uint32_t cache_size; /**< l-core object cache size */
382 } session_mp; /**< Session mempool configuration */
386 * Configure a device.
388 * This function must be invoked first before any other function in the
389 * API. This function can also be re-invoked when a device is in the
392 * @param dev_id The identifier of the device to configure.
393 * @param config The crypto device configuration structure.
396 * - 0: Success, device configured.
397 * - <0: Error code returned by the driver configuration function.
400 rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config);
405 * The device start step is the last one and consists of setting the configured
406 * offload features and in starting the transmit and the receive units of the
408 * On success, all basic functions exported by the API (link status,
409 * receive/transmit, and so on) can be invoked.
412 * The identifier of the device.
414 * - 0: Success, device started.
415 * - <0: Error code of the driver device start function.
418 rte_cryptodev_start(uint8_t dev_id);
421 * Stop an device. The device can be restarted with a call to
422 * rte_cryptodev_start()
424 * @param dev_id The identifier of the device.
427 rte_cryptodev_stop(uint8_t dev_id);
430 * Close an device. The device cannot be restarted!
432 * @param dev_id The identifier of the device.
435 * - 0 on successfully closing device
436 * - <0 on failure to close device
439 rte_cryptodev_close(uint8_t dev_id);
442 * Allocate and set up a receive queue pair for a device.
445 * @param dev_id The identifier of the device.
446 * @param queue_pair_id The index of the queue pairs to set up. The
447 * value must be in the range [0, nb_queue_pair
448 * - 1] previously supplied to
449 * rte_cryptodev_configure().
450 * @param qp_conf The pointer to the configuration data to be
451 * used for the queue pair. NULL value is
452 * allowed, in which case default configuration
454 * @param socket_id The *socket_id* argument is the socket
455 * identifier in case of NUMA. The value can be
456 * *SOCKET_ID_ANY* if there is no NUMA constraint
457 * for the DMA memory allocated for the receive
461 * - 0: Success, queue pair correctly set up.
462 * - <0: Queue pair configuration failed
465 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
466 const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
469 * Start a specified queue pair of a device. It is used
470 * when deferred_start flag of the specified queue is true.
472 * @param dev_id The identifier of the device
473 * @param queue_pair_id The index of the queue pair to start. The value
474 * must be in the range [0, nb_queue_pair - 1]
475 * previously supplied to
476 * rte_crypto_dev_configure().
478 * - 0: Success, the transmit queue is correctly set up.
479 * - -EINVAL: The dev_id or the queue_id out of range.
480 * - -ENOTSUP: The function not supported in PMD driver.
483 rte_cryptodev_queue_pair_start(uint8_t dev_id, uint16_t queue_pair_id);
486 * Stop specified queue pair of a device
488 * @param dev_id The identifier of the device
489 * @param queue_pair_id The index of the queue pair to stop. The value
490 * must be in the range [0, nb_queue_pair - 1]
491 * previously supplied to
492 * rte_cryptodev_configure().
494 * - 0: Success, the transmit queue is correctly set up.
495 * - -EINVAL: The dev_id or the queue_id out of range.
496 * - -ENOTSUP: The function not supported in PMD driver.
499 rte_cryptodev_queue_pair_stop(uint8_t dev_id, uint16_t queue_pair_id);
502 * Get the number of queue pairs on a specific crypto device
504 * @param dev_id Crypto device identifier.
506 * - The number of configured queue pairs.
509 rte_cryptodev_queue_pair_count(uint8_t dev_id);
513 * Retrieve the general I/O statistics of a device.
515 * @param dev_id The identifier of the device.
516 * @param stats A pointer to a structure of type
517 * *rte_cryptodev_stats* to be filled with the
518 * values of device counters.
520 * - Zero if successful.
521 * - Non-zero otherwise.
524 rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats);
527 * Reset the general I/O statistics of a device.
529 * @param dev_id The identifier of the device.
532 rte_cryptodev_stats_reset(uint8_t dev_id);
535 * Retrieve the contextual information of a device.
537 * @param dev_id The identifier of the device.
538 * @param dev_info A pointer to a structure of type
539 * *rte_cryptodev_info* to be filled with the
540 * contextual information of the device.
543 rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info);
547 * Register a callback function for specific device id.
549 * @param dev_id Device id.
550 * @param event Event interested.
551 * @param cb_fn User supplied callback function to be called.
552 * @param cb_arg Pointer to the parameters for the registered
556 * - On success, zero.
557 * - On failure, a negative value.
560 rte_cryptodev_callback_register(uint8_t dev_id,
561 enum rte_cryptodev_event_type event,
562 rte_cryptodev_cb_fn cb_fn, void *cb_arg);
565 * Unregister a callback function for specific device id.
567 * @param dev_id The device identifier.
568 * @param event Event interested.
569 * @param cb_fn User supplied callback function to be called.
570 * @param cb_arg Pointer to the parameters for the registered
574 * - On success, zero.
575 * - On failure, a negative value.
578 rte_cryptodev_callback_unregister(uint8_t dev_id,
579 enum rte_cryptodev_event_type event,
580 rte_cryptodev_cb_fn cb_fn, void *cb_arg);
583 typedef uint16_t (*dequeue_pkt_burst_t)(void *qp,
584 struct rte_crypto_op **ops, uint16_t nb_ops);
585 /**< Dequeue processed packets from queue pair of a device. */
587 typedef uint16_t (*enqueue_pkt_burst_t)(void *qp,
588 struct rte_crypto_op **ops, uint16_t nb_ops);
589 /**< Enqueue packets for processing on queue pair of a device. */
594 struct rte_cryptodev_callback;
596 /** Structure to keep track of registered callbacks */
597 TAILQ_HEAD(rte_cryptodev_cb_list, rte_cryptodev_callback);
599 /** The data structure associated with each crypto device. */
600 struct rte_cryptodev {
601 dequeue_pkt_burst_t dequeue_burst;
602 /**< Pointer to PMD receive function. */
603 enqueue_pkt_burst_t enqueue_burst;
604 /**< Pointer to PMD transmit function. */
606 const struct rte_cryptodev_driver *driver;
607 /**< Driver for this device */
608 struct rte_cryptodev_data *data;
609 /**< Pointer to device data */
610 struct rte_cryptodev_ops *dev_ops;
611 /**< Functions exported by PMD */
612 uint64_t feature_flags;
613 /**< Supported features */
614 struct rte_pci_device *pci_dev;
615 /**< PCI info. supplied by probing */
617 enum rte_cryptodev_type dev_type;
618 /**< Crypto device type */
619 enum pmd_type pmd_type;
620 /**< PMD type - PDEV / VDEV */
622 struct rte_cryptodev_cb_list link_intr_cbs;
623 /**< User application callback for interrupts if present */
626 uint8_t attached : 1;
627 /**< Flag indicating the device is attached */
628 } __rte_cache_aligned;
631 #define RTE_CRYPTODEV_NAME_MAX_LEN (64)
632 /**< Max length of name of crypto PMD */
636 * The data part, with no function pointers, associated with each device.
638 * This structure is safe to place in shared memory to be common among
639 * different processes in a multi-process configuration.
641 struct rte_cryptodev_data {
643 /**< Device ID for this instance */
645 /**< Socket ID where memory is allocated */
646 char name[RTE_CRYPTODEV_NAME_MAX_LEN];
647 /**< Unique identifier name */
650 uint8_t dev_started : 1;
651 /**< Device state: STARTED(1)/STOPPED(0) */
653 struct rte_mempool *session_pool;
654 /**< Session memory pool */
656 /**< Array of pointers to queue pairs. */
657 uint16_t nb_queue_pairs;
658 /**< Number of device queue pairs. */
661 /**< PMD-specific private data */
662 } __rte_cache_aligned;
664 extern struct rte_cryptodev *rte_cryptodevs;
667 * Dequeue a burst of processed crypto operations from a queue on the crypto
668 * device. The dequeued operation are stored in *rte_crypto_op* structures
669 * whose pointers are supplied in the *ops* array.
671 * The rte_cryptodev_dequeue_burst() function returns the number of ops
672 * actually dequeued, which is the number of *rte_crypto_op* data structures
673 * effectively supplied into the *ops* array.
675 * A return value equal to *nb_ops* indicates that the queue contained
676 * at least *nb_ops* operations, and this is likely to signify that other
677 * processed operations remain in the devices output queue. Applications
678 * implementing a "retrieve as many processed operations as possible" policy
679 * can check this specific case and keep invoking the
680 * rte_cryptodev_dequeue_burst() function until a value less than
681 * *nb_ops* is returned.
683 * The rte_cryptodev_dequeue_burst() function does not provide any error
684 * notification to avoid the corresponding overhead.
686 * @param dev_id The symmetric crypto device identifier
687 * @param qp_id The index of the queue pair from which to
688 * retrieve processed packets. The value must be
689 * in the range [0, nb_queue_pair - 1] previously
690 * supplied to rte_cryptodev_configure().
691 * @param ops The address of an array of pointers to
692 * *rte_crypto_op* structures that must be
693 * large enough to store *nb_ops* pointers in it.
694 * @param nb_ops The maximum number of operations to dequeue.
697 * - The number of operations actually dequeued, which is the number
698 * of pointers to *rte_crypto_op* structures effectively supplied to the
701 static inline uint16_t
702 rte_cryptodev_dequeue_burst(uint8_t dev_id, uint16_t qp_id,
703 struct rte_crypto_op **ops, uint16_t nb_ops)
705 struct rte_cryptodev *dev = &rte_cryptodevs[dev_id];
707 nb_ops = (*dev->dequeue_burst)
708 (dev->data->queue_pairs[qp_id], ops, nb_ops);
714 * Enqueue a burst of operations for processing on a crypto device.
716 * The rte_cryptodev_enqueue_burst() function is invoked to place
717 * crypto operations on the queue *qp_id* of the device designated by
720 * The *nb_ops* parameter is the number of operations to process which are
721 * supplied in the *ops* array of *rte_crypto_op* structures.
723 * The rte_cryptodev_enqueue_burst() function returns the number of
724 * operations it actually enqueued for processing. A return value equal to
725 * *nb_ops* means that all packets have been enqueued.
727 * @param dev_id The identifier of the device.
728 * @param qp_id The index of the queue pair which packets are
729 * to be enqueued for processing. The value
730 * must be in the range [0, nb_queue_pairs - 1]
731 * previously supplied to
732 * *rte_cryptodev_configure*.
733 * @param ops The address of an array of *nb_ops* pointers
734 * to *rte_crypto_op* structures which contain
735 * the crypto operations to be processed.
736 * @param nb_ops The number of operations to process.
739 * The number of operations actually enqueued on the crypto device. The return
740 * value can be less than the value of the *nb_ops* parameter when the
741 * crypto devices queue is full or if invalid parameters are specified in
744 static inline uint16_t
745 rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
746 struct rte_crypto_op **ops, uint16_t nb_ops)
748 struct rte_cryptodev *dev = &rte_cryptodevs[dev_id];
750 return (*dev->enqueue_burst)(
751 dev->data->queue_pairs[qp_id], ops, nb_ops);
755 /** Cryptodev symmetric crypto session */
756 struct rte_cryptodev_sym_session {
761 enum rte_cryptodev_type dev_type;
762 /** Crypto Device type session created on */
763 struct rte_mempool *mp;
764 /**< Mempool session allocated from */
766 /**< Public symmetric session details */
769 /**< Private session material */
774 * Initialise a session for symmetric cryptographic operations.
776 * This function is used by the client to initialize immutable
777 * parameters of symmetric cryptographic operation.
778 * To perform the operation the rte_cryptodev_enqueue_burst function is
779 * used. Each mbuf should contain a reference to the session
780 * pointer returned from this function contained within it's crypto_op if a
781 * session-based operation is being provisioned. Memory to contain the session
782 * information is allocated from within mempool managed by the cryptodev.
784 * The rte_cryptodev_session_free must be called to free allocated
785 * memory when the session is no longer required.
787 * @param dev_id The device identifier.
788 * @param xform Crypto transform chain.
792 * Pointer to the created session or NULL
794 extern struct rte_cryptodev_sym_session *
795 rte_cryptodev_sym_session_create(uint8_t dev_id,
796 struct rte_crypto_sym_xform *xform);
799 * Free the memory associated with a previously allocated session.
801 * @param dev_id The device identifier.
802 * @param session Session pointer previously allocated by
803 * *rte_cryptodev_sym_session_create*.
806 * NULL on successful freeing of session.
807 * Session pointer on failure to free session.
809 extern struct rte_cryptodev_sym_session *
810 rte_cryptodev_sym_session_free(uint8_t dev_id,
811 struct rte_cryptodev_sym_session *session);
818 #endif /* _RTE_CRYPTODEV_H_ */