FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
session.h File Reference
+ Include dependency graph for session.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  session_rpc_args_t
 
struct  session_dgram_pre_hdr_
 
struct  session_tx_context_
 
struct  session_manager_worker_
 
struct  session_manager_main_
 

Macros

#define HALF_OPEN_LOOKUP_INVALID_VALUE   ((u64)~0)
 
#define INVALID_INDEX   ((u32)~0)
 
#define SESSION_PROXY_LISTENER_INDEX   ((u8)~0 - 1)
 
#define SESSION_LOCAL_HANDLE_PREFIX   0x7FFFFFFF
 
#define MAX_HDRS_LEN   100 /* Max number of bytes for headers */
 
#define foreach_session_input_error
 
#define SESSION_MSG_NULL   { }
 
#define SESSION_CONN_ID_LEN   37
 
#define SESSION_CONN_HDR_LEN   45
 
#define SESSION_Q_PROCESS_FLUSH_FRAMES   1
 
#define SESSION_Q_PROCESS_STOP   2
 
#define session_cli_return_if_not_enabled()
 

Typedefs

typedef u64 session_handle_t
 
typedef struct session_dgram_pre_hdr_ session_dgram_pre_hdr_t
 
typedef struct session_tx_context_ session_tx_context_t
 
typedef struct session_manager_worker_ session_manager_worker_t
 
typedef int() session_fifo_rx_fn(vlib_main_t *vm, vlib_node_runtime_t *node, session_manager_worker_t *wrk, session_event_t *e, int *n_tx_pkts)
 
typedef struct session_manager_main_ session_manager_main_t
 

Enumerations

enum  session_evt_type_t {
  FIFO_EVENT_APP_RX, SESSION_IO_EVT_CT_RX, FIFO_EVENT_APP_TX, SESSION_IO_EVT_CT_TX,
  SESSION_IO_EVT_TX_FLUSH, FIFO_EVENT_DISCONNECT, FIFO_EVENT_BUILTIN_RX, FIFO_EVENT_BUILTIN_TX,
  FIFO_EVENT_RPC, SESSION_CTRL_EVT_BOUND, SESSION_CTRL_EVT_ACCEPTED, SESSION_CTRL_EVT_ACCEPTED_REPLY,
  SESSION_CTRL_EVT_CONNECTED, SESSION_CTRL_EVT_CONNECTED_REPLY, SESSION_CTRL_EVT_DISCONNECTED, SESSION_CTRL_EVT_DISCONNECTED_REPLY,
  SESSION_CTRL_EVT_RESET, SESSION_CTRL_EVT_RESET_REPLY, SESSION_CTRL_EVT_REQ_WORKER_UPDATE, SESSION_CTRL_EVT_WORKER_UPDATE,
  SESSION_CTRL_EVT_WORKER_UPDATE_REPLY
}
 
enum  session_mq_rings_e { SESSION_MQ_IO_EVT_RING, SESSION_MQ_CTRL_EVT_RING, SESSION_MQ_N_RINGS }
 
enum  session_error_t { SESSION_N_ERROR }
 

Functions

static const char * fifo_event_type_str (session_evt_type_t et)
 
typedef CLIB_PACKED (struct session_dgram_header_ { u32 data_length;u32 data_offset;ip46_address_t rmt_ip;ip46_address_t lcl_ip;u16 rmt_port;u16 lcl_port;u8 is_ip4;}) session_dgram_hdr_t
 
 STATIC_ASSERT (sizeof(session_dgram_hdr_t)==(SESSION_CONN_ID_LEN+8), "session conn id wrong length")
 
u8 session_node_lookup_fifo_event (svm_fifo_t *f, session_event_t *e)
 
static session_manager_main_tvnet_get_session_manager_main ()
 
static session_manager_worker_tsession_manager_get_worker (u32 thread_index)
 
static u8 stream_session_is_valid (u32 si, u8 thread_index)
 
stream_session_tsession_alloc (u32 thread_index)
 
int session_alloc_fifos (segment_manager_t *sm, stream_session_t *s)
 
void session_free (stream_session_t *s)
 
void session_free_w_fifos (stream_session_t *s)
 
static stream_session_tsession_get (u32 si, u32 thread_index)
 
static stream_session_tsession_get_if_valid (u64 si, u32 thread_index)
 
