FD.io VPP  v21.06
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_tx_context_
 
struct  session_evt_elt
 
struct  session_ctrl_evt_data_
 
struct  session_worker_
 
struct  session_main_
 

Macros

#define foreach_session_input_error
 
#define TRANSPORT_PROTO_INVALID   (session_main.last_transport_proto_type + 1)
 
#define TRANSPORT_N_PROTOS   (session_main.last_transport_proto_type + 1)
 
#define session_cli_return_if_not_enabled()
 

Typedefs

typedef struct session_tx_context_ session_tx_context_t
 
typedef struct session_evt_elt session_evt_elt_t
 
typedef struct session_ctrl_evt_data_ session_evt_ctrl_data_t
 
typedef enum session_wrk_state_ session_wrk_state_t
 
typedef enum session_wrk_flags_ session_wrk_flag_t
 
typedef struct session_worker_ session_worker_t
 
typedef int() session_fifo_rx_fn(session_worker_t *wrk, vlib_node_runtime_t *node, session_evt_elt_t *e, int *n_tx_packets)
 
typedef struct session_main_ session_main_t
 
typedef enum session_q_process_evt_ session_q_process_evt_t
 

Enumerations

enum  session_input_error_t { SESSION_N_ERROR }
 
enum  session_wrk_state_ { SESSION_WRK_POLLING, SESSION_WRK_INTERRUPT, SESSION_WRK_IDLE }
 
enum  session_wrk_flags_ { SESSION_WRK_F_ADAPTIVE = 1 << 0 }
 
enum  session_q_process_evt_ { SESSION_Q_PROCESS_RUN_ON_MAIN = 1, SESSION_Q_PROCESS_STOP }
 

Functions

u8 session_node_lookup_fifo_event (svm_fifo_t *f, session_event_t *e)
 
static void session_evt_add_old (session_worker_t *wrk, session_evt_elt_t *elt)
 
static void session_evt_add_head_old (session_worker_t *wrk, session_evt_elt_t *elt)
 
static u32 session_evt_ctrl_data_alloc (session_worker_t *wrk)
 
static session_evt_elt_tsession_evt_alloc_ctrl (session_worker_t *wrk)
 
static void * session_evt_ctrl_data (session_worker_t *wrk, session_evt_elt_t *elt)
 
static void session_evt_ctrl_data_free (session_worker_t *wrk, session_evt_elt_t *elt)
 
static session_evt_elt_tsession_evt_alloc_new (session_worker_t *wrk)
 
static session_evt_elt_tsession_evt_alloc_old (session_worker_t *wrk)
 
int session_wrk_handle_mq (session_worker_t *wrk, svm_msg_q_t *mq)
 
session_tsession_alloc (u32 thread_index)
 
void session_free (session_t *s)
 
void session_free_w_fifos (session_t *s)
 
void session_cleanup_half_open (session_handle_t ho_handle)
 
u8 session_is_valid (u32 si, u8 thread_index)
 
static session_tsession_get (u32 si, u32 thread_index)
 
static session_tsession_get_if_valid (u64 si, u32 thread_index)
 
static session_tsession_get_from_handle (session_handle_t handle)
 
static session_tsession_get_from_handle_if_valid (session_handle_t handle)
 
