FD.io VPP  v21.01.1
Vector Packet Processing
transport.c File Reference
+ Include dependency graph for transport.c:

Go to the source code of this file.

Data Structures

struct  local_endpoint_
 

Macros

#define PORT_MASK   ((1 << 16)- 1)
 

Typedefs

typedef struct local_endpoint_ local_endpoint_t
 

Functions

u8format_transport_proto (u8 *s, va_list *args)
 
u8format_transport_proto_short (u8 *s, va_list *args)
 
u8format_transport_connection (u8 *s, va_list *args)
 
u8format_transport_listen_connection (u8 *s, va_list *args)
 
u8format_transport_half_open_connection (u8 *s, va_list *args)
 
static u8 unformat_transport_str_match (unformat_input_t *input, const char *str)
 
uword unformat_transport_proto (unformat_input_t *input, va_list *args)
 
u8format_transport_protos (u8 *s, va_list *args)
 
u32 transport_endpoint_lookup (transport_endpoint_table_t *ht, u8 proto, ip46_address_t *ip, u16 port)
 
void transport_endpoint_table_add (transport_endpoint_table_t *ht, u8 proto, transport_endpoint_t *te, u32 value)
 
void transport_endpoint_table_del (transport_endpoint_table_t *ht, u8 proto, transport_endpoint_t *te)
 
void transport_register_protocol (transport_proto_t transport_proto, const transport_proto_vft_t *vft, fib_protocol_t fib_proto, u32 output_node)
 Register transport virtual function table. More...
 
transport_proto_t transport_register_new_protocol (const transport_proto_vft_t *vft, fib_protocol_t fib_proto, u32 output_node)
 
transport_proto_vft_ttransport_protocol_get_vft (transport_proto_t transport_proto)
 Get transport virtual function table. More...
 
transport_service_type_t transport_protocol_service_type (transport_proto_t tp)
 
transport_tx_fn_type_t transport_protocol_tx_fn_type (transport_proto_t tp)
 
void transport_cleanup (transport_proto_t tp, u32 conn_index, u8 thread_index)
 
void transport_cleanup_half_open (transport_proto_t tp, u32 conn_index)
 
int transport_connect (transport_proto_t tp, transport_endpoint_cfg_t *tep)
 
void transport_close (transport_proto_t tp, u32 conn_index, u8 thread_index)
 
void transport_reset (transport_proto_t tp, u32 conn_index, u8 thread_index)
 
u32 transport_start_listen (transport_proto_t tp, u32 session_index, transport_endpoint_t *tep)
 
u32 transport_stop_listen (transport_proto_t tp, u32 conn_index)
 
u8 transport_protocol_is_cl (transport_proto_t tp)
 
static void default_get_transport_endpoint (transport_connection_t *tc, transport_endpoint_t *tep, u8 is_lcl)
 
void transport_get_endpoint (transport_proto_t tp, u32 conn_index, u32 thread_index, transport_endpoint_t *tep, u8 is_lcl)
 
void transport_get_listener_endpoint (transport_proto_t tp, u32 conn_index, transport_endpoint_t *tep, u8 is_lcl)
 
void transport_endpoint_del (u32 tepi)
 
static local_endpoint_ttransport_endpoint_new (void)
 
void transport_endpoint_cleanup (u8 proto, ip46_address_t *lcl_ip, u16 port)
 
static void transport_endpoint_mark_used (u8 proto, ip46_address_t *ip, u16 port)
 
void transport_share_local_endpoint (u8 proto, ip46_address_t *lcl_ip, u16 port)
 
int transport_alloc_local_port (u8 proto, ip46_address_t *ip)
 Allocate local port and add if successful add entry to local endpoint table to mark the pair as used. More...
 
static session_error_t transport_get_interface_ip (u32 sw_if_index, u8 is_ip4, ip46_address_t *addr)
 
static session_error_t transport_find_local_ip_for_remote (u32 sw_if_index, transport_endpoint_t *rmt, ip46_address_t *lcl_addr)
 
int transport_alloc_local_endpoint (u8 proto, transport_endpoint_cfg_t *rmt_cfg, ip46_address_t *lcl_addr, u16 *lcl_port)
 
u8format_clib_us_time (u8 *s, va_list *args)
 
u8format_transport_pacer (u8 *s, va_list *args)
 
static u32 spacer_max_burst (spacer_t *pacer, clib_us_time_t time_now)
 
static void spacer_update_bucket (spacer_t *pacer, u32 bytes)
 
static void spacer_set_pace_rate (spacer_t *pacer, u64 rate_bytes_per_sec, clib_us_time_t rtt, clib_time_type_t sec_per_loop)
 
static u64 spacer_pace_rate (spacer_t *pacer)
 
static void spacer_reset (spacer_t *pacer, clib_us_time_t time_now, u64 bucket)
 