static session_handle_t session_handle (stream_session_t *s)
 
static u32 session_index_from_handle (session_handle_t handle)
 
static u32 session_thread_from_handle (session_handle_t handle)
 
static void session_parse_handle (session_handle_t handle, u32 *index, u32 *thread_index)
 
static stream_session_tsession_get_from_handle (session_handle_t handle)
 
static stream_session_tsession_get_from_handle_if_valid (session_handle_t handle)
 
static u8 session_handle_is_local (session_handle_t handle)
 
static transport_proto_t session_type_transport_proto (session_type_t st)
 
static u8 session_type_is_ip4 (session_type_t st)
 
static transport_proto_t session_get_transport_proto (stream_session_t *s)
 
static fib_protocol_t session_get_fib_proto (stream_session_t *s)
 
static session_type_t session_type_from_proto_and_ip (transport_proto_t proto, u8 is_ip4)
 
static u64 session_segment_handle (stream_session_t *s)
 
static u8 session_has_transport (stream_session_t *s)
 
transport_service_type_t session_transport_service_type (stream_session_t *)
 
transport_tx_fn_type_t session_transport_tx_fn_type (stream_session_t *)
 
u8 session_tx_is_dgram (stream_session_t *s)
 
static void session_pool_add_peeker (u32 thread_index)
 Acquires a lock that blocks a session pool from expanding. More...
 
static void session_pool_remove_peeker (u32 thread_index)
 
static stream_session_tsession_get_from_handle_safe (u64 handle)
 Get session from handle and 'lock' pool resize if not in same thread. More...
 
static u32 transport_max_rx_enqueue (transport_connection_t *tc)
 
static u32 transport_max_tx_dequeue (transport_connection_t *tc)
 
static u32 transport_rx_fifo_size (transport_connection_t *tc)
 
static u32 transport_tx_fifo_size (transport_connection_t *tc)
 
static u8 transport_rx_fifo_has_ooo_data (transport_connection_t *tc)
 
static f64 transport_dispatch_period (u32 thread_index)
 
static f64 transport_time_now (u32 thread_index)
 
static u32 session_get_index (stream_session_t *s)
 
static stream_session_tsession_clone_safe (u32 session_index, u32 thread_index)
 
transport_connection_tsession_get_transport (stream_session_t *s)
 
u32 session_tx_fifo_max_dequeue (transport_connection_t *tc)
 
int session_enqueue_stream_connection (transport_connection_t *tc, vlib_buffer_t *b, u32 offset, u8 queue_event, u8 is_in_order)
 
int session_enqueue_dgram_connection (stream_session_t *s, session_dgram_hdr_t *hdr, vlib_buffer_t *b, u8 proto, u8 queue_event)
 
int stream_session_peek_bytes (transport_connection_t *tc, u8 *buffer, u32 offset, u32 max_bytes)
 
u32 stream_session_dequeue_drop (transport_connection_t *tc, u32 max_bytes)
 
int session_stream_connect_notify (transport_connection_t *tc, u8 is_fail)
 
int session_dgram_connect_notify (transport_connection_t *tc, u32 old_thread_index, stream_session_t **new_session)
 Move dgram session to the right thread. More...
 
int session_dequeue_notify (stream_session_t *s)
 
void stream_session_init_fifos_pointers (transport_connection_t *tc, u32 rx_pointer, u32 tx_pointer)
 Init fifo tail and head pointers. More...
 
int stream_session_accept_notify (transport_connection_t *tc)
 
void session_transport_closing_notify (transport_connection_t *tc)
 Notification from transport that connection is being closed. More...
 
void session_transport_delete_notify (transport_connection_t *tc)
 Notification from transport that connection is being deleted. More...
 
void session_transport_closed_notify (transport_connection_t *tc)
 Notification from transport that session can be closed. More...
 
void session_transport_reset_notify (transport_connection_t *tc)
 Notify application that connection has been reset. More...
 
int stream_session_accept (transport_connection_t *tc, u32 listener_index, u8 notify)
 Accept a stream session. More...
 
int session_open (u32 app_index, session_endpoint_t *tep, u32 opaque)
 Ask transport to open connection to remote transport endpoint. More...
 
