![]() |
FD.io VPP
v17.10-9-gd594711
Vector Packet Processing
|
Go to the source code of this file.
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_DUPACK_THRESHOLD 3 |
#define | TCP_MAX_RX_FIFO_SIZE 4 << 20 |
#define | TCP_MIN_RX_FIFO_SIZE 4 << 10 |
#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_TO_TIMER_TICK |
#define | TCP_DELACK_TIME 1 /* 0.1s */ |
#define | TCP_ESTABLISH_TIME 750 /* 75s */ |
#define | TCP_SYN_RCVD_TIME 600 /* 60s */ |
#define | TCP_2MSL_TIME 300 /* 30s */ |
#define | TCP_CLOSEWAIT_TIME 20 /* 2s */ |
#define | TCP_TIMEWAIT_TIME 20 /* 2s */ |
#define | TCP_CLEANUP_TIME 10 /* 1s Time to wait before cleanup */ |
#define | TCP_TIMER_PERSIST_MIN 2 /* 0.2s */ |
#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 | foreach_tcp_connection_flag |
TCP connection flags. More... | |
#define | foreach_tcp_buf_flag |
TCP buffer flags. More... | |
#define | TCP_SCOREBOARD_TRACE (0) |
#define | TCP_MAX_SACK_BLOCKS 15 |
Max number of SACK blocks stored. More... | |
#define | TCP_INVALID_SACK_HOLE_INDEX ((u32)~0) |
#define | tcp_scoreboard_trace_add(_tc, _ack) |
#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_fastrecovery_sent_1_smss(tc) ((tc)->flags & TCP_CONN_FR_1_SMSS) |
#define | tcp_fastrecovery_1_smss_on(tc) ((tc)->flags |= TCP_CONN_FR_1_SMSS) |
#define | tcp_fastrecovery_1_smss_off(tc) ((tc)->flags &= ~TCP_CONN_FR_1_SMSS) |
#define | tcp_in_cong_recovery(tc) |
#define | tcp_error(n, s) TCP_ERROR_##n, |
#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) |
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_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 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_main | tcp_main_t |
Enumerations | |
enum | { TCP_N_BUF_BITS } |
enum | { foreach_tcp_buf_flag } |
enum | tcp_af_t { TCP_IP4, TCP_IP6, TCP_N_AF } |
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... | |
#define foreach_tcp_buf_flag |
#define foreach_tcp_connection_flag |
TCP connection flags.
#define foreach_tcp_fsm_state |
TCP FSM state definitions as per RFC793.
#define foreach_tcp_timer |
#define seq_max | ( | _s1, | |
_s2 | |||
) | (seq_gt((_s1), (_s2)) ? (_s1) : (_s2)) |
#define TCP_CLEANUP_TIME 10 /* 1s Time to wait before cleanup */ |
#define tcp_fastrecovery_1_smss_off | ( | tc | ) | ((tc)->flags &= ~TCP_CONN_FR_1_SMSS) |
#define tcp_fastrecovery_1_smss_on | ( | tc | ) | ((tc)->flags |= TCP_CONN_FR_1_SMSS) |
#define tcp_fastrecovery_off | ( | tc | ) | (tc)->flags &= ~TCP_CONN_FAST_RECOVERY |
#define tcp_fastrecovery_on | ( | tc | ) | (tc)->flags |= TCP_CONN_FAST_RECOVERY |
#define tcp_fastrecovery_sent_1_smss | ( | tc | ) | ((tc)->flags & TCP_CONN_FR_1_SMSS) |
#define tcp_in_cong_recovery | ( | tc | ) |
#define tcp_in_fastrecovery | ( | tc | ) | ((tc)->flags & TCP_CONN_FAST_RECOVERY) |
#define tcp_in_recovery | ( | tc | ) | ((tc)->flags & (TCP_CONN_RECOVERY)) |
#define TCP_MAX_SACK_BLOCKS 15 |
#define tcp_recovery_off | ( | tc | ) | (tc)->flags &= ~TCP_CONN_RECOVERY |
#define tcp_recovery_on | ( | tc | ) | (tc)->flags |= TCP_CONN_RECOVERY |
#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_RTO_SYN_RETRIES 3 /* SYN retries without doubling RTO */ |
#define TCP_TO_TIMER_TICK |
#define tcp_validate_txf_size | ( | _tc, | |
_a | |||
) |
typedef struct _sack_scoreboard_hole sack_scoreboard_hole_t |
typedef struct _sack_scoreboard sack_scoreboard_t |
typedef struct _scoreboard_trace_elt scoreboard_trace_elt_t |
typedef enum _tcp_cc_ack_t tcp_cc_ack_t |
typedef struct _tcp_cc_algorithm tcp_cc_algorithm_t |
typedef enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e |
typedef enum _tcp_connection_flag_bits tcp_connection_flag_bits_e |
typedef enum _tcp_connection_flag tcp_connection_flags_e |
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_main tcp_main_t |
typedef enum _tcp_state tcp_state_t |
typedef enum _tcp_timers tcp_timers_e |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
void scoreboard_init_high_rxt | ( | sack_scoreboard_t * | sb, |
u32 | seq | ||
) |
Definition at line 693 of file tcp_input.c.
sack_scoreboard_hole_t* scoreboard_insert_hole | ( | sack_scoreboard_t * | sb, |
u32 | prev_index, | ||
u32 | start, | ||
u32 | end | ||
) |
Definition at line 557 of file tcp_input.c.
|
inlinestatic |
|
inlinestatic |
sack_scoreboard_hole_t* scoreboard_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.
Follows logic proposed in RFC6675 Sec. 4, NextSeg()
Definition at line 638 of file tcp_input.c.
|
inlinestatic |
void scoreboard_remove_hole | ( | sack_scoreboard_t * | sb, |
sack_scoreboard_hole_t * | hole | ||
) |
Definition at line 522 of file tcp_input.c.
void scoreboard_update_lost | ( | tcp_connection_t * | tc, |
sack_scoreboard_t * | sb | ||
) |
void tcp_api_reference | ( | void | ) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
void tcp_cc_fastrecovery_exit | ( | tcp_connection_t * | tc | ) |
void tcp_cc_init | ( | tcp_connection_t * | tc | ) |
Definition at line 1200 of file tcp_input.c.
void tcp_cc_init_congestion | ( | tcp_connection_t * | tc | ) |
int tcp_cc_recover | ( | tcp_connection_t * | tc | ) |
Definition at line 981 of file tcp_input.c.
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.
vm | vlib_main_t pointer |
start | first ipv4 address in the source address range |
end | last ipv4 address in the source address range |
table_id | VRF / table ID, 0 for the default FIB |
Definition at line 1478 of file tcp.c.
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.
vm | vlib_main_t pointer |
start | first ipv6 address in the source address range |
end | last ipv6 address in the source address range |
table_id | VRF / table ID, 0 for the default FIB |
Definition at line 1570 of file tcp.c.
|
inlinestatic |
void tcp_connection_cleanup | ( | tcp_connection_t * | tc | ) |
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 295 of file tcp.c.
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 222 of file tcp.c.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
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 593 of file tcp.c.
tcp_connection_t* tcp_connection_new | ( | u8 | thread_index | ) |
void tcp_connection_reset | ( | tcp_connection_t * | tc | ) |
void tcp_connection_timers_init | ( | tcp_connection_t * | tc | ) |
void tcp_connection_timers_reset | ( | tcp_connection_t * | tc | ) |
|
inlinestatic |
void tcp_fast_retransmit | ( | tcp_connection_t * | tc | ) |
Do fast retransmit.
Definition at line 1721 of file tcp_output.c.
void tcp_fast_retransmit_no_sack | ( | tcp_connection_t * | tc | ) |
Fast retransmit without SACK info.
Definition at line 1684 of file tcp_output.c.
void tcp_fast_retransmit_sack | ( | tcp_connection_t * | tc | ) |
Do fast retransmit with SACKs.
Definition at line 1607 of file tcp_output.c.
|
inlinestatic |
void tcp_flush_frame_to_output | ( | vlib_main_t * | vm, |
u8 | thread_index, | ||
u8 | is_ip4 | ||
) |
Flush tx frame populated by retransmits and timer pops.
Definition at line 1004 of file tcp_output.c.
void tcp_flush_frames_to_output | ( | u8 | thread_index | ) |
Flush v4 and v6 tcp and ip-lookup tx frames for thread index.
Definition at line 1037 of file tcp_output.c.
|
inlinestatic |
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.
tc | - connection to be cleaned up |
Definition at line 147 of file tcp.c.
|
inlinestatic |
void tcp_init_mss | ( | tcp_connection_t * | tc | ) |
Definition at line 415 of file tcp_output.c.
void tcp_init_snd_vars | ( | tcp_connection_t * | tc | ) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
fib_node_index_t tcp_lookup_rmt_in_fib | ( | tcp_connection_t * | tc | ) |
|
inlinestatic |
void tcp_make_ack | ( | tcp_connection_t * | ts, |
vlib_buffer_t * | b | ||
) |
Convert buffer to ACK.
Definition at line 541 of file tcp_output.c.
void tcp_make_fin | ( | tcp_connection_t * | tc, |
vlib_buffer_t * | b | ||
) |
Convert buffer to FIN-ACK.
Definition at line 556 of file tcp_output.c.
void tcp_make_synack | ( | tcp_connection_t * | ts, |
vlib_buffer_t * | b | ||
) |
Convert buffer to SYN-ACK.
Definition at line 602 of file tcp_output.c.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
u32 tcp_prepare_retransmit_segment | ( | tcp_connection_t * | tc, |
u32 | offset, | ||
u32 | max_deq_bytes, | ||
vlib_buffer_t ** | b | ||
) |
Build a retransmit segment.
Definition at line 1193 of file tcp_output.c.
void tcp_punt_unknown | ( | vlib_main_t * | vm, |
u8 | is_ip4, | ||
u8 | is_add | ||
) |
u32 tcp_push_header | ( | transport_connection_t * | tconn, |
vlib_buffer_t * | b | ||
) |
Definition at line 1955 of file tcp_output.c.
void tcp_rcv_sacks | ( | tcp_connection_t * | tc, |
u32 | ack | ||
) |
Definition at line 720 of file tcp_input.c.
i32 tcp_rcv_wnd_available | ( | tcp_connection_t * | tc | ) |
void tcp_retransmit_first_unacked | ( | tcp_connection_t * | tc | ) |
Retransmit first unacked segment.
Definition at line 1584 of file tcp_output.c.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
u8* tcp_scoreboard_replay | ( | u8 * | s, |
tcp_connection_t * | tc, | ||
u8 | verbose | ||
) |
void tcp_send_fin | ( | tcp_connection_t * | tc | ) |
Send FIN.
Definition at line 1050 of file tcp_output.c.
void tcp_send_reset | ( | tcp_connection_t * | tc | ) |
Build and set reset packet for connection.
Definition at line 896 of file tcp_output.c.
void tcp_send_reset_w_pkt | ( | tcp_connection_t * | tc, |
vlib_buffer_t * | pkt, | ||
u8 | is_ip4 | ||
) |
Send reset without reusing existing buffer.
It extracts connection info out of original packet
Definition at line 821 of file tcp_output.c.
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 973 of file tcp_output.c.
u32 tcp_snd_space | ( | tcp_connection_t * | tc | ) |
Compute tx window session is allowed to fill.
Takes into account available send space, snd_mss and the congestion state of the connection. If possible, the value returned is a multiple of snd_mss.
tc | tcp connection |
Definition at line 1063 of file tcp.c.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
void tcp_update_rcv_wnd | ( | tcp_connection_t * | tc | ) |
Definition at line 152 of file tcp_output.c.
void tcp_update_rto | ( | tcp_connection_t * | tc | ) |
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.
tc | TCP connection for which the SACK list is updated |
start | Start sequence number of the newest SACK block |
end | End sequence of the newest SACK block |
Definition at line 1323 of file tcp_input.c.
void tcp_update_snd_mss | ( | tcp_connection_t * | tc | ) |
Update snd_mss to reflect the effective segment size that we can send by taking into account all TCP options, including SACKs.
Definition at line 402 of file tcp_output.c.
|
inlinestatic |
Push TCP header to buffer.
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 |
Definition at line 968 of file tcp.h.
|
inlinestatic |
Push TCP header to buffer.
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 |
Definition at line 933 of file tcp.h.
|
inlinestatic |
clib_error_t* vnet_tcp_enable_disable | ( | vlib_main_t * | vm, |
u8 | is_en | ||
) |
format_function_t format_tcp_flags |
format_function_t format_tcp_rcv_sacks |
format_function_t format_tcp_sacks |
format_function_t format_tcp_state |
vlib_node_registration_t tcp4_input_node |
(constructor) VLIB_REGISTER_NODE (tcp4_input_node)
Definition at line 3069 of file tcp_input.c.
vlib_node_registration_t tcp4_output_node |
(constructor) VLIB_REGISTER_NODE (tcp4_output_node)
Definition at line 1912 of file tcp_output.c.
vlib_node_registration_t tcp6_input_node |
(constructor) VLIB_REGISTER_NODE (tcp6_input_node)
Definition at line 3092 of file tcp_input.c.
vlib_node_registration_t tcp6_output_node |
(constructor) VLIB_REGISTER_NODE (tcp6_output_node)
Definition at line 1933 of file tcp_output.c.
tcp_main_t tcp_main |
timer_expiration_handler tcp_timer_delack_handler |
timer_expiration_handler tcp_timer_persist_handler |
timer_expiration_handler tcp_timer_retransmit_handler |
timer_expiration_handler tcp_timer_retransmit_syn_handler |