test mbuf attach
[dpdk.git] / lib / librte_cryptodev / rte_cryptodev.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2015-2020 Intel Corporation.
3  */
4
5 #ifndef _RTE_CRYPTODEV_H_
6 #define _RTE_CRYPTODEV_H_
7
8 /**
9  * @file rte_cryptodev.h
10  *
11  * RTE Cryptographic Device APIs
12  *
13  * Defines RTE Crypto Device APIs for the provisioning of cipher and
14  * authentication operations.
15  */
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 #include "rte_kvargs.h"
22 #include "rte_crypto.h"
23 #include "rte_dev.h"
24 #include <rte_common.h>
25 #include <rte_config.h>
26
27 #include "rte_cryptodev_trace_fp.h"
28
29 extern const char **rte_cyptodev_names;
30
31 /* Logging Macros */
32
33 #define CDEV_LOG_ERR(...) \
34         RTE_LOG(ERR, CRYPTODEV, \
35                 RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
36                         __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
37
38 #define CDEV_LOG_INFO(...) \
39         RTE_LOG(INFO, CRYPTODEV, \
40                 RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
41                         RTE_FMT_TAIL(__VA_ARGS__,)))
42
43 #define CDEV_LOG_DEBUG(...) \
44         RTE_LOG(DEBUG, CRYPTODEV, \
45                 RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
46                         __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
47
48 #define CDEV_PMD_TRACE(...) \
49         RTE_LOG(DEBUG, CRYPTODEV, \
50                 RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
51                         dev, __func__, RTE_FMT_TAIL(__VA_ARGS__,)))
52
53 /**
54  * A macro that points to an offset from the start
55  * of the crypto operation structure (rte_crypto_op)
56  *
57  * The returned pointer is cast to type t.
58  *
59  * @param c
60  *   The crypto operation.
61  * @param o
62  *   The offset from the start of the crypto operation.
63  * @param t
64  *   The type to cast the result into.
65  */
66 #define rte_crypto_op_ctod_offset(c, t, o)      \
67         ((t)((char *)(c) + (o)))
68
69 /**
70  * A macro that returns the physical address that points
71  * to an offset from the start of the crypto operation
72  * (rte_crypto_op)
73  *
74  * @param c
75  *   The crypto operation.
76  * @param o
77  *   The offset from the start of the crypto operation
78  *   to calculate address from.
79  */
80 #define rte_crypto_op_ctophys_offset(c, o)      \
81         (rte_iova_t)((c)->phys_addr + (o))
82
83 /**
84  * Crypto parameters range description
85  */
86 struct rte_crypto_param_range {
87         uint16_t min;   /**< minimum size */
88         uint16_t max;   /**< maximum size */
89         uint16_t increment;
90         /**< if a range of sizes are supported,
91          * this parameter is used to indicate
92          * increments in byte size that are supported
93          * between the minimum and maximum
94          */
95 };
96
97 /**
98  * Symmetric Crypto Capability
99  */
100 struct rte_cryptodev_symmetric_capability {
101         enum rte_crypto_sym_xform_type xform_type;
102         /**< Transform type : Authentication / Cipher / AEAD */
103         RTE_STD_C11
104         union {
105                 struct {
106                         enum rte_crypto_auth_algorithm algo;
107                         /**< authentication algorithm */
108                         uint16_t block_size;
109                         /**< algorithm block size */
110                         struct rte_crypto_param_range key_size;
111                         /**< auth key size range */
112                         struct rte_crypto_param_range digest_size;
113                         /**< digest size range */
114                         struct rte_crypto_param_range aad_size;
115                         /**< Additional authentication data size range */
116                         struct rte_crypto_param_range iv_size;
117                         /**< Initialisation vector data size range */
118                 } auth;
119                 /**< Symmetric Authentication transform capabilities */
120                 struct {
121                         enum rte_crypto_cipher_algorithm algo;
122                         /**< cipher algorithm */
123                         uint16_t block_size;
124                         /**< algorithm block size */
125                         struct rte_crypto_param_range key_size;
126                         /**< cipher key size range */
127                         struct rte_crypto_param_range iv_size;
128                         /**< Initialisation vector data size range */
129                 } cipher;
130                 /**< Symmetric Cipher transform capabilities */
131                 struct {
132                         enum rte_crypto_aead_algorithm algo;
133                         /**< AEAD algorithm */
134                         uint16_t block_size;
135                         /**< algorithm block size */
136                         struct rte_crypto_param_range key_size;
137                         /**< AEAD key size range */
138                         struct rte_crypto_param_range digest_size;
139                         /**< digest size range */
140                         struct rte_crypto_param_range aad_size;
141                         /**< Additional authentication data size range */
142                         struct rte_crypto_param_range iv_size;
143                         /**< Initialisation vector data size range */
144                 } aead;
145         };
146 };
147
148 /**
149  * Asymmetric Xform Crypto Capability
150  *
151  */
152 struct rte_cryptodev_asymmetric_xform_capability {
153         enum rte_crypto_asym_xform_type xform_type;
154         /**< Transform type: RSA/MODEXP/DH/DSA/MODINV */
155
156         uint32_t op_types;
157         /**< bitmask for supported rte_crypto_asym_op_type */
158
159         __extension__
160         union {
161                 struct rte_crypto_param_range modlen;
162                 /**< Range of modulus length supported by modulus based xform.
163                  * Value 0 mean implementation default
164                  */
165         };
166 };
167
168 /**
169  * Asymmetric Crypto Capability
170  *
171  */
172 struct rte_cryptodev_asymmetric_capability {
173         struct rte_cryptodev_asymmetric_xform_capability xform_capa;
174 };
175
176
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 */
181
182         RTE_STD_C11
183         union {
184                 struct rte_cryptodev_symmetric_capability sym;
185                 /**< Symmetric operation capability parameters */
186                 struct rte_cryptodev_asymmetric_capability asym;
187                 /**< Asymmetric operation capability parameters */
188         };
189 };
190
191 /** Structure used to describe crypto algorithms */
192 struct rte_cryptodev_sym_capability_idx {
193         enum rte_crypto_sym_xform_type type;
194         union {
195                 enum rte_crypto_cipher_algorithm cipher;
196                 enum rte_crypto_auth_algorithm auth;
197                 enum rte_crypto_aead_algorithm aead;
198         } algo;
199 };
200
201 /**
202  * Structure used to describe asymmetric crypto xforms
203  * Each xform maps to one asym algorithm.
204  *
205  */
206 struct rte_cryptodev_asym_capability_idx {
207         enum rte_crypto_asym_xform_type type;
208         /**< Asymmetric xform (algo) type */
209 };
210
211 /**
212  * Provide capabilities available for defined device and algorithm
213  *
214  * @param       dev_id          The identifier of the device.
215  * @param       idx             Description of crypto algorithms.
216  *
217  * @return
218  *   - Return description of the symmetric crypto capability if exist.
219  *   - Return NULL if the capability not exist.
220  */
221 const struct rte_cryptodev_symmetric_capability *
222 rte_cryptodev_sym_capability_get_v20(uint8_t dev_id,
223                 const struct rte_cryptodev_sym_capability_idx *idx);
224
225 const struct rte_cryptodev_symmetric_capability *
226 rte_cryptodev_sym_capability_get_v21(uint8_t dev_id,
227                 const struct rte_cryptodev_sym_capability_idx *idx);
228
229 const struct rte_cryptodev_symmetric_capability *
230 rte_cryptodev_sym_capability_get(uint8_t dev_id,
231                 const struct rte_cryptodev_sym_capability_idx *idx);
232
233 /**
234  *  Provide capabilities available for defined device and xform
235  *
236  * @param       dev_id          The identifier of the device.
237  * @param       idx             Description of asym crypto xform.
238  *
239  * @return
240  *   - Return description of the asymmetric crypto capability if exist.
241  *   - Return NULL if the capability not exist.
242  */
243 __rte_experimental
244 const struct rte_cryptodev_asymmetric_xform_capability *
245 rte_cryptodev_asym_capability_get(uint8_t dev_id,
246                 const struct rte_cryptodev_asym_capability_idx *idx);
247
248 /**
249  * Check if key size and initial vector are supported
250  * in crypto cipher capability
251  *
252  * @param       capability      Description of the symmetric crypto capability.
253  * @param       key_size        Cipher key size.
254  * @param       iv_size         Cipher initial vector size.
255  *
256  * @return
257  *   - Return 0 if the parameters are in range of the capability.
258  *   - Return -1 if the parameters are out of range of the capability.
259  */
260 int
261 rte_cryptodev_sym_capability_check_cipher(
262                 const struct rte_cryptodev_symmetric_capability *capability,
263                 uint16_t key_size, uint16_t iv_size);
264
265 /**
266  * Check if key size and initial vector are supported
267  * in crypto auth capability
268  *
269  * @param       capability      Description of the symmetric crypto capability.
270  * @param       key_size        Auth key size.
271  * @param       digest_size     Auth digest size.
272  * @param       iv_size         Auth initial vector size.
273  *
274  * @return
275  *   - Return 0 if the parameters are in range of the capability.
276  *   - Return -1 if the parameters are out of range of the capability.
277  */
278 int
279 rte_cryptodev_sym_capability_check_auth(
280                 const struct rte_cryptodev_symmetric_capability *capability,
281                 uint16_t key_size, uint16_t digest_size, uint16_t iv_size);
282
283 /**
284  * Check if key, digest, AAD and initial vector sizes are supported
285  * in crypto AEAD capability
286  *
287  * @param       capability      Description of the symmetric crypto capability.
288  * @param       key_size        AEAD key size.
289  * @param       digest_size     AEAD digest size.
290  * @param       aad_size        AEAD AAD size.
291  * @param       iv_size         AEAD IV size.
292  *
293  * @return
294  *   - Return 0 if the parameters are in range of the capability.
295  *   - Return -1 if the parameters are out of range of the capability.
296  */
297 int
298 rte_cryptodev_sym_capability_check_aead(
299                 const struct rte_cryptodev_symmetric_capability *capability,
300                 uint16_t key_size, uint16_t digest_size, uint16_t aad_size,
301                 uint16_t iv_size);
302
303 /**
304  * Check if op type is supported
305  *
306  * @param       capability      Description of the asymmetric crypto capability.
307  * @param       op_type         op type
308  *
309  * @return
310  *   - Return 1 if the op type is supported
311  *   - Return 0 if unsupported
312  */
313 __rte_experimental
314 int
315 rte_cryptodev_asym_xform_capability_check_optype(
316         const struct rte_cryptodev_asymmetric_xform_capability *capability,
317                 enum rte_crypto_asym_op_type op_type);
318
319 /**
320  * Check if modulus length is in supported range
321  *
322  * @param       capability      Description of the asymmetric crypto capability.
323  * @param       modlen          modulus length.
324  *
325  * @return
326  *   - Return 0 if the parameters are in range of the capability.
327  *   - Return -1 if the parameters are out of range of the capability.
328  */
329 __rte_experimental
330 int
331 rte_cryptodev_asym_xform_capability_check_modlen(
332         const struct rte_cryptodev_asymmetric_xform_capability *capability,
333                 uint16_t modlen);
334
335 /**
336  * Provide the cipher algorithm enum, given an algorithm string
337  *
338  * @param       algo_enum       A pointer to the cipher algorithm
339  *                              enum to be filled
340  * @param       algo_string     Authentication algo string
341  *
342  * @return
343  * - Return -1 if string is not valid
344  * - Return 0 is the string is valid
345  */
346 int
347 rte_cryptodev_get_cipher_algo_enum(enum rte_crypto_cipher_algorithm *algo_enum,
348                 const char *algo_string);
349
350 /**
351  * Provide the authentication algorithm enum, given an algorithm string
352  *
353  * @param       algo_enum       A pointer to the authentication algorithm
354  *                              enum to be filled
355  * @param       algo_string     Authentication algo string
356  *
357  * @return
358  * - Return -1 if string is not valid
359  * - Return 0 is the string is valid
360  */
361 int
362 rte_cryptodev_get_auth_algo_enum(enum rte_crypto_auth_algorithm *algo_enum,
363                 const char *algo_string);
364
365 /**
366  * Provide the AEAD algorithm enum, given an algorithm string
367  *
368  * @param       algo_enum       A pointer to the AEAD algorithm
369  *                              enum to be filled
370  * @param       algo_string     AEAD algorithm string
371  *
372  * @return
373  * - Return -1 if string is not valid
374  * - Return 0 is the string is valid
375  */
376 int
377 rte_cryptodev_get_aead_algo_enum(enum rte_crypto_aead_algorithm *algo_enum,
378                 const char *algo_string);
379
380 /**
381  * Provide the Asymmetric xform enum, given an xform string
382  *
383  * @param       xform_enum      A pointer to the xform type
384  *                              enum to be filled
385  * @param       xform_string    xform string
386  *
387  * @return
388  * - Return -1 if string is not valid
389  * - Return 0 if the string is valid
390  */
391 __rte_experimental
392 int
393 rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,
394                 const char *xform_string);
395
396
397 /** Macro used at end of crypto PMD list */
398 #define RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() \
399         { RTE_CRYPTO_OP_TYPE_UNDEFINED }
400
401
402 /**
403  * Crypto device supported feature flags
404  *
405  * Note:
406  * New features flags should be added to the end of the list
407  *
408  * Keep these flags synchronised with rte_cryptodev_get_feature_name()
409  */
410 #define RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO               (1ULL << 0)
411 /**< Symmetric crypto operations are supported */
412 #define RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO              (1ULL << 1)
413 /**< Asymmetric crypto operations are supported */
414 #define RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING         (1ULL << 2)
415 /**< Chaining symmetric crypto operations are supported */
416 #define RTE_CRYPTODEV_FF_CPU_SSE                        (1ULL << 3)
417 /**< Utilises CPU SIMD SSE instructions */
418 #define RTE_CRYPTODEV_FF_CPU_AVX                        (1ULL << 4)
419 /**< Utilises CPU SIMD AVX instructions */
420 #define RTE_CRYPTODEV_FF_CPU_AVX2                       (1ULL << 5)
421 /**< Utilises CPU SIMD AVX2 instructions */
422 #define RTE_CRYPTODEV_FF_CPU_AESNI                      (1ULL << 6)
423 /**< Utilises CPU AES-NI instructions */
424 #define RTE_CRYPTODEV_FF_HW_ACCELERATED                 (1ULL << 7)
425 /**< Operations are off-loaded to an
426  * external hardware accelerator
427  */
428 #define RTE_CRYPTODEV_FF_CPU_AVX512                     (1ULL << 8)
429 /**< Utilises CPU SIMD AVX512 instructions */
430 #define RTE_CRYPTODEV_FF_IN_PLACE_SGL                   (1ULL << 9)
431 /**< In-place Scatter-gather (SGL) buffers, with multiple segments,
432  * are supported
433  */
434 #define RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT             (1ULL << 10)
435 /**< Out-of-place Scatter-gather (SGL) buffers are
436  * supported in input and output
437  */
438 #define RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT              (1ULL << 11)
439 /**< Out-of-place Scatter-gather (SGL) buffers are supported
440  * in input, combined with linear buffers (LB), with a
441  * single segment in output
442  */
443 #define RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT              (1ULL << 12)
444 /**< Out-of-place Scatter-gather (SGL) buffers are supported
445  * in output, combined with linear buffers (LB) in input
446  */
447 #define RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT               (1ULL << 13)
448 /**< Out-of-place linear buffers (LB) are supported in input and output */
449 #define RTE_CRYPTODEV_FF_CPU_NEON                       (1ULL << 14)
450 /**< Utilises CPU NEON instructions */
451 #define RTE_CRYPTODEV_FF_CPU_ARM_CE                     (1ULL << 15)
452 /**< Utilises ARM CPU Cryptographic Extensions */
453 #define RTE_CRYPTODEV_FF_SECURITY                       (1ULL << 16)
454 /**< Support Security Protocol Processing */
455 #define RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP            (1ULL << 17)
456 /**< Support RSA Private Key OP with exponent */
457 #define RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT             (1ULL << 18)
458 /**< Support RSA Private Key OP with CRT (quintuple) Keys */
459 #define RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED               (1ULL << 19)
460 /**< Support encrypted-digest operations where digest is appended to data */
461 #define RTE_CRYPTODEV_FF_ASYM_SESSIONLESS               (1ULL << 20)
462 /**< Support asymmetric session-less operations */
463 #define RTE_CRYPTODEV_FF_SYM_CPU_CRYPTO                 (1ULL << 21)
464 /**< Support symmetric cpu-crypto processing */
465 #define RTE_CRYPTODEV_FF_SYM_SESSIONLESS                (1ULL << 22)
466 /**< Support symmetric session-less operations */
467 #define RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA          (1ULL << 23)
468 /**< Support operations on data which is not byte aligned */
469
470
471 /**
472  * Get the name of a crypto device feature flag
473  *
474  * @param       flag    The mask describing the flag.
475  *
476  * @return
477  *   The name of this flag, or NULL if it's not a valid feature flag.
478  */
479
480 extern const char *
481 rte_cryptodev_get_feature_name(uint64_t flag);
482
483 /**  Crypto device information */
484 struct rte_cryptodev_info {
485         const char *driver_name;        /**< Driver name. */
486         uint8_t driver_id;              /**< Driver identifier */
487         struct rte_device *device;      /**< Generic device information. */
488
489         uint64_t feature_flags;
490         /**< Feature flags exposes HW/SW features for the given device */
491
492         const struct rte_cryptodev_capabilities *capabilities;
493         /**< Array of devices supported capabilities */
494
495         unsigned max_nb_queue_pairs;
496         /**< Maximum number of queues pairs supported by device. */
497
498         uint16_t min_mbuf_headroom_req;
499         /**< Minimum mbuf headroom required by device */
500
501         uint16_t min_mbuf_tailroom_req;
502         /**< Minimum mbuf tailroom required by device */
503
504         struct {
505                 unsigned max_nb_sessions;
506                 /**< Maximum number of sessions supported by device.
507                  * If 0, the device does not have any limitation in
508                  * number of sessions that can be used.
509                  */
510         } sym;
511 };
512
513 #define RTE_CRYPTODEV_DETACHED  (0)
514 #define RTE_CRYPTODEV_ATTACHED  (1)
515
516 /** Definitions of Crypto device event types */
517 enum rte_cryptodev_event_type {
518         RTE_CRYPTODEV_EVENT_UNKNOWN,    /**< unknown event type */
519         RTE_CRYPTODEV_EVENT_ERROR,      /**< error interrupt event */
520         RTE_CRYPTODEV_EVENT_MAX         /**< max value of this enum */
521 };
522
523 /** Crypto device queue pair configuration structure. */
524 struct rte_cryptodev_qp_conf {
525         uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
526         struct rte_mempool *mp_session;
527         /**< The mempool for creating session in sessionless mode */
528         struct rte_mempool *mp_session_private;
529         /**< The mempool for creating sess private data in sessionless mode */
530 };
531
532 /**
533  * Typedef for application callback function to be registered by application
534  * software for notification of device events
535  *
536  * @param       dev_id  Crypto device identifier
537  * @param       event   Crypto device event to register for notification of.
538  * @param       cb_arg  User specified parameter to be passed as to passed to
539  *                      users callback function.
540  */
541 typedef void (*rte_cryptodev_cb_fn)(uint8_t dev_id,
542                 enum rte_cryptodev_event_type event, void *cb_arg);
543
544
545 /** Crypto Device statistics */
546 struct rte_cryptodev_stats {
547         uint64_t enqueued_count;
548         /**< Count of all operations enqueued */
549         uint64_t dequeued_count;
550         /**< Count of all operations dequeued */
551
552         uint64_t enqueue_err_count;
553         /**< Total error count on operations enqueued */
554         uint64_t dequeue_err_count;
555         /**< Total error count on operations dequeued */
556 };
557
558 #define RTE_CRYPTODEV_NAME_MAX_LEN      (64)
559 /**< Max length of name of crypto PMD */
560
561 /**
562  * Get the device identifier for the named crypto device.
563  *
564  * @param       name    device name to select the device structure.
565  *
566  * @return
567  *   - Returns crypto device identifier on success.
568  *   - Return -1 on failure to find named crypto device.
569  */
570 extern int
571 rte_cryptodev_get_dev_id(const char *name);
572
573 /**
574  * Get the crypto device name given a device identifier.
575  *
576  * @param dev_id
577  *   The identifier of the device
578  *
579  * @return
580  *   - Returns crypto device name.
581  *   - Returns NULL if crypto device is not present.
582  */
583 extern const char *
584 rte_cryptodev_name_get(uint8_t dev_id);
585
586 /**
587  * Get the total number of crypto devices that have been successfully
588  * initialised.
589  *
590  * @return
591  *   - The total number of usable crypto devices.
592  */
593 extern uint8_t
594 rte_cryptodev_count(void);
595
596 /**
597  * Get number of crypto device defined type.
598  *
599  * @param       driver_id       driver identifier.
600  *
601  * @return
602  *   Returns number of crypto device.
603  */
604 extern uint8_t
605 rte_cryptodev_device_count_by_driver(uint8_t driver_id);
606
607 /**
608  * Get number and identifiers of attached crypto devices that
609  * use the same crypto driver.
610  *
611  * @param       driver_name     driver name.
612  * @param       devices         output devices identifiers.
613  * @param       nb_devices      maximal number of devices.
614  *
615  * @return
616  *   Returns number of attached crypto device.
617  */
618 uint8_t
619 rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
620                 uint8_t nb_devices);
621 /*
622  * Return the NUMA socket to which a device is connected
623  *
624  * @param dev_id
625  *   The identifier of the device
626  * @return
627  *   The NUMA socket id to which the device is connected or
628  *   a default of zero if the socket could not be determined.
629  *   -1 if returned is the dev_id value is out of range.
630  */
631 extern int
632 rte_cryptodev_socket_id(uint8_t dev_id);
633
634 /** Crypto device configuration structure */
635 struct rte_cryptodev_config {
636         int socket_id;                  /**< Socket to allocate resources on */
637         uint16_t nb_queue_pairs;
638         /**< Number of queue pairs to configure on device */
639         uint64_t ff_disable;
640         /**< Feature flags to be disabled. Only the following features are
641          * allowed to be disabled,
642          *  - RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO
643          *  - RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO
644          *  - RTE_CRYTPODEV_FF_SECURITY
645          */
646 };
647
648 /**
649  * Configure a device.
650  *
651  * This function must be invoked first before any other function in the
652  * API. This function can also be re-invoked when a device is in the
653  * stopped state.
654  *
655  * @param       dev_id          The identifier of the device to configure.
656  * @param       config          The crypto device configuration structure.
657  *
658  * @return
659  *   - 0: Success, device configured.
660  *   - <0: Error code returned by the driver configuration function.
661  */
662 extern int
663 rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config);
664
665 /**
666  * Start an device.
667  *
668  * The device start step is the last one and consists of setting the configured
669  * offload features and in starting the transmit and the receive units of the
670  * device.
671  * On success, all basic functions exported by the API (link status,
672  * receive/transmit, and so on) can be invoked.
673  *
674  * @param dev_id
675  *   The identifier of the device.
676  * @return
677  *   - 0: Success, device started.
678  *   - <0: Error code of the driver device start function.
679  */
680 extern int
681 rte_cryptodev_start(uint8_t dev_id);
682
683 /**
684  * Stop an device. The device can be restarted with a call to
685  * rte_cryptodev_start()
686  *
687  * @param       dev_id          The identifier of the device.
688  */
689 extern void
690 rte_cryptodev_stop(uint8_t dev_id);
691
692 /**
693  * Close an device. The device cannot be restarted!
694  *
695  * @param       dev_id          The identifier of the device.
696  *
697  * @return
698  *  - 0 on successfully closing device
699  *  - <0 on failure to close device
700  */
701 extern int
702 rte_cryptodev_close(uint8_t dev_id);
703
704 /**
705  * Allocate and set up a receive queue pair for a device.
706  *
707  *
708  * @param       dev_id          The identifier of the device.
709  * @param       queue_pair_id   The index of the queue pairs to set up. The
710  *                              value must be in the range [0, nb_queue_pair
711  *                              - 1] previously supplied to
712  *                              rte_cryptodev_configure().
713  * @param       qp_conf         The pointer to the configuration data to be
714  *                              used for the queue pair.
715  * @param       socket_id       The *socket_id* argument is the socket
716  *                              identifier in case of NUMA. The value can be
717  *                              *SOCKET_ID_ANY* if there is no NUMA constraint
718  *                              for the DMA memory allocated for the receive
719  *                              queue pair.
720  *
721  * @return
722  *   - 0: Success, queue pair correctly set up.
723  *   - <0: Queue pair configuration failed
724  */
725 extern int
726 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
727                 const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
728
729 /**
730  * Get the status of queue pairs setup on a specific crypto device
731  *
732  * @param       dev_id          Crypto device identifier.
733  * @param       queue_pair_id   The index of the queue pairs to set up. The
734  *                              value must be in the range [0, nb_queue_pair
735  *                              - 1] previously supplied to
736  *                              rte_cryptodev_configure().
737  * @return
738  *   - 0: qp was not configured
739  *       - 1: qp was configured
740  *       - -EINVAL: device was not configured
741  */
742 __rte_experimental
743 int
744 rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id);
745
746 /**
747  * Get the number of queue pairs on a specific crypto device
748  *
749  * @param       dev_id          Crypto device identifier.
750  * @return
751  *   - The number of configured queue pairs.
752  */
753 extern uint16_t
754 rte_cryptodev_queue_pair_count(uint8_t dev_id);
755
756
757 /**
758  * Retrieve the general I/O statistics of a device.
759  *
760  * @param       dev_id          The identifier of the device.
761  * @param       stats           A pointer to a structure of type
762  *                              *rte_cryptodev_stats* to be filled with the
763  *                              values of device counters.
764  * @return
765  *   - Zero if successful.
766  *   - Non-zero otherwise.
767  */
768 extern int
769 rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats);
770
771 /**
772  * Reset the general I/O statistics of a device.
773  *
774  * @param       dev_id          The identifier of the device.
775  */
776 extern void
777 rte_cryptodev_stats_reset(uint8_t dev_id);
778
779 /**
780  * Retrieve the contextual information of a device.
781  *
782  * @param       dev_id          The identifier of the device.
783  * @param       dev_info        A pointer to a structure of type
784  *                              *rte_cryptodev_info* to be filled with the
785  *                              contextual information of the device.
786  *
787  * @note The capabilities field of dev_info is set to point to the first
788  * element of an array of struct rte_cryptodev_capabilities. The element after
789  * the last valid element has it's op field set to
790  * RTE_CRYPTO_OP_TYPE_UNDEFINED.
791  */
792
793 void
794 rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info);
795
796 /* An extra element RTE_CRYPTO_AEAD_CHACHA20_POLY1305 is added
797  * to enum rte_crypto_aead_algorithm, also changing the value of
798  *  RTE_CRYPTO_AEAD_LIST_END. To maintain ABI compatibility with applications
799  * which linked against earlier versions, preventing them, for example, from
800  * picking up the new value and using it to index into an array sized too small
801  * for it, it is necessary to have two versions of rte_cryptodev_info_get()
802  * The latest version just returns directly the capabilities retrieved from
803  * the device. The compatible version inspects the capabilities retrieved
804  * from the device, but only returns them directly if the new value
805  * is not included. If the new value is included, it allocates space
806  * for a copy of the device capabilities, trims the new value from this
807  * and returns this copy. It only needs to do this once per device.
808  * For the corner case of a corner case when the alloc may fail,
809  * an empty capability list is returned, as there is no mechanism to return
810  * an error and adding such a mechanism would itself be an ABI breakage.
811  * The compatible version can be removed after the next major ABI release.
812  */
813
814 void
815 rte_cryptodev_info_get_v20(uint8_t dev_id, struct rte_cryptodev_info *dev_info);
816
817 void
818 rte_cryptodev_info_get_v21(uint8_t dev_id, struct rte_cryptodev_info *dev_info);
819
820 /**
821  * Register a callback function for specific device id.
822  *
823  * @param       dev_id          Device id.
824  * @param       event           Event interested.
825  * @param       cb_fn           User supplied callback function to be called.
826  * @param       cb_arg          Pointer to the parameters for the registered
827  *                              callback.
828  *
829  * @return
830  *  - On success, zero.
831  *  - On failure, a negative value.
832  */
833 extern int
834 rte_cryptodev_callback_register(uint8_t dev_id,
835                 enum rte_cryptodev_event_type event,
836                 rte_cryptodev_cb_fn cb_fn, void *cb_arg);
837
838 /**
839  * Unregister a callback function for specific device id.
840  *
841  * @param       dev_id          The device identifier.
842  * @param       event           Event interested.
843  * @param       cb_fn           User supplied callback function to be called.
844  * @param       cb_arg          Pointer to the parameters for the registered
845  *                              callback.
846  *
847  * @return
848  *  - On success, zero.
849  *  - On failure, a negative value.
850  */
851 extern int
852 rte_cryptodev_callback_unregister(uint8_t dev_id,
853                 enum rte_cryptodev_event_type event,
854                 rte_cryptodev_cb_fn cb_fn, void *cb_arg);
855
856
857 typedef uint16_t (*dequeue_pkt_burst_t)(void *qp,
858                 struct rte_crypto_op **ops,     uint16_t nb_ops);
859 /**< Dequeue processed packets from queue pair of a device. */
860
861 typedef uint16_t (*enqueue_pkt_burst_t)(void *qp,
862                 struct rte_crypto_op **ops,     uint16_t nb_ops);
863 /**< Enqueue packets for processing on queue pair of a device. */
864
865
866
867
868 struct rte_cryptodev_callback;
869
870 /** Structure to keep track of registered callbacks */
871 TAILQ_HEAD(rte_cryptodev_cb_list, rte_cryptodev_callback);
872
873 /** The data structure associated with each crypto device. */
874 struct rte_cryptodev {
875         dequeue_pkt_burst_t dequeue_burst;
876         /**< Pointer to PMD receive function. */
877         enqueue_pkt_burst_t enqueue_burst;
878         /**< Pointer to PMD transmit function. */
879
880         struct rte_cryptodev_data *data;
881         /**< Pointer to device data */
882         struct rte_cryptodev_ops *dev_ops;
883         /**< Functions exported by PMD */
884         uint64_t feature_flags;
885         /**< Feature flags exposes HW/SW features for the given device */
886         struct rte_device *device;
887         /**< Backing device */
888
889         uint8_t driver_id;
890         /**< Crypto driver identifier*/
891
892         struct rte_cryptodev_cb_list link_intr_cbs;
893         /**< User application callback for interrupts if present */
894
895         void *security_ctx;
896         /**< Context for security ops */
897
898         __extension__
899         uint8_t attached : 1;
900         /**< Flag indicating the device is attached */
901 } __rte_cache_aligned;
902
903 void *
904 rte_cryptodev_get_sec_ctx(uint8_t dev_id);
905
906 /**
907  *
908  * The data part, with no function pointers, associated with each device.
909  *
910  * This structure is safe to place in shared memory to be common among
911  * different processes in a multi-process configuration.
912  */
913 struct rte_cryptodev_data {
914         uint8_t dev_id;
915         /**< Device ID for this instance */
916         uint8_t socket_id;
917         /**< Socket ID where memory is allocated */
918         char name[RTE_CRYPTODEV_NAME_MAX_LEN];
919         /**< Unique identifier name */
920
921         __extension__
922         uint8_t dev_started : 1;
923         /**< Device state: STARTED(1)/STOPPED(0) */
924
925         struct rte_mempool *session_pool;
926         /**< Session memory pool */
927         void **queue_pairs;
928         /**< Array of pointers to queue pairs. */
929         uint16_t nb_queue_pairs;
930         /**< Number of device queue pairs. */
931
932         void *dev_private;
933         /**< PMD-specific private data */
934 } __rte_cache_aligned;
935
936 extern struct rte_cryptodev *rte_cryptodevs;
937 /**
938  *
939  * Dequeue a burst of processed crypto operations from a queue on the crypto
940  * device. The dequeued operation are stored in *rte_crypto_op* structures
941  * whose pointers are supplied in the *ops* array.
942  *
943  * The rte_cryptodev_dequeue_burst() function returns the number of ops
944  * actually dequeued, which is the number of *rte_crypto_op* data structures
945  * effectively supplied into the *ops* array.
946  *
947  * A return value equal to *nb_ops* indicates that the queue contained
948  * at least *nb_ops* operations, and this is likely to signify that other
949  * processed operations remain in the devices output queue. Applications
950  * implementing a "retrieve as many processed operations as possible" policy
951  * can check this specific case and keep invoking the
952  * rte_cryptodev_dequeue_burst() function until a value less than
953  * *nb_ops* is returned.
954  *
955  * The rte_cryptodev_dequeue_burst() function does not provide any error
956  * notification to avoid the corresponding overhead.
957  *
958  * @param       dev_id          The symmetric crypto device identifier
959  * @param       qp_id           The index of the queue pair from which to
960  *                              retrieve processed packets. The value must be
961  *                              in the range [0, nb_queue_pair - 1] previously
962  *                              supplied to rte_cryptodev_configure().
963  * @param       ops             The address of an array of pointers to
964  *                              *rte_crypto_op* structures that must be
965  *                              large enough to store *nb_ops* pointers in it.
966  * @param       nb_ops          The maximum number of operations to dequeue.
967  *
968  * @return
969  *   - The number of operations actually dequeued, which is the number
970  *   of pointers to *rte_crypto_op* structures effectively supplied to the
971  *   *ops* array.
972  */
973 static inline uint16_t
974 rte_cryptodev_dequeue_burst(uint8_t dev_id, uint16_t qp_id,
975                 struct rte_crypto_op **ops, uint16_t nb_ops)
976 {
977         struct rte_cryptodev *dev = &rte_cryptodevs[dev_id];
978
979         nb_ops = (*dev->dequeue_burst)
980                         (dev->data->queue_pairs[qp_id], ops, nb_ops);
981
982         rte_cryptodev_trace_dequeue_burst(dev_id, qp_id, (void **)ops, nb_ops);
983         return nb_ops;
984 }
985
986 /**
987  * Enqueue a burst of operations for processing on a crypto device.
988  *
989  * The rte_cryptodev_enqueue_burst() function is invoked to place
990  * crypto operations on the queue *qp_id* of the device designated by
991  * its *dev_id*.
992  *
993  * The *nb_ops* parameter is the number of operations to process which are
994  * supplied in the *ops* array of *rte_crypto_op* structures.
995  *
996  * The rte_cryptodev_enqueue_burst() function returns the number of
997  * operations it actually enqueued for processing. A return value equal to
998  * *nb_ops* means that all packets have been enqueued.
999  *
1000  * @param       dev_id          The identifier of the device.
1001  * @param       qp_id           The index of the queue pair which packets are
1002  *                              to be enqueued for processing. The value
1003  *                              must be in the range [0, nb_queue_pairs - 1]
1004  *                              previously supplied to
1005  *                               *rte_cryptodev_configure*.
1006  * @param       ops             The address of an array of *nb_ops* pointers
1007  *                              to *rte_crypto_op* structures which contain
1008  *                              the crypto operations to be processed.
1009  * @param       nb_ops          The number of operations to process.
1010  *
1011  * @return
1012  * The number of operations actually enqueued on the crypto device. The return
1013  * value can be less than the value of the *nb_ops* parameter when the
1014  * crypto devices queue is full or if invalid parameters are specified in
1015  * a *rte_crypto_op*.
1016  */
1017 static inline uint16_t
1018 rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
1019                 struct rte_crypto_op **ops, uint16_t nb_ops)
1020 {
1021         struct rte_cryptodev *dev = &rte_cryptodevs[dev_id];
1022
1023         rte_cryptodev_trace_enqueue_burst(dev_id, qp_id, (void **)ops, nb_ops);
1024         return (*dev->enqueue_burst)(
1025                         dev->data->queue_pairs[qp_id], ops, nb_ops);
1026 }
1027
1028
1029 /** Cryptodev symmetric crypto session
1030  * Each session is derived from a fixed xform chain. Therefore each session
1031  * has a fixed algo, key, op-type, digest_len etc.
1032  */
1033 struct rte_cryptodev_sym_session {
1034         uint64_t opaque_data;
1035         /**< Can be used for external metadata */
1036         uint16_t nb_drivers;
1037         /**< number of elements in sess_data array */
1038         uint16_t user_data_sz;
1039         /**< session user data will be placed after sess_data */
1040         __extension__ struct {
1041                 void *data;
1042                 uint16_t refcnt;
1043         } sess_data[0];
1044         /**< Driver specific session material, variable size */
1045 };
1046
1047 /** Cryptodev asymmetric crypto session */
1048 struct rte_cryptodev_asym_session {
1049         __extension__ void *sess_private_data[0];
1050         /**< Private asymmetric session material */
1051 };
1052
1053 /**
1054  * Create a symmetric session mempool.
1055  *
1056  * @param name
1057  *   The unique mempool name.
1058  * @param nb_elts
1059  *   The number of elements in the mempool.
1060  * @param elt_size
1061  *   The size of the element. This value will be ignored if it is smaller than
1062  *   the minimum session header size required for the system. For the user who
1063  *   want to use the same mempool for sym session and session private data it
1064  *   can be the maximum value of all existing devices' private data and session
1065  *   header sizes.
1066  * @param cache_size
1067  *   The number of per-lcore cache elements
1068  * @param priv_size
1069  *   The private data size of each session.
1070  * @param socket_id
1071  *   The *socket_id* argument is the socket identifier in the case of
1072  *   NUMA. The value can be *SOCKET_ID_ANY* if there is no NUMA
1073  *   constraint for the reserved zone.
1074  *
1075  * @return
1076  *  - On success return size of the session
1077  *  - On failure returns 0
1078  */
1079 __rte_experimental
1080 struct rte_mempool *
1081 rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
1082         uint32_t elt_size, uint32_t cache_size, uint16_t priv_size,
1083         int socket_id);
1084
1085 /**
1086  * Create symmetric crypto session header (generic with no private data)
1087  *
1088  * @param   mempool    Symmetric session mempool to allocate session
1089  *                     objects from
1090  * @return
1091  *  - On success return pointer to sym-session
1092  *  - On failure returns NULL
1093  */
1094 struct rte_cryptodev_sym_session *
1095 rte_cryptodev_sym_session_create(struct rte_mempool *mempool);
1096
1097 /**
1098  * Create asymmetric crypto session header (generic with no private data)
1099  *
1100  * @param   mempool    mempool to allocate asymmetric session
1101  *                     objects from
1102  * @return
1103  *  - On success return pointer to asym-session
1104  *  - On failure returns NULL
1105  */
1106 __rte_experimental
1107 struct rte_cryptodev_asym_session *
1108 rte_cryptodev_asym_session_create(struct rte_mempool *mempool);
1109
1110 /**
1111  * Frees symmetric crypto session header, after checking that all
1112  * the device private data has been freed, returning it
1113  * to its original mempool.
1114  *
1115  * @param   sess     Session header to be freed.
1116  *
1117  * @return
1118  *  - 0 if successful.
1119  *  - -EINVAL if session is NULL.
1120  *  - -EBUSY if not all device private data has been freed.
1121  */
1122 int
1123 rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess);
1124
1125 /**
1126  * Frees asymmetric crypto session header, after checking that all
1127  * the device private data has been freed, returning it
1128  * to its original mempool.
1129  *
1130  * @param   sess     Session header to be freed.
1131  *
1132  * @return
1133  *  - 0 if successful.
1134  *  - -EINVAL if session is NULL.
1135  *  - -EBUSY if not all device private data has been freed.
1136  */
1137 __rte_experimental
1138 int
1139 rte_cryptodev_asym_session_free(struct rte_cryptodev_asym_session *sess);
1140
1141 /**
1142  * Fill out private data for the device id, based on its device type.
1143  *
1144  * @param   dev_id   ID of device that we want the session to be used on
1145  * @param   sess     Session where the private data will be attached to
1146  * @param   xforms   Symmetric crypto transform operations to apply on flow
1147  *                   processed with this session
1148  * @param   mempool  Mempool where the private data is allocated.
1149  *
1150  * @return
1151  *  - On success, zero.
1152  *  - -EINVAL if input parameters are invalid.
1153  *  - -ENOTSUP if crypto device does not support the crypto transform or
1154  *    does not support symmetric operations.
1155  *  - -ENOMEM if the private session could not be allocated.
1156  */
1157 int
1158 rte_cryptodev_sym_session_init(uint8_t dev_id,
1159                         struct rte_cryptodev_sym_session *sess,
1160                         struct rte_crypto_sym_xform *xforms,
1161                         struct rte_mempool *mempool);
1162
1163 /**
1164  * Initialize asymmetric session on a device with specific asymmetric xform
1165  *
1166  * @param   dev_id   ID of device that we want the session to be used on
1167  * @param   sess     Session to be set up on a device
1168  * @param   xforms   Asymmetric crypto transform operations to apply on flow
1169  *                   processed with this session
1170  * @param   mempool  Mempool to be used for internal allocation.
1171  *
1172  * @return
1173  *  - On success, zero.
1174  *  - -EINVAL if input parameters are invalid.
1175  *  - -ENOTSUP if crypto device does not support the crypto transform.
1176  *  - -ENOMEM if the private session could not be allocated.
1177  */
1178 __rte_experimental
1179 int
1180 rte_cryptodev_asym_session_init(uint8_t dev_id,
1181                         struct rte_cryptodev_asym_session *sess,
1182                         struct rte_crypto_asym_xform *xforms,
1183                         struct rte_mempool *mempool);
1184
1185 /**
1186  * Frees private data for the device id, based on its device type,
1187  * returning it to its mempool. It is the application's responsibility
1188  * to ensure that private session data is not cleared while there are
1189  * still in-flight operations using it.
1190  *
1191  * @param   dev_id   ID of device that uses the session.
1192  * @param   sess     Session containing the reference to the private data
1193  *
1194  * @return
1195  *  - 0 if successful.
1196  *  - -EINVAL if device is invalid or session is NULL.
1197  *  - -ENOTSUP if crypto device does not support symmetric operations.
1198  */
1199 int
1200 rte_cryptodev_sym_session_clear(uint8_t dev_id,
1201                         struct rte_cryptodev_sym_session *sess);
1202
1203 /**
1204  * Frees resources held by asymmetric session during rte_cryptodev_session_init
1205  *
1206  * @param   dev_id   ID of device that uses the asymmetric session.
1207  * @param   sess     Asymmetric session setup on device using
1208  *                                       rte_cryptodev_session_init
1209  * @return
1210  *  - 0 if successful.
1211  *  - -EINVAL if device is invalid or session is NULL.
1212  */
1213 __rte_experimental
1214 int
1215 rte_cryptodev_asym_session_clear(uint8_t dev_id,
1216                         struct rte_cryptodev_asym_session *sess);
1217
1218 /**
1219  * Get the size of the header session, for all registered drivers excluding
1220  * the user data size.
1221  *
1222  * @return
1223  *   Size of the symmetric header session.
1224  */
1225 unsigned int
1226 rte_cryptodev_sym_get_header_session_size(void);
1227
1228 /**
1229  * Get the size of the header session from created session.
1230  *
1231  * @param sess
1232  *   The sym cryptodev session pointer
1233  *
1234  * @return
1235  *   - If sess is not NULL, return the size of the header session including
1236  *   the private data size defined within sess.
1237  *   - If sess is NULL, return 0.
1238  */
1239 __rte_experimental
1240 unsigned int
1241 rte_cryptodev_sym_get_existing_header_session_size(
1242                 struct rte_cryptodev_sym_session *sess);
1243
1244 /**
1245  * Get the size of the asymmetric session header, for all registered drivers.
1246  *
1247  * @return
1248  *   Size of the asymmetric header session.
1249  */
1250 __rte_experimental
1251 unsigned int
1252 rte_cryptodev_asym_get_header_session_size(void);
1253
1254 /**
1255  * Get the size of the private symmetric session data
1256  * for a device.
1257  *
1258  * @param       dev_id          The device identifier.
1259  *
1260  * @return
1261  *   - Size of the private data, if successful
1262  *   - 0 if device is invalid or does not have private
1263  *   symmetric session
1264  */
1265 unsigned int
1266 rte_cryptodev_sym_get_private_session_size(uint8_t dev_id);
1267
1268 /**
1269  * Get the size of the private data for asymmetric session
1270  * on device
1271  *
1272  * @param       dev_id          The device identifier.
1273  *
1274  * @return
1275  *   - Size of the asymmetric private data, if successful
1276  *   - 0 if device is invalid or does not have private session
1277  */
1278 __rte_experimental
1279 unsigned int
1280 rte_cryptodev_asym_get_private_session_size(uint8_t dev_id);
1281
1282 /**
1283  * Provide driver identifier.
1284  *
1285  * @param name
1286  *   The pointer to a driver name.
1287  * @return
1288  *  The driver type identifier or -1 if no driver found
1289  */
1290 int rte_cryptodev_driver_id_get(const char *name);
1291
1292 /**
1293  * Provide driver name.
1294  *
1295  * @param driver_id
1296  *   The driver identifier.
1297  * @return
1298  *  The driver name or null if no driver found
1299  */
1300 const char *rte_cryptodev_driver_name_get(uint8_t driver_id);
1301
1302 /**
1303  * Store user data in a session.
1304  *
1305  * @param       sess            Session pointer allocated by
1306  *                              *rte_cryptodev_sym_session_create*.
1307  * @param       data            Pointer to the user data.
1308  * @param       size            Size of the user data.
1309  *
1310  * @return
1311  *  - On success, zero.
1312  *  - On failure, a negative value.
1313  */
1314 __rte_experimental
1315 int
1316 rte_cryptodev_sym_session_set_user_data(
1317                                         struct rte_cryptodev_sym_session *sess,
1318                                         void *data,
1319                                         uint16_t size);
1320
1321 /**
1322  * Get user data stored in a session.
1323  *
1324  * @param       sess            Session pointer allocated by
1325  *                              *rte_cryptodev_sym_session_create*.
1326  *
1327  * @return
1328  *  - On success return pointer to user data.
1329  *  - On failure returns NULL.
1330  */
1331 __rte_experimental
1332 void *
1333 rte_cryptodev_sym_session_get_user_data(
1334                                         struct rte_cryptodev_sym_session *sess);
1335
1336 /**
1337  * Perform actual crypto processing (encrypt/digest or auth/decrypt)
1338  * on user provided data.
1339  *
1340  * @param       dev_id  The device identifier.
1341  * @param       sess    Cryptodev session structure
1342  * @param       ofs     Start and stop offsets for auth and cipher operations
1343  * @param       vec     Vectorized operation descriptor
1344  *
1345  * @return
1346  *  - Returns number of successfully processed packets.
1347  */
1348 __rte_experimental
1349 uint32_t
1350 rte_cryptodev_sym_cpu_crypto_process(uint8_t dev_id,
1351         struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs ofs,
1352         struct rte_crypto_sym_vec *vec);
1353
1354 #ifdef __cplusplus
1355 }
1356 #endif
1357
1358 #endif /* _RTE_CRYPTODEV_H_ */