rte_cryptodev.h(3)

πŸ“¦ version 26.03, in nixos 26.05, nixpkgs unstable

πŸ¦‹ rte_cryptodev.h πŸ¦‹

okay so bestie, welcome to rte_cryptodev.h β€” and yes that (3) on the end is literally giving "Library Functions Manual" energy, that's the manual she lives in. she's the crypto device header, she's iconic, and she's about to drop a lot of definitions on you. hydrate first. πŸ’§


✨ NAME ✨

rte_cryptodev.h β€” the cryptodev header, periodt. no long explanation, she simply exists. πŸ’…


✨ SYNOPSIS ✨

bestie, look at all these includes she pulls in. she is not doing it alone, she has a whole friend group:

#include <rte_compat.h>
#include 'rte_kvargs.h'
#include 'rte_crypto.h'
#include <rte_common.h>
#include <rte_rcu_qsbr.h>
#include 'rte_cryptodev_trace_fp.h'
#include 'rte_cryptodev_core.h'
ngl, notice the vibe: some of these are <> includes and some are '' includes. that's exactly how the original writes them, so we are not fixing it. copy it verbatim, always. 🫢

🌸 Data Structures 🌸

so many structs. she's organized. every single one, in order:

  • struct rte_crypto_param_range
  • struct rte_cryptodev_symmetric_capability
  • struct rte_cryptodev_asymmetric_xform_capability
  • struct rte_cryptodev_asymmetric_capability
  • struct rte_cryptodev_capabilities
  • struct rte_cryptodev_sym_capability_idx
  • struct rte_cryptodev_asym_capability_idx
  • struct rte_cryptodev_info
  • struct rte_cryptodev_qp_conf
  • struct rte_cryptodev_stats
  • struct rte_cryptodev_config
  • struct rte_cryptodev_cb
  • union rte_cryptodev_session_ctx
  • struct rte_crypto_raw_dp_ctx

fourteen of them. fourteen!! she ate and left no crumbs. πŸ”₯

πŸ’œ Macros πŸ’œ

okay this is the big one. grab a snack. the <pink>macros</pink> come in three flavors β€” the offset helpers, the capability-list terminator, and then the feature flags which go from bit 0 all the way up to bit 29. lowkey obsessed with how tidy this is.

first, the two offset helpers and the data-unit constant:

  • rte_crypto_op_ctod_offset(c, t, o) β€” the c-to-d offset macro, arguments right there as c, t, o.
  • rte_crypto_op_ctophys_offset(c, o) β€” the c-to-phys offset macro, arguments c and o.
  • RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_512_BYTES β€” set to RTE_BIT32(0). five hundred twelve bytes of data unit, slay. πŸŽ€

then the capabilities-list terminator:

  • RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() β€” the "we're done here, list over" macro. no arguments, just vibes.

and now the feature flags, all thirty of them, exact values, no cap:

  • RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO β€” (1ULL << 0)
  • RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO β€” (1ULL << 1)
  • RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING β€” (1ULL << 2)
  • RTE_CRYPTODEV_FF_CPU_SSE β€” (1ULL << 3)
  • RTE_CRYPTODEV_FF_CPU_AVX β€” (1ULL << 4)
  • RTE_CRYPTODEV_FF_CPU_AVX2 β€” (1ULL << 5)
  • RTE_CRYPTODEV_FF_CPU_AESNI β€” (1ULL << 6)
  • RTE_CRYPTODEV_FF_HW_ACCELERATED β€” (1ULL << 7)
  • RTE_CRYPTODEV_FF_CPU_AVX512 β€” (1ULL << 8)
  • RTE_CRYPTODEV_FF_IN_PLACE_SGL β€” (1ULL << 9)
  • RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT β€” (1ULL << 10)
  • RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT β€” (1ULL << 11)
  • RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT β€” (1ULL << 12)
  • RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT β€” (1ULL << 13)
  • RTE_CRYPTODEV_FF_CPU_NEON β€” (1ULL << 14)
  • RTE_CRYPTODEV_FF_CPU_ARM_CE β€” (1ULL << 15)
  • RTE_CRYPTODEV_FF_SECURITY β€” (1ULL << 16)
  • RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP β€” (1ULL << 17)
  • RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT β€” (1ULL << 18)
  • RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED β€” (1ULL << 19)
  • RTE_CRYPTODEV_FF_ASYM_SESSIONLESS β€” (1ULL << 20)
  • RTE_CRYPTODEV_FF_SYM_CPU_CRYPTO β€” (1ULL << 21)
  • RTE_CRYPTODEV_FF_SYM_SESSIONLESS β€” (1ULL << 22)
  • RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA β€” (1ULL << 23)
  • RTE_CRYPTODEV_FF_SYM_RAW_DP β€” (1ULL << 24)
  • RTE_CRYPTODEV_FF_CIPHER_MULTIPLE_DATA_UNITS β€” (1ULL << 25)
  • RTE_CRYPTODEV_FF_CIPHER_WRAPPED_KEY β€” (1ULL << 26)
  • RTE_CRYPTODEV_FF_SECURITY_INNER_CSUM β€” (1ULL << 27)
  • RTE_CRYPTODEV_FF_SECURITY_RX_INJECT β€” (1ULL << 28)
  • RTE_CRYPTODEV_FF_MLDSA_SIGN_PREHASH β€” (1ULL << 29)

see how each one is 1ULL shifted by its own little bit number and they just march up in order? the way that structure is immaculate. 🧚

next up, the queue-pair priority macros β€” three of them, and the numbers are the whole story:

  • RTE_CRYPTODEV_QP_PRIORITY_HIGHEST β€” 0
  • RTE_CRYPTODEV_QP_PRIORITY_NORMAL β€” 128
  • RTE_CRYPTODEV_QP_PRIORITY_LOWEST β€” 255
heads up bestie: HIGHEST is the smallest number and LOWEST is the biggest. don't let the naming gaslight you into assuming higher number = higher priority. the header says what it says. πŸ’€

and one last macro, the name-length one:

  • RTE_CRYPTODEV_NAME_MAX_LEN β€” (64). sixty-four characters max for a name, that's the whole budget. ✨

πŸŽ€ Typedefs πŸŽ€

nine function-pointer typedefs. she loves a callback. every signature, character for character:

  • rte_cryptodev_callback_fn β€” returns uint16_t, takes uint16_t dev_id, uint16_t qp_id, struct rte_crypto_op **ops, uint16_t nb_ops, void *user_param:
typedef uint16_t(* rte_cryptodev_callback_fn) (uint16_t dev_id, uint16_t
    qp_id, struct rte_crypto_op **ops, uint16_t nb_ops, void
    *user_param)
  • rte_cryptodev_cb_fn β€” returns void, takes uint8_t dev_id, enum rte_cryptodev_event_type event, void *cb_arg:
typedef void(* rte_cryptodev_cb_fn) (uint8_t dev_id, enum
    rte_cryptodev_event_type event, void *cb_arg)
  • cryptodev_sym_raw_enqueue_burst_t β€” returns uint32_t, takes void *qp, uint8_t *drv_ctx, struct rte_crypto_sym_vec *vec, union rte_crypto_sym_ofs ofs, void *user_data[], int *enqueue_status:
typedef uint32_t(* cryptodev_sym_raw_enqueue_burst_t) (void *qp, uint8_t
    *drv_ctx, struct rte_crypto_sym_vec *vec, union rte_crypto_sym_ofs
    ofs, void *user_data[], int *enqueue_status)
  • cryptodev_sym_raw_enqueue_t β€” returns int, takes void *qp, uint8_t *drv_ctx, struct rte_crypto_vec *data_vec, uint16_t n_data_vecs, union rte_crypto_sym_ofs ofs, struct rte_crypto_va_iova_ptr *iv, struct rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr *aad_or_auth_iv, void *user_data:
typedef int(* cryptodev_sym_raw_enqueue_t) (void *qp, uint8_t *drv_ctx,
    struct rte_crypto_vec *data_vec, uint16_t n_data_vecs, union
    rte_crypto_sym_ofs ofs, struct rte_crypto_va_iova_ptr *iv, struct
    rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr
    *aad_or_auth_iv, void *user_data)
  • cryptodev_sym_raw_operation_done_t β€” returns int, takes void *qp, uint8_t *drv_ctx, uint32_t n:
typedef int(* cryptodev_sym_raw_operation_done_t) (void *qp, uint8_t
    *drv_ctx, uint32_t n)
  • rte_cryptodev_raw_get_dequeue_count_t β€” returns uint32_t, takes void *user_data:
typedef uint32_t(* rte_cryptodev_raw_get_dequeue_count_t) (void
    *user_data)
  • rte_cryptodev_raw_post_dequeue_t β€” returns void, takes void *user_data, uint32_t index, uint8_t is_op_success:
typedef void(* rte_cryptodev_raw_post_dequeue_t) (void *user_data,
    uint32_t index, uint8_t is_op_success)
  • cryptodev_sym_raw_dequeue_burst_t β€” returns uint32_t, takes void *qp, uint8_t *drv_ctx, rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count, uint32_t max_nb_to_dequeue, rte_cryptodev_raw_post_dequeue_t post_dequeue, void **out_user_data, uint8_t is_user_data_array, uint32_t *n_success, int *dequeue_status:
typedef uint32_t(* cryptodev_sym_raw_dequeue_burst_t) (void *qp, uint8_t
    *drv_ctx, rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count,
    uint32_t max_nb_to_dequeue, rte_cryptodev_raw_post_dequeue_t
    post_dequeue, void **out_user_data, uint8_t is_user_data_array,
    uint32_t *n_success, int *dequeue_status)
  • cryptodev_sym_raw_dequeue_t β€” returns void *, takes void *qp, uint8_t *drv_ctx, int *dequeue_status, enum rte_crypto_op_status *op_status:
typedef void *(* cryptodev_sym_raw_dequeue_t) (void *qp, uint8_t
    *drv_ctx, int *dequeue_status, enum rte_crypto_op_status *op_status)

like… the way these are so detailed and each one returns something different. enqueue returns a count, dequeue returns a pointer, done returns an int. she's consistent about being inconsistent. πŸ’–

🌈 Enumerations 🌈

just one enum here, and it's the event type one:

  • enum rte_cryptodev_event_type β€” members, exactly: RTE_CRYPTODEV_EVENT_UNKNOWN, RTE_CRYPTODEV_EVENT_ERROR, RTE_CRYPTODEV_EVENT_MAX.
enum rte_cryptodev_event_type { RTE_CRYPTODEV_EVENT_UNKNOWN,
    RTE_CRYPTODEV_EVENT_ERROR, RTE_CRYPTODEV_EVENT_MAX }

