FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
cryptodev_dp_api.c File Reference
+ Include dependency graph for cryptodev_dp_api.c:

Go to the source code of this file.

Data Structures

struct  cryptodev_key_t
 
struct  cryptodev_inst_t
 
struct  cryptodev_numa_data_t
 
struct  cryptodev_engine_thread_t
 
struct  cryptodev_main_t
 

Macros

#define always_inline   static inline
 
#define CRYPTODEV_NB_CRYPTO_OPS   1024
 
#define CRYPTODEV_MAX_INFLIGHT   (CRYPTODEV_NB_CRYPTO_OPS - 1)
 
#define CRYPTODEV_AAD_MASK   (CRYPTODEV_NB_CRYPTO_OPS - 1)
 
#define CRYPTODEV_DEQ_CACHE_SZ   32
 
#define CRYPTODEV_NB_SESSION   10240
 
#define CRYPTODEV_MAX_AAD_SIZE   16
 
#define CRYPTODEV_MAX_N_SGL   8
 maximum number of segments More...
 
#define foreach_vnet_aead_crypto_conversion
 
#define foreach_cryptodev_link_async_alg
 crypto (alg, cryptodev_alg), hash (alg, digest-size) More...
 
#define GET_RING_OBJ(r, pos, f)
 

Enumerations

enum  cryptodev_op_type_t {
  CRYPTODEV_OP_TYPE_ENCRYPT = 0, CRYPTODEV_OP_TYPE_DECRYPT, CRYPTODEV_N_OP_TYPES, CRYPTODEV_OP_TYPE_ENCRYPT = 0,
  CRYPTODEV_OP_TYPE_DECRYPT, CRYPTODEV_N_OP_TYPES
}
 
enum  cryptodev_resource_assign_op_t { CRYPTODEV_RESOURCE_ASSIGN_AUTO = 0, CRYPTODEV_RESOURCE_ASSIGN_UPDATE, CRYPTODEV_RESOURCE_ASSIGN_AUTO = 0, CRYPTODEV_RESOURCE_ASSIGN_UPDATE }
 

Functions

static int prepare_aead_xform (struct rte_crypto_sym_xform *xform, cryptodev_op_type_t op_type, const vnet_crypto_key_t *key, u32 aad_len)
 
static int prepare_linked_xform (struct rte_crypto_sym_xform *xforms, cryptodev_op_type_t op_type, const vnet_crypto_key_t *key)
 
static int cryptodev_session_create (vnet_crypto_key_t *const key, struct rte_mempool *sess_priv_pool, cryptodev_key_t *session_pair, u32 aad_len)
 
static void cryptodev_session_del (struct rte_cryptodev_sym_session *sess)
 
static int cryptodev_check_supported_vnet_alg (vnet_crypto_key_t *key)
 
static_always_inline void cryptodev_sess_handler (vlib_main_t *vm, vnet_crypto_key_op_t kop, vnet_crypto_key_index_t idx, u32 aad_len)
 
void cryptodev_key_handler (vlib_main_t *vm, vnet_crypto_key_op_t kop, vnet_crypto_key_index_t idx)
 
static_always_inline void cryptodev_mark_frame_err_status (vnet_crypto_async_frame_t *f, vnet_crypto_op_status_t s)
 
static_always_inline int cryptodev_frame_build_sgl (vlib_main_t *vm, enum rte_iova_mode iova_mode, struct rte_crypto_vec *data_vec, u16 *n_seg, vlib_buffer_t *b, u32 size)
 
static_always_inline u64 compute_ofs_linked_alg (vnet_crypto_async_frame_elt_t *fe, i16 *min_ofs, u32 *max_end)
 
static_always_inline int cryptodev_frame_linked_algs_enqueue (vlib_main_t *vm, vnet_crypto_async_frame_t *frame, cryptodev_op_type_t op_type)
 
static_always_inline int cryptodev_frame_gcm_enqueue (vlib_main_t *vm, vnet_crypto_async_frame_t *frame, cryptodev_op_type_t op_type, u8 aad_len)
 
static u32 cryptodev_get_frame_n_elts (void *frame)
 
