64 .sw_if_index = tc->sw_if_index,
74 tc->cc_algo->init (tc);
80 if (tc->cc_algo->cleanup)
81 tc->cc_algo->cleanup (tc);
91 tm->cc_algos[
type] = *vft;
99 return &tm->cc_algos[
type];
107 return tm->cc_last_type;
117 pool_get (tm->listener_pool, listener);
120 listener->c_c_index = listener - tm->listener_pool;
121 listener->c_lcl_port = lcl->port;
128 ip_set (&lcl->ip, iface_ip, lcl->is_ip4);
130 ip_copy (&listener->c_lcl_ip, &lcl->ip, lcl->is_ip4);
131 listener->c_is_ip4 = lcl->is_ip4;
132 listener->c_proto = TRANSPORT_PROTO_TCP;
133 listener->c_s_index = session_index;
134 listener->c_fib_index = lcl->fib_index;
135 listener->state = TCP_STATE_LISTEN;
140 TCP_EVT (TCP_EVT_BIND, listener);
142 return listener->c_c_index;
181 return &tc->connection;
195 pool_put (tm->half_open_connections, tc);
230 pool_get (tm->half_open_connections, tc);
232 tc->c_c_index = tc - tm->half_open_connections;
247 if (!(tc->cfg_flags & TCP_CFG_F_NO_ENDPOINT))
252 if (tc->state == TCP_STATE_SYN_SENT)
258 tc->flags |= TCP_CONN_HALF_OPEN_DONE;
274 if (tc->cfg_flags & TCP_CFG_F_RATE_SAMPLE)
304 tc->c_thread_index = thread_index;
317 tc->c_thread_index = thread_index;
369 case TCP_STATE_SYN_SENT:
374 case TCP_STATE_SYN_RCVD:
381 case TCP_STATE_ESTABLISHED:
396 tc->flags |= TCP_CONN_FINPNDG;
404 case TCP_STATE_CLOSE_WAIT:
414 tc->flags |= TCP_CONN_FINPNDG;
416 case TCP_STATE_FIN_WAIT_1:
420 case TCP_STATE_CLOSED:
424 TCP_DBG (
"state: %u", tc->state);
503 typedef struct ip4_tcp_hdr
509 typedef struct ip6_tcp_hdr
528 hdr.ip.protocol = IP_PROTOCOL_TCP;
529 hdr.ip.address_pair.src.as_u32 = tc->c_lcl_ip.ip4.as_u32;
530 hdr.ip.address_pair.dst.as_u32 = tc->c_rmt_ip.ip4.as_u32;
531 hdr.tcp.src_port = tc->c_lcl_port;
532 hdr.tcp.dst_port = tc->c_rmt_port;
539 hdr.ip.protocol = IP_PROTOCOL_TCP;
541 sizeof (ip6_address_t));
543 sizeof (ip6_address_t));
544 hdr.tcp.src_port = tc->c_lcl_port;
545 hdr.tcp.dst_port = tc->c_rmt_port;
560 prefix.
fp_len = tc->c_is_ip4 ? 32 : 128;
569 u32 output_node_index;
576 tcp_connection_select_lb_bucket (tc, &fe->
fe_lb, &choice);
595 tcp_connection_stack_on_fib_entry (tc);
609 tmp = (
u64) tc->c_lcl_ip.ip4.as_u32 << 32 | (
u64) tc->c_rmt_ip.ip4.as_u32;
611 tmp = tc->c_lcl_ip.ip6.as_u64[0] ^ tc->c_lcl_ip.ip6.as_u64[1]
612 ^ tc->c_rmt_ip.ip6.as_u64[0] ^ tc->c_rmt_ip.ip6.as_u64[1];
614 tmp ^= tm->iss_seed.first | ((
u64) tc->c_lcl_port << 16 | tc->c_rmt_port);
615 tmp ^= tm->iss_seed.second;
617 return ((tmp >> 32) ^ (tmp & 0xffffffff));
643 u16 default_min_mss = 536;
648 tc->snd_mss =
clib_min (tc->rcv_opts.mss, tc->mss);
650 if (tc->snd_mss < 45)
653 tc->snd_mss = default_min_mss;
654 tc->rcv_opts.mss = default_min_mss;
658 ASSERT (tc->snd_mss > 45);
681 tc->snd_una = tc->iss;
682 tc->snd_nxt = tc->iss + 1;
683 tc->srtt = 0.1 *
THZ;
686 tc->cfg_flags |= TCP_CFG_F_NO_CSUM_OFFLOAD;
693 byte_rate = tc->cwnd / (tc->srtt *
TCP_TICK);
695 tc->mrtt_us = (
u32) ~ 0;
708 if (tc->state == TCP_STATE_SYN_RCVD)
722 if (tc->cfg_flags & TCP_CFG_F_RATE_SAMPLE)
726 tc->cfg_flags |= TCP_CFG_F_NO_TSO;
733 u16 * lcl_port,
u8 is_ip4)
738 index = tm->last_v4_addr_rotor++;
740 tm->last_v4_addr_rotor = 0;
741 lcl_addr->ip4.as_u32 =
tcp_cfg.ip4_src_addrs[
index].as_u32;
745 index = tm->last_v6_addr_rotor++;
747 tm->last_v6_addr_rotor = 0;
749 sizeof (ip6_address_t));
753 return SESSION_E_NOPORT;
763 ip46_address_t lcl_addr;
776 rmt, &lcl_addr, &lcl_port);
780 if (rv != SESSION_E_PORTINUSE)
784 lcl_port, rmt->port, TRANSPORT_PROTO_UDP,
786 return SESSION_E_PORTINUSE;
799 ip_copy (&tc->c_rmt_ip, &rmt->ip, rmt->is_ip4);
800 ip_copy (&tc->c_lcl_ip, &lcl_addr, rmt->is_ip4);
801 tc->c_rmt_port = rmt->port;
802 tc->c_lcl_port = clib_host_to_net_u16 (lcl_port);
803 tc->c_is_ip4 = rmt->is_ip4;
804 tc->c_proto = TRANSPORT_PROTO_TCP;
805 tc->c_fib_index = rmt->fib_index;
812 tc->state = TCP_STATE_SYN_SENT;
817 return tc->c_c_index;
823 u32 tci = va_arg (*args,
u32);
824 u32 thread_index = va_arg (*args,
u32);
825 u32 verbose = va_arg (*args,
u32);
832 s =
format (s,
"empty\n");
839 u32 tci = va_arg (*args,
u32);
840 u32 __clib_unused thread_index = va_arg (*args,
u32);
841 u32 verbose = va_arg (*args,
u32);
853 u32 tci = va_arg (*args,
u32);
854 u32 __clib_unused thread_index = va_arg (*args,
u32);
865 return &tc->connection;
872 return &tc->connection;
878 u16 goal_size = tc->snd_mss;
880 goal_size =
tcp_cfg.max_gso_size - tc->snd_mss %
tcp_cfg.max_gso_size;
881 goal_size =
clib_min (goal_size, tc->snd_wnd / 2);
883 return goal_size > tc->snd_mss ? goal_size : tc->snd_mss;
891 return tc->snd_wnd <= snd_space ? tc->snd_wnd : 0;
897 return snd_space < tc->cwnd ? 0 : snd_space;
900 return snd_space - (snd_space % tc->snd_mss);
922 || tc->state == TCP_STATE_CLOSED))
931 if (
PREDICT_FALSE (tc->rcv_dupacks || tc->sack_sb.sacked_bytes))
933 int snt_limited, n_pkts;
936 ? tc->sack_sb.reorder - 1 : 2;
938 if ((
seq_lt (tc->limited_transmit, tc->snd_nxt - n_pkts * tc->snd_mss)
939 ||
seq_gt (tc->limited_transmit, tc->snd_nxt)))
940 tc->limited_transmit = tc->snd_nxt;
944 snt_limited = tc->snd_nxt - tc->limited_transmit;
945 snd_space =
clib_max (n_pkts * tc->snd_mss - snt_limited, 0);
973 tc->snd_wnd - (tc->snd_nxt - tc->snd_una));
977 sp->
tx_offset = tc->snd_nxt - tc->snd_una;
991 case TCP_STATE_CLOSE_WAIT:
994 if (!(tc->flags & TCP_CONN_FINPNDG))
1006 tc->snd_nxt = tc->snd_una;
1018 case TCP_STATE_FIN_WAIT_1:
1020 if (tc->flags & TCP_CONN_FINPNDG)
1038 case TCP_STATE_LAST_ACK:
1045 case TCP_STATE_CLOSING:
1052 case TCP_STATE_FIN_WAIT_2:
1060 case TCP_STATE_TIME_WAIT:
1083 u32 n_timers, connection_index, timer_id, thread_index, timer_handle;
1094 connection_index = timer_handle & 0x0FFFFFFF;
1095 timer_id = timer_handle >> 28;
1097 if (
PREDICT_TRUE (timer_id != TCP_TIMER_RETRANSMIT_SYN))
1107 if (
PREDICT_FALSE (!(tc->pending_timers & (1 << timer_id))))
1110 tc->pending_timers &= ~(1 << timer_id);
1159 if (tc->flags & TCP_CONN_PSH_PENDING)
1161 tc->flags |= TCP_CONN_PSH_PENDING;
1186 .transport_options = {
1230 u32 connection_index, timer_id, n_expired, max_loops;
1236 n_expired =
vec_len (expired_timers);
1244 for (i = 0; i < n_expired; i++)
1246 connection_index = expired_timers[
i] & 0x0FFFFFFF;
1247 timer_id = expired_timers[
i] >> 28;
1249 if (timer_id != TCP_TIMER_RETRANSMIT_SYN)
1254 TCP_EVT (TCP_EVT_TIMER_POP, connection_index, timer_id);
1257 tc->pending_timers |= (1 << timer_id);
1263 max_per_loop =
clib_max ((n_left + n_expired) / max_loops, 10);
1268 if (thread_index == 0)
1278 tm->iss_seed.first = (
u64)
random_u32 (&default_seed) << 32;
1279 tm->iss_seed.second =
random_u64 (&time_now);
1286 u32 num_threads, n_workers, prealloc_conn_per_wrk;
1313 n_workers = num_threads == 1 ? 1 : vtm->
n_threads;
1314 prealloc_conn_per_wrk =
tcp_cfg.preallocated_connections / n_workers;
1316 wrk = &tm->wrk_ctx[0];
1322 for (thread = 0; thread < num_threads; thread++)
1324 wrk = &tm->wrk_ctx[
thread];
1345 if ((thread > 0 || num_threads == 1) && prealloc_conn_per_wrk)
1356 if (
tcp_cfg.preallocated_half_open_connections)
1358 tcp_cfg.preallocated_half_open_connections);
1360 if (num_threads > 1)
1400 tm->punt_unknown4 = is_add;
1402 tm->punt_unknown6 = is_add;
1414 tcp_cfg.max_rx_fifo = 32 << 20;
1415 tcp_cfg.min_rx_fifo = 4 << 10;
1418 tcp_cfg.initial_cwnd_multiplier = 0;
1423 tcp_cfg.rwnd_min_update_ack = 1;
1427 tcp_cfg.closewait_time = 20000;
1428 tcp_cfg.timewait_time = 100000;
1429 tcp_cfg.finwait1_time = 600000;
1430 tcp_cfg.lastack_time = 300000;
1431 tcp_cfg.finwait2_time = 300000;
1432 tcp_cfg.closing_time = 300000;
static void tcp_session_close(u32 conn_index, u32 thread_index)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
#define SESSION_CLI_STATE_LEN
void dpo_stack_from_node(u32 child_node_index, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child parent relationship.
fib_protocol_t fp_proto
protocol type
#define ENDPOINT_INVALID_INDEX
static void tcp_handle_cleanups(tcp_worker_ctx_t *wrk, clib_time_type_t now)
static void tcp_add_del_adjacency(tcp_connection_t *tc, u8 is_add)
#define TCP_TIMER_HANDLE_INVALID
#define clib_fifo_head(v)
static void tcp_half_open_connection_free(tcp_connection_t *tc)
Cleanup half-open connection.
static u8 * format_tcp_listener_session(u8 *s, va_list *args)
tcp_cleanup_req_t * pending_cleanups
u32 * pending_disconnects
vector of pending disconnect notifications
void ip_copy(ip46_address_t *dst, ip46_address_t *src, u8 is_ip4)
static clib_time_type_t transport_time_now(u32 thread_index)
static uword random_default_seed(void)
Default random seed (unix/linux user-mode)
void ip6_register_protocol(u32 protocol, u32 node_index)
#define clib_fifo_sub2(f, p)
static tcp_connection_t * tcp_connection_get(u32 conn_index, u32 thread_index)
static uword clib_fifo_elts(void *v)
static clib_error_t * ip4_lookup_init(vlib_main_t *vm)
void session_queue_run_on_main_thread(vlib_main_t *vm)
vlib_node_registration_t tcp4_output_node
(constructor) VLIB_REGISTER_NODE (tcp4_output_node)
#define THZ
TCP tick frequency.
void transport_share_local_endpoint(u8 proto, ip46_address_t *lcl_ip, u16 port)
#define tcp_opts_tstamp(_to)
static transport_connection_t * tcp_half_open_session_get_transport(u32 conn_index)
static u32 ip4_compute_flow_hash(const ip4_header_t *ip, flow_hash_config_t flow_hash_config)
void * ip_interface_get_first_ip(u32 sw_if_index, u8 is_ip4)
void ip_set(ip46_address_t *dst, void *src, u8 is_ip4)
#define clib_memcpy_fast(a, b, c)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void session_transport_delete_notify(transport_connection_t *tc)
Notification from transport that connection is being deleted.
static int tcp_alloc_custom_local_endpoint(tcp_main_t *tm, ip46_address_t *lcl_addr, u16 *lcl_port, u8 is_ip4)
static f64 vlib_time_now(vlib_main_t *vm)
static tcp_connection_t * tcp_half_open_connection_new(void)
flow_hash_config_t lb_hash_config
the hash config to use when selecting a bucket.
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
struct _tcp_main tcp_main_t
void tcp_connection_timers_reset(tcp_connection_t *tc)
Stop all connection timers.
struct _tcp_connection tcp_connection_t
vlib_node_registration_t tcp6_output_node
(constructor) VLIB_REGISTER_NODE (tcp6_output_node)
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
static u64 clib_cpu_time_now(void)
static u32 tcp_set_time_now(tcp_worker_ctx_t *wrk)
timer_expiration_handler tcp_timer_retransmit_handler
static u64 clib_xxhash(u64 key)
u32 tcp_session_push_header(transport_connection_t *tconn, vlib_buffer_t *b)
u32 * pending_resets
vector of pending reset notifications
void tcp_update_burst_snd_vars(tcp_connection_t *tc)
Update burst send vars.
#define hash_set_mem(h, key, value)
#define TCP_TICK
TCP tick period (s)
static u64 random_u64(u64 *seed)
64-bit random number generator Again, constants courtesy of Donald Knuth.
static void tcp_initialize_iss_seed(tcp_main_t *tm)
void ip4_register_protocol(u32 protocol, u32 node_index)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
struct _tcp_header tcp_header_t
int tcp_half_open_connection_cleanup(tcp_connection_t *tc)
Try to cleanup half-open connection.
vlib_node_registration_t session_queue_node
(constructor) VLIB_REGISTER_NODE (session_queue_node)
vlib_main_t ** vlib_mains
#define tcp_in_cong_recovery(tc)
u32 * pending_deq_acked
vector of pending ack dequeues
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
tcp_cc_algorithm_t * tcp_cc_algo_get(tcp_cc_algorithm_type_e type)
tcp_connection_t * connections
worker's pool of connections
struct _tcp_cc_algorithm tcp_cc_algorithm_t
unformat_function_t * unformat_pg_edit
format_function_t format_tcp_connection
void tcp_init_snd_vars(tcp_connection_t *tc)
Initialize connection send variables.
#define VLIB_INIT_FUNCTION(x)
u16 lb_n_buckets_minus_1
number of buckets in the load-balance - 1.
void tcp_connection_timers_init(tcp_connection_t *tc)
Initialize all connection timers as invalid.
#define seq_leq(_s1, _s2)
description fragment has unexpected format
static void tcp_connection_unbind(u32 listener_index)
Aggregate type for a prefix.
#define clib_error_return(e, args...)
void() timer_expiration_handler(tcp_connection_t *tc)
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
timer_expiration_handler tcp_timer_retransmit_syn_handler
pthread_t thread[MAX_CONNS]
int transport_alloc_local_endpoint(u8 proto, transport_endpoint_cfg_t *rmt_cfg, ip46_address_t *lcl_addr, u16 *lcl_port)
void session_half_open_delete_notify(transport_proto_t tp, session_handle_t ho_handle)
u32 tcp_snd_space(tcp_connection_t *tc)
static void tcp_timer_reset(tcp_timer_wheel_t *tw, tcp_connection_t *tc, u8 timer_id)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
u16 fp_len
The mask length.
#define vlib_call_init_function(vm, x)
fib_node_index_t fib_table_lookup(u32 fib_index, const fib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
static u32 tcp_connection_bind(u32 session_index, transport_endpoint_t *lcl)
#define hash_create_string(elts, value_bytes)
static void tcp_timer_set(tcp_timer_wheel_t *tw, tcp_connection_t *tc, u8 timer_id, u32 interval)
static void tcp_cc_init(tcp_connection_t *tc)
struct _transport_proto_vft transport_proto_vft_t
static void clib_spinlock_init(clib_spinlock_t *p)
vl_api_fib_path_type_t type
static u32 tcp_session_unbind(u32 listener_index)
static timer_expiration_handler * timer_expiration_handlers[TCP_N_TIMERS]
void tcp_bt_init(tcp_connection_t *tc)
Byte tracker initialize.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static void tcp_dispatch_pending_timers(tcp_worker_ctx_t *wrk)
static clib_error_t * tcp_main_enable(vlib_main_t *vm)
vlib_main_t * vm
convenience pointer to this thread's vlib main
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
timer_expiration_handler tcp_timer_persist_handler
#define CLIB_US_TIME_FREQ
static transport_connection_t * tcp_session_get_transport(u32 conn_index, u32 thread_index)
static ip_protocol_info_t * ip_get_protocol_info(ip_main_t *im, u32 protocol)
static tcp_connection_t * tcp_half_open_connection_get(u32 conn_index)
#define clib_fifo_sub1(f, e)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
void tcp_connection_tx_pacer_reset(tcp_connection_t *tc, u32 window, u32 start_bucket)
dpo_type_t dpoi_type
the type
format_function_t * format_header
tcp_connection_t * tcp_connection_alloc_w_base(u8 thread_index, tcp_connection_t *base)
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
format_function_t format_tcp_connection_id
static void tcp_init_rcv_mss(tcp_connection_t *tc)
Initialize max segment size we're able to process.
void tcp_send_syn(tcp_connection_t *tc)
Send SYN.
#define TCP_TIMER_TICK
Timer tick in seconds.
tcp_connection_t * tcp_connection_alloc(u8 thread_index)
void tcp_bt_cleanup(tcp_connection_t *tc)
Byte tracker cleanup.
load-balancing over a choice of [un]equal cost paths
static transport_connection_t * tcp_session_get_listener(u32 listener_index)
static u32 transport_max_rx_dequeue(transport_connection_t *tc)
void tcp_connection_tx_pacer_update(tcp_connection_t *tc)
#define pool_put(P, E)
Free an object E in pool P.
static void tcp_expired_timers_dispatch(u32 *expired_timers)
void transport_connection_tx_pacer_init(transport_connection_t *tc, u64 rate_bytes_per_sec, u32 initial_bucket)
Initialize tx pacer for connection.
static void tcp_session_cleanup(u32 conn_index, u32 thread_index)
tcp_timer_wheel_t timer_wheel
worker timer wheel
clib_error_t * vnet_tcp_enable_disable(vlib_main_t *vm, u8 is_en)
static void tcp_session_cleanup_ho(u32 conn_index)
static u8 transport_connection_is_tx_paced(transport_connection_t *tc)
Check if transport connection is paced.
static u64 tcp_cc_get_pacing_rate(tcp_connection_t *tc)
void transport_connection_tx_pacer_reset(transport_connection_t *tc, u64 rate_bytes_per_sec, u32 start_bucket, clib_us_time_t rtt)
static void tcp_timer_expire_timers(tcp_timer_wheel_t *tw, f64 now)
static u32 tcp_available_output_snd_space(const tcp_connection_t *tc)
#define TCP_OPTION_LEN_TIMESTAMP
static int tcp_session_send_params(transport_connection_t *trans_conn, transport_send_params_t *sp)
#define TCP_DBG(_fmt, _args...)
void tcp_program_cleanup(tcp_worker_ctx_t *wrk, tcp_connection_t *tc)
void tcp_connection_free(tcp_connection_t *tc)
static_always_inline u32 vlib_buffer_get_default_data_size(vlib_main_t *vm)
#define pool_free(p)
Free a pool.
void transport_connection_reschedule(transport_connection_t *tc)
clib_error_t * ip_main_init(vlib_main_t *vm)
static_always_inline uword vlib_get_thread_index(void)
static void tcp_add_del_adj_cb(tcp_add_del_adj_args_t *args)
void scoreboard_init(sack_scoreboard_t *sb)
void tcp_connection_close(tcp_connection_t *tc)
Begin connection closing procedure.
sll srl srl sll sra u16x4 i
void tcp_send_reset(tcp_connection_t *tc)
Build and set reset packet for connection.
#define vec_free(V)
Free vector's memory (no header).
#define SESSION_CLI_ID_LEN
static void tcp_session_flush_data(transport_connection_t *tconn)
format_function_t format_tcp_state
#define clib_warning(format, args...)
struct _transport_connection transport_connection_t
u32 fib_node_index_t
A typedef of a node index.
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)
fib_entry_t * fib_entry_get(fib_node_index_t index)
#define pool_init_fixed(pool, max_elts)
initialize a fixed-size, preallocated pool
void transport_endpoint_cleanup(u8 proto, ip46_address_t *lcl_ip, u16 port)
void transport_register_protocol(transport_proto_t transport_proto, const transport_proto_vft_t *vft, fib_protocol_t fib_proto, u32 output_node)
Register transport virtual function table.
transport_snd_flags_t flags
static u32 transport_max_tx_dequeue(transport_connection_t *tc)
#define seq_geq(_s1, _s2)
vlib_node_registration_t ip6_lookup_node
(constructor) VLIB_REGISTER_NODE (ip6_lookup_node)
#define pool_put_index(p, i)
Free pool element with given index.
static int tcp_session_open(transport_endpoint_cfg_t *rmt)
tcp_cc_algorithm_type_e tcp_cc_algo_new_type(const tcp_cc_algorithm_t *vft)
Register new cc algo type.
static void tcp_configuration_init(void)
Initialize default values for tcp parameters.
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
static load_balance_t * load_balance_get(index_t lbi)
static void tcp_init_mss(tcp_connection_t *tc)
uword vlib_node_get_next(vlib_main_t *vm, uword node_index, uword next_node_index)
static void tcp_cong_recovery_off(tcp_connection_t *tc)
static u32 tcp_generate_random_iss(tcp_connection_t *tc)
Generate random iss as per rfc6528.
clib_time_type_t free_time
reliable transport protos
static uword ip6_address_is_link_local_unicast(const ip6_address_t *a)
void tcp_cc_algo_register(tcp_cc_algorithm_type_e type, const tcp_cc_algorithm_t *vft)
Register exiting cc algo type.
static clib_error_t * tcp_init(vlib_main_t *vm)
void transport_connection_tx_pacer_update(transport_connection_t *tc, u64 bytes_per_sec, clib_us_time_t rtt)
Update tx pacer pacing rate.
dpo_id_t fe_lb
The load-balance used for forwarding.
static u32 ip6_compute_flow_hash(const ip6_header_t *ip, flow_hash_config_t flow_hash_config)
u8 ip_is_zero(ip46_address_t *ip46_address, u8 is_ip4)
static const transport_proto_vft_t tcp_proto
void tcp_punt_unknown(vlib_main_t *vm, u8 is_ip4, u8 is_add)
vlib_node_registration_t tcp4_input_node
(constructor) VLIB_REGISTER_NODE (tcp4_input_node)
static void tcp_timer_update(tcp_timer_wheel_t *tw, tcp_connection_t *tc, u8 timer_id, u32 interval)
static u32 tcp_session_bind(u32 session_index, transport_endpoint_t *tep)
index_t dpoi_index
the index of objects of that type
#define FIB_NODE_INDEX_INVALID
void tcp_send_fin(tcp_connection_t *tc)
Send FIN.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void vlib_rpc_call_main_thread(void *callback, u8 *args, u32 arg_size)
static void tcp_cc_cleanup(tcp_connection_t *tc)
static tcp_connection_t * tcp_listener_get(u32 tli)
static u32 tcp_round_snd_space(tcp_connection_t *tc, u32 snd_space)
static tcp_worker_ctx_t * tcp_get_worker(u32 thread_index)
void session_transport_closed_notify(transport_connection_t *tc)
Notification from transport that it is closed.
void tcp_connection_init_vars(tcp_connection_t *tc)
Initialize tcp connection variables.
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
static u8 * format_tcp_session(u8 *s, va_list *args)
transport_connection_t * session_lookup_connection(u32 fib_index, ip46_address_t *lcl, ip46_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto, u8 is_ip4)
static f64 tcp_time_now_us(u32 thread_index)
static void tcp_connection_set_state(tcp_connection_t *tc, tcp_state_t state)
enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e
static void tcp_timer_waitclose_handler(tcp_connection_t *tc)
#define clib_fifo_add2(f, p)
static u32 random_u32(u32 *seed)
32-bit random number generator
#define clib_fifo_add(f, e, n)
static u16 tcp_session_cal_goal_size(tcp_connection_t *tc)
static vlib_thread_main_t * vlib_get_thread_main()
void tcp_connection_cleanup(tcp_connection_t *tc)
Cleans up connection state.
void tcp_connection_del(tcp_connection_t *tc)
Connection removal.
adj_index_t adj_nbr_add_or_lock(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Neighbour Adjacency sub-type.
void tcp_reschedule(tcp_connection_t *tc)
static u8 * format_tcp_half_open_session(u8 *s, va_list *args)
#define tcp_opts_sack_permitted(_to)
static u32 tcp_snd_space_inline(tcp_connection_t *tc)
Compute tx window session is allowed to fill.
int transport_alloc_local_port(u8 proto, ip46_address_t *ip)
Allocate local port and add if successful add entry to local endpoint table to mark the pair as used...
static clib_error_t * ip6_lookup_init(vlib_main_t *vm)
static void tcp_update_time(f64 now, u8 thread_index)
void tcp_enable_pacing(tcp_connection_t *tc)
static tcp_main_t * vnet_get_tcp_main()
u32 tco_next_node[2]
Session layer edge indices to tcp output.
void tcp_timer_initialize_wheel(tcp_timer_wheel_t *tw, void(*expired_timer_cb)(u32 *), f64 now)
static void tcp_session_reset(u32 conn_index, u32 thread_index)
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
int tcp_session_custom_tx(void *conn, transport_send_params_t *sp)
#define tcp_worker_stats_inc(_wrk, _stat, _val)
adj_index_t adj_nbr_find(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Lookup neighbor adjancency.
#define TCP_EVT(_evt, _args...)