unknown, error, max. short, sweet, and MAX is just sitting there at the end holding the door. πŸ‘‘


okay that's where this part wraps β€” but do not close the tab bestie, there's more coming. πŸ¦‹

🧚 Functions 🧚

okay so this is the whole function roster, bestie β€” every single prototype is right here, no skips, no cap. capability lookups? checks? algo string/enum glow-ups? device counting, config, queue pairs, stats, callbacks, session pools, raw datapath, enqueue/dequeue wrappers? it’s all in this lineup πŸ’…

       const struct rte_cryptodev_symmetric_capability *
           rte_cryptodev_sym_capability_get (uint8_t dev_id, const struct
           rte_cryptodev_sym_capability_idx *idx)
       const struct rte_cryptodev_asymmetric_xform_capability *
           rte_cryptodev_asym_capability_get (uint8_t dev_id, const struct
           rte_cryptodev_asym_capability_idx *idx)
       int rte_cryptodev_sym_capability_check_cipher (const struct
           rte_cryptodev_symmetric_capability *capability, uint16_t key_size,
           uint16_t iv_size)
       int rte_cryptodev_sym_capability_check_auth (const struct
           rte_cryptodev_symmetric_capability *capability, uint16_t key_size,
           uint16_t digest_size, uint16_t iv_size)
       int rte_cryptodev_sym_capability_check_aead (const struct
           rte_cryptodev_symmetric_capability *capability, uint16_t key_size,
           uint16_t digest_size, uint16_t aad_size, uint16_t iv_size)
       int rte_cryptodev_asym_xform_capability_check_optype (const struct
           rte_cryptodev_asymmetric_xform_capability *capability, enum
           rte_crypto_asym_op_type op_type)
       int rte_cryptodev_asym_xform_capability_check_modlen (const struct
           rte_cryptodev_asymmetric_xform_capability *capability, uint16_t
           modlen)
       bool rte_cryptodev_asym_xform_capability_check_hash (const struct
           rte_cryptodev_asymmetric_xform_capability *capability, enum
           rte_crypto_auth_algorithm hash)
       __rte_experimental int rte_cryptodev_asym_xform_capability_check_opcap
           (const struct rte_cryptodev_asymmetric_xform_capability *capability,
           enum rte_crypto_asym_op_type op_type, uint8_t cap)
       int rte_cryptodev_get_cipher_algo_enum (enum rte_crypto_cipher_algorithm
           *algo_enum, const char *algo_string)
       int rte_cryptodev_get_auth_algo_enum (enum rte_crypto_auth_algorithm
           *algo_enum, const char *algo_string)
       int rte_cryptodev_get_aead_algo_enum (enum rte_crypto_aead_algorithm
           *algo_enum, const char *algo_string)
       int rte_cryptodev_asym_get_xform_enum (enum rte_crypto_asym_xform_type
           *xform_enum, const char *xform_string)
       __rte_experimental const char * rte_cryptodev_get_cipher_algo_string
           (enum rte_crypto_cipher_algorithm algo_enum)
       __rte_experimental const char * rte_cryptodev_get_auth_algo_string (enum
           rte_crypto_auth_algorithm algo_enum)
       __rte_experimental const char * rte_cryptodev_get_aead_algo_string (enum
           rte_crypto_aead_algorithm algo_enum)
       __rte_experimental const char * rte_cryptodev_asym_get_xform_string
           (enum rte_crypto_asym_xform_type xform_enum)
       const char * rte_cryptodev_get_feature_name (uint64_t flag)
       int rte_cryptodev_get_dev_id (const char *name)
       const char * rte_cryptodev_name_get (uint8_t dev_id)
       uint8_t rte_cryptodev_count (void)
       uint8_t rte_cryptodev_device_count_by_driver (uint8_t driver_id)
       uint8_t rte_cryptodev_devices_get (const char *driver_name, uint8_t
           *devices, uint8_t nb_devices)
       int rte_cryptodev_configure (uint8_t dev_id, struct rte_cryptodev_config
           *config)
       int rte_cryptodev_start (uint8_t dev_id)
       void rte_cryptodev_stop (uint8_t dev_id)
       int rte_cryptodev_close (uint8_t dev_id)
       int rte_cryptodev_queue_pair_setup (uint8_t dev_id, uint16_t
           queue_pair_id, const struct rte_cryptodev_qp_conf *qp_conf, int
           socket_id)
       __rte_experimental int rte_cryptodev_queue_pair_reset (uint8_t dev_id,
           uint16_t queue_pair_id, const struct rte_cryptodev_qp_conf *qp_conf,
           int socket_id)
       int rte_cryptodev_get_qp_status (uint8_t dev_id, uint16_t queue_pair_id)
       uint16_t rte_cryptodev_queue_pair_count (uint8_t dev_id)
       int rte_cryptodev_stats_get (uint8_t dev_id, struct rte_cryptodev_stats
           *stats)
       void rte_cryptodev_stats_reset (uint8_t dev_id)
       void rte_cryptodev_info_get (uint8_t dev_id, struct rte_cryptodev_info
           *dev_info)
       int rte_cryptodev_callback_register (uint8_t dev_id, enum
           rte_cryptodev_event_type event, rte_cryptodev_cb_fn cb_fn, void
           *cb_arg)
       int rte_cryptodev_callback_unregister (uint8_t dev_id, enum
           rte_cryptodev_event_type event, rte_cryptodev_cb_fn cb_fn, void
           *cb_arg)
       __rte_experimental int rte_cryptodev_queue_pair_event_error_query
           (uint8_t dev_id, uint16_t qp_id)
       RTE_TAILQ_HEAD (rte_cryptodev_cb_list, rte_cryptodev_callback)
       void * rte_cryptodev_get_sec_ctx (uint8_t dev_id)
       struct rte_mempool * rte_cryptodev_sym_session_pool_create (const char
           *name, uint32_t nb_elts, uint32_t elt_size, uint32_t cache_size,
           uint16_t priv_size, int socket_id)
       struct rte_mempool * rte_cryptodev_asym_session_pool_create (const char
           *name, uint32_t nb_elts, uint32_t cache_size, uint16_t
           user_data_size, int socket_id)
       void * rte_cryptodev_sym_session_create (uint8_t dev_id, struct
           rte_crypto_sym_xform *xforms, struct rte_mempool *mp)
       int rte_cryptodev_asym_session_create (uint8_t dev_id, struct
           rte_crypto_asym_xform *xforms, struct rte_mempool *mp, void
           **session)
       int rte_cryptodev_sym_session_free (uint8_t dev_id, void *sess)
       int rte_cryptodev_asym_session_free (uint8_t dev_id, void *sess)
       unsigned int rte_cryptodev_asym_get_header_session_size (void)
       unsigned int rte_cryptodev_sym_get_private_session_size (uint8_t dev_id)
       unsigned int rte_cryptodev_asym_get_private_session_size (uint8_t
           dev_id)
       unsigned int rte_cryptodev_is_valid_dev (uint8_t dev_id)
       int rte_cryptodev_driver_id_get (const char *name)
       const char * rte_cryptodev_driver_name_get (uint8_t driver_id)
       int rte_cryptodev_sym_session_set_user_data (void *sess, void *data,
           uint16_t size)
       static uint64_t rte_cryptodev_sym_session_opaque_data_get (void *sess)
       static void rte_cryptodev_sym_session_opaque_data_set (void *sess,
           uint64_t opaque)
       void * rte_cryptodev_sym_session_get_user_data (void *sess)
       int rte_cryptodev_asym_session_set_user_data (void *sess, void *data,
           uint16_t size)
       void * rte_cryptodev_asym_session_get_user_data (void *sess)
       uint32_t rte_cryptodev_sym_cpu_crypto_process (uint8_t dev_id, void
           *sess, union rte_crypto_sym_ofs ofs, struct rte_crypto_sym_vec *vec)
       int rte_cryptodev_get_raw_dp_ctx_size (uint8_t dev_id)
       int rte_cryptodev_session_event_mdata_set (uint8_t dev_id, void *sess,
           enum rte_crypto_op_type op_type, enum rte_crypto_op_sess_type
           sess_type, void *ev_mdata, uint16_t size)
       int rte_cryptodev_configure_raw_dp_ctx (uint8_t dev_id, uint16_t qp_id,
           struct rte_crypto_raw_dp_ctx *ctx, enum rte_crypto_op_sess_type
           sess_type, union rte_cryptodev_session_ctx session_ctx, uint8_t
           is_update)
       uint32_t rte_cryptodev_raw_enqueue_burst (struct rte_crypto_raw_dp_ctx
           *ctx, struct rte_crypto_sym_vec *vec, union rte_crypto_sym_ofs ofs,
           void **user_data, int *enqueue_status)
       static __rte_experimental __rte_always_inline int
           rte_cryptodev_raw_enqueue (struct rte_crypto_raw_dp_ctx *ctx, struct
           rte_crypto_vec *data_vec, uint16_t n_data_vecs, union
           rte_crypto_sym_ofs ofs, struct rte_crypto_va_iova_ptr *iv, struct
           rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr
           *aad_or_auth_iv, void *user_data)
       int rte_cryptodev_raw_enqueue_done (struct rte_crypto_raw_dp_ctx *ctx,
           uint32_t n)
       uint32_t rte_cryptodev_raw_dequeue_burst (struct rte_crypto_raw_dp_ctx
           *ctx, rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count,
           uint32_t max_nb_to_dequeue, rte_cryptodev_raw_post_dequeue_t
           post_dequeue, void **out_user_data, uint8_t is_user_data_array,
           uint32_t *n_success, int *dequeue_status)
       static __rte_experimental __rte_always_inline void *
           rte_cryptodev_raw_dequeue (struct rte_crypto_raw_dp_ctx *ctx, int
           *dequeue_status, enum rte_crypto_op_status *op_status)
       int rte_cryptodev_raw_dequeue_done (struct rte_crypto_raw_dp_ctx *ctx,
           uint32_t n)
       struct rte_cryptodev_cb * rte_cryptodev_add_enq_callback (uint8_t
           dev_id, uint16_t qp_id, rte_cryptodev_callback_fn cb_fn, void
           *cb_arg)
       int rte_cryptodev_remove_enq_callback (uint8_t dev_id, uint16_t qp_id,
           struct rte_cryptodev_cb *cb)
       struct rte_cryptodev_cb * rte_cryptodev_add_deq_callback (uint8_t
           dev_id, uint16_t qp_id, rte_cryptodev_callback_fn cb_fn, void
           *cb_arg)
       int rte_cryptodev_remove_deq_callback (uint8_t dev_id, uint16_t qp_id,
           struct rte_cryptodev_cb *cb)
       static uint16_t rte_cryptodev_dequeue_burst (uint8_t dev_id, uint16_t
           qp_id, struct rte_crypto_op **ops, uint16_t nb_ops)
       static uint16_t rte_cryptodev_enqueue_burst (uint8_t dev_id, uint16_t
           qp_id, struct rte_crypto_op **ops, uint16_t nb_ops)
       static __rte_experimental int rte_cryptodev_qp_depth_used (uint8_t
           dev_id, uint16_t qp_id)