int session_listen (stream_session_t *s, session_endpoint_cfg_t *sep)
 Ask transport to listen on session endpoint. More...
 
int session_stop_listen (stream_session_t *s)
 Ask transport to stop listening on local transport endpoint. More...
 
void session_close (stream_session_t *s)
 Initialize session closing procedure. More...
 
void session_transport_close (stream_session_t *s)
 Notify transport the session can be disconnected. More...
 
void session_transport_cleanup (stream_session_t *s)
 Cleanup transport and session state. More...
 
int session_send_io_evt_to_thread (svm_fifo_t *f, session_evt_type_t evt_type)
 
int session_send_io_evt_to_thread_custom (void *data, u32 thread_index, session_evt_type_t evt_type)
 
void session_send_rpc_evt_to_thread (u32 thread_index, void *fp, void *rpc_args)
 
ssvm_private_tsession_manager_get_evt_q_segment (void)
 
u8format_stream_session (u8 *s, va_list *args)
 Format stream session as per the following format. More...
 
uword unformat_stream_session (unformat_input_t *input, va_list *args)
 
uword unformat_transport_connection (unformat_input_t *input, va_list *args)
 
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. More...
 
static void transport_add_tx_event (transport_connection_t *tc)
 
clib_error_tvnet_session_enable_disable (vlib_main_t *vm, u8 is_en)
 
static svm_msg_q_tsession_manager_get_vpp_event_queue (u32 thread_index)
 
int session_manager_flush_enqueue_events (u8 proto, u32 thread_index)
 Flushes queue of sessions that are to be notified of new data enqueued events. More...
 
int session_manager_flush_all_enqueue_events (u8 transport_proto)
 
static u64 listen_session_get_handle (stream_session_t *s)
 
static stream_session_tlisten_session_get_from_handle (session_handle_t handle)
 
static void listen_session_parse_handle (session_handle_t handle, u32 *index, u32 *thread_index)
 
static stream_session_tlisten_session_new (u8 thread_index, session_type_t type)
 
static stream_session_tlisten_session_get (u32 index)
 
static void listen_session_del (stream_session_t *s)
 
transport_connection_tlisten_session_get_transport (stream_session_t *s)
 
int listen_session_get_local_session_endpoint (stream_session_t *listener, session_endpoint_t *sep)
 
void session_flush_frames_main_thread (vlib_main_t *vm)
 
static u8 session_manager_is_enabled ()
 
void session_node_enable_disable (u8 is_en)
 

Variables

session_fifo_rx_fn session_tx_fifo_peek_and_snd
 
session_fifo_rx_fn session_tx_fifo_dequeue_and_snd
 
session_fifo_rx_fn session_tx_fifo_dequeue_internal
 
session_manager_main_t session_manager_main
 
vlib_node_registration_t session_queue_node
 (constructor) VLIB_REGISTER_NODE (session_queue_node) More...
 
vlib_node_registration_t session_queue_process_node
 (constructor) VLIB_REGISTER_NODE (session_queue_process_node) More...
 

Macro Definition Documentation

◆ foreach_session_input_error

#define foreach_session_input_error
Value:
_(NO_SESSION, "No session drops") \
_(NO_LISTENER, "No listener for dst port drops") \
_(ENQUEUED, "Packets pushed into rx fifo") \
_(NOT_READY, "Session not ready packets") \
_(FIFO_FULL, "Packets dropped for lack of rx fifo space") \
_(EVENT_FIFO_FULL, "Events not sent for lack of event fifo space") \
_(API_QUEUE_FULL, "Sessions not created for lack of API queue space") \
_(NEW_SEG_NO_SPACE, "Created segment, couldn't allocate a fifo pair") \
_(NO_SPACE, "Couldn't allocate a fifo pair") \
_(SEG_CREATE, "Couldn't create a new segment")

Definition at line 85 of file session.h.

◆ HALF_OPEN_LOOKUP_INVALID_VALUE

#define HALF_OPEN_LOOKUP_INVALID_VALUE   ((u64)~0)

Definition at line 25 of file session.h.

◆ INVALID_INDEX

#define INVALID_INDEX   ((u32)~0)

Definition at line 26 of file session.h.

◆ MAX_HDRS_LEN

#define MAX_HDRS_LEN   100 /* Max number of bytes for headers */

