FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
transport.c File Reference
+ Include dependency graph for transport.c:

Go to the source code of this file.

Macros

#define TRANSPORT_PACER_MIN_MSS   1460
 
#define TRANSPORT_PACER_MIN_BURST   TRANSPORT_PACER_MIN_MSS
 
#define PORT_MASK   ((1 << 16)- 1)
 
#define SPACER_CPU_TICKS_PER_PERIOD_SHIFT   10
 
#define SPACER_CPU_TICKS_PER_PERIOD   (1 << SPACER_CPU_TICKS_PER_PERIOD_SHIFT)
 

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)
 
uword unformat_transport_proto (unformat_input_t *input, 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_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)
 
u8 transport_protocol_is_cl (transport_proto_t tp)
 
void transport_endpoint_del (u32 tepi)
 
static transport_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)
 
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 clib_error_ttransport_get_interface_ip (u32 sw_if_index, u8 is_ip4, ip46_address_t *addr)
 
static clib_error_ttransport_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_transport_pacer (u8 *s, va_list *args)
 
static u32 spacer_max_burst (spacer_t *pacer, u64 norm_time_now)
 
static void spacer_update_bucket (spacer_t *pacer, u32 bytes)
 
static void spacer_update_max_burst_size (spacer_t *pacer, u32 max_burst_bytes)
 
static void spacer_set_pace_rate (spacer_t *pacer, u64 rate_bytes_per_sec)
 
void transport_connection_tx_pacer_reset (transport_connection_t *tc, u32 rate_bytes_per_sec, u32 start_bucket, u64 time_now)
 
void transport_connection_tx_pacer_init (transport_connection_t *tc, u32 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)
 Update tx pacer pacing rate. More...
 
u32 transport_connection_tx_pacer_burst (transport_connection_t *tc, u64 time_now)
 
u32 transport_connection_snd_space (transport_connection_t *tc, u64 time_now, u16 mss)
 Get maximum tx burst allowed for transport connection. More...
 
void transport_connection_update_tx_stats (transport_connection_t *tc, u32 bytes)
 Update tx byte stats for transport connection. More...
 
void transport_connection_tx_pacer_update_bytes (transport_connection_t *tc, u32 bytes)
 
void transport_init_tx_pacers_period (void)
 Initialize period for tx pacers. More...
 
void transport_update_time (f64 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 transport_endpoint_tlocal_endpoints
 
static clib_spinlock_t local_endpoints_lock
 
static double transport_pacer_period
 

Macro Definition Documentation

◆ PORT_MASK

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

Definition at line 281 of file transport.c.

◆ SPACER_CPU_TICKS_PER_PERIOD

#define SPACER_CPU_TICKS_PER_PERIOD   (1 << SPACER_CPU_TICKS_PER_PERIOD_SHIFT)

Definition at line 488 of file transport.c.

◆ SPACER_CPU_TICKS_PER_PERIOD_SHIFT

#define SPACER_CPU_TICKS_PER_PERIOD_SHIFT   10

Definition at line 487 of file transport.c.

◆ TRANSPORT_PACER_MIN_BURST

#define TRANSPORT_PACER_MIN_BURST   TRANSPORT_PACER_MIN_MSS

Definition at line 51 of file transport.c.

◆ TRANSPORT_PACER_MIN_MSS

#define TRANSPORT_PACER_MIN_MSS   1460

Definition at line 50 of file transport.c.

Function Documentation

◆ format_transport_connection()

u8* format_transport_connection ( u8 s,
va_list *  args 
)

Definition at line 98 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 140 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 125 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 491 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 54 of file transport.c.

+ Here is the call graph for this function:
+ 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 76 of file transport.c.

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

◆ spacer_max_burst()

static u32 spacer_max_burst ( spacer_t pacer,
u64  norm_time_now 
)
inlinestatic

Definition at line 502 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 
)
inlinestatic

Definition at line 531 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 517 of file transport.c.

+ Here is the caller graph for this function:

◆ spacer_update_max_burst_size()

static void spacer_update_max_burst_size ( spacer_t pacer,
u32  max_burst_bytes 
)
inlinestatic

Definition at line 524 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 431 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 334 of file transport.c.

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

◆ transport_connection_snd_space()

u32 transport_connection_snd_space ( transport_connection_t tc,
u64  time_now,
u16  mss 
)

Get maximum tx burst allowed for transport connection.

Parameters
tctransport connection
time_nowcurrent cpu time as returned by clib_cpu_time_now
msstransport's mss

Definition at line 585 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,
u64  time_now 
)

Definition at line 577 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,
u32  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 555 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,
u32  rate_bytes_per_sec,
u32  start_bucket,
u64  time_now 
)

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

Update tx pacer pacing rate.

Parameters
tctransport connection
bytes_per_secnew pacing rate

Definition at line 567 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 611 of file transport.c.

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

◆ transport_connection_update_tx_stats()

void transport_connection_update_tx_stats ( transport_connection_t tc,
u32  bytes 
)

Update tx byte stats for transport connection.

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

Parameters
tctransport connection
pktspackets recently sent
bytesbytes recently sent

Definition at line 603 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 636 of file transport.c.

◆ transport_endpoint_cleanup()

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

Definition at line 300 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 284 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 184 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 317 of file transport.c.

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

◆ transport_endpoint_new()

static transport_endpoint_t* transport_endpoint_new ( void  )
inlinestatic

Definition at line 292 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 202 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 216 of file transport.c.

+ Here is the caller graph for this function:

◆ transport_find_local_ip_for_remote()

static clib_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 397 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 clib_error_t* transport_get_interface_ip ( u32  sw_if_index,
u8  is_ip4,
ip46_address_t *  addr 
)
static

Definition at line 371 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 647 of file transport.c.

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

◆ transport_init_tx_pacers_period()

void transport_init_tx_pacers_period ( void  )

Initialize period for tx pacers.

Defines a unit of time with respect to number of cpu cycles that is to be used by all tx pacers.

Definition at line 618 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 256 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 276 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 264 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 270 of file transport.c.

+ 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 238 of file transport.c.

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

◆ transport_update_time()

void transport_update_time ( f64  time_now,
u8  thread_index 
)

Definition at line 625 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 call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ local_endpoints

transport_endpoint_t* local_endpoints
static

Definition at line 38 of file transport.c.

◆ local_endpoints_lock

clib_spinlock_t local_endpoints_lock
static

Definition at line 43 of file transport.c.

◆ local_endpoints_table

transport_endpoint_table_t local_endpoints_table
static

Definition at line 33 of file transport.c.

◆ port_allocator_seed

u32 port_allocator_seed
static

Definition at line 28 of file transport.c.

◆ tp_vfts

Per-type vector of transport protocol virtual function tables.

Generate typed init functions for multiple hash table styles...

Definition at line 23 of file transport.c.

◆ transport_pacer_period

double transport_pacer_period
static

Definition at line 48 of file transport.c.