🌸 Detailed Description 🌸

This is the RTE Cryptographic Device APIs zone β€” iconic behavior only. It defines the RTE Crypto Device APIs for the provisioning of cipher and authentication operations, fr fr. Think of it as the group chat that gets your cipher and auth operations set up and ready to slay. πŸ’–

Definition in file rte_cryptodev.h β€” that’s where this whole masterpiece lives, no cap. πŸ¦‹

πŸ’… Macro Definition Documentation πŸ’…

ok bestie this is the part where every single #define in rte_cryptodev.h gets its own little spotlight moment. there are a LOT. grab a snack. πŸ“


πŸŽ€ rte_crypto_op_ctod_offset πŸŽ€

#define rte_crypto_op_ctod_offset( c,  t,  o)

Value:

((t)((char *)(c) + (o)))

A macro that points to an offset from the start of the crypto operation structure ( rte_crypto_op ).

The returned pointer is cast to type t. yes literally just pointer math but make it fashion πŸ’…

Parameters:

  • c β€” The crypto operation.
  • o β€” The offset from the start of the crypto operation.
  • t β€” The type to cast the result into.

Definition at line 64 of file rte_cryptodev.h.


✨ rte_crypto_op_ctophys_offset ✨

#define rte_crypto_op_ctophys_offset( c,  o)

Value:

(rte_iova_t)((c)->phys_addr + (o))

A macro that returns the physical address that points to an offset from the start of the crypto operation ( rte_crypto_op ). physical address era πŸ”₯

Parameters:

  • c β€” The crypto operation.
  • o β€” The offset from the start of the crypto operation to calculate address from.

Definition at line 78 of file rte_cryptodev.h.


πŸ¦‹ RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_512_BYTES πŸ¦‹

#define RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_512_BYTES   RTE_BIT32(0)

Data-unit supported lengths of cipher algorithms. A bit can represent any set of data-unit sizes β€” single size, multiple size, range, etc. it's giving bitmask energy, no cap ✨

Definition at line 100 of file rte_cryptodev.h.


🌸 RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST 🌸

#define RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()

Value:

{ RTE_CRYPTO_OP_TYPE_UNDEFINED }

Macro used at end of crypto PMD list. it's the little "that's all folks" terminator of the list 🎬

Definition at line 508 of file rte_cryptodev.h.


πŸ‘‘ Crypto device supported feature flags πŸ‘‘

Real talk before we get into these: New features flags should be added to the end of the list, and keep these flags synchronised with rte_cryptodev_get_feature_name(). that's the rule, ok? write it on your mirror 🫢

  • RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO (1ULL << 0) β€” Symmetric crypto operations are supported. Definition at line 520 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO (1ULL << 1) β€” Asymmetric crypto operations are supported. Definition at line 522 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING (1ULL << 2) β€” Chaining symmetric crypto operations are supported. Definition at line 524 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_CPU_SSE (1ULL << 3) β€” Utilises CPU SIMD SSE instructions. Definition at line 526 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_CPU_AVX (1ULL << 4) β€” Utilises CPU SIMD AVX instructions. Definition at line 528 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_CPU_AVX2 (1ULL << 5) β€” Utilises CPU SIMD AVX2 instructions. Definition at line 530 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_CPU_AESNI (1ULL << 6) β€” Utilises CPU AES-NI instructions. Definition at line 532 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_HW_ACCELERATED (1ULL << 7) β€” Operations are off-loaded to an external hardware accelerator. Definition at line 534 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_CPU_AVX512 (1ULL << 8) β€” Utilises CPU SIMD AVX512 instructions. Definition at line 538 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_IN_PLACE_SGL (1ULL << 9) β€” In-place Scatter-gather (SGL) buffers, with multiple segments, are supported. Definition at line 540 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT (1ULL << 10) β€” Out-of-place Scatter-gather (SGL) buffers are supported in input and output. Definition at line 544 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT (1ULL << 11) β€” Out-of-place Scatter-gather (SGL) buffers are supported in input, combined with linear buffers (LB), with a single segment in output. Definition at line 548 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT (1ULL << 12) β€” Out-of-place Scatter-gather (SGL) buffers are supported in output, combined with linear buffers (LB) in input. Definition at line 553 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT (1ULL << 13) β€” Out-of-place linear buffers (LB) are supported in input and output. Definition at line 557 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_CPU_NEON (1ULL << 14) β€” Utilises CPU NEON instructions. Definition at line 559 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_CPU_ARM_CE (1ULL << 15) β€” Utilises ARM CPU Cryptographic Extensions. Definition at line 561 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_SECURITY (1ULL << 16) β€” Support Security Protocol Processing. Definition at line 563 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP (1ULL << 17) β€” Support RSA Private Key OP with exponent. Definition at line 565 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT (1ULL << 18) β€” Support RSA Private Key OP with CRT (quintuple) Keys. Definition at line 567 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED (1ULL << 19) β€” Support encrypted-digest operations where digest is appended to data. Definition at line 569 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_ASYM_SESSIONLESS (1ULL << 20) β€” Support asymmetric session-less operations. Definition at line 571 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_SYM_CPU_CRYPTO (1ULL << 21) β€” Support symmetric cpu-crypto processing. Definition at line 573 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_SYM_SESSIONLESS (1ULL << 22) β€” Support symmetric session-less operations. Definition at line 575 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA (1ULL << 23) β€” Support operations on data which is not byte aligned. Definition at line 577 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_SYM_RAW_DP (1ULL << 24) β€” Support accelerator specific symmetric raw data-path APIs. Definition at line 579 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_CIPHER_MULTIPLE_DATA_UNITS (1ULL << 25) β€” Support operations on multiple data-units message. Definition at line 581 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_CIPHER_WRAPPED_KEY (1ULL << 26) β€” Support wrapped key in cipher xform. Definition at line 583 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_SECURITY_INNER_CSUM (1ULL << 27) β€” Support inner checksum computation/verification. Definition at line 585 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_SECURITY_RX_INJECT (1ULL << 28) β€” Support Rx injection after security processing. Definition at line 587 of file rte_cryptodev.h.
  • RTE_CRYPTODEV_FF_MLDSA_SIGN_PREHASH (1ULL << 29) β€” Support Pre Hash ML-DSA Signature Generation. Definition at line 589 of file rte_cryptodev.h.

🧚 Queue pair priorities 🧚

these three are literally the vibes ladder for a cryptodev queue pair, from most main character to most chill πŸ’…

⭐ RTE_CRYPTODEV_QP_PRIORITY_HIGHEST

#define RTE_CRYPTODEV_QP_PRIORITY_HIGHEST   0

Highest priority of a cryptodev queue pair. the it-girl of priorities πŸ‘‘

See also:

  • rte_cryptodev_queue_pair_setup()
  • rte_cryptodev_enqueue_burst()

Definition at line 646 of file rte_cryptodev.h.

🌸 RTE_CRYPTODEV_QP_PRIORITY_NORMAL

#define RTE_CRYPTODEV_QP_PRIORITY_NORMAL   128

Normal priority of a cryptodev queue pair. just existing, no drama, we respect it 🫢

See also:

  • rte_cryptodev_queue_pair_setup()
  • rte_cryptodev_enqueue_burst()

Definition at line 650 of file rte_cryptodev.h.

πŸ¦‹ RTE_CRYPTODEV_QP_PRIORITY_LOWEST

#define RTE_CRYPTODEV_QP_PRIORITY_LOWEST   255

Lowest priority of a cryptodev queue pair. background character energy but honestly kind of iconic for it 😌

See also:

  • rte_cryptodev_queue_pair_setup()
  • rte_cryptodev_enqueue_burst()

Definition at line 654 of file rte_cryptodev.h.


πŸŽ€ RTE_CRYPTODEV_NAME_MAX_LEN πŸŽ€

#define RTE_CRYPTODEV_NAME_MAX_LEN   (64)

Max length of name of crypto PMD. that's 64 characters bestie, don't go over, the limit does exist 😭

Definition at line 726 of file rte_cryptodev.h.

✨ TYPEDEF DOCUMENTATION ✨

Okay bestie, this is the part where we meet the function pointer girlies πŸ’… β€” the typedefs. These are the shapes of the callbacks you can hand to the library, or that the driver calls back into. Every single one of them, no skipping, let's go πŸŽ€


πŸ¦‹ rte_cryptodev_callback_fn

typedef uint16_t(* rte_cryptodev_callback_fn) (uint16_t dev_id, uint16_t
    qp_id, struct rte_crypto_op **ops, uint16_t nb_ops, void *user_param)

This is the function type used for processing crypto ops when an enqueue/dequeue burst is called. ✨

Real talk: the callback function is called on the enqueue/dequeue burst immediately. Like, no waiting around, it's main character energy from the jump πŸ”₯

Parameters

  • dev_id β€” the identifier of the device.
  • qp_id β€” the index of the queue pair on which ops are enqueued/dequeued. The value must be in the range [0, nb_queue_pairs - 1] previously supplied to rte_cryptodev_configure.
  • ops β€” the address of an array of nb_ops pointers to rte_crypto_op structures which contain the crypto operations to be processed.
  • nb_ops β€” the number of operations to process.
  • user_param β€” the arbitrary user parameter passed in by the application when the callback was originally registered.

Returns β€” the number of ops to be enqueued to the crypto device.

Definition at line 697 of file rte_cryptodev.h.


🌸 rte_cryptodev_cb_fn

typedef void(* rte_cryptodev_cb_fn) (uint8_t dev_id, enum
    rte_cryptodev_event_type event, void *cb_arg)

Typedef for an application callback function β€” this is the one application software registers so it gets a lil heads-up when device events happen 🫢

Parameters

  • dev_id β€” crypto device identifier.
  • event β€” crypto device event to register for notification of.
  • cb_arg β€” user specified parameter to be passed as to passed to users callback function.

Definition at line 709 of file rte_cryptodev.h.


🧚 cryptodev_sym_raw_enqueue_burst_t

typedef uint32_t(* cryptodev_sym_raw_enqueue_burst_t) (void *qp, uint8_t
    *drv_ctx, struct rte_crypto_sym_vec *vec, union rte_crypto_sym_ofs ofs,
    void *user_data[], int *enqueue_status)