Definition at line 31 of file session.h.

◆ session_cli_return_if_not_enabled

#define session_cli_return_if_not_enabled ( )
Value:
do { \
return clib_error_return(0, "session layer is not enabled"); \
} while (0)
u8 is_enabled
Session manager is enabled.
Definition: session.h:261
#define clib_error_return(e, args...)
Definition: error.h:99
session_manager_main_t session_manager_main
Definition: session.c:27

Definition at line 720 of file session.h.

◆ SESSION_CONN_HDR_LEN

#define SESSION_CONN_HDR_LEN   45

Definition at line 153 of file session.h.

◆ SESSION_CONN_ID_LEN

#define SESSION_CONN_ID_LEN   37

Definition at line 152 of file session.h.

◆ SESSION_LOCAL_HANDLE_PREFIX

#define SESSION_LOCAL_HANDLE_PREFIX   0x7FFFFFFF

Definition at line 28 of file session.h.

◆ SESSION_MSG_NULL

#define SESSION_MSG_NULL   { }

Definition at line 131 of file session.h.

◆ SESSION_PROXY_LISTENER_INDEX

#define SESSION_PROXY_LISTENER_INDEX   ((u8)~0 - 1)

Definition at line 27 of file session.h.

◆ SESSION_Q_PROCESS_FLUSH_FRAMES

#define SESSION_Q_PROCESS_FLUSH_FRAMES   1

Definition at line 303 of file session.h.

◆ SESSION_Q_PROCESS_STOP

#define SESSION_Q_PROCESS_STOP   2

Definition at line 304 of file session.h.

Typedef Documentation

◆ session_dgram_pre_hdr_t

◆ session_fifo_rx_fn

typedef int() session_fifo_rx_fn(vlib_main_t *vm, vlib_node_runtime_t *node, session_manager_worker_t *wrk, session_event_t *e, int *n_tx_pkts)

Definition at line 226 of file session.h.

◆ session_handle_t

Definition at line 111 of file session.h.

◆ session_manager_main_t

◆ session_manager_worker_t

◆ session_tx_context_t

Enumeration Type Documentation

◆ session_error_t

Enumerator
SESSION_N_ERROR 

Definition at line 97 of file session.h.

◆ session_evt_type_t

Enumerator
FIFO_EVENT_APP_RX 
SESSION_IO_EVT_CT_RX 
FIFO_EVENT_APP_TX 
SESSION_IO_EVT_CT_TX 
SESSION_IO_EVT_TX_FLUSH 
FIFO_EVENT_DISCONNECT 
FIFO_EVENT_BUILTIN_RX 
FIFO_EVENT_BUILTIN_TX 
FIFO_EVENT_RPC 
SESSION_CTRL_EVT_BOUND 
SESSION_CTRL_EVT_ACCEPTED 
SESSION_CTRL_EVT_ACCEPTED_REPLY 
SESSION_CTRL_EVT_CONNECTED 
SESSION_CTRL_EVT_CONNECTED_REPLY 
SESSION_CTRL_EVT_DISCONNECTED 
SESSION_CTRL_EVT_DISCONNECTED_REPLY 
SESSION_CTRL_EVT_RESET 
SESSION_CTRL_EVT_RESET_REPLY 
SESSION_CTRL_EVT_REQ_WORKER_UPDATE 
SESSION_CTRL_EVT_WORKER_UPDATE 
SESSION_CTRL_EVT_WORKER_UPDATE_REPLY 

Definition at line 33 of file session.h.

◆ session_mq_rings_e

Enumerator
SESSION_MQ_IO_EVT_RING 
SESSION_MQ_CTRL_EVT_RING 
SESSION_MQ_N_RINGS 

Definition at line 78 of file session.h.

Function Documentation

◆ CLIB_PACKED()

typedef CLIB_PACKED ( struct session_dgram_header_ { u32 data_length;u32 data_offset;ip46_address_t rmt_ip;ip46_address_t lcl_ip;u16 rmt_port;u16 lcl_port;u8 is_ip4;}  )

◆ fifo_event_type_str()

static const char* fifo_event_type_str ( session_evt_type_t  et)
inlinestatic

Definition at line 59 of file session.h.

◆ format_stream_session()

u8* format_stream_session ( u8 s,
va_list *  args 
)

