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_head - tc->iss,
tcp_tstamp (tc) - tc->snd_rxt_ts);
156 s =
format (s,
"%Uprr_start %u prr_delivered %u prr space %u\n",
158 tc->prr_delivered, prr_space);
167 s =
format (s,
"in segs %lu dsegs %lu bytes %lu dupacks %u\n",
168 tc->segs_in, tc->data_segs_in, tc->bytes_in, tc->dupacks_in);
169 s =
format (s,
"%Uout segs %lu dsegs %lu bytes %lu dupacks %u\n",
171 tc->data_segs_out, tc->bytes_out, tc->dupacks_out);
172 s =
format (s,
"%Ufr %u tr %u rxt segs %lu bytes %lu duration %.3f\n",
174 tc->tr_occurences, tc->segs_retrans, tc->bytes_retrans,
176 s =
format (s,
"%Uerr wnd data below %u above %u ack below %u above %u",
178 tc->errors.above_data_wnd, tc->errors.below_ack_wnd,
179 tc->errors.above_ack_wnd);
187 s =
format (s,
" index: %u cfg: %U flags: %U timers: %U\n", tc->c_c_index,
190 s =
format (s,
" snd_una %u snd_nxt %u", tc->snd_una - tc->iss,
191 tc->snd_nxt - tc->iss);
192 s =
format (s,
" rcv_nxt %u rcv_las %u\n",
193 tc->rcv_nxt - tc->irs, tc->rcv_las - tc->irs);
194 s =
format (s,
" snd_wnd %u rcv_wnd %u rcv_wscale %u ",
195 tc->snd_wnd, tc->rcv_wnd, tc->rcv_wscale);
196 s =
format (s,
"snd_wl1 %u snd_wl2 %u\n", tc->snd_wl1 - tc->irs,
197 tc->snd_wl2 - tc->iss);
198 s =
format (s,
" flight size %u out space %u rcv_wnd_av %u",
201 s =
format (s,
" tsval_recent %u\n", tc->tsval_recent);
202 s =
format (s,
" tsecr %u tsecr_last_ack %u tsval_recent_age %u",
203 tc->rcv_opts.tsecr, tc->tsecr_last_ack,
205 s =
format (s,
" snd_mss %u\n", tc->snd_mss);
206 s =
format (s,
" rto %u rto_boff %u srtt %.1f us %.3f rttvar %.1f",
207 tc->rto / 1000, tc->rto_boff, tc->srtt / 1000.0,
208 tc->mrtt_us * 1e3, tc->rttvar / 1000.0);
209 s =
format (s,
" rtt_ts %.4f rtt_seq %u\n", tc->rtt_ts,
210 tc->rtt_seq - tc->iss);
211 s =
format (s,
" next_node %u opaque 0x%x fib_index %u\n",
212 tc->next_node_index, tc->next_node_opaque, tc->c_fib_index);
215 if (tc->state >= TCP_STATE_ESTABLISHED)
235 s =
format (s,
"[%d:%d][%s] %U:%d->%U:%d", tc->c_thread_index,
238 &tc->c_rmt_ip4, clib_net_to_host_u16 (tc->c_rmt_port));
242 s =
format (s,
"[%d:%d][%s] %U:%d->%U:%d", tc->c_thread_index,
245 &tc->c_rmt_ip6, clib_net_to_host_u16 (tc->c_rmt_port));
255 u32 verbose = va_arg (*args,
u32);
280 for (i = 0; i < len - 1; i++)
283 s =
format (s,
" start %u end %u\n", block->start - tc->irs,
284 block->end - tc->irs);
288 block = &sacks[len - 1];
289 s =
format (s,
" start %u end %u", block->start - tc->irs,
290 block->end - tc->irs);
304 for (i = 0; i < len - 1; i++)
307 s =
format (s,
" start %u end %u\n", block->start - tc->iss,
308 block->end - tc->iss);
312 block = &sacks[len - 1];
313 s =
format (s,
" start %u end %u", block->start - tc->iss,
314 block->end - tc->iss);
325 s =
format (s,
" [%u, %u]", hole->start - tc->iss, hole->end - tc->iss);
327 s =
format (s,
" [%u, %u]", hole->start, hole->end);
339 s =
format (s,
"sacked %u last_sacked %u lost %u last_lost %u" 341 sb->sacked_bytes, sb->last_sacked_bytes, sb->lost_bytes,
342 sb->last_lost_bytes, sb->rxt_sacked);
343 s =
format (s,
"%Ulast_delivered %u high_sacked %u is_reneging %u",
345 sb->high_sacked - tc->iss, sb->is_reneging);
346 s =
format (s,
" reorder %u\n", sb->reorder);
347 s =
format (s,
"%Ucur_rxt_hole %u high_rxt %u rescue_rxt %u",
349 sb->high_rxt - tc->iss, sb->rescue_rxt - tc->iss);
354 indent, sb->head, sb->tail,
pool_elts (sb->holes),
380 u32 start_host_byte_order, end_host_byte_order;
392 return VNET_API_ERROR_NO_SUCH_FIB;
394 start_host_byte_order = clib_net_to_host_u32 (start->
as_u32);
395 end_host_byte_order = clib_net_to_host_u32 (end->
as_u32);
398 if ((end_host_byte_order - start_host_byte_order) > (10 << 10))
399 return VNET_API_ERROR_INVALID_ARGUMENT;
410 return VNET_API_ERROR_NEXT_HOP_NOT_IN_FIB;
445 start_host_byte_order++;
446 start->
as_u32 = clib_host_to_net_u32 (start_host_byte_order);
448 while (start_host_byte_order <= end_host_byte_order);
464 ip6_address_t * start,
477 return VNET_API_ERROR_NO_SUCH_FIB;
491 memcpy (&prefix.
fp_addr.ip6, start, sizeof (ip6_address_t));
497 return VNET_API_ERROR_NEXT_HOP_NOT_IN_FIB;
501 if (sw_if_index == (
u32) ~ 0)
502 return VNET_API_ERROR_NO_MATCHING_INTERFACE;
518 if (!memcmp (start, end,
sizeof (start[0])))
523 for (i = 15; i >= 0; i--)
526 if (tmp.as_u8[i] != 0)
539 ip6_address_t v6start, v6end;
552 memcpy (&v4end, &v4start,
sizeof (v4start));
560 memcpy (&v6end, &v6start,
sizeof (v6start));
563 else if (
unformat (input,
"fib-table %d", &table_id))
569 if (!v4set && !v6set)
581 case VNET_API_ERROR_NO_SUCH_FIB:
584 case VNET_API_ERROR_INVALID_ARGUMENT:
602 case VNET_API_ERROR_NO_SUCH_FIB:
616 .path =
"tcp src-address",
617 .short_help =
"tcp src-address <ip-addr> [- <ip-addr>] add src address range",
625 #if TCP_SCOREBOARD_TRACE 633 s =
format (s,
"scoreboard trace:");
636 s =
format (s,
"{%u, %u, %u, %u, %u}, ", block->start, block->end,
637 block->ack, block->snd_una_max, block->group);
657 TRANSPORT_PROTO_TCP))
679 .path =
"show tcp scoreboard trace",
680 .short_help =
"show tcp scoreboard trace <connection>",
690 u32 next_ack,
left, group, has_new_ack = 0;
696 s =
format (s,
"scoreboard tracing not enabled");
703 clib_memset (placeholder_tc, 0,
sizeof (*placeholder_tc));
706 placeholder_tc->rcv_opts.flags |= TCP_OPTS_FLAG_SACK;
708 #if TCP_SCOREBOARD_TRACE 709 trace = tc->sack_sb.trace;
710 trace_len =
vec_len (tc->sack_sb.trace);
713 for (i = 0; i < trace_len; i++)
715 if (trace[i].ack != 0)
717 placeholder_tc->snd_una = trace[
i].ack - 1448;
718 placeholder_tc->snd_nxt = trace[
i].ack;
723 while (left < trace_len)
725 group = trace[
left].group;
728 while (trace[left].group == group)
730 if (trace[left].ack != 0)
733 s =
format (s,
"Adding ack %u, snd_una_max %u, segs: ",
734 trace[left].ack, trace[left].snd_nxt);
735 placeholder_tc->snd_nxt = trace[
left].snd_nxt;
736 next_ack = trace[
left].ack;
742 s =
format (s,
"[%u, %u], ", trace[left].start,
744 vec_add2 (placeholder_tc->rcv_opts.sacks, block, 1);
745 block->start = trace[
left].start;
746 block->end = trace[
left].end;
754 placeholder_tc->snd_una = next_ack;
758 &placeholder_tc->sack_sb);
777 TRANSPORT_PROTO_TCP))
804 .path =
"tcp replay scoreboard",
805 .short_help =
"tcp replay scoreboard <connection>",
819 tm->punt_unknown4 ?
"enabled" :
"disabled");
821 tm->punt_unknown6 ?
"enabled" :
"disabled");
827 .path =
"show tcp punt",
828 .short_help =
"show tcp punt",
844 for (thread = 0; thread <
vec_len (tm->wrk_ctx); thread++)
853 #define _(name,type,str) \ 854 if (wrk->stats.name) \ 855 vlib_cli_output (vm, " %lu %s", wrk->stats.name, str); 866 .path =
"show tcp stats",
867 .short_help =
"show tcp stats",
884 for (thread = 0; thread <
vec_len (tm->wrk_ctx); thread++)
896 .path =
"clear tcp stats",
897 .short_help =
"clear tcp stats",
906 u8 output_suppressed = 0;
911 n_elts =
pool_elts (tm->half_open_connections);
913 if (verbose && end == ~0 && n_elts > 50)
925 for (i = start; i <=
clib_min (end, max_index); i++)
935 if (count > 50 || (verbose > 1 && count > 10))
937 output_suppressed = 1;
943 if (!output_suppressed)
947 "suppressed. Use finer grained filter.", count);
956 u32 start,
end = ~0, verbose = 0;
969 if (
unformat (line_input,
"range %u %u", &start, &end))
971 else if (
unformat (line_input,
"verbose %d", &verbose))
973 else if (
unformat (line_input,
"verbose"))
1000 .path =
"show tcp half-open",
1001 .short_help =
"show tcp half-open [verbose <n>] [range <start> <end>]",
1015 if (
unformat (input,
"%s", &cc_algo_name)
1016 && ((p =
hash_get_mem (tm->cc_algo_by_name, cc_algo_name))))
1036 if (!
unformat (input, cc_alg->name))
1039 if (cc_alg->unformat_cfg
1042 if (cc_alg->unformat_cfg (&sub_input))
1052 u32 cwnd_multiplier, tmp_time, mtu, max_gso_size;
1057 if (
unformat (input,
"preallocated-connections %d",
1058 &
tcp_cfg.preallocated_connections))
1060 else if (
unformat (input,
"preallocated-half-open-connections %d",
1061 &
tcp_cfg.preallocated_half_open_connections))
1063 else if (
unformat (input,
"buffer-fail-fraction %f",
1064 &
tcp_cfg.buffer_fail_fraction))
1069 if (memory_size >= 0x100000000)
1072 (0,
"max-rx-fifo %llu (0x%llx) too large", memory_size,
1080 if (memory_size >= 0x100000000)
1083 (0,
"min-rx-fifo %llu (0x%llx) too large", memory_size,
1088 else if (
unformat (input,
"mtu %u", &mtu))
1090 else if (
unformat (input,
"rwnd-min-update-ack %d",
1091 &
tcp_cfg.rwnd_min_update_ack))
1093 else if (
unformat (input,
"initial-cwnd-multiplier %u",
1095 tcp_cfg.initial_cwnd_multiplier = cwnd_multiplier;
1096 else if (
unformat (input,
"no-tx-pacing"))
1100 else if (
unformat (input,
"no-csum-offload"))
1102 else if (
unformat (input,
"max-gso-size %u", &max_gso_size))
1109 else if (
unformat (input,
"closewait-time %u", &tmp_time))
1111 else if (
unformat (input,
"timewait-time %u", &tmp_time))
1113 else if (
unformat (input,
"finwait1-time %u", &tmp_time))
1115 else if (
unformat (input,
"finwait2-time %u", &tmp_time))
1117 else if (
unformat (input,
"lastack-time %u", &tmp_time))
1119 else if (
unformat (input,
"closing-time %u", &tmp_time))
1121 else if (
unformat (input,
"cleanup-time %u", &tmp_time))
1122 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)
#define SESSION_CLI_STATE_LEN
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
#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 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)
description fragment has unexpected format
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.
vl_api_interface_index_t sw_if_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 u32 tcp_time_tstamp(u32 thread_index)
Time used to generate timestamps, not the timestamp.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
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 SESSION_CLI_ID_LEN
#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)
static u32 tcp_tstamp(tcp_connection_t *tc)
Generate timestamp for tcp connection.
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)
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.