FD.io VPP  v17.10-9-gd594711
Vector Packet Processing
session.c File Reference

Session and session manager. More...

+ Include dependency graph for session.c:

Go to the source code of this file.

Functions

int stream_session_create_i (segment_manager_t *sm, transport_connection_t *tc, u8 alloc_fifos, stream_session_t **ret_s)
 
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. More...
 
static int session_enqueue_chain_tail (stream_session_t *s, vlib_buffer_t *b, u32 offset, u8 is_in_order)
 Enqueue buffer chain tail. More...
 
int stream_session_enqueue_data (transport_connection_t *tc, vlib_buffer_t *b, u32 offset, u8 queue_event, u8 is_in_order)
 
u8 stream_session_no_space (transport_connection_t *tc, u32 thread_index, u16 data_len)
 Check if we have space in rx fifo to push more bytes. More...
 
u32 stream_session_tx_fifo_max_dequeue (transport_connection_t *tc)
 
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)
 
static int stream_session_enqueue_notify (stream_session_t *s, u8 block)
 Notify session peer that new data has been enqueued. More...
 
int session_manager_flush_enqueue_events (u32 thread_index)
 Flushes queue of sessions that are to be notified of new data enqueued events. More...
 
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_connect_notify (transport_connection_t *tc, u8 is_fail)
 
void stream_session_accept_notify (transport_connection_t *tc)
 
void stream_session_disconnect_notify (transport_connection_t *tc)
 Notification from transport that connection is being closed. More...
 
void stream_session_delete (stream_session_t *s)
 Cleans up session and lookup table. More...
 
void stream_session_delete_notify (transport_connection_t *tc)
 Notification from transport that connection is being deleted. More...
 
void stream_session_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 sst, u8 notify)
 Accept a stream session. More...
 
int stream_session_open (u32 app_index, session_type_t st, transport_endpoint_t *rmt, transport_connection_t **res)
 Ask transport to open connection to remote transport endpoint. More...
 
int stream_session_listen (stream_session_t *s, transport_endpoint_t *tep)
 Ask transport to listen on local transport endpoint. More...
 
int stream_session_stop_listen (stream_session_t *s)
 Ask transport to stop listening on local transport endpoint. More...
 
void session_send_session_evt_to_thread (u64 session_handle, fifo_event_type_t evt_type, u32 thread_index)
 
void stream_session_disconnect (stream_session_t *s)
 Disconnect session and propagate to transport. More...
 
void stream_session_cleanup (stream_session_t *s)
 Cleanup transport and session state. More...
 
void session_vpp_event_queue_allocate (session_manager_main_t *smm, u32 thread_index)
 Allocate vpp event queue (once) per worker thread. More...
 
session_type_t session_type_from_proto_and_ip (transport_proto_t proto, u8 is_ip4)
 
static clib_error_tsession_manager_main_enable (vlib_main_t *vm)
 
void session_node_enable_disable (u8 is_en)
 
clib_error_tvnet_session_enable_disable (vlib_main_t *vm, u8 is_en)
 
clib_error_tsession_manager_main_init (vlib_main_t *vm)
 
static clib_error_tsession_config_fn (vlib_main_t *vm, unformat_input_t *input)
 

Variables

session_manager_main_t session_manager_main
 
transport_proto_vft_ttp_vfts
 Per-type vector of transport protocol virtual function tables. More...
 

Detailed Description

Session and session manager.

Definition in file session.c.

Function Documentation

static clib_error_t* session_config_fn ( vlib_main_t vm,
unformat_input_t input 
)
static

Definition at line 959 of file session.c.

+ Here is the call graph for this function:

static int session_enqueue_chain_tail ( stream_session_t s,
vlib_buffer_t b,
u32  offset,
u8  is_in_order 
)
inlinestatic

Enqueue buffer chain tail.

Definition at line 132 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)
inlinestatic

Discards bytes from buffer chain.

It discards n_bytes_to_drop starting at first buffer after chain_b

Definition at line 101 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int session_manager_flush_enqueue_events ( 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 392 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* session_manager_main_enable ( vlib_main_t vm)
static

Definition at line 841 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* session_manager_main_init ( vlib_main_t vm)

Definition at line 949 of file session.c.

void session_node_enable_disable ( u8  is_en)

Definition at line 916 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void session_send_session_evt_to_thread ( u64  session_handle,
fifo_event_type_t  evt_type,
u32  thread_index 
)

Definition at line 730 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

session_type_t session_type_from_proto_and_ip ( transport_proto_t  proto,
u8  is_ip4 
)

Definition at line 820 of file session.c.

+ Here is the caller graph for this function:

void session_vpp_event_queue_allocate ( session_manager_main_t smm,
u32  thread_index 
)

Allocate vpp event queue (once) per worker thread.

Definition at line 794 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Accept a stream session.

Optionally ping the server by callback.

Definition at line 594 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_accept_notify ( transport_connection_t tc)

Definition at line 506 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_cleanup ( stream_session_t s)

Cleanup transport and session state.

Notify transport of the cleanup, wait for a delete notify to actually remove the session state.

Definition at line 776 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int stream_session_connect_notify ( transport_connection_t tc,
u8  is_fail 
)

Definition at line 441 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int stream_session_create_i ( segment_manager_t sm,
transport_connection_t tc,
u8  alloc_fifos,
stream_session_t **  ret_s 
)

Definition at line 32 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_delete ( stream_session_t s)

Cleans up session and lookup table.

Definition at line 538 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_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 565 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 stream_session_dequeue_drop ( transport_connection_t tc,
u32  max_bytes 
)

Definition at line 307 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_disconnect ( stream_session_t s)

Disconnect session and propagate to transport.

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

Should be called from the session's thread.

Definition at line 763 of file session.c.

+ Here is the caller graph for this function:

void stream_session_disconnect_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 524 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 220 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int stream_session_enqueue_notify ( stream_session_t s,
u8  block 
)
static

Notify session peer that new data has been enqueued.

Parameters
sStream session for which the event is to be generated.
blockFlag to indicate if call should block if event queue is full.
Returns
0 on succes or negative number if failed to send notification.

Definition at line 322 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int stream_session_listen ( stream_session_t s,
transport_endpoint_t tep 
)

Ask transport to listen on local transport endpoint.

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

Definition at line 676 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8 stream_session_no_space ( transport_connection_t tc,
u32  thread_index,
u16  data_len 
)

Check if we have space in rx fifo to push more bytes.

Definition at line 275 of file session.c.

+ Here is the call graph for this function:

int stream_session_open ( u32  app_index,
session_type_t  st,
transport_endpoint_t rmt,
transport_connection_t **  res 
)

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
resResulting transport connection .

Definition at line 637 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 299 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_reset_notify ( transport_connection_t tc)

Notify application that connection has been reset.

Definition at line 580 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int stream_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 707 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 stream_session_tx_fifo_max_dequeue ( transport_connection_t tc)

Definition at line 290 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* vnet_session_enable_disable ( vlib_main_t vm,
u8  is_en 
)

Definition at line 928 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_t session_manager_main

Definition at line 28 of file session.c.

Per-type vector of transport protocol virtual function tables.

Definition at line 22 of file transport_interface.c.