Format stream session as per the following format.

verbose: "Connection", "Rx fifo", "Tx fifo", "Session Index" non-verbose: "Connection"

Definition at line 57 of file session_cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listen_session_del()

static void listen_session_del ( stream_session_t s)
inlinestatic

Definition at line 701 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listen_session_get()

static stream_session_t* listen_session_get ( u32  index)
inlinestatic

Definition at line 695 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listen_session_get_from_handle()

static stream_session_t* listen_session_get_from_handle ( session_handle_t  handle)
inlinestatic

Definition at line 672 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listen_session_get_handle()

static u64 listen_session_get_handle ( stream_session_t s)
inlinestatic

Definition at line 665 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listen_session_get_local_session_endpoint()

int listen_session_get_local_session_endpoint ( stream_session_t listener,
session_endpoint_t sep 
)

Definition at line 1378 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listen_session_get_transport()

transport_connection_t* listen_session_get_transport ( stream_session_t s)

Definition at line 1371 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listen_session_new()

static stream_session_t* listen_session_new ( u8  thread_index,
session_type_t  type 
)
inlinestatic

Definition at line 685 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listen_session_parse_handle()

static void listen_session_parse_handle ( session_handle_t  handle,
u32 index,
u32 thread_index 
)
inlinestatic

Definition at line 678 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_alloc()

stream_session_t* session_alloc ( u32  thread_index)

Definition at line 144 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_alloc_fifos()

int session_alloc_fifos ( segment_manager_t sm,
stream_session_t s 
)

Definition at line 202 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_clone_safe()

static stream_session_t* session_clone_safe ( u32  session_index,
u32  thread_index 
)
inlinestatic

Definition at line 569 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_close()

void session_close ( stream_session_t s)

Initialize session closing procedure.

Request is always sent to session node to ensure that all outstanding requests are served before transport is notified.

Definition at line 1135 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_dequeue_notify()

int session_dequeue_notify ( stream_session_t s)

Definition at line 552 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_dgram_connect_notify()

int session_dgram_connect_notify ( transport_connection_t tc,
u32  old_thread_index,
stream_session_t **  new_session 
)

Move dgram session to the right thread.

Definition at line 735 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_enqueue_dgram_connection()

int session_enqueue_dgram_connection ( stream_session_t s,
session_dgram_hdr_t *  hdr,
vlib_buffer_t b,
u8  proto,
u8  queue_event 
)

Definition at line 445 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_enqueue_stream_connection()

int session_enqueue_stream_connection ( transport_connection_t tc,
vlib_buffer_t b,
u32  offset,
u8  queue_event,
u8  is_in_order 
)

Definition at line 392 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_flush_frames_main_thread()

void session_flush_frames_main_thread ( vlib_main_t vm)

Definition at line 1398 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_free()

void session_free ( stream_session_t s)

Definition at line 169 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_free_w_fifos()

void session_free_w_fifos ( stream_session_t s)

Definition at line 177 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_get()

static stream_session_t* session_get ( u32  si,
u32  thread_index 
)
inlinestatic

Definition at line 341 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_get_fib_proto()

static fib_protocol_t session_get_fib_proto ( stream_session_t s)
inlinestatic

Definition at line 433 of file session.h.

+ Here is the caller graph for this function:

◆ session_get_from_handle()

static stream_session_t* session_get_from_handle ( session_handle_t  handle)
inlinestatic

Definition at line 390 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_get_from_handle_if_valid()

static stream_session_t* session_get_from_handle_if_valid ( session_handle_t  handle)
inlinestatic

Definition at line 399 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_get_from_handle_safe()

static stream_session_t* session_get_from_handle_safe ( u64  handle)
inlinestatic

Get session from handle and 'lock' pool resize if not in same thread.

Caller should drop the peek 'lock' as soon as possible.

Definition at line 497 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_get_if_valid()

static stream_session_t* session_get_if_valid ( u64  si,
u32  thread_index 
)
inlinestatic

Definition at line 349 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_get_index()

static u32 session_get_index ( stream_session_t s)
inlinestatic

Definition at line 563 of file session.h.

+ Here is the caller graph for this function:

◆ session_get_transport()

transport_connection_t* session_get_transport ( stream_session_t s)