static void cryptodev_post_dequeue (void *frame, u32 index, u8 is_op_success)
 
static_always_inline vnet_crypto_async_frame_tcryptodev_frame_dequeue (vlib_main_t *vm, u32 *nb_elts_processed, u32 *enqueue_thread_idx)
 
static_always_inline int cryptodev_enqueue_gcm_aad_8_enc (vlib_main_t *vm, vnet_crypto_async_frame_t *frame)
 
static_always_inline int cryptodev_enqueue_gcm_aad_12_enc (vlib_main_t *vm, vnet_crypto_async_frame_t *frame)
 
static_always_inline int cryptodev_enqueue_gcm_aad_8_dec (vlib_main_t *vm, vnet_crypto_async_frame_t *frame)
 
static_always_inline int cryptodev_enqueue_gcm_aad_12_dec (vlib_main_t *vm, vnet_crypto_async_frame_t *frame)
 
static_always_inline int cryptodev_enqueue_linked_alg_enc (vlib_main_t *vm, vnet_crypto_async_frame_t *frame)
 
static_always_inline int cryptodev_enqueue_linked_alg_dec (vlib_main_t *vm, vnet_crypto_async_frame_t *frame)
 
static_always_inline int cryptodev_assign_resource (cryptodev_engine_thread_t *cet, u32 cryptodev_inst_index, cryptodev_resource_assign_op_t op)
 assign a cryptodev resource to a worker. More...
 
static u8format_cryptodev_inst (u8 *s, va_list *args)
 
static clib_error_tcryptodev_show_assignment_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tcryptodev_set_assignment_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static int check_cryptodev_alg_support (u32 dev_id)
 
static u32 cryptodev_count_queue (u32 numa)
 
static int cryptodev_configure (vlib_main_t *vm, u32 cryptodev_id)
 
static int cryptodev_cmp (void *v1, void *v2)
 
static int cryptodev_probe (vlib_main_t *vm, u32 n_workers)
 
static int cryptodev_get_session_sz (vlib_main_t *vm, u32 n_workers)
 
static void dpdk_disable_cryptodev_engine (vlib_main_t *vm)
 
clib_error_tdpdk_cryptodev_init (vlib_main_t *vm)
 

Variables

cryptodev_main_t cryptodev_main
 
static vlib_cli_command_t show_cryptodev_assignment
 (constructor) VLIB_CLI_COMMAND (show_cryptodev_assignment) More...
 
static vlib_cli_command_t set_cryptodev_assignment
 (constructor) VLIB_CLI_COMMAND (set_cryptodev_assignment) More...
 

Macro Definition Documentation

◆ always_inline

#define always_inline   static inline

Definition at line 36 of file cryptodev_dp_api.c.

◆ CRYPTODEV_AAD_MASK

#define CRYPTODEV_AAD_MASK   (CRYPTODEV_NB_CRYPTO_OPS - 1)

Definition at line 43 of file cryptodev_dp_api.c.

◆ CRYPTODEV_DEQ_CACHE_SZ

#define CRYPTODEV_DEQ_CACHE_SZ   32

Definition at line 44 of file cryptodev_dp_api.c.

◆ CRYPTODEV_MAX_AAD_SIZE

#define CRYPTODEV_MAX_AAD_SIZE   16

Definition at line 46 of file cryptodev_dp_api.c.

◆ CRYPTODEV_MAX_INFLIGHT

#define CRYPTODEV_MAX_INFLIGHT   (CRYPTODEV_NB_CRYPTO_OPS - 1)

Definition at line 42 of file cryptodev_dp_api.c.

◆ CRYPTODEV_MAX_N_SGL

#define CRYPTODEV_MAX_N_SGL   8

maximum number of segments

Definition at line 47 of file cryptodev_dp_api.c.

◆ CRYPTODEV_NB_CRYPTO_OPS

#define CRYPTODEV_NB_CRYPTO_OPS   1024

Definition at line 41 of file cryptodev_dp_api.c.

◆ CRYPTODEV_NB_SESSION

#define CRYPTODEV_NB_SESSION   10240

