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"
52 #define CRYPTODEV_NAME_NULL_PMD cryptodev_null_pmd
53 /**< Null crypto PMD device name */
54 #define CRYPTODEV_NAME_AESNI_MB_PMD cryptodev_aesni_mb_pmd
55 /**< AES-NI Multi buffer PMD device name */
56 #define CRYPTODEV_NAME_AESNI_GCM_PMD cryptodev_aesni_gcm_pmd
57 /**< AES-NI GCM PMD device name */
58 #define CRYPTODEV_NAME_QAT_SYM_PMD cryptodev_qat_sym_pmd
59 /**< Intel QAT Symmetric Crypto PMD device name */
60 #define CRYPTODEV_NAME_SNOW3G_PMD cryptodev_snow3g_pmd
61 /**< SNOW 3G PMD device name */
62 #define CRYPTODEV_NAME_KASUMI_PMD cryptodev_kasumi_pmd
63 /**< KASUMI PMD device name */
65 /** Crypto device type */
66 enum rte_cryptodev_type {
67 RTE_CRYPTODEV_NULL_PMD = 1, /**< Null crypto PMD */
68 RTE_CRYPTODEV_AESNI_GCM_PMD, /**< AES-NI GCM PMD */
69 RTE_CRYPTODEV_AESNI_MB_PMD, /**< AES-NI multi buffer PMD */
70 RTE_CRYPTODEV_QAT_SYM_PMD, /**< QAT PMD Symmetric Crypto */
71 RTE_CRYPTODEV_SNOW3G_PMD, /**< SNOW 3G PMD */
72 RTE_CRYPTODEV_KASUMI_PMD, /**< KASUMI PMD */
75 extern const char **rte_cyptodev_names;
79 #define CDEV_LOG_ERR(fmt, args...) \
80 RTE_LOG(ERR, CRYPTODEV, "%s() line %u: " fmt "\n", \
81 __func__, __LINE__, ## args)
83 #define CDEV_PMD_LOG_ERR(dev, fmt, args...) \
84 RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
85 dev, __func__, __LINE__, ## args)
87 #ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
88 #define CDEV_LOG_DEBUG(fmt, args...) \
89 RTE_LOG(DEBUG, CRYPTODEV, "%s() line %u: " fmt "\n", \
90 __func__, __LINE__, ## args) \
92 #define CDEV_PMD_TRACE(fmt, args...) \
93 RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s: " fmt "\n", \
94 dev, __func__, ## args)
97 #define CDEV_LOG_DEBUG(fmt, args...)
98 #define CDEV_PMD_TRACE(fmt, args...)
102 * Symmetric Crypto Capability
104 struct rte_cryptodev_symmetric_capability {
105 enum rte_crypto_sym_xform_type xform_type;
106 /**< Transform type : Authentication / Cipher */
109 enum rte_crypto_auth_algorithm algo;
110 /**< authentication algorithm */
112 /**< algorithm block size */
114 uint16_t min; /**< minimum key size */
115 uint16_t max; /**< maximum key size */
117 /**< if a range of sizes are supported,
118 * this parameter is used to indicate
119 * increments in byte size that are supported
120 * between the minimum and maximum */
122 /**< auth key size range */
124 uint16_t min; /**< minimum digest size */
125 uint16_t max; /**< maximum digest size */
127 /**< if a range of sizes are supported,
128 * this parameter is used to indicate
129 * increments in byte size that are supported
130 * between the minimum and maximum */
132 /**< digest size range */
134 uint16_t min; /**< minimum aad size */
135 uint16_t max; /**< maximum aad size */
137 /**< if a range of sizes are supported,
138 * this parameter is used to indicate
139 * increments in byte size that are supported
140 * between the minimum and maximum */
142 /**< Additional authentication data size range */
144 /**< Symmetric Authentication transform capabilities */
146 enum rte_crypto_cipher_algorithm algo;
147 /**< cipher algorithm */
149 /**< algorithm block size */
151 uint16_t min; /**< minimum key size */
152 uint16_t max; /**< maximum key size */
154 /**< if a range of sizes are supported,
155 * this parameter is used to indicate
156 * increments in byte size that are supported
157 * between the minimum and maximum */
159 /**< cipher key size range */
161 uint16_t min; /**< minimum iv size */
162 uint16_t max; /**< maximum iv size */
164 /**< if a range of sizes are supported,
165 * this parameter is used to indicate
166 * increments in byte size that are supported
167 * between the minimum and maximum */
169 /**< Initialisation vector data size range */
171 /**< Symmetric Cipher transform capabilities */
175 /** Structure used to capture a capability of a crypto device */
176 struct rte_cryptodev_capabilities {
177 enum rte_crypto_op_type op;
178 /**< Operation type */
181 struct rte_cryptodev_symmetric_capability sym;
182 /**< Symmetric operation capability parameters */
186 /** Macro used at end of crypto PMD list */
187 #define RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() \
188 { RTE_CRYPTO_OP_TYPE_UNDEFINED }
192 * Crypto device supported feature flags
195 * New features flags should be added to the end of the list
197 * Keep these flags synchronised with rte_cryptodev_get_feature_name()
199 #define RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO (1ULL << 0)
200 /**< Symmetric crypto operations are supported */
201 #define RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO (1ULL << 1)
202 /**< Asymmetric crypto operations are supported */
203 #define RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING (1ULL << 2)
204 /**< Chaining symmetric crypto operations are supported */
205 #define RTE_CRYPTODEV_FF_CPU_SSE (1ULL << 3)
206 /**< Utilises CPU SIMD SSE instructions */
207 #define RTE_CRYPTODEV_FF_CPU_AVX (1ULL << 4)
208 /**< Utilises CPU SIMD AVX instructions */
209 #define RTE_CRYPTODEV_FF_CPU_AVX2 (1ULL << 5)
210 /**< Utilises CPU SIMD AVX2 instructions */
211 #define RTE_CRYPTODEV_FF_CPU_AESNI (1ULL << 6)
212 /**< Utilises CPU AES-NI instructions */
213 #define RTE_CRYPTODEV_FF_HW_ACCELERATED (1ULL << 7)
214 /**< Operations are off-loaded to an external hardware accelerator */
218 * Get the name of a crypto device feature flag
220 * @param flag The mask describing the flag.
223 * The name of this flag, or NULL if it's not a valid feature flag.
227 rte_cryptodev_get_feature_name(uint64_t flag);
229 /** Crypto device information */
230 struct rte_cryptodev_info {
231 const char *driver_name; /**< Driver name. */
232 enum rte_cryptodev_type dev_type; /**< Device type */
233 struct rte_pci_device *pci_dev; /**< PCI information. */
235 uint64_t feature_flags; /**< Feature flags */
237 const struct rte_cryptodev_capabilities *capabilities;
238 /**< Array of devices supported capabilities */
240 unsigned max_nb_queue_pairs;
241 /**< Maximum number of queues pairs supported by device. */
244 unsigned max_nb_sessions;
245 /**< Maximum number of sessions supported by device. */
249 #define RTE_CRYPTODEV_DETACHED (0)
250 #define RTE_CRYPTODEV_ATTACHED (1)
252 /** Definitions of Crypto device event types */
253 enum rte_cryptodev_event_type {
254 RTE_CRYPTODEV_EVENT_UNKNOWN, /**< unknown event type */
255 RTE_CRYPTODEV_EVENT_ERROR, /**< error interrupt event */
256 RTE_CRYPTODEV_EVENT_MAX /**< max value of this enum */
259 /** Crypto device queue pair configuration structure. */
260 struct rte_cryptodev_qp_conf {
261 uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
265 * Typedef for application callback function to be registered by application
266 * software for notification of device events
268 * @param dev_id Crypto device identifier
269 * @param event Crypto device event to register for notification of.
270 * @param cb_arg User specified parameter to be passed as to passed to
271 * users callback function.
273 typedef void (*rte_cryptodev_cb_fn)(uint8_t dev_id,
274 enum rte_cryptodev_event_type event, void *cb_arg);
277 /** Crypto Device statistics */
278 struct rte_cryptodev_stats {
279 uint64_t enqueued_count;
280 /**< Count of all operations enqueued */
281 uint64_t dequeued_count;
282 /**< Count of all operations dequeued */
284 uint64_t enqueue_err_count;
285 /**< Total error count on operations enqueued */
286 uint64_t dequeue_err_count;
287 /**< Total error count on operations dequeued */
290 #define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS 8
291 #define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS 2048
295 * Initialisation parameters for virtual crypto devices
297 struct rte_crypto_vdev_init_params {
298 unsigned max_nb_queue_pairs;
299 unsigned max_nb_sessions;
304 * Parse virtual device initialisation parameters input arguments
307 * @params params Initialisation parameters with defaults set.
308 * @params input_args Command line arguments
311 * 0 on successful parse
312 * <0 on failure to parse
315 rte_cryptodev_parse_vdev_init_params(
316 struct rte_crypto_vdev_init_params *params,
317 const char *input_args);
320 * Create a virtual crypto device
322 * @param name Cryptodev PMD name of device to be created.
323 * @param args Options arguments for device.
326 * - On successful creation of the cryptodev the device index is returned,
327 * which will be between 0 and rte_cryptodev_count().
328 * - In the case of a failure, returns -1.
331 rte_cryptodev_create_vdev(const char *name, const char *args);
334 * Get the device identifier for the named crypto device.
336 * @param name device name to select the device structure.
339 * - Returns crypto device identifier on success.
340 * - Return -1 on failure to find named crypto device.
343 rte_cryptodev_get_dev_id(const char *name);
346 * Get the total number of crypto devices that have been successfully
350 * - The total number of usable crypto devices.
353 rte_cryptodev_count(void);
356 rte_cryptodev_count_devtype(enum rte_cryptodev_type type);
358 * Return the NUMA socket to which a device is connected
361 * The identifier of the device
363 * The NUMA socket id to which the device is connected or
364 * a default of zero if the socket could not be determined.
365 * -1 if returned is the dev_id value is out of range.
368 rte_cryptodev_socket_id(uint8_t dev_id);
370 /** Crypto device configuration structure */
371 struct rte_cryptodev_config {
372 int socket_id; /**< Socket to allocate resources on */
373 uint16_t nb_queue_pairs;
374 /**< Number of queue pairs to configure on device */
377 uint32_t nb_objs; /**< Number of objects in mempool */
378 uint32_t cache_size; /**< l-core object cache size */
379 } session_mp; /**< Session mempool configuration */
383 * Configure a device.
385 * This function must be invoked first before any other function in the
386 * API. This function can also be re-invoked when a device is in the
389 * @param dev_id The identifier of the device to configure.
390 * @param config The crypto device configuration structure.
393 * - 0: Success, device configured.
394 * - <0: Error code returned by the driver configuration function.
397 rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config);
402 * The device start step is the last one and consists of setting the configured
403 * offload features and in starting the transmit and the receive units of the
405 * On success, all basic functions exported by the API (link status,
406 * receive/transmit, and so on) can be invoked.
409 * The identifier of the device.
411 * - 0: Success, device started.
412 * - <0: Error code of the driver device start function.
415 rte_cryptodev_start(uint8_t dev_id);
418 * Stop an device. The device can be restarted with a call to
419 * rte_cryptodev_start()
421 * @param dev_id The identifier of the device.
424 rte_cryptodev_stop(uint8_t dev_id);
427 * Close an device. The device cannot be restarted!
429 * @param dev_id The identifier of the device.
432 * - 0 on successfully closing device
433 * - <0 on failure to close device
436 rte_cryptodev_close(uint8_t dev_id);
439 * Allocate and set up a receive queue pair for a device.
442 * @param dev_id The identifier of the device.
443 * @param queue_pair_id The index of the queue pairs to set up. The
444 * value must be in the range [0, nb_queue_pair
445 * - 1] previously supplied to
446 * rte_cryptodev_configure().
447 * @param qp_conf The pointer to the configuration data to be
448 * used for the queue pair. NULL value is
449 * allowed, in which case default configuration
451 * @param socket_id The *socket_id* argument is the socket
452 * identifier in case of NUMA. The value can be
453 * *SOCKET_ID_ANY* if there is no NUMA constraint
454 * for the DMA memory allocated for the receive
458 * - 0: Success, queue pair correctly set up.
459 * - <0: Queue pair configuration failed
462 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
463 const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
466 * Start a specified queue pair of a device. It is used
467 * when deferred_start flag of the specified queue is true.
469 * @param dev_id The identifier of the device
470 * @param queue_pair_id The index of the queue pair to start. The value
471 * must be in the range [0, nb_queue_pair - 1]
472 * previously supplied to
473 * rte_crypto_dev_configure().
475 * - 0: Success, the transmit queue is correctly set up.
476 * - -EINVAL: The dev_id or the queue_id out of range.
477 * - -ENOTSUP: The function not supported in PMD driver.
480 rte_cryptodev_queue_pair_start(uint8_t dev_id, uint16_t queue_pair_id);
483 * Stop specified queue pair of a device
485 * @param dev_id The identifier of the device
486 * @param queue_pair_id The index of the queue pair to stop. The value
487 * must be in the range [0, nb_queue_pair - 1]
488 * previously supplied to
489 * rte_cryptodev_configure().
491 * - 0: Success, the transmit queue is correctly set up.
492 * - -EINVAL: The dev_id or the queue_id out of range.
493 * - -ENOTSUP: The function not supported in PMD driver.
496 rte_cryptodev_queue_pair_stop(uint8_t dev_id, uint16_t queue_pair_id);
499 * Get the number of queue pairs on a specific crypto device
501 * @param dev_id Crypto device identifier.
503 * - The number of configured queue pairs.
506 rte_cryptodev_queue_pair_count(uint8_t dev_id);
510 * Retrieve the general I/O statistics of a device.
512 * @param dev_id The identifier of the device.
513 * @param stats A pointer to a structure of type
514 * *rte_cryptodev_stats* to be filled with the
515 * values of device counters.
517 * - Zero if successful.
518 * - Non-zero otherwise.
521 rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats);
524 * Reset the general I/O statistics of a device.
526 * @param dev_id The identifier of the device.
529 rte_cryptodev_stats_reset(uint8_t dev_id);
532 * Retrieve the contextual information of a device.
534 * @param dev_id The identifier of the device.
535 * @param dev_info A pointer to a structure of type
536 * *rte_cryptodev_info* to be filled with the
537 * contextual information of the device.
540 rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info);
544 * Register a callback function for specific device id.
546 * @param dev_id Device id.
547 * @param event Event interested.
548 * @param cb_fn User supplied callback function to be called.
549 * @param cb_arg Pointer to the parameters for the registered
553 * - On success, zero.
554 * - On failure, a negative value.
557 rte_cryptodev_callback_register(uint8_t dev_id,
558 enum rte_cryptodev_event_type event,
559 rte_cryptodev_cb_fn cb_fn, void *cb_arg);
562 * Unregister a callback function for specific device id.
564 * @param dev_id The device identifier.
565 * @param event Event interested.
566 * @param cb_fn User supplied callback function to be called.
567 * @param cb_arg Pointer to the parameters for the registered
571 * - On success, zero.
572 * - On failure, a negative value.
575 rte_cryptodev_callback_unregister(uint8_t dev_id,
576 enum rte_cryptodev_event_type event,
577 rte_cryptodev_cb_fn cb_fn, void *cb_arg);
580 typedef uint16_t (*dequeue_pkt_burst_t)(void *qp,
581 struct rte_crypto_op **ops, uint16_t nb_ops);
582 /**< Dequeue processed packets from queue pair of a device. */
584 typedef uint16_t (*enqueue_pkt_burst_t)(void *qp,
585 struct rte_crypto_op **ops, uint16_t nb_ops);
586 /**< Enqueue packets for processing on queue pair of a device. */
591 struct rte_cryptodev_callback;
593 /** Structure to keep track of registered callbacks */
594 TAILQ_HEAD(rte_cryptodev_cb_list, rte_cryptodev_callback);
596 /** The data structure associated with each crypto device. */
597 struct rte_cryptodev {
598 dequeue_pkt_burst_t dequeue_burst;
599 /**< Pointer to PMD receive function. */
600 enqueue_pkt_burst_t enqueue_burst;
601 /**< Pointer to PMD transmit function. */
603 const struct rte_cryptodev_driver *driver;
604 /**< Driver for this device */
605 struct rte_cryptodev_data *data;
606 /**< Pointer to device data */
607 struct rte_cryptodev_ops *dev_ops;
608 /**< Functions exported by PMD */
609 uint64_t feature_flags;
610 /**< Supported features */
611 struct rte_pci_device *pci_dev;
612 /**< PCI info. supplied by probing */
614 enum rte_cryptodev_type dev_type;
615 /**< Crypto device type */
616 enum pmd_type pmd_type;
617 /**< PMD type - PDEV / VDEV */
619 struct rte_cryptodev_cb_list link_intr_cbs;
620 /**< User application callback for interrupts if present */
622 uint8_t attached : 1;
623 /**< Flag indicating the device is attached */
624 } __rte_cache_aligned;
627 #define RTE_CRYPTODEV_NAME_MAX_LEN (64)
628 /**< Max length of name of crypto PMD */
632 * The data part, with no function pointers, associated with each device.
634 * This structure is safe to place in shared memory to be common among
635 * different processes in a multi-process configuration.
637 struct rte_cryptodev_data {
639 /**< Device ID for this instance */
641 /**< Socket ID where memory is allocated */
642 char name[RTE_CRYPTODEV_NAME_MAX_LEN];
643 /**< Unique identifier name */
645 uint8_t dev_started : 1;
646 /**< Device state: STARTED(1)/STOPPED(0) */
648 struct rte_mempool *session_pool;
649 /**< Session memory pool */
651 /**< Array of pointers to queue pairs. */
652 uint16_t nb_queue_pairs;
653 /**< Number of device queue pairs. */
656 /**< PMD-specific private data */
657 } __rte_cache_aligned;
659 extern struct rte_cryptodev *rte_cryptodevs;
662 * Dequeue a burst of processed crypto operations from a queue on the crypto
663 * device. The dequeued operation are stored in *rte_crypto_op* structures
664 * whose pointers are supplied in the *ops* array.
666 * The rte_cryptodev_dequeue_burst() function returns the number of ops
667 * actually dequeued, which is the number of *rte_crypto_op* data structures
668 * effectively supplied into the *ops* array.
670 * A return value equal to *nb_ops* indicates that the queue contained
671 * at least *nb_ops* operations, and this is likely to signify that other
672 * processed operations remain in the devices output queue. Applications
673 * implementing a "retrieve as many processed operations as possible" policy
674 * can check this specific case and keep invoking the
675 * rte_cryptodev_dequeue_burst() function until a value less than
676 * *nb_ops* is returned.
678 * The rte_cryptodev_dequeue_burst() function does not provide any error
679 * notification to avoid the corresponding overhead.
681 * @param dev_id The symmetric crypto device identifier
682 * @param qp_id The index of the queue pair from which to
683 * retrieve processed packets. The value must be
684 * in the range [0, nb_queue_pair - 1] previously
685 * supplied to rte_cryptodev_configure().
686 * @param ops The address of an array of pointers to
687 * *rte_crypto_op* structures that must be
688 * large enough to store *nb_ops* pointers in it.
689 * @param nb_ops The maximum number of operations to dequeue.
692 * - The number of operations actually dequeued, which is the number
693 * of pointers to *rte_crypto_op* structures effectively supplied to the
696 static inline uint16_t
697 rte_cryptodev_dequeue_burst(uint8_t dev_id, uint16_t qp_id,
698 struct rte_crypto_op **ops, uint16_t nb_ops)
700 struct rte_cryptodev *dev = &rte_cryptodevs[dev_id];
702 nb_ops = (*dev->dequeue_burst)
703 (dev->data->queue_pairs[qp_id], ops, nb_ops);
709 * Enqueue a burst of operations for processing on a crypto device.
711 * The rte_cryptodev_enqueue_burst() function is invoked to place
712 * crypto operations on the queue *qp_id* of the device designated by
715 * The *nb_ops* parameter is the number of operations to process which are
716 * supplied in the *ops* array of *rte_crypto_op* structures.
718 * The rte_cryptodev_enqueue_burst() function returns the number of
719 * operations it actually enqueued for processing. A return value equal to
720 * *nb_ops* means that all packets have been enqueued.
722 * @param dev_id The identifier of the device.
723 * @param qp_id The index of the queue pair which packets are
724 * to be enqueued for processing. The value
725 * must be in the range [0, nb_queue_pairs - 1]
726 * previously supplied to
727 * *rte_cryptodev_configure*.
728 * @param ops The address of an array of *nb_ops* pointers
729 * to *rte_crypto_op* structures which contain
730 * the crypto operations to be processed.
731 * @param nb_ops The number of operations to process.
734 * The number of operations actually enqueued on the crypto device. The return
735 * value can be less than the value of the *nb_ops* parameter when the
736 * crypto devices queue is full or if invalid parameters are specified in
739 static inline uint16_t
740 rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
741 struct rte_crypto_op **ops, uint16_t nb_ops)
743 struct rte_cryptodev *dev = &rte_cryptodevs[dev_id];
745 return (*dev->enqueue_burst)(
746 dev->data->queue_pairs[qp_id], ops, nb_ops);
750 /** Cryptodev symmetric crypto session */
751 struct rte_cryptodev_sym_session {
755 enum rte_cryptodev_type dev_type;
756 /** Crypto Device type session created on */
757 struct rte_mempool *mp;
758 /**< Mempool session allocated from */
760 /**< Public symmetric session details */
763 /**< Private session material */
768 * Initialise a session for symmetric cryptographic operations.
770 * This function is used by the client to initialize immutable
771 * parameters of symmetric cryptographic operation.
772 * To perform the operation the rte_cryptodev_enqueue_burst function is
773 * used. Each mbuf should contain a reference to the session
774 * pointer returned from this function contained within it's crypto_op if a
775 * session-based operation is being provisioned. Memory to contain the session
776 * information is allocated from within mempool managed by the cryptodev.
778 * The rte_cryptodev_session_free must be called to free allocated
779 * memory when the session is no longer required.
781 * @param dev_id The device identifier.
782 * @param xform Crypto transform chain.
786 * Pointer to the created session or NULL
788 extern struct rte_cryptodev_sym_session *
789 rte_cryptodev_sym_session_create(uint8_t dev_id,
790 struct rte_crypto_sym_xform *xform);
793 * Free the memory associated with a previously allocated session.
795 * @param dev_id The device identifier.
796 * @param session Session pointer previously allocated by
797 * *rte_cryptodev_sym_session_create*.
800 * NULL on successful freeing of session.
801 * Session pointer on failure to free session.
803 extern struct rte_cryptodev_sym_session *
804 rte_cryptodev_sym_session_free(uint8_t dev_id,
805 struct rte_cryptodev_sym_session *session);
812 #endif /* _RTE_CRYPTODEV_H_ */