Definition at line 1358 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_get_transport_proto()

static transport_proto_t session_get_transport_proto ( stream_session_t s)
inlinestatic

Definition at line 427 of file session.h.

+ Here is the caller graph for this function:

◆ session_handle()

static session_handle_t session_handle ( stream_session_t s)
inlinestatic

Definition at line 364 of file session.h.

+ Here is the caller graph for this function:

◆ session_handle_is_local()

static u8 session_handle_is_local ( session_handle_t  handle)
inlinestatic

Definition at line 407 of file session.h.

+ Here is the caller graph for this function:

◆ session_has_transport()

static u8 session_has_transport ( stream_session_t s)
inlinestatic

Definition at line 454 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_index_from_handle()

static u32 session_index_from_handle ( session_handle_t  handle)
inlinestatic

Definition at line 370 of file session.h.

+ Here is the caller graph for this function:

◆ session_listen()

int session_listen ( stream_session_t ls,
session_endpoint_cfg_t sep 
)

Ask transport to listen on session endpoint.

Parameters
sSession for which listen will be called. Note that unlike established sessions, listen sessions are not associated to a thread.
sepLocal endpoint to be listened on.

Definition at line 1076 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_manager_flush_all_enqueue_events()

int session_manager_flush_all_enqueue_events ( u8  transport_proto)

Definition at line 605 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_manager_flush_enqueue_events()

int session_manager_flush_enqueue_events ( u8  transport_proto,
u32  thread_index 
)

Flushes queue of sessions that are to be notified of new data enqueued events.

Parameters
thread_indexThread index for which the flush is to be performed.
Returns
0 on success or a positive number indicating the number of failures due to API queue being full.

Definition at line 576 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_manager_get_evt_q_segment()

ssvm_private_t* session_manager_get_evt_q_segment ( void  )

Definition at line 1305 of file session.c.

+ Here is the caller graph for this function:

◆ session_manager_get_vpp_event_queue()

static svm_msg_q_t* session_manager_get_vpp_event_queue ( u32  thread_index)
inlinestatic

Definition at line 656 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_manager_get_worker()

static session_manager_worker_t* session_manager_get_worker ( u32  thread_index)
inlinestatic

Definition at line 316 of file session.h.

+ Here is the caller graph for this function:

◆ session_manager_is_enabled()

static u8 session_manager_is_enabled ( )
inlinestatic

Definition at line 715 of file session.h.

+ Here is the caller graph for this function:

◆ session_node_enable_disable()

void session_node_enable_disable ( u8  is_en)

Definition at line 1495 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_node_lookup_fifo_event()

u8 session_node_lookup_fifo_event ( svm_fifo_t f,
session_event_t *  e 
)

Definition at line 1142 of file session_node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_open()

int session_open ( u32  app_wrk_index,
session_endpoint_t rmt,
u32  opaque 
)

Ask transport to open connection to remote transport endpoint.

Stores handle for matching request with reply since the call can be asynchronous. For instance, for TCP the 3-way handshake must complete before reply comes. Session is only created once connection is established.

Parameters
app_indexIndex of the application requesting the connect
stSession type requested.
tepRemote transport endpoint
opaqueOpaque data (typically, api_context) the application expects on open completion.

Definition at line 1061 of file session.c.

+ Here is the caller graph for this function:

◆ session_parse_handle()

static void session_parse_handle ( session_handle_t  handle,
u32 index,
u32 thread_index 
)
inlinestatic

Definition at line 382 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_pool_add_peeker()

static void session_pool_add_peeker ( u32  thread_index)
inlinestatic

Acquires a lock that blocks a session pool from expanding.

This is typically used for safely peeking into other threads' pools in order to clone elements. Lock should be dropped as soon as possible by calling session_pool_remove_peeker.

NOTE: Avoid using pool_elt_at_index while the lock is held because it may lead to free elt bitmap expansion/contraction!

Definition at line 474 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_pool_remove_peeker()

static void session_pool_remove_peeker ( u32  thread_index)
inlinestatic

Definition at line 483 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_register_transport()

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.

Allocates per session type (transport proto + ip version) data structures and adds arc from session queue node to session type output node.

Definition at line 1329 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_segment_handle()

static u64 session_segment_handle ( stream_session_t s)
inlinestatic