Enqueue a vectorized operation descriptor into the device queue β€” but heads up, the driver may or may not start processing until rte_cryptodev_raw_enqueue_done() is called πŸ‘€

Parameters

  • qp β€” driver specific queue pair data.
  • drv_ctx β€” driver specific context data.
  • vec β€” vectorized operation descriptor.
  • ofs β€” start and stop offsets for auth and cipher operations.
  • user_data β€” the array of user data for dequeue later.
  • enqueue_status β€” driver written value to specify the enqueue status. Possible values:
    • 1 β€” the number of operations returned are enqueued successfully.
    • 0 β€” the number of operations returned are cached into the queue but are not processed until rte_cryptodev_raw_enqueue_done() is called.
    • negative integer β€” error occurred.

Returns

  • The number of operations in the descriptor successfully enqueued or cached into the queue but not enqueued yet, depends on the "enqueue_status" value.

Definition at line 1452 of file rte_cryptodev.h.


πŸ’œ cryptodev_sym_raw_enqueue_t

typedef int(* cryptodev_sym_raw_enqueue_t) (void *qp, uint8_t *drv_ctx,
    struct rte_crypto_vec *data_vec, uint16_t n_data_vecs, union
    rte_crypto_sym_ofs ofs, struct rte_crypto_va_iova_ptr *iv, struct
    rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr
    *aad_or_auth_iv, void *user_data)

Enqueue a single raw data vector into the device queue, but again the driver may or may not start processing until rte_cryptodev_raw_enqueue_done() is called. Same vibe as the burst version, just one at a time πŸ’«

Parameters

  • qp β€” driver specific queue pair data.
  • drv_ctx β€” driver specific context data.
  • data_vec β€” the buffer data vector.
  • n_data_vecs β€” number of buffer data vectors.
  • ofs β€” start and stop offsets for auth and cipher operations.
  • iv β€” IV virtual and IOVA addresses.
  • digest β€” digest virtual and IOVA addresses.
  • aad_or_auth_iv β€” AAD or auth IV virtual and IOVA addresses, depends on the algorithm used.
  • user_data β€” the user data.

Returns

  • 1 β€” the data vector is enqueued successfully.
  • 0 β€” the data vector is cached into the queue but is not processed until rte_cryptodev_raw_enqueue_done() is called.
  • negative integer β€” failure.

Definition at line 1477 of file rte_cryptodev.h.


πŸŽ€ cryptodev_sym_raw_operation_done_t

typedef int(* cryptodev_sym_raw_operation_done_t) (void *qp, uint8_t
    *drv_ctx, uint32_t n)

This one tells the cryptodev queue pair to start processing, or finish dequeuing, all the enqueued/dequeued operations. It's like the "okay we're done here bestie, wrap it up" signal ✨

Parameters

  • qp β€” driver specific queue pair data.
  • drv_ctx β€” driver specific context data.
  • n β€” the total number of processed operations.

Returns

  • On success return 0.
  • On failure return negative integer.

Definition at line 1496 of file rte_cryptodev.h.


πŸ“ rte_cryptodev_raw_get_dequeue_count_t

typedef uint32_t(* rte_cryptodev_raw_get_dequeue_count_t) (void *user_data)

A typedef that you the user provide, so the driver can get the dequeue count. The function may return a fixed number, or the number it parsed from the user data stored in the first processed operation 🧠

Parameters

  • user_data β€” dequeued user data.

Returns

  • The number of operations to be dequeued.

Definition at line 1508 of file rte_cryptodev.h.


🌈 rte_cryptodev_raw_post_dequeue_t

typedef void(* rte_cryptodev_raw_post_dequeue_t) (void *user_data, uint32_t
    index, uint8_t is_op_success)

A typedef that you provide to deal with the post-dequeue situation β€” like filling in status and other lil cleanup duties 🧹

Parameters

  • user_data β€” dequeued user data.
  • index β€” index number of the processed descriptor.
  • is_op_success β€” operation status provided by the driver.

Definition at line 1518 of file rte_cryptodev.h.


πŸ”₯ cryptodev_sym_raw_dequeue_burst_t

typedef uint32_t(* cryptodev_sym_raw_dequeue_burst_t) (void *qp, uint8_t
    *drv_ctx, rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count,
    uint32_t max_nb_to_dequeue, rte_cryptodev_raw_post_dequeue_t
    post_dequeue, void **out_user_data, uint8_t is_user_data_array, uint32_t
    *n_success, int *dequeue_status)

Dequeue a burst of symmetric crypto processing. Burst mode, bestie β€” we're doing several πŸ”₯

Parameters

  • qp β€” driver specific queue pair data.
  • drv_ctx β€” driver specific context data.
  • get_dequeue_count β€” user provided callback function to obtain dequeue operation count.
  • max_nb_to_dequeue β€” when get_dequeue_count is NULL this value is used to pass the maximum number of operations to be dequeued.
  • post_dequeue β€” user provided callback function to post-process a dequeued operation.
  • out_user_data β€” user data pointer array to be retrieve from device queue. In case of is_user_data_array is set there should be enough room to store all user data.
  • is_user_data_array β€” set 1 if every dequeued user data will be written into out_user_data array. Set 0 if only the first user data will be written into out_user_data array.
  • n_success β€” driver written value to specific the total successful operations count.
  • dequeue_status β€” driver written value to specify the dequeue status. Possible values:
    • 1 β€” successfully dequeued the number of operations returned. The user data previously set during enqueue is stored in the "out_user_data".
    • 0 β€” the number of operations returned are completed and the user data is stored in the "out_user_data", but they are not freed from the queue until rte_cryptodev_raw_dequeue_done() is called.
    • negative integer β€” error occurred.

Returns

  • The number of operations dequeued or completed but not freed from the queue, depends on "dequeue_status" value.

Definition at line 1562 of file rte_cryptodev.h.


πŸ¦‹ cryptodev_sym_raw_dequeue_t

typedef void *(* cryptodev_sym_raw_dequeue_t) (void *qp, uint8_t *drv_ctx,
    int *dequeue_status, enum rte_crypto_op_status *op_status)

Dequeue a symmetric crypto processing β€” the single-op edition, for when you're not doing the whole burst thing πŸŽ€

Parameters

  • qp β€” driver specific queue pair data.
  • drv_ctx β€” driver specific context data.
  • dequeue_status β€” driver written value to specify the dequeue status. Possible values:
    • 1 β€” successfully dequeued a operation. The user data is returned.
    • 0 β€” the first operation in the queue is completed and the user data previously set during enqueue is returned, but it is not freed from the queue until rte_cryptodev_raw_dequeue_done() is called.
    • negative integer β€” error occurred.
  • op_status β€” driver written value to specify operation status.

Returns

  • The user data pointer retrieved from device queue or NULL if no operation is ready for dequeue.

Definition at line 1593 of file rte_cryptodev.h.


πŸ’€ ENUMERATION TYPE DOCUMENTATION πŸ’€

enum rte_cryptodev_event_type

Definitions of Crypto device event types. The whole menu of things that can happen to your device πŸ‘‘

Enumerator

  • RTE_CRYPTODEV_EVENT_UNKNOWN β€” unknown event type
  • RTE_CRYPTODEV_EVENT_ERROR β€” error interrupt event
  • RTE_CRYPTODEV_EVENT_MAX β€” max value of this enum

Definition at line 639 of file rte_cryptodev.h.


🫢 FUNCTION DOCUMENTATION 🫢

Now for the actual functions, bestie. These are the ones you'll be calling β€” capability checks and lookups, chef's kiss πŸ‘‘


rte_cryptodev_sym_capability_get

const struct rte_cryptodev_symmetric_capability *
    rte_cryptodev_sym_capability_get (uint8_t dev_id, const struct
    rte_cryptodev_sym_capability_idx * idx)

Provide capabilities available for defined device and algorithm. Basically "what can this device actually do?" ✨

Parameters

  • dev_id β€” the identifier of the device.
  • idx β€” description of crypto algorithms.

Returns

  • Return description of the symmetric crypto capability if exist.
  • Return NULL if the capability not exist.

rte_cryptodev_asym_capability_get

const struct rte_cryptodev_asymmetric_xform_capability *
    rte_cryptodev_asym_capability_get (uint8_t dev_id, const struct
    rte_cryptodev_asym_capability_idx * idx)

Provide capabilities available for defined device and xform β€” the asymmetric edition πŸ¦‹

Parameters

  • dev_id β€” the identifier of the device.
  • idx β€” description of asym crypto xform.

Returns

  • Return description of the asymmetric crypto capability if exist.
  • Return NULL if the capability not exist.

rte_cryptodev_sym_capability_check_cipher

int rte_cryptodev_sym_capability_check_cipher (const struct
    rte_cryptodev_symmetric_capability * capability, uint16_t key_size,
    uint16_t iv_size)

Check if key size and initial vector are supported in the crypto cipher capability. Like a vibe check but for your params πŸ’…

Parameters

  • capability β€” description of the symmetric crypto capability.
  • key_size β€” cipher key size.
  • iv_size β€” cipher initial vector size.

Returns

  • Return 0 if the parameters are in range of the capability.
  • Return -1 if the parameters are out of range of the capability.

rte_cryptodev_sym_capability_check_auth

int rte_cryptodev_sym_capability_check_auth (const struct
    rte_cryptodev_symmetric_capability * capability, uint16_t key_size,
    uint16_t digest_size, uint16_t iv_size)

Check if key size and initial vector are supported in the crypto auth capability β€” same check, but for auth this time πŸŽ€

Parameters

  • capability β€” description of the symmetric crypto capability.
  • key_size β€” auth key size.
  • digest_size β€” auth digest size.
  • iv_size β€” auth initial vector size.

Returns

  • Return 0 if the parameters are in range of the capability.
  • Return -1 if the parameters are out of range of the capability.

πŸ’– rte_cryptodev_sym_capability_check_aead()

int rte_cryptodev_sym_capability_check_aead (const struct
    rte_cryptodev_symmetric_capability * capability, uint16_t key_size,
    uint16_t digest_size, uint16_t aad_size, uint16_t iv_size)

okay so this one is your vibe check for AEAD sizes πŸ’… it literally asks "does this capability vibe with these numbers?" β€” key, digest, AAD and IV all get checked against a symmetric crypto capability.

  • capability β€” the description of the symmetric crypto capability you're checking against.
  • key_size β€” the AEAD key size.
  • digest_size β€” the AEAD digest size.
  • aad_size β€” the AEAD AAD size.
  • iv_size β€” the AEAD IV size.

