FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
tcp.h File Reference
+ Include dependency graph for tcp.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tcp_bt_sample_
 
struct  tcp_rate_sample_
 
struct  tcp_byte_tracker_
 
struct  tcp_errors_
 
struct  tcp_worker_ctx_
 
struct  tcp_iss_seed_
 
struct  tcp_configuration_
 

Macros

#define TCP_TICK   0.001
 TCP tick period (s) More...
 
#define THZ   (u32) (1/TCP_TICK)
 TCP tick frequency. More...
 
#define TCP_TSTAMP_RESOLUTION   TCP_TICK
 Time stamp resolution. More...
 
#define TCP_PAWS_IDLE   24 * 24 * 60 * 60 * THZ
 24 days More...
 
#define TCP_FIB_RECHECK_PERIOD   1 * THZ
 Recheck every 1s. More...
 
#define TCP_MAX_OPTION_SPACE   40
 
#define TCP_CC_DATA_SZ   24
 
#define TCP_MAX_GSO_SZ   65536
 
#define TCP_RXT_MAX_BURST   10
 
#define TCP_DUPACK_THRESHOLD   3
 
#define TCP_IW_N_SEGMENTS   10
 
#define TCP_ALWAYS_ACK   1
 On/off delayed acks. More...
 
#define TCP_USE_SACKS   1
 Disable only for testing. More...
 
#define foreach_tcp_fsm_state
 TCP FSM state definitions as per RFC793. More...
 
#define foreach_tcp_timer
 TCP timers. More...
 
#define TCP_TIMER_HANDLE_INVALID   ((u32) ~0)
 
#define TCP_TIMER_TICK   0.1
 Timer tick in seconds. More...
 
#define TCP_TO_TIMER_TICK   TCP_TICK*10
 Factor for converting ticks to timer ticks. More...
 
#define TCP_RTO_MAX   60 * THZ /* Min max RTO (60s) as per RFC6298 */
 
#define TCP_RTO_MIN   0.2 * THZ /* Min RTO (200ms) - lower than standard */
 
#define TCP_RTT_MAX   30 * THZ /* 30s (probably too much) */
 
#define TCP_RTO_SYN_RETRIES   3 /* SYN retries without doubling RTO */
 
#define TCP_RTO_INIT   1 * THZ /* Initial retransmit timer */
 
#define TCP_RTO_BOFF_MAX   8 /* Max number of retries before reset */
 
#define TCP_ESTABLISH_TIME   (60 * THZ) /* Connection establish timeout */
 
#define foreach_tcp_cfg_flag
 Connection configuration flags. More...
 
#define foreach_tcp_connection_flag
 TCP connection flags. More...
 
#define TCP_SCOREBOARD_TRACE   (0)
 
#define TCP_MAX_SACK_BLOCKS   256
 Max number of SACK blocks stored. More...
 
#define TCP_INVALID_SACK_HOLE_INDEX   ((u32)~0)
 
#define tcp_scoreboard_trace_add(_tc, _ack)
 
#define TCP_BTS_INVALID_INDEX   ((u32)~0)
 
#define tcp_fastrecovery_on(tc)   (tc)->flags |= TCP_CONN_FAST_RECOVERY
 
#define tcp_fastrecovery_off(tc)   (tc)->flags &= ~TCP_CONN_FAST_RECOVERY
 
#define tcp_recovery_on(tc)   (tc)->flags |= TCP_CONN_RECOVERY
 
#define tcp_recovery_off(tc)   (tc)->flags &= ~TCP_CONN_RECOVERY
 
#define tcp_in_fastrecovery(tc)   ((tc)->flags & TCP_CONN_FAST_RECOVERY)
 
#define tcp_in_recovery(tc)   ((tc)->flags & (TCP_CONN_RECOVERY))
 
#define tcp_in_slowstart(tc)   (tc->cwnd < tc->ssthresh)
 
#define tcp_disconnect_pending(tc)   ((tc)->flags & TCP_CONN_DCNT_PENDING)
 
#define tcp_disconnect_pending_on(tc)   ((tc)->flags |= TCP_CONN_DCNT_PENDING)
 
#define tcp_disconnect_pending_off(tc)   ((tc)->flags &= ~TCP_CONN_DCNT_PENDING)
 
#define tcp_fastrecovery_first(tc)   ((tc)->flags & TCP_CONN_FRXT_FIRST)
 
#define tcp_fastrecovery_first_on(tc)   ((tc)->flags |= TCP_CONN_FRXT_FIRST)
 
#define tcp_fastrecovery_first_off(tc)   ((tc)->flags &= ~TCP_CONN_FRXT_FIRST)
 
#define tcp_in_cong_recovery(tc)
 
#define tcp_csum_offload(tc)   (!((tc)->cfg_flags & TCP_CFG_F_NO_CSUM_OFFLOAD))
 
#define tcp_zero_rwnd_sent(tc)   ((tc)->flags & TCP_CONN_ZERO_RWND_SENT)
 
#define tcp_zero_rwnd_sent_on(tc)   (tc)->flags |= TCP_CONN_ZERO_RWND_SENT
 
#define tcp_zero_rwnd_sent_off(tc)   (tc)->flags &= ~TCP_CONN_ZERO_RWND_SENT
 
#define tcp_error(n, s)   TCP_ERROR_##n,
 
#define tcp_cfg   tcp_main.cfg
 
#define tcp_node_index(node_id, is_ip4)   ((is_ip4) ? tcp4_##node_id##_node.index : tcp6_##node_id##_node.index)
 
#define tcp_trajectory_add_start(b, start)
 
#define seq_lt(_s1, _s2)   ((i32)((_s1)-(_s2)) < 0)
 
#define seq_leq(_s1, _s2)   ((i32)((_s1)-(_s2)) <= 0)
 
#define seq_gt(_s1, _s2)   ((i32)((_s1)-(_s2)) > 0)
 
#define seq_geq(_s1, _s2)   ((i32)((_s1)-(_s2)) >= 0)
 
#define seq_max(_s1, _s2)   (seq_gt((_s1), (_s2)) ? (_s1) : (_s2))
 
#define timestamp_lt(_t1, _t2)   ((i32)((_t1)-(_t2)) < 0)
 
#define timestamp_leq(_t1, _t2)   ((i32)((_t1)-(_t2)) <= 0)
 
#define tcp_validate_txf_size(_tc, _a)
 

Typedefs

typedef enum _tcp_state tcp_state_t
 
typedef enum _tcp_timers tcp_timers_e
 
typedef void() timer_expiration_handler(u32 index, u32 thread_index)
 
typedef enum tcp_cfg_flag_bits_ tcp_cfg_flag_bits_e
 
typedef enum tcp_cfg_flag_ tcp_cfg_flags_e
 
typedef enum tcp_connection_flag_bits_ tcp_connection_flag_bits_e
 
typedef enum tcp_connection_flag_ tcp_connection_flags_e
 
typedef struct _scoreboard_trace_elt scoreboard_trace_elt_t
 
typedef struct _sack_scoreboard_hole sack_scoreboard_hole_t
 
typedef struct _sack_scoreboard sack_scoreboard_t
 
typedef enum tcp_bts_flags_ tcp_bts_flags_t
 
typedef struct tcp_bt_sample_ tcp_bt_sample_t
 
typedef struct tcp_rate_sample_ tcp_rate_sample_t
 
typedef struct tcp_byte_tracker_ tcp_byte_tracker_t
 
typedef enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e
 
typedef struct _tcp_cc_algorithm tcp_cc_algorithm_t
 
typedef enum _tcp_cc_ack_t tcp_cc_ack_t
 
typedef enum tcp_cc_event_ tcp_cc_event_t
 
typedef struct tcp_errors_ tcp_errors_t
 
typedef struct _tcp_connection tcp_connection_t
 
typedef enum _tcp_error tcp_error_t
 
typedef struct _tcp_lookup_dispatch tcp_lookup_dispatch_t
 
typedef struct tcp_worker_ctx_ tcp_worker_ctx_t
 
typedef struct tcp_iss_seed_ tcp_iss_seed_t
 
typedef struct tcp_configuration_ tcp_configuration_t
 
typedef struct _tcp_main tcp_main_t
 

Enumerations

enum  tcp_cfg_flag_bits_ { TCP_CFG_N_FLAG_BITS }
 
enum  tcp_cfg_flag_ { TCP_CFG_N_FLAGS }
 
enum  tcp_connection_flag_bits_ { TCP_CONN_N_FLAG_BITS }
 
enum  tcp_connection_flag_ { TCP_CONN_N_FLAGS }
 