Definition at line 446 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_send_io_evt_to_thread()

int session_send_io_evt_to_thread ( svm_fifo_t f,
session_evt_type_t  evt_type 
)

Definition at line 88 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_send_io_evt_to_thread_custom()

int session_send_io_evt_to_thread_custom ( void *  data,
u32  thread_index,
session_evt_type_t  evt_type 
)

Definition at line 94 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_send_rpc_evt_to_thread()

void session_send_rpc_evt_to_thread ( u32  thread_index,
void *  fp,
void *  rpc_args 
)

Definition at line 111 of file session.c.

+ Here is the caller graph for this function:

◆ session_stop_listen()

int session_stop_listen ( stream_session_t s)

Ask transport to stop listening on local transport endpoint.

Parameters
sSession to stop listening on. It must be in state LISTENING.

Definition at line 1106 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_stream_connect_notify()

int session_stream_connect_notify ( transport_connection_t tc,
u8  is_fail 
)

Definition at line 630 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_thread_from_handle()

static u32 session_thread_from_handle ( session_handle_t  handle)
inlinestatic

Definition at line 376 of file session.h.

+ Here is the caller graph for this function:

◆ session_transport_cleanup()

void session_transport_cleanup ( stream_session_t s)

Cleanup transport and session state.

Notify transport of the cleanup and free the session. This should be called only if transport reported some error and is already closed.

Definition at line 1197 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_transport_close()

void session_transport_close ( stream_session_t s)

Notify transport the session can be disconnected.

This should eventually result in a delete notification that allows us to cleanup session state. Called for both active/passive disconnects.

Must be called from the session's thread.

Definition at line 1165 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_transport_closed_notify()

void session_transport_closed_notify ( transport_connection_t tc)

Notification from transport that session can be closed.

Should be called by transport only if it was closed with non-empty tx fifo and once it decides to begin the closing procedure prior to issuing a delete notify. This gives the chance to the session layer to cleanup any outstanding events.

Definition at line 875 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_transport_closing_notify()

void session_transport_closing_notify ( transport_connection_t tc)

Notification from transport that connection is being closed.

A disconnect is sent to application but state is not removed. Once disconnect is acknowledged by application, session disconnect is called. Ultimately this leads to close being called on transport (passive close).

Definition at line 794 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_transport_delete_notify()

void session_transport_delete_notify ( transport_connection_t tc)

Notification from transport that connection is being deleted.

This removes the session if it is still valid. It should be called only on previously fully established sessions. For instance failed connects should call stream_session_connect_notify and indicate that the connect has failed.

Definition at line 820 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_transport_reset_notify()

void session_transport_reset_notify ( transport_connection_t tc)

Notify application that connection has been reset.

Definition at line 904 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_transport_service_type()

transport_service_type_t session_transport_service_type ( stream_session_t )

Definition at line 1211 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_transport_tx_fn_type()

transport_tx_fn_type_t session_transport_tx_fn_type ( stream_session_t )

Definition at line 1219 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_tx_fifo_max_dequeue()

u32 session_tx_fifo_max_dequeue ( transport_connection_t tc)

Definition at line 498 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_tx_is_dgram()

u8 session_tx_is_dgram ( stream_session_t s)

Definition at line 1227 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ session_type_from_proto_and_ip()

static session_type_t session_type_from_proto_and_ip ( transport_proto_t  proto,
u8  is_ip4 
)
inlinestatic

Definition at line 440 of file session.h.

+ Here is the caller graph for this function:

◆ session_type_is_ip4()

static u8 session_type_is_ip4 ( session_type_t  st)
inlinestatic

Definition at line 421 of file session.h.

+ Here is the caller graph for this function:

◆ session_type_transport_proto()

static transport_proto_t session_type_transport_proto ( session_type_t  st)
inlinestatic

Definition at line 415 of file session.h.

+ Here is the caller graph for this function:

◆ STATIC_ASSERT()

STATIC_ASSERT ( sizeof(session_dgram_hdr_t)  = =(SESSION_CONN_ID_LEN+8),
"session conn id wrong length"   
)

◆ stream_session_accept()

int stream_session_accept ( transport_connection_t tc,
u32  listener_index,
u8  notify 
)

Accept a stream session.

Optionally ping the server by callback.

