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 crypto_null
54 /**< Null crypto PMD device name */
55 #define CRYPTODEV_NAME_AESNI_MB_PMD crypto_aesni_mb
56 /**< AES-NI Multi buffer PMD device name */
57 #define CRYPTODEV_NAME_AESNI_GCM_PMD crypto_aesni_gcm
58 /**< AES-NI GCM PMD device name */
59 #define CRYPTODEV_NAME_QAT_SYM_PMD crypto_qat
60 /**< Intel QAT Symmetric Crypto PMD device name */
61 #define CRYPTODEV_NAME_SNOW3G_PMD crypto_snow3g
62 /**< SNOW 3G PMD device name */
63 #define CRYPTODEV_NAME_KASUMI_PMD crypto_kasumi
64 /**< KASUMI PMD device name */
65 #define CRYPTODEV_NAME_ZUC_PMD crypto_zuc
66 /**< KASUMI PMD device name */
68 /** Crypto device type */
69 enum rte_cryptodev_type {
70 RTE_CRYPTODEV_NULL_PMD = 1, /**< Null crypto PMD */
71 RTE_CRYPTODEV_AESNI_GCM_PMD, /**< AES-NI GCM PMD */
72 RTE_CRYPTODEV_AESNI_MB_PMD, /**< AES-NI multi buffer PMD */
73 RTE_CRYPTODEV_QAT_SYM_PMD, /**< QAT PMD Symmetric Crypto */
74 RTE_CRYPTODEV_SNOW3G_PMD, /**< SNOW 3G PMD */
75 RTE_CRYPTODEV_KASUMI_PMD, /**< KASUMI PMD */
76 RTE_CRYPTODEV_ZUC_PMD /**< ZUC PMD */
79 extern const char **rte_cyptodev_names;
83 #define CDEV_LOG_ERR(...) \
84 RTE_LOG(ERR, CRYPTODEV, \
85 RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
86 __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
88 #define CDEV_PMD_LOG_ERR(dev, ...) \
89 RTE_LOG(ERR, CRYPTODEV, \
90 RTE_FMT("[%s] %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
91 dev, __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
93 #ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
94 #define CDEV_LOG_DEBUG(...) \
95 RTE_LOG(DEBUG, CRYPTODEV, \
96 RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
97 __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
99 #define CDEV_PMD_TRACE(...) \
100 RTE_LOG(DEBUG, CRYPTODEV, \
101 RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
102 dev, __func__, RTE_FMT_TAIL(__VA_ARGS__,)))
105 #define CDEV_LOG_DEBUG(...) (void)0
106 #define CDEV_PMD_TRACE(...) (void)0
110 * Symmetric Crypto Capability
112 struct rte_cryptodev_symmetric_capability {
113 enum rte_crypto_sym_xform_type xform_type;
114 /**< Transform type : Authentication / Cipher */
118 enum rte_crypto_auth_algorithm algo;
119 /**< authentication algorithm */
121 /**< algorithm block size */
123 uint16_t min; /**< minimum key size */
124 uint16_t max; /**< maximum key size */
126 /**< if a range of sizes are supported,
127 * this parameter is used to indicate
128 * increments in byte size that are supported
129 * between the minimum and maximum */
131 /**< auth key size range */
133 uint16_t min; /**< minimum digest size */
134 uint16_t max; /**< maximum digest size */
136 /**< if a range of sizes are supported,
137 * this parameter is used to indicate
138 * increments in byte size that are supported
139 * between the minimum and maximum */
141 /**< digest size range */
143 uint16_t min; /**< minimum aad size */
144 uint16_t max; /**< maximum aad size */
146 /**< if a range of sizes are supported,
147 * this parameter is used to indicate
148 * increments in byte size that are supported
149 * between the minimum and maximum */
151 /**< Additional authentication data size range */
153 /**< Symmetric Authentication transform capabilities */
155 enum rte_crypto_cipher_algorithm algo;
156 /**< cipher algorithm */
158 /**< algorithm block size */
160 uint16_t min; /**< minimum key size */
161 uint16_t max; /**< maximum key size */
163 /**< if a range of sizes are supported,
164 * this parameter is used to indicate
165 * increments in byte size that are supported
166 * between the minimum and maximum */
168 /**< cipher key size range */
170 uint16_t min; /**< minimum iv size */
171 uint16_t max; /**< maximum iv size */
173 /**< if a range of sizes are supported,
174 * this parameter is used to indicate
175 * increments in byte size that are supported
176 * between the minimum and maximum */
178 /**< Initialisation vector data size range */
180 /**< Symmetric Cipher transform capabilities */
184 /** Structure used to capture a capability of a crypto device */
185 struct rte_cryptodev_capabilities {
186 enum rte_crypto_op_type op;
187 /**< Operation type */
191 struct rte_cryptodev_symmetric_capability sym;
192 /**< Symmetric operation capability parameters */
196 /** Macro used at end of crypto PMD list */
197 #define RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() \
198 { RTE_CRYPTO_OP_TYPE_UNDEFINED }
202 * Crypto device supported feature flags
205 * New features flags should be added to the end of the list
207 * Keep these flags synchronised with rte_cryptodev_get_feature_name()
209 #define RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO (1ULL << 0)
210 /**< Symmetric crypto operations are supported */
211 #define RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO (1ULL << 1)
212 /**< Asymmetric crypto operations are supported */
213 #define RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING (1ULL << 2)
214 /**< Chaining symmetric crypto operations are supported */
215 #define RTE_CRYPTODEV_FF_CPU_SSE (1ULL << 3)
216 /**< Utilises CPU SIMD SSE instructions */
217 #define RTE_CRYPTODEV_FF_CPU_AVX (1ULL << 4)
218 /**< Utilises CPU SIMD AVX instructions */
219 #define RTE_CRYPTODEV_FF_CPU_AVX2 (1ULL << 5)
220 /**< Utilises CPU SIMD AVX2 instructions */
221 #define RTE_CRYPTODEV_FF_CPU_AESNI (1ULL << 6)
222 /**< Utilises CPU AES-NI instructions */
223 #define RTE_CRYPTODEV_FF_HW_ACCELERATED (1ULL << 7)
224 /**< Operations are off-loaded to an external hardware accelerator */
228 * Get the name of a crypto device feature flag
230 * @param flag The mask describing the flag.
233 * The name of this flag, or NULL if it's not a valid feature flag.
237 rte_cryptodev_get_feature_name(uint64_t flag);
239 /** Crypto device information */
240 struct rte_cryptodev_info {
241 const char *driver_name; /**< Driver name. */
242 enum rte_cryptodev_type dev_type; /**< Device type */
243 struct rte_pci_device *pci_dev; /**< PCI information. */
245 uint64_t feature_flags; /**< Feature flags */
247 const struct rte_cryptodev_capabilities *capabilities;
248 /**< Array of devices supported capabilities */
250 unsigned max_nb_queue_pairs;
251 /**< Maximum number of queues pairs supported by device. */
254 unsigned max_nb_sessions;
255 /**< Maximum number of sessions supported by device. */
259 #define RTE_CRYPTODEV_DETACHED (0)
260 #define RTE_CRYPTODEV_ATTACHED (1)
262 /** Definitions of Crypto device event types */
263 enum rte_cryptodev_event_type {
264 RTE_CRYPTODEV_EVENT_UNKNOWN, /**< unknown event type */
265 RTE_CRYPTODEV_EVENT_ERROR, /**< error interrupt event */
266 RTE_CRYPTODEV_EVENT_MAX /**< max value of this enum */
269 /** Crypto device queue pair configuration structure. */
270 struct rte_cryptodev_qp_conf {
271 uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
275 * Typedef for application callback function to be registered by application
276 * software for notification of device events
278 * @param dev_id Crypto device identifier
279 * @param event Crypto device event to register for notification of.
280 * @param cb_arg User specified parameter to be passed as to passed to
281 * users callback function.
283 typedef void (*rte_cryptodev_cb_fn)(uint8_t dev_id,
284 enum rte_cryptodev_event_type event, void *cb_arg);
287 /** Crypto Device statistics */
288 struct rte_cryptodev_stats {
289 uint64_t enqueued_count;
290 /**< Count of all operations enqueued */
291 uint64_t dequeued_count;
292 /**< Count of all operations dequeued */
294 uint64_t enqueue_err_count;
295 /**< Total error count on operations enqueued */
296 uint64_t dequeue_err_count;
297 /**< Total error count on operations dequeued */
300 #define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS 8
301 #define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS 2048
305 * Initialisation parameters for virtual crypto devices
307 struct rte_crypto_vdev_init_params {
308 unsigned max_nb_queue_pairs;
309 unsigned max_nb_sessions;
314 * Parse virtual device initialisation parameters input arguments
317 * @params params Initialisation parameters with defaults set.
318 * @params input_args Command line arguments
321 * 0 on successful parse
322 * <0 on failure to parse
325 rte_cryptodev_parse_vdev_init_params(
326 struct rte_crypto_vdev_init_params *params,
327 const char *input_args);
330 * Create a virtual crypto device
332 * @param name Cryptodev PMD name of device to be created.
333 * @param args Options arguments for device.
336 * - On successful creation of the cryptodev the device index is returned,
337 * which will be between 0 and rte_cryptodev_count().
338 * - In the case of a failure, returns -1.
341 rte_cryptodev_create_vdev(const char *name, const char *args);
344 * Get the device identifier for the named crypto device.
346 * @param name device name to select the device structure.
349 * - Returns crypto device identifier on success.
350 * - Return -1 on failure to find named crypto device.
353 rte_cryptodev_get_dev_id(const char *name);
356 * Get the total number of crypto devices that have been successfully
360 * - The total number of usable crypto devices.
363 rte_cryptodev_count(void);
366 rte_cryptodev_count_devtype(enum rte_cryptodev_type type);
368 * Return the NUMA socket to which a device is connected
371 * The identifier of the device
373 * The NUMA socket id to which the device is connected or
374 * a default of zero if the socket could not be determined.
375 * -1 if returned is the dev_id value is out of range.
378 rte_cryptodev_socket_id(uint8_t dev_id);
380 /** Crypto device configuration structure */
381 struct rte_cryptodev_config {
382 int socket_id; /**< Socket to allocate resources on */
383 uint16_t nb_queue_pairs;
384 /**< Number of queue pairs to configure on device */
387 uint32_t nb_objs; /**< Number of objects in mempool */
388 uint32_t cache_size; /**< l-core object cache size */
389 } session_mp; /**< Session mempool configuration */
393 * Configure a device.
395 * This function must be invoked first before any other function in the
396 * API. This function can also be re-invoked when a device is in the
399 * @param dev_id The identifier of the device to configure.
400 * @param config The crypto device configuration structure.
403 * - 0: Success, device configured.
404 * - <0: Error code returned by the driver configuration function.
407 rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config);
412 * The device start step is the last one and consists of setting the configured
413 * offload features and in starting the transmit and the receive units of the
415 * On success, all basic functions exported by the API (link status,
416 * receive/transmit, and so on) can be invoked.
419 * The identifier of the device.
421 * - 0: Success, device started.
422 * - <0: Error code of the driver device start function.
425 rte_cryptodev_start(uint8_t dev_id);
428 * Stop an device. The device can be restarted with a call to
429 * rte_cryptodev_start()
431 * @param dev_id The identifier of the device.
434 rte_cryptodev_stop(uint8_t dev_id);
437 * Close an device. The device cannot be restarted!
439 * @param dev_id The identifier of the device.
442 * - 0 on successfully closing device
443 * - <0 on failure to close device
446 rte_cryptodev_close(uint8_t dev_id);
449 * Allocate and set up a receive queue pair for a device.
452 * @param dev_id The identifier of the device.
453 * @param queue_pair_id The index of the queue pairs to set up. The
454 * value must be in the range [0, nb_queue_pair
455 * - 1] previously supplied to
456 * rte_cryptodev_configure().
457 * @param qp_conf The pointer to the configuration data to be
458 * used for the queue pair. NULL value is
459 * allowed, in which case default configuration
461 * @param socket_id The *socket_id* argument is the socket
462 * identifier in case of NUMA. The value can be
463 * *SOCKET_ID_ANY* if there is no NUMA constraint
464 * for the DMA memory allocated for the receive
468 * - 0: Success, queue pair correctly set up.
469 * - <0: Queue pair configuration failed
472 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
473 const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
476 * Start a specified queue pair of a device. It is used
477 * when deferred_start flag of the specified queue is true.
479 * @param dev_id The identifier of the device
480 * @param queue_pair_id The index of the queue pair to start. The value
481 * must be in the range [0, nb_queue_pair - 1]
482 * previously supplied to
483 * rte_crypto_dev_configure().
485 * - 0: Success, the transmit queue is correctly set up.
486 * - -EINVAL: The dev_id or the queue_id out of range.
487 * - -ENOTSUP: The function not supported in PMD driver.
490 rte_cryptodev_queue_pair_start(uint8_t dev_id, uint16_t queue_pair_id);
493 * Stop specified queue pair of a device
495 * @param dev_id The identifier of the device
496 * @param queue_pair_id The index of the queue pair to stop. The value
497 * must be in the range [0, nb_queue_pair - 1]
498 * previously supplied to
499 * rte_cryptodev_configure().
501 * - 0: Success, the transmit queue is correctly set up.
502 * - -EINVAL: The dev_id or the queue_id out of range.
503 * - -ENOTSUP: The function not supported in PMD driver.
506 rte_cryptodev_queue_pair_stop(uint8_t dev_id, uint16_t queue_pair_id);
509 * Get the number of queue pairs on a specific crypto device
511 * @param dev_id Crypto device identifier.
513 * - The number of configured queue pairs.
516 rte_cryptodev_queue_pair_count(uint8_t dev_id);
520 * Retrieve the general I/O statistics of a device.
522 * @param dev_id The identifier of the device.
523 * @param stats A pointer to a structure of type
524 * *rte_cryptodev_stats* to be filled with the
525 * values of device counters.
527 * - Zero if successful.
528 * - Non-zero otherwise.
531 rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats);
534 * Reset the general I/O statistics of a device.
536 * @param dev_id The identifier of the device.
539 rte_cryptodev_stats_reset(uint8_t dev_id);
542 * Retrieve the contextual information of a device.
544 * @param dev_id The identifier of the device.
545 * @param dev_info A pointer to a structure of type
546 * *rte_cryptodev_info* to be filled with the
547 * contextual information of the device.
550 rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info);
554 * Register a callback function for specific device id.
556 * @param dev_id Device id.
557 * @param event Event interested.
558 * @param cb_fn User supplied callback function to be called.
559 * @param cb_arg Pointer to the parameters for the registered
563 * - On success, zero.
564 * - On failure, a negative value.
567 rte_cryptodev_callback_register(uint8_t dev_id,
568 enum rte_cryptodev_event_type event,
569 rte_cryptodev_cb_fn cb_fn, void *cb_arg);
572 * Unregister a callback function for specific device id.
574 * @param dev_id The device identifier.
575 * @param event Event interested.
576 * @param cb_fn User supplied callback function to be called.
577 * @param cb_arg Pointer to the parameters for the registered
581 * - On success, zero.
582 * - On failure, a negative value.
585 rte_cryptodev_callback_unregister(uint8_t dev_id,
586 enum rte_cryptodev_event_type event,
587 rte_cryptodev_cb_fn cb_fn, void *cb_arg);
590 typedef uint16_t (*dequeue_pkt_burst_t)(void *qp,
591 struct rte_crypto_op **ops, uint16_t nb_ops);
592 /**< Dequeue processed packets from queue pair of a device. */
594 typedef uint16_t (*enqueue_pkt_burst_t)(void *qp,
595 struct rte_crypto_op **ops, uint16_t nb_ops);
596 /**< Enqueue packets for processing on queue pair of a device. */
601 struct rte_cryptodev_callback;
603 /** Structure to keep track of registered callbacks */
604 TAILQ_HEAD(rte_cryptodev_cb_list, rte_cryptodev_callback);
606 /** The data structure associated with each crypto device. */
607 struct rte_cryptodev {
608 dequeue_pkt_burst_t dequeue_burst;
609 /**< Pointer to PMD receive function. */
610 enqueue_pkt_burst_t enqueue_burst;
611 /**< Pointer to PMD transmit function. */
613 const struct rte_cryptodev_driver *driver;
614 /**< Driver for this device */
615 struct rte_cryptodev_data *data;
616 /**< Pointer to device data */
617 struct rte_cryptodev_ops *dev_ops;
618 /**< Functions exported by PMD */
619 uint64_t feature_flags;
620 /**< Supported features */
621 struct rte_pci_device *pci_dev;
622 /**< PCI info. supplied by probing */
624 enum rte_cryptodev_type dev_type;
625 /**< Crypto device type */
627 struct rte_cryptodev_cb_list link_intr_cbs;
628 /**< User application callback for interrupts if present */
631 uint8_t attached : 1;
632 /**< Flag indicating the device is attached */
633 } __rte_cache_aligned;
636 #define RTE_CRYPTODEV_NAME_MAX_LEN (64)
637 /**< Max length of name of crypto PMD */
641 * The data part, with no function pointers, associated with each device.
643 * This structure is safe to place in shared memory to be common among
644 * different processes in a multi-process configuration.
646 struct rte_cryptodev_data {
648 /**< Device ID for this instance */
650 /**< Socket ID where memory is allocated */
651 char name[RTE_CRYPTODEV_NAME_MAX_LEN];
652 /**< Unique identifier name */
655 uint8_t dev_started : 1;
656 /**< Device state: STARTED(1)/STOPPED(0) */
658 struct rte_mempool *session_pool;
659 /**< Session memory pool */
661 /**< Array of pointers to queue pairs. */
662 uint16_t nb_queue_pairs;
663 /**< Number of device queue pairs. */
666 /**< PMD-specific private data */
667 } __rte_cache_aligned;
669 extern struct rte_cryptodev *rte_cryptodevs;
672 * Dequeue a burst of processed crypto operations from a queue on the crypto
673 * device. The dequeued operation are stored in *rte_crypto_op* structures
674 * whose pointers are supplied in the *ops* array.
676 * The rte_cryptodev_dequeue_burst() function returns the number of ops
677 * actually dequeued, which is the number of *rte_crypto_op* data structures
678 * effectively supplied into the *ops* array.
680 * A return value equal to *nb_ops* indicates that the queue contained
681 * at least *nb_ops* operations, and this is likely to signify that other
682 * processed operations remain in the devices output queue. Applications
683 * implementing a "retrieve as many processed operations as possible" policy
684 * can check this specific case and keep invoking the
685 * rte_cryptodev_dequeue_burst() function until a value less than
686 * *nb_ops* is returned.
688 * The rte_cryptodev_dequeue_burst() function does not provide any error
689 * notification to avoid the corresponding overhead.
691 * @param dev_id The symmetric crypto device identifier
692 * @param qp_id The index of the queue pair from which to
693 * retrieve processed packets. The value must be
694 * in the range [0, nb_queue_pair - 1] previously
695 * supplied to rte_cryptodev_configure().
696 * @param ops The address of an array of pointers to
697 * *rte_crypto_op* structures that must be
698 * large enough to store *nb_ops* pointers in it.
699 * @param nb_ops The maximum number of operations to dequeue.
702 * - The number of operations actually dequeued, which is the number
703 * of pointers to *rte_crypto_op* structures effectively supplied to the
706 static inline uint16_t
707 rte_cryptodev_dequeue_burst(uint8_t dev_id, uint16_t qp_id,
708 struct rte_crypto_op **ops, uint16_t nb_ops)
710 struct rte_cryptodev *dev = &rte_cryptodevs[dev_id];
712 nb_ops = (*dev->dequeue_burst)
713 (dev->data->queue_pairs[qp_id], ops, nb_ops);
719 * Enqueue a burst of operations for processing on a crypto device.
721 * The rte_cryptodev_enqueue_burst() function is invoked to place
722 * crypto operations on the queue *qp_id* of the device designated by
725 * The *nb_ops* parameter is the number of operations to process which are
726 * supplied in the *ops* array of *rte_crypto_op* structures.
728 * The rte_cryptodev_enqueue_burst() function returns the number of
729 * operations it actually enqueued for processing. A return value equal to
730 * *nb_ops* means that all packets have been enqueued.
732 * @param dev_id The identifier of the device.
733 * @param qp_id The index of the queue pair which packets are
734 * to be enqueued for processing. The value
735 * must be in the range [0, nb_queue_pairs - 1]
736 * previously supplied to
737 * *rte_cryptodev_configure*.
738 * @param ops The address of an array of *nb_ops* pointers
739 * to *rte_crypto_op* structures which contain
740 * the crypto operations to be processed.
741 * @param nb_ops The number of operations to process.
744 * The number of operations actually enqueued on the crypto device. The return
745 * value can be less than the value of the *nb_ops* parameter when the
746 * crypto devices queue is full or if invalid parameters are specified in
749 static inline uint16_t
750 rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
751 struct rte_crypto_op **ops, uint16_t nb_ops)
753 struct rte_cryptodev *dev = &rte_cryptodevs[dev_id];
755 return (*dev->enqueue_burst)(
756 dev->data->queue_pairs[qp_id], ops, nb_ops);
760 /** Cryptodev symmetric crypto session */
761 struct rte_cryptodev_sym_session {
766 enum rte_cryptodev_type dev_type;
767 /** Crypto Device type session created on */
768 struct rte_mempool *mp;
769 /**< Mempool session allocated from */
771 /**< Public symmetric session details */
774 /**< Private session material */
779 * Initialise a session for symmetric cryptographic operations.
781 * This function is used by the client to initialize immutable
782 * parameters of symmetric cryptographic operation.
783 * To perform the operation the rte_cryptodev_enqueue_burst function is
784 * used. Each mbuf should contain a reference to the session
785 * pointer returned from this function contained within it's crypto_op if a
786 * session-based operation is being provisioned. Memory to contain the session
787 * information is allocated from within mempool managed by the cryptodev.
789 * The rte_cryptodev_session_free must be called to free allocated
790 * memory when the session is no longer required.
792 * @param dev_id The device identifier.
793 * @param xform Crypto transform chain.
797 * Pointer to the created session or NULL
799 extern struct rte_cryptodev_sym_session *
800 rte_cryptodev_sym_session_create(uint8_t dev_id,
801 struct rte_crypto_sym_xform *xform);
804 * Free the memory associated with a previously allocated session.
806 * @param dev_id The device identifier.
807 * @param session Session pointer previously allocated by
808 * *rte_cryptodev_sym_session_create*.
811 * NULL on successful freeing of session.
812 * Session pointer on failure to free session.
814 extern struct rte_cryptodev_sym_session *
815 rte_cryptodev_sym_session_free(uint8_t dev_id,
816 struct rte_cryptodev_sym_session *session);
823 #endif /* _RTE_CRYPTODEV_H_ */