-#define CRYPTODEV_NB_CRYPTO_OPS 1024
-#define CRYPTODEV_NB_SESSION 10240
-#define CRYPTODEV_DEF_DRIVE crypto_aesni_mb
-
-#define CRYPTODEV_IV_OFFSET (offsetof (cryptodev_op_t, iv))
-#define CRYPTODEV_AAD_OFFSET (offsetof (cryptodev_op_t, aad))
-
-/* VNET_CRYPTO_ALGO, TYPE, DPDK_CRYPTO_ALGO, IV_LEN, TAG_LEN, AAD_LEN */
-#define foreach_vnet_aead_crypto_conversion \
- _(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)
-
-/**
- * crypto (alg, cryptodev_alg), hash (alg, digest-size)
- **/
-#define foreach_cryptodev_link_async_alg \
- _ (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)
-
-#define foreach_vnet_crypto_status_conversion \
- _(SUCCESS, COMPLETED) \
- _(NOT_PROCESSED, WORK_IN_PROGRESS) \
- _(AUTH_FAILED, FAIL_BAD_HMAC) \
- _(INVALID_SESSION, FAIL_ENGINE_ERR) \
- _(INVALID_ARGS, FAIL_ENGINE_ERR) \
- _(ERROR, FAIL_ENGINE_ERR)
-
-static const vnet_crypto_op_status_t cryptodev_status_conversion[] = {
-#define _(a, b) VNET_CRYPTO_OP_STATUS_##b,
- foreach_vnet_crypto_status_conversion
-#undef _
-};
-
-typedef struct
-{
- CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
- struct rte_crypto_op op;
- struct rte_crypto_sym_op sop;
- u8 iv[16];
- u8 aad[16];
- vnet_crypto_async_frame_t *frame;
- u32 n_elts;
-} cryptodev_op_t;
-
-typedef enum
-{
- CRYPTODEV_OP_TYPE_ENCRYPT = 0,
- CRYPTODEV_OP_TYPE_DECRYPT,
- CRYPTODEV_N_OP_TYPES,
-} cryptodev_op_type_t;
-
-typedef struct
-{
- struct rte_cryptodev_sym_session *keys[CRYPTODEV_N_OP_TYPES];
-} cryptodev_key_t;
-
-typedef struct
-{
- u32 dev_id;
- u32 q_id;
- char *desc;
-} cryptodev_inst_t;
-
-typedef struct
-{
- struct rte_mempool *cop_pool;
- struct rte_mempool *sess_pool;
- struct rte_mempool *sess_priv_pool;
-} cryptodev_numa_data_t;
-
-typedef struct
-{
- CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
- u16 cryptodev_id;
- u16 cryptodev_q;
- u32 inflight;
- cryptodev_op_t **cops;
- struct rte_ring *ring;
-} cryptodev_engine_thread_t;
-
-typedef struct
-{
- cryptodev_numa_data_t *per_numa_data;
- cryptodev_key_t *keys;
- cryptodev_engine_thread_t *per_thread_data;
- enum rte_iova_mode iova_mode;
- cryptodev_inst_t *cryptodev_inst;
- clib_bitmap_t *active_cdev_inst_mask;
- clib_spinlock_t tlock;
-} cryptodev_main_t;
-