Definition at line 923 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stream_session_accept_notify()

int stream_session_accept_notify ( transport_connection_t tc)

Definition at line 771 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stream_session_dequeue_drop()

u32 stream_session_dequeue_drop ( transport_connection_t tc,
u32  max_bytes 
)

Definition at line 515 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stream_session_init_fifos_pointers()

void stream_session_init_fifos_pointers ( transport_connection_t tc,
u32  rx_pointer,
u32  tx_pointer 
)

Init fifo tail and head pointers.

Useful if transport uses absolute offsets for tracking ooo segments.

Definition at line 620 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stream_session_is_valid()

static u8 stream_session_is_valid ( u32  si,
u8  thread_index 
)
inlinestatic

Definition at line 322 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stream_session_peek_bytes()

int stream_session_peek_bytes ( transport_connection_t tc,
u8 buffer,
u32  offset,
u32  max_bytes 
)

Definition at line 507 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ transport_add_tx_event()

static void transport_add_tx_event ( transport_connection_t tc)
inlinestatic

Definition at line 645 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ transport_dispatch_period()

static f64 transport_dispatch_period ( u32  thread_index)
inlinestatic

Definition at line 551 of file session.h.

+ Here is the caller graph for this function:

◆ transport_max_rx_enqueue()

static u32 transport_max_rx_enqueue ( transport_connection_t tc)
inlinestatic

Definition at line 516 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ transport_max_tx_dequeue()

static u32 transport_max_tx_dequeue ( transport_connection_t tc)
inlinestatic

Definition at line 523 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ transport_rx_fifo_has_ooo_data()

static u8 transport_rx_fifo_has_ooo_data ( transport_connection_t tc)
inlinestatic

Definition at line 544 of file session.h.

+ Here is the call graph for this function:

◆ transport_rx_fifo_size()

static u32 transport_rx_fifo_size ( transport_connection_t tc)
inlinestatic

Definition at line 530 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ transport_time_now()

static f64 transport_time_now ( u32  thread_index)
inlinestatic

Definition at line 557 of file session.h.

+ Here is the caller graph for this function:

◆ transport_tx_fifo_size()

static u32 transport_tx_fifo_size ( transport_connection_t tc)
inlinestatic

Definition at line 537 of file session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unformat_stream_session()

uword unformat_stream_session ( unformat_input_t input,
va_list *  args 
)

Definition at line 153 of file session_cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unformat_transport_connection()

uword unformat_transport_connection ( unformat_input_t input,
va_list *  args 
)

Definition at line 184 of file session_cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vnet_get_session_manager_main()

static session_manager_main_t* vnet_get_session_manager_main ( )
inlinestatic

Definition at line 310 of file session.h.

+ Here is the caller graph for this function:

◆ vnet_session_enable_disable()

clib_error_t* vnet_session_enable_disable ( vlib_main_t vm,
u8  is_en 
)

Definition at line 1529 of file session.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ session_manager_main

session_manager_main_t session_manager_main

Definition at line 27 of file session.c.

◆ session_queue_node

vlib_node_registration_t session_queue_node
Initial value:
=
{
.function = session_queue_node_fn,
.name = "session-queue",
.format_trace = format_session_queue_trace,
.error_strings = session_queue_error_strings,
.state = VLIB_NODE_STATE_DISABLED,
}
static uword session_queue_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: session_node.c:863
static char * session_queue_error_strings[]
Definition: session_node.c:324
#define ARRAY_LEN(x)
Definition: clib.h:62
static u8 * format_session_queue_trace(u8 *s, va_list *args)
Definition: session_node.c:300

(constructor) VLIB_REGISTER_NODE (session_queue_node)

Definition at line 1040 of file session_node.c.

◆ session_queue_process_node

vlib_node_registration_t session_queue_process_node

(constructor) VLIB_REGISTER_NODE (session_queue_process_node)

Definition at line 1242 of file session_node.c.

◆ session_tx_fifo_dequeue_and_snd

session_fifo_rx_fn session_tx_fifo_dequeue_and_snd

◆ session_tx_fifo_dequeue_internal

session_fifo_rx_fn session_tx_fifo_dequeue_internal

◆ session_tx_fifo_peek_and_snd

session_fifo_rx_fn session_tx_fifo_peek_and_snd