enum  tcp_bts_flags_ { TCP_BTS_IS_RXT = 1, TCP_BTS_IS_APP_LIMITED = 1 << 1, TCP_BTS_IS_SACKED = 1 << 2, TCP_BTS_IS_RXT_LOST = 1 << 3 }
 
enum  tcp_cc_event_ { TCP_CC_EVT_START_TX }
 

Functions

sack_scoreboard_hole_tscoreboard_next_rxt_hole (sack_scoreboard_t *sb, sack_scoreboard_hole_t *start, u8 have_sent_1_smss, u8 *can_rescue, u8 *snd_limited)
 Figure out the next hole to retransmit. More...
 
sack_scoreboard_hole_tscoreboard_get_hole (sack_scoreboard_t *sb, u32 index)
 
sack_scoreboard_hole_tscoreboard_next_hole (sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
 
sack_scoreboard_hole_tscoreboard_prev_hole (sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
 
sack_scoreboard_hole_tscoreboard_first_hole (sack_scoreboard_t *sb)
 
sack_scoreboard_hole_tscoreboard_last_hole (sack_scoreboard_t *sb)
 
void scoreboard_clear (sack_scoreboard_t *sb)
 
void scoreboard_clear_reneging (sack_scoreboard_t *sb, u32 start, u32 end)
 
void scoreboard_init (sack_scoreboard_t *sb)
 
void scoreboard_init_rxt (sack_scoreboard_t *sb, u32 snd_una)
 
u8format_tcp_scoreboard (u8 *s, va_list *args)
 
static void tcp_cong_recovery_off (tcp_connection_t *tc)
 
static tcp_main_tvnet_get_tcp_main ()
 
static tcp_worker_ctx_ttcp_get_worker (u32 thread_index)
 
static tcp_header_ttcp_buffer_hdr (vlib_buffer_t *b)
 
clib_error_tvnet_tcp_enable_disable (vlib_main_t *vm, u8 is_en)
 
void tcp_punt_unknown (vlib_main_t *vm, u8 is_ip4, u8 is_add)
 
static tcp_connection_ttcp_connection_get (u32 conn_index, u32 thread_index)
 
static tcp_connection_ttcp_connection_get_if_valid (u32 conn_index, u32 thread_index)
 
static tcp_connection_ttcp_get_connection_from_transport (transport_connection_t *tconn)
 
static void tcp_connection_set_state (tcp_connection_t *tc, tcp_state_t state)
 
void tcp_connection_close (tcp_connection_t *tc)
 Begin connection closing procedure. More...
 
void tcp_connection_cleanup (tcp_connection_t *tc)
 Cleans up connection state. More...
 
void tcp_connection_del (tcp_connection_t *tc)
 Connection removal. More...
 
int tcp_half_open_connection_cleanup (tcp_connection_t *tc)
 Try to cleanup half-open connection. More...
 
tcp_connection_ttcp_connection_alloc (u8 thread_index)
 
tcp_connection_ttcp_connection_alloc_w_base (u8 thread_index, tcp_connection_t *base)
 
void tcp_connection_free (tcp_connection_t *tc)
 
void tcp_connection_reset (tcp_connection_t *tc)
 Notify session that connection has been reset. More...
 
int tcp_configure_v4_source_address_range (vlib_main_t *vm, ip4_address_t *start, ip4_address_t *end, u32 table_id)
 Configure an ipv4 source address range. More...
 
int tcp_configure_v6_source_address_range (vlib_main_t *vm, ip6_address_t *start, ip6_address_t *end, u32 table_id)
 Configure an ipv6 source address range. More...
 
void tcp_api_reference (void)
 
u8format_tcp_connection (u8 *s, va_list *args)
 
u8format_tcp_connection_id (u8 *s, va_list *args)
 
static tcp_connection_ttcp_listener_get (u32 tli)
 
static tcp_connection_ttcp_half_open_connection_get (u32 conn_index)
 
void tcp_make_fin (tcp_connection_t *tc, vlib_buffer_t *b)
 Convert buffer to FIN-ACK. More...
 
void tcp_make_synack (tcp_connection_t *ts, vlib_buffer_t *b)
 Convert buffer to SYN-ACK. More...
 
void tcp_send_reset_w_pkt (tcp_connection_t *tc, vlib_buffer_t *pkt, u32 thread_index, u8 is_ip4)
 Send reset without reusing existing buffer. More...
 
void tcp_send_reset (tcp_connection_t *tc)
 Build and set reset packet for connection. More...
 
void tcp_send_syn (tcp_connection_t *tc)
 Send SYN. More...
 
void tcp_send_synack (tcp_connection_t *tc)
 
void tcp_send_fin (tcp_connection_t *tc)
 Send FIN. More...
 
void tcp_send_ack (tcp_connection_t *tc)
 
void tcp_update_burst_snd_vars (tcp_connection_t *tc)
 Update burst send vars. More...
 
void tcp_update_rto (tcp_connection_t *tc)
 
void tcp_flush_frames_to_output (tcp_worker_ctx_t *wrk)
 Flush v4 and v6 tcp and ip-lookup tx frames for thread index. More...
 
void tcp_send_window_update_ack (tcp_connection_t *tc)
 Send window update ack. More...
 
void tcp_program_ack (tcp_connection_t *tc)
 
void tcp_program_dupack (tcp_connection_t *tc)
 
void tcp_program_retransmit (tcp_connection_t *tc)
 
void tcp_bt_init (tcp_connection_t *tc)
 Byte tracker initialize. More...
 
void tcp_bt_cleanup (tcp_connection_t *tc)
 Byte tracker cleanup. More...
 
void tcp_bt_flush_samples (tcp_connection_t *tc)
 Flush byte tracker samples. More...
 
void tcp_bt_track_tx (tcp_connection_t *tc, u32 len)
 Track a tcp tx burst. More...
 
void tcp_bt_track_rxt (tcp_connection_t *tc, u32 start, u32 end)
 Track a tcp retransmission. More...
 
void tcp_bt_sample_delivery_rate (tcp_connection_t *tc, tcp_rate_sample_t *rs)
 Generate a delivery rate sample from recently acked bytes. More...
 
void tcp_bt_check_app_limited (tcp_connection_t *tc)
 Check if sample to be generated is app limited. More...
 
int tcp_bt_is_sane (tcp_byte_tracker_t *bt)
 Check if the byte tracker is in sane state. More...
 
u8format_tcp_bt (u8 *s, va_list *args)
 
static u32 tcp_end_seq (tcp_header_t *th, u32 len)
 
static u32 tcp_bytes_out (const tcp_connection_t *tc)
 Our estimate of the number of bytes that have left the network. More...
 
static u32 tcp_flight_size (const tcp_connection_t *tc)
 Our estimate of the number of bytes in flight (pipe size) More...
 
static u32 tcp_initial_cwnd (const tcp_connection_t *tc)
 Initial cwnd as per RFC5681. More...
 
static void tcp_cwnd_accumulate (tcp_connection_t *tc, u32 thresh, u32 bytes)
 
static u32 tcp_loss_wnd (const tcp_connection_t *tc)
 
static u32 tcp_available_snd_wnd (const tcp_connection_t *tc)
 
static u32 tcp_available_output_snd_space (const tcp_connection_t *tc)
 
static u32 tcp_available_cc_snd_space (const tcp_connection_t *tc)
 Estimate of how many bytes we can still push into the network. More...
 
static u8 tcp_is_lost_fin (tcp_connection_t *tc)
 
u32 tcp_snd_space (tcp_connection_t *tc)
 
int tcp_fastrecovery_prr_snd_space (tcp_connection_t *tc)
 Estimate send space using proportional rate reduction (RFC6937) More...
 
fib_node_index_t tcp_lookup_rmt_in_fib (tcp_connection_t *tc)
 
void tcp_update_sack_list (tcp_connection_t *tc, u32 start, u32 end)
 Build SACK list as per RFC2018. More...
 
u32 tcp_sack_list_bytes (tcp_connection_t *tc)
 
static u32 tcp_time_now (void)
 
static u32 tcp_time_now_w_thread (u32 thread_index)
 
static u32 tcp_tstamp (tcp_connection_t *tc)
 Generate timestamp for tcp connection. More...
 
static f64 tcp_time_now_us (u32 thread_index)
 
static u32 tcp_set_time_now (tcp_worker_ctx_t *wrk)
 
u32 tcp_session_push_header (transport_connection_t *tconn, vlib_buffer_t *b)
 
int tcp_session_custom_tx (void *conn, u32 max_burst_size)
 
void tcp_connection_timers_init (tcp_connection_t *tc)
 Initialize all connection timers as invalid. More...
 
void tcp_connection_timers_reset (tcp_connection_t *tc)
 Stop all connection timers. More...
 
void tcp_init_snd_vars (tcp_connection_t *tc)
 Initialize connection send variables. More...
 
void tcp_connection_init_vars (tcp_connection_t *tc)
 Initialize tcp connection variables. More...
 
void tcp_connection_tx_pacer_update (tcp_connection_t *tc)
 
void tcp_connection_tx_pacer_reset (tcp_connection_t *tc, u32 window, u32 start_bucket)
 
static void tcp_cc_rcv_ack (tcp_connection_t *tc, tcp_rate_sample_t *rs)
 
static void tcp_cc_rcv_cong_ack (tcp_connection_t *tc, tcp_cc_ack_t ack_type, tcp_rate_sample_t *rs)
 
static void tcp_cc_congestion (tcp_connection_t *tc)
 
static void tcp_cc_loss (tcp_connection_t *tc)
 
static void tcp_cc_recovered (tcp_connection_t *tc)
 
static void tcp_cc_undo_recovery (tcp_connection_t *tc)
 
static void tcp_cc_event (tcp_connection_t *tc, tcp_cc_event_t evt)
 
static u64 tcp_cc_get_pacing_rate (tcp_connection_t *tc)
 
static void tcp_timer_set (tcp_connection_t *tc, u8 timer_id, u32 interval)
 
static void tcp_timer_reset (tcp_connection_t *tc, u8 timer_id)
 
static void tcp_timer_update (tcp_connection_t *tc, u8 timer_id, u32 interval)
 
static void tcp_retransmit_timer_set (tcp_connection_t *tc)
 
static void tcp_retransmit_timer_reset (tcp_connection_t *tc)
 
static void tcp_retransmit_timer_force_update (tcp_connection_t *tc)
 
static void tcp_persist_timer_set (tcp_connection_t *tc)
 
static void tcp_persist_timer_update (tcp_connection_t *tc)
 
static void tcp_persist_timer_reset (tcp_connection_t *tc)
 
static void tcp_retransmit_timer_update (tcp_connection_t *tc)
 
static u8 tcp_timer_is_active (tcp_connection_t *tc, tcp_timers_e timer)
 
void tcp_rcv_sacks (tcp_connection_t *tc, u32 ack)
 
u8tcp_scoreboard_replay (u8 *s, tcp_connection_t *tc, u8 verbose)
 
void tcp_cc_algo_register (tcp_cc_algorithm_type_e type, const tcp_cc_algorithm_t *vft)
 Register exiting cc algo type. More...
 
tcp_cc_algorithm_type_e tcp_cc_algo_new_type (const tcp_cc_algorithm_t *vft)
 Register new cc algo type. More...
 
tcp_cc_algorithm_ttcp_cc_algo_get (tcp_cc_algorithm_type_e type)
 
static void * tcp_cc_data (tcp_connection_t *tc)
 
void newreno_rcv_cong_ack (tcp_connection_t *tc, tcp_cc_ack_t ack_type, tcp_rate_sample_t *rs)
 
static void * vlib_buffer_push_tcp_net_order (vlib_buffer_t *b, u16 sp, u16 dp, u32 seq, u32 ack, u8 tcp_hdr_opts_len, u8 flags, u16 wnd)
 Push TCP header to buffer. More...
 
static void * vlib_buffer_push_tcp (vlib_buffer_t *b, u16 sp_net, u16 dp_net, u32 seq, u32 ack, u8 tcp_hdr_opts_len, u8 flags, u16 wnd)
 Push TCP header to buffer. More...
 

Variables

format_function_t format_tcp_state
 
format_function_t format_tcp_flags
 
format_function_t format_tcp_sacks
 
format_function_t format_tcp_rcv_sacks
 
timer_expiration_handler tcp_timer_delack_handler
 
timer_expiration_handler tcp_timer_retransmit_handler
 
timer_expiration_handler tcp_timer_persist_handler
 
timer_expiration_handler tcp_timer_retransmit_syn_handler
 
tcp_main_t tcp_main
 
vlib_node_registration_t tcp4_input_node
 (constructor) VLIB_REGISTER_NODE (tcp4_input_node) More...
 
vlib_node_registration_t tcp6_input_node
 (constructor) VLIB_REGISTER_NODE (tcp6_input_node) More...
 
vlib_node_registration_t tcp4_output_node
 (constructor) VLIB_REGISTER_NODE (tcp4_output_node) More...
 
vlib_node_registration_t tcp6_output_node
 (constructor) VLIB_REGISTER_NODE (tcp6_output_node) More...
 
vlib_node_registration_t tcp4_established_node
 (constructor) VLIB_REGISTER_NODE (tcp4_established_node) More...
 
vlib_node_registration_t tcp6_established_node
 (constructor) VLIB_REGISTER_NODE (tcp6_established_node) More...
 
vlib_node_registration_t tcp4_syn_sent_node
 (constructor) VLIB_REGISTER_NODE (tcp4_syn_sent_node) More...
 
vlib_node_registration_t tcp6_syn_sent_node
 (constructor) VLIB_REGISTER_NODE (tcp6_syn_sent_node) More...
 
vlib_node_registration_t tcp4_rcv_process_node
 (constructor) VLIB_REGISTER_NODE (tcp4_rcv_process_node) More...
 
vlib_node_registration_t tcp6_rcv_process_node
 (constructor) VLIB_REGISTER_NODE (tcp6_rcv_process_node) More...
 
vlib_node_registration_t tcp4_listen_node
 (constructor) VLIB_REGISTER_NODE (tcp4_listen_node) More...
 
vlib_node_registration_t tcp6_listen_node
 (constructor) VLIB_REGISTER_NODE (tcp6_listen_node) More...
 

Macro Definition Documentation

◆ foreach_tcp_cfg_flag

#define foreach_tcp_cfg_flag
Value:
_(RATE_SAMPLE, "Rate sampling") \
_(NO_CSUM_OFFLOAD, "No csum offload") \
_(NO_TSO, "TSO off") \
_(TSO, "TSO") \

Connection configuration flags.

Definition at line 108 of file tcp.h.

◆ foreach_tcp_connection_flag

#define foreach_tcp_connection_flag
Value:
_(SNDACK, "Send ACK") \
_(FINSNT, "FIN sent") \
_(RECOVERY, "Recovery") \
_(FAST_RECOVERY, "Fast Recovery") \
_(DCNT_PENDING, "Disconnect pending") \
_(HALF_OPEN_DONE, "Half-open completed") \
_(FINPNDG, "FIN pending") \
_(RXT_PENDING, "Retransmit pending") \
_(FRXT_FIRST, "Retransmit first") \
_(DEQ_PENDING, "Dequeue pending ") \
_(PSH_PENDING, "PSH pending") \
_(FINRCVD, "FIN received") \
_(ZERO_RWND_SENT, "Zero RWND sent") \

TCP connection flags.

Definition at line 131 of file tcp.h.

◆ foreach_tcp_fsm_state

#define foreach_tcp_fsm_state
Value:
_(CLOSED, "CLOSED") \
_(LISTEN, "LISTEN") \
_(SYN_SENT, "SYN_SENT") \
_(SYN_RCVD, "SYN_RCVD") \
_(ESTABLISHED, "ESTABLISHED") \
_(CLOSE_WAIT, "CLOSE_WAIT") \
_(FIN_WAIT_1, "FIN_WAIT_1") \
_(LAST_ACK, "LAST_ACK") \
_(CLOSING, "CLOSING") \
_(FIN_WAIT_2, "FIN_WAIT_2") \
_(TIME_WAIT, "TIME_WAIT")

TCP FSM state definitions as per RFC793.

Definition at line 43 of file tcp.h.

◆ foreach_tcp_timer

#define foreach_tcp_timer
Value:
_(RETRANSMIT, "RETRANSMIT") \
_(DELACK, "DELAYED ACK") \
_(PERSIST, "PERSIST") \
_(WAITCLOSE, "WAIT CLOSE") \
_(RETRANSMIT_SYN, "RETRANSMIT SYN") \

TCP timers.

Definition at line 70 of file tcp.h.

◆ seq_geq

#define seq_geq (   _s1,
  _s2 
)    ((i32)((_s1)-(_s2)) >= 0)

Definition at line 876 of file tcp.h.

◆ seq_gt

#define seq_gt (   _s1,
  _s2 
)    ((i32)((_s1)-(_s2)) > 0)