void transport_connection_tx_pacer_reset (transport_connection_t *tc, u64 rate_bytes_per_sec, u32 start_bucket, clib_us_time_t rtt)
 
void transport_connection_tx_pacer_reset_bucket (transport_connection_t *tc, u32 bucket)
 Reset tx pacer bucket. More...
 
void transport_connection_tx_pacer_init (transport_connection_t *tc, u64 rate_bytes_per_sec, u32 initial_bucket)
 Initialize tx pacer for connection. More...
 
void transport_connection_tx_pacer_update (transport_connection_t *tc, u64 bytes_per_sec, clib_us_time_t rtt)
 Update tx pacer pacing rate. More...
 
u32 transport_connection_tx_pacer_burst (transport_connection_t *tc)
 Get tx pacer max burst. More...
 
u64 transport_connection_tx_pacer_rate (transport_connection_t *tc)
 Get tx pacer current rate. More...
 
void transport_connection_update_tx_bytes (transport_connection_t *tc, u32 bytes)
 Update tx bytes for paced transport connection. More...
 
void transport_connection_tx_pacer_update_bytes (transport_connection_t *tc, u32 bytes)
 
void transport_connection_reschedule (transport_connection_t *tc)
 
void transport_fifos_init_ooo (transport_connection_t *tc)
 
void transport_update_time (clib_time_type_t time_now, u8 thread_index)
 
void transport_enable_disable (vlib_main_t *vm, u8 is_en)
 
void transport_init (void)
 

Variables

transport_proto_vft_ttp_vfts
 Per-type vector of transport protocol virtual function tables. More...
 
static u32 port_allocator_seed
 
static transport_endpoint_table_t local_endpoints_table
 
static local_endpoint_tlocal_endpoints
 
static clib_spinlock_t local_endpoints_lock
 

Macro Definition Documentation

◆ PORT_MASK

#define PORT_MASK   ((1 << 16)- 1)

Definition at line 402 of file transport.c.

Typedef Documentation

◆ local_endpoint_t

Function Documentation

◆ default_get_transport_endpoint()

static void default_get_transport_endpoint ( transport_connection_t tc,
transport_endpoint_t tep,
u8  is_lcl 
)
inlinestatic

Definition at line 355 of file transport.c.

+ Here is the caller graph for this function:

◆ format_clib_us_time()

u8* format_clib_us_time ( u8 s,
va_list *  args 
)

Definition at line 616 of file transport.c.

+ Here is the caller graph for this function:

◆ format_transport_connection()

u8* format_transport_connection ( u8 s,
va_list *  args 
)

Definition at line 80 of file transport.c.

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

◆ format_transport_half_open_connection()

u8* format_transport_half_open_connection ( u8 s,
va_list *  args 
)

Definition at line 124 of file transport.c.

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

◆ format_transport_listen_connection()

u8* format_transport_listen_connection ( u8 s,
va_list *  args 
)

Definition at line 110 of file transport.c.

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

◆ format_transport_pacer()

u8* format_transport_pacer ( u8 s,
va_list *  args 
)

Definition at line 627 of file transport.c.

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

◆ format_transport_proto()

u8* format_transport_proto ( u8 s,
va_list *  args 
)

Definition at line 52 of file transport.c.

+ Here is the caller graph for this function:

◆ format_transport_proto_short()

u8* format_transport_proto_short ( u8 s,
va_list *  args 
)

Definition at line 65 of file transport.c.

+ Here is the caller graph for this function:

◆ format_transport_protos()

u8* format_transport_protos ( u8 s,
va_list *  args 
)

Definition at line 190 of file transport.c.

+ Here is the caller graph for this function:

◆ spacer_max_burst()

static u32 spacer_max_burst ( spacer_t pacer,
clib_us_time_t  time_now 
)
inlinestatic

Definition at line 642 of file transport.c.

+ Here is the caller graph for this function:

◆ spacer_pace_rate()

static u64 spacer_pace_rate ( spacer_t pacer)
inlinestatic

Definition at line 690 of file transport.c.

+ Here is the caller graph for this function:

◆ spacer_reset()

static void spacer_reset ( spacer_t pacer,
clib_us_time_t  time_now,
u64  bucket 
)
inlinestatic

Definition at line 696 of file transport.c.

+ Here is the caller graph for this function:

◆ spacer_set_pace_rate()

static void spacer_set_pace_rate ( spacer_t pacer,
u64  rate_bytes_per_sec,
clib_us_time_t  rtt,
clib_time_type_t  sec_per_loop 
)
inlinestatic

Definition at line 663 of file transport.c.

+ Here is the caller graph for this function:

◆ spacer_update_bucket()

static void spacer_update_bucket ( spacer_t pacer,
u32  bytes 
)
inlinestatic

