|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
18 #include <openssl/engine.h>
21 #define SSL_ASYNC_INFLIGHT 1
22 #define SSL_ASYNC_READY 2
23 #define SSL_ASYNC_REENTER 3
24 #define MAX_VECTOR_ASYNC 256
40 #define thread_idx cb_args.thread_index
41 #define event_idx cb_args.event_index
97 TLS_DBG (2,
"Totally there is %d thread\n", num_threads);
105 for (
i = 0;
i < num_threads;
i++)
118 int i, registered = -1;
133 clib_error (
"engine %s is not regisered in VPP", engine_name);
137 ENGINE_load_builtin_engines ();
138 ENGINE_load_dynamic ();
139 engine = ENGINE_by_id (engine_name);
143 clib_warning (
"Failed to find engine ENGINE_by_id %s", engine_name);
155 if (!ENGINE_set_default_string (
engine, algorithm))
158 engine_name, algorithm);
164 if (!ENGINE_set_default (
engine, ENGINE_METHOD_ALL))
166 clib_warning (
"Failed to set engine %s to all algorithm",
235 return ((*evt)->event_idx);
253 TLS_DBG (2,
"Set event %d to run\n", event_index);
265 if (*evt_run_tail >= 0)
268 event_tail->
next = event_index;
270 *evt_run_tail = event_index;
271 if (*evt_run_head < 0)
273 *evt_run_head = event_index;
287 u32 thread_id =
ctx->c_thread_index;
292 event->event_idx = eidx;
293 event->thread_idx = thread_id;
294 event->handler = handler;
297 ctx->evt_index = eidx;
298 #ifdef HAVE_OPENSSL_ASYNC
299 SSL_set_async_callback_arg (oc->
ssl, &event->
cb_args);
310 eidx =
ctx->evt_index;
324 eidx =
ctx->evt_index;
345 handler =
event->handler;
350 (*handler) (
ctx, session);
371 ENGINE_ctrl_cmd (om->
engine,
"ENABLE_EXTERNAL_POLLING", 0, NULL, NULL, 0);
397 ENGINE_ctrl_cmd (om->
engine,
"POLL", 0, &poll_status, NULL, 0);
414 u8 state = is_en ? VLIB_NODE_STATE_POLLING : VLIB_NODE_STATE_DISABLED;
420 if (have_workers && this_vlib_main->thread_index)
456 if (*evt_run_head < 0)
461 if (*evt_run_head >= 0)
473 *evt_run_head =
event->next;
517 .name =
"tls-async-process",
518 .state = VLIB_NODE_STATE_DISABLED,
static vlib_node_registration_t tls_async_process_node
(constructor) VLIB_REGISTER_NODE (tls_async_process_node)
static u32 vlib_num_workers()
struct openssl_event_ openssl_evt_t
#define SSL_ASYNC_REENTER
u32 session_index
Index in thread pool where session was allocated.
openssl_async_queue_t * queue
openssl_async_t openssl_async_main
int vpp_tls_async_update_event(tls_ctx_t *ctx, int eagain)
void qat_init_thread(void *arg)
static uword pointer_to_uword(const void *p)
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void openssl_async_polling()
int openssl_engine_register(char *engine_name, char *algorithm, int async)
openssl_evt_t *** evt_pool
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vl_api_dhcp_client_state_t state
int vpp_openssl_is_inflight(tls_ctx_t *ctx)
struct openssl_async_queue_ openssl_async_queue_t
#define pool_put_index(p, i)
Free pool element with given index.
static uword tls_async_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
void evt_pool_init(vlib_main_t *vm)
#define foreach_vlib_main()
struct openssl_async_ openssl_async_t
int tls_async_do_job(int eidx, u32 thread_index)
#define TLS_DBG(_lvl, _fmt, _args...)
openssl_tls_callback_arg_t cb_args
static_always_inline uword vlib_get_thread_index(void)
static openssl_evt_t * openssl_evt_get_w_thread(int evt_index, u8 thread_index)
static clib_error_t * tls_async_init(vlib_main_t *vm)
static openssl_evt_t * openssl_evt_get(u32 evt_index)
sll srl srl sll sra u16x4 i
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
int vpp_tls_async_init_event(tls_ctx_t *ctx, openssl_resume_handler *handler, session_t *session)
int openssl_evt_free(int event_index, u8 thread_index)
void(* thread_init)(void *)
struct _vlib_node_registration vlib_node_registration_t
static session_t * session_get(u32 si, u32 thread_index)
int tls_async_openssl_callback(SSL *s, void *cb_arg)
static u32 openssl_evt_alloc(void)
openssl_resume_handler * handler
struct engine_polling engine_list[]
struct openssl_tls_callback_arg_ openssl_tls_callback_arg_t
void qat_polling_config()
void session_send_rpc_evt_to_thread(u32 thread_index, void *fp, void *rpc_args)
#define VLIB_INIT_FUNCTION(x)
static uword pool_elts(void *v)
Number of active elements in a pool.
int tls_resume_from_crypto(int thread_index)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vnet_interface_output_runtime_t * rt
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define uword_to_pointer(u, type)
#define clib_error(format, args...)
#define clib_warning(format, args...)
void event_handler(void *tls_async)
void openssl_async_node_enable_disable(u8 is_en)
int openssl_resume_handler(tls_ctx_t *ctx, session_t *tls_session)
static vlib_thread_main_t * vlib_get_thread_main()
tls_ctx_t * openssl_ctx_get_w_thread(u32 ctx_index, u8 thread_index)
#define SSL_ASYNC_INFLIGHT
static void * clib_mem_alloc(uword size)
#define VLIB_REGISTER_NODE(x,...)