49 evt->rpc_args.fp =
data;
50 evt->rpc_args.arg = args;
58 evt->session_index = *(
u32 *) data;
72 evt->event_type = evt_type;
82 f->master_thread_index, evt_type);
116 void (*fnp) (
void *) = fp;
129 if (!(s->
flags & SESSION_F_CUSTOM_TX))
131 s->
flags |= SESSION_F_CUSTOM_TX;
142 elt->
evt.session_index = tc->s_index;
158 elt->
evt.session_index = tc->s_index;
177 elt->
evt.event_type = evt;
243 || s->
thread_index != tc->thread_index || tc->s_index != si)
329 u32 to_drop = n_bytes_to_drop;
331 while (to_drop && (next->
flags & VLIB_BUFFER_NEXT_PRESENT))
365 if (is_in_order && offset)
393 return (rv > 0) ? (written + rv) : written;
418 while ((chain_bi = (chain_b->
flags & VLIB_BUFFER_NEXT_PRESENT)
431 if (s->
flags & SESSION_F_CUSTOM_FIFO_TUNING)
440 ASSERT (f->size <= sm->max_fifo_size);
462 u8 queue_event,
u8 is_in_order)
465 int enqueued = 0, rv, in_order_off;
502 if (!(s->
flags & SESSION_F_RX_EVT))
504 s->
flags |= SESSION_F_RX_EVT;
528 { (
u8 *) hdr,
sizeof (*hdr) },
544 seg->data = (
u8 *) hdr;
545 seg->len =
sizeof (*hdr);
552 if (!(it->
flags & VLIB_BUFFER_NEXT_PRESENT))
561 if (queue_event && rv > 0)
568 if (!(s->
flags & SESSION_F_RX_EVT))
570 s->
flags |= SESSION_F_RX_EVT;
576 return rv > 0 ? rv : 0;
614 for (i = 0; i < f->n_subscribers; i++)
653 s->
flags &= ~SESSION_F_RX_EVT;
751 for (i = 0; i <
vec_len (indices); i++)
788 u32 opaque = 0, new_ti, new_si;
878 typedef struct _session_switch_pool_args
882 u32 new_thread_index;
883 u32 new_session_index;
900 s =
session_get (args->session_index, args->thread_index);
906 args->new_thread_index);
945 new_s->
flags |= SESSION_F_IS_MIGRATING;
956 rpc_args->session_index = tc->s_index;
957 rpc_args->thread_index = old_thread_index;
963 *new_session = new_s;
1007 case SESSION_STATE_CREATED:
1014 case SESSION_STATE_ACCEPTING:
1015 case SESSION_STATE_TRANSPORT_CLOSING:
1016 case SESSION_STATE_CLOSING:
1017 case SESSION_STATE_TRANSPORT_CLOSED:
1028 case SESSION_STATE_APP_CLOSED:
1040 case SESSION_STATE_TRANSPORT_DELETED:
1042 case SESSION_STATE_CLOSED:
1138 u32 thread_index,
u8 notify)
1218 SESSION_DBG (
"Transport failed to open connection.");
1245 u64 handle, wrk_handle;
1252 SESSION_DBG (
"Transport failed to open connection.");
1271 tc->s_ho_handle = handle;
1278 rmt->transport_proto, handle, wrk_handle);
1289 sep->app_wrk_index = app_wrk_index;
1290 sep->opaque = opaque;
1370 return SESSION_E_NOLISTEN;
1376 return SESSION_E_NONE;
1440 else if (s->
session_state >= SESSION_STATE_TRANSPORT_DELETED)
1467 else if (s->
session_state >= SESSION_STATE_TRANSPORT_DELETED)
1507 u32 evt_q_length = 2048, evt_size =
sizeof (session_event_t);
1509 uword eqs_size = 64 << 20;
1510 pid_t vpp_pid = getpid ();
1522 eqs->
name =
format (0,
"%s%c",
"session: evt-qs-segment", 0);
1538 {evt_q_length, evt_size, 0}
1540 {evt_q_length >> 1, 256, 0}
1578 session_tx_fifo_dequeue_and_snd
1589 u32 next_index = ~0;
1597 if (output_node != ~0)
1621 for (thread = 0; thread <
vec_len (smm->
wrk); thread++)
1674 u32 num_threads, preallocated_sessions_per_worker;
1675 uword margin = 8 << 12;
1685 if (num_threads < 1)
1691 for (i = 0; i < num_threads; i++)
1702 if (num_threads > 1)
1717 if (num_threads == 1)
1724 preallocated_sessions_per_worker =
1726 (
f64) (num_threads - 1));
1728 for (j = 1; j < num_threads; j++)
1731 preallocated_sessions_per_worker);
1761 u8 state = is_en ? VLIB_NODE_STATE_POLLING : VLIB_NODE_STATE_DISABLED;
1767 if (have_workers && ii == 0)
1824 #if (HIGH_SEGMENT_BASEVA > (4ULL << 30)) 1862 if (
unformat (input,
"event-queue-length %d", &nitems))
1867 clib_warning (
"event queue length %d too small, ignored", nitems);
1869 else if (
unformat (input,
"preallocated-sessions %d",
1872 else if (
unformat (input,
"v4-session-table-buckets %d",
1875 else if (
unformat (input,
"v4-halfopen-table-buckets %d",
1878 else if (
unformat (input,
"v6-session-table-buckets %d",
1881 else if (
unformat (input,
"v6-halfopen-table-buckets %d",
1884 else if (
unformat (input,
"v4-session-table-memory %U",
1887 if (tmp >= 0x100000000)
1892 else if (
unformat (input,
"v4-halfopen-table-memory %U",
1895 if (tmp >= 0x100000000)
1900 else if (
unformat (input,
"v6-session-table-memory %U",
1903 if (tmp >= 0x100000000)
1908 else if (
unformat (input,
"v6-halfopen-table-memory %U",
1911 if (tmp >= 0x100000000)
1916 else if (
unformat (input,
"local-endpoints-table-memory %U",
1919 if (tmp >= 0x100000000)
1924 else if (
unformat (input,
"local-endpoints-table-buckets %d",
1928 else if (
unformat (input,
"evt_qs_memfd_seg"))
1933 else if (
unformat (input,
"enable"))
1937 else if (
unformat (input,
"use-app-socket-api"))
1939 else if (
unformat (input,
"poll-main"))
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
#define session_endpoint_to_transport_cfg(_sep)
u32 preallocated_sessions
Preallocate session config parameter.
int app_worker_lock_and_send_event(app_worker_t *app, session_t *s, u8 evt_type)
Send event to application.
void transport_close(transport_proto_t tp, u32 conn_index, u8 thread_index)
static session_open_service_fn session_open_srv_fns[TRANSPORT_N_SERVICES]
u32 connection_index
Index of the transport connection associated to the session.
uword evt_qs_segment_size
int app_worker_init_accepted(session_t *s)
void session_transport_reset(session_t *s)
Force transport close.
int session_lookup_del_connection(transport_connection_t *tc)
Delete transport connection from session table.
int app_worker_reset_notify(app_worker_t *app_wrk, 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.
static u8 svm_msg_q_ring_is_full(svm_msg_q_t *mq, u32 ring_index)
int session_open(u32 app_wrk_index, session_endpoint_t *rmt, u32 opaque)
Ask transport to open connection to remote transport endpoint.
session_type_t session_type
Type built from transport and network protocol types.
svm_msg_q_t * vpp_event_queue
vpp event message queue for worker
void transport_get_listener_endpoint(transport_proto_t tp, u32 conn_index, transport_endpoint_t *tep, u8 is_lcl)
static u32 svm_fifo_max_enqueue_prod(svm_fifo_t *f)
Maximum number of bytes that can be enqueued into fifo.
static void clib_rwlock_writer_lock(clib_rwlock_t *p)
int app_worker_connect_notify(app_worker_t *app_wrk, session_t *s, session_error_t err, u32 opaque)
session_main_t session_main
int session_tx_fifo_peek_bytes(transport_connection_t *tc, u8 *buffer, u32 offset, u32 max_bytes)
#define VLIB_MAIN_LOOP_ENTER_FUNCTION(x)
void session_queue_run_on_main_thread(vlib_main_t *vm)
u32 session_index
Index in thread pool where session was allocated.
int session_stop_listen(session_t *s)
Ask transport to stop listening on local transport endpoint.
static void session_switch_pool_reply(void *arg)
int app_worker_del_half_open(app_worker_t *app_wrk, transport_proto_t tp, session_handle_t ho_handle)
transport_connection_t * listen_session_get_transport(session_t *s)
static svm_msg_q_t * session_main_get_vpp_event_queue(u32 thread_index)
transport_proto_t session_add_transport_proto(void)
u32 configured_v4_halfopen_table_buckets
u8 session_enable_asap
Enable session manager at startup.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void session_transport_delete_notify(transport_connection_t *tc)
Notification from transport that connection is being deleted.
transport_connection_t * session_get_transport(session_t *s)
static f64 vlib_time_now(vlib_main_t *vm)
svm_fifo_t * rx_fifo
Pointers to rx/tx buffers.
session_worker_t * wrk
Worker contexts.
static session_t * session_get_if_valid(u64 si, u32 thread_index)
void session_add_self_custom_tx_evt(transport_connection_t *tc, u8 has_prio)
u32 ** session_to_enqueue
Per-proto vector of sessions to enqueue.
#define pool_get_aligned_will_expand(P, YESNO, A)
See if pool_get will expand the pool or not.
int session_enqueue_dgram_connection(session_t *s, session_dgram_hdr_t *hdr, vlib_buffer_t *b, u8 proto, u8 queue_event)
u16 current_length
Nbytes between current data and the end of this buffer.
static int session_enqueue_notify_inline(session_t *s)
Notify session peer that new data has been enqueued.
int session_main_flush_enqueue_events(u8 transport_proto, u32 thread_index)
Flushes queue of sessions that are to be notified of new data enqueued events.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static transport_proto_t session_get_transport_proto(session_t *s)
void session_send_rpc_evt_to_thread(u32 thread_index, void *fp, void *rpc_args)
int svm_fifo_peek(svm_fifo_t *f, u32 offset, u32 len, u8 *dst)
Peek data from fifo.
void session_transport_reset_notify(transport_connection_t *tc)
Notify application that connection has been reset.
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
int session_open_vc(u32 app_wrk_index, session_endpoint_t *rmt, u32 opaque)
void svm_fifo_dequeue_drop_all(svm_fifo_t *f)
Drop all data from fifo.
ssvm_shared_header_t * sh
u32 transport_start_listen(transport_proto_t tp, u32 session_index, transport_endpoint_t *tep)
static session_t * session_get(u32 si, u32 thread_index)
session_evt_elt_t * event_elts
Pool of session event list elements.
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
int session_enqueue_stream_connection(transport_connection_t *tc, vlib_buffer_t *b, u32 offset, u8 queue_event, u8 is_in_order)
u64 session_lookup_half_open_handle(transport_connection_t *tc)
static session_t * session_clone_safe(u32 session_index, u32 thread_index)
u32 local_endpoints_table_memory
Transport table (preallocation) size parameters.
static u32 session_handle_data(session_handle_t ho_handle)
void session_node_enable_disable(u8 is_en)
vlib_node_registration_t session_queue_node
(constructor) VLIB_REGISTER_NODE (session_queue_node)
static_always_inline uword clib_mem_get_page_size(void)
vlib_main_t ** vlib_mains
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
app_worker_t * application_get_worker(application_t *app, u32 wrk_map_index)
session_fifo_rx_fn session_tx_fifo_peek_and_snd
clib_error_t * session_main_init(vlib_main_t *vm)
session_t * sessions
Worker session pool.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static session_fifo_rx_fn * session_tx_fns[TRANSPORT_TX_N_FNS]
#define vlib_worker_thread_barrier_sync(X)
static session_handle_t session_handle(session_t *s)
void session_get_endpoint(session_t *s, transport_endpoint_t *tep, u8 is_lcl)
void segment_manager_attach_fifo(segment_manager_t *sm, svm_fifo_t *f, session_t *s)
void session_transport_closing_notify(transport_connection_t *tc)
Notification from transport that connection is being closed.
u64 segment_manager_make_segment_handle(u32 segment_manager_index, u32 segment_index)
enum session_ft_action_ session_ft_action_t
int session_open_cl(u32 app_wrk_index, session_endpoint_t *rmt, u32 opaque)
#define clib_llist_make_head(LP, name)
Initialize llist head.
int ssvm_server_init(ssvm_private_t *ssvm, ssvm_segment_type_t type)
static session_worker_t * session_main_get_worker(u32 thread_index)
void session_free_w_fifos(session_t *s)
#define session_endpoint_to_transport(_sep)
void app_namespaces_init(void)
vlib_main_t * vm
Convenience pointer to this worker's vlib_main.
static clib_error_t * session_config_fn(vlib_main_t *vm, unformat_input_t *input)
svm_msg_q_t * svm_msg_q_alloc(svm_msg_q_cfg_t *cfg)
Allocate message queue.
int session_send_ctrl_evt_to_thread(session_t *s, session_evt_type_t evt_type)
void session_fifo_tuning(session_t *s, svm_fifo_t *f, session_ft_action_t act, u32 len)
#define VLIB_INIT_FUNCTION(x)
void segment_manager_dealloc_fifos(svm_fifo_t *rx_fifo, svm_fifo_t *tx_fifo)
int svm_fifo_enqueue_segments(svm_fifo_t *f, const svm_fifo_seg_t segs[], u32 n_segs, u8 allow_partial)
Enqueue array of svm_fifo_seg_t in order.
static void session_manager_main_disable(vlib_main_t *vm)
clib_llist_index_t new_head
Head of list of elements.
description fragment has unexpected format
u32 * session_type_to_next
Per session type output nodes.
void session_cleanup_half_open(transport_proto_t tp, session_handle_t ho_handle)
static int session_enqueue_chain_tail(session_t *s, vlib_buffer_t *b, u32 offset, u8 is_in_order)
Enqueue buffer chain tail.
static void * ssvm_push_heap(ssvm_shared_header_t *sh)
#define clib_error_return(e, args...)
uword session_baseva
Session ssvm segment configs.
pthread_t thread[MAX_CONNS]
void session_half_open_delete_notify(transport_proto_t tp, session_handle_t ho_handle)
int session_send_io_evt_to_thread(svm_fifo_t *f, session_evt_type_t evt_type)
u8 session_is_valid(u32 si, u8 thread_index)
static void ssvm_pop_heap(void *oldheap)
void transport_reset(transport_proto_t tp, u32 conn_index, u8 thread_index)
#define HALF_OPEN_LOOKUP_INVALID_VALUE
#define SESSION_INVALID_HANDLE
int session_lookup_del_half_open(transport_connection_t *tc)
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
static clib_error_t * session_manager_main_enable(vlib_main_t *vm)
struct _transport_proto_vft transport_proto_vft_t
u8 is_initialized
Session manager initialized (not necessarily enabled)
int session_dequeue_notify(session_t *s)
struct _session_endpoint_cfg session_endpoint_cfg_t
u32 configured_v6_halfopen_table_memory
u32 configured_v6_session_table_buckets
static session_type_t session_type_from_proto_and_ip(transport_proto_t proto, u8 is_ip4)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void clib_rwlock_init(clib_rwlock_t *p)
#define CLIB_US_TIME_FREQ
int svm_msg_q_alloc_consumer_eventfd(svm_msg_q_t *mq)
Allocate event fd for queue consumer.
transport_service_type_t transport_protocol_service_type(transport_proto_t tp)
uword session_va_space_size
void session_send_rpc_evt_to_thread_force(u32 thread_index, void *fp, void *rpc_args)
u32 configured_v4_session_table_buckets
Session table size parameters.
void transport_get_endpoint(transport_proto_t tp, u32 conn_index, u32 thread_index, transport_endpoint_t *tep, u8 is_lcl)
int app_worker_accept_notify(app_worker_t *app_wrk, session_t *s)
u32 app_index
Index of application that owns the listener.
u32 configured_v6_halfopen_table_buckets
u32 configured_event_queue_length
vpp fifo event queue configured length
u8 is_enabled
Session manager is enabled.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define pool_put(P, E)
Free an object E in pool P.
#define APP_INVALID_INDEX
int svm_fifo_enqueue(svm_fifo_t *f, u32 len, const u8 *src)
Enqueue data to fifo.
segment_manager_t * app_worker_get_connect_segment_manager(app_worker_t *)
static clib_error_t * session_main_loop_init(vlib_main_t *vm)
enum transport_service_type_ transport_service_type_t
#define VLIB_CONFIG_FUNCTION(x, n,...)
int session_lookup_del_session(session_t *s)
u32 wrk_index
Worker index in global worker pool.
app_worker_t * app_worker_get_if_valid(u32 wrk_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)
static u32 svm_fifo_max_dequeue_prod(svm_fifo_t *f)
Fifo max bytes to dequeue optimized for producer.
session_fifo_rx_fn ** session_tx_fns
Per transport rx function that can either dequeue or peek.
u64 session_segment_handle(session_t *s)
#define foreach_vlib_main(body)
static session_evt_elt_t * session_evt_alloc_old(session_worker_t *wrk)
void transport_cleanup(transport_proto_t tp, u32 conn_index, u8 thread_index)
clib_error_t * vnet_session_enable_disable(vlib_main_t *vm, u8 is_en)
u32 transport_stop_listen(transport_proto_t tp, u32 conn_index)
struct _session_switch_pool_args session_switch_pool_args_t
clib_rwlock_t peekers_rw_locks
Peekers rw lock.
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
#define SESSION_DBG(_fmt, _args...)
static void clib_rwlock_writer_unlock(clib_rwlock_t *p)
static u8 svm_fifo_set_event(svm_fifo_t *f)
Set fifo event flag.
u32 n_rings
number of msg rings
void transport_init(void)
int app_worker_transport_closed_notify(app_worker_t *app_wrk, session_t *s)
session_fifo_rx_fn session_tx_fifo_dequeue_and_snd
ssvm_private_t evt_qs_segment
Event queues memfd segment.
transport_proto_t last_transport_proto_type
static u8 svm_fifo_needs_deq_ntf(svm_fifo_t *f, u32 n_last_deq)
Check if fifo needs dequeue notification.
session_handle_t listener_handle
Parent listener session index if the result of an accept.
static_always_inline uword vlib_get_thread_index(void)
int transport_connect(transport_proto_t tp, transport_endpoint_cfg_t *tep)
static void svm_msg_q_unlock(svm_msg_q_t *mq)
Unlock message queue.
void segment_manager_detach_fifo(segment_manager_t *sm, svm_fifo_t *f)
static transport_connection_t * transport_get_connection(transport_proto_t tp, u32 conn_index, u8 thread_index)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
static void vlib_process_signal_event_mt(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
Signal event to process from any thread.
static void session_cleanup_notify(session_t *s, session_cleanup_ntf_t ntf)
void session_free(session_t *s)
int app_worker_cleanup_notify(app_worker_t *app_wrk, session_t *s, session_cleanup_ntf_t ntf)
#define clib_warning(format, args...)
static int session_send_evt_to_thread(void *data, void *args, u32 thread_index, session_evt_type_t evt_type)
int session_dgram_connect_notify(transport_connection_t *tc, u32 old_thread_index, session_t **new_session)
Move dgram session to the right thread.
Don't register connection in lookup.
struct _transport_connection transport_connection_t
#define HIGH_SEGMENT_BASEVA
int app_worker_init_connected(app_worker_t *app_wrk, session_t *s)
static session_evt_elt_t * session_evt_alloc_new(session_worker_t *wrk)
void transport_enable_disable(vlib_main_t *vm, u8 is_en)
static u8 vlib_thread_is_main_w_barrier(void)
#define pool_init_fixed(pool, max_elts)
initialize a fixed-size, preallocated pool
application_t * application_get(u32 app_index)
static u32 session_thread_from_handle(session_handle_t handle)
int session_listen(session_t *ls, session_endpoint_cfg_t *sep)
Ask transport to listen on session endpoint.
static u32 session_index_from_handle(session_handle_t handle)
#define uword_to_pointer(u, type)
void session_vpp_event_queues_allocate(session_main_t *smm)
Allocate event queues in the shared-memory segment.
static int session_notify_subscribers(u32 app_index, session_t *s, svm_fifo_t *f, session_evt_type_t evt_type)
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_add_half_open(app_worker_t *app_wrk, transport_proto_t tp, session_handle_t ho_handle, session_handle_t wrk_handle)
void sesssion_reschedule_tx(transport_connection_t *tc)
int session_main_flush_all_enqueue_events(u8 transport_proto)
#define CLIB_ASSERT_ENABLE
void segment_manager_main_init(segment_manager_main_init_args_t *a)
static void clib_mem_free(void *p)
enum _transport_proto transport_proto_t
static void svm_fifo_clear_deq_ntf(svm_fifo_t *f)
Clear the want notification flag and set has notification.
int svm_fifo_enqueue_with_offset(svm_fifo_t *f, u32 offset, u32 len, u8 *src)
Enqueue a future segment.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
static session_handle_t session_make_handle(u32 session_index, u32 data)
clib_time_type_t last_vlib_time
vlib_time_now last time around the track
u32 configured_v4_halfopen_table_memory
int app_worker_migrate_notify(app_worker_t *app_wrk, session_t *s, session_handle_t new_sh)
u32 configured_v4_session_table_memory
int session_stream_accept_notify(transport_connection_t *tc)
static void * clib_mem_alloc(uword size)
void session_enqueue_notify_thread(session_handle_t sh)
Like session_enqueue_notify, but can be called from a thread that does not own the session...
static uword pointer_to_uword(const void *p)
svm_msg_q_ring_cfg_t * ring_cfgs
array of ring cfgs
static vlib_main_t * vlib_get_main(void)
int() session_fifo_rx_fn(session_worker_t *wrk, vlib_node_runtime_t *node, session_evt_elt_t *e, int *n_tx_packets)
u8 thread_index
Index of the thread that allocated the session.
session_t * session_alloc(u32 thread_index)
void session_transport_cleanup(session_t *s)
Cleanup transport and session state.
static void session_enqueue_discard_chain_bytes(vlib_main_t *vm, vlib_buffer_t *b, vlib_buffer_t **chain_b, u32 n_bytes_to_drop)
Discards bytes from buffer chain.
template key/value backing page structure
static void session_switch_pool(void *cb_args)
Notify old thread of the session pool switch.
static transport_connection_t * transport_get_half_open(transport_proto_t tp, u32 conn_index)
static u32 session_handle_index(session_handle_t ho_handle)
u64 app_worker_lookup_half_open(app_worker_t *app_wrk, transport_proto_t tp, session_handle_t ho_handle)
u32 local_endpoints_table_buckets
app_worker_t * app_worker_get(u32 wrk_index)
u32 q_nitems
msg queue size (not rings)
void appns_sapi_enable(void)
void session_lookup_init(void)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
session_fifo_rx_fn session_tx_fifo_dequeue_internal
clib_llist_index_t old_head
Head of list of pending events.
u32 next_buffer
Next buffer for this linked-list of buffers.
volatile u8 session_state
State in session layer state machine.
int session_enqueue_notify(session_t *s)
void session_transport_closed_notify(transport_connection_t *tc)
Notification from transport that it is closed.
void session_debug_init(void)
void session_close(session_t *s)
Initialize session closing procedure.
VLIB buffer representation.
int session_stream_connect_notify(transport_connection_t *tc, session_error_t err)
u8 poll_main
Poll session node in main thread.
void session_reset(session_t *s)
Force a close without waiting for data to be flushed.
ssvm_private_t * session_main_get_evt_q_segment(void)
struct _segment_manager segment_manager_t
segment_manager_t * segment_manager_get(u32 index)
int session_send_io_evt_to_thread_custom(void *data, u32 thread_index, session_evt_type_t evt_type)
static session_evt_elt_t * session_evt_alloc_ctrl(session_worker_t *wrk)
u32 app_index
Index of owning app.
static u8 svm_fifo_n_subscribers(svm_fifo_t *f)
Fifo number of subscribers getter.
int session_lookup_add_connection(transport_connection_t *tc, u64 value)
Add transport connection to a session table.
Connection descheduled by the session layer.
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
u32 configured_v6_session_table_memory
clib_us_time_t last_vlib_us_time
vlib_time_now rounded to us precision and as u64
static vlib_thread_main_t * vlib_get_thread_main()
vlib_node_registration_t session_queue_process_node
(constructor) VLIB_REGISTER_NODE (session_queue_process_node)
vl_api_dhcp_client_state_t state
static u32 vlib_num_workers()
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
int(* session_open_service_fn)(u32, session_endpoint_t *, u32)
enum session_error_ session_error_t
save_rewrite_length must be aligned so that reass doesn t overwrite it
u32 app_wrk_index
Index of the app worker that owns the session.
void transport_cleanup_half_open(transport_proto_t tp, u32 conn_index)
u32 session_tx_fifo_dequeue_drop(transport_connection_t *tc, u32 max_bytes)
static void session_delete(session_t *s)
Cleans up session and lookup table.
void session_transport_close(session_t *s)
Notify transport the session can be disconnected.
clib_llist_index_t ctrl_head
Head of control events list.
int session_dgram_accept(transport_connection_t *tc, u32 listener_index, u32 thread_index)
int app_worker_close_notify(app_worker_t *app_wrk, session_t *s)
struct _session_endpoint session_endpoint_t
int session_stream_accept(transport_connection_t *tc, u32 listener_index, u32 thread_index, u8 notify)
Accept a stream session.
int consumer_pid
pid of msg consumer
#define CLIB_CACHE_LINE_BYTES
static transport_connection_t * transport_get_listener(transport_proto_t tp, u32 conn_index)
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
int svm_fifo_dequeue_drop(svm_fifo_t *f, u32 len)
Dequeue and drop bytes from fifo.
static int svm_msg_q_lock(svm_msg_q_t *mq)
Lock, or block trying, the message queue.
static void session_enqueue_notify_rpc(void *arg)
int session_open_app(u32 app_wrk_index, session_endpoint_t *rmt, u32 opaque)
void vlib_start_process(vlib_main_t *vm, uword process_index)
void session_register_transport(transport_proto_t transport_proto, const transport_proto_vft_t *vft, u8 is_ip4, u32 output_node)
Initialize session layer for given transport proto and ip version.
int session_lookup_add_half_open(transport_connection_t *tc, u64 value)
struct _svm_fifo svm_fifo_t
u8 transport_protocol_is_cl(transport_proto_t tp)
static u8 svm_msg_q_is_full(svm_msg_q_t *mq)
Check if message queue is full.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
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.
#define SESSION_EVT(_evt, _args...)
session_t * session_alloc_for_connection(transport_connection_t *tc)
static void session_program_transport_ctrl_evt(session_t *s, session_evt_type_t evt)
static session_t * listen_session_get(u32 ls_index)
static u8 transport_connection_is_descheduled(transport_connection_t *tc)