Definition at line 657 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_alloc_local_endpoint()

int transport_alloc_local_endpoint ( u8  proto,
transport_endpoint_cfg_t rmt_cfg,
ip46_address_t *  lcl_addr,
u16 lcl_port 
)

Definition at line 565 of file transport.c.

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

◆ transport_alloc_local_port()

int transport_alloc_local_port ( u8  proto,
ip46_address_t *  ip 
)

Allocate local port and add if successful add entry to local endpoint table to mark the pair as used.

Definition at line 475 of file transport.c.

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

◆ transport_cleanup()

void transport_cleanup ( transport_proto_t  tp,
u32  conn_index,
u8  thread_index 
)

Definition at line 302 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_cleanup_half_open()

void transport_cleanup_half_open ( transport_proto_t  tp,
u32  conn_index 
)

Definition at line 308 of file transport.c.

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

◆ transport_close()

void transport_close ( transport_proto_t  tp,
u32  conn_index,
u8  thread_index 
)

Definition at line 321 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_connect()

int transport_connect ( transport_proto_t  tp,
transport_endpoint_cfg_t tep 
)

Definition at line 315 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_connection_reschedule()

void transport_connection_reschedule ( transport_connection_t tc)

Definition at line 766 of file transport.c.

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

◆ transport_connection_tx_pacer_burst()

u32 transport_connection_tx_pacer_burst ( transport_connection_t tc)

Get tx pacer max burst.

Parameters
tctransport connection
time_nowcurrent cpu time
Returns
max burst for connection

Definition at line 739 of file transport.c.

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

◆ transport_connection_tx_pacer_init()

void transport_connection_tx_pacer_init ( transport_connection_t tc,
u64  rate_bytes_per_sec,
u32  initial_bucket 
)

Initialize tx pacer for connection.

Parameters
tctransport connection
rate_bytes_per_secondinitial byte rate
burst_bytesinitial burst size in bytes

Definition at line 721 of file transport.c.

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

◆ transport_connection_tx_pacer_rate()

u64 transport_connection_tx_pacer_rate ( transport_connection_t tc)

Get tx pacer current rate.

Parameters
tctransport connection
Returns
rate for connection in bytes/s

Definition at line 746 of file transport.c.

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

◆ transport_connection_tx_pacer_reset()

void transport_connection_tx_pacer_reset ( transport_connection_t tc,
u64  rate_bytes_per_sec,
u32  start_bucket,
clib_us_time_t  rtt 
)

Definition at line 703 of file transport.c.

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

◆ transport_connection_tx_pacer_reset_bucket()

void transport_connection_tx_pacer_reset_bucket ( transport_connection_t tc,
u32  bucket 
)

Reset tx pacer bucket.

Parameters
tctransport connection
bucketvalue the bucket will be reset to

Definition at line 714 of file transport.c.

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

◆ transport_connection_tx_pacer_update()

void transport_connection_tx_pacer_update ( transport_connection_t tc,
u64  bytes_per_sec,
clib_us_time_t  rtt 
)

Update tx pacer pacing rate.

Parameters
tctransport connection
bytes_per_secnew pacing rate
rttconnection rtt that is used to compute inactivity time after which pacer bucket is reset to 1 mtu

Definition at line 731 of file transport.c.

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

◆ transport_connection_tx_pacer_update_bytes()

void transport_connection_tx_pacer_update_bytes ( transport_connection_t tc,
u32  bytes 
)

Definition at line 759 of file transport.c.

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

◆ transport_connection_update_tx_bytes()

void transport_connection_update_tx_bytes ( transport_connection_t tc,
u32  bytes 
)

Update tx bytes for paced transport connection.

If tx pacing is enabled, this update pacer bucket to account for the amount of bytes that have been sent.

Parameters
tctransport connection
bytesbytes recently sent

Definition at line 752 of file transport.c.

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

◆ transport_enable_disable()

void transport_enable_disable ( vlib_main_t vm,
u8  is_en 
)

Definition at line 802 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_endpoint_cleanup()

void transport_endpoint_cleanup ( u8  proto,
ip46_address_t *  lcl_ip,
u16  port 
)

Definition at line 421 of file transport.c.

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

◆ transport_endpoint_del()

void transport_endpoint_del ( u32  tepi)

Definition at line 405 of file transport.c.

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

◆ transport_endpoint_lookup()

u32 transport_endpoint_lookup ( transport_endpoint_table_t ht,
u8  proto,
ip46_address_t *  ip,
u16  port 
)

Definition at line 201 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_endpoint_mark_used()

static void transport_endpoint_mark_used ( u8  proto,
ip46_address_t *  ip,
u16  port 
)
static

Definition at line 442 of file transport.c.

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

◆ transport_endpoint_new()