Definition at line 45 of file cryptodev_dp_api.c.

◆ foreach_cryptodev_link_async_alg

#define foreach_cryptodev_link_async_alg
Value:
_ (AES_128_CBC, AES_CBC, SHA1, 12) \
_ (AES_192_CBC, AES_CBC, SHA1, 12) \
_ (AES_256_CBC, AES_CBC, SHA1, 12) \
_ (AES_128_CBC, AES_CBC, SHA224, 14) \
_ (AES_192_CBC, AES_CBC, SHA224, 14) \
_ (AES_256_CBC, AES_CBC, SHA224, 14) \
_ (AES_128_CBC, AES_CBC, SHA256, 16) \
_ (AES_192_CBC, AES_CBC, SHA256, 16) \
_ (AES_256_CBC, AES_CBC, SHA256, 16) \
_ (AES_128_CBC, AES_CBC, SHA384, 24) \
_ (AES_192_CBC, AES_CBC, SHA384, 24) \
_ (AES_256_CBC, AES_CBC, SHA384, 24) \
_ (AES_128_CBC, AES_CBC, SHA512, 32) \
_ (AES_192_CBC, AES_CBC, SHA512, 32) \
_ (AES_256_CBC, AES_CBC, SHA512, 32)

crypto (alg, cryptodev_alg), hash (alg, digest-size)

Definition at line 61 of file cryptodev_dp_api.c.

◆ foreach_vnet_aead_crypto_conversion

#define foreach_vnet_aead_crypto_conversion
Value:
_(AES_128_GCM, AEAD, AES_GCM, 12, 16, 8) \
_(AES_128_GCM, AEAD, AES_GCM, 12, 16, 12) \
_(AES_192_GCM, AEAD, AES_GCM, 12, 16, 8) \
_(AES_192_GCM, AEAD, AES_GCM, 12, 16, 12) \
_(AES_256_GCM, AEAD, AES_GCM, 12, 16, 8) \
_(AES_256_GCM, AEAD, AES_GCM, 12, 16, 12)

Definition at line 50 of file cryptodev_dp_api.c.

◆ GET_RING_OBJ

#define GET_RING_OBJ (   r,
  pos,
 
)
Value:
do { \
vnet_crypto_async_frame_t **ring = (void *)&r[1]; \
f = ring[(r->cons.head + pos) & r->mask]; \
} while (0)

Definition at line 764 of file cryptodev_dp_api.c.

Enumeration Type Documentation

◆ cryptodev_op_type_t

Enumerator
CRYPTODEV_OP_TYPE_ENCRYPT 
CRYPTODEV_OP_TYPE_DECRYPT 
CRYPTODEV_N_OP_TYPES 
CRYPTODEV_OP_TYPE_ENCRYPT 
CRYPTODEV_OP_TYPE_DECRYPT 
CRYPTODEV_N_OP_TYPES 

Definition at line 78 of file cryptodev_dp_api.c.

◆ cryptodev_resource_assign_op_t

Enumerator
CRYPTODEV_RESOURCE_ASSIGN_AUTO 
CRYPTODEV_RESOURCE_ASSIGN_UPDATE 
CRYPTODEV_RESOURCE_ASSIGN_AUTO 
CRYPTODEV_RESOURCE_ASSIGN_UPDATE 

Definition at line 961 of file cryptodev_dp_api.c.

Function Documentation

◆ check_cryptodev_alg_support()

static int check_cryptodev_alg_support ( u32  dev_id)
static

Definition at line 1166 of file cryptodev_dp_api.c.

+ Here is the caller graph for this function:

◆ compute_ofs_linked_alg()

static_always_inline u64 compute_ofs_linked_alg ( vnet_crypto_async_frame_elt_t fe,
i16 min_ofs,
u32 max_end 
)

Definition at line 431 of file cryptodev_dp_api.c.

+ Here is the caller graph for this function:

◆ cryptodev_assign_resource()

static_always_inline int cryptodev_assign_resource ( cryptodev_engine_thread_t cet,
u32  cryptodev_inst_index,
cryptodev_resource_assign_op_t  op 
)

