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