Returns:

  • 0 if the parameters are in range of the capability πŸŽ€
  • -1 if the parameters are out of range of the capability πŸ’€

πŸ¦‹ rte_cryptodev_asym_xform_capability_check_optype()

int rte_cryptodev_asym_xform_capability_check_optype (const struct
    rte_cryptodev_asymmetric_xform_capability * capability, enum
    rte_crypto_asym_op_type op_type)

Checks whether an op type is even supported. Very "do you serve?" energy ✨

  • capability β€” description of the asymmetric crypto capability.
  • op_type β€” the op type.

Returns:

  • 1 if the op type is supported πŸ‘‘
  • 0 if unsupported 😭

🧚 rte_cryptodev_asym_xform_capability_check_modlen()

int rte_cryptodev_asym_xform_capability_check_modlen (const struct
    rte_cryptodev_asymmetric_xform_capability * capability, uint16_t modlen)

Is this modulus length inside the supported range? That's the whole ask, bestie.

  • capability β€” description of the asymmetric crypto capability.
  • modlen β€” modulus length.

Returns:

  • 0 if the parameters are in range of the capability 🌸
  • -1 if the parameters are out of range of the capability πŸ™ˆ

🫢 rte_cryptodev_asym_xform_capability_check_hash()

bool rte_cryptodev_asym_xform_capability_check_hash (const struct
    rte_cryptodev_asymmetric_xform_capability * capability, enum
    rte_crypto_auth_algorithm hash)

Hash algorithm support check, but make it bool so it's giving yes/no main character energy πŸ”₯

  • capability β€” asymmetric crypto capability.
  • hash β€” hash algorithm.

Returns:

  • true if the hash algorithm is supported πŸ’–
  • false if the hash algorithm is not supported πŸ’€

⭐ rte_cryptodev_asym_xform_capability_check_opcap()

__rte_experimental int rte_cryptodev_asym_xform_capability_check_opcap
    (const struct rte_cryptodev_asymmetric_xform_capability * capability,
    enum rte_crypto_asym_op_type op_type, uint8_t cap)
⚠️ EXPERIMENTAL: this API may change without prior notice. Like, do not build your whole personality on it, it could shift under you 😭

Checks if an op capability is supported.

  • capability β€” description of the asymmetric crypto capability.
  • op_type β€” op type.
  • cap β€” op capability.

Returns:

  • 1 if the op capability is supported πŸŽ€
  • 0 if unsupported πŸ“

🌈 rte_cryptodev_get_cipher_algo_enum()

int rte_cryptodev_get_cipher_algo_enum (enum rte_crypto_cipher_algorithm *
    algo_enum, const char * algo_string)

Gives you the cipher algorithm enum, given an algorithm string. String in, enum out, slay πŸ’…

  • algo_enum β€” a pointer to the cipher algorithm enum to be filled.
  • algo_string β€” authentication algo string.

