|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
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;
128 ip_set (&lcl->ip, iface_ip, 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;
181 return &tc->connection;
194 pool_put (tm->half_open_connections, tc);
228 pool_get (tm->half_open_connections, tc);
230 tc->c_c_index = tc - tm->half_open_connections;
245 if (!(tc->cfg_flags & TCP_CFG_F_NO_ENDPOINT))
250 if (tc->state == TCP_STATE_SYN_SENT)
256 tc->flags |= TCP_CONN_HALF_OPEN_DONE;
272 if (tc->cfg_flags & TCP_CFG_F_RATE_SAMPLE)
301 tc->c_c_index = tc -
wrk->connections;
314 tc->c_c_index = tc -
wrk->connections;
366 case TCP_STATE_SYN_SENT:
371 case TCP_STATE_SYN_RCVD:
378 case TCP_STATE_ESTABLISHED:
393 tc->flags |= TCP_CONN_FINPNDG;
401 case TCP_STATE_CLOSE_WAIT:
411 tc->flags |= TCP_CONN_FINPNDG;
413 case TCP_STATE_FIN_WAIT_1:
417 case TCP_STATE_CLOSED:
421 TCP_DBG (
"state: %u", tc->state);
435 if (tc->state != TCP_STATE_ESTABLISHED)
440 tc->flags |= TCP_CONN_FINPNDG;
524 typedef struct ip4_tcp_hdr
530 typedef struct ip6_tcp_hdr
549 hdr.ip.protocol = IP_PROTOCOL_TCP;
550 hdr.ip.address_pair.src.as_u32 = tc->c_lcl_ip.ip4.as_u32;
551 hdr.ip.address_pair.dst.as_u32 = tc->c_rmt_ip.ip4.as_u32;
552 hdr.tcp.src_port = tc->c_lcl_port;
553 hdr.tcp.dst_port = tc->c_rmt_port;
560 hdr.ip.protocol = IP_PROTOCOL_TCP;
562 sizeof (ip6_address_t));
564 sizeof (ip6_address_t));
565 hdr.tcp.src_port = tc->c_lcl_port;
566 hdr.tcp.dst_port = tc->c_rmt_port;
581 prefix.fp_len = tc->c_is_ip4 ? 32 : 128;
590 u32 output_node_index;
597 tcp_connection_select_lb_bucket (tc, &fe->
fe_lb, &choice);
616 tcp_connection_stack_on_fib_entry (tc);
630 tmp = (
u64) tc->c_lcl_ip.ip4.as_u32 << 32 | (
u64) tc->c_rmt_ip.ip4.as_u32;
632 tmp = tc->c_lcl_ip.ip6.as_u64[0] ^ tc->c_lcl_ip.ip6.as_u64[1]
633 ^ tc->c_rmt_ip.ip6.as_u64[0] ^ tc->c_rmt_ip.ip6.as_u64[1];
635 tmp ^= tm->iss_seed.first | ((
u64) tc->c_lcl_port << 16 | tc->c_rmt_port);
636 tmp ^= tm->iss_seed.second;
638 return ((
tmp >> 32) ^ (
tmp & 0xffffffff));
664 u16 default_min_mss = 536;
669 tc->snd_mss =
clib_min (tc->rcv_opts.mss, tc->mss);
671 if (tc->snd_mss < 45)
674 tc->snd_mss = default_min_mss;
675 tc->rcv_opts.mss = default_min_mss;
679 ASSERT (tc->snd_mss > 45);
703 tc->snd_una = tc->iss;
704 tc->snd_nxt = tc->iss + 1;
705 tc->srtt = 0.1 *
THZ;
708 tc->cfg_flags |= TCP_CFG_F_NO_CSUM_OFFLOAD;
715 byte_rate = tc->cwnd / (tc->srtt *
TCP_TICK);
717 tc->mrtt_us = (
u32) ~ 0;
730 if (tc->state == TCP_STATE_SYN_RCVD)
744 if (tc->cfg_flags & TCP_CFG_F_RATE_SAMPLE)
748 tc->cfg_flags |= TCP_CFG_F_NO_TSO;
755 u16 * lcl_port,
u8 is_ip4)
760 index = tm->last_v4_addr_rotor++;
762 tm->last_v4_addr_rotor = 0;
763 lcl_addr->ip4.as_u32 =
tcp_cfg.ip4_src_addrs[
index].as_u32;
767 index = tm->last_v6_addr_rotor++;
769 tm->last_v6_addr_rotor = 0;
771 sizeof (ip6_address_t));
775 return SESSION_E_NOPORT;
785 ip46_address_t lcl_addr;
798 rmt, &lcl_addr, &lcl_port);
802 if (
rv != SESSION_E_PORTINUSE)
806 lcl_port, rmt->port, TRANSPORT_PROTO_TCP,
808 return SESSION_E_PORTINUSE;
820 ip_copy (&tc->c_rmt_ip, &rmt->ip, rmt->is_ip4);
821 ip_copy (&tc->c_lcl_ip, &lcl_addr, rmt->is_ip4);
822 tc->c_rmt_port = rmt->port;
823 tc->c_lcl_port = clib_host_to_net_u16 (lcl_port);
824 tc->c_is_ip4 = rmt->is_ip4;
825 tc->c_proto = TRANSPORT_PROTO_TCP;
826 tc->c_fib_index = rmt->fib_index;
833 tc->state = TCP_STATE_SYN_SENT;
837 return tc->c_c_index;
843 u32 tci = va_arg (*args,
u32);
845 u32 verbose = va_arg (*args,
u32);
852 s =
format (s,
"empty\n");
859 u32 tci = va_arg (*args,
u32);
861 u32 verbose = va_arg (*args,
u32);
873 u32 tci = va_arg (*args,
u32);
875 u32 verbose = va_arg (*args,
u32);
880 if (tc->flags & TCP_CONN_HALF_OPEN_DONE)
897 return &tc->connection;
904 return &tc->connection;
914 case TRANSPORT_ENDPT_ATTR_NEXT_OUTPUT_NODE:
915 tc->next_node_index = attr->next_output_node & 0xffffffff;
916 tc->next_node_opaque = attr->next_output_node >> 32;
918 case TRANSPORT_ENDPT_ATTR_MSS:
920 tc->snd_mss =
clib_min (tc->snd_mss, tc->mss);
922 case TRANSPORT_ENDPT_ATTR_FLAGS:
923 if (attr->flags & TRANSPORT_ENDPT_ATTR_F_CSUM_OFFLOAD)
924 tc->cfg_flags |= TCP_CFG_F_NO_CSUM_OFFLOAD;
926 tc->cfg_flags &= ~TCP_CFG_F_NO_CSUM_OFFLOAD;
927 if (attr->flags & TRANSPORT_ENDPT_ATTR_F_GSO)
929 if (!(tc->cfg_flags & TCP_CFG_F_TSO))
931 tc->cfg_flags &= ~TCP_CFG_F_NO_TSO;
935 tc->cfg_flags |= TCP_CFG_F_NO_TSO;
936 tc->cfg_flags &= ~TCP_CFG_F_TSO;
938 if (attr->flags & TRANSPORT_ENDPT_ATTR_F_RATE_SAMPLING)
940 if (!(tc->cfg_flags & TCP_CFG_F_RATE_SAMPLE))
942 tc->cfg_flags |= TCP_CFG_F_RATE_SAMPLE;
946 if (tc->cfg_flags & TCP_CFG_F_RATE_SAMPLE)
948 tc->cfg_flags &= ~TCP_CFG_F_RATE_SAMPLE;
951 case TRANSPORT_ENDPT_ATTR_CC_ALGO:
974 case TRANSPORT_ENDPT_ATTR_NEXT_OUTPUT_NODE:
975 non = (
u64) tc->next_node_opaque << 32 | tc->next_node_index;
976 attr->next_output_node = non;
978 case TRANSPORT_ENDPT_ATTR_MSS:
979 attr->mss = tc->snd_mss;
981 case TRANSPORT_ENDPT_ATTR_FLAGS:
983 if (!(tc->cfg_flags & TCP_CFG_F_NO_CSUM_OFFLOAD))
984 attr->flags |= TRANSPORT_ENDPT_ATTR_F_CSUM_OFFLOAD;
985 if (tc->cfg_flags & TCP_CFG_F_TSO)
986 attr->flags |= TRANSPORT_ENDPT_ATTR_F_GSO;
987 if (tc->cfg_flags & TCP_CFG_F_RATE_SAMPLE)
988 attr->flags |= TRANSPORT_ENDPT_ATTR_F_RATE_SAMPLING;
990 case TRANSPORT_ENDPT_ATTR_CC_ALGO:
991 attr->cc_algo = tc->cc_algo -
tcp_main.cc_algos;
1019 u16 goal_size = tc->snd_mss;
1021 goal_size =
tcp_cfg.max_gso_size - tc->snd_mss %
tcp_cfg.max_gso_size;
1022 goal_size =
clib_min (goal_size, tc->snd_wnd / 2);
1024 return goal_size > tc->snd_mss ? goal_size : tc->snd_mss;
1032 return tc->snd_wnd <= snd_space ? tc->snd_wnd : 0;
1038 return snd_space < tc->cwnd ? 0 : snd_space;
1041 return snd_space - (snd_space % tc->snd_mss);
1063 || tc->state == TCP_STATE_CLOSED))
1072 if (
PREDICT_FALSE (tc->rcv_dupacks || tc->sack_sb.sacked_bytes))
1074 int snt_limited, n_pkts;
1077 ? tc->sack_sb.reorder - 1 : 2;
1079 if ((
seq_lt (tc->limited_transmit, tc->snd_nxt - n_pkts * tc->snd_mss)
1080 ||
seq_gt (tc->limited_transmit, tc->snd_nxt)))
1081 tc->limited_transmit = tc->snd_nxt;
1085 snt_limited = tc->snd_nxt - tc->limited_transmit;
1086 snd_space =
clib_max (n_pkts * tc->snd_mss - snt_limited, 0);
1114 tc->snd_wnd - (tc->snd_nxt - tc->snd_una));
1118 sp->
tx_offset = tc->snd_nxt - tc->snd_una;
1132 case TCP_STATE_CLOSE_WAIT:
1135 if (!(tc->flags & TCP_CONN_FINPNDG))
1147 tc->snd_nxt = tc->snd_una;
1159 case TCP_STATE_FIN_WAIT_1:
1161 if (tc->flags & TCP_CONN_FINPNDG)
1179 case TCP_STATE_LAST_ACK:
1186 case TCP_STATE_CLOSING:
1193 case TCP_STATE_FIN_WAIT_2:
1201 case TCP_STATE_TIME_WAIT:
1232 for (
i = 0;
i <
clib_min (n_timers,
wrk->max_timers_per_loop);
i++)
1235 connection_index = timer_handle & 0x0FFFFFFF;
1236 timer_id = timer_handle >> 28;
1238 if (
PREDICT_TRUE (timer_id != TCP_TIMER_RETRANSMIT_SYN))
1248 if (
PREDICT_FALSE (!(tc->pending_timers & (1 << timer_id))))
1251 tc->pending_timers &= ~(1 << timer_id);
1300 if (tc->flags & TCP_CONN_PSH_PENDING)
1302 tc->flags |= TCP_CONN_PSH_PENDING;
1310 u32 min_free,
lo = 4 << 10,
hi = 128 << 10;
1312 if (!(tc->flags & TCP_CONN_ZERO_RWND_SENT))
1351 .transport_options = {
1395 u32 connection_index, timer_id, n_expired, max_loops;
1401 n_expired =
vec_len (expired_timers);
1409 for (
i = 0;
i < n_expired;
i++)
1411 connection_index = expired_timers[
i] & 0x0FFFFFFF;
1412 timer_id = expired_timers[
i] >> 28;
1414 if (timer_id != TCP_TIMER_RETRANSMIT_SYN)
1419 TCP_EVT (TCP_EVT_TIMER_POP, connection_index, timer_id);
1422 tc->pending_timers |= (1 << timer_id);
1443 tm->iss_seed.first = (
u64)
random_u32 (&default_seed) << 32;
1444 tm->iss_seed.second =
random_u64 (&time_now);
1451 u32 num_threads, n_workers, prealloc_conn_per_wrk;
1478 n_workers = num_threads == 1 ? 1 : vtm->
n_threads;
1479 prealloc_conn_per_wrk =
tcp_cfg.preallocated_connections / n_workers;
1481 wrk = &tm->wrk_ctx[0];
1498 wrk->max_timers_per_loop = 10;
1502 wrk->tco_next_node[0] = tm->wrk_ctx[0].tco_next_node[0];
1503 wrk->tco_next_node[1] = tm->wrk_ctx[0].tco_next_node[1];
1510 if ((
thread > 0 || num_threads == 1) && prealloc_conn_per_wrk)
1521 if (
tcp_cfg.preallocated_half_open_connections)
1523 tcp_cfg.preallocated_half_open_connections);
1560 tm->punt_unknown4 = is_add;
1562 tm->punt_unknown6 = is_add;
1574 tcp_cfg.max_rx_fifo = 32 << 20;
1575 tcp_cfg.min_rx_fifo = 4 << 10;
1578 tcp_cfg.initial_cwnd_multiplier = 0;
1583 tcp_cfg.rwnd_min_update_ack = 1;
1587 tcp_cfg.closewait_time = 20000;
1588 tcp_cfg.timewait_time = 100000;
1589 tcp_cfg.finwait1_time = 600000;
1590 tcp_cfg.lastack_time = 300000;
1591 tcp_cfg.finwait2_time = 300000;
1592 tcp_cfg.closing_time = 300000;
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
void tcp_timer_initialize_wheel(tcp_timer_wheel_t *tw, void(*expired_timer_cb)(u32 *), f64 now)
void transport_connection_tx_pacer_reset(transport_connection_t *tc, u64 rate_bytes_per_sec, u32 start_bucket, clib_us_time_t rtt)
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
static uword ip6_address_is_link_local_unicast(const ip6_address_t *a)
#define SESSION_CLI_STATE_LEN
static int tcp_get_attribute(tcp_connection_t *tc, transport_endpt_attr_t *attr)
fib_node_index_t tcp_lookup_rmt_in_fib(tcp_connection_t *tc)
vnet_interface_main_t * im
int transport_alloc_local_endpoint(u8 proto, transport_endpoint_cfg_t *rmt_cfg, ip46_address_t *lcl_addr, u16 *lcl_port)
void tcp_connection_cleanup(tcp_connection_t *tc)
Cleans up connection state.
index_t dpoi_index
the index of objects of that type
static void tcp_cc_cleanup(tcp_connection_t *tc)
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
#define seq_geq(_s1, _s2)
void ip_set(ip46_address_t *dst, void *src, u8 is_ip4)
void tcp_reschedule(tcp_connection_t *tc)
static void tcp_session_close(u32 conn_index, u32 thread_index)
static tcp_connection_t * tcp_half_open_connection_get(u32 conn_index)
#define tcp_opts_tstamp(_to)
void transport_connection_tx_pacer_update(transport_connection_t *tc, u64 bytes_per_sec, clib_us_time_t rtt)
Update tx pacer pacing rate.
static int tcp_alloc_custom_local_endpoint(tcp_main_t *tm, ip46_address_t *lcl_addr, u16 *lcl_port, u8 is_ip4)
static int tcp_session_app_rx_evt(transport_connection_t *conn)
#define SESSION_CLI_ID_LEN
format_function_t format_tcp_state
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.
static void tcp_connection_unbind(u32 listener_index)
static void tcp_half_open_connection_free(tcp_connection_t *tc)
Cleanup half-open connection.
dpo_type_t dpoi_type
the type
vlib_node_registration_t tcp6_output_node
(constructor) VLIB_REGISTER_NODE (tcp6_output_node)
static u16 tcp_session_cal_goal_size(tcp_connection_t *tc)
void session_half_open_delete_notify(transport_connection_t *tc)
u32 tcp_snd_space(tcp_connection_t *tc)
static void tcp_set_time_now(tcp_worker_ctx_t *wrk, f64 now)
tcp_connection_t * tcp_connection_alloc(u8 thread_index)
#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.
#define CLIB_US_TIME_FREQ
static void tcp_expired_timers_dispatch(u32 *expired_timers)
static void tcp_session_cleanup(u32 conn_index, u32 thread_index)
static u32 tcp_connection_bind(u32 session_index, transport_endpoint_t *lcl)
static uword clib_fifo_elts(void *v)
struct _tcp_header tcp_header_t
void tcp_send_ack(tcp_connection_t *tc)
static u32 tcp_available_output_snd_space(const tcp_connection_t *tc)
void transport_connection_tx_pacer_init(transport_connection_t *tc, u64 rate_bytes_per_sec, u32 initial_bucket)
Initialize tx pacer for connection.
flow_hash_config_t lb_hash_config
the hash config to use when selecting a bucket.
struct _tcp_connection tcp_connection_t
static timer_expiration_handler * timer_expiration_handlers[TCP_N_TIMERS]
static ip_protocol_info_t * ip_get_protocol_info(ip_main_t *im, u32 protocol)
#define clib_error_return(e, args...)
void tcp_enable_pacing(tcp_connection_t *tc)
static u8 transport_connection_is_tx_paced(transport_connection_t *tc)
Check if transport connection is paced.
static tcp_connection_t * tcp_listener_get(u32 tli)
format_function_t * format_header
#define TCP_DBG(_fmt, _args...)
pthread_t thread[MAX_CONNS]
static tcp_main_t * vnet_get_tcp_main()
#define FIB_NODE_INDEX_INVALID
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
struct _transport_proto_vft transport_proto_vft_t
timer_expiration_handler tcp_timer_persist_handler
static tcp_worker_ctx_t * tcp_get_worker(u32 thread_index)
static void tcp_init_rcv_mss(tcp_connection_t *tc)
Initialize max segment size we're able to process.
#define vlib_call_init_function(vm, x)
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static void tcp_timer_update(tcp_timer_wheel_t *tw, tcp_connection_t *tc, u8 timer_id, u32 interval)
void transport_connection_reschedule(transport_connection_t *tc)
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.
#define hash_create_string(elts, value_bytes)
vl_api_dhcp_client_state_t state
void session_transport_closed_notify(transport_connection_t *tc)
Notification from transport that it is closed.
void session_queue_run_on_main_thread(vlib_main_t *vm)
void tcp_init_snd_vars(tcp_connection_t *tc)
Initialize connection send variables.
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 u8 * format_tcp_half_open_session(u8 *s, va_list *args)
void tcp_connection_close(tcp_connection_t *tc)
Begin connection closing procedure.
format_function_t format_tcp_connection
static void tcp_timer_expire_timers(tcp_timer_wheel_t *tw, f64 now)
void ip4_register_protocol(u32 protocol, u32 node_index)
static void tcp_dispatch_pending_timers(tcp_worker_ctx_t *wrk)
struct _transport_connection transport_connection_t
static u32 transport_rx_fifo_size(transport_connection_t *tc)
static transport_connection_t * tcp_half_open_session_get_transport(u32 conn_index)
#define clib_fifo_add(f, e, n)
static void tcp_initialize_iss_seed(tcp_main_t *tm)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
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.
vlib_node_registration_t tcp4_input_node
(constructor) VLIB_REGISTER_NODE (tcp4_input_node)
struct _tcp_main tcp_main_t
static u32 random_u32(u32 *seed)
32-bit random number generator
static void tcp_cong_recovery_off(tcp_connection_t *tc)
void tcp_bt_cleanup(tcp_connection_t *tc)
Byte tracker cleanup.
static void tcp_cc_init(tcp_connection_t *tc)
static void tcp_add_del_adj_cb(tcp_add_del_adj_args_t *args)
static int tcp_session_open(transport_endpoint_cfg_t *rmt)
static void tcp_timer_reset(tcp_timer_wheel_t *tw, tcp_connection_t *tc, u8 timer_id)
vlib_node_registration_t tcp4_output_node
(constructor) VLIB_REGISTER_NODE (tcp4_output_node)
#define pool_init_fixed(pool, max_elts)
initialize a fixed-size, preallocated pool
static void tcp_configuration_init(void)
Initialize default values for tcp parameters.
@ TRANSPORT_SND_F_DESCHED
void * ip_interface_get_first_ip(u32 sw_if_index, u8 is_ip4)
#define seq_leq(_s1, _s2)
void tcp_check_gso(tcp_connection_t *tc)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static tcp_connection_t * tcp_half_open_connection_new(void)
transport_endpt_attr_type_t type
void tcp_program_cleanup(tcp_worker_ctx_t *wrk, tcp_connection_t *tc)
static u32 ip6_compute_flow_hash(const ip6_header_t *ip, flow_hash_config_t flow_hash_config)
void tcp_send_syn(tcp_connection_t *tc)
Send SYN.
#define ENDPOINT_INVALID_INDEX
tcp_cc_algorithm_t * tcp_cc_algo_get(tcp_cc_algorithm_type_e type)
static_always_inline uword vlib_get_thread_index(void)
format_function_t format_tcp_connection_id
enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e
static clib_error_t * ip4_lookup_init(vlib_main_t *vm)
void tcp_bt_init(tcp_connection_t *tc)
Byte tracker initialize.
static u32 transport_max_rx_dequeue(transport_connection_t *tc)
static u32 tcp_session_unbind(u32 listener_index)
u32 fib_node_index_t
A typedef of a node index.
static u64 tcp_cc_get_pacing_rate(tcp_connection_t *tc)
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
static transport_connection_t * tcp_session_get_transport(u32 conn_index, u32 thread_index)
static u32 tcp_generate_random_iss(tcp_connection_t *tc)
Generate random iss as per rfc6528.
#define hash_set_mem(h, key, value)
static u32 transport_max_tx_dequeue(transport_connection_t *tc)
static int tcp_set_attribute(tcp_connection_t *tc, transport_endpt_attr_t *attr)
#define clib_fifo_sub1(f, e)
static void tcp_connection_set_state(tcp_connection_t *tc, tcp_state_t state)
void tcp_connection_timers_reset(tcp_connection_t *tc)
Stop all connection timers.
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
sll srl srl sll sra u16x4 i
static void tcp_timer_set(tcp_timer_wheel_t *tw, tcp_connection_t *tc, u8 timer_id, u32 interval)
void scoreboard_init(sack_scoreboard_t *sb)
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.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define tcp_opts_sack_permitted(_to)
static u64 clib_xxhash(u64 key)
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.
#define clib_fifo_head(v)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
void tcp_punt_unknown(vlib_main_t *vm, u8 is_ip4, u8 is_add)
#define TCP_EVT(_evt, _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)
#define TCP_TIMER_TICK
Timer tick in seconds.
static clib_error_t * ip6_lookup_init(vlib_main_t *vm)
clib_error_t * ip_main_init(vlib_main_t *vm)
static clib_error_t * tcp_main_enable(vlib_main_t *vm)
vlib_node_registration_t tcp6_input_node
(constructor) VLIB_REGISTER_NODE (tcp6_input_node)
static int tcp_session_send_params(transport_connection_t *trans_conn, transport_send_params_t *sp)
void session_transport_delete_notify(transport_connection_t *tc)
Notification from transport that connection is being deleted.
void tcp_update_burst_snd_vars(tcp_connection_t *tc)
Update burst send vars.
static f64 tcp_time_now_us(u32 thread_index)
static clib_error_t * tcp_init(vlib_main_t *vm)
void transport_share_local_endpoint(u8 proto, ip46_address_t *lcl_ip, u16 port)
void tcp_send_reset(tcp_connection_t *tc)
Build and set reset packet for connection.
@ DPO_LOAD_BALANCE
load-balancing over a choice of [un]equal cost paths
@ TRANSPORT_SERVICE_VC
virtual circuit service
static transport_connection_t * tcp_session_get_listener(u32 listener_index)
static void transport_rx_fifo_req_deq_ntf(transport_connection_t *tc)
tcp_cc_algorithm_type_e tcp_cc_algo_new_type(const tcp_cc_algorithm_t *vft)
Register new cc algo type.
#define vec_free(V)
Free vector's memory (no header).
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
void tcp_connection_timers_init(tcp_connection_t *tc)
Initialize all connection timers as invalid.
fib_entry_t * fib_entry_get(fib_node_index_t index)
#define TCP_OPTION_LEN_TIMESTAMP
@ TRANSPORT_TX_PEEK
reliable transport protos
void tcp_connection_tx_pacer_reset(tcp_connection_t *tc, u32 window, u32 start_bucket)
description fragment has unexpected format
void tcp_cc_algo_register(tcp_cc_algorithm_type_e type, const tcp_cc_algorithm_t *vft)
Register exiting cc algo type.
dpo_id_t fe_lb
The load-balance used for forwarding.
static_always_inline u32 vlib_buffer_get_default_data_size(vlib_main_t *vm)
#define VLIB_INIT_FUNCTION(x)
void ip_copy(ip46_address_t *dst, ip46_address_t *src, u8 is_ip4)
static void tcp_session_reset(u32 conn_index, u32 thread_index)
static void tcp_timer_waitclose_handler(tcp_connection_t *tc)
#define clib_fifo_add2(f, p)
static tcp_connection_t * tcp_connection_get(u32 conn_index, u32 thread_index)
vlib_main_t * vm
Convenience pointer to this worker's vlib_main.
uword vlib_node_get_next(vlib_main_t *vm, uword node_index, uword next_node_index)
#define tcp_in_cong_recovery(tc)
static load_balance_t * load_balance_get(index_t lbi)
static void tcp_session_cleanup_ho(u32 conn_index)
static int tcp_session_attribute(u32 conn_index, u32 thread_index, u8 is_get, transport_endpt_attr_t *attr)
static u32 tcp_session_bind(u32 session_index, transport_endpoint_t *tep)
static vlib_main_t * vlib_get_main_by_index(u32 thread_index)
int tcp_session_custom_tx(void *conn, transport_send_params_t *sp)
void vlib_rpc_call_main_thread(void *callback, u8 *args, u32 arg_size)
void() timer_expiration_handler(tcp_connection_t *tc)
static u64 random_u64(u64 *seed)
64-bit random number generator Again, constants courtesy of Donald Knuth.
static u32 tcp_snd_space_inline(tcp_connection_t *tc)
Compute tx window session is allowed to fill.
static u32 ip4_compute_flow_hash(const ip4_header_t *ip, flow_hash_config_t flow_hash_config)
clib_time_type_t free_time
const static transport_proto_vft_t tcp_proto
static void tcp_update_time_now(tcp_worker_ctx_t *wrk)
void transport_endpoint_cleanup(u8 proto, ip46_address_t *lcl_ip, u16 port)
void tcp_connection_free(tcp_connection_t *tc)
static void tcp_update_time(f64 now, u8 thread_index)
tcp_connection_t * tcp_connection_alloc_w_base(u8 thread_index, tcp_connection_t *base)
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.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
struct _tcp_cc_algorithm tcp_cc_algorithm_t
#define clib_clamp(x, lo, hi)
static void tcp_handle_cleanups(tcp_worker_ctx_t *wrk, clib_time_type_t now)
void tcp_connection_tx_pacer_update(tcp_connection_t *tc)
#define THZ
TCP tick frequency.
static u32 transport_max_rx_enqueue(transport_connection_t *tc)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
clib_error_t * vnet_tcp_enable_disable(vlib_main_t *vm, u8 is_en)
static void tcp_session_flush_data(transport_connection_t *tconn)
u32 tcp_session_push_header(transport_connection_t *tconn, vlib_buffer_t *b)
#define pool_free(p)
Free a pool.
transport_snd_flags_t flags
#define clib_warning(format, args...)
void ip6_register_protocol(u32 protocol, u32 node_index)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static void tcp_init_mss(tcp_connection_t *tc)
timer_expiration_handler tcp_timer_retransmit_handler
u16 lb_n_buckets_minus_1
number of buckets in the load-balance - 1.
static u32 tcp_round_snd_space(tcp_connection_t *tc, u32 snd_space)
static f64 vlib_time_now(vlib_main_t *vm)
void tcp_connection_init_vars(tcp_connection_t *tc)
Initialize tcp connection variables.
timer_expiration_handler tcp_timer_retransmit_syn_handler
static void tcp_session_half_close(u32 conn_index, u32 thread_index)
vlib_node_registration_t session_queue_node
(constructor) VLIB_REGISTER_NODE (session_queue_node)
#define TCP_TICK
TCP tick period (s)
static u64 clib_cpu_time_now(void)
static vlib_thread_main_t * vlib_get_thread_main()
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
#define clib_fifo_sub2(f, p)
#define TCP_TIMER_HANDLE_INVALID
unformat_function_t * unformat_pg_edit
#define tcp_worker_stats_inc(_wrk, _stat, _val)
void tcp_connection_del(tcp_connection_t *tc)
Connection removal.
void tcp_send_fin(tcp_connection_t *tc)
Send FIN.
Aggregate type for a prefix.
vl_api_fib_path_type_t type
static void tcp_add_del_adjacency(tcp_connection_t *tc, u8 is_add)
static uword random_default_seed(void)
Default random seed (unix/linux user-mode)
u8 ip_is_zero(ip46_address_t *ip46_address, u8 is_ip4)
int tcp_half_open_connection_cleanup(tcp_connection_t *tc)
Try to cleanup half-open connection.
static u8 * format_tcp_listener_session(u8 *s, va_list *args)
static u8 * format_tcp_session(u8 *s, va_list *args)