Definition at line 875 of file tcp.h.

◆ seq_leq

#define seq_leq (   _s1,
  _s2 
)    ((i32)((_s1)-(_s2)) <= 0)

Definition at line 874 of file tcp.h.

◆ seq_lt

#define seq_lt (   _s1,
  _s2 
)    ((i32)((_s1)-(_s2)) < 0)

Definition at line 873 of file tcp.h.

◆ seq_max

#define seq_max (   _s1,
  _s2 
)    (seq_gt((_s1), (_s2)) ? (_s1) : (_s2))

Definition at line 877 of file tcp.h.

◆ TCP_ALWAYS_ACK

#define TCP_ALWAYS_ACK   1

On/off delayed acks.

Definition at line 39 of file tcp.h.

◆ TCP_BTS_INVALID_INDEX

#define TCP_BTS_INVALID_INDEX   ((u32)~0)

Definition at line 253 of file tcp.h.

◆ TCP_CC_DATA_SZ

#define TCP_CC_DATA_SZ   24

Definition at line 33 of file tcp.h.

◆ tcp_cfg

#define tcp_cfg   tcp_main.cfg

Definition at line 679 of file tcp.h.

◆ tcp_csum_offload

#define tcp_csum_offload (   tc)    (!((tc)->cfg_flags & TCP_CFG_F_NO_CSUM_OFFLOAD))

