FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
tcp_cli.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <vnet/tcp/tcp.h>
17 #include <vnet/tcp/tcp_inlines.h>
18 #include <vnet/dpo/receive_dpo.h>
20 
21 const char *tcp_fsm_states[] = {
22 #define _(sym, str) str,
24 #undef _
25 };
26 
27 u8 *
28 format_tcp_state (u8 * s, va_list * args)
29 {
30  u32 state = va_arg (*args, u32);
31 
32  if (state < TCP_N_STATES)
33  s = format (s, "%s", tcp_fsm_states[state]);
34  else
35  s = format (s, "UNKNOWN (%d (0x%x))", state, state);
36  return s;
37 }
38 
39 const char *tcp_cfg_flags_str[] = {
40 #define _(sym, str) str,
42 #undef _
43 };
44 
45 static u8 *
46 format_tcp_cfg_flags (u8 * s, va_list * args)
47 {
48  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
49  int i, last = -1;
50 
51  for (i = 0; i < TCP_CFG_N_FLAG_BITS; i++)
52  if (tc->cfg_flags & (1 << i))
53  last = i;
54  for (i = 0; i < last; i++)
55  {
56  if (tc->cfg_flags & (1 << i))
57  s = format (s, "%s, ", tcp_cfg_flags_str[i]);
58  }
59  if (last >= 0)
60  s = format (s, "%s", tcp_cfg_flags_str[last]);
61  return s;
62 }
63 
64 const char *tcp_connection_flags_str[] = {
65 #define _(sym, str) str,
67 #undef _
68 };
69 
70 static u8 *
71 format_tcp_connection_flags (u8 * s, va_list * args)
72 {
73  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
74  int i, last = -1;
75 
76  for (i = 0; i < TCP_CONN_N_FLAG_BITS; i++)
77  if (tc->flags & (1 << i))
78  last = i;
79  for (i = 0; i < last; i++)
80  {
81  if (tc->flags & (1 << i))
82  s = format (s, "%s, ", tcp_connection_flags_str[i]);
83  }
84  if (last >= 0)
85  s = format (s, "%s", tcp_connection_flags_str[last]);
86  return s;
87 }
88 
89 const char *tcp_conn_timers[] = {
90 #define _(sym, str) str,
92 #undef _
93 };
94 
95 static u8 *
96 format_tcp_timers (u8 * s, va_list * args)
97 {
98  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
99  int i, last = -1;
100 
101  for (i = 0; i < TCP_N_TIMERS; i++)
102  if (tc->timers[i] != TCP_TIMER_HANDLE_INVALID)
103  last = i;
104 
105  for (i = 0; i < last; i++)
106  {
107  if (tc->timers[i] != TCP_TIMER_HANDLE_INVALID)
108  s = format (s, "%s,", tcp_conn_timers[i]);
109  }
110 
111  if (last >= 0)
112  s = format (s, "%s", tcp_conn_timers[i]);
113 
114  return s;
115 }
116 
117 static u8 *
118 format_tcp_congestion_status (u8 * s, va_list * args)
119 {
120  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
121  if (tcp_in_recovery (tc))
122  s = format (s, "recovery");
123  else if (tcp_in_fastrecovery (tc))
124  s = format (s, "fastrecovery");
125  else
126  s = format (s, "none");
127  return s;
128 }
129 
130 static i32
132 {
133  return (i32) tc->rcv_wnd - (tc->rcv_nxt - tc->rcv_las);
134 }
135 
136 static u8 *
137 format_tcp_congestion (u8 * s, va_list * args)
138 {
139  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
140  u32 indent = format_get_indent (s), prr_space = 0;
141 
142  s = format (s, "%U ", format_tcp_congestion_status, tc);
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",
149  format_white_space, indent, tc->snd_congestion - tc->iss,
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",
152  format_white_space, indent, tc->snd_rxt_bytes,
153  tc->rxt_delivered, tc->rxt_head - tc->iss,
154  tcp_time_now_w_thread (tc->c_thread_index) - tc->snd_rxt_ts);
155  if (tcp_in_fastrecovery (tc))
156  prr_space = tcp_fastrecovery_prr_snd_space (tc);
157  s = format (s, "%Uprr_start %u prr_delivered %u prr space %u\n",
158  format_white_space, indent, tc->prr_start - tc->iss,
159  tc->prr_delivered, prr_space);
160  return s;
161 }
162 
163 static u8 *
164 format_tcp_stats (u8 * s, va_list * args)
165 {
166  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
167  u32 indent = format_get_indent (s);
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",
171  format_white_space, indent, tc->segs_out,
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",
174  format_white_space, indent, tc->fr_occurences,
175  tc->tr_occurences, tc->segs_retrans, tc->bytes_retrans,
176  tcp_time_now_us (tc->c_thread_index) - tc->start_ts);
177  s = format (s, "%Uerr wnd data below %u above %u ack below %u above %u",
178  format_white_space, indent, tc->errors.below_data_wnd,
179  tc->errors.above_data_wnd, tc->errors.below_ack_wnd,
180  tc->errors.above_ack_wnd);
181  return s;
182 }
183 
184 static u8 *
185 format_tcp_vars (u8 * s, va_list * args)
186 {
187  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
188  s = format (s, " index: %u cfg: %U flags: %U timers: %U\n", tc->c_c_index,
190  format_tcp_timers, tc);
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",
202  tcp_rcv_wnd_available (tc));
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,
206  tcp_time_now () - tc->tsval_recent_age);
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);
215  s = format (s, " cong: %U", format_tcp_congestion, tc);
216 
217  if (tc->state >= TCP_STATE_ESTABLISHED)
218  {
219  s = format (s, " sboard: %U\n", format_tcp_scoreboard, &tc->sack_sb,
220  tc);
221  s = format (s, " stats: %U\n", format_tcp_stats, tc);
222  }
223  if (vec_len (tc->snd_sacks))
224  s = format (s, " sacks tx: %U\n", format_tcp_sacks, tc);
225 
226  return s;
227 }
228 
229 u8 *
230 format_tcp_connection_id (u8 * s, va_list * args)
231 {
232  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
233  if (!tc)
234  return s;
235  if (tc->c_is_ip4)
236  {
237  s = format (s, "[%d:%d][%s] %U:%d->%U:%d", tc->c_thread_index,
238  tc->c_s_index, "T", format_ip4_address, &tc->c_lcl_ip4,
239  clib_net_to_host_u16 (tc->c_lcl_port), format_ip4_address,
240  &tc->c_rmt_ip4, clib_net_to_host_u16 (tc->c_rmt_port));
241  }
242  else
243  {
244  s = format (s, "[%d:%d][%s] %U:%d->%U:%d", tc->c_thread_index,
245  tc->c_s_index, "T", format_ip6_address, &tc->c_lcl_ip6,
246  clib_net_to_host_u16 (tc->c_lcl_port), format_ip6_address,
247  &tc->c_rmt_ip6, clib_net_to_host_u16 (tc->c_rmt_port));
248  }
249 
250  return s;
251 }
252 
253 u8 *
254 format_tcp_connection (u8 * s, va_list * args)
255 {
256  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
257  u32 verbose = va_arg (*args, u32);
258 
259  if (!tc)
260  return s;
261  s = format (s, "%-50U", format_tcp_connection_id, tc);
262  if (verbose)
263  {
264  s = format (s, "%-15U", format_tcp_state, tc->state);
265  if (verbose > 1)
266  s = format (s, "\n%U", format_tcp_vars, tc);
267  }
268 
269  return s;
270 }
271 
272 u8 *
273 format_tcp_sacks (u8 * s, va_list * args)
274 {
275  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
276  sack_block_t *sacks = tc->snd_sacks;
277  sack_block_t *block;
278  int i, len = 0;
279 
280  len = vec_len (sacks);
281  for (i = 0; i < len - 1; i++)
282  {
283  block = &sacks[i];
284  s = format (s, " start %u end %u\n", block->start - tc->irs,
285  block->end - tc->irs);
286  }
287  if (len)
288  {
289  block = &sacks[len - 1];
290  s = format (s, " start %u end %u", block->start - tc->irs,
291  block->end - tc->irs);
292  }
293  return s;
294 }
295 
296 u8 *
297 format_tcp_rcv_sacks (u8 * s, va_list * args)
298 {
299  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
300  sack_block_t *sacks = tc->rcv_opts.sacks;
301  sack_block_t *block;
302  int i, len = 0;
303 
304  len = vec_len (sacks);
305  for (i = 0; i < len - 1; i++)
306  {
307  block = &sacks[i];
308  s = format (s, " start %u end %u\n", block->start - tc->iss,
309  block->end - tc->iss);
310  }
311  if (len)
312  {
313  block = &sacks[len - 1];
314  s = format (s, " start %u end %u", block->start - tc->iss,
315  block->end - tc->iss);
316  }
317  return s;
318 }
319 
320 static u8 *
321 format_tcp_sack_hole (u8 * s, va_list * args)
322 {
323  sack_scoreboard_hole_t *hole = va_arg (*args, sack_scoreboard_hole_t *);
324  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
325  if (tc)
326  s = format (s, " [%u, %u]", hole->start - tc->iss, hole->end - tc->iss);
327  else
328  s = format (s, " [%u, %u]", hole->start, hole->end);
329  return s;
330 }
331 
332 u8 *
333 format_tcp_scoreboard (u8 * s, va_list * args)
334 {
335  sack_scoreboard_t *sb = va_arg (*args, sack_scoreboard_t *);
336  tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
338  u32 indent = format_get_indent (s);
339 
340  s = format (s, "sacked %u last_sacked %u lost %u last_lost %u"
341  " rxt_sacked %u\n",
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",
345  format_white_space, indent, sb->last_bytes_delivered,
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",
349  format_white_space, indent, sb->cur_rxt_hole,
350  sb->high_rxt - tc->iss, sb->rescue_rxt - tc->iss);
351 
352  hole = scoreboard_first_hole (sb);
353  if (hole)
354  s = format (s, "\n%Uhead %u tail %u %u holes:\n%U", format_white_space,
355  indent, sb->head, sb->tail, pool_elts (sb->holes),
356  format_white_space, indent);
357 
358  while (hole)
359  {
360  s = format (s, "%U", format_tcp_sack_hole, hole, tc);
361  hole = scoreboard_next_hole (sb, hole);
362  }
363 
364  return s;
365 }
366 
367 /**
368  * \brief Configure an ipv4 source address range
369  * @param vm vlib_main_t pointer
370  * @param start first ipv4 address in the source address range
371  * @param end last ipv4 address in the source address range
372  * @param table_id VRF / table ID, 0 for the default FIB
373  * @return 0 if all OK, else an error indication from api_errno.h
374  */
375 
376 int
378  ip4_address_t * start,
380 {
381  u32 start_host_byte_order, end_host_byte_order;
383  fib_node_index_t fei;
384  u32 fib_index = 0;
386  int rv;
387 
388  clib_memset (&prefix, 0, sizeof (prefix));
389 
390  fib_index = fib_table_find (FIB_PROTOCOL_IP4, table_id);
391 
392  if (fib_index == ~0)
393  return VNET_API_ERROR_NO_SUCH_FIB;
394 
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);
397 
398  /* sanity check for reversed args or some such */
399  if ((end_host_byte_order - start_host_byte_order) > (10 << 10))
400  return VNET_API_ERROR_INVALID_ARGUMENT;
401 
402  /* Lookup the last address, to identify the interface involved */
403  prefix.fp_len = 32;
404  prefix.fp_proto = FIB_PROTOCOL_IP4;
405  memcpy (&prefix.fp_addr.ip4, end, sizeof (ip4_address_t));
406 
407  fei = fib_table_lookup (fib_index, &prefix);
408 
409  /* Couldn't find route to destination. Bail out. */
410  if (fei == FIB_NODE_INDEX_INVALID)
411  return VNET_API_ERROR_NEXT_HOP_NOT_IN_FIB;
412 
413  sw_if_index = fib_entry_get_resolving_interface (fei);
414 
415  /* Configure proxy arp across the range */
416  rv = ip4_neighbor_proxy_add (fib_index, start, end);
417 
418  if (rv)
419  return rv;
420 
421  rv = ip4_neighbor_proxy_enable (sw_if_index);
422 
423  if (rv)
424  return rv;
425 
426  do
427  {
428  dpo_id_t dpo = DPO_INVALID;
429 
430  vec_add1 (tcp_cfg.ip4_src_addrs, start[0]);
431 
432  /* Add local adjacencies for the range */
433 
434  receive_dpo_add_or_lock (DPO_PROTO_IP4, ~0 /* sw_if_index */ ,
435  NULL, &dpo);
436  prefix.fp_len = 32;
437  prefix.fp_proto = FIB_PROTOCOL_IP4;
438  prefix.fp_addr.ip4.as_u32 = start->as_u32;
439 
441  &prefix,
444  dpo_reset (&dpo);
445 
446  start_host_byte_order++;
447  start->as_u32 = clib_host_to_net_u32 (start_host_byte_order);
448  }
449  while (start_host_byte_order <= end_host_byte_order);
450 
451  return 0;
452 }
453 
454 /**
455  * \brief Configure an ipv6 source address range
456  * @param vm vlib_main_t pointer
457  * @param start first ipv6 address in the source address range
458  * @param end last ipv6 address in the source address range
459  * @param table_id VRF / table ID, 0 for the default FIB
460  * @return 0 if all OK, else an error indication from api_errno.h
461  */
462 
463 int
465  ip6_address_t * start,
466  ip6_address_t * end, u32 table_id)
467 {
469  u32 fib_index = 0;
470  fib_node_index_t fei;
472 
473  clib_memset (&prefix, 0, sizeof (prefix));
474 
475  fib_index = fib_table_find (FIB_PROTOCOL_IP6, table_id);
476 
477  if (fib_index == ~0)
478  return VNET_API_ERROR_NO_SUCH_FIB;
479 
480  while (1)
481  {
482  int i;
483  ip6_address_t tmp;
484  dpo_id_t dpo = DPO_INVALID;
485 
486  /* Remember this address */
487  vec_add1 (tcp_cfg.ip6_src_addrs, start[0]);
488 
489  /* Lookup the prefix, to identify the interface involved */
490  prefix.fp_len = 128;
491  prefix.fp_proto = FIB_PROTOCOL_IP6;
492  memcpy (&prefix.fp_addr.ip6, start, sizeof (ip6_address_t));
493 
494  fei = fib_table_lookup (fib_index, &prefix);
495 
496  /* Couldn't find route to destination. Bail out. */
497  if (fei == FIB_NODE_INDEX_INVALID)
498  return VNET_API_ERROR_NEXT_HOP_NOT_IN_FIB;
499 
500  sw_if_index = fib_entry_get_resolving_interface (fei);
501 
502  if (sw_if_index == (u32) ~ 0)
503  return VNET_API_ERROR_NO_MATCHING_INTERFACE;
504 
505  /* Add a proxy neighbor discovery entry for this address */
506  ip6_neighbor_proxy_add (sw_if_index, start);
507 
508  /* Add a receive adjacency for this address */
509  receive_dpo_add_or_lock (DPO_PROTO_IP6, ~0 /* sw_if_index */ ,
510  NULL, &dpo);
511 
513  &prefix,
516  dpo_reset (&dpo);
517 
518  /* Done with the entire range? */
519  if (!memcmp (start, end, sizeof (start[0])))
520  break;
521 
522  /* Increment the address. DGMS. */
523  tmp = start[0];
524  for (i = 15; i >= 0; i--)
525  {
526  tmp.as_u8[i] += 1;
527  if (tmp.as_u8[i] != 0)
528  break;
529  }
530  start[0] = tmp;
531  }
532  return 0;
533 }
534 
535 static clib_error_t *
537  unformat_input_t * input, vlib_cli_command_t * cmd_arg)
538 {
539  ip4_address_t v4start, v4end;
540  ip6_address_t v6start, v6end;
541  u32 table_id = 0;
542  int v4set = 0;
543  int v6set = 0;
544  int rv;
545 
547  {
548  if (unformat (input, "%U - %U", unformat_ip4_address, &v4start,
549  unformat_ip4_address, &v4end))
550  v4set = 1;
551  else if (unformat (input, "%U", unformat_ip4_address, &v4start))
552  {
553  memcpy (&v4end, &v4start, sizeof (v4start));
554  v4set = 1;
555  }
556  else if (unformat (input, "%U - %U", unformat_ip6_address, &v6start,
557  unformat_ip6_address, &v6end))
558  v6set = 1;
559  else if (unformat (input, "%U", unformat_ip6_address, &v6start))
560  {
561  memcpy (&v6end, &v6start, sizeof (v6start));
562  v6set = 1;
563  }
564  else if (unformat (input, "fib-table %d", &table_id))
565  ;
566  else
567  break;
568  }
569 
570  if (!v4set && !v6set)
571  return clib_error_return (0, "at least one v4 or v6 address required");
572 
573  if (v4set)
574  {
575  rv = tcp_configure_v4_source_address_range (vm, &v4start, &v4end,
576  table_id);
577  switch (rv)
578  {
579  case 0:
580  break;
581 
582  case VNET_API_ERROR_NO_SUCH_FIB:
583  return clib_error_return (0, "Invalid table-id %d", table_id);
584 
585  case VNET_API_ERROR_INVALID_ARGUMENT:
586  return clib_error_return (0, "Invalid address range %U - %U",
587  format_ip4_address, &v4start,
588  format_ip4_address, &v4end);
589  default:
590  return clib_error_return (0, "error %d", rv);
591  break;
592  }
593  }
594  if (v6set)
595  {
596  rv = tcp_configure_v6_source_address_range (vm, &v6start, &v6end,
597  table_id);
598  switch (rv)
599  {
600  case 0:
601  break;
602 
603  case VNET_API_ERROR_NO_SUCH_FIB:
604  return clib_error_return (0, "Invalid table-id %d", table_id);
605 
606  default:
607  return clib_error_return (0, "error %d", rv);
608  break;
609  }
610  }
611  return 0;
612 }
613 
614 /* *INDENT-OFF* */
615 VLIB_CLI_COMMAND (tcp_src_address_command, static) =
616 {
617  .path = "tcp src-address",
618  .short_help = "tcp src-address <ip-addr> [- <ip-addr>] add src address range",
619  .function = tcp_src_address_fn,
620 };
621 /* *INDENT-ON* */
622 
623 static u8 *
625 {
626 #if TCP_SCOREBOARD_TRACE
627 
628  scoreboard_trace_elt_t *block;
629  int i = 0;
630 
631  if (!sb->trace)
632  return s;
633 
634  s = format (s, "scoreboard trace:");
635  vec_foreach (block, sb->trace)
636  {
637  s = format (s, "{%u, %u, %u, %u, %u}, ", block->start, block->end,
638  block->ack, block->snd_una_max, block->group);
639  if ((++i % 3) == 0)
640  s = format (s, "\n");
641  }
642  return s;
643 #else
644  return 0;
645 #endif
646 }
647 
648 static clib_error_t *
650  vlib_cli_command_t * cmd_arg)
651 {
652  transport_connection_t *tconn = 0;
653  tcp_connection_t *tc;
654  u8 *s = 0;
656  {
657  if (unformat (input, "%U", unformat_transport_connection, &tconn,
658  TRANSPORT_PROTO_TCP))
659  ;
660  else
661  return clib_error_return (0, "unknown input `%U'",
662  format_unformat_error, input);
663  }
664 
666  {
667  vlib_cli_output (vm, "scoreboard tracing not enabled");
668  return 0;
669  }
670 
672  s = tcp_scoreboard_dump_trace (s, &tc->sack_sb);
673  vlib_cli_output (vm, "%v", s);
674  return 0;
675 }
676 
677 /* *INDENT-OFF* */
678 VLIB_CLI_COMMAND (tcp_show_scoreboard_trace_command, static) =
679 {
680  .path = "show tcp scoreboard trace",
681  .short_help = "show tcp scoreboard trace <connection>",
682  .function = tcp_show_scoreboard_trace_fn,
683 };
684 /* *INDENT-ON* */
685 
686 u8 *
688 {
689  int i, trace_len;
691  u32 next_ack, left, group, has_new_ack = 0;
692  tcp_connection_t _placeholder_tc, *placeholder_tc = &_placeholder_tc;
693  sack_block_t *block;
694 
696  {
697  s = format (s, "scoreboard tracing not enabled");
698  return s;
699  }
700 
701  if (!tc)
702  return s;
703 
704  clib_memset (placeholder_tc, 0, sizeof (*placeholder_tc));
705  tcp_connection_timers_init (placeholder_tc);
706  scoreboard_init (&placeholder_tc->sack_sb);
707  placeholder_tc->rcv_opts.flags |= TCP_OPTS_FLAG_SACK;
708 
709 #if TCP_SCOREBOARD_TRACE
710  trace = tc->sack_sb.trace;
711  trace_len = vec_len (tc->sack_sb.trace);
712 #endif
713 
714  for (i = 0; i < trace_len; i++)
715  {
716  if (trace[i].ack != 0)
717  {
718  placeholder_tc->snd_una = trace[i].ack - 1448;
719  placeholder_tc->snd_una_max = trace[i].ack;
720  }
721  }
722 
723  left = 0;
724  while (left < trace_len)
725  {
726  group = trace[left].group;
727  vec_reset_length (placeholder_tc->rcv_opts.sacks);
728  has_new_ack = 0;
729  while (trace[left].group == group)
730  {
731  if (trace[left].ack != 0)
732  {
733  if (verbose)
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;
738  has_new_ack = 1;
739  }
740  else
741  {
742  if (verbose)
743  s = format (s, "[%u, %u], ", trace[left].start,
744  trace[left].end);
745  vec_add2 (placeholder_tc->rcv_opts.sacks, block, 1);
746  block->start = trace[left].start;
747  block->end = trace[left].end;
748  }
749  left++;
750  }
751 
752  /* Push segments */
753  tcp_rcv_sacks (placeholder_tc, next_ack);
754  if (has_new_ack)
755  placeholder_tc->snd_una = next_ack;
756 
757  if (verbose)
758  s = format (s, "result: %U", format_tcp_scoreboard,
759  &placeholder_tc->sack_sb);
760 
761  }
762  s =
763  format (s, "result: %U", format_tcp_scoreboard, &placeholder_tc->sack_sb);
764 
765  return s;
766 }
767 
768 static clib_error_t *
770  vlib_cli_command_t * cmd_arg)
771 {
772  transport_connection_t *tconn = 0;
773  tcp_connection_t *tc = 0;
774  u8 *str = 0;
776  {
777  if (unformat (input, "%U", unformat_transport_connection, &tconn,
778  TRANSPORT_PROTO_TCP))
779  ;
780  else
781  return clib_error_return (0, "unknown input `%U'",
782  format_unformat_error, input);
783  }
784 
786  {
787  vlib_cli_output (vm, "scoreboard tracing not enabled");
788  return 0;
789  }
790 
792  if (!tc)
793  {
794  vlib_cli_output (vm, "connection not found");
795  return 0;
796  }
797  str = tcp_scoreboard_replay (str, tc, 1);
798  vlib_cli_output (vm, "%v", str);
799  return 0;
800 }
801 
802 /* *INDENT-OFF* */
803 VLIB_CLI_COMMAND (tcp_replay_scoreboard_command, static) =
804 {
805  .path = "tcp replay scoreboard",
806  .short_help = "tcp replay scoreboard <connection>",
807  .function = tcp_scoreboard_trace_fn,
808 };
809 /* *INDENT-ON* */
810 
811 static clib_error_t *
813  vlib_cli_command_t * cmd_arg)
814 {
815  tcp_main_t *tm = vnet_get_tcp_main ();
817  return clib_error_return (0, "unknown input `%U'", format_unformat_error,
818  input);
819  vlib_cli_output (vm, "IPv4 TCP punt: %s",
820  tm->punt_unknown4 ? "enabled" : "disabled");
821  vlib_cli_output (vm, "IPv6 TCP punt: %s",
822  tm->punt_unknown6 ? "enabled" : "disabled");
823  return 0;
824 }
825 /* *INDENT-OFF* */
826 VLIB_CLI_COMMAND (show_tcp_punt_command, static) =
827 {
828  .path = "show tcp punt",
829  .short_help = "show tcp punt",
830  .function = show_tcp_punt_fn,
831 };
832 /* *INDENT-ON* */
833 
834 static clib_error_t *
836  vlib_cli_command_t * cmd)
837 {
838  tcp_main_t *tm = vnet_get_tcp_main ();
839  tcp_worker_ctx_t *wrk;
840  u32 thread;
841 
843  return clib_error_return (0, "unknown input `%U'", format_unformat_error,
844  input);
845  for (thread = 0; thread < vec_len (tm->wrk_ctx); thread++)
846  {
847  wrk = tcp_get_worker (thread);
848  vlib_cli_output (vm, "Thread %u:\n", thread);
849 
850  if (clib_fifo_elts (wrk->pending_timers))
851  vlib_cli_output (vm, " %lu pending timers",
853 
854 #define _(name,type,str) \
855  if (wrk->stats.name) \
856  vlib_cli_output (vm, " %lu %s", wrk->stats.name, str);
858 #undef _
859  }
860 
861  return 0;
862 }
863 
864 /* *INDENT-OFF* */
865 VLIB_CLI_COMMAND (show_tcp_stats_command, static) =
866 {
867  .path = "show tcp stats",
868  .short_help = "show tcp stats",
869  .function = show_tcp_stats_fn,
870 };
871 /* *INDENT-ON* */
872 
873 static clib_error_t *
875  vlib_cli_command_t * cmd)
876 {
877  tcp_main_t *tm = vnet_get_tcp_main ();
878  tcp_worker_ctx_t *wrk;
879  u32 thread;
880 
882  return clib_error_return (0, "unknown input `%U'", format_unformat_error,
883  input);
884 
885  for (thread = 0; thread < vec_len (tm->wrk_ctx); thread++)
886  {
887  wrk = tcp_get_worker (thread);
888  clib_memset (&wrk->stats, 0, sizeof (wrk->stats));
889  }
890 
891  return 0;
892 }
893 
894 /* *INDENT-OFF* */
895 VLIB_CLI_COMMAND (clear_tcp_stats_command, static) =
896 {
897  .path = "clear tcp stats",
898  .short_help = "clear tcp stats",
899  .function = clear_tcp_stats_fn,
900 };
901 /* *INDENT-ON* */
902 
903 static void
905 {
906  tcp_main_t *tm = &tcp_main;
907  u8 output_suppressed = 0;
908  u32 n_elts, count = 0;
909  tcp_connection_t *tc;
910  int max_index, i;
911 
912  n_elts = pool_elts (tm->half_open_connections);
913  max_index = clib_max (pool_len (tm->half_open_connections), 1) - 1;
914  if (verbose && end == ~0 && n_elts > 50)
915  {
916  vlib_cli_output (vm, "Too many connections, use range <start> <end>");
917  return;
918  }
919 
920  if (!verbose)
921  {
922  vlib_cli_output (vm, "%u tcp half-open connections", n_elts);
923  return;
924  }
925 
926  for (i = start; i <= clib_min (end, max_index); i++)
927  {
928  if (pool_is_free_index (tm->half_open_connections, i))
929  continue;
930 
931  tc = pool_elt_at_index (tm->half_open_connections, i);
932 
933  count += 1;
934  if (verbose)
935  {
936  if (count > 50 || (verbose > 1 && count > 10))
937  {
938  output_suppressed = 1;
939  continue;
940  }
941  }
942  vlib_cli_output (vm, "%U", format_tcp_connection, tc, verbose);
943  }
944  if (!output_suppressed)
945  vlib_cli_output (vm, "%u tcp half-open connections", n_elts);
946  else
947  vlib_cli_output (vm, "%u tcp half-open connections matched. Output "
948  "suppressed. Use finer grained filter.", count);
949 
950 }
951 
952 static clib_error_t *
954  vlib_cli_command_t * cmd)
955 {
956  unformat_input_t _line_input, *line_input = &_line_input;
957  u32 start, end = ~0, verbose = 0;
958  clib_error_t *error = 0;
959 
961 
962  if (!unformat_user (input, unformat_line_input, line_input))
963  {
964  tcp_show_half_open (vm, 0, ~0, 0);
965  return 0;
966  }
967 
968  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
969  {
970  if (unformat (line_input, "range %u %u", &start, &end))
971  ;
972  else if (unformat (line_input, "verbose %d", &verbose))
973  ;
974  else if (unformat (line_input, "verbose"))
975  verbose = 1;
976  else
977  {
978  error = clib_error_return (0, "unknown input `%U'",
979  format_unformat_error, input);
980  goto done;
981  }
982  }
983 
984  if (start > end)
985  {
986  error = clib_error_return (0, "invalid range start: %u end: %u", start,
987  end);
988  goto done;
989  }
990 
991  tcp_show_half_open (vm, start, end, verbose);
992 
993 done:
994  unformat_free (line_input);
995  return error;
996 }
997 
998 /* *INDENT-OFF* */
999 VLIB_CLI_COMMAND (show_tcp_half_open_command, static) =
1000 {
1001  .path = "show tcp half-open",
1002  .short_help = "show tcp half-open [verbose <n>] [range <start> <end>]",
1003  .function = show_tcp_half_open_fn,
1004 };
1005 /* *INDENT-ON* */
1006 
1007 uword
1009 {
1010  tcp_cc_algorithm_type_e *result = va_arg (*va, tcp_cc_algorithm_type_e *);
1011  tcp_main_t *tm = &tcp_main;
1012  char *cc_algo_name;
1013  u8 found = 0;
1014  uword *p;
1015 
1016  if (unformat (input, "%s", &cc_algo_name)
1017  && ((p = hash_get_mem (tm->cc_algo_by_name, cc_algo_name))))
1018  {
1019  *result = *p;
1020  found = 1;
1021  }
1022 
1023  vec_free (cc_algo_name);
1024  return found;
1025 }
1026 
1027 uword
1029 {
1030  tcp_main_t *tm = vnet_get_tcp_main ();
1031  tcp_cc_algorithm_t *cc_alg;
1032  unformat_input_t sub_input;
1033  int found = 0;
1034 
1035  vec_foreach (cc_alg, tm->cc_algos)
1036  {
1037  if (!unformat (input, cc_alg->name))
1038  continue;
1039 
1040  if (cc_alg->unformat_cfg
1041  && unformat (input, "%U", unformat_vlib_cli_sub_input, &sub_input))
1042  {
1043  if (cc_alg->unformat_cfg (&sub_input))
1044  found = 1;
1045  }
1046  }
1047  return found;
1048 }
1049 
1050 static clib_error_t *
1052 {
1053  u32 cwnd_multiplier, tmp_time, mtu;
1055 
1056  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
1057  {
1058  if (unformat (input, "preallocated-connections %d",
1059  &tcp_cfg.preallocated_connections))
1060  ;
1061  else if (unformat (input, "preallocated-half-open-connections %d",
1062  &tcp_cfg.preallocated_half_open_connections))
1063  ;
1064  else if (unformat (input, "buffer-fail-fraction %f",
1065  &tcp_cfg.buffer_fail_fraction))
1066  ;
1067  else if (unformat (input, "max-rx-fifo %U", unformat_memory_size,
1068  &memory_size))
1069  {
1070  if (memory_size >= 0x100000000)
1071  {
1072  return clib_error_return
1073  (0, "max-rx-fifo %llu (0x%llx) too large", memory_size,
1074  memory_size);
1075  }
1076  tcp_cfg.max_rx_fifo = memory_size;
1077  }
1078  else if (unformat (input, "min-rx-fifo %U", unformat_memory_size,
1079  &memory_size))
1080  {
1081  if (memory_size >= 0x100000000)
1082  {
1083  return clib_error_return
1084  (0, "min-rx-fifo %llu (0x%llx) too large", memory_size,
1085  memory_size);
1086  }
1087  tcp_cfg.min_rx_fifo = memory_size;
1088  }
1089  else if (unformat (input, "mtu %u", &mtu))
1090  tcp_cfg.default_mtu = mtu;
1091  else if (unformat (input, "rwnd-min-update-ack %d",
1092  &tcp_cfg.rwnd_min_update_ack))
1093  ;
1094  else if (unformat (input, "initial-cwnd-multiplier %u",
1095  &cwnd_multiplier))
1096  tcp_cfg.initial_cwnd_multiplier = cwnd_multiplier;
1097  else if (unformat (input, "no-tx-pacing"))
1098  tcp_cfg.enable_tx_pacing = 0;
1099  else if (unformat (input, "tso"))
1100  tcp_cfg.allow_tso = 1;
1101  else if (unformat (input, "no-csum-offload"))
1102  tcp_cfg.csum_offload = 0;
1103  else if (unformat (input, "cc-algo %U", unformat_tcp_cc_algo,
1104  &tcp_cfg.cc_algo))
1105  ;
1106  else if (unformat (input, "%U", unformat_tcp_cc_algo_cfg))
1107  ;
1108  else if (unformat (input, "closewait-time %u", &tmp_time))
1109  tcp_cfg.closewait_time = tmp_time / TCP_TIMER_TICK;
1110  else if (unformat (input, "timewait-time %u", &tmp_time))
1111  tcp_cfg.timewait_time = tmp_time / TCP_TIMER_TICK;
1112  else if (unformat (input, "finwait1-time %u", &tmp_time))
1113  tcp_cfg.finwait1_time = tmp_time / TCP_TIMER_TICK;
1114  else if (unformat (input, "finwait2-time %u", &tmp_time))
1115  tcp_cfg.finwait2_time = tmp_time / TCP_TIMER_TICK;
1116  else if (unformat (input, "lastack-time %u", &tmp_time))
1117  tcp_cfg.lastack_time = tmp_time / TCP_TIMER_TICK;
1118  else if (unformat (input, "closing-time %u", &tmp_time))
1119  tcp_cfg.closing_time = tmp_time / TCP_TIMER_TICK;
1120  else if (unformat (input, "cleanup-time %u", &tmp_time))
1121  tcp_cfg.cleanup_time = tmp_time / 1000.0;
1122  else
1123  return clib_error_return (0, "unknown input `%U'",
1124  format_unformat_error, input);
1125  }
1126  return 0;
1127 }
1128 
1130 
1131 /*
1132  * fd.io coding-style-patch-verification: ON
1133  *
1134  * Local Variables:
1135  * eval: (c-set-style "gnu")
1136  * End:
1137  */
static clib_error_t * tcp_show_scoreboard_trace_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd_arg)
Definition: tcp_cli.c:649
u32 * pending_timers
Definition: tcp.h:104
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:212
u8 count
Definition: dhcp.api:208
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
Definition: vlib_api_cli.c:899
#define TCP_TIMER_HANDLE_INVALID
Definition: tcp_types.h:81
void receive_dpo_add_or_lock(dpo_proto_t proto, u32 sw_if_index, const ip46_address_t *nh_addr, dpo_id_t *dpo)
Definition: receive_dpo.c:67
#define clib_min(x, y)
Definition: clib.h:327
struct _sack_block sack_block_t
static u32 tcp_time_now(void)
Definition: tcp_inlines.h:191
#define foreach_tcp_wrk_stat
Definition: tcp.h:48
static uword clib_fifo_elts(void *v)
Definition: fifo.h:66
uword unformat_transport_connection(unformat_input_t *input, va_list *args)
Definition: session_cli.c:265
#define session_cli_return_if_not_enabled()
Definition: session.h:644
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static u8 * format_tcp_cfg_flags(u8 *s, va_list *args)
Definition: tcp_cli.c:46
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).
Definition: vec.h:592
static heap_elt_t * last(heap_header_t *h)
Definition: heap.c:53
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
Definition: vec.h:630
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:989
static u32 format_get_indent(u8 *s)
Definition: format.h:72
static u32 tcp_time_now_w_thread(u32 thread_index)
Definition: tcp_inlines.h:197
vlib_main_t * vm
Definition: in2out_ed.c:1582
static u8 * format_tcp_congestion_status(u8 *s, va_list *args)
Definition: tcp_cli.c:118
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
vl_api_prefix_t prefix
Definition: ip.api:144
struct _sack_scoreboard sack_scoreboard_t
unsigned char u8
Definition: types.h:56
#define pool_len(p)
Number of elements in pool vector.
Definition: pool.h:140
#define TCP_SCOREBOARD_TRACE
Definition: tcp_types.h:152
#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)
Definition: tcp_cli.c:1008
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.
Definition: ip_neighbor.c:1080
format_function_t format_ip4_address
Definition: format.h:73
struct _tcp_cc_algorithm tcp_cc_algorithm_t
Definition: tcp_types.h:256
unformat_function_t unformat_ip4_address
Definition: format.h:68
#define tcp_cfg
Definition: tcp.h:271
void tcp_connection_timers_init(tcp_connection_t *tc)
Initialize all connection timers as invalid.
Definition: tcp.c:476
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:129
u8 * format_tcp_connection_id(u8 *s, va_list *args)
Definition: tcp_cli.c:230
tcp_main_t tcp_main
Definition: tcp.c:28
u8 * format_tcp_scoreboard(u8 *s, va_list *args)
Definition: tcp_cli.c:333
Aggregate type for a prefix.
Definition: fib_types.h:203
u8 * format_tcp_rcv_sacks(u8 *s, va_list *args)
Definition: tcp_cli.c:297
#define clib_error_return(e, args...)
Definition: error.h:99
pthread_t thread[MAX_CONNS]
Definition: main.c:142
unsigned int u32
Definition: types.h:88
static sack_scoreboard_hole_t * scoreboard_first_hole(sack_scoreboard_t *sb)
Definition: tcp_sack.h:59
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:1097
u16 fp_len
The mask length.
Definition: fib_types.h:207
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.
Definition: fib_table.c:68
#define tcp_in_fastrecovery(tc)
Definition: tcp_types.h:419
#define foreach_tcp_connection_flag
TCP connection flags.
Definition: tcp_types.h:121
u8 * format_tcp_state(u8 *s, va_list *args)
Definition: tcp_cli.c:28
unformat_function_t unformat_line_input
Definition: format.h:283
#define foreach_tcp_fsm_state
TCP FSM state definitions as per RFC793.
Definition: tcp_types.h:45
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:170
static sack_scoreboard_hole_t * scoreboard_next_hole(sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
Definition: tcp_sack.h:43
const char * tcp_connection_flags_str[]
Definition: tcp_cli.c:64
Definition: fib_entry.h:116
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:534
static u8 * format_tcp_timers(u8 *s, va_list *args)
Definition: tcp_cli.c:96
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
Definition: fib_types.h:226
u8 * format_tcp_sacks(u8 *s, va_list *args)
Definition: tcp_cli.c:273
int tcp_fastrecovery_prr_snd_space(tcp_connection_t *tc)
Estimate send space using proportional rate reduction (RFC6937)
Definition: tcp_output.c:1653
struct _unformat_input_t unformat_input_t
u64 memory_size
Definition: vhost_user.h:105
#define TCP_TIMER_TICK
Timer tick in seconds.
Definition: tcp_types.h:83
#define VLIB_CONFIG_FUNCTION(x, n,...)
Definition: init.h:182
static u8 * format_tcp_vars(u8 *s, va_list *args)
Definition: tcp_cli.c:185
static u32 tcp_available_output_snd_space(const tcp_connection_t *tc)
Definition: tcp_inlines.h:156
u8 len
Definition: ip_types.api:92
#define foreach_tcp_cfg_flag
Connection configuration flags.
Definition: tcp_types.h:97
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
Definition: fib_entry.c:1458
unformat_function_t unformat_ip6_address
Definition: format.h:89
static u32 tcp_flight_size(const tcp_connection_t *tc)
Our estimate of the number of bytes in flight (pipe size)
Definition: tcp_inlines.h:94
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 &#39;special&#39; entry to the FIB that links to the DPO passed A special entry is an entry that the...
Definition: fib_table.c:363
#define UNFORMAT_END_OF_INPUT
Definition: format.h:145
format_function_t format_ip6_address
Definition: format.h:91
void scoreboard_init(sack_scoreboard_t *sb)
Definition: tcp_sack.c:268
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:380
u8 * tcp_scoreboard_replay(u8 *s, tcp_connection_t *tc, u8 verbose)
Definition: tcp_cli.c:687
#define tcp_in_recovery(tc)
Definition: tcp_types.h:420
struct _transport_connection transport_connection_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:30
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:299
const char * tcp_conn_timers[]
Definition: tcp_cli.c:89
static u32 tcp_available_cc_snd_space(const tcp_connection_t *tc)
Estimate of how many bytes we can still push into the network.
Definition: tcp_inlines.h:171
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:158
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.
Definition: tcp_cli.c:377
uword unformat_vlib_cli_sub_input(unformat_input_t *i, va_list *args)
Definition: cli.c:163
static u8 * tcp_scoreboard_dump_trace(u8 *s, sack_scoreboard_t *sb)
Definition: tcp_cli.c:624
signed int i32
Definition: types.h:77
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:696
int ip6_neighbor_proxy_add(u32 sw_if_index, const ip6_address_t *addr)
Definition: ip_neighbor.c:1127
static u8 * format_tcp_connection_flags(u8 *s, va_list *args)
Definition: tcp_cli.c:71
From the control plane API.
Definition: fib_source.h:72
static clib_error_t * show_tcp_punt_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd_arg)
Definition: tcp_cli.c:812
static i32 tcp_rcv_wnd_available(tcp_connection_t *tc)
Definition: tcp_cli.c:131
struct _sack_scoreboard_hole sack_scoreboard_hole_t
#define clib_max(x, y)
Definition: clib.h:320
static u8 * format_tcp_sack_hole(u8 *s, va_list *args)
Definition: tcp_cli.c:321
int ip4_neighbor_proxy_enable(u32 sw_if_index)
Definition: ip_neighbor.c:1107
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:31
static clib_error_t * show_tcp_stats_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: tcp_cli.c:835
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
tcp_wrk_stats_t stats
Definition: tcp.h:122
static tcp_worker_ctx_t * tcp_get_worker(u32 thread_index)
Definition: tcp.h:282
u64 uword
Definition: types.h:112
static void unformat_free(unformat_input_t *i)
Definition: format.h:163
static clib_error_t * tcp_config_fn(vlib_main_t *vm, unformat_input_t *input)
Definition: tcp_cli.c:1051
u32 table_id
Definition: wireguard.api:100
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:197
static clib_error_t * clear_tcp_stats_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: tcp_cli.c:874
left
static f64 tcp_time_now_us(u32 thread_index)
Definition: tcp_inlines.h:213
#define hash_get_mem(h, key)
Definition: hash.h:269
unformat_function_t unformat_memory_size
Definition: format.h:296
u8 * format_tcp_connection(u8 *s, va_list *args)
Definition: tcp_cli.c:254
enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e
const char * tcp_fsm_states[]
Definition: tcp_cli.c:21
static clib_error_t * tcp_scoreboard_trace_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd_arg)
Definition: tcp_cli.c:769
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
vl_api_dhcp_client_state_t state
Definition: dhcp.api:201
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:232
#define vec_foreach(var, vec)
Vector iterator.
f64 end
end of the time range
Definition: mactime.api:44
static u8 * format_tcp_stats(u8 *s, va_list *args)
Definition: tcp_cli.c:164
static clib_error_t * show_tcp_half_open_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: tcp_cli.c:953
struct _scoreboard_trace_elt scoreboard_trace_elt_t
static u8 * format_tcp_congestion(u8 *s, va_list *args)
Definition: tcp_cli.c:137
static tcp_connection_t * tcp_get_connection_from_transport(transport_connection_t *tconn)
Definition: tcp_types.h:446
static tcp_main_t * vnet_get_tcp_main()
Definition: tcp.h:276
const char * tcp_cfg_flags_str[]
Definition: tcp_cli.c:39
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.
Definition: tcp_cli.c:464
static void tcp_show_half_open(vlib_main_t *vm, u32 start, u32 end, u8 verbose)
Definition: tcp_cli.c:904
static clib_error_t * tcp_src_address_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd_arg)
Definition: tcp_cli.c:536
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:33
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:171
void tcp_rcv_sacks(tcp_connection_t *tc, u32 ack)
Definition: tcp_sack.c:326
#define foreach_tcp_timer
TCP timers.
Definition: tcp_types.h:67
uword unformat_tcp_cc_algo_cfg(unformat_input_t *input, va_list *va)
Definition: tcp_cli.c:1028
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:128