|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
59 u64 handle, *handles = 0, *sm_indices = 0;
72 ls = listen_session_get_from_handle (handle);
73 vec_add1 (handles, app_listen_session_handle (ls));
74 vec_add1 (sm_indices, sm_index);
75 sm = segment_manager_get (sm_index);
84 a->handle = handles[
i];
90 sm->first_is_protected = 0;
106 sm->first_is_protected = 0;
163 &rx_fifo, &tx_fifo)))
185 return SESSION_E_ALLOC;
194 return SESSION_E_NOSUPPORT;
208 return SESSION_E_ALREADY_LISTENING;
286 vec_add1 (states, SESSION_STATE_CREATED);
341 s->
flags |= SESSION_F_CUSTOM_FIFO_TUNING;
364 s->
flags |= SESSION_F_CUSTOM_FIFO_TUNING;
554 listener = listen_session_get_from_handle (handle);
555 if (listener->session_type == sst
556 && !(listener->flags & SESSION_F_PROXY))
578 listener = listen_session_get_from_handle (handle);
579 if (listener->session_type == sst && (listener->flags & SESSION_F_PROXY))
616 session_event_t *evt;
645 evt->session_index = s->
rx_fifo->shr->client_session_index;
658 session_event_t *evt;
684 evt->session_index = s->
tx_fifo->shr->client_session_index;
716 u64 handle = va_arg (*args,
u64);
717 u32 sm_index = va_arg (*args,
u32);
718 int verbose = va_arg (*args,
int);
727 "Connection",
"App",
"Wrk",
"API Client",
"ListenerID",
763 s =
format (s,
"%U wrk-index %u app-index %u map-index %u "
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
int app_worker_builtin_tx(app_worker_t *app_wrk, session_t *s)
static void clib_spinlock_init(clib_spinlock_t *p)
static u8 svm_fifo_set_event(svm_fifo_t *f)
Set fifo event flag.
session_handle_t * half_open_table
Pool of half-open session handles.
#define APP_DBG(_fmt, _args...)
u32 wrk_index
Worker index in global worker pool.
int application_change_listener_owner(session_t *s, app_worker_t *app_wrk)
enum session_error_ session_error_t
int app_worker_lock_and_send_event(app_worker_t *app, session_t *s, u8 evt_type)
Send event to application.
#define hash_set(h, key, value)
int app_worker_add_half_open(app_worker_t *app_wrk, session_handle_t sh)
segment_manager_t * segment_manager_get(u32 index)
static app_worker_t * app_workers
Pool of workers associated to apps.
static segment_manager_t * app_worker_alloc_segment_manager(app_worker_t *app_wrk)
u32 session_index
Index in thread pool where session was allocated.
#define SESSION_CLI_ID_LEN
void svm_msg_q_add_and_unlock(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Producer enqueue one message to queue with mutex held.
int app_worker_init_connected(app_worker_t *app_wrk, session_t *s)
svm_msg_q_msg_t svm_msg_q_alloc_msg_w_ring(svm_msg_q_t *mq, u32 ring_index)
Allocate message buffer on ring.
int segment_manager_init(segment_manager_t *sm)
u32 local_index
local listening session index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
int vnet_unlisten(vnet_unlisten_args_t *a)
static u64 listen_session_get_handle(session_t *s)
void * svm_msg_q_msg_data(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Get data for message in queue.
int app_worker_connect_session(app_worker_t *app_wrk, session_endpoint_cfg_t *sep, session_handle_t *rsh)
int(* builtin_app_rx_callback)(session_t *session)
Direct RX callback for built-in application.
struct _segment_manager segment_manager_t
struct _session_endpoint_cfg session_endpoint_cfg_t
static u8 app_worker_application_is_builtin(app_worker_t *app_wrk)
#define hash_foreach(key_var, value_var, h, body)
static session_t * listen_session_get(u32 ls_index)
#define SESSION_INVALID_INDEX
u32 app_index
App index in app pool.
static int svm_msg_q_lock(svm_msg_q_t *mq)
Lock, or block trying, the message queue.
u8 thread_index
Index of the thread that allocated the session.
#define pool_put(P, E)
Free an object E in pool P.
int application_is_builtin_proxy(application_t *app)
int app_worker_builtin_rx(app_worker_t *app_wrk, session_t *s)
void app_worker_del_detached_sm(app_worker_t *app_wrk, u32 sm_index)
int app_worker_transport_closed_notify(app_worker_t *app_wrk, session_t *s)
struct _vnet_unlisten_args_t vnet_unlisten_args_t
int app_worker_reset_notify(app_worker_t *app_wrk, session_t *s)
segment_manager_t * segment_manager_alloc(void)
static int app_send_io_evt_tx(app_worker_t *app_wrk, session_t *s)
#define pool_put_index(p, i)
Free pool element with given index.
#define hash_unset(h, key)
app_worker_t * app_worker_alloc(application_t *app)
int(* session_accept_callback)(session_t *new_session)
Notify server of newly accepted session.
u8 segment_manager_app_detached(segment_manager_t *sm)
struct _svm_fifo svm_fifo_t
void(* session_cleanup_callback)(session_t *s, session_cleanup_ntf_t ntf)
Notify app that session or transport are about to be removed.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
uword * listeners_table
Lookup tables for listeners.
application_t * app_worker_get_app(u32 wrk_index)
application_t * application_get(u32 app_index)
u32 app_wrk_index
Index of the app worker that owns the session.
void app_listener_cleanup(app_listener_t *al)
int() app_send_evt_handler_fn(app_worker_t *app, session_t *s)
int segment_manager_alloc_session_fifos(segment_manager_t *sm, u32 thread_index, svm_fifo_t **rx_fifo, svm_fifo_t **tx_fifo)
#define pool_foreach(VAR, POOL)
Iterate through pool.
void segment_manager_app_detach(segment_manager_t *sm)
static int app_worker_alloc_session_fifos(segment_manager_t *sm, session_t *s)
enum session_ft_action_ session_ft_action_t
int app_worker_cleanup_notify(app_worker_t *app_wrk, session_t *s, session_cleanup_ntf_t ntf)
svm_fifo_t * rx_fifo
Pointers to rx/tx buffers.
u32 session_index
global listening session index
static void app_worker_stop_listen_session(app_worker_t *app_wrk, session_t *ls)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
static u8 svm_msg_q_is_full(svm_msg_q_t *mq)
Check if message queue is full.
@ SEG_MANAGER_F_DETACHED_LISTENER
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
void segment_manager_dealloc_fifos(svm_fifo_t *rx_fifo, svm_fifo_t *tx_fifo)
transport_connection_t * session_get_transport(session_t *s)
static int svm_fifo_is_empty_cons(svm_fifo_t *f)
Check if fifo is empty optimized for consumer.
void segment_manager_free(segment_manager_t *sm)
Cleanup segment manager.
int app_worker_migrate_notify(app_worker_t *app_wrk, session_t *s, session_handle_t new_sh)
static int app_send_io_evt_rx(app_worker_t *app_wrk, session_t *s)
static_always_inline uword vlib_get_thread_index(void)
app_worker_t * application_listener_select_worker(session_t *ls)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
void segment_manager_format_sessions(segment_manager_t *sm, int verbose)
void(* session_disconnect_callback)(session_t *s)
Notify app that session is closing.
void(* session_migrate_callback)(session_t *s, session_handle_t new_sh)
Notify app that session pool migration happened.
session_t * app_worker_proxy_listener(app_worker_t *app_wrk, u8 fib_proto, u8 transport_proto)
int session_open(session_endpoint_cfg_t *rmt, session_handle_t *rsh)
Ask transport to open connection to remote transport endpoint.
static void clib_spinlock_free(clib_spinlock_t *p)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
void session_cleanup_half_open(session_handle_t ho_handle)
void(* session_reset_callback)(session_t *s)
Notify app that session was reset.
int app_worker_connect_notify(app_worker_t *app_wrk, session_t *s, session_error_t err, u32 opaque)
#define ALWAYS_ASSERT(truth)
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
svm_msg_q_t * event_queue
Application listens for events on this svm queue.
application_t * application_get_if_valid(u32 app_index)
u8 * format_app_worker_listener(u8 *s, va_list *args)
u32 segment_manager_index(segment_manager_t *sm)
void app_worker_free(app_worker_t *app_wrk)
int app_worker_del_segment_notify(app_worker_t *app_wrk, u64 segment_handle)
static session_t * session_get(u32 si, u32 thread_index)
u8 * format_session(u8 *s, va_list *args)
Format stream session as per the following format.
int app_worker_close_notify(app_worker_t *app_wrk, session_t *s)
clib_spinlock_t detached_seg_managers_lock
Protects detached seg managers.
session_handle_t listener_handle
Parent listener session index if the result of an accept.
static session_type_t session_type_from_proto_and_ip(transport_proto_t proto, u8 is_ip4)
int app_worker_stop_listen(app_worker_t *app_wrk, app_listener_t *al)
static app_send_evt_handler_fn *const app_send_evt_handler_fns[2]
app_worker_t * app_worker_get_if_valid(u32 wrk_index)
clib_bitmap_t * workers
workers accepting connections
#define vec_free(V)
Free vector's memory (no header).
int(* add_segment_callback)(u32 app_wrk_index, u64 segment_handle)
Notify server of new segment.
void segment_manager_init_free(segment_manager_t *sm)
Initiate segment manager cleanup.
void(* session_transport_closed_callback)(session_t *s)
Notify app that transport is closed.
u32 connects_seg_manager
Segment manager used for outgoing connects issued by the app.
segment_manager_t * segment_manager_get_if_valid(u32 index)
description fragment has unexpected format
int app_worker_start_listen(app_worker_t *app_wrk, app_listener_t *app_listener)
#define APP_INVALID_SEGMENT_MANAGER_INDEX
int app_worker_accept_notify(app_worker_t *app_wrk, session_t *s)
u8 * format_app_worker(u8 *s, va_list *args)
void svm_fifo_clone(svm_fifo_t *df, svm_fifo_t *sf)
Clones fifo.
#define SEGMENT_MANAGER_INVALID_APP_INDEX
int app_worker_session_fifo_tuning(app_worker_t *app_wrk, session_t *s, svm_fifo_t *f, session_ft_action_t act, u32 len)
void segment_manager_del_sessions_filter(segment_manager_t *sm, session_state_t *states)
Initiate disconnects for sessions in specified state 'owned' by a segment manager.
int app_worker_init_listener(app_worker_t *app_wrk, session_t *ls)
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
const u8 * application_name_from_index(u32 app_index)
Returns app name for app-index.
int(* session_connected_callback)(u32 app_wrk_index, u32 opaque, session_t *s, session_error_t code)
Connection request callback.
u8 segment_manager_has_fifos(segment_manager_t *sm)
int(* del_segment_callback)(u32 app_wrk_index, u64 segment_handle)
Notify server of new segment.
static u8 transport_connection_is_cless(transport_connection_t *tc)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
u32 wrk_map_index
Worker index in app's map pool.
int app_worker_own_session(app_worker_t *app_wrk, session_t *s)
segment_manager_t * app_worker_get_connect_segment_manager(app_worker_t *app)
#define pool_free(p)
Free a pool.
int(* builtin_app_tx_callback)(session_t *session)
Direct TX callback for built-in application.
#define clib_warning(format, args...)
int(* fifo_tuning_callback)(session_t *s, svm_fifo_t *f, session_ft_action_t act, u32 bytes)
Delegate fifo-tuning-logic to application.
void app_worker_format_connects(app_worker_t *app_wrk, int verbose)
int app_worker_add_segment_notify(app_worker_t *app_wrk, u64 segment_handle)
Send an API message to the external app, to map new segment.
u32 ho_index
Index in app worker's half-open table if a half-open.
session_cb_vft_t cb_fns
Callbacks: shoulder-taps for the server/client.
u8 * name
Name registered by builtin apps.
segment_manager_t * app_worker_get_listen_segment_manager(app_worker_t *app, session_t *listener)
u32 * detached_seg_managers
Vector of detached listener segment managers.
u32 app_index
Index of owning app.
static u8 svm_msg_q_ring_is_full(svm_msg_q_t *mq, u32 ring_index)
static uword clib_bitmap_set_no_check(uword *a, uword i, uword new_value)
Sets the ith bit of a bitmap to new_value.
u32 api_client_index
API index for the worker.
int app_worker_del_half_open(app_worker_t *app_wrk, session_t *s)
app_worker_t * app_worker_get(u32 wrk_index)
volatile u8 session_state
State in session layer state machine.
void(* half_open_cleanup_callback)(session_t *s)
Notify app that half open state was cleaned up (optional)
static int svm_fifo_has_event(svm_fifo_t *f)
Check if fifo has io event.
int app_worker_init_accepted(session_t *s)
static uword clib_bitmap_is_zero(uword *ai)
predicate function; is an entire bitmap empty?
static session_t * listen_session_get_from_handle(session_handle_t handle)
session_t * app_worker_first_listener(app_worker_t *app_wrk, u8 fib_proto, u8 transport_proto)
#define vec_del1(v, i)
Delete the element at index I.
static void app_worker_add_detached_sm(app_worker_t *app_wrk, u32 sm_index)
static void svm_msg_q_unlock(svm_msg_q_t *mq)
Unlock message queue.