15 #ifndef __DPDK_IPSEC_H__ 16 #define __DPDK_IPSEC_H__ 21 #include <rte_config.h> 22 #include <rte_crypto.h> 23 #include <rte_cryptodev.h> 26 #define always_inline static inline 28 #define always_inline static inline __attribute__ ((__always_inline__)) 32 #define MAX_QP_PER_LCORE 16 96 #define CRYPTO_N_FREE_COPS (VLIB_FRAME_SIZE * 3) 104 unsigned socket_id = rte_socket_id ();
119 n_alloc = rte_crypto_op_bulk_alloc (dcm->
cop_pools[socket_id],
120 RTE_CRYPTO_OP_TYPE_SYMMETRIC,
138 rte_mempool_put_bulk (cops[0]->mempool,
152 enum rte_crypto_sym_xform_type type;
155 enum rte_crypto_auth_algorithm auth;
156 enum rte_crypto_cipher_algorithm cipher;
158 enum rte_crypto_aead_algorithm aead;
165 .type = RTE_CRYPTO_SYM_XFORM_CIPHER,.cipher =
166 RTE_CRYPTO_CIPHER_NULL,.name =
"NULL"},
168 .type = RTE_CRYPTO_SYM_XFORM_CIPHER,.cipher =
169 RTE_CRYPTO_CIPHER_AES_CBC,.name =
"AES_CBC"},
172 .type = RTE_CRYPTO_SYM_XFORM_CIPHER,.cipher =
173 RTE_CRYPTO_CIPHER_AES_GCM,.name =
"AES-GCM"},
176 .type = RTE_CRYPTO_SYM_XFORM_AEAD,.aead =
177 RTE_CRYPTO_AEAD_AES_GCM,.name =
"AES-GCM"},
180 .type = RTE_CRYPTO_SYM_XFORM_AUTH,.auth =
181 RTE_CRYPTO_AUTH_NULL,.name =
"NULL"},
183 .type = RTE_CRYPTO_SYM_XFORM_AUTH,.auth =
184 RTE_CRYPTO_AUTH_SHA1_HMAC,.name =
"HMAC-SHA1"},
186 .type = RTE_CRYPTO_SYM_XFORM_AUTH,.auth =
187 RTE_CRYPTO_AUTH_SHA256_HMAC,.name =
"HMAC-SHA256"},
189 .type = RTE_CRYPTO_SYM_XFORM_AUTH,.auth =
190 RTE_CRYPTO_AUTH_SHA384_HMAC,.name =
"HMAC-SHA384"},
192 .type = RTE_CRYPTO_SYM_XFORM_AUTH,.auth =
193 RTE_CRYPTO_AUTH_SHA512_HMAC,.name =
"HMAC-SHA512"},
196 .type = RTE_CRYPTO_SYM_XFORM_AUTH,.auth =
197 RTE_CRYPTO_AUTH_AES_GCM,.name =
"AES-GCM"},
201 .type = RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED}
206 if (cap->op != RTE_CRYPTO_OP_TYPE_SYMMETRIC)
209 while (supported_algo[i].type != RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED)
211 if (cap->sym.xform_type == supported_algo[i].type)
213 if ((cap->sym.xform_type == RTE_CRYPTO_SYM_XFORM_CIPHER &&
214 cap->sym.cipher.algo == supported_algo[i].cipher) ||
216 (cap->sym.xform_type == RTE_CRYPTO_SYM_XFORM_AEAD &&
217 cap->sym.aead.algo == supported_algo[i].aead) ||
219 (cap->sym.xform_type == RTE_CRYPTO_SYM_XFORM_AUTH &&
220 cap->sym.auth.algo == supported_algo[i].auth))
223 strcpy (name, supported_algo[i].name);
struct rte_crypto_op ** free_cops
sll srl srl sll sra u16x4 i
struct _vlib_node_registration vlib_node_registration_t
struct rte_mempool ** sess_pools
#define vec_alloc(V, N)
Allocate space for N more elements (no header, unspecified alignment)
static_always_inline void crypto_free_cop(crypto_qp_data_t *qpd, struct rte_crypto_op **cops, u32 n)
dpdk_crypto_main_t dpdk_crypto_main
#define static_always_inline
static_always_inline void crypto_alloc_cops()
vlib_node_registration_t dpdk_crypto_input_node
(constructor) VLIB_REGISTER_NODE (dpdk_crypto_input_node)
static_always_inline uword vlib_get_thread_index(void)
#define clib_memcpy(a, b, c)
struct rte_mempool ** cop_pools
crypto_worker_main_t * workers_main
crypto_qp_data_t * qp_data
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define CRYPTO_N_FREE_COPS
static_always_inline int check_algo_is_supported(const struct rte_cryptodev_capabilities *cap, char *name)
#define vec_foreach(var, vec)
Vector iterator.
struct rte_mempool ** sess_h_pools