assign a cryptodev resource to a worker.

Parameters
cetthe worker thread data
cryptodev_inst_indexif op is "ASSIGN_AUTO" this param is ignored.
opthe assignment method.
Returns
: 0 if successfully, negative number otherwise.

Definition at line 975 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cryptodev_check_supported_vnet_alg()

static int cryptodev_check_supported_vnet_alg ( vnet_crypto_key_t key)
static

Definition at line 291 of file cryptodev_dp_api.c.

+ Here is the caller graph for this function:

◆ cryptodev_cmp()

static int cryptodev_cmp ( void *  v1,
void *  v2 
)
static

Definition at line 1306 of file cryptodev_dp_api.c.

+ Here is the caller graph for this function:

◆ cryptodev_configure()

static int cryptodev_configure ( vlib_main_t vm,
u32  cryptodev_id 
)
static

If the device is already started, we reuse it, otherwise configure both the device and queue pair.

Definition at line 1230 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cryptodev_count_queue()

static u32 cryptodev_count_queue ( u32  numa)
static

Definition at line 1208 of file cryptodev_dp_api.c.

+ Here is the caller graph for this function:

◆ cryptodev_enqueue_gcm_aad_12_dec()

static_always_inline int cryptodev_enqueue_gcm_aad_12_dec ( vlib_main_t vm,
vnet_crypto_async_frame_t frame 
)

Definition at line 938 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:

◆ cryptodev_enqueue_gcm_aad_12_enc()

static_always_inline int cryptodev_enqueue_gcm_aad_12_enc ( vlib_main_t vm,
vnet_crypto_async_frame_t frame 
)

Definition at line 923 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:

◆ cryptodev_enqueue_gcm_aad_8_dec()

static_always_inline int cryptodev_enqueue_gcm_aad_8_dec ( vlib_main_t vm,
vnet_crypto_async_frame_t frame 
)

Definition at line 931 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:

◆ cryptodev_enqueue_gcm_aad_8_enc()

static_always_inline int cryptodev_enqueue_gcm_aad_8_enc ( vlib_main_t vm,
vnet_crypto_async_frame_t frame 
)

Definition at line 916 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:

◆ cryptodev_enqueue_linked_alg_dec()

static_always_inline int cryptodev_enqueue_linked_alg_dec ( vlib_main_t vm,
vnet_crypto_async_frame_t frame 
)

Definition at line 954 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:

◆ cryptodev_enqueue_linked_alg_enc()

static_always_inline int cryptodev_enqueue_linked_alg_enc ( vlib_main_t vm,
vnet_crypto_async_frame_t frame 
)

Definition at line 946 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:

◆ cryptodev_frame_build_sgl()

static_always_inline int cryptodev_frame_build_sgl ( vlib_main_t vm,
enum rte_iova_mode  iova_mode,
struct rte_crypto_vec *  data_vec,
u16 n_seg,
vlib_buffer_t b,
u32  size 
)

Definition at line 400 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cryptodev_frame_dequeue()

static_always_inline vnet_crypto_async_frame_t* cryptodev_frame_dequeue ( vlib_main_t vm,
u32 nb_elts_processed,
u32 enqueue_thread_idx 
)

Definition at line 770 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:

◆ cryptodev_frame_gcm_enqueue()

static_always_inline int cryptodev_frame_gcm_enqueue ( vlib_main_t vm,
vnet_crypto_async_frame_t frame,
cryptodev_op_type_t  op_type,
u8  aad_len 
)

Definition at line 590 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cryptodev_frame_linked_algs_enqueue()

static_always_inline int cryptodev_frame_linked_algs_enqueue ( vlib_main_t vm,
vnet_crypto_async_frame_t frame,
cryptodev_op_type_t  op_type 
)

Definition at line 451 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cryptodev_get_frame_n_elts()

static u32 cryptodev_get_frame_n_elts ( void *  frame)
static

Definition at line 749 of file cryptodev_dp_api.c.

+ Here is the caller graph for this function:

◆ cryptodev_get_session_sz()

static int cryptodev_get_session_sz ( vlib_main_t vm,
u32  n_workers 
)
static

