rte_cryptodev.h(3)
π¦ 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_rangestruct rte_cryptodev_symmetric_capabilitystruct rte_cryptodev_asymmetric_xform_capabilitystruct rte_cryptodev_asymmetric_capabilitystruct rte_cryptodev_capabilitiesstruct rte_cryptodev_sym_capability_idxstruct rte_cryptodev_asym_capability_idxstruct rte_cryptodev_infostruct rte_cryptodev_qp_confstruct rte_cryptodev_statsstruct rte_cryptodev_configstruct rte_cryptodev_cbunion rte_cryptodev_session_ctxstruct 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 asc,t,o.rte_crypto_op_ctophys_offset(c, o)β the c-to-phys offset macro, argumentscando.RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_512_BYTESβ set toRTE_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β0RTE_CRYPTODEV_QP_PRIORITY_NORMALβ128RTE_CRYPTODEV_QP_PRIORITY_LOWESTβ255
heads up bestie:HIGHESTis the smallest number andLOWESTis 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β returnsuint16_t, takesuint16_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β returnsvoid, takesuint8_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β returnsuint32_t, takesvoid *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β returnsint, takesvoid *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β returnsint, takesvoid *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β returnsuint32_t, takesvoid *user_data:
typedef uint32_t(* rte_cryptodev_raw_get_dequeue_count_t) (void
*user_data)
rte_cryptodev_raw_post_dequeue_tβ returnsvoid, takesvoid *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β returnsuint32_t, takesvoid *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β returnsvoid *, takesvoid *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 filerte_cryptodev.h.RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO (1ULL << 1)β Asymmetric crypto operations are supported. Definition at line 522 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING (1ULL << 2)β Chaining symmetric crypto operations are supported. Definition at line 524 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_CPU_SSE (1ULL << 3)β Utilises CPU SIMD SSE instructions. Definition at line 526 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_CPU_AVX (1ULL << 4)β Utilises CPU SIMD AVX instructions. Definition at line 528 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_CPU_AVX2 (1ULL << 5)β Utilises CPU SIMD AVX2 instructions. Definition at line 530 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_CPU_AESNI (1ULL << 6)β Utilises CPU AES-NI instructions. Definition at line 532 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_HW_ACCELERATED (1ULL << 7)β Operations are off-loaded to an external hardware accelerator. Definition at line 534 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_CPU_AVX512 (1ULL << 8)β Utilises CPU SIMD AVX512 instructions. Definition at line 538 of filerte_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 filerte_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 filerte_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 filerte_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 filerte_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 filerte_cryptodev.h.RTE_CRYPTODEV_FF_CPU_NEON (1ULL << 14)β Utilises CPU NEON instructions. Definition at line 559 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_CPU_ARM_CE (1ULL << 15)β Utilises ARM CPU Cryptographic Extensions. Definition at line 561 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_SECURITY (1ULL << 16)β Support Security Protocol Processing. Definition at line 563 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP (1ULL << 17)β Support RSA Private Key OP with exponent. Definition at line 565 of filerte_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 filerte_cryptodev.h.RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED (1ULL << 19)β Support encrypted-digest operations where digest is appended to data. Definition at line 569 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_ASYM_SESSIONLESS (1ULL << 20)β Support asymmetric session-less operations. Definition at line 571 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_SYM_CPU_CRYPTO (1ULL << 21)β Support symmetric cpu-crypto processing. Definition at line 573 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_SYM_SESSIONLESS (1ULL << 22)β Support symmetric session-less operations. Definition at line 575 of filerte_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 filerte_cryptodev.h.RTE_CRYPTODEV_FF_SYM_RAW_DP (1ULL << 24)β Support accelerator specific symmetric raw data-path APIs. Definition at line 579 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_CIPHER_MULTIPLE_DATA_UNITS (1ULL << 25)β Support operations on multiple data-units message. Definition at line 581 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_CIPHER_WRAPPED_KEY (1ULL << 26)β Support wrapped key in cipher xform. Definition at line 583 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_SECURITY_INNER_CSUM (1ULL << 27)β Support inner checksum computation/verification. Definition at line 585 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_SECURITY_RX_INJECT (1ULL << 28)β Support Rx injection after security processing. Definition at line 587 of filerte_cryptodev.h.RTE_CRYPTODEV_FF_MLDSA_SIGN_PREHASH (1ULL << 29)β Support Pre Hash ML-DSA Signature Generation. Definition at line 589 of filerte_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 torte_cryptodev_configure.opsβ the address of an array ofnb_opspointers torte_crypto_opstructures 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 untilrte_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 untilrte_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β whenget_dequeue_countisNULLthis 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 ofis_user_data_arrayis set there should be enough room to store all user data.is_user_data_arrayβ set1if every dequeued user data will be written intoout_user_dataarray. Set0if only the first user data will be written intoout_user_dataarray.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 untilrte_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 untilrte_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
NULLif 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 typeRTE_CRYPTODEV_EVENT_ERRORβ error interrupt eventRTE_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
NULLif 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
NULLif 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
0if the parameters are in range of the capability. - Return
-1if 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
0if the parameters are in range of the capability. - Return
-1if 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:
0if the parameters are in range of the capability π-1if 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:
1if the op type is supported π0if 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:
0if the parameters are in range of the capability πΈ-1if 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:
trueif the hash algorithm is supported πfalseif 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:
1if the op capability is supported π0if 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:
-1if string is not valid0is 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:
-1if string is not valid0is 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:
-1if string is not valid0is 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:
-1if string is not valid0if 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:
NULLif enum is not validalgo_stringcorresponding 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:
NULLif enum is not validalgo_stringcorresponding 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:
NULLif enum is not validalgo_stringcorresponding 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 πΈ
-1on 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 π
NULLif 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:
0on successfully closing device πΈ<0on 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 torte_cryptodev_configure().qp_confβ the pointer to the configuration data to be used for the queue pair.socket_idβ thesocket_idargument is the socket identifier in case of NUMA. The value can beSOCKET_ID_ANYif 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 torte_cryptodev_configure().qp_confβ the pointer to configuration data to be used for the queue pair. It should beNULL, if the API is called from an interrupt context.socket_idβ thesocket_idargument is the socket identifier in case of NUMA. The value can beSOCKET_ID_ANYif 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 torte_cryptodev_configure().
Returns
0: qp was not configured1: 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 typerte_cryptodev_statsto 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 typerte_cryptodev_infoto be filled with the contextual information of the device.
Note π‘ β Thecapabilitiesfield ofdev_infois set to point to the first element of an array ofstruct rte_cryptodev_capabilities. The element after the last valid element has it'sopfield set toRTE_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
1if requested queue has a pending event.0if 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
NULLon 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 throughrte_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 biggereltsize than this value as necessary session header and the possible padding are filled into eachelt.cache_sizeβ The number of per-lcore cache elementspriv_sizeβ The private data size of each session.socket_idβ Thesocket_idargument is the socket identifier in the case of NUMA. The value can beSOCKET_ID_ANYif 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 elementsuser_data_sizeβ The size of user data to be placed after session private data.socket_idβ Thesocket_idargument is the socket identifier in the case of NUMA. The value can beSOCKET_ID_ANYif 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 onxformsβ Symmetric crypto transform operations to apply on flow processed with this sessionmpβ Mempool to allocate symmetric session objects from
Returns
- On success return pointer to sym-session.
- On failure returns
NULLandrte_errnois set to the error code:EINVALon invalid arguments.ENOMEMon memory error for session allocation.ENOTSUPif 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 onxformsβ Asymmetric crypto transform operations to apply on flow processed with this sessionmpβ mempool to allocate asymmetric session objects fromsessionβ void ** for session to be used
Returns
0on success.-EINVALon invalid arguments.-ENOMEMon memory error for session allocation.-ENOTSUPif 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
0if successful.-EINVALif session isNULLor 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
0if successful.-EINVALif device is invalid or session isNULL.
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
0if 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
0if 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 byrte_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 byrte_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 byrte_cryptodev_asym_session_create.dataβ Pointer to the user data.sizeβ Size of the user data.
Returns
- On success, zero.
-EINVALif the session pointer is invalid.-ENOMEMβ the available user data size is smaller than thesizeparameter. π
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 byrte_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 (akaunion rte_event_crypto_metadata).sizeβ size ofev_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 torte_cryptodev_configure().ctxβ the raw data-path context data.sess_typeβ session type.session_ctxβ session context data.is_updateβ set0if it is to initialize thectx. Set1ifctxis 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 untilrte_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_statusvalue. β
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 untilrte_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β whenget_dequeue_countisNULL, 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 caseis_user_data_arrayis set, there should be enough room to store all user data.is_user_data_arrayβ set1if every dequeued user data will be written into theout_user_dataarray. Set0if only the first user data will be written into theout_user_dataarray.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 theout_user_data.0: the number of operations returned are completed and the user data is stored in theout_user_data, but they are not freed from the queue untilrte_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_statusvalue. π«Ά
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 untilrte_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
NULLif 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 surviverte_cryptodev_configure()as it reinitializes the callback list. It is the userβs responsibility to remove all installed callbacks before callingrte_cryptodev_configure()to avoid possible memory leakage. The application is expected to call the add API afterrte_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 torte_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
NULLon error &rte_errnowill 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 torte_cryptodev_configure.cbβ pointer to user supplied callback created viarte_cryptodev_add_enq_callback().
Returns
0: success, the callback was removed β¨<0: thedev_idor theqp_idis out of range, or the callback isNULLor 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 surviverte_cryptodev_configure()because it reinitializes the callback list. It is the user's responsibility to remove all installed callbacks before callingrte_cryptodev_configure()to avoid possible memory leakage. The application is expected to call this add API afterrte_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 torte_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
NULLon error &rte_errnowill 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 torte_cryptodev_configure.cbβ pointer to user supplied callback created viarte_cryptodev_add_deq_callback().
Returns
0: success, callback was removed β¨<0: thedev_idor theqp_idis out of range, or the callback isNULLor 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 torte_cryptodev_configure().opsβ the address of an array of pointers torte_crypto_opstructures that must be large enough to storenb_opspointers 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_opstructures effectively supplied to theopsarray.
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 torte_cryptodev_configure.opsβ the address of an array ofnb_opspointers torte_crypto_opstructures 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 ondev_idandqp_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 torte_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
- nixos 26.05: dpdk 26.03
- nixpkgs unstable: dpdk 26.03
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms