27 #define TCP_TICK 0.001 28 #define THZ (u32) (1/TCP_TICK) 29 #define TCP_TSTAMP_RESOLUTION TCP_TICK 30 #define TCP_PAWS_IDLE 24 * 24 * 60 * 60 * THZ 31 #define TCP_FIB_RECHECK_PERIOD 1 * THZ 32 #define TCP_MAX_OPTION_SPACE 40 33 #define TCP_CC_DATA_SZ 24 34 #define TCP_MAX_GSO_SZ 65536 35 #define TCP_RXT_MAX_BURST 10 37 #define TCP_DUPACK_THRESHOLD 3 38 #define TCP_IW_N_SEGMENTS 10 39 #define TCP_ALWAYS_ACK 1 40 #define TCP_USE_SACKS 1 43 #define foreach_tcp_fsm_state \ 46 _(SYN_SENT, "SYN_SENT") \ 47 _(SYN_RCVD, "SYN_RCVD") \ 48 _(ESTABLISHED, "ESTABLISHED") \ 49 _(CLOSE_WAIT, "CLOSE_WAIT") \ 50 _(FIN_WAIT_1, "FIN_WAIT_1") \ 51 _(LAST_ACK, "LAST_ACK") \ 52 _(CLOSING, "CLOSING") \ 53 _(FIN_WAIT_2, "FIN_WAIT_2") \ 54 _(TIME_WAIT, "TIME_WAIT") 56 typedef enum _tcp_state
58 #define _(sym, str) TCP_STATE_##sym, 70 #define foreach_tcp_timer \ 71 _(RETRANSMIT, "RETRANSMIT") \ 72 _(DELACK, "DELAYED ACK") \ 73 _(PERSIST, "PERSIST") \ 74 _(WAITCLOSE, "WAIT CLOSE") \ 75 _(RETRANSMIT_SYN, "RETRANSMIT SYN") \ 77 typedef enum _tcp_timers
79 #define _(sym, str) TCP_TIMER_##sym, 92 #define TCP_TIMER_HANDLE_INVALID ((u32) ~0) 94 #define TCP_TIMER_TICK 0.1 95 #define TCP_TO_TIMER_TICK TCP_TICK*10 98 #define TCP_RTO_MAX 60 * THZ 99 #define TCP_RTO_MIN 0.2 * THZ 100 #define TCP_RTT_MAX 30 * THZ 101 #define TCP_RTO_SYN_RETRIES 3 102 #define TCP_RTO_INIT 1 * THZ 103 #define TCP_RTO_BOFF_MAX 8 104 #define TCP_ESTABLISH_TIME (60 * THZ) 107 #define foreach_tcp_cfg_flag \ 108 _(RATE_SAMPLE, "Rate sampling") \ 109 _(NO_CSUM_OFFLOAD, "No csum offload") \ 110 _(NO_TSO, "TSO off") \ 115 #define _(sym, str) TCP_CFG_F_##sym##_BIT, 123 #define _(sym, str) TCP_CFG_F_##sym = 1 << TCP_CFG_F_##sym##_BIT, 130 #define foreach_tcp_connection_flag \ 131 _(SNDACK, "Send ACK") \ 132 _(FINSNT, "FIN sent") \ 133 _(RECOVERY, "Recovery") \ 134 _(FAST_RECOVERY, "Fast Recovery") \ 135 _(DCNT_PENDING, "Disconnect pending") \ 136 _(HALF_OPEN_DONE, "Half-open completed") \ 137 _(FINPNDG, "FIN pending") \ 138 _(RXT_PENDING, "Retransmit pending") \ 139 _(FRXT_FIRST, "Retransmit first") \ 140 _(DEQ_PENDING, "Dequeue pending ") \ 141 _(PSH_PENDING, "PSH pending") \ 142 _(FINRCVD, "FIN received") \ 143 _(ZERO_RWND_SENT, "Zero RWND sent") \ 147 #define _(sym, str) TCP_CONN_##sym##_BIT, 155 #define _(sym, str) TCP_CONN_##sym = 1 << TCP_CONN_##sym##_BIT, 161 #define TCP_SCOREBOARD_TRACE (0) 162 #define TCP_MAX_SACK_BLOCKS 256 163 #define TCP_INVALID_SACK_HOLE_INDEX ((u32)~0) 165 typedef struct _scoreboard_trace_elt
174 typedef struct _sack_scoreboard_hole
183 typedef struct _sack_scoreboard
189 u32 last_sacked_bytes;
190 u32 last_bytes_delivered;
200 #if TCP_SCOREBOARD_TRACE 206 #if TCP_SCOREBOARD_TRACE 207 #define tcp_scoreboard_trace_add(_tc, _ack) \ 209 static u64 _group = 0; \ 210 sack_scoreboard_t *_sb = &_tc->sack_sb; \ 211 sack_block_t *_sack, *_sacks; \ 212 scoreboard_trace_elt_t *_elt; \ 215 _sacks = _tc->rcv_opts.sacks; \ 216 for (i = 0; i < vec_len (_sacks); i++) \ 218 _sack = &_sacks[i]; \ 219 vec_add2 (_sb->trace, _elt, 1); \ 220 _elt->start = _sack->start; \ 221 _elt->end = _sack->end; \ 222 _elt->ack = _elt->end == _ack ? _ack : 0; \ 223 _elt->snd_una_max = _elt->end == _ack ? _tc->snd_una_max : 0; \ 224 _elt->group = _group; \ 228 #define tcp_scoreboard_trace_add(_tc, _ack) 233 start,
u8 have_sent_1_smss,
252 #define TCP_BTS_INVALID_INDEX ((u32)~0) 297 typedef enum _tcp_cc_algorithm_type
306 typedef enum _tcp_cc_ack_t
329 typedef struct _tcp_connection
369 u32 tsval_recent_age;
421 u32 next_node_opaque;
422 u32 limited_transmit;
441 struct _tcp_cc_algorithm
459 #define tcp_fastrecovery_on(tc) (tc)->flags |= TCP_CONN_FAST_RECOVERY 460 #define tcp_fastrecovery_off(tc) (tc)->flags &= ~TCP_CONN_FAST_RECOVERY 461 #define tcp_recovery_on(tc) (tc)->flags |= TCP_CONN_RECOVERY 462 #define tcp_recovery_off(tc) (tc)->flags &= ~TCP_CONN_RECOVERY 463 #define tcp_in_fastrecovery(tc) ((tc)->flags & TCP_CONN_FAST_RECOVERY) 464 #define tcp_in_recovery(tc) ((tc)->flags & (TCP_CONN_RECOVERY)) 465 #define tcp_in_slowstart(tc) (tc->cwnd < tc->ssthresh) 466 #define tcp_disconnect_pending(tc) ((tc)->flags & TCP_CONN_DCNT_PENDING) 467 #define tcp_disconnect_pending_on(tc) ((tc)->flags |= TCP_CONN_DCNT_PENDING) 468 #define tcp_disconnect_pending_off(tc) ((tc)->flags &= ~TCP_CONN_DCNT_PENDING) 469 #define tcp_fastrecovery_first(tc) ((tc)->flags & TCP_CONN_FRXT_FIRST) 470 #define tcp_fastrecovery_first_on(tc) ((tc)->flags |= TCP_CONN_FRXT_FIRST) 471 #define tcp_fastrecovery_first_off(tc) ((tc)->flags &= ~TCP_CONN_FRXT_FIRST) 473 #define tcp_in_cong_recovery(tc) ((tc)->flags & \ 474 (TCP_CONN_FAST_RECOVERY | TCP_CONN_RECOVERY)) 476 #define tcp_csum_offload(tc) (!((tc)->cfg_flags & TCP_CFG_F_NO_CSUM_OFFLOAD)) 481 tc->flags &= ~(TCP_CONN_FAST_RECOVERY | TCP_CONN_RECOVERY);
485 #define tcp_zero_rwnd_sent(tc) ((tc)->flags & TCP_CONN_ZERO_RWND_SENT) 486 #define tcp_zero_rwnd_sent_on(tc) (tc)->flags |= TCP_CONN_ZERO_RWND_SENT 487 #define tcp_zero_rwnd_sent_off(tc) (tc)->flags &= ~TCP_CONN_ZERO_RWND_SENT 489 typedef enum _tcp_error
491 #define tcp_error(n,s) TCP_ERROR_##n, 497 typedef struct _tcp_lookup_dispatch
509 tw_timer_wheel_16t_2w_512sl_t timer_wheel;
518 u32 *pending_deq_acked;
521 u32 *pending_disconnects;
553 u16 initial_cwnd_multiplier;
566 u32 rwnd_min_update_ack;
593 u32 preallocated_connections;
596 u32 preallocated_half_open_connections;
603 f64 buffer_fail_fraction;
606 typedef struct _tcp_main
617 u8 log2_tstamp_clocks_per_tick;
618 f64 tstamp_ticks_per_clock;
628 u32 bytes_per_buffer;
637 uword *cc_algo_by_name;
652 u32 last_v4_addr_rotor;
655 u32 last_v6_addr_rotor;
675 #define tcp_cfg tcp_main.cfg 676 #define tcp_node_index(node_id, is_ip4) \ 677 ((is_ip4) ? tcp4_##node_id##_node.index : tcp6_##node_id##_node.index) 688 return &
tcp_main.wrk_ctx[thread_index];
699 #if (VLIB_BUFFER_TRACE_TRAJECTORY) 700 #define tcp_trajectory_add_start(b, start) \ 702 (*vlib_buffer_trace_trajectory_cb) (b, start); \ 705 #define tcp_trajectory_add_start(b, start) 724 if (
tcp_main.connections[thread_index] == 0)
741 TCP_EVT (TCP_EVT_STATE_CHANGE, tc);
783 u32 thread_index,
u8 is_ip4);
866 #define seq_lt(_s1, _s2) ((i32)((_s1)-(_s2)) < 0) 867 #define seq_leq(_s1, _s2) ((i32)((_s1)-(_s2)) <= 0) 868 #define seq_gt(_s1, _s2) ((i32)((_s1)-(_s2)) > 0) 869 #define seq_geq(_s1, _s2) ((i32)((_s1)-(_s2)) >= 0) 870 #define seq_max(_s1, _s2) (seq_gt((_s1), (_s2)) ? (_s1) : (_s2)) 873 #define timestamp_lt(_t1, _t2) ((i32)((_t1)-(_t2)) < 0) 874 #define timestamp_leq(_t1, _t2) ((i32)((_t1)-(_t2)) <= 0) 883 return tc->sack_sb.sacked_bytes + tc->sack_sb.lost_bytes;
885 return clib_min (tc->rcv_dupacks * tc->snd_mss,
886 tc->snd_nxt - tc->snd_una);
897 flight_size = (int) (tc->snd_nxt - tc->snd_una) -
tcp_bytes_out (tc)
898 + tc->snd_rxt_bytes - tc->rxt_delivered;
900 ASSERT (flight_size >= 0);
911 if (
tcp_cfg.initial_cwnd_multiplier > 0)
912 return tcp_cfg.initial_cwnd_multiplier * tc->snd_mss;
914 if (tc->snd_mss > 2190)
915 return 2 * tc->snd_mss;
916 else if (tc->snd_mss > 1095)
917 return 3 * tc->snd_mss;
919 return 4 * tc->snd_mss;
931 tc->cwnd_acc_bytes += bytes;
932 if (tc->cwnd_acc_bytes >= thresh)
934 u32 inc = tc->cwnd_acc_bytes / thresh;
935 tc->cwnd_acc_bytes -= inc * thresh;
936 tc->cwnd += inc * tc->snd_mss;
937 tc->cwnd =
clib_min (tc->cwnd, tc->tx_fifo_size);
951 return clib_min (tc->cwnd, tc->snd_wnd);
958 int flight_size = (int) (tc->snd_nxt - tc->snd_una);
960 if (available_wnd <= flight_size)
963 return available_wnd - flight_size;
975 if (available_wnd <= flight_size)
978 return available_wnd - flight_size;
984 if ((tc->flags & TCP_CONN_FINSNT) && (tc->snd_una_max - tc->snd_una == 1))
1007 return tcp_main.wrk_ctx[thread_index].time_now;
1016 return (
tcp_main.wrk_ctx[tc->c_thread_index].time_now -
1017 tc->timestamp_delta);
1048 tc->cc_algo->rcv_ack (tc, rs);
1049 tc->tsecr_last_ack = tc->rcv_opts.tsecr;
1056 tc->cc_algo->rcv_cong_ack (tc, ack_type, rs);
1062 tc->cc_algo->congestion (tc);
1068 tc->cc_algo->loss (tc);
1074 tc->cc_algo->recovered (tc);
1080 if (tc->cc_algo->undo_recovery)
1081 tc->cc_algo->undo_recovery (tc);
1087 if (tc->cc_algo->event)
1088 tc->cc_algo->event (tc, evt);
1094 if (tc->cc_algo->get_pacing_rate)
1095 return tc->cc_algo->get_pacing_rate (tc);
1101 return ((
f64) tc->cwnd / srtt);
1109 tc->timers[timer_id] =
1110 tw_timer_start_16t_2w_512sl (&
tcp_main.
1111 wrk_ctx[tc->c_thread_index].timer_wheel,
1112 tc->c_c_index, timer_id, interval);
1122 tw_timer_stop_16t_2w_512sl (&
tcp_main.
1123 wrk_ctx[tc->c_thread_index].timer_wheel,
1124 tc->timers[timer_id]);
1133 tw_timer_update_16t_2w_512sl (&
tcp_main.
1134 wrk_ctx[tc->c_thread_index].timer_wheel,
1135 tc->timers[timer_id], interval);
1137 tc->timers[timer_id] =
1138 tw_timer_start_16t_2w_512sl (&
tcp_main.
1139 wrk_ctx[tc->c_thread_index].timer_wheel,
1140 tc->c_c_index, timer_id, interval);
1146 ASSERT (tc->snd_una != tc->snd_una_max);
1177 if (
seq_leq (tc->snd_una, tc->snd_congestion + tc->burst_acked))
1194 if (tc->snd_una == tc->snd_nxt)
1197 if (tc->snd_wnd < tc->snd_mss)
1211 #define tcp_validate_txf_size(_tc, _a) \ 1212 ASSERT(_tc->state != TCP_STATE_ESTABLISHED \ 1213 || transport_max_tx_dequeue (&_tc->connection) >= _a) 1230 static inline void *
1233 return (
void *) tc->cc_data;
1265 th->seq_number = seq;
1266 th->ack_number = ack;
1267 th->data_offset_and_reserved = (tcp_hdr_opts_len >> 2) << 4;
1271 th->urgent_pointer = 0;
1273 b->
flags |= VNET_BUFFER_F_L4_HDR_OFFSET_VALID;
1296 clib_host_to_net_u32 (seq),
1297 clib_host_to_net_u32 (ack),
1298 tcp_hdr_opts_len, flags,
1299 clib_host_to_net_u16 (wnd));
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
enum tcp_connection_flag_ tcp_connection_flags_e
#define foreach_tcp_cfg_flag
Connection configuration flags.
void() timer_expiration_handler(u32 index, u32 thread_index)
vlib_node_registration_t tcp6_listen_node
(constructor) VLIB_REGISTER_NODE (tcp6_listen_node)
void tcp_program_retransmit(tcp_connection_t *tc)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
void tcp_send_window_update_ack(tcp_connection_t *tc)
Send window update ack.
void scoreboard_clear(sack_scoreboard_t *sb)
static f64 tcp_time_now_us(u32 thread_index)
static void tcp_retransmit_timer_set(tcp_connection_t *tc)
static clib_time_type_t transport_time_now(u32 thread_index)
#define seq_leq(_s1, _s2)
void tcp_make_fin(tcp_connection_t *tc, vlib_buffer_t *b)
Convert buffer to FIN-ACK.
struct _sack_block sack_block_t
struct _scoreboard_trace_elt scoreboard_trace_elt_t
void tcp_connection_timers_reset(tcp_connection_t *tc)
Stop all connection timers.
#define TCP_TO_TIMER_TICK
Factor for converting ticks to timer ticks.
vlib_node_registration_t tcp4_output_node
(constructor) VLIB_REGISTER_NODE (tcp4_output_node)
void scoreboard_init(sack_scoreboard_t *sb)
static u32 tcp_bytes_out(const tcp_connection_t *tc)
Our estimate of the number of bytes that have left the network.
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
static tcp_connection_t * tcp_connection_get_if_valid(u32 conn_index, u32 thread_index)
void tcp_connection_del(tcp_connection_t *tc)
Connection removal.
struct _sack_scoreboard sack_scoreboard_t
void tcp_update_sack_list(tcp_connection_t *tc, u32 start, u32 end)
Build SACK list as per RFC2018.
enum tcp_bts_flags_ tcp_bts_flags_t
u32 tcp_snd_space(tcp_connection_t *tc)
int tcp_bt_is_sane(tcp_byte_tracker_t *bt)
Check if the byte tracker is in sane state.
static tcp_connection_t * tcp_half_open_connection_get(u32 conn_index)
sack_scoreboard_hole_t * scoreboard_last_hole(sack_scoreboard_t *sb)
sack_scoreboard_hole_t * scoreboard_next_hole(sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
#define VLIB_BUFFER_PRE_DATA_SIZE
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
struct _tcp_main tcp_main_t
vlib_node_registration_t tcp6_output_node
(constructor) VLIB_REGISTER_NODE (tcp6_output_node)
static u64 clib_cpu_time_now(void)
timer_expiration_handler tcp_timer_retransmit_handler
u8 * format_tcp_scoreboard(u8 *s, va_list *args)
u32 tcp_session_push_header(transport_connection_t *tconn, vlib_buffer_t *b)
struct _tcp_lookup_dispatch tcp_lookup_dispatch_t
void tcp_connection_tx_pacer_update(tcp_connection_t *tc)
enum tcp_cc_event_ tcp_cc_event_t
void tcp_update_burst_snd_vars(tcp_connection_t *tc)
Update burst send vars.
struct _tcp_connection tcp_connection_t
static u32 tcp_available_cc_snd_space(const tcp_connection_t *tc)
Estimate of how many bytes we can still push into the network.
static u32 tcp_available_snd_wnd(const tcp_connection_t *tc)
static tcp_connection_t * tcp_get_connection_from_transport(transport_connection_t *tconn)
void tcp_connection_cleanup(tcp_connection_t *tc)
Cleans up connection state.
format_function_t format_tcp_flags
struct _tcp_header tcp_header_t
void tcp_connection_reset(tcp_connection_t *tc)
Notify session that connection has been reset.
struct _sack_scoreboard_hole sack_scoreboard_hole_t
vlib_node_registration_t tcp4_syn_sent_node
(constructor) VLIB_REGISTER_NODE (tcp4_syn_sent_node)
#define TCP_TICK
TCP tick period (s)
u8 * tcp_scoreboard_replay(u8 *s, tcp_connection_t *tc, u8 verbose)
static void tcp_connection_set_state(tcp_connection_t *tc, tcp_state_t state)
vl_api_interface_index_t sw_if_index
sack_scoreboard_hole_t * scoreboard_get_hole(sack_scoreboard_t *sb, u32 index)
struct tcp_bt_sample_ tcp_bt_sample_t
static u32 tcp_available_output_snd_space(const tcp_connection_t *tc)
static void tcp_cc_loss(tcp_connection_t *tc)
static tcp_header_t * tcp_buffer_hdr(vlib_buffer_t *b)
enum _tcp_state tcp_state_t
vhost_vring_state_t state
timer_expiration_handler tcp_timer_retransmit_syn_handler
static u32 tcp_time_now(void)
static ct_connection_t * connections
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.
void tcp_api_reference(void)
struct tcp_byte_tracker_ tcp_byte_tracker_t
static void tcp_timer_set(tcp_connection_t *tc, u8 timer_id, u32 interval)
static heap_elt_t * first(heap_header_t *h)
vl_api_fib_path_type_t type
struct tcp_worker_ctx_ tcp_worker_ctx_t
enum tcp_cfg_flag_bits_ tcp_cfg_flag_bits_e
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void tcp_bt_init(tcp_connection_t *tc)
Byte tracker initialize.
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)
u32 tcp_sack_list_bytes(tcp_connection_t *tc)
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.
int tcp_fastrecovery_prr_snd_space(tcp_connection_t *tc)
Estimate send space using proportional rate reduction (RFC6937)
void tcp_rcv_sacks(tcp_connection_t *tc, u32 ack)
clib_error_t * vnet_tcp_enable_disable(vlib_main_t *vm, u8 is_en)
void tcp_send_syn(tcp_connection_t *tc)
Send SYN.
static void * tcp_cc_data(tcp_connection_t *tc)
enum tcp_connection_flag_bits_ tcp_connection_flag_bits_e
sack_scoreboard_hole_t * scoreboard_prev_hole(sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
static void cleanup(void)
#define TCP_TIMER_HANDLE_INVALID
static void tcp_cc_rcv_cong_ack(tcp_connection_t *tc, tcp_cc_ack_t ack_type, tcp_rate_sample_t *rs)
static u32 tcp_flight_size(const tcp_connection_t *tc)
Our estimate of the number of bytes in flight (pipe size)
tcp_connection_t * tcp_connection_alloc(u8 thread_index)
void tcp_connection_tx_pacer_reset(tcp_connection_t *tc, u32 window, u32 start_bucket)
void tcp_cc_algo_register(tcp_cc_algorithm_type_e type, const tcp_cc_algorithm_t *vft)
Register exiting cc algo type.
enum _tcp_cc_ack_t tcp_cc_ack_t
static void tcp_cwnd_accumulate(tcp_connection_t *tc, u32 thresh, u32 bytes)
void newreno_rcv_cong_ack(tcp_connection_t *tc, tcp_cc_ack_t ack_type, tcp_rate_sample_t *rs)
static void tcp_timer_reset(tcp_connection_t *tc, u8 timer_id)
vlib_node_registration_t tcp4_listen_node
(constructor) VLIB_REGISTER_NODE (tcp4_listen_node)
void scoreboard_init_rxt(sack_scoreboard_t *sb, u32 snd_una)
tcp_connection_flag_bits_
enum _tcp_error tcp_error_t
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.
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 scoreboard_clear_reneging(sack_scoreboard_t *sb, u32 start, u32 end)
static_always_inline uword vlib_get_thread_index(void)
void tcp_program_dupack(tcp_connection_t *tc)
void tcp_send_reset(tcp_connection_t *tc)
Build and set reset packet for connection.
static u32 tcp_tstamp(tcp_connection_t *tc)
Generate timestamp for tcp connection.
void tcp_punt_unknown(vlib_main_t *vm, u8 is_ip4, u8 is_add)
format_function_t format_tcp_state
static void tcp_cc_undo_recovery(tcp_connection_t *tc)
enum _tcp_timers tcp_timers_e
void tcp_bt_track_tx(tcp_connection_t *tc, u32 len)
Track a tcp tx burst.
struct _transport_connection transport_connection_t
int tcp_half_open_connection_cleanup(tcp_connection_t *tc)
Try to cleanup half-open connection.
u8 * format_tcp_bt(u8 *s, va_list *args)
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.
void tcp_make_synack(tcp_connection_t *ts, vlib_buffer_t *b)
Convert buffer to SYN-ACK.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
format_function_t format_tcp_rcv_sacks
u8 * format_tcp_connection_id(u8 *s, va_list *args)
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)
void tcp_send_synack(tcp_connection_t *tc)
static void tcp_timer_update(tcp_connection_t *tc, u8 timer_id, u32 interval)
enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e
struct tcp_rate_sample_ tcp_rate_sample_t
void tcp_flush_frames_to_output(tcp_worker_ctx_t *wrk)
Flush v4 and v6 tcp and ip-lookup tx frames for thread index.
void tcp_connection_init_vars(tcp_connection_t *tc)
Initialize tcp connection variables.
void tcp_bt_sample_delivery_rate(tcp_connection_t *tc, tcp_rate_sample_t *rs)
Generate a delivery rate sample from recently acked bytes.
vlib_node_registration_t tcp4_rcv_process_node
(constructor) VLIB_REGISTER_NODE (tcp4_rcv_process_node)
u8 * format_tcp_connection(u8 *s, va_list *args)
static u32 tcp_end_seq(tcp_header_t *th, u32 len)
vlib_node_registration_t tcp6_established_node
(constructor) VLIB_REGISTER_NODE (tcp6_established_node)
#define tcp_fastrecovery_first_off(tc)
struct _tcp_cc_algorithm tcp_cc_algorithm_t
static u32 tcp_time_now_w_thread(u32 thread_index)
struct _vlib_node_registration vlib_node_registration_t
struct tcp_iss_seed_ tcp_iss_seed_t
static void tcp_persist_timer_update(tcp_connection_t *tc)
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.
static void * vlib_buffer_push_uninit(vlib_buffer_t *b, u8 size)
Prepend uninitialized data to buffer.
void tcp_bt_check_app_limited(tcp_connection_t *tc)
Check if sample to be generated is app limited.
vlib_node_registration_t tcp4_input_node
(constructor) VLIB_REGISTER_NODE (tcp4_input_node)
tcp_cc_algorithm_t * tcp_cc_algo_get(tcp_cc_algorithm_type_e type)
static u32 tcp_initial_cwnd(const tcp_connection_t *tc)
Initial cwnd as per RFC5681.
vlib_node_registration_t tcp6_rcv_process_node
(constructor) VLIB_REGISTER_NODE (tcp6_rcv_process_node)
#define foreach_tcp_fsm_state
TCP FSM state definitions as per RFC793.
void tcp_send_fin(tcp_connection_t *tc)
Send FIN.
#define foreach_tcp_connection_flag
TCP connection flags.
#define foreach_tcp_timer
TCP timers.
static u8 tcp_is_lost_fin(tcp_connection_t *tc)
static void tcp_cc_rcv_ack(tcp_connection_t *tc, tcp_rate_sample_t *rs)
sack_scoreboard_hole_t * scoreboard_first_hole(sack_scoreboard_t *sb)
static tcp_worker_ctx_t * tcp_get_worker(u32 thread_index)
static void tcp_retransmit_timer_update(tcp_connection_t *tc)
VLIB buffer representation.
static void tcp_cc_recovered(tcp_connection_t *tc)
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.
static void tcp_retransmit_timer_force_update(tcp_connection_t *tc)
static tcp_connection_t * tcp_connection_get(u32 conn_index, u32 thread_index)
static void tcp_cc_event(tcp_connection_t *tc, tcp_cc_event_t evt)
void tcp_update_rto(tcp_connection_t *tc)
format_function_t format_tcp_sacks
tcp_cc_algorithm_type_e tcp_cc_algo_new_type(const tcp_cc_algorithm_t *vft)
Register new cc algo type.
void tcp_program_ack(tcp_connection_t *tc)
#define tcp_opts_sack_permitted(_to)
static u32 tcp_loss_wnd(const tcp_connection_t *tc)
struct tcp_errors_ tcp_errors_t
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 u64 tcp_cc_get_pacing_rate(tcp_connection_t *tc)
static void tcp_persist_timer_set(tcp_connection_t *tc)
static tcp_main_t * vnet_get_tcp_main()
static void tcp_cong_recovery_off(tcp_connection_t *tc)
timer_expiration_handler tcp_timer_delack_handler
void tcp_connection_free(tcp_connection_t *tc)
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
static void tcp_retransmit_timer_reset(tcp_connection_t *tc)
tcp_connection_t * tcp_connection_alloc_w_base(u8 thread_index, tcp_connection_t *base)
static u32 tcp_set_time_now(tcp_worker_ctx_t *wrk)
void tcp_bt_track_rxt(tcp_connection_t *tc, u32 start, u32 end)
Track a tcp retransmission.
enum tcp_cfg_flag_ tcp_cfg_flags_e
void tcp_bt_flush_samples(tcp_connection_t *tc)
Flush byte tracker samples.
static u8 tcp_timer_is_active(tcp_connection_t *tc, tcp_timers_e timer)
void tcp_bt_cleanup(tcp_connection_t *tc)
Byte tracker cleanup.
static void tcp_cc_congestion(tcp_connection_t *tc)
static tcp_connection_t * tcp_listener_get(u32 tli)
vlib_node_registration_t tcp4_established_node
(constructor) VLIB_REGISTER_NODE (tcp4_established_node)
static void tcp_persist_timer_reset(tcp_connection_t *tc)
#define TCP_EVT(_evt, _args...)
int tcp_session_custom_tx(void *conn, u32 max_burst_size)