Definition at line 477 of file tcp.h.

◆ tcp_disconnect_pending

#define tcp_disconnect_pending (   tc)    ((tc)->flags & TCP_CONN_DCNT_PENDING)

Definition at line 467 of file tcp.h.

◆ tcp_disconnect_pending_off

#define tcp_disconnect_pending_off (   tc)    ((tc)->flags &= ~TCP_CONN_DCNT_PENDING)

Definition at line 469 of file tcp.h.

◆ tcp_disconnect_pending_on

#define tcp_disconnect_pending_on (   tc)    ((tc)->flags |= TCP_CONN_DCNT_PENDING)

Definition at line 468 of file tcp.h.

◆ TCP_DUPACK_THRESHOLD

#define TCP_DUPACK_THRESHOLD   3

Definition at line 37 of file tcp.h.

◆ tcp_error

#define tcp_error (   n,
 
)    TCP_ERROR_##n,

Definition at line 492 of file tcp.h.

◆ TCP_ESTABLISH_TIME

#define TCP_ESTABLISH_TIME   (60 * THZ) /* Connection establish timeout */

Definition at line 105 of file tcp.h.

◆ tcp_fastrecovery_first

#define tcp_fastrecovery_first (   tc)    ((tc)->flags & TCP_CONN_FRXT_FIRST)

Definition at line 470 of file tcp.h.

◆ tcp_fastrecovery_first_off

#define tcp_fastrecovery_first_off (   tc)    ((tc)->flags &= ~TCP_CONN_FRXT_FIRST)

Definition at line 472 of file tcp.h.

◆ tcp_fastrecovery_first_on

#define tcp_fastrecovery_first_on (   tc)    ((tc)->flags |= TCP_CONN_FRXT_FIRST)

Definition at line 471 of file tcp.h.

◆ tcp_fastrecovery_off

#define tcp_fastrecovery_off (   tc)    (tc)->flags &= ~TCP_CONN_FAST_RECOVERY

Definition at line 461 of file tcp.h.

◆ tcp_fastrecovery_on

#define tcp_fastrecovery_on (   tc)    (tc)->flags |= TCP_CONN_FAST_RECOVERY

Definition at line 460 of file tcp.h.

◆ TCP_FIB_RECHECK_PERIOD

#define TCP_FIB_RECHECK_PERIOD   1 * THZ

Recheck every 1s.

Definition at line 31 of file tcp.h.

◆ tcp_in_cong_recovery

#define tcp_in_cong_recovery (   tc)
Value:
((tc)->flags & \
(TCP_CONN_FAST_RECOVERY | TCP_CONN_RECOVERY))
u32 flags
Definition: vhost_user.h:141

Definition at line 474 of file tcp.h.

◆ tcp_in_fastrecovery

#define tcp_in_fastrecovery (   tc)    ((tc)->flags & TCP_CONN_FAST_RECOVERY)

Definition at line 464 of file tcp.h.

◆ tcp_in_recovery

#define tcp_in_recovery (   tc)    ((tc)->flags & (TCP_CONN_RECOVERY))

Definition at line 465 of file tcp.h.

◆ tcp_in_slowstart

#define tcp_in_slowstart (   tc)    (tc->cwnd < tc->ssthresh)

Definition at line 466 of file tcp.h.

◆ TCP_INVALID_SACK_HOLE_INDEX

#define TCP_INVALID_SACK_HOLE_INDEX   ((u32)~0)

Definition at line 164 of file tcp.h.

◆ TCP_IW_N_SEGMENTS

#define TCP_IW_N_SEGMENTS   10

Definition at line 38 of file tcp.h.

◆ TCP_MAX_GSO_SZ

#define TCP_MAX_GSO_SZ   65536

Definition at line 34 of file tcp.h.

◆ TCP_MAX_OPTION_SPACE

#define TCP_MAX_OPTION_SPACE   40

Definition at line 32 of file tcp.h.

◆ TCP_MAX_SACK_BLOCKS

#define TCP_MAX_SACK_BLOCKS   256

Max number of SACK blocks stored.

Definition at line 163 of file tcp.h.

◆ tcp_node_index

#define tcp_node_index (   node_id,
  is_ip4 
)    ((is_ip4) ? tcp4_##node_id##_node.index : tcp6_##node_id##_node.index)

Definition at line 680 of file tcp.h.

◆ TCP_PAWS_IDLE

#define TCP_PAWS_IDLE   24 * 24 * 60 * 60 * THZ

24 days

Definition at line 30 of file tcp.h.

◆ tcp_recovery_off

#define tcp_recovery_off (   tc)    (tc)->flags &= ~TCP_CONN_RECOVERY

Definition at line 463 of file tcp.h.

◆ tcp_recovery_on

#define tcp_recovery_on (   tc)    (tc)->flags |= TCP_CONN_RECOVERY

Definition at line 462 of file tcp.h.

◆ TCP_RTO_BOFF_MAX

#define TCP_RTO_BOFF_MAX   8 /* Max number of retries before reset */

Definition at line 104 of file tcp.h.

◆ TCP_RTO_INIT

#define TCP_RTO_INIT   1 * THZ /* Initial retransmit timer */

Definition at line 103 of file tcp.h.

◆ TCP_RTO_MAX

#define TCP_RTO_MAX   60 * THZ /* Min max RTO (60s) as per RFC6298 */

Definition at line 99 of file tcp.h.

◆ TCP_RTO_MIN

#define TCP_RTO_MIN   0.2 * THZ /* Min RTO (200ms) - lower than standard */

Definition at line 100 of file tcp.h.

◆ TCP_RTO_SYN_RETRIES

#define TCP_RTO_SYN_RETRIES   3 /* SYN retries without doubling RTO */

Definition at line 102 of file tcp.h.

◆ TCP_RTT_MAX

#define TCP_RTT_MAX   30 * THZ /* 30s (probably too much) */

Definition at line 101 of file tcp.h.

◆ TCP_RXT_MAX_BURST

#define TCP_RXT_MAX_BURST   10

Definition at line 35 of file tcp.h.

◆ TCP_SCOREBOARD_TRACE

#define TCP_SCOREBOARD_TRACE   (0)

Definition at line 162 of file tcp.h.

◆ tcp_scoreboard_trace_add

#define tcp_scoreboard_trace_add (   _tc,
  _ack 
)

Definition at line 229 of file tcp.h.

◆ TCP_TICK

#define TCP_TICK   0.001

TCP tick period (s)

Definition at line 27 of file tcp.h.

◆ TCP_TIMER_HANDLE_INVALID

#define TCP_TIMER_HANDLE_INVALID   ((u32) ~0)

Definition at line 92 of file tcp.h.

◆ TCP_TIMER_TICK

#define TCP_TIMER_TICK   0.1

Timer tick in seconds.

Definition at line 94 of file tcp.h.

◆ TCP_TO_TIMER_TICK

#define TCP_TO_TIMER_TICK   TCP_TICK*10

Factor for converting ticks to timer ticks.

Definition at line 95 of file tcp.h.

◆ tcp_trajectory_add_start

#define tcp_trajectory_add_start (   b,
  start 
)

Definition at line 709 of file tcp.h.

◆ TCP_TSTAMP_RESOLUTION

#define TCP_TSTAMP_RESOLUTION   TCP_TICK

Time stamp resolution.

Definition at line 29 of file tcp.h.

◆ TCP_USE_SACKS

#define TCP_USE_SACKS   1

Disable only for testing.

Definition at line 40 of file tcp.h.

◆ tcp_validate_txf_size