Definition at line 1346 of file cryptodev_dp_api.c.

+ Here is the caller graph for this function:

◆ cryptodev_key_handler()

void cryptodev_key_handler ( vlib_main_t vm,
vnet_crypto_key_op_t  kop,
vnet_crypto_key_index_t  idx 
)

Definition at line 382 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cryptodev_mark_frame_err_status()

static_always_inline void cryptodev_mark_frame_err_status ( vnet_crypto_async_frame_t f,
vnet_crypto_op_status_t  s 
)

Definition at line 389 of file cryptodev_dp_api.c.

+ Here is the caller graph for this function:

◆ cryptodev_post_dequeue()

static void cryptodev_post_dequeue ( void *  frame,
u32  index,
u8  is_op_success 
)
static

Definition at line 756 of file cryptodev_dp_api.c.

+ Here is the caller graph for this function:

◆ cryptodev_probe()

static int cryptodev_probe ( vlib_main_t vm,
u32  n_workers 
)
static

Definition at line 1319 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cryptodev_sess_handler()

static_always_inline void cryptodev_sess_handler ( vlib_main_t vm,
vnet_crypto_key_op_t  kop,
vnet_crypto_key_index_t  idx,
u32  aad_len 
)

Definition at line 309 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cryptodev_session_create()

static int cryptodev_session_create ( vnet_crypto_key_t *const  key,
struct rte_mempool *  sess_priv_pool,
cryptodev_key_t session_pair,
u32  aad_len 
)
static

Definition at line 225 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cryptodev_session_del()

static void cryptodev_session_del ( struct rte_cryptodev_sym_session *  sess)
static

Definition at line 275 of file cryptodev_dp_api.c.

+ Here is the caller graph for this function:

◆ cryptodev_set_assignment_fn()

static clib_error_t* cryptodev_set_assignment_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1096 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:

◆ cryptodev_show_assignment_fn()

static clib_error_t* cryptodev_show_assignment_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1069 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:

◆ dpdk_cryptodev_init()

clib_error_t* dpdk_cryptodev_init ( vlib_main_t vm)

Definition at line 1391 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:

◆ dpdk_disable_cryptodev_engine()

static void dpdk_disable_cryptodev_engine ( vlib_main_t vm)
static

Definition at line 1367 of file cryptodev_dp_api.c.

+ Here is the caller graph for this function:

◆ format_cryptodev_inst()

static u8* format_cryptodev_inst ( u8 s,
va_list *  args 
)
static

Definition at line 1037 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepare_aead_xform()

static int prepare_aead_xform ( struct rte_crypto_sym_xform *  xform,
cryptodev_op_type_t  op_type,
const vnet_crypto_key_t key,
u32  aad_len 
)
static

Definition at line 133 of file cryptodev_dp_api.c.

+ Here is the caller graph for this function:

◆ prepare_linked_xform()

static int prepare_linked_xform ( struct rte_crypto_sym_xform *  xforms,
cryptodev_op_type_t  op_type,
const vnet_crypto_key_t key 
)
static

Definition at line 161 of file cryptodev_dp_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ cryptodev_main

cryptodev_main_t cryptodev_main

Definition at line 130 of file cryptodev_dp_api.c.

◆ set_cryptodev_assignment

vlib_cli_command_t set_cryptodev_assignment
static
Initial value:
= {
.path = "set cryptodev assignment",
.short_help = "set cryptodev assignment thread <thread_index> "
"resource <inst_index>",
}
static clib_error_t * cryptodev_set_assignment_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)

(constructor) VLIB_CLI_COMMAND (set_cryptodev_assignment)

Definition at line 1158 of file cryptodev_dp_api.c.

◆ show_cryptodev_assignment

vlib_cli_command_t show_cryptodev_assignment
static
Initial value:
= {
.path = "show cryptodev assignment",
.short_help = "show cryptodev assignment",
}
static clib_error_t * cryptodev_show_assignment_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)

(constructor) VLIB_CLI_COMMAND (show_cryptodev_assignment)

Definition at line 1089 of file cryptodev_dp_api.c.