22 #define _(sym, str) str, 35 s =
format (s,
"UNKNOWN (%d (0x%x))", state, state);
40 #define _(sym, str) str, 52 if (tc->cfg_flags & (1 << i))
54 for (i = 0; i <
last; i++)
56 if (tc->cfg_flags & (1 << i))
65 #define _(sym, str) str, 77 if (tc->flags & (1 << i))
79 for (i = 0; i <
last; i++)
81 if (tc->flags & (1 << i))
90 #define _(sym, str) str, 105 for (i = 0; i <
last; i++)
122 s =
format (s,
"recovery");
124 s =
format (s,
"fastrecovery");
133 return (
i32) tc->rcv_wnd - (tc->rcv_nxt - tc->rcv_las);
143 s =
format (s,
"algo %s cwnd %u ssthresh %u bytes_acked %u\n",
144 tc->cc_algo->name, tc->cwnd, tc->ssthresh, tc->bytes_acked);
145 s =
format (s,
"%Ucc space %u prev_cwnd %u prev_ssthresh %u\n",
147 tc->prev_cwnd, tc->prev_ssthresh);
148 s =
format (s,
"%Usnd_cong %u dupack %u limited_tx %u\n",
150 tc->rcv_dupacks, tc->limited_transmit - tc->iss);
151 s =
format (s,
"%Urxt_bytes %u rxt_delivered %u rxt_head %u rxt_ts %u\n",
153 tc->rxt_delivered, tc->rxt_head - tc->iss,
157 s =
format (s,
"%Uprr_start %u prr_delivered %u prr space %u\n",
159 tc->prr_delivered, prr_space);
168 s =
format (s,
"in segs %lu dsegs %lu bytes %lu dupacks %u\n",
169 tc->segs_in, tc->data_segs_in, tc->bytes_in, tc->dupacks_in);
170 s =
format (s,
"%Uout segs %lu dsegs %lu bytes %lu dupacks %u\n",
172 tc->data_segs_out, tc->bytes_out, tc->dupacks_out);
173 s =
format (s,
"%Ufr %u tr %u rxt segs %lu bytes %lu duration %.3f\n",
175 tc->tr_occurences, tc->segs_retrans, tc->bytes_retrans,
177 s =
format (s,
"%Uerr wnd data below %u above %u ack below %u above %u",
179 tc->errors.above_data_wnd, tc->errors.below_ack_wnd,
180 tc->errors.above_ack_wnd);
188 s =
format (s,
" index: %u cfg: %U flags: %U timers: %U\n", tc->c_c_index,
191 s =
format (s,
" snd_una %u snd_nxt %u snd_una_max %u",
192 tc->snd_una - tc->iss, tc->snd_nxt - tc->iss,
193 tc->snd_una_max - tc->iss);
194 s =
format (s,
" rcv_nxt %u rcv_las %u\n",
195 tc->rcv_nxt - tc->irs, tc->rcv_las - tc->irs);
196 s =
format (s,
" snd_wnd %u rcv_wnd %u rcv_wscale %u ",
197 tc->snd_wnd, tc->rcv_wnd, tc->rcv_wscale);
198 s =
format (s,
"snd_wl1 %u snd_wl2 %u\n", tc->snd_wl1 - tc->irs,
199 tc->snd_wl2 - tc->iss);
200 s =
format (s,
" flight size %u out space %u rcv_wnd_av %u",
203 s =
format (s,
" tsval_recent %u\n", tc->tsval_recent);
204 s =
format (s,
" tsecr %u tsecr_last_ack %u tsval_recent_age %u",
205 tc->rcv_opts.tsecr, tc->tsecr_last_ack,
207 s =
format (s,
" snd_mss %u\n", tc->snd_mss);
208 s =
format (s,
" rto %u rto_boff %u srtt %.1f us %.3f rttvar %.1f",
209 tc->rto / 1000, tc->rto_boff, tc->srtt / 1000.0,
210 tc->mrtt_us * 1e3, tc->rttvar / 1000.0);
211 s =
format (s,
" rtt_ts %.4f rtt_seq %u\n", tc->rtt_ts,
212 tc->rtt_seq - tc->iss);
213 s =
format (s,
" next_node %u opaque 0x%x fib_index %u\n",
214 tc->next_node_index, tc->next_node_opaque, tc->c_fib_index);
217 if (tc->state >= TCP_STATE_ESTABLISHED)
237 s =
format (s,
"[%d:%d][%s] %U:%d->%U:%d", tc->c_thread_index,
240 &tc->c_rmt_ip4, clib_net_to_host_u16 (tc->c_rmt_port));
244 s =
format (s,
"[%d:%d][%s] %U:%d->%U:%d", tc->c_thread_index,
247 &tc->c_rmt_ip6, clib_net_to_host_u16 (tc->c_rmt_port));
257 u32 verbose = va_arg (*args,
u32);
281 for (i = 0; i < len - 1; i++)
284 s =
format (s,
" start %u end %u\n", block->start - tc->irs,
285 block->end - tc->irs);
289 block = &sacks[len - 1];
290 s =
format (s,
" start %u end %u", block->start - tc->irs,
291 block->end - tc->irs);
305 for (i = 0; i < len - 1; i++)
308 s =
format (s,
" start %u end %u\n", block->start - tc->iss,
309 block->end - tc->iss);
313 block = &sacks[len - 1];
314 s =
format (s,
" start %u end %u", block->start - tc->iss,
315 block->end - tc->iss);
326 s =
format (s,
" [%u, %u]", hole->start - tc->iss, hole->end - tc->iss);
328 s =
format (s,
" [%u, %u]", hole->start, hole->end);
340 s =
format (s,
"sacked %u last_sacked %u lost %u last_lost %u" 342 sb->sacked_bytes, sb->last_sacked_bytes, sb->lost_bytes,
343 sb->last_lost_bytes, sb->rxt_sacked);
344 s =
format (s,
"%Ulast_delivered %u high_sacked %u is_reneging %u",
346 sb->high_sacked - tc->iss, sb->is_reneging);
347 s =
format (s,
" reorder %u\n", sb->reorder);
348 s =
format (s,
"%Ucur_rxt_hole %u high_rxt %u rescue_rxt %u",
350 sb->high_rxt - tc->iss, sb->rescue_rxt - tc->iss);
355 indent, sb->head, sb->tail,
pool_elts (sb->holes),
381 u32 start_host_byte_order, end_host_byte_order;
393 return VNET_API_ERROR_NO_SUCH_FIB;
395 start_host_byte_order = clib_net_to_host_u32 (start->
as_u32);
396 end_host_byte_order = clib_net_to_host_u32 (end->
as_u32);
399 if ((end_host_byte_order - start_host_byte_order) > (10 << 10))
400 return VNET_API_ERROR_INVALID_ARGUMENT;
411 return VNET_API_ERROR_NEXT_HOP_NOT_IN_FIB;
446 start_host_byte_order++;
447 start->
as_u32 = clib_host_to_net_u32 (start_host_byte_order);
449 while (start_host_byte_order <= end_host_byte_order);
465 ip6_address_t * start,
478 return VNET_API_ERROR_NO_SUCH_FIB;
492 memcpy (&prefix.
fp_addr.ip6, start, sizeof (ip6_address_t));
498 return VNET_API_ERROR_NEXT_HOP_NOT_IN_FIB;
502 if (sw_if_index == (
u32) ~ 0)
503 return VNET_API_ERROR_NO_MATCHING_INTERFACE;
519 if (!memcmp (start, end,
sizeof (start[0])))
524 for (i = 15; i >= 0; i--)
527 if (tmp.as_u8[i] != 0)
540 ip6_address_t v6start, v6end;
553 memcpy (&v4end, &v4start,
sizeof (v4start));
561 memcpy (&v6end, &v6start,
sizeof (v6start));
564 else if (
unformat (input,
"fib-table %d", &table_id))
570 if (!v4set && !v6set)
582 case VNET_API_ERROR_NO_SUCH_FIB:
585 case VNET_API_ERROR_INVALID_ARGUMENT:
603 case VNET_API_ERROR_NO_SUCH_FIB:
617 .path =
"tcp src-address",
618 .short_help =
"tcp src-address <ip-addr> [- <ip-addr>] add src address range",
626 #if TCP_SCOREBOARD_TRACE 634 s =
format (s,
"scoreboard trace:");
637 s =
format (s,
"{%u, %u, %u, %u, %u}, ", block->start, block->end,
638 block->ack, block->snd_una_max, block->group);
658 TRANSPORT_PROTO_TCP))
680 .path =
"show tcp scoreboard trace",
681 .short_help =
"show tcp scoreboard trace <connection>",
691 u32 next_ack,
left, group, has_new_ack = 0;
697 s =
format (s,
"scoreboard tracing not enabled");
704 clib_memset (placeholder_tc, 0,
sizeof (*placeholder_tc));
707 placeholder_tc->rcv_opts.flags |= TCP_OPTS_FLAG_SACK;
709 #if TCP_SCOREBOARD_TRACE 710 trace = tc->sack_sb.trace;
711 trace_len =
vec_len (tc->sack_sb.trace);
714 for (i = 0; i < trace_len; i++)
716 if (trace[i].ack != 0)
718 placeholder_tc->snd_una = trace[
i].ack - 1448;
719 placeholder_tc->snd_una_max = trace[
i].ack;
724 while (left < trace_len)
726 group = trace[
left].group;
729 while (trace[left].group == group)
731 if (trace[left].ack != 0)
734 s =
format (s,
"Adding ack %u, snd_una_max %u, segs: ",
735 trace[left].ack, trace[left].snd_una_max);
736 placeholder_tc->snd_una_max = trace[
left].snd_una_max;
737 next_ack = trace[
left].ack;
743 s =
format (s,
"[%u, %u], ", trace[left].start,
745 vec_add2 (placeholder_tc->rcv_opts.sacks, block, 1);
746 block->start = trace[
left].start;
747 block->end = trace[
left].end;
755 placeholder_tc->snd_una = next_ack;
759 &placeholder_tc->sack_sb);
778 TRANSPORT_PROTO_TCP))
805 .path =
"tcp replay scoreboard",
806 .short_help =
"tcp replay scoreboard <connection>",
820 tm->punt_unknown4 ?
"enabled" :
"disabled");
822 tm->punt_unknown6 ?
"enabled" :
"disabled");
828 .path =
"show tcp punt",
829 .short_help =
"show tcp punt",
845 for (thread = 0; thread <
vec_len (tm->wrk_ctx); thread++)
854 #define _(name,type,str) \ 855 if (wrk->stats.name) \ 856 vlib_cli_output (vm, " %lu %s", wrk->stats.name, str); 867 .path =
"show tcp stats",
868 .short_help =
"show tcp stats",
885 for (thread = 0; thread <
vec_len (tm->wrk_ctx); thread++)
897 .path =
"clear tcp stats",
898 .short_help =
"clear tcp stats",
907 u8 output_suppressed = 0;
912 n_elts =
pool_elts (tm->half_open_connections);
914 if (verbose && end == ~0 && n_elts > 50)
926 for (i = start; i <=
clib_min (end, max_index); i++)
936 if (count > 50 || (verbose > 1 && count > 10))
938 output_suppressed = 1;
944 if (!output_suppressed)
948 "suppressed. Use finer grained filter.", count);
957 u32 start,
end = ~0, verbose = 0;
970 if (
unformat (line_input,
"range %u %u", &start, &end))
972 else if (
unformat (line_input,
"verbose %d", &verbose))
974 else if (
unformat (line_input,
"verbose"))
1001 .path =
"show tcp half-open",
1002 .short_help =
"show tcp half-open [verbose <n>] [range <start> <end>]",
1016 if (
unformat (input,
"%s", &cc_algo_name)
1017 && ((p =
hash_get_mem (tm->cc_algo_by_name, cc_algo_name))))
1037 if (!
unformat (input, cc_alg->name))
1040 if (cc_alg->unformat_cfg
1043 if (cc_alg->unformat_cfg (&sub_input))
1053 u32 cwnd_multiplier, tmp_time, mtu;
1058 if (
unformat (input,
"preallocated-connections %d",
1059 &
tcp_cfg.preallocated_connections))
1061 else if (
unformat (input,
"preallocated-half-open-connections %d",
1062 &
tcp_cfg.preallocated_half_open_connections))
1064 else if (
unformat (input,
"buffer-fail-fraction %f",
1065 &
tcp_cfg.buffer_fail_fraction))
1070 if (memory_size >= 0x100000000)
1073 (0,
"max-rx-fifo %llu (0x%llx) too large", memory_size,
1081 if (memory_size >= 0x100000000)
1084 (0,
"min-rx-fifo %llu (0x%llx) too large", memory_size,
1089 else if (
unformat (input,
"mtu %u", &mtu))
1091 else if (
unformat (input,
"rwnd-min-update-ack %d",
1092 &
tcp_cfg.rwnd_min_update_ack))
1094 else if (
unformat (input,
"initial-cwnd-multiplier %u",
1096 tcp_cfg.initial_cwnd_multiplier = cwnd_multiplier;
1097 else if (
unformat (input,
"no-tx-pacing"))
1101 else if (
unformat (input,
"no-csum-offload"))
1108 else if (
unformat (input,
"closewait-time %u", &tmp_time))
1110 else if (
unformat (input,
"timewait-time %u", &tmp_time))
1112 else if (
unformat (input,
"finwait1-time %u", &tmp_time))
1114 else if (
unformat (input,
"finwait2-time %u", &tmp_time))
1116 else if (
unformat (input,
"lastack-time %u", &tmp_time))
1118 else if (
unformat (input,
"closing-time %u", &tmp_time))
1120 else if (
unformat (input,
"cleanup-time %u", &tmp_time))
1121 tcp_cfg.cleanup_time = tmp_time / 1000.0;
static clib_error_t * tcp_show_scoreboard_trace_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd_arg)
fib_protocol_t fp_proto
protocol type
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
#define TCP_TIMER_HANDLE_INVALID
void receive_dpo_add_or_lock(dpo_proto_t proto, u32 sw_if_index, const ip46_address_t *nh_addr, dpo_id_t *dpo)
struct _sack_block sack_block_t
static u32 tcp_time_now(void)
#define foreach_tcp_wrk_stat
static uword clib_fifo_elts(void *v)
uword unformat_transport_connection(unformat_input_t *input, va_list *args)
#define session_cli_return_if_not_enabled()
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static u8 * format_tcp_cfg_flags(u8 *s, va_list *args)
struct _tcp_main tcp_main_t
struct _tcp_connection tcp_connection_t
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static heap_elt_t * last(heap_header_t *h)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static u32 tcp_time_now_w_thread(u32 thread_index)
static u8 * format_tcp_congestion_status(u8 *s, va_list *args)
struct _sack_scoreboard sack_scoreboard_t
#define pool_len(p)
Number of elements in pool vector.
#define TCP_SCOREBOARD_TRACE
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
uword unformat_tcp_cc_algo(unformat_input_t *input, va_list *va)
int ip4_neighbor_proxy_add(u32 fib_index, const ip4_address_t *start, const ip4_address_t *end)
The set of function that vnet requires from the IP neighbour module.
struct _tcp_cc_algorithm tcp_cc_algorithm_t
void tcp_connection_timers_init(tcp_connection_t *tc)
Initialize all connection timers as invalid.
u8 * format_tcp_connection_id(u8 *s, va_list *args)
u8 * format_tcp_scoreboard(u8 *s, va_list *args)
Aggregate type for a prefix.
u8 * format_tcp_rcv_sacks(u8 *s, va_list *args)
#define clib_error_return(e, args...)
pthread_t thread[MAX_CONNS]
static sack_scoreboard_hole_t * scoreboard_first_hole(sack_scoreboard_t *sb)
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.
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.
#define tcp_in_fastrecovery(tc)
#define foreach_tcp_connection_flag
TCP connection flags.
u8 * format_tcp_state(u8 *s, va_list *args)
#define foreach_tcp_fsm_state
TCP FSM state definitions as per RFC793.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static sack_scoreboard_hole_t * scoreboard_next_hole(sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
const char * tcp_connection_flags_str[]
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static u8 * format_tcp_timers(u8 *s, va_list *args)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
u8 * format_tcp_sacks(u8 *s, va_list *args)
int tcp_fastrecovery_prr_snd_space(tcp_connection_t *tc)
Estimate send space using proportional rate reduction (RFC6937)
#define TCP_TIMER_TICK
Timer tick in seconds.
#define VLIB_CONFIG_FUNCTION(x, n,...)
static u8 * format_tcp_vars(u8 *s, va_list *args)
static u32 tcp_available_output_snd_space(const tcp_connection_t *tc)
#define foreach_tcp_cfg_flag
Connection configuration flags.
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
static u32 tcp_flight_size(const tcp_connection_t *tc)
Our estimate of the number of bytes in flight (pipe size)
fib_node_index_t fib_table_entry_special_dpo_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Update a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the...
void scoreboard_init(sack_scoreboard_t *sb)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
u8 * tcp_scoreboard_replay(u8 *s, tcp_connection_t *tc, u8 verbose)
#define tcp_in_recovery(tc)
struct _transport_connection transport_connection_t
u32 fib_node_index_t
A typedef of a node index.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
const char * tcp_conn_timers[]
static u32 tcp_available_cc_snd_space(const tcp_connection_t *tc)
Estimate of how many bytes we can still push into the network.
#define VLIB_CLI_COMMAND(x,...)
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.
uword unformat_vlib_cli_sub_input(unformat_input_t *i, va_list *args)
static u8 * tcp_scoreboard_dump_trace(u8 *s, sack_scoreboard_t *sb)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
int ip6_neighbor_proxy_add(u32 sw_if_index, const ip6_address_t *addr)
static u8 * format_tcp_connection_flags(u8 *s, va_list *args)
From the control plane API.
static clib_error_t * show_tcp_punt_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd_arg)
static i32 tcp_rcv_wnd_available(tcp_connection_t *tc)
struct _sack_scoreboard_hole sack_scoreboard_hole_t
static u8 * format_tcp_sack_hole(u8 *s, va_list *args)
int ip4_neighbor_proxy_enable(u32 sw_if_index)
#define FIB_NODE_INDEX_INVALID
static clib_error_t * show_tcp_stats_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static tcp_worker_ctx_t * tcp_get_worker(u32 thread_index)
static clib_error_t * tcp_config_fn(vlib_main_t *vm, unformat_input_t *input)
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
static clib_error_t * clear_tcp_stats_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static f64 tcp_time_now_us(u32 thread_index)
#define hash_get_mem(h, key)
u8 * format_tcp_connection(u8 *s, va_list *args)
enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e
const char * tcp_fsm_states[]
static clib_error_t * tcp_scoreboard_trace_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd_arg)
vl_api_dhcp_client_state_t state
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
#define vec_foreach(var, vec)
Vector iterator.
f64 end
end of the time range
static u8 * format_tcp_stats(u8 *s, va_list *args)
static clib_error_t * show_tcp_half_open_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
struct _scoreboard_trace_elt scoreboard_trace_elt_t
static u8 * format_tcp_congestion(u8 *s, va_list *args)
static tcp_connection_t * tcp_get_connection_from_transport(transport_connection_t *tconn)
static tcp_main_t * vnet_get_tcp_main()
const char * tcp_cfg_flags_str[]
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 void tcp_show_half_open(vlib_main_t *vm, u32 start, u32 end, u8 verbose)
static clib_error_t * tcp_src_address_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd_arg)
vl_api_interface_index_t sw_if_index
void tcp_rcv_sacks(tcp_connection_t *tc, u32 ack)
#define foreach_tcp_timer
TCP timers.
uword unformat_tcp_cc_algo_cfg(unformat_input_t *input, va_list *va)
static uword pool_elts(void *v)
Number of active elements in a pool.