#define tcp_validate_txf_size (   _tc,
  _a 
)
Value:
ASSERT(_tc->state != TCP_STATE_ESTABLISHED \
|| transport_max_tx_dequeue (&_tc->connection) >= _a)
static u32 transport_max_tx_dequeue(transport_connection_t *tc)
Definition: session.h:478
#define ASSERT(truth)

Definition at line 1218 of file tcp.h.

◆ tcp_zero_rwnd_sent

#define tcp_zero_rwnd_sent (   tc)    ((tc)->flags & TCP_CONN_ZERO_RWND_SENT)

Definition at line 486 of file tcp.h.

◆ tcp_zero_rwnd_sent_off

#define tcp_zero_rwnd_sent_off (   tc)    (tc)->flags &= ~TCP_CONN_ZERO_RWND_SENT

Definition at line 488 of file tcp.h.

◆ tcp_zero_rwnd_sent_on

#define tcp_zero_rwnd_sent_on (   tc)    (tc)->flags |= TCP_CONN_ZERO_RWND_SENT

Definition at line 487 of file tcp.h.

◆ THZ

#define THZ   (u32) (1/TCP_TICK)

TCP tick frequency.

Definition at line 28 of file tcp.h.

◆ timestamp_leq

#define timestamp_leq (   _t1,
  _t2 
)    ((i32)((_t1)-(_t2)) <= 0)

Definition at line 881 of file tcp.h.

◆ timestamp_lt

#define timestamp_lt (   _t1,
  _t2 
)    ((i32)((_t1)-(_t2)) < 0)

Definition at line 880 of file tcp.h.

Typedef Documentation

◆ sack_scoreboard_hole_t

typedef struct _sack_scoreboard_hole sack_scoreboard_hole_t

◆ sack_scoreboard_t

typedef struct _sack_scoreboard sack_scoreboard_t

◆ scoreboard_trace_elt_t

typedef struct _scoreboard_trace_elt scoreboard_trace_elt_t

◆ tcp_bt_sample_t

◆ tcp_bts_flags_t

◆ tcp_byte_tracker_t

◆ tcp_cc_ack_t

typedef enum _tcp_cc_ack_t tcp_cc_ack_t

◆ tcp_cc_algorithm_t

typedef struct _tcp_cc_algorithm tcp_cc_algorithm_t

Definition at line 305 of file tcp.h.

◆ tcp_cc_algorithm_type_e

typedef enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e

◆ tcp_cc_event_t

◆ tcp_cfg_flag_bits_e

◆ tcp_cfg_flags_e

◆ tcp_configuration_t

◆ tcp_connection_flag_bits_e

◆ tcp_connection_flags_e

◆ tcp_connection_t

typedef struct _tcp_connection tcp_connection_t

◆ tcp_error_t

typedef enum _tcp_error tcp_error_t

◆ tcp_errors_t

typedef struct tcp_errors_ tcp_errors_t

◆ tcp_iss_seed_t

typedef struct tcp_iss_seed_ tcp_iss_seed_t

◆ tcp_lookup_dispatch_t

typedef struct _tcp_lookup_dispatch tcp_lookup_dispatch_t

◆ tcp_main_t

typedef struct _tcp_main tcp_main_t

◆ tcp_rate_sample_t

◆ tcp_state_t

typedef enum _tcp_state tcp_state_t

◆ tcp_timers_e

typedef enum _tcp_timers tcp_timers_e

◆ tcp_worker_ctx_t

◆ timer_expiration_handler

typedef void() timer_expiration_handler(u32 index, u32 thread_index)

Definition at line 85 of file tcp.h.

Enumeration Type Documentation

◆ tcp_bts_flags_

Enumerator
TCP_BTS_IS_RXT 
TCP_BTS_IS_APP_LIMITED 
TCP_BTS_IS_SACKED 
TCP_BTS_IS_RXT_LOST 

Definition at line 255 of file tcp.h.

◆ tcp_cc_event_

Enumerator
TCP_CC_EVT_START_TX 

Definition at line 314 of file tcp.h.

◆ tcp_cfg_flag_

Enumerator
TCP_CFG_N_FLAGS 

Definition at line 122 of file tcp.h.

◆ tcp_cfg_flag_bits_

Enumerator
TCP_CFG_N_FLAG_BITS 

Definition at line 114 of file tcp.h.

◆ tcp_connection_flag_

Enumerator
TCP_CONN_N_FLAGS 

Definition at line 154 of file tcp.h.

◆ tcp_connection_flag_bits_

Enumerator
TCP_CONN_N_FLAG_BITS 

Definition at line 146 of file tcp.h.

Function Documentation

◆ format_tcp_bt()

u8* format_tcp_bt ( u8 s,
va_list *  args 
)

Definition at line 676 of file tcp_bt.c.

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

◆ format_tcp_connection()

u8* format_tcp_connection ( u8 s,
va_list *  args 
)

Definition at line 1064 of file tcp.c.

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

◆ format_tcp_connection_id()

u8* format_tcp_connection_id ( u8 s,
va_list *  args 
)

Definition at line 1040 of file tcp.c.

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

◆ format_tcp_scoreboard()

u8* format_tcp_scoreboard ( u8 s,
va_list *  args 
)

Definition at line 1181 of file tcp.c.

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

◆ newreno_rcv_cong_ack()

void newreno_rcv_cong_ack ( tcp_connection_t tc,
tcp_cc_ack_t  ack_type,
tcp_rate_sample_t rs 
)

Definition at line 61 of file tcp_newreno.c.

+ Here is the caller graph for this function:

◆ scoreboard_clear()

void scoreboard_clear ( sack_scoreboard_t sb)

Definition at line 927 of file tcp_input.c.

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

◆ scoreboard_clear_reneging()

void scoreboard_clear_reneging ( sack_scoreboard_t sb,
u32  start,
u32  end 
)

Definition at line 946 of file tcp_input.c.

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

◆ scoreboard_first_hole()

sack_scoreboard_hole_t* scoreboard_first_hole ( sack_scoreboard_t sb)

Definition at line 673 of file tcp_input.c.

+ Here is the caller graph for this function:

◆ scoreboard_get_hole()

sack_scoreboard_hole_t* scoreboard_get_hole ( sack_scoreboard_t sb,
u32  index 
)

Definition at line 649 of file tcp_input.c.

+ Here is the caller graph for this function:

◆ scoreboard_init()

void scoreboard_init ( sack_scoreboard_t sb)

Definition at line 919 of file tcp_input.c.

+ Here is the caller graph for this function:

◆ scoreboard_init_rxt()

void scoreboard_init_rxt ( sack_scoreboard_t sb,
u32  snd_una 
)

Definition at line 905 of file tcp_input.c.

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

◆ scoreboard_last_hole()

sack_scoreboard_hole_t* scoreboard_last_hole ( sack_scoreboard_t sb)

Definition at line 681 of file tcp_input.c.

+ Here is the caller graph for this function:

◆ scoreboard_next_hole()

sack_scoreboard_hole_t* scoreboard_next_hole ( sack_scoreboard_t sb,
sack_scoreboard_hole_t hole 
)

Definition at line 657 of file tcp_input.c.

+ Here is the caller graph for this function:

◆ scoreboard_next_rxt_hole()

sack_scoreboard_hole_t* scoreboard_next_rxt_hole ( sack_scoreboard_t sb,
sack_scoreboard_hole_t start,
u8  have_unsent,
u8 can_rescue,
u8 snd_limited 
)

Figure out the next hole to retransmit.

Follows logic proposed in RFC6675 Sec. 4, NextSeg()

Definition at line 845 of file tcp_input.c.

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

◆ scoreboard_prev_hole()

sack_scoreboard_hole_t* scoreboard_prev_hole ( sack_scoreboard_t sb,
sack_scoreboard_hole_t hole 
)

Definition at line 665 of file tcp_input.c.

+ Here is the caller graph for this function:

◆ tcp_api_reference()

void tcp_api_reference ( void  )

Definition at line 119 of file tcp_api.c.

+ Here is the caller graph for this function:

◆ tcp_available_cc_snd_space()

static u32 tcp_available_cc_snd_space ( const tcp_connection_t tc)
inlinestatic

Estimate of how many bytes we can still push into the network.

Definition at line 977 of file tcp.h.

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

◆ tcp_available_output_snd_space()

static u32 tcp_available_output_snd_space ( const tcp_connection_t tc)
inlinestatic

Definition at line 962 of file tcp.h.

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

◆ tcp_available_snd_wnd()

static u32 tcp_available_snd_wnd ( const tcp_connection_t tc)
inlinestatic

Definition at line 956 of file tcp.h.

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

◆ tcp_bt_check_app_limited()

