|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
22 #define _(sym, str) str,
40 #define _(sym, str) str,
52 if (tc->cfg_flags & (1 <<
i))
56 if (tc->cfg_flags & (1 <<
i))
65 #define _(sym, str) str,
77 if (tc->flags & (1 <<
i))
81 if (tc->flags & (1 <<
i))
90 #define _(sym, str) str,
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 sw_if_index %d\n",
212 tc->next_node_index, tc->next_node_opaque, tc->c_fib_index,
216 if (tc->state >= TCP_STATE_ESTABLISHED)
236 s =
format (s,
"[%d:%d][%s] %U:%d->%U:%d", tc->c_thread_index,
239 &tc->c_rmt_ip4, clib_net_to_host_u16 (tc->c_rmt_port));
243 s =
format (s,
"[%d:%d][%s] %U:%d->%U:%d", tc->c_thread_index,
246 &tc->c_rmt_ip6, clib_net_to_host_u16 (tc->c_rmt_port));
256 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;
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));
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++)
718 placeholder_tc->snd_una =
trace[
i].ack - 1448;
719 placeholder_tc->snd_nxt =
trace[
i].ack;
724 while (
left < trace_len)
734 s =
format (s,
"Adding ack %u, snd_una_max %u, segs: ",
736 placeholder_tc->snd_nxt =
trace[
left].snd_nxt;
745 vec_add2 (placeholder_tc->rcv_opts.sacks, block, 1);
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",
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",
897 .path =
"clear tcp stats",
898 .short_help =
"clear tcp stats",
912 if (
unformat (input,
"%s", &cc_algo_name)
913 && ((p =
hash_get_mem (tm->cc_algo_by_name, cc_algo_name))))
933 if (!
unformat (input, cc_alg->name))
936 if (cc_alg->unformat_cfg
939 if (cc_alg->unformat_cfg (&sub_input))
949 u32 cwnd_multiplier, tmp_time, mtu, max_gso_size,
tmp;
954 if (
unformat (input,
"preallocated-connections %d",
955 &
tcp_cfg.preallocated_connections))
958 else if (
unformat (input,
"preallocated-half-open-connections %d", &
tmp))
960 else if (
unformat (input,
"buffer-fail-fraction %f",
961 &
tcp_cfg.buffer_fail_fraction))
969 (0,
"max-rx-fifo %llu (0x%llx) too large",
memory_size,
980 (0,
"min-rx-fifo %llu (0x%llx) too large",
memory_size,
985 else if (
unformat (input,
"mtu %u", &mtu))
987 else if (
unformat (input,
"rwnd-min-update-ack %d",
990 else if (
unformat (input,
"initial-cwnd-multiplier %u",
992 tcp_cfg.initial_cwnd_multiplier = cwnd_multiplier;
993 else if (
unformat (input,
"no-tx-pacing"))
997 else if (
unformat (input,
"no-csum-offload"))
999 else if (
unformat (input,
"max-gso-size %u", &max_gso_size))
1006 else if (
unformat (input,
"closewait-time %u", &tmp_time))
1008 else if (
unformat (input,
"timewait-time %u", &tmp_time))
1010 else if (
unformat (input,
"finwait1-time %u", &tmp_time))
1012 else if (
unformat (input,
"finwait2-time %u", &tmp_time))
1014 else if (
unformat (input,
"lastack-time %u", &tmp_time))
1016 else if (
unformat (input,
"closing-time %u", &tmp_time))
1018 else if (
unformat (input,
"alloc-err-timeout %u", &tmp_time))
1020 else if (
unformat (input,
"cleanup-time %u", &tmp_time))
1021 tcp_cfg.cleanup_time = tmp_time / 1000.0;
#define foreach_tcp_connection_flag
TCP connection flags.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#define SESSION_CLI_STATE_LEN
void tcp_rcv_sacks(tcp_connection_t *tc, u32 ack)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
const char * tcp_cfg_flags_str[]
#define foreach_tcp_wrk_stat
#define SESSION_CLI_ID_LEN
uword unformat_tcp_cc_algo_cfg(unformat_input_t *input, va_list *va)
#define foreach_tcp_fsm_state
TCP FSM state definitions as per RFC793.
static vlib_cli_command_t clear_tcp_stats_command
(constructor) VLIB_CLI_COMMAND (clear_tcp_stats_command)
static vlib_cli_command_t show_tcp_stats_command
(constructor) VLIB_CLI_COMMAND (show_tcp_stats_command)
static uword clib_fifo_elts(void *v)
const char * tcp_connection_flags_str[]
static u32 tcp_available_output_snd_space(const tcp_connection_t *tc)
struct _tcp_connection tcp_connection_t
#define clib_error_return(e, args...)
u8 * format_tcp_scoreboard(u8 *s, va_list *args)
pthread_t thread[MAX_CONNS]
static tcp_main_t * vnet_get_tcp_main()
#define FIB_NODE_INDEX_INVALID
static tcp_worker_ctx_t * tcp_get_worker(u32 thread_index)
u8 * format_tcp_connection_id(u8 *s, va_list *args)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static u32 tcp_time_tstamp(u32 thread_index)
Time used to generate timestamps, not the timestamp.
vl_api_dhcp_client_state_t state
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.
@ FIB_ENTRY_FLAG_EXCLUSIVE
struct _transport_connection transport_connection_t
u8 * format_tcp_state(u8 *s, va_list *args)
struct _tcp_main tcp_main_t
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...
static clib_error_t * tcp_show_scoreboard_trace_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd_arg)
#define VLIB_CONFIG_FUNCTION(x, n,...)
const char * tcp_fsm_states[]
static u8 * format_tcp_congestion_status(u8 *s, va_list *args)
static u8 * tcp_scoreboard_dump_trace(u8 *s, sack_scoreboard_t *sb)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static u8 * format_tcp_stats(u8 *s, va_list *args)
#define TCP_SCOREBOARD_TRACE
#define tcp_in_recovery(tc)
int ip4_neighbor_proxy_enable(u32 sw_if_index)
struct _sack_scoreboard sack_scoreboard_t
static clib_error_t * show_tcp_punt_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd_arg)
#define foreach_tcp_cfg_flag
Connection configuration flags.
f64 end
end of the time range
enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e
u32 fib_node_index_t
A typedef of a node index.
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 u8 * format_tcp_congestion(u8 *s, va_list *args)
static heap_elt_t * last(heap_header_t *h)
const char * tcp_conn_timers[]
u8 * tcp_scoreboard_replay(u8 *s, tcp_connection_t *tc, 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 scoreboard_init(sack_scoreboard_t *sb)
#define VLIB_CLI_COMMAND(x,...)
u8 * format_tcp_sacks(u8 *s, va_list *args)
struct _sack_block sack_block_t
int ip6_neighbor_proxy_add(u32 sw_if_index, const ip6_address_t *addr)
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
#define TCP_TIMER_TICK
Timer tick in seconds.
uword unformat_vlib_cli_sub_input(unformat_input_t *i, va_list *args)
static u32 tcp_tstamp(tcp_connection_t *tc)
Generate timestamp for tcp connection.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static sack_scoreboard_hole_t * scoreboard_next_hole(sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
uword unformat_tcp_cc_algo(unformat_input_t *input, va_list *va)
static f64 tcp_time_now_us(u32 thread_index)
uword unformat_transport_connection(unformat_input_t *input, va_list *args)
u8 * format_tcp_connection(u8 *s, va_list *args)
static u8 * format_tcp_connection_flags(u8 *s, va_list *args)
static vlib_cli_command_t tcp_src_address_command
(constructor) VLIB_CLI_COMMAND (tcp_src_address_command)
#define hash_get_mem(h, key)
#define vec_free(V)
Free vector's memory (no header).
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 _sack_scoreboard_hole sack_scoreboard_hole_t
void tcp_connection_timers_init(tcp_connection_t *tc)
Initialize all connection timers as invalid.
static u8 * format_tcp_sack_hole(u8 *s, va_list *args)
static vlib_cli_command_t tcp_show_scoreboard_trace_command
(constructor) VLIB_CLI_COMMAND (tcp_show_scoreboard_trace_command)
description fragment has unexpected format
#define tcp_in_fastrecovery(tc)
static clib_error_t * show_tcp_stats_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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.
#define vec_foreach(var, vec)
Vector iterator.
static uword pool_elts(void *v)
Number of active elements in a pool.
@ FIB_SOURCE_API
From the control plane API.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static tcp_connection_t * tcp_get_connection_from_transport(transport_connection_t *tconn)
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 _tcp_cc_algorithm tcp_cc_algorithm_t
static u32 tcp_flight_size(const tcp_connection_t *tc)
Our estimate of the number of bytes in flight (pipe size)
static sack_scoreboard_hole_t * scoreboard_first_hole(sack_scoreboard_t *sb)
u8 * format_tcp_rcv_sacks(u8 *s, va_list *args)
static u8 * format_tcp_cfg_flags(u8 *s, va_list *args)
static i32 tcp_rcv_wnd_available(tcp_connection_t *tc)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static vlib_cli_command_t tcp_replay_scoreboard_command
(constructor) VLIB_CLI_COMMAND (tcp_replay_scoreboard_command)
int tcp_fastrecovery_prr_snd_space(tcp_connection_t *tc)
Estimate send space using proportional rate reduction (RFC6937)
struct _scoreboard_trace_elt scoreboard_trace_elt_t
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
static u8 * format_tcp_timers(u8 *s, va_list *args)
vl_api_interface_index_t sw_if_index
#define TCP_TIMER_HANDLE_INVALID
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
static clib_error_t * clear_tcp_stats_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define foreach_tcp_timer
TCP timers.
Aggregate type for a prefix.
static clib_error_t * tcp_scoreboard_trace_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd_arg)
static clib_error_t * tcp_config_fn(vlib_main_t *vm, unformat_input_t *input)
static vlib_cli_command_t show_tcp_punt_command
(constructor) VLIB_CLI_COMMAND (show_tcp_punt_command)
static u8 * format_tcp_vars(u8 *s, va_list *args)
static u32 tcp_available_cc_snd_space(const tcp_connection_t *tc)
Estimate of how many bytes we can still push into the network.