static local_endpoint_t* transport_endpoint_new ( void  )
inlinestatic

Definition at line 413 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_endpoint_table_add()

void transport_endpoint_table_add ( transport_endpoint_table_t ht,
u8  proto,
transport_endpoint_t te,
u32  value 
)

Definition at line 219 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_endpoint_table_del()

void transport_endpoint_table_del ( transport_endpoint_table_t ht,
u8  proto,
transport_endpoint_t te 
)

Definition at line 233 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_fifos_init_ooo()

void transport_fifos_init_ooo ( transport_connection_t tc)

Definition at line 783 of file transport.c.

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

◆ transport_find_local_ip_for_remote()

static session_error_t transport_find_local_ip_for_remote ( u32  sw_if_index,
transport_endpoint_t rmt,
ip46_address_t *  lcl_addr 
)
static

Definition at line 534 of file transport.c.

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

◆ transport_get_endpoint()

void transport_get_endpoint ( transport_proto_t  tp,
u32  conn_index,
u32  thread_index,
transport_endpoint_t tep,
u8  is_lcl 
)

Definition at line 373 of file transport.c.

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

◆ transport_get_interface_ip()

static session_error_t transport_get_interface_ip ( u32  sw_if_index,
u8  is_ip4,
ip46_address_t *  addr 
)
static

Definition at line 512 of file transport.c.

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

◆ transport_get_listener_endpoint()

void transport_get_listener_endpoint ( transport_proto_t  tp,
u32  conn_index,
transport_endpoint_t tep,
u8  is_lcl 
)

Definition at line 389 of file transport.c.

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

◆ transport_init()

void transport_init ( void  )

Definition at line 813 of file transport.c.

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

◆ transport_protocol_get_vft()

transport_proto_vft_t* transport_protocol_get_vft ( transport_proto_t  transport_proto)

Get transport virtual function table.

Parameters
type- session type (not protocol type)

Definition at line 282 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_protocol_is_cl()

u8 transport_protocol_is_cl ( transport_proto_t  tp)

Definition at line 349 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_protocol_service_type()

transport_service_type_t transport_protocol_service_type ( transport_proto_t  tp)

Definition at line 290 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_protocol_tx_fn_type()

transport_tx_fn_type_t transport_protocol_tx_fn_type ( transport_proto_t  tp)

Definition at line 296 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_register_new_protocol()

transport_proto_t transport_register_new_protocol ( const transport_proto_vft_t vft,
fib_protocol_t  fib_proto,
u32  output_node 
)

Definition at line 259 of file transport.c.

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

◆ transport_register_protocol()

void transport_register_protocol ( transport_proto_t  transport_proto,
const transport_proto_vft_t vft,
fib_protocol_t  fib_proto,
u32  output_node 
)

Register transport virtual function table.

Parameters
transport_proto- transport protocol type (i.e., TCP, UDP ..)
vft- virtual function table for transport proto
fib_proto- network layer protocol
output_node- output node index that session layer will hand off buffers to, for requested fib proto

Definition at line 246 of file transport.c.

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

◆ transport_reset()

void transport_reset ( transport_proto_t  tp,
u32  conn_index,
u8  thread_index 
)

Definition at line 327 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_share_local_endpoint()

void transport_share_local_endpoint ( u8  proto,
ip46_address_t *  lcl_ip,
u16  port 
)

Definition at line 456 of file transport.c.

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

◆ transport_start_listen()

u32 transport_start_listen ( transport_proto_t  tp,
u32  session_index,
transport_endpoint_t tep 
)

Definition at line 336 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_stop_listen()

u32 transport_stop_listen ( transport_proto_t  tp,
u32  conn_index 
)

Definition at line 343 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_update_time()

void transport_update_time ( clib_time_type_t  time_now,
u8  thread_index 
)

Definition at line 791 of file transport.c.

+ Here is the caller graph for this function:

◆ unformat_transport_proto()

uword unformat_transport_proto ( unformat_input_t input,
va_list *  args 
)

Definition at line 155 of file transport.c.

+ Here is the caller graph for this function:

◆ unformat_transport_str_match()

static u8 unformat_transport_str_match ( unformat_input_t input,
const char *  str 
)
static

Definition at line 139 of file transport.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ local_endpoints

local_endpoint_t* local_endpoints
static

Definition at line 44 of file transport.c.

◆ local_endpoints_lock

clib_spinlock_t local_endpoints_lock
static

Definition at line 49 of file transport.c.

◆ local_endpoints_table

transport_endpoint_table_t local_endpoints_table
static

Definition at line 39 of file transport.c.

◆ port_allocator_seed

u32 port_allocator_seed
static

Definition at line 34 of file transport.c.

◆ tp_vfts

Per-type vector of transport protocol virtual function tables.

Definition at line 29 of file transport.c.