u64 session_segment_handle (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 session_tsession_get_from_handle_safe (u64 handle)
 Get session from handle and 'lock' pool resize if not in same thread. More...
 
static u32 session_get_index (session_t *s)
 
static session_tsession_clone_safe (u32 session_index, u32 thread_index)
 
int session_open (session_endpoint_cfg_t *sep, session_handle_t *rsh)
 Ask transport to open connection to remote transport endpoint. More...
 
int session_listen (session_t *s, session_endpoint_cfg_t *sep)
 Ask transport to listen on session endpoint. More...
 
int session_stop_listen (session_t *s)
 Ask transport to stop listening on local transport endpoint. More...
 
void session_half_close (session_t *s)
 Initialize session half-closing procedure. More...
 
void session_close (session_t *s)
 Initialize session closing procedure. More...
 
void session_reset (session_t *s)
 Force a close without waiting for data to be flushed. More...
 
void session_transport_half_close (session_t *s)
 Notify transport the session can be half-disconnected. More...
 
void session_transport_close (session_t *s)
 Notify transport the session can be disconnected. More...
 
void session_transport_reset (session_t *s)
 Force transport close. More...
 
void session_transport_cleanup (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_enqueue_notify (session_t *s)
 
int session_dequeue_notify (session_t *s)
 
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)
 
void session_send_rpc_evt_to_thread_force (u32 thread_index, void *fp, void *rpc_args)
 
void session_add_self_custom_tx_evt (transport_connection_t *tc, u8 has_prio)
 
void sesssion_reschedule_tx (transport_connection_t *tc)
 
transport_connection_tsession_get_transport (session_t *s)
 
void session_get_endpoint (session_t *s, transport_endpoint_t *tep, u8 is_lcl)
 
int session_transport_attribute (session_t *s, u8 is_get, transport_endpt_attr_t *attr)
 
u8format_session (u8 *s, va_list *args)
 Format stream session as per the following format. More...
 
uword unformat_session (unformat_input_t *input, va_list *args)
 
uword unformat_transport_connection (unformat_input_t *input, va_list *args)
 
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 (session_t *s, session_dgram_hdr_t *hdr, vlib_buffer_t *b, u8 proto, u8 queue_event)
 
int session_stream_connect_notify (transport_connection_t *tc, session_error_t err)
 
int session_dgram_connect_notify (transport_connection_t *tc, u32 old_thread_index, session_t **new_session)
 Move dgram session to the right thread. More...
 
int session_stream_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_half_open_delete_notify (transport_connection_t *tc)
 
void session_half_open_migrate_notify (transport_connection_t *tc)
 
int session_half_open_migrated_notify (transport_connection_t *tc)
 
void session_transport_closed_notify (transport_connection_t *tc)
 Notification from transport that it is closed. More...
 
void session_transport_reset_notify (transport_connection_t *tc)
 Notify application that connection has been reset. More...
 
int session_stream_accept (transport_connection_t *tc, u32 listener_index, u32 thread_index, u8 notify)
 Accept a stream session. More...
 
int session_dgram_accept (transport_connection_t *tc, u32 listener_index, u32 thread_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. More...
 
transport_proto_t session_add_transport_proto (void)
 
int session_tx_fifo_peek_bytes (transport_connection_t *tc, u8 *buffer, u32 offset, u32 max_bytes)
 
u32 session_tx_fifo_dequeue_drop (transport_connection_t *tc, u32 max_bytes)
 
static u32 transport_max_rx_enqueue (transport_connection_t *tc)
 
static u32 transport_max_tx_dequeue (transport_connection_t *tc)
 
static u32 transport_max_rx_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 void transport_rx_fifo_req_deq_ntf (transport_connection_t *tc)
 
static clib_time_type_t transport_time_now (u32 thread_index)
 
static clib_us_time_t transport_us_time_now (u32 thread_index)
 
static clib_time_type_t transport_seconds_per_loop (u32 thread_index)
 
static void transport_add_tx_event (transport_connection_t *tc)
 
static u32 transport_cl_thread (void)
 
static u64 listen_session_get_handle (session_t *s)
 
static 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 session_tlisten_session_alloc (u8 thread_index, session_type_t type)
 
static session_tlisten_session_get (u32 ls_index)
 
static void listen_session_free (session_t *s)
 
static session_tho_session_alloc (void)
 
static session_tho_session_get (u32 ho_index)
 
static void ho_session_free (session_t *s)
 
transport_connection_tlisten_session_get_transport (session_t *s)
 
static session_main_tvnet_get_session_main ()
 
static session_worker_tsession_main_get_worker (u32 thread_index)
 
static session_worker_tsession_main_get_worker_if_valid (u32 thread_index)
 
static svm_msg_q_tsession_main_get_vpp_event_queue (u32 thread_index)
 
static u8 session_main_is_enabled ()
 
int session_main_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_main_flush_all_enqueue_events (u8 transport_proto)
 
void session_queue_run_on_main_thread (vlib_main_t *vm)
 
static void session_add_pending_tx_buffer (u32 thread_index, u32 bi, u32 next_node)
 Add session node pending buffer with custom node. More...
 
static void session_wrk_update_time (session_worker_t *wrk, f64 now)
 
void session_wrk_enable_adaptive_mode (session_worker_t *wrk)
 
fifo_segment_tsession_main_get_evt_q_segment (void)
 
void session_node_enable_disable (u8 is_en)
 
clib_error_tvnet_session_enable_disable (vlib_main_t *vm, u8 is_en)
 
session_tsession_alloc_for_connection (transport_connection_t *tc)
 
session_tsession_alloc_for_half_open (transport_connection_t *tc)
 

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_main_t session_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...
 
vlib_node_registration_t session_queue_pre_input_node
 (constructor) VLIB_REGISTER_NODE (session_queue_pre_input_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") \

Definition at line 25 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)
#define clib_error_return(e, args...)
Definition: error.h:99
u8 is_enabled
Session manager is enabled.
Definition: session.h:202
session_main_t session_main
Definition: session.c:25

Definition at line 727 of file session.h.

◆ TRANSPORT_N_PROTOS

#define TRANSPORT_N_PROTOS   (session_main.last_transport_proto_type + 1)

Definition at line 258 of file session.h.

◆ TRANSPORT_PROTO_INVALID

#define TRANSPORT_PROTO_INVALID   (session_main.last_transport_proto_type + 1)

Definition at line 257 of file session.h.

Typedef Documentation

◆ session_evt_ctrl_data_t

◆ session_evt_elt_t

◆ session_fifo_rx_fn

typedef int() session_fifo_rx_fn(session_worker_t *wrk, vlib_node_runtime_t *node, session_evt_elt_t *e, int *n_tx_packets)

Definition at line 163 of file session.h.

◆ session_main_t

typedef struct session_main_ session_main_t

◆ session_q_process_evt_t

◆ session_tx_context_t

◆ session_worker_t

◆ session_wrk_flag_t

◆ session_wrk_state_t

Enumeration Type Documentation

◆ session_input_error_t

Enumerator
SESSION_N_ERROR 

Definition at line 34 of file session.h.

◆ session_q_process_evt_

Enumerator
SESSION_Q_PROCESS_RUN_ON_MAIN 
SESSION_Q_PROCESS_STOP 

Definition at line 251 of file session.h.

◆ session_wrk_flags_

Enumerator
SESSION_WRK_F_ADAPTIVE 

Definition at line 82 of file session.h.

◆ session_wrk_state_

Enumerator
SESSION_WRK_POLLING 
SESSION_WRK_INTERRUPT 
SESSION_WRK_IDLE 

Definition at line 75 of file session.h.

Function Documentation

◆ format_session()

u8* format_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 101 of file session_cli.c.

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

◆ ho_session_alloc()

static session_t* ho_session_alloc ( void  )
inlinestatic

Definition at line 666 of file session.h.

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

◆ ho_session_free()

static void ho_session_free ( session_t s)
inlinestatic

Definition at line 683 of file session.h.

+ Here is the call graph for this function:

◆ ho_session_get()

static session_t* ho_session_get ( u32  ho_index)
inlinestatic

Definition at line 677 of file session.h.

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

◆ listen_session_alloc()

static session_t* listen_session_alloc ( u8  thread_index,
session_type_t  type 
)
inlinestatic

Definition at line 643 of file session.h.

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

◆ listen_session_free()

static void listen_session_free ( session_t s)
inlinestatic

Definition at line 659 of file session.h.

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

◆ listen_session_get()

static session_t* listen_session_get ( u32  ls_index)
inlinestatic

Definition at line 653 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 session_t* listen_session_get_from_handle ( session_handle_t  handle)
inlinestatic

Definition at line 630 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 ( session_t s)
inlinestatic

Definition at line 622 of file session.h.

+ 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 ( session_t s)

Definition at line 1780 of file session.c.

+ 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 636 of file session.h.

+ Here is the call graph for this function:

◆ session_add_pending_tx_buffer()

static void session_add_pending_tx_buffer ( u32  thread_index,
u32  bi,
u32  next_node 
)
inlinestatic

Add session node pending buffer with custom node.

Parameters
thread_indexworker thread expected to send the buffer
bibuffer index
next_nodenext node edge index for buffer. Edge to next node must exist

Definition at line 746 of file session.h.

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

◆ session_add_self_custom_tx_evt()

void session_add_self_custom_tx_evt ( transport_connection_t tc,
u8  has_prio 
)

Definition at line 128 of file session.c.

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

◆ session_add_transport_proto()

transport_proto_t session_add_transport_proto ( void  )

Definition at line 1727 of file session.c.

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

◆ session_alloc()

session_t* session_alloc ( u32  thread_index)

Definition at line 201 of file session.c.

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

◆ session_alloc_for_connection()

session_t* session_alloc_for_connection ( transport_connection_t tc)

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_alloc_for_half_open()

session_t* session_alloc_for_half_open ( transport_connection_t tc)

Definition at line 411 of file session.c.

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

◆ session_cleanup_half_open()

void session_cleanup_half_open ( session_handle_t  ho_handle)

Definition at line 304 of file session.c.

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

◆ session_clone_safe()

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

Definition at line 433 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 ( 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 1496 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 ( session_t s)

Definition at line 816 of file session.c.

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

◆ session_dgram_accept()

int session_dgram_accept ( transport_connection_t tc,
u32  listener_index,
u32  thread_index 
)

Definition at line 1263 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,
session_t **  new_session 
)

Move dgram session to the right thread.

Definition at line 1008 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 ( session_t s,
session_dgram_hdr_t hdr,
vlib_buffer_t b,
u8  proto,
u8  queue_event 
)

Definition at line 619 of file session.c.

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

◆ session_enqueue_notify()

int session_enqueue_notify ( session_t s)

Definition at line 778 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 564 of file session.c.

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

◆ session_evt_add_head_old()

static void session_evt_add_head_old ( session_worker_t wrk,
session_evt_elt_t elt 
)
inlinestatic

Definition at line 268 of file session.h.

+ Here is the caller graph for this function:

◆ session_evt_add_old()

static void session_evt_add_old ( session_worker_t wrk,
session_evt_elt_t elt 
)
inlinestatic

Definition at line 261 of file session.h.

+ Here is the caller graph for this function:

◆ session_evt_alloc_ctrl()

static session_evt_elt_t* session_evt_alloc_ctrl ( session_worker_t wrk)
inlinestatic

Definition at line 284 of file session.h.

+ Here is the caller graph for this function:

◆ session_evt_alloc_new()

static session_evt_elt_t* session_evt_alloc_new ( session_worker_t wrk)
inlinestatic

Definition at line 308 of file session.h.

+ Here is the caller graph for this function:

◆ session_evt_alloc_old()

static session_evt_elt_t* session_evt_alloc_old ( session_worker_t wrk)
inlinestatic

Definition at line 318 of file session.h.

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

◆ session_evt_ctrl_data()

static void* session_evt_ctrl_data ( session_worker_t wrk,
session_evt_elt_t elt 
)
inlinestatic

Definition at line 294 of file session.h.

+ Here is the caller graph for this function:

◆ session_evt_ctrl_data_alloc()

static u32 session_evt_ctrl_data_alloc ( session_worker_t wrk)
inlinestatic

Definition at line 276 of file session.h.

+ Here is the caller graph for this function:

◆ session_evt_ctrl_data_free()

static void session_evt_ctrl_data_free ( session_worker_t wrk,
session_evt_elt_t elt 
)
inlinestatic

Definition at line 301 of file session.h.

+ Here is the caller graph for this function:

◆ session_free()

void session_free ( session_t s)

Definition at line 227 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 ( session_t s)

Definition at line 279 of file session.c.

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

◆ session_get()

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

Definition at line 336 of file session.h.

+ Here is the call graph for this function:

◆ session_get_endpoint()

void session_get_endpoint ( session_t s,
transport_endpoint_t tep,
u8  is_lcl 
)

Definition at line 1756 of file session.c.

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

◆ session_get_from_handle()

static session_t* session_get_from_handle ( session_handle_t  handle)
inlinestatic

Definition at line 356 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 session_t* session_get_from_handle_if_valid ( session_handle_t  handle)
inlinestatic

Definition at line 365 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 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 408 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 session_t* session_get_if_valid ( u64  si,
u32  thread_index 
)
inlinestatic

Definition at line 343 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 ( session_t s)
inlinestatic

Definition at line 427 of file session.h.

+ Here is the caller graph for this function:

◆ session_get_transport()

transport_connection_t* session_get_transport ( session_t s)

Definition at line 1745 of file session.c.

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

◆ session_half_close()

void session_half_close ( session_t s)

Initialize session half-closing procedure.

Note that half-closing will not change the state of the session.

Definition at line 1481 of file session.c.

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

◆ session_half_open_delete_notify()

void session_half_open_delete_notify ( transport_connection_t tc)

Definition at line 347 of file session.c.

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

◆ session_half_open_migrate_notify()

void session_half_open_migrate_notify ( transport_connection_t tc)

Definition at line 363 of file session.c.

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

◆ session_half_open_migrated_notify()

int session_half_open_migrated_notify ( transport_connection_t tc)

Definition at line 373 of file session.c.

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

◆ session_is_valid()

u8 session_is_valid ( u32  si,
u8  thread_index 
)

Definition at line 241 of file session.c.

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

◆ session_listen()

int session_listen ( 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 1425 of file session.c.

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

◆ session_main_flush_all_enqueue_events()

int session_main_flush_all_enqueue_events ( u8  transport_proto)

Definition at line 878 of file session.c.

+ Here is the call graph for this function:

◆ session_main_flush_enqueue_events()

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.

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 846 of file session.c.

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

◆ session_main_get_evt_q_segment()

fifo_segment_t* session_main_get_evt_q_segment ( void  )

Definition at line 1676 of file session.c.

+ Here is the caller graph for this function:

◆ session_main_get_vpp_event_queue()

static svm_msg_q_t* session_main_get_vpp_event_queue ( u32  thread_index)
inlinestatic

Definition at line 716 of file session.h.

+ Here is the caller graph for this function:

◆ session_main_get_worker()

static session_worker_t* session_main_get_worker ( u32  thread_index)
inlinestatic

Definition at line 702 of file session.h.

+ Here is the caller graph for this function:

◆ session_main_get_worker_if_valid()

static session_worker_t* session_main_get_worker_if_valid ( u32  thread_index)
inlinestatic

Definition at line 708 of file session.h.

+ Here is the caller graph for this function:

◆ session_main_is_enabled()

static u8 session_main_is_enabled ( )
inlinestatic

Definition at line 722 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 1885 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 213 of file session_debug.c.

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

◆ session_open()

int session_open ( session_endpoint_cfg_t rmt,
session_handle_t rsh 
)

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 1409 of file session.c.

+ 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 385 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 394 of file session.h.

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

◆ session_queue_run_on_main_thread()

void session_queue_run_on_main_thread ( vlib_main_t vm)

Definition at line 1787 of file session.c.

+ 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.

Parameters
transport_prototransport proto to be registered
vftvirtual function table for transport
is_ip4flag that indicates if transports uses ipv4 as underlying network layer
output_nodeoutput node for transport

Definition at line 1704 of file session.c.

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

◆ session_reset()

void session_reset ( session_t s)

Force a close without waiting for data to be flushed.

Definition at line 1519 of file session.c.

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

◆ session_segment_handle()

u64 session_segment_handle ( session_t s)

Definition at line 1682 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()

int session_send_io_evt_to_thread ( svm_fifo_t f,
session_evt_type_t  evt_type 
)

Definition at line 84 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 91 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 116 of file session.c.

+ Here is the caller graph for this function:

◆ session_send_rpc_evt_to_thread_force()

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

Definition at line 108 of file session.c.

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

◆ session_stop_listen()

int session_stop_listen ( 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 1454 of file session.c.

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

◆ session_stream_accept()

int session_stream_accept ( transport_connection_t tc,
u32  listener_index,
u32  thread_index,
u8  notify 
)

Accept a stream session.

Optionally ping the server by callback.

Definition at line 1228 of file session.c.

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

◆ session_stream_accept_notify()

int session_stream_accept_notify ( transport_connection_t tc)

Definition at line 1202 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,
session_error_t  err 
)

Definition at line 888 of file session.c.

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

◆ session_transport_attribute()

int session_transport_attribute ( session_t s,
u8  is_get,
transport_endpt_attr_t attr 
)

Definition at line 1768 of file session.c.

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

◆ session_transport_cleanup()

void session_transport_cleanup ( 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 1607 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 ( 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 1555 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 it is closed.

Should be called by transport, prior to calling delete notify, once it knows that no more data will be exchanged. This could serve as an early acknowledgment of an active close especially if transport delete can be delayed a long time, e.g., tcp time-wait.

Definition at line 1150 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 1062 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 1084 of file session.c.

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

◆ session_transport_half_close()

void session_transport_half_close ( session_t s)

Notify transport the session can be half-disconnected.

Must be called from the session's thread.

Definition at line 1535 of file session.c.

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

◆ session_transport_reset()

void session_transport_reset ( session_t s)

Force transport close.

Definition at line 1583 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 1187 of file session.c.

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

◆ session_tx_fifo_dequeue_drop()

u32 session_tx_fifo_dequeue_drop ( transport_connection_t tc,
u32  max_bytes 
)

Definition at line 692 of file session.c.

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

◆ session_tx_fifo_peek_bytes()

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

Definition at line 684 of file session.c.

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

◆ session_wrk_enable_adaptive_mode()

void session_wrk_enable_adaptive_mode ( session_worker_t wrk)

Definition at line 1860 of file session_node.c.

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

◆ session_wrk_handle_mq()

int session_wrk_handle_mq ( session_worker_t wrk,
svm_msg_q_t mq 
)

Definition at line 1662 of file session_node.c.

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

◆ session_wrk_update_time()

static void session_wrk_update_time ( session_worker_t wrk,
f64  now 
)
inlinestatic

Definition at line 756 of file session.h.

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

◆ sesssion_reschedule_tx()

void sesssion_reschedule_tx ( transport_connection_t tc)

Definition at line 161 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 603 of file session.h.

+ Here is the call graph for this function:

◆ transport_cl_thread()

static u32 transport_cl_thread ( void  )
inlinestatic

Definition at line 612 of file session.h.

+ Here is the caller graph for this function:

◆ transport_max_rx_dequeue()

static u32 transport_max_rx_dequeue ( transport_connection_t tc)
inlinestatic

Definition at line 550 of file session.h.

+ Here is the call graph for this function:
+ 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 536 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 543 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 571 of file session.h.

+ Here is the call graph for this function:

◆ transport_rx_fifo_req_deq_ntf()

static void transport_rx_fifo_req_deq_ntf ( transport_connection_t tc)
inlinestatic

Definition at line 578 of file session.h.

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

◆ transport_rx_fifo_size()

static u32 transport_rx_fifo_size ( transport_connection_t tc)
inlinestatic

Definition at line 557 of file session.h.

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

◆ transport_seconds_per_loop()

static clib_time_type_t transport_seconds_per_loop ( u32  thread_index)
inlinestatic

Definition at line 597 of file session.h.

+ Here is the caller graph for this function:

◆ transport_time_now()

static clib_time_type_t transport_time_now ( u32  thread_index)
inlinestatic

Definition at line 585 of file session.h.

◆ transport_tx_fifo_size()

static u32 transport_tx_fifo_size ( transport_connection_t tc)
inlinestatic

Definition at line 564 of file session.h.

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

◆ transport_us_time_now()

static clib_us_time_t transport_us_time_now ( u32  thread_index)
inlinestatic

Definition at line 591 of file session.h.

+ Here is the caller graph for this function:

◆ unformat_session()

uword unformat_session ( unformat_input_t input,
va_list *  args 
)

Definition at line 238 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 269 of file session_cli.c.

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

◆ vnet_get_session_main()

static session_main_t* vnet_get_session_main ( )
inlinestatic

Definition at line 696 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 1927 of file session.c.

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

Variable Documentation

◆ session_main

session_main_t session_main

Definition at line 25 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,
}
#define VLIB_NODE_FLAG_TRACE_SUPPORTED
Definition: node.h:296
static uword session_queue_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static char * session_queue_error_strings[]
Definition: session_node.c:810
#define ARRAY_LEN(x)
Definition: clib.h:70
static u8 * format_session_queue_trace(u8 *s, va_list *args)
Definition: session_node.c:786

(constructor) VLIB_REGISTER_NODE (session_queue_node)

Definition at line 1826 of file session_node.c.

◆ session_queue_pre_input_node

vlib_node_registration_t session_queue_pre_input_node

(constructor) VLIB_REGISTER_NODE (session_queue_pre_input_node)

Definition at line 1963 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 1942 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