void tcp_bt_check_app_limited ( tcp_connection_t tc)

Check if sample to be generated is app limited.

Parameters
tctcp connection

Definition at line 282 of file tcp_bt.c.

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

◆ tcp_bt_cleanup()

void tcp_bt_cleanup ( tcp_connection_t tc)

Byte tracker cleanup.

Parameters
tcconnection for which the byte tracker should be cleaned up

Definition at line 639 of file tcp_bt.c.

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

◆ tcp_bt_flush_samples()

void tcp_bt_flush_samples ( tcp_connection_t tc)

Flush byte tracker samples.

Parameters
tctcp connection for which samples should be flushed

Definition at line 614 of file tcp_bt.c.

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

◆ tcp_bt_init()

void tcp_bt_init ( tcp_connection_t tc)

Byte tracker initialize.

Parameters
tcconnection for which the byte tracker should be allocated and initialized

Definition at line 650 of file tcp_bt.c.

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

◆ tcp_bt_is_sane()

int tcp_bt_is_sane ( tcp_byte_tracker_t bt)

Check if the byte tracker is in sane state.

Should be used only for testing

Parameters
btbyte tracker

Definition at line 213 of file tcp_bt.c.

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

◆ tcp_bt_sample_delivery_rate()

void tcp_bt_sample_delivery_rate ( tcp_connection_t tc,
tcp_rate_sample_t rs 
)

Generate a delivery rate sample from recently acked bytes.

Parameters
tctcp connection
rsresulting rate sample

Definition at line 582 of file tcp_bt.c.

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

◆ tcp_bt_track_rxt()

void tcp_bt_track_rxt ( tcp_connection_t tc,
u32  start,
u32  end 
)

Track a tcp retransmission.

Parameters
tctcp connection
startstart sequence number
endend sequence number

Definition at line 333 of file tcp_bt.c.

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

◆ tcp_bt_track_tx()

void tcp_bt_track_tx ( tcp_connection_t tc,
u32  len 
)

Track a tcp tx burst.

Parameters
tctcp connection

Definition at line 297 of file tcp_bt.c.

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

◆ tcp_buffer_hdr()

static tcp_header_t* tcp_buffer_hdr ( vlib_buffer_t b)
inlinestatic

Definition at line 696 of file tcp.h.

+ Here is the caller graph for this function:

◆ tcp_bytes_out()

static u32 tcp_bytes_out ( const tcp_connection_t tc)
inlinestatic

Our estimate of the number of bytes that have left the network.

Definition at line 887 of file tcp.h.

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

◆ tcp_cc_algo_get()

tcp_cc_algorithm_t* tcp_cc_algo_get ( tcp_cc_algorithm_type_e  type)

Definition at line 97 of file tcp.c.

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

◆ tcp_cc_algo_new_type()

tcp_cc_algorithm_type_e tcp_cc_algo_new_type ( const tcp_cc_algorithm_t vft)

Register new cc algo type.

Definition at line 104 of file tcp.c.

+ Here is the call graph for this function:

◆ tcp_cc_algo_register()

void tcp_cc_algo_register ( tcp_cc_algorithm_type_e  type,
const tcp_cc_algorithm_t vft 
)

Register exiting cc algo type.

Definition at line 86 of file tcp.c.

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

◆ tcp_cc_congestion()

static void tcp_cc_congestion ( tcp_connection_t tc)
inlinestatic

Definition at line 1067 of file tcp.h.

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

◆ tcp_cc_data()

static void* tcp_cc_data ( tcp_connection_t tc)
inlinestatic

Definition at line 1238 of file tcp.h.

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

◆ tcp_cc_event()

static void tcp_cc_event ( tcp_connection_t tc,
tcp_cc_event_t  evt 
)
inlinestatic

Definition at line 1092 of file tcp.h.

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

◆ tcp_cc_get_pacing_rate()

static u64 tcp_cc_get_pacing_rate ( tcp_connection_t tc)
inlinestatic

Definition at line 1099 of file tcp.h.

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

◆ tcp_cc_loss()

static void tcp_cc_loss ( tcp_connection_t tc)
inlinestatic

Definition at line 1073 of file tcp.h.

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

◆ tcp_cc_rcv_ack()

static void tcp_cc_rcv_ack ( tcp_connection_t tc,
tcp_rate_sample_t rs 
)
inlinestatic

Definition at line 1053 of file tcp.h.

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

◆ tcp_cc_rcv_cong_ack()

static void tcp_cc_rcv_cong_ack ( tcp_connection_t tc,
tcp_cc_ack_t  ack_type,
tcp_rate_sample_t rs 
)
inlinestatic

Definition at line 1060 of file tcp.h.

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

◆ tcp_cc_recovered()

static void tcp_cc_recovered ( tcp_connection_t tc)
inlinestatic

Definition at line 1079 of file tcp.h.

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

◆ tcp_cc_undo_recovery()

static void tcp_cc_undo_recovery ( tcp_connection_t tc)
inlinestatic

Definition at line 1085 of file tcp.h.

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

◆ tcp_configure_v4_source_address_range()

int tcp_configure_v4_source_address_range ( vlib_main_t vm,
ip4_address_t start,
ip4_address_t end,
u32  table_id 
)

Configure an ipv4 source address range.

Parameters
vmvlib_main_t pointer
startfirst ipv4 address in the source address range
endlast ipv4 address in the source address range
table_idVRF / table ID, 0 for the default FIB
Returns
0 if all OK, else an error indication from api_errno.h

Definition at line 1862 of file tcp.c.

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

◆ tcp_configure_v6_source_address_range()

int tcp_configure_v6_source_address_range ( vlib_main_t vm,
ip6_address_t start,
ip6_address_t end,
u32  table_id 
)

Configure an ipv6 source address range.

Parameters
vmvlib_main_t pointer
startfirst ipv6 address in the source address range
endlast ipv6 address in the source address range
table_idVRF / table ID, 0 for the default FIB
Returns
0 if all OK, else an error indication from api_errno.h

Definition at line 1949 of file tcp.c.

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

◆ tcp_cong_recovery_off()

static void tcp_cong_recovery_off ( tcp_connection_t tc)
inlinestatic

Definition at line 480 of file tcp.h.

+ Here is the caller graph for this function:

◆ tcp_connection_alloc()

tcp_connection_t* tcp_connection_alloc ( u8  thread_index)

Definition at line 298 of file tcp.c.

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

◆ tcp_connection_alloc_w_base()

tcp_connection_t* tcp_connection_alloc_w_base ( u8  thread_index,
tcp_connection_t base 
)

Definition at line 311 of file tcp.c.

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

◆ tcp_connection_cleanup()

void tcp_connection_cleanup ( tcp_connection_t tc)

Cleans up connection state.

No notifications.

Definition at line 238 of file tcp.c.

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

◆ tcp_connection_close()

void tcp_connection_close ( tcp_connection_t tc)

Begin connection closing procedure.

If at the end the connection is not in CLOSED state, it is not removed. Instead, we rely on on TCP to advance through state machine to either 1) LAST_ACK (passive close) whereby when the last ACK is received tcp_connection_del is called. This notifies session of the delete and calls cleanup. 2) TIME_WAIT (active close) whereby after 2MSL the 2MSL timer triggers and cleanup is called.

N.B. Half-close connections are not supported

Definition at line 401 of file tcp.c.

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

◆ tcp_connection_del()

void tcp_connection_del ( tcp_connection_t tc)

Connection removal.

This should be called only once connection enters CLOSED state. Note that it notifies the session of the removal event, so if the goal is to just remove the connection, call tcp_connection_cleanup instead.

Definition at line 291 of file tcp.c.

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

◆ tcp_connection_free()

void tcp_connection_free ( tcp_connection_t tc)

Definition at line 324 of file tcp.c.

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

◆ tcp_connection_get()

static tcp_connection_t* tcp_connection_get ( u32  conn_index,
u32  thread_index 
)
inlinestatic

Definition at line 717 of file tcp.h.

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

◆ tcp_connection_get_if_valid()

static tcp_connection_t* tcp_connection_get_if_valid ( u32  conn_index,
u32  thread_index 
)
inlinestatic

Definition at line 726 of file tcp.h.

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

◆ tcp_connection_init_vars()

void tcp_connection_init_vars ( tcp_connection_t tc)

Initialize tcp connection variables.

Should be called after having received a msg from the peer, i.e., a SYN or a SYNACK, such that connection options have already been exchanged.

Definition at line 726 of file tcp.c.

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

◆ tcp_connection_reset()

void tcp_connection_reset ( tcp_connection_t tc)

Notify session that connection has been reset.

Switch state to closed and wait for session to call cleanup.