Returns:

  • -1 if string is not valid
  • 0 is the string is valid (that's literally what the page says, fr fr, keeping the typo for the culture) πŸ™ˆ

🌸 rte_cryptodev_get_auth_algo_enum()

int rte_cryptodev_get_auth_algo_enum (enum rte_crypto_auth_algorithm *
    algo_enum, const char * algo_string)

Same deal but for the authentication algorithm enum.

  • algo_enum β€” a pointer to the authentication algorithm enum to be filled.
  • algo_string β€” authentication algo string.

Returns:

  • -1 if string is not valid
  • 0 is the string is valid

πŸŽ€ rte_cryptodev_get_aead_algo_enum()

int rte_cryptodev_get_aead_algo_enum (enum rte_crypto_aead_algorithm *
    algo_enum, const char * algo_string)

And again, now for the AEAD algorithm enum ✨

  • algo_enum β€” a pointer to the AEAD algorithm enum to be filled.
  • algo_string β€” AEAD algorithm string.

Returns:

  • -1 if string is not valid
  • 0 is the string is valid

πŸ¦‹ rte_cryptodev_asym_get_xform_enum()

int rte_cryptodev_asym_get_xform_enum (enum rte_crypto_asym_xform_type *
    xform_enum, const char * xform_string)

Asymmetric edition: xform string β†’ xform enum. No cap 🧒

  • xform_enum β€” a pointer to the xform type enum to be filled.
  • xform_string β€” xform string.

Returns:

  • -1 if string is not valid
  • 0 if the string is valid

πŸ’œ rte_cryptodev_get_cipher_algo_string()

__rte_experimental const char * rte_cryptodev_get_cipher_algo_string (enum
    rte_crypto_cipher_algorithm algo_enum)

The reverse direction, bestie β€” enum in, cipher algorithm string out. (Also experimental, so, y'know, it's an experimental girlie.) πŸ”₯

  • algo_enum β€” cipher algorithm enum.

Returns:

  • NULL if enum is not valid
  • algo_string corresponding to enum πŸ‘‘

πŸ’œ rte_cryptodev_get_auth_algo_string()

__rte_experimental const char * rte_cryptodev_get_auth_algo_string (enum
    rte_crypto_auth_algorithm algo_enum)

Same thing but for authentication algorithms. Experimental too, obviously.

  • algo_enum β€” auth algorithm enum.

Returns:

  • NULL if enum is not valid
  • algo_string corresponding to enum 🌟

πŸ’œ rte_cryptodev_get_aead_algo_string()

__rte_experimental const char * rte_cryptodev_get_aead_algo_string (enum
    rte_crypto_aead_algorithm algo_enum)

And the AEAD version of the same trick.

  • algo_enum β€” AEAD algorithm enum.

Returns:

  • NULL if enum is not valid
  • algo_string corresponding to enum πŸŽ€

πŸ’œ rte_cryptodev_asym_get_xform_string()

__rte_experimental const char * rte_cryptodev_asym_get_xform_string (enum
    rte_crypto_asym_xform_type xform_enum)

Asymmetric xform enum β†’ string. Also experimental, also iconic.

  • xform_enum β€” xform type enum.

Returns:

  • NULL, if enum is not valid.
  • xform string, for valid enum. πŸ’–

⭐ rte_cryptodev_get_feature_name()

const char * rte_cryptodev_get_feature_name (uint64_t flag)

Gives you the name of a crypto device feature flag. Mask in, name out.

  • flag β€” the mask describing the flag.

Returns the name of this flag, or NULL if it's not a valid feature flag. 🚩

πŸ“ rte_cryptodev_get_dev_id()

int rte_cryptodev_get_dev_id (const char * name)

Device identifier for the named crypto device β€” like looking someone up in the group chat by name, except the name is a device name and the result is a dev_id.

  • name β€” device name to select the device structure.

Returns:

  • the crypto device identifier on success 🌸
  • -1 on failure to find the named crypto device 😭

🌟 rte_cryptodev_name_get()

const char * rte_cryptodev_name_get (uint8_t dev_id)

Opposite direction: you've got a dev_id, you want the crypto device name.

  • dev_id β€” the identifier of the device.

Returns:

  • the crypto device name πŸ‘‘
  • NULL if crypto device is not present πŸ’€

πŸ”’ rte_cryptodev_count()

uint8_t rte_cryptodev_count (void )

How many crypto devices have actually been successfully initialised. That's it. That's the function. ✨

Returns the total number of usable crypto devices. πŸŽ€

πŸ”’ rte_cryptodev_device_count_by_driver()

uint8_t rte_cryptodev_device_count_by_driver (uint8_t driver_id)

Number of crypto devices of a defined type β€” you hand it a driver and it counts.

  • driver_id β€” driver identifier.

Returns the number of crypto device. πŸ¦‹

πŸ”’ rte_cryptodev_devices_get()

uint8_t rte_cryptodev_devices_get (const char * driver_name, uint8_t *
    devices, uint8_t nb_devices)

Gives you both the number and the identifiers of attached crypto devices that use the same crypto driver. Two for one, we love efficiency πŸ’…

  • driver_name β€” driver name.
  • devices β€” output devices identifiers.
  • nb_devices β€” maximal number of devices.

Returns the number of attached crypto device. 🌈


πŸ‘‘ rte_cryptodev_configure()

int rte_cryptodev_configure (uint8_t dev_id, struct rte_cryptodev_config *
    config)

Configures a device. This one goes first, periodt β€” you literally have to call it before any other function in the API. It can also be re-invoked while a device is in the stopped state, which is lowkey handy.

  • dev_id β€” the identifier of the device to configure.
  • config β€” the crypto device configuration structure.

Returns:

  • 0: Success, device configured πŸŽ€
  • <0: error code returned by the driver configuration function πŸ’€

πŸ”₯ rte_cryptodev_start()

int rte_cryptodev_start (uint8_t dev_id)

Starts a device. This is the final step of the whole setup arc and it's giving main character energy: it sets the configured offload features and starts the transmit and the receive units of the device. On success, all the basic functions the API exports (link status, receive/transmit, and so on) can be invoked. So yeah β€” everything works after this. ✨

  • dev_id β€” the identifier of the device.

Returns:

  • 0: Success, device started πŸ‘‘
  • <0: error code of the driver device start function 😭

⏹️ rte_cryptodev_stop()

void rte_cryptodev_stop (uint8_t dev_id)

Stops a device β€” but good news, it's not forever: the device can be restarted with a call to rte_cryptodev_start(). It's giving "brb" not "goodbye". πŸ’…

  • dev_id β€” the identifier of the device.

πŸ’€ rte_cryptodev_close()

int rte_cryptodev_close (uint8_t dev_id)

Closes a device. The device cannot be restarted! Like, genuinely cannot. This is the permanent one, no takebacks, no "wait actuallyβ€”". πŸ™ˆ

  • dev_id β€” the identifier of the device.

Returns:

  • 0 on successfully closing device 🌸
  • <0 on failure to close device 😭

πŸŽ€ rte_cryptodev_queue_pair_setup()

int rte_cryptodev_queue_pair_setup (uint8_t dev_id, uint16_t queue_pair_id,
    const struct rte_cryptodev_qp_conf * qp_conf, int socket_id)

Allocates and sets up a receive queue pair for a device. Two jobs, one function, we stan a multitasker ✨

  • dev_id β€” the identifier of the device.
  • queue_pair_id β€” the index of the queue pairs to set up. The value must be in the range [0, nb_queue_pair - 1] previously supplied to rte_cryptodev_configure().
  • qp_conf β€” the pointer to the configuration data to be used for the queue pair.
  • socket_id β€” the socket_id argument is the socket identifier in case of NUMA. The value can be SOCKET_ID_ANY if there is no NUMA constraint for the DMA memory allocated for the receive queue pair. πŸ¦‹

Returns:

  • 0: Success, queue pair correctly set up πŸ’–
  • <0: queue pair configuration failed πŸ’€

⭐ rte_cryptodev_queue_pair_reset()

__rte_experimental int rte_cryptodev_queue_pair_reset (uint8_t dev_id,
    uint16_t queue_pair_id, const struct rte_cryptodev_qp_conf * qp_conf,
    int socket_id)
⚠️ EXPERIMENTAL: this API may change without prior notice. Experimental icon behaviour, handle with care 🫢

Resets a queue pair for a device. Big warning bestie: whoever calls this API has to make sure there are no enqueues to the queue and no pending/inflight packets sitting in the queue when the API is called. No cap, that part is on you. The nice part? It can reconfigure the queue pair when the queue pair configuration data is provided. ✨

  • dev_id β€” the identifier of the device.
  • queue_pair_id β€” the index of the queue pairs to set up. The value must be in the range [0, nb_queue_pair - 1] previously supplied to rte_cryptodev_configure().
  • qp_conf β€” the pointer to configuration data to be used for the queue pair. It should be NULL, if the API is called from an interrupt context.
  • socket_id β€” the socket_id argument is the socket identifier in case of NUMA. The value can be SOCKET_ID_ANY if there is no NUMA constraint for the DMA memory allocated for the queue pair. 🌸

Returns:

  • 0: queue pair is reset successfully πŸ‘‘
  • ENOTSUP: if the operation is not supported by the PMD πŸ™ˆ
  • <0: queue pair reset failed πŸ’€

🌟 rte_cryptodev_get_qp_status()

int rte_cryptodev_get_qp_status (uint8_t dev_id, uint16_t queue_pair_id)

Get the status of queue pairs setup on a specific crypto device.

ok we're picking up mid-function, right at its parameter list β€” no drama, just vibes πŸ’…

Parameters

  • dev_id β€” Crypto device identifier.
  • queue_pair_id β€” The index of the queue pairs to set up. The value must be in the range [0, nb_queue_pair β€’ 1] previously supplied to rte_cryptodev_configure().

Returns

  • 0: qp was not configured
  • 1: qp was configured
  • -EINVAL: device was not configured

uint16_t rte_cryptodev_queue_pair_count (uint8_t dev_id)

Get the number of queue pairs on a specific crypto device πŸŽ€

Parameters

  • dev_id β€” Crypto device identifier.

Returns

  • The number of configured queue pairs.

int rte_cryptodev_stats_get (uint8_t dev_id, struct rte_cryptodev_stats * stats)

Retrieve the general I/O statistics of a device. bestie wants the receipts πŸ“Šβœ¨

Parameters

  • dev_id β€” The identifier of the device.
  • stats β€” A pointer to a structure of type rte_cryptodev_stats to be filled with the values of device counters.

Returns

  • Zero if successful.
  • Non-zero otherwise.

void rte_cryptodev_stats_reset (uint8_t dev_id)

Reset the general I/O statistics of a device. clean slate era 🌸

Parameters

  • dev_id β€” The identifier of the device.

void rte_cryptodev_info_get (uint8_t dev_id, struct rte_cryptodev_info * dev_info)

Retrieve the contextual information of a device. it's giving "tell me everything about yourself" 🫢

Parameters

  • dev_id β€” The identifier of the device.
  • dev_info β€” A pointer to a structure of type rte_cryptodev_info to be filled with the contextual information of the device.
Note πŸ’‘ β€” The capabilities field of dev_info is set to point to the first element of an array of struct rte_cryptodev_capabilities. The element after the last valid element has it's op field set to RTE_CRYPTO_OP_TYPE_UNDEFINED. that undefined one is literally the "you've reached the end, babe" marker ✨

int rte_cryptodev_callback_register (uint8_t dev_id, enum rte_cryptodev_event_type event, rte_cryptodev_cb_fn cb_fn, void * cb_arg)

Register a callback function for specific device id. like adding someone to your close friends list πŸ‘‘

Parameters

  • dev_id β€” Device id.
  • event β€” Event interested.
  • cb_fn β€” User supplied callback function to be called.
  • cb_arg β€” Pointer to the parameters for the registered callback.

Returns

  • On success, zero.
  • On failure, a negative value.

int rte_cryptodev_callback_unregister (uint8_t dev_id, enum rte_cryptodev_event_type event, rte_cryptodev_cb_fn cb_fn, void * cb_arg)

Unregister a callback function for specific device id. respectfully removing them from the list πŸ™ˆ

Parameters

  • dev_id β€” The device identifier.
  • event β€” Event interested.
  • cb_fn β€” User supplied callback function to be called.
  • cb_arg β€” Pointer to the parameters for the registered callback.

Returns

  • On success, zero.
  • On failure, a negative value.

__rte_experimental int rte_cryptodev_queue_pair_event_error_query (uint8_t dev_id, uint16_t qp_id)

Warning ⚠️ β€” EXPERIMENTAL: this API may change without prior notice. she's still in her testing era, don't get attached 😭

Query a cryptodev queue pair if there are pending RTE_CRYPTODEV_EVENT_ERROR events. lowkey a vibe check on the queue pair πŸ”

Parameters

  • dev_id β€” The device identifier.
  • qp_id β€” Queue pair index to be queried.

Returns

  • 1 if requested queue has a pending event.
  • 0 if no pending event is found.
  • a negative value on failure

RTE_TAILQ_HEAD (rte_cryptodev_cb_list , rte_cryptodev_callback )

Structure to keep track of registered callbacks. a whole little list of your faves πŸ’–


void * rte_cryptodev_get_sec_ctx (uint8_t dev_id)

Get the security context for the cryptodev. handing you the keys to the security wing πŸ”

Parameters

  • dev_id β€” The device identifier.

Returns

  • NULL on error.
  • Pointer to security context on success.

struct rte_mempool * rte_cryptodev_sym_session_pool_create (const char * name, uint32_t nb_elts, uint32_t elt_size, uint32_t cache_size, uint16_t priv_size, int socket_id)

Create a symmetric session mempool. building the pool party from scratch πŸŠβ€β™€οΈβœ¨

Parameters

  • name β€” The unique mempool name.
  • nb_elts β€” The number of elements in the mempool.
  • elt_size β€” The size of the element. This should be the size of the cryptodev PMD session private data obtained through rte_cryptodev_sym_get_private_session_size() function call. For the user who wants to use the same mempool for heterogeneous PMDs this value should be the maximum value of their private session sizes. Please note the created mempool will have bigger elt size than this value as necessary session header and the possible padding are filled into each elt.
  • cache_size β€” The number of per-lcore cache elements
  • priv_size β€” The private data size of each session.
  • socket_id β€” The socket_id argument is the socket identifier in the case of NUMA. The value can be SOCKET_ID_ANY if there is no NUMA constraint for the reserved zone.

Returns

  • On success returns the created session mempool pointer
  • On failure returns NULL

struct rte_mempool * rte_cryptodev_asym_session_pool_create (const char * name, uint32_t nb_elts, uint32_t cache_size, uint16_t user_data_size, int socket_id)

Create an asymmetric session mempool. same pool energy, asymmetric edition πŸ¦‹

Parameters

  • name β€” The unique mempool name.
  • nb_elts β€” The number of elements in the mempool.
  • cache_size β€” The number of per-lcore cache elements
  • user_data_size β€” The size of user data to be placed after session private data.
  • socket_id β€” The socket_id argument is the socket identifier in the case of NUMA. The value can be SOCKET_ID_ANY if there is no NUMA constraint for the reserved zone.

Returns

  • On success return mempool
  • On failure returns NULL

void * rte_cryptodev_sym_session_create (uint8_t dev_id, struct rte_crypto_sym_xform * xforms, struct rte_mempool * mp)

Create symmetric crypto session and fill out private data for the device id, based on its device type. literally custom-making the session for that one specific device πŸ’…

Parameters

  • dev_id β€” ID of device that we want the session to be used on
  • xforms β€” Symmetric crypto transform operations to apply on flow processed with this session
  • mp β€” Mempool to allocate symmetric session objects from

Returns

  • On success return pointer to sym-session.
  • On failure returns NULL and rte_errno is set to the error code:
    • EINVAL on invalid arguments.
    • ENOMEM on memory error for session allocation.
    • ENOTSUP if device doesn't support session configuration.

int rte_cryptodev_asym_session_create (uint8_t dev_id, struct rte_crypto_asym_xform * xforms, struct rte_mempool * mp, void ** session)

Create and initialise an asymmetric crypto session structure. Calls the PMD to configure the private session data. ngl this one's a two-step, the PMD does the private part πŸ‘€

Parameters

  • dev_id β€” ID of device that we want the session to be used on
  • xforms β€” Asymmetric crypto transform operations to apply on flow processed with this session
  • mp β€” mempool to allocate asymmetric session objects from
  • session β€” void ** for session to be used

Returns

  • 0 on success.
  • -EINVAL on invalid arguments.
  • -ENOMEM on memory error for session allocation.
  • -ENOTSUP if device doesn't support session configuration.

int rte_cryptodev_sym_session_free (uint8_t dev_id, void * sess)

Frees session for the device id and returning it to its mempool. It is the application's responsibility to ensure that the session is not still in-flight operations using it. 🚨 bestie this one's on you β€” free it while something's still using it and that's a you problem, no cap

Parameters

  • dev_id β€” ID of device that uses the session.
  • sess β€” Session header to be freed.

Returns

  • 0 if successful.
  • -EINVAL if session is NULL or the mismatched device ids.

int rte_cryptodev_asym_session_free (uint8_t dev_id, void * sess)

Clears and frees asymmetric crypto session header and private data, returning it to its original mempool. clearing out the whole thing, header AND private data, very thorough 🧹✨

Parameters

  • dev_id β€” ID of device that uses the asymmetric session.
  • sess β€” Session header to be freed.

Returns

  • 0 if successful.
  • -EINVAL if device is invalid or session is NULL.

unsigned int rte_cryptodev_asym_get_header_session_size (void )

Get the size of the asymmetric session header. just the header babe, not the whole thing πŸ“

Returns

Size of the asymmetric header session.


unsigned int rte_cryptodev_sym_get_private_session_size (uint8_t dev_id)

Get the size of the private symmetric session data for a device.

Parameters

  • dev_id β€” The device identifier.

Returns

  • Size of the private data, if successful
  • 0 if device is invalid or does not have private symmetric session

unsigned int rte_cryptodev_asym_get_private_session_size (uint8_t dev_id)

Get the size of the private data for asymmetric session on device

Parameters

  • dev_id β€” The device identifier.

Returns

  • Size of the asymmetric private data, if successful
  • 0 if device is invalid or does not have private session

unsigned int rte_cryptodev_is_valid_dev (uint8_t dev_id)

Validate if the crypto device index is valid attached crypto device. the vibe check function fr fr βœ…

Parameters

  • dev_id β€” Crypto device index.

Returns

  • If the device index is valid (1) or not (0).

int rte_cryptodev_driver_id_get (const char * name)

Provide driver identifier. name in, id out πŸŽ€

Parameters

  • name β€” The pointer to a driver name.

Returns

The driver type identifier or -1 if no driver found


const char * rte_cryptodev_driver_name_get (uint8_t driver_id)

Provide driver name. the reverse trip, id in, name out πŸ¦‹

Parameters

  • driver_id β€” The driver identifier.

Returns

The driver name or null if no driver found


int rte_cryptodev_sym_session_set_user_data (void * sess, void * data, uint16_t size)

Store user data in a session. lil stash spot for your own stuff πŸ“

Parameters

  • sess β€” Session pointer allocated by rte_cryptodev_sym_session_create.
  • data β€” Pointer to the user data.
  • size β€” Size of the user data.

Returns

  • On success, zero.
  • On failure, a negative value.

uint64_t rte_cryptodev_sym_session_opaque_data_get (void * sess) [inline], [static]

Get opaque data from session handle. opaque like, you don't look inside, you just hold it πŸ’œ

Definition at line 1310 of file rte_cryptodev.h.


void rte_cryptodev_sym_session_opaque_data_set (void * sess, uint64_t opaque) [inline], [static]

Set opaque data in session handle.

Definition at line 1319 of file rte_cryptodev.h.


void * rte_cryptodev_sym_session_get_user_data (void * sess)

Get user data stored in a session. retrieving the lil stash πŸŽ€

Parameters

  • sess β€” Session pointer allocated by rte_cryptodev_sym_session_create.

Returns

  • On success return pointer to user data.
  • On failure returns NULL.

int rte_cryptodev_asym_session_set_user_data (void * sess, void * data, uint16_t size)

Store user data in an asymmetric session. same stash energy, asymmetric flavor ✨

Parameters

  • sess β€” Session pointer allocated by rte_cryptodev_asym_session_create.
  • data β€” Pointer to the user data.
  • size β€” Size of the user data.

Returns

  • On success, zero.
  • -EINVAL if the session pointer is invalid.
  • -ENOMEM β€” the available user data size is smaller than the size parameter. 😭

rte_cryptodev_asym_session_get_user_data β€” grab the user data stored in an asymmetric session, bestie ✨

void * rte_cryptodev_asym_session_get_user_data (void * sess)

Parameters

  • sess β€” session pointer allocated by rte_cryptodev_asym_session_create.

Returns

  • On success, a pointer to the user data. 🫢
  • On failure, NULL. πŸ’€

rte_cryptodev_sym_cpu_crypto_process β€” do the actual crypto processing (encrypt/digest or auth/decrypt) on the data the user handed over πŸ”₯

uint32_t rte_cryptodev_sym_cpu_crypto_process (uint8_t dev_id, void * sess,
    union rte_crypto_sym_ofs ofs, struct rte_crypto_sym_vec * vec)

Parameters

  • dev_id β€” the device identifier.
  • sess β€” cryptodev session structure.
  • ofs β€” start and stop offsets for auth and cipher operations.
  • vec β€” vectorized operation descriptor.

Returns

  • The number of successfully processed packets. πŸ‘‘

rte_cryptodev_get_raw_dp_ctx_size β€” get the size of the raw data-path context buffer 🌈

int rte_cryptodev_get_raw_dp_ctx_size (uint8_t dev_id)

Parameters

  • dev_id β€” the device identifier.

Returns

  • If the device supports raw data-path APIs, return the context size. ✨
  • If the device does not support the APIs, return -1. πŸ™ˆ

rte_cryptodev_session_event_mdata_set β€” set session event meta data πŸŽ€

int rte_cryptodev_session_event_mdata_set (uint8_t dev_id, void * sess, enum
    rte_crypto_op_type op_type, enum rte_crypto_op_sess_type sess_type, void
    * ev_mdata, uint16_t size)

Parameters

  • dev_id β€” the device identifier.
  • sess β€” crypto or security session.
  • op_type β€” operation type.
  • sess_type β€” session type.
  • ev_mdata β€” pointer to the event crypto meta data (aka union rte_event_crypto_metadata).
  • size β€” size of ev_mdata.

Returns

  • On success, zero. πŸ’–
  • On failure, a negative value. 😭

rte_cryptodev_configure_raw_dp_ctx β€” configure raw data-path context data πŸ¦‹

int rte_cryptodev_configure_raw_dp_ctx (uint8_t dev_id, uint16_t qp_id,
    struct rte_crypto_raw_dp_ctx * ctx, enum rte_crypto_op_sess_type
    sess_type, union rte_cryptodev_session_ctx session_ctx, uint8_t is_update)

Parameters

  • dev_id β€” the device identifier.
  • qp_id β€” the index of the queue pair from which to retrieve processed packets. The value must be in the range [0, nb_queue_pair - 1] previously supplied to rte_cryptodev_configure().
  • ctx β€” the raw data-path context data.
  • sess_type β€” session type.
  • session_ctx β€” session context data.
  • is_update β€” set 0 if it is to initialize the ctx. Set 1 if ctx is initialized and only to update session context data.

Returns

  • On success, return 0. 🌸
  • On failure, return a negative integer.
    • -EINVAL β€” if input parameters are invalid.
    • -ENOTSUP β€” if the crypto device does not support raw DP operations with the provided session. πŸ’…

rte_cryptodev_raw_enqueue_burst β€” enqueue a vectorized operation descriptor into the device queue, but the driver may or may not start processing until rte_cryptodev_raw_enqueue_done() is called πŸ‘€

uint32_t rte_cryptodev_raw_enqueue_burst (struct rte_crypto_raw_dp_ctx *
    ctx, struct rte_crypto_sym_vec * vec, union rte_crypto_sym_ofs ofs, void
    ** user_data, int * enqueue_status)

Parameters

  • ctx β€” the initialized raw data-path context data.
  • vec β€” vectorized operation descriptor.
  • ofs β€” start and stop offsets for auth and cipher operations.
  • user_data β€” the array of user data for dequeue later.
  • enqueue_status β€” driver-written value to specify the enqueue status. Possible values:
    • 1: the number of operations returned are enqueued successfully.
    • 0: the number of operations returned are cached into the queue but are not processed until rte_cryptodev_raw_enqueue_done() is called.
    • negative integer: an error occurred. πŸ’€

Returns

  • The number of operations in the descriptor successfully enqueued or cached into the queue but not enqueued yet, depending on the enqueue_status value. ⭐

rte_cryptodev_raw_enqueue β€” enqueue a single raw data vector into the device queue, but the driver may or may not start processing until rte_cryptodev_raw_enqueue_done() is called πŸ’–

__rte_experimental __rte_always_inline int rte_cryptodev_raw_enqueue (struct
    rte_crypto_raw_dp_ctx * ctx, struct rte_crypto_vec * data_vec, uint16_t
    n_data_vecs, union rte_crypto_sym_ofs ofs, struct rte_crypto_va_iova_ptr
    * iv, struct rte_crypto_va_iova_ptr * digest, struct
    rte_crypto_va_iova_ptr * aad_or_auth_iv, void * user_data) [static]

Parameters

  • ctx β€” the initialized raw data-path context data.
  • data_vec β€” the buffer data vector.
  • n_data_vecs β€” number of buffer data vectors.
  • ofs β€” start and stop offsets for auth and cipher operations.
  • iv β€” IV virtual and IOVA addresses.
  • digest β€” digest virtual and IOVA addresses.
  • aad_or_auth_iv β€” AAD or auth IV virtual and IOVA addresses, depends on the algorithm used.
  • user_data β€” the user data.

Returns

  • 1: the data vector is enqueued successfully. πŸŽ€
  • 0: the data vector is cached into the queue but is not processed until rte_cryptodev_raw_enqueue_done() is called.
  • negative integer: failure. 😭

Definition at line 1695 of file rte_cryptodev.h.


rte_cryptodev_raw_enqueue_done β€” start processing all enqueued operations from the last rte_cryptodev_configure_raw_dp_ctx() call πŸš€

int rte_cryptodev_raw_enqueue_done (struct rte_crypto_raw_dp_ctx * ctx,
    uint32_t n)

Parameters

  • ctx β€” the initialized raw data-path context data.
  • n β€” the number of operations cached.

Returns

  • On success, return 0. ✨
  • On failure, return a negative integer. πŸ™ˆ

rte_cryptodev_raw_dequeue_burst β€” dequeue a burst of symmetric crypto processing 🌟

uint32_t rte_cryptodev_raw_dequeue_burst (struct rte_crypto_raw_dp_ctx *
    ctx, rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count, uint32_t
    max_nb_to_dequeue, rte_cryptodev_raw_post_dequeue_t post_dequeue, void
    ** out_user_data, uint8_t is_user_data_array, uint32_t * n_success, int
    * dequeue_status)

Parameters

  • ctx β€” the initialized raw data-path context data.
  • get_dequeue_count β€” user-provided callback function to obtain the dequeue operation count.
  • max_nb_to_dequeue β€” when get_dequeue_count is NULL, this value is used to pass the maximum number of operations to be dequeued.
  • post_dequeue β€” user-provided callback function to post-process a dequeued operation.
  • out_user_data β€” user data pointer array to be retrieved from the device queue. In case is_user_data_array is set, there should be enough room to store all user data.
  • is_user_data_array β€” set 1 if every dequeued user data will be written into the out_user_data array. Set 0 if only the first user data will be written into the out_user_data array.
  • n_success β€” driver-written value to specify the total successful operations count.
  • dequeue_status β€” driver-written value to specify the dequeue status. Possible values:
    • 1: successfully dequeued the number of operations returned. The user data previously set during enqueue is stored in the out_user_data.
    • 0: the number of operations returned are completed and the user data is stored in the out_user_data, but they are not freed from the queue until rte_cryptodev_raw_dequeue_done() is called.
    • negative integer: an error occurred. πŸ’€

Returns

  • The number of operations dequeued or completed but not freed from the queue, depending on the dequeue_status value. 🫢

rte_cryptodev_raw_dequeue β€” dequeue a single symmetric crypto processing πŸ’…

__rte_experimental __rte_always_inline void * rte_cryptodev_raw_dequeue
    (struct rte_crypto_raw_dp_ctx * ctx, int * dequeue_status, enum
    rte_crypto_op_status * op_status) [static]

Parameters

  • ctx β€” the initialized raw data-path context data.
  • dequeue_status β€” driver-written value to specify the dequeue status. Possible values:
    • 1: successfully dequeued an operation. The user data is returned.
    • 0: the first operation in the queue is completed and the user data previously set during enqueue is returned, but it is not freed from the queue until rte_cryptodev_raw_dequeue_done() is called.
    • negative integer: an error occurred. 😭
  • op_status β€” driver-written value to specify operation status.

Returns

  • The user data pointer retrieved from the device queue, or NULL if no operation is ready for dequeue. 🌈

Definition at line 1795 of file rte_cryptodev.h.


rte_cryptodev_raw_dequeue_done β€” inform the queue pair that dequeue operations are finished πŸŽ€

int rte_cryptodev_raw_dequeue_done (struct rte_crypto_raw_dp_ctx * ctx,
    uint32_t n)

Parameters

  • ctx β€” the initialized raw data-path context data.
  • n β€” the number of operations.

Returns

  • On success, return 0. πŸ’–
  • On failure, return a negative integer. πŸ™ˆ

rte_cryptodev_add_enq_callback β€” add a user callback for a given crypto device and queue pair that will be called on crypto ops enqueue πŸ‘‘

struct rte_cryptodev_cb * rte_cryptodev_add_enq_callback (uint8_t dev_id,
    uint16_t qp_id, rte_cryptodev_callback_fn cb_fn, void * cb_arg)

This API configures a function to be called for each burst of crypto ops received on a given crypto device queue pair. The return value is a pointer that can be used later to remove the callback using rte_cryptodev_remove_enq_callback(). ✨

Callbacks registered by the application would not survive rte_cryptodev_configure() as it reinitializes the callback list. It is the user’s responsibility to remove all installed callbacks before calling rte_cryptodev_configure() to avoid possible memory leakage. The application is expected to call the add API after rte_cryptodev_configure(). 😭

Multiple functions can be registered per queue pair & they are called in the order they were added. The API does not restrict on the maximum number of callbacks. πŸ’«

Parameters

  • dev_id β€” the identifier of the device.
  • qp_id β€” the index of the queue pair on which ops are to be enqueued for processing. The value must be in the range [0, nb_queue_pairs - 1] previously supplied to rte_cryptodev_configure.
  • cb_fn β€” the callback function.
  • cb_arg β€” a generic pointer parameter which will be passed to each invocation of the callback function on this crypto device and queue pair.

Returns

  • NULL on error & rte_errno will contain the error code. πŸ’€
  • On success, a pointer value which can later be used to remove the callback. 🫢

rte_cryptodev_remove_enq_callback β€” remove a user callback function for a given crypto device and queue pair 🧚

int rte_cryptodev_remove_enq_callback (uint8_t dev_id, uint16_t qp_id,
    struct rte_cryptodev_cb * cb)

This function is used to remove enqueue callbacks that were added to a crypto device queue pair using rte_cryptodev_add_enq_callback(). πŸ’œ

πŸ’… the rest of rte_cryptodev_remove_enq_callback's deets

okay so bestie, picking right back up where we left off β€” here's what you gotta hand that enqueue-callback remover:

Parameters

  • dev_id β€” the identifier of the device 🫢
  • qp_id β€” the index of the queue pair on which ops are to be enqueued. The value must be in the range [0, nb_queue_pairs - 1] previously supplied to rte_cryptodev_configure.
  • cb β€” pointer to user supplied callback created via rte_cryptodev_add_enq_callback().

Returns

  • 0: success, the callback was removed ✨
  • <0: the dev_id or the qp_id is out of range, or the callback is NULL or not found for the crypto device queue pair 😭

πŸ¦‹ struct rte_cryptodev_cb * rte_cryptodev_add_deq_callback (uint8_t dev_id, uint16_t qp_id, rte_cryptodev_callback_fn cb_fn, void * cb_arg)

Add a user callback for a given crypto device and queue pair which will be called on crypto ops dequeue. yes, dequeue, not enqueue β€” read it again, i'll wait πŸ’…

This API configures a function to be called for each burst of crypto ops received on a given crypto device queue pair. The return value is a pointer that you can use later to remove the callback using rte_cryptodev_remove_deq_callback().

⚠️ Callbacks registered by the application would not survive rte_cryptodev_configure() because it reinitializes the callback list. It is the user's responsibility to remove all installed callbacks before calling rte_cryptodev_configure() to avoid possible memory leakage. The application is expected to call this add API after rte_cryptodev_configure().

Multiple functions can be registered per queue pair & they are called in the order they were added. The API does not restrict the maximum number of callbacks β€” go off, register as many as your heart desires πŸ’–

Parameters

  • dev_id β€” the identifier of the device.
  • qp_id β€” the index of the queue pair on which ops are to be dequeued. The value must be in the range [0, nb_queue_pairs - 1] previously supplied to rte_cryptodev_configure.
  • cb_fn β€” the callback function.
  • cb_arg β€” a generic pointer parameter which will be passed to each invocation of the callback function on this crypto device and queue pair.

Returns

  • NULL on error & rte_errno will contain the error code πŸ’€
  • On success, a pointer value which can later be used to remove the callback πŸ‘‘

πŸŽ€ int rte_cryptodev_remove_deq_callback (uint8_t dev_id, uint16_t qp_id, struct rte_cryptodev_cb * cb)

Remove a user callback function for a given crypto device and queue pair.

This function is used to remove dequeue callbacks that were added to a crypto device queue pair using rte_cryptodev_add_deq_callback(). it's the cleanup era, we love to see it 🌸

Parameters

  • dev_id β€” the identifier of the device.
  • qp_id β€” the index of the queue pair on which ops are to be dequeued. The value must be in the range [0, nb_queue_pairs - 1] previously supplied to rte_cryptodev_configure.
  • cb β€” pointer to user supplied callback created via rte_cryptodev_add_deq_callback().

Returns

  • 0: success, callback was removed ✨
  • <0: the dev_id or the qp_id is out of range, or the callback is NULL or not found for the crypto device queue pair 😭

🧚 uint16_t rte_cryptodev_dequeue_burst (uint8_t dev_id, uint16_t qp_id, struct rte_crypto_op ** ops, uint16_t nb_ops) [inline], [static]

Dequeue a burst of processed crypto operations from a queue on the crypto device. the dequeued ops are stored in rte_crypto_op structures whose pointers are supplied in the ops array β€” it's giving "here's your stuff back, bestie" 🫢

The rte_cryptodev_dequeue_burst() function returns the number of ops actually dequeued, which is the number of rte_crypto_op data structures effectively supplied into the ops array.

A return value equal to nb_ops indicates that the queue contained at least nb_ops operations, and this is likely to signify that other processed operations remain in the device's output queue. Applications implementing a "retrieve as many processed operations as possible" policy can check this specific case and keep invoking the rte_cryptodev_dequeue_burst() function until a value less than nb_ops is returned. literally just keep looping until it's not full anymore πŸ”₯

The rte_cryptodev_dequeue_burst() function does not provide any error notification, to avoid the corresponding overhead. no error messages, no drama, just vibes (and speed) πŸ’€

Parameters

  • dev_id β€” the symmetric crypto device identifier.
  • qp_id β€” the index of the queue pair from which to retrieve processed packets. The value must be in the range [0, nb_queue_pair - 1] previously supplied to rte_cryptodev_configure().
  • ops β€” the address of an array of pointers to rte_crypto_op structures that must be large enough to store nb_ops pointers in it.
  • nb_ops β€” the maximum number of operations to dequeue.

Returns

  • The number of operations actually dequeued, which is the number of pointers to rte_crypto_op structures effectively supplied to the ops array.

Definition at line 1992 of file rte_cryptodev.h.


🌈 uint16_t rte_cryptodev_enqueue_burst (uint8_t dev_id, uint16_t qp_id, struct rte_crypto_op ** ops, uint16_t nb_ops) [inline], [static]

Enqueue a burst of operations for processing on a crypto device. the sending-off era, main character energy fr fr πŸ‘‘

The rte_cryptodev_enqueue_burst() function is invoked to place crypto operations on the queue qp_id of the device designated by its dev_id.

The nb_ops parameter is the number of operations to process which are supplied in the ops array of rte_crypto_op structures.

The rte_cryptodev_enqueue_burst() function returns the number of operations it actually enqueued for processing. A return value equal to nb_ops means that all packets have been enqueued β€” slay, full send ✨

Parameters

  • dev_id β€” the identifier of the device.
  • qp_id β€” the index of the queue pair which packets are to be enqueued for processing. The value must be in the range [0, nb_queue_pairs - 1] previously supplied to rte_cryptodev_configure.
  • ops β€” the address of an array of nb_ops pointers to rte_crypto_op structures which contain the crypto operations to be processed.
  • nb_ops β€” the number of operations to process.

Returns

The number of operations actually enqueued on the crypto device. The return value can be less than the value of the nb_ops parameter when the crypto device's queue is full, or if invalid parameters are specified in a rte_crypto_op β€” so yeah, check that number, don't just assume πŸ™ˆ

Definition at line 2064 of file rte_cryptodev.h.


πŸ’œ __rte_experimental int rte_cryptodev_qp_depth_used (uint8_t dev_id, uint16_t qp_id) [inline], [static]

⚠️ Warning: EXPERIMENTAL: this API may change, or be removed, without prior notice. it's in its experimental era, we respect the journey but don't get too attached πŸ’€

Get the number of used descriptors, aka the depth, of a cryptodev queue pair.

This function retrieves the number of used descriptors in a crypto queue. Applications can use this API in the fast path to inspect QP occupancy and take appropriate action. lowkey a vibe check for your queue πŸ¦‹

Since it is a fast-path function, no check is performed on dev_id and qp_id. The caller must therefore ensure that the device is enabled and the queue pair is set up. no safety net, bestie β€” that's on you 😭

Parameters

  • dev_id β€” the identifier of the device.
  • qp_id β€” the index of the queue pair for which the used descriptor count is to be retrieved. The value must be in the range [0, nb_queue_pairs - 1] previously supplied to rte_cryptodev_configure.

Returns

The number of used descriptors on the specified queue pair, or:

  • (-ENOTSUP) if the device does not support this function.

Definition at line 2127 of file rte_cryptodev.h.


πŸ‘‘ AUTHOR

Generated automatically by Doxygen for DPDK from the source code. not me being a whole autogenerated icon πŸ’…


and that's the whole page, bestie β€” we made it πŸŽ€ ok and for the cute little sign-off: this masterpiece is from DPDK, Version 26.03.0, and it's the rte_cryptodev.h(3) manual page. go forth and enqueue responsibly, mwah 🫢✨🌸

πŸ“¦ where this page comes from