35 typedef enum _tcp_error
37 #define tcp_error(n,s) TCP_ERROR_##n, 43 typedef struct _tcp_lookup_dispatch
48 #define foreach_tcp_wrk_stat \ 49 _(timer_expirations, u64, "timer expirations") \ 50 _(rxt_segs, u64, "segments retransmitted") \ 51 _(tr_events, u32, "timer retransmit events") \ 52 _(to_closewait, u32, "timeout close-wait") \ 53 _(to_closewait2, u32, "timeout close-wait w/data") \ 54 _(to_finwait1, u32, "timeout fin-wait-1") \ 55 _(to_finwait2, u32, "timeout fin-wait-2") \ 56 _(to_lastack, u32, "timeout last-ack") \ 57 _(to_closing, u32, "timeout closing") \ 58 _(tr_abort, u32, "timer retransmit abort") \ 59 _(rst_unread, u32, "reset on close due to unread data") \ 60 _(no_buffer, u32, "out of buffers") \ 64 #define _(name, type, str) type name; 125 #define tcp_worker_stats_inc(_wrk,_stat,_val) \ 126 _wrk->stats._stat += _val 204 typedef struct _tcp_main
213 u32 bytes_per_buffer;
216 u32 ipl_next_node[2];
233 uword *cc_algo_by_name;
248 u32 last_v4_addr_rotor;
251 u32 last_v6_addr_rotor;
271 #define tcp_cfg tcp_main.cfg 272 #define tcp_node_index(node_id, is_ip4) \ 273 ((is_ip4) ? tcp4_##node_id##_node.index : tcp6_##node_id##_node.index) 285 return &
tcp_main.wrk_ctx[thread_index];
288 #if (VLIB_BUFFER_TRACE_TRAJECTORY) 289 #define tcp_trajectory_add_start(b, start) \ 291 (*vlib_buffer_trace_trajectory_cb) (b, start); \ 294 #define tcp_trajectory_add_start(b, start) 307 u32 thread_index,
u8 is_ip4);
342 ip6_address_t * start,
354 #define tcp_validate_txf_size(_tc, _a) \ 355 ASSERT(_tc->state != TCP_STATE_ESTABLISHED \ 356 || transport_max_tx_dequeue (&_tc->connection) >= _a)
ip6_address_t * ip6_src_addrs
vlib_node_registration_t tcp6_listen_node
(constructor) VLIB_REGISTER_NODE (tcp6_listen_node)
u8 allow_tso
Allow use of TSO whenever available.
void tcp_program_retransmit(tcp_connection_t *tc)
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
void tcp_send_window_update_ack(tcp_connection_t *tc)
Send window update ack.
tcp_cleanup_req_t * pending_cleanups
u32 * pending_disconnects
vector of pending disconnect notifications
void tcp_connection_timers_reset(tcp_connection_t *tc)
Stop all connection timers.
#define foreach_tcp_wrk_stat
vlib_node_registration_t tcp4_output_node
(constructor) VLIB_REGISTER_NODE (tcp4_output_node)
void tcp_connection_del(tcp_connection_t *tc)
Connection removal.
u32 tcp_snd_space(tcp_connection_t *tc)
struct _tcp_main tcp_main_t
struct _tcp_connection tcp_connection_t
vlib_node_registration_t tcp6_output_node
(constructor) VLIB_REGISTER_NODE (tcp6_output_node)
timer_expiration_handler tcp_timer_retransmit_handler
u32 tcp_session_push_header(transport_connection_t *tconn, vlib_buffer_t *b)
struct _tcp_lookup_dispatch tcp_lookup_dispatch_t
u32 * pending_resets
vector of pending reset notifications
void tcp_connection_tx_pacer_update(tcp_connection_t *tc)
void tcp_update_burst_snd_vars(tcp_connection_t *tc)
Update burst send vars.
void tcp_connection_cleanup(tcp_connection_t *tc)
Cleans up connection state.
format_function_t format_tcp_flags
ip4_address_t * ip4_src_addrs
Vectors of src addresses.
u32 * pending_deq_acked
vector of pending ack dequeues
tcp_cc_algorithm_type_e cc_algo
Default congestion control algorithm type.
tcp_connection_t * connections
worker's pool of connections
struct _tcp_cc_algorithm tcp_cc_algorithm_t
vlib_node_registration_t tcp4_syn_sent_node
(constructor) VLIB_REGISTER_NODE (tcp4_syn_sent_node)
struct tcp_wrk_stats_ tcp_wrk_stats_t
format_function_t format_tcp_connection
u32 min_rx_fifo
Min rx fifo for a session (in bytes)
void() timer_expiration_handler(tcp_connection_t *tc)
u8 enable_tx_pacing
Enable tx pacing for new connections.
timer_expiration_handler tcp_timer_retransmit_syn_handler
u16 closing_time
Timer ticks to wait in closing for fin ack.
f64 buffer_fail_fraction
Fault-injection.
struct tcp_worker_ctx_ tcp_worker_ctx_t
vlib_main_t * vm
convenience pointer to this thread's vlib main
timer_expiration_handler tcp_timer_persist_handler
void tcp_send_ack(tcp_connection_t *tc)
vlib_node_registration_t tcp6_syn_sent_node
(constructor) VLIB_REGISTER_NODE (tcp6_syn_sent_node)
int tcp_fastrecovery_prr_snd_space(tcp_connection_t *tc)
Estimate send space using proportional rate reduction (RFC6937)
u32 max_rx_fifo
Max rx fifo size for a session (in bytes).
struct tcp_free_req_ tcp_cleanup_req_t
format_function_t format_tcp_connection_id
clib_error_t * vnet_tcp_enable_disable(vlib_main_t *vm, u8 is_en)
void tcp_send_syn(tcp_connection_t *tc)
Send SYN.
tw_timer_wheel_16t_2w_512sl_t tcp_timer_wheel_t
u32 preallocated_half_open_connections
Number of preallocated half-open connections.
tcp_timer_wheel_t timer_wheel
worker timer wheel
tcp_connection_t * tcp_connection_alloc(u8 thread_index)
void tcp_connection_tx_pacer_reset(tcp_connection_t *tc, u32 window, u32 start_bucket)
u8 csum_offload
Set if csum offloading is enabled.
u16 finwait1_time
Timer ticks to wait in fin-wait1 to send fin and rcv fin-ack.
vlib_node_registration_t tcp4_listen_node
(constructor) VLIB_REGISTER_NODE (tcp4_listen_node)
enum _tcp_error tcp_error_t
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.
void tcp_program_cleanup(tcp_worker_ctx_t *wrk, tcp_connection_t *tc)
void tcp_program_dupack(tcp_connection_t *tc)
void tcp_send_reset(tcp_connection_t *tc)
Build and set reset packet for connection.
void tcp_punt_unknown(vlib_main_t *vm, u8 is_ip4, u8 is_add)
format_function_t format_tcp_state
struct _transport_connection transport_connection_t
int tcp_half_open_connection_cleanup(tcp_connection_t *tc)
Try to cleanup half-open connection.
u32 fib_node_index_t
A typedef of a node index.
void tcp_connection_timers_init(tcp_connection_t *tc)
Initialize all connection timers as invalid.
format_function_t format_tcp_rcv_sacks
vlib_node_registration_t tcp6_input_node
(constructor) VLIB_REGISTER_NODE (tcp6_input_node)
fib_node_index_t tcp_lookup_rmt_in_fib(tcp_connection_t *tc)
u16 default_mtu
Default MTU to be used when establishing connections.
void tcp_send_synack(tcp_connection_t *tc)
u16 closewait_time
Timer ticks to wait for close from app.
u16 initial_cwnd_multiplier
Initial CWND multiplier, which multiplies MSS to determine initial CWND.
u16 lastack_time
Timer ticks to wait in last ack for ack.
void tcp_connection_init_vars(tcp_connection_t *tc)
Initialize tcp connection variables.
clib_time_type_t free_time
vlib_node_registration_t tcp4_rcv_process_node
(constructor) VLIB_REGISTER_NODE (tcp4_rcv_process_node)
vlib_node_registration_t tcp6_established_node
(constructor) VLIB_REGISTER_NODE (tcp6_established_node)
struct _vlib_node_registration vlib_node_registration_t
struct tcp_iss_seed_ tcp_iss_seed_t
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.
u32 rwnd_min_update_ack
Min rwnd, as number of snd_mss segments, for update ack to be sent after a zero rwnd advertisement...
vlib_node_registration_t tcp4_input_node
(constructor) VLIB_REGISTER_NODE (tcp4_input_node)
vlib_node_registration_t tcp6_rcv_process_node
(constructor) VLIB_REGISTER_NODE (tcp6_rcv_process_node)
void tcp_send_fin(tcp_connection_t *tc)
Send FIN.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static tcp_worker_ctx_t * tcp_get_worker(u32 thread_index)
VLIB buffer representation.
f32 cleanup_time
Time to wait (sec) before cleaning up the connection.
u32 time_now
Time measured in TCP_TSTAMP_TICK used for time stamps.
void tcp_init_snd_vars(tcp_connection_t *tc)
Initialize connection send variables.
struct tcp_configuration_ tcp_configuration_t
void tcp_connection_close(tcp_connection_t *tc)
Begin connection closing procedure.
enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e
u16 delack_time
Delayed ack time (disabled)
void tcp_reschedule(tcp_connection_t *tc)
format_function_t format_tcp_sacks
f64 end
end of the time range
void tcp_program_ack(tcp_connection_t *tc)
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.
static tcp_main_t * vnet_get_tcp_main()
u32 preallocated_connections
Number of preallocated connections.
void tcp_connection_free(tcp_connection_t *tc)
u16 timewait_time
Timer ticks to wait in time-wait.
tcp_connection_t * tcp_connection_alloc_w_base(u8 thread_index, tcp_connection_t *base)
u16 finwait2_time
Timer ticks to wait in fin-wait2 for fin.
int tcp_session_custom_tx(void *conn, transport_send_params_t *sp)
u32 * tx_buffers
tx buffer free list
vlib_node_registration_t tcp4_established_node
(constructor) VLIB_REGISTER_NODE (tcp4_established_node)