Definition at line 342 of file tcp.c.

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

◆ tcp_connection_set_state()

static void tcp_connection_set_state ( tcp_connection_t tc,
tcp_state_t  state 
)
inlinestatic

Definition at line 742 of file tcp.h.

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

◆ tcp_connection_timers_init()

void tcp_connection_timers_init ( tcp_connection_t tc)

Initialize all connection timers as invalid.

Definition at line 502 of file tcp.c.

+ Here is the caller graph for this function:

◆ tcp_connection_timers_reset()

void tcp_connection_timers_reset ( tcp_connection_t tc)

Stop all connection timers.

Definition at line 519 of file tcp.c.

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

◆ tcp_connection_tx_pacer_reset()

void tcp_connection_tx_pacer_reset ( tcp_connection_t tc,
u32  window,
u32  start_bucket 
)

Definition at line 1409 of file tcp.c.

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

◆ tcp_connection_tx_pacer_update()

void tcp_connection_tx_pacer_update ( tcp_connection_t tc)

Definition at line 1396 of file tcp.c.

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

◆ tcp_cwnd_accumulate()

static void tcp_cwnd_accumulate ( tcp_connection_t tc,
u32  thresh,
u32  bytes 
)
inlinestatic

Definition at line 936 of file tcp.h.

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

◆ tcp_end_seq()

static u32 tcp_end_seq ( tcp_header_t th,
u32  len 
)
inlinestatic

Definition at line 867 of file tcp.h.

+ Here is the caller graph for this function:

◆ tcp_fastrecovery_prr_snd_space()

int tcp_fastrecovery_prr_snd_space ( tcp_connection_t tc)

Estimate send space using proportional rate reduction (RFC6937)

Definition at line 1798 of file tcp_output.c.

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

◆ tcp_flight_size()

static u32 tcp_flight_size ( const tcp_connection_t tc)
inlinestatic

Our estimate of the number of bytes in flight (pipe size)

Definition at line 900 of file tcp.h.

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

◆ tcp_flush_frames_to_output()

void tcp_flush_frames_to_output ( tcp_worker_ctx_t wrk)

Flush v4 and v6 tcp and ip-lookup tx frames for thread index.

Definition at line 997 of file tcp_output.c.

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

◆ tcp_get_connection_from_transport()

static tcp_connection_t* tcp_get_connection_from_transport ( transport_connection_t tconn)
inlinestatic

Definition at line 736 of file tcp.h.

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

◆ tcp_get_worker()

static tcp_worker_ctx_t* tcp_get_worker ( u32  thread_index)
inlinestatic

Definition at line 690 of file tcp.h.

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

◆ tcp_half_open_connection_cleanup()

int tcp_half_open_connection_cleanup ( tcp_connection_t tc)

Try to cleanup half-open connection.

If called from a thread that doesn't own tc, the call won't have any effect.

Parameters
tc- connection to be cleaned up
Returns
non-zero if cleanup failed.

Definition at line 210 of file tcp.c.

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

◆ tcp_half_open_connection_get()

static tcp_connection_t* tcp_half_open_connection_get ( u32  conn_index)
inlinestatic

Definition at line 777 of file tcp.h.

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

◆ tcp_init_snd_vars()

void tcp_init_snd_vars ( tcp_connection_t tc)

Initialize connection send variables.

Definition at line 691 of file tcp.c.

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

◆ tcp_initial_cwnd()

static u32 tcp_initial_cwnd ( const tcp_connection_t tc)
inlinestatic

Initial cwnd as per RFC5681.

Definition at line 916 of file tcp.h.

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

◆ tcp_is_lost_fin()

static u8 tcp_is_lost_fin ( tcp_connection_t tc)
inlinestatic

Definition at line 989 of file tcp.h.

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

◆ tcp_listener_get()

static tcp_connection_t* tcp_listener_get ( u32  tli)
inlinestatic

Definition at line 768 of file tcp.h.

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

◆ tcp_lookup_rmt_in_fib()

fib_node_index_t tcp_lookup_rmt_in_fib ( tcp_connection_t tc)
+ Here is the caller graph for this function:

◆ tcp_loss_wnd()

static u32 tcp_loss_wnd ( const tcp_connection_t tc)
inlinestatic

Definition at line 949 of file tcp.h.

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

◆ tcp_make_fin()

void tcp_make_fin ( tcp_connection_t tc,
vlib_buffer_t b 
)

Convert buffer to FIN-ACK.

Definition at line 569 of file tcp_output.c.

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

◆ tcp_make_synack()

void tcp_make_synack ( tcp_connection_t ts,
vlib_buffer_t b 
)

Convert buffer to SYN-ACK.

Definition at line 604 of file tcp_output.c.

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

◆ tcp_persist_timer_reset()

static void tcp_persist_timer_reset ( tcp_connection_t tc)
inlinestatic

Definition at line 1193 of file tcp.h.

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

◆ tcp_persist_timer_set()

static void tcp_persist_timer_set ( tcp_connection_t tc)
inlinestatic

Definition at line 1172 of file tcp.h.

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

◆ tcp_persist_timer_update()

static void tcp_persist_timer_update ( tcp_connection_t tc)
inlinestatic

Definition at line 1180 of file tcp.h.

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

◆ tcp_program_ack()

void tcp_program_ack ( tcp_connection_t tc)

Definition at line 1176 of file tcp_output.c.

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

◆ tcp_program_dupack()

void tcp_program_dupack ( tcp_connection_t tc)

Definition at line 1186 of file tcp_output.c.

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

◆ tcp_program_retransmit()

void tcp_program_retransmit ( tcp_connection_t tc)

Definition at line 1198 of file tcp_output.c.

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

◆ tcp_punt_unknown()

void tcp_punt_unknown ( vlib_main_t vm,
u8  is_ip4,
u8  is_add 
)

Definition at line 1654 of file tcp.c.

+ Here is the caller graph for this function:

◆ tcp_rcv_sacks()

void tcp_rcv_sacks ( tcp_connection_t tc,
u32  ack 
)

Definition at line 981 of file tcp_input.c.

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

◆ tcp_retransmit_timer_force_update()

static void tcp_retransmit_timer_force_update ( tcp_connection_t tc)
inlinestatic

Definition at line 1165 of file tcp.h.

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

◆ tcp_retransmit_timer_reset()

static void tcp_retransmit_timer_reset ( tcp_connection_t tc)
inlinestatic

Definition at line 1159 of file tcp.h.

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

◆ tcp_retransmit_timer_set()

static void tcp_retransmit_timer_set ( tcp_connection_t tc)
inlinestatic

Definition at line 1151 of file tcp.h.

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

◆ tcp_retransmit_timer_update()

static void tcp_retransmit_timer_update ( tcp_connection_t tc)
inlinestatic

Definition at line 1199 of file tcp.h.

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

◆ tcp_sack_list_bytes()

u32 tcp_sack_list_bytes ( tcp_connection_t tc)

Definition at line 1792 of file tcp_input.c.

+ Here is the caller graph for this function:

◆ tcp_scoreboard_replay()

u8* tcp_scoreboard_replay ( u8 s,
tcp_connection_t tc,
u8  verbose 
)

Definition at line 2172 of file tcp.c.

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

◆ tcp_send_ack()

void tcp_send_ack ( tcp_connection_t tc)

Definition at line 1157 of file tcp_output.c.

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

◆ tcp_send_fin()

void tcp_send_fin ( tcp_connection_t tc)

Send FIN.

Definition at line 1007 of file tcp_output.c.

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

◆ tcp_send_reset()

void tcp_send_reset ( tcp_connection_t tc)

Build and set reset packet for connection.

Definition at line 863 of file tcp_output.c.

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

◆ tcp_send_reset_w_pkt()

void tcp_send_reset_w_pkt ( tcp_connection_t tc,
vlib_buffer_t pkt,
u32  thread_index,
u8  is_ip4 
)

Send reset without reusing existing buffer.

It extracts connection info out of original packet

Definition at line 778 of file tcp_output.c.

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

◆ tcp_send_syn()

void tcp_send_syn ( tcp_connection_t tc)

Send SYN.

Builds a SYN packet for a half-open connection and sends it to ipx_lookup. The packet is not forwarded through tcpx_output to avoid doing lookups in the half_open pool.

Definition at line 919 of file tcp_output.c.

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

◆ tcp_send_synack()

void tcp_send_synack ( tcp_connection_t tc)

Definition at line 954 of file tcp_output.c.

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

◆ tcp_send_window_update_ack()

void tcp_send_window_update_ack ( tcp_connection_t tc)

Send window update ack.

Ensures that it will be sent only once, after a zero rwnd has been advertised in a previous ack, and only if rwnd has grown beyond a configurable value.

Definition at line 1229 of file tcp_output.c.

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

◆ tcp_session_custom_tx()

int tcp_session_custom_tx ( void *  conn,
u32  max_burst_size 
)

Definition at line 2157 of file tcp_output.c.

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

◆ tcp_session_push_header()

u32 tcp_session_push_header ( transport_connection_t tconn,
vlib_buffer_t b 
)

Definition at line 1129 of file tcp_output.c.

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

◆ tcp_set_time_now()

static u32 tcp_set_time_now ( tcp_worker_ctx_t wrk)
inlinestatic

Definition at line 1034 of file tcp.h.

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

◆ tcp_snd_space()

u32 tcp_snd_space ( tcp_connection_t tc)

Definition at line 1322 of file tcp.c.

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

◆ tcp_time_now()

static u32 tcp_time_now ( void  )
inlinestatic

Definition at line 1006 of file tcp.h.

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

◆ tcp_time_now_us()

static f64 tcp_time_now_us ( u32  thread_index)
inlinestatic

Definition at line 1028 of file tcp.h.

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

◆ tcp_time_now_w_thread()

static u32 tcp_time_now_w_thread ( u32  thread_index)
inlinestatic

Definition at line 1012 of file tcp.h.

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

◆ tcp_timer_is_active()

static u8 tcp_timer_is_active ( tcp_connection_t tc,
tcp_timers_e  timer 
)
inlinestatic

Definition at line 1213 of file tcp.h.

+ Here is the caller graph for this function:

◆ tcp_timer_reset()

static void tcp_timer_reset ( tcp_connection_t tc,
u8  timer_id 
)
inlinestatic

Definition at line 1123 of file tcp.h.

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

◆ tcp_timer_set()

static void tcp_timer_set ( tcp_connection_t tc,
u8  timer_id,
u32  interval 
)
inlinestatic

Definition at line 1112 of file tcp.h.

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

◆ tcp_timer_update()

static void tcp_timer_update ( tcp_connection_t tc,
u8  timer_id,
u32  interval 
)
inlinestatic

Definition at line 1136 of file tcp.h.

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

◆ tcp_tstamp()

static u32 tcp_tstamp ( tcp_connection_t tc)
inlinestatic

Generate timestamp for tcp connection.

Definition at line 1021 of file tcp.h.

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

◆ tcp_update_burst_snd_vars()

void tcp_update_burst_snd_vars ( tcp_connection_t tc)

Update burst send vars.

  • Updates snd_mss to reflect the effective segment size that we can send by taking into account all TCP options, including SACKs.
  • Cache 'on the wire' options for reuse
  • Updates receive window which can be reused for a burst.

This should only be called when doing bursts

Definition at line 390 of file tcp_output.c.

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

◆ tcp_update_rto()

void tcp_update_rto ( tcp_connection_t tc)

Definition at line 478 of file tcp_input.c.

+ Here is the caller graph for this function:

◆ tcp_update_sack_list()

void tcp_update_sack_list ( tcp_connection_t tc,
u32  start,
u32  end 
)

Build SACK list as per RFC2018.

Makes sure the first block contains the segment that generated the current ACK and the following ones are the ones most recently reported in SACK blocks.

Parameters
tcTCP connection for which the SACK list is updated
startStart sequence number of the newest SACK block
endEnd sequence of the newest SACK block

Definition at line 1743 of file tcp_input.c.

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

◆ vlib_buffer_push_tcp()

static void* vlib_buffer_push_tcp ( vlib_buffer_t b,
u16  sp_net,
u16  dp_net,
u32  seq,
u32  ack,
u8  tcp_hdr_opts_len,
u8  flags,
u16  wnd 
)
inlinestatic

Push TCP header to buffer.

Parameters
b- buffer to write the header to
sp_net- source port net order
dp_net- destination port net order
seq- sequence number host order
ack- ack number host order
tcp_hdr_opts_len- header and options length in bytes
flags- header flags
wnd- window size
Returns
- pointer to start of TCP header

Definition at line 1299 of file tcp.h.

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

◆ vlib_buffer_push_tcp_net_order()

static void* vlib_buffer_push_tcp_net_order ( vlib_buffer_t b,
u16  sp,
u16  dp,
u32  seq,
u32  ack,
u8  tcp_hdr_opts_len,
u8  flags,
u16  wnd 
)
inlinestatic

Push TCP header to buffer.

Parameters
vm- vlib_main
b- buffer to write the header to
sp_net- source port net order
dp_net- destination port net order
seq- sequence number net order
ack- ack number net order
tcp_hdr_opts_len- header and options length in bytes
flags- header flags
wnd- window size
Returns
- pointer to start of TCP header

Definition at line 1262 of file tcp.h.

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

◆ vnet_get_tcp_main()

static tcp_main_t* vnet_get_tcp_main ( )
inlinestatic

Definition at line 684 of file tcp.h.

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

◆ vnet_tcp_enable_disable()

clib_error_t* vnet_tcp_enable_disable ( vlib_main_t vm,
u8  is_en 
)

Definition at line 1636 of file tcp.c.

+ Here is the call graph for this function:

Variable Documentation

◆ format_tcp_flags

format_function_t format_tcp_flags

Definition at line 65 of file tcp.h.

◆ format_tcp_rcv_sacks

format_function_t format_tcp_rcv_sacks

Definition at line 67 of file tcp.h.

◆ format_tcp_sacks

format_function_t format_tcp_sacks

Definition at line 66 of file tcp.h.

◆ format_tcp_state

format_function_t format_tcp_state

Definition at line 64 of file tcp.h.

◆ tcp4_established_node

vlib_node_registration_t tcp4_established_node

(constructor) VLIB_REGISTER_NODE (tcp4_established_node)

Definition at line 2244 of file tcp_input.c.

◆ tcp4_input_node

vlib_node_registration_t tcp4_input_node

(constructor) VLIB_REGISTER_NODE (tcp4_input_node)

Definition at line 3786 of file tcp_input.c.

◆ tcp4_listen_node

vlib_node_registration_t tcp4_listen_node

(constructor) VLIB_REGISTER_NODE (tcp4_listen_node)

Definition at line 3373 of file tcp_input.c.

◆ tcp4_output_node

vlib_node_registration_t tcp4_output_node

(constructor) VLIB_REGISTER_NODE (tcp4_output_node)

Definition at line 2456 of file tcp_output.c.

◆ tcp4_rcv_process_node

vlib_node_registration_t tcp4_rcv_process_node

(constructor) VLIB_REGISTER_NODE (tcp4_rcv_process_node)

Definition at line 3156 of file tcp_input.c.

◆ tcp4_syn_sent_node

vlib_node_registration_t tcp4_syn_sent_node

(constructor) VLIB_REGISTER_NODE (tcp4_syn_sent_node)

Definition at line 2723 of file tcp_input.c.

◆ tcp6_established_node

vlib_node_registration_t tcp6_established_node

(constructor) VLIB_REGISTER_NODE (tcp6_established_node)

Definition at line 2263 of file tcp_input.c.

◆ tcp6_input_node

vlib_node_registration_t tcp6_input_node

(constructor) VLIB_REGISTER_NODE (tcp6_input_node)

Definition at line 3806 of file tcp_input.c.

◆ tcp6_listen_node

vlib_node_registration_t tcp6_listen_node

(constructor) VLIB_REGISTER_NODE (tcp6_listen_node)

Definition at line 3392 of file tcp_input.c.

◆ tcp6_output_node

vlib_node_registration_t tcp6_output_node

(constructor) VLIB_REGISTER_NODE (tcp6_output_node)

Definition at line 2476 of file tcp_output.c.

◆ tcp6_rcv_process_node

vlib_node_registration_t tcp6_rcv_process_node

(constructor) VLIB_REGISTER_NODE (tcp6_rcv_process_node)

Definition at line 3175 of file tcp_input.c.

◆ tcp6_syn_sent_node

vlib_node_registration_t tcp6_syn_sent_node

(constructor) VLIB_REGISTER_NODE (tcp6_syn_sent_node)

Definition at line 2742 of file tcp_input.c.

◆ tcp_main

tcp_main_t tcp_main

Definition at line 29 of file tcp.c.

◆ tcp_timer_delack_handler

timer_expiration_handler tcp_timer_delack_handler

◆ tcp_timer_persist_handler

timer_expiration_handler tcp_timer_persist_handler

◆ tcp_timer_retransmit_handler

timer_expiration_handler tcp_timer_retransmit_handler

◆ tcp_timer_retransmit_syn_handler

timer_expiration_handler tcp_timer_retransmit_syn_handler