FD.io VPP  v21.01.1
Vector Packet Processing
node_cli.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 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  * node_cli.c: node CLI
17  *
18  * Copyright (c) 2008 Eliot Dresselhaus
19  *
20  * Permission is hereby granted, free of charge, to any person obtaining
21  * a copy of this software and associated documentation files (the
22  * "Software"), to deal in the Software without restriction, including
23  * without limitation the rights to use, copy, modify, merge, publish,
24  * distribute, sublicense, and/or sell copies of the Software, and to
25  * permit persons to whom the Software is furnished to do so, subject to
26  * the following conditions:
27  *
28  * The above copyright notice and this permission notice shall be
29  * included in all copies or substantial portions of the Software.
30  *
31  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
35  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
36  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
37  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38  */
39 
40 #include <sys/types.h>
41 #include <sys/stat.h>
42 #include <fcntl.h>
43 #include <vlib/vlib.h>
44 #include <vlib/threads.h>
45 
46 static int
47 node_cmp (void *a1, void *a2)
48 {
49  vlib_node_t **n1 = a1;
50  vlib_node_t **n2 = a2;
51 
52  return vec_cmp (n1[0]->name, n2[0]->name);
53 }
54 
55 static clib_error_t *
57  unformat_input_t * input, vlib_cli_command_t * cmd)
58 {
59  vlib_node_main_t *nm = &vm->node_main;
60  vlib_node_t *n;
61  u32 node_index;
62 
63  vlib_cli_output (vm, "%U\n", format_vlib_node_graph, nm, 0);
64 
65  if (unformat (input, "%U", unformat_vlib_node, vm, &node_index))
66  {
67  n = vlib_get_node (vm, node_index);
68  vlib_cli_output (vm, "%U\n", format_vlib_node_graph, nm, n);
69  }
70  else
71  {
72  vlib_node_t **nodes = vec_dup (nm->nodes);
73  uword i;
74 
76 
77  for (i = 0; i < vec_len (nodes); i++)
78  vlib_cli_output (vm, "%U\n\n", format_vlib_node_graph, nm, nodes[i]);
79 
80  vec_free (nodes);
81  }
82 
83  return 0;
84 }
85 
86 /* *INDENT-OFF* */
87 VLIB_CLI_COMMAND (show_node_graph_command, static) = {
88  .path = "show vlib graph",
89  .short_help = "Show packet processing node graph",
90  .function = show_node_graph,
91 };
92 /* *INDENT-ON* */
93 
94 static clib_error_t *
96  unformat_input_t * input, vlib_cli_command_t * cmd)
97 {
98  clib_error_t *error = 0;
99  vlib_node_main_t *nm = &vm->node_main;
100  u8 *chroot_filename = 0;
101  int fd;
102  vlib_node_t **nodes = 0;
103  uword i, j;
104 
105  if (!unformat_user (input, unformat_vlib_tmpfile, &chroot_filename))
106  {
107  fd = -1;
108  }
109  else
110  {
111  fd =
112  open ((char *) chroot_filename, O_CREAT | O_TRUNC | O_WRONLY, 0664);
113  }
114 
115 #define format__(vm__, fd__, ...) \
116  if ((fd) < 0) \
117  { \
118  vlib_cli_output((vm__), ## __VA_ARGS__); \
119  } \
120  else \
121  { \
122  fdformat((fd__), ## __VA_ARGS__); \
123  }
124 
125  format__ (vm, fd, "%s", "digraph {\n");
126 
127  nodes = vec_dup (nm->nodes);
129 
130  for (i = 0; i < vec_len (nodes); i++)
131  {
132  for (j = 0; j < vec_len (nodes[i]->next_nodes); j++)
133  {
134  vlib_node_t *x;
135 
136  if (nodes[i]->next_nodes[j] == VLIB_INVALID_NODE_INDEX)
137  continue;
138 
139  x = vec_elt (nm->nodes, nodes[i]->next_nodes[j]);
140  format__ (vm, fd, " \"%v\" -> \"%v\"\n", nodes[i]->name, x->name);
141  }
142  }
143 
144  format__ (vm, fd, "%s", "}");
145 
146  if (fd >= 0)
147  {
148  vlib_cli_output (vm,
149  "vlib graph dumped into `%s'. Run eg. `fdp -Tsvg -O %s'.",
150  chroot_filename, chroot_filename);
151  }
152 
153  vec_free (nodes);
154  vec_free (chroot_filename);
155  vec_free (nodes);
156  if (fd >= 0)
157  close (fd);
158  return error;
159 }
160 
161 /* *INDENT-OFF* */
162 VLIB_CLI_COMMAND (show_node_graphviz_command, static) = {
163  .path = "show vlib graphviz",
164  .short_help = "Dump packet processing node graph as a graphviz dotfile",
165  .function = show_node_graphviz,
166 };
167 /* *INDENT-ON* */
168 
169 static u8 *
170 format_vlib_node_state (u8 * s, va_list * va)
171 {
172  vlib_main_t *vm = va_arg (*va, vlib_main_t *);
173  vlib_node_t *n = va_arg (*va, vlib_node_t *);
174  char *state;
175 
176  state = "active";
177  if (n->type == VLIB_NODE_TYPE_PROCESS)
178  {
180 
183  {
184  default:
185  if (!(p->flags & VLIB_PROCESS_IS_RUNNING))
186  state = "done";
187  break;
188 
190  state = "time wait";
191  break;
192 
194  state = "event wait";
195  break;
196 
198  state =
199  "any wait";
200  break;
201  }
202  }
203  else if (n->type != VLIB_NODE_TYPE_INTERNAL)
204  {
205  state = "polling";
206  if (n->state == VLIB_NODE_STATE_DISABLED)
207  state = "disabled";
208  else if (n->state == VLIB_NODE_STATE_INTERRUPT)
209  state = "interrupt wait";
210  }
211 
212  return format (s, "%s", state);
213 }
214 
215 static u8 *
216 format_vlib_node_stats (u8 * s, va_list * va)
217 {
218  vlib_main_t *vm = va_arg (*va, vlib_main_t *);
219  vlib_node_t *n = va_arg (*va, vlib_node_t *);
220  int max = va_arg (*va, int);
221  f64 v;
222  u8 *ns;
223  u8 *misc_info = 0;
224  u64 c, p, l, d;
225  f64 x;
226  f64 maxc, maxcn;
227  u32 maxn;
228  u32 indent;
229 
230  if (!n)
231  {
232  if (max)
233  s = format (s,
234  "%=30s%=17s%=16s%=16s%=16s%=16s",
235  "Name", "Max Node Clocks", "Vectors at Max",
236  "Max Clocks", "Avg Clocks", "Avg Vectors/Call");
237  else
238  s = format (s,
239  "%=30s%=12s%=16s%=16s%=16s%=16s%=16s",
240  "Name", "State", "Calls", "Vectors", "Suspends",
241  "Clocks", "Vectors/Call");
242  return s;
243  }
244 
245  indent = format_get_indent (s);
246 
251  maxc = (f64) n->stats_total.max_clock;
252  maxn = n->stats_total.max_clock_n;
253  if (n->stats_total.max_clock_n)
254  maxcn = (f64) n->stats_total.max_clock / (f64) maxn;
255  else
256  maxcn = 0.0;
257 
258  /* Clocks per packet, per call or per suspend. */
259  x = 0;
260  if (p > 0)
261  x = (f64) l / (f64) p;
262  else if (c > 0)
263  x = (f64) l / (f64) c;
264  else if (d > 0)
265  x = (f64) l / (f64) d;
266 
267  if (c > 0)
268  v = (double) p / (double) c;
269  else
270  v = 0;
271 
272  if (n->type == VLIB_NODE_TYPE_PROCESS)
273  {
275 
276  /* Show processes with events pending. This helps spot bugs where events are not
277  being handled. */
279  misc_info = format (misc_info, "events pending, ");
280  }
281  ns = n->name;
282 
283  if (max)
284  s = format (s, "%-30v%=17.2e%=16d%=16.2e%=16.2e%=16.2e",
285  ns, maxc, maxn, maxcn, x, v);
286  else
287  s = format (s, "%-30v%=12U%16Ld%16Ld%16Ld%16.2e%16.2f", ns,
288  format_vlib_node_state, vm, n, c, p, d, x, v);
289 
290  if (ns != n->name)
291  vec_free (ns);
292 
293  if (misc_info)
294  {
295  s = format (s, "\n%U%v", format_white_space, indent + 4, misc_info);
296  vec_free (misc_info);
297  }
298 
299  return s;
300 }
301 
302 f64 vlib_get_stat_segment_update_rate (void) __attribute__ ((weak));
303 f64
305 {
306  return 1e70;
307 }
308 
309 static clib_error_t *
311  unformat_input_t * input, vlib_cli_command_t * cmd)
312 {
313  vlib_node_main_t *nm = &vm->node_main;
314  vlib_node_t *n;
315  f64 time_now;
316  u32 node_index;
317  vlib_node_t ***node_dups = 0;
318  f64 *internal_node_vector_rates = 0;
319 
320  time_now = vlib_time_now (vm);
321 
322  if (unformat (input, "%U", unformat_vlib_node, vm, &node_index))
323  {
324  n = vlib_get_node (vm, node_index);
325  vlib_node_sync_stats (vm, n);
326  vlib_cli_output (vm, "%U\n", format_vlib_node_stats, vm, 0, 0);
327  vlib_cli_output (vm, "%U\n", format_vlib_node_stats, vm, n, 0);
328  }
329  else
330  {
331  vlib_node_t **nodes;
332  uword i, j;
333  f64 dt;
334  u64 n_input, n_output, n_drop, n_punt;
335  u64 n_internal_vectors, n_internal_calls;
336  u64 n_clocks, l, v, c, d;
337  int brief = 1;
338  int summary = 0;
339  int max = 0;
340  vlib_main_t **stat_vms = 0, *stat_vm;
341 
342  /* Suppress nodes with zero calls since last clear */
343  if (unformat (input, "brief") || unformat (input, "b"))
344  brief = 1;
345  if (unformat (input, "verbose") || unformat (input, "v"))
346  brief = 0;
347  if (unformat (input, "max") || unformat (input, "m"))
348  max = 1;
349  if (unformat (input, "summary") || unformat (input, "sum")
350  || unformat (input, "su"))
351  summary = 1;
352 
353  for (i = 0; i < vec_len (vlib_mains); i++)
354  {
355  stat_vm = vlib_mains[i];
356  if (stat_vm)
357  vec_add1 (stat_vms, stat_vm);
358  }
359 
360  /*
361  * Barrier sync across stats scraping.
362  * Otherwise, the counts will be grossly inaccurate.
363  */
365 
366  for (j = 0; j < vec_len (stat_vms); j++)
367  {
368  stat_vm = stat_vms[j];
369  nm = &stat_vm->node_main;
370 
371  for (i = 0; i < vec_len (nm->nodes); i++)
372  {
373  n = nm->nodes[i];
374  vlib_node_sync_stats (stat_vm, n);
375  }
376 
377  nodes = vec_dup (nm->nodes);
378 
379  vec_add1 (node_dups, nodes);
380  vec_add1 (internal_node_vector_rates,
382  }
384 
385 
386  for (j = 0; j < vec_len (stat_vms); j++)
387  {
388  stat_vm = stat_vms[j];
389  nodes = node_dups[j];
390 
392 
393  n_input = n_output = n_drop = n_punt = n_clocks = 0;
394  n_internal_vectors = n_internal_calls = 0;
395  for (i = 0; i < vec_len (nodes); i++)
396  {
397  n = nodes[i];
398 
400  n_clocks += l;
401 
404 
405  switch (n->type)
406  {
407  default:
408  continue;
409 
411  n_output += (n->flags & VLIB_NODE_FLAG_IS_OUTPUT) ? v : 0;
412  n_drop += (n->flags & VLIB_NODE_FLAG_IS_DROP) ? v : 0;
413  n_punt += (n->flags & VLIB_NODE_FLAG_IS_PUNT) ? v : 0;
414  if (!(n->flags & VLIB_NODE_FLAG_IS_OUTPUT))
415  {
416  n_internal_vectors += v;
417  n_internal_calls += c;
418  }
420  n_input += v;
421  break;
422 
424  n_input += v;
425  break;
426  }
427  }
428 
429  if (vec_len (vlib_mains) > 1)
430  {
432  if (j > 0)
433  vlib_cli_output (vm, "---------------");
434 
435  if (w->cpu_id > -1)
436  vlib_cli_output (vm, "Thread %d %s (lcore %u)", j, w->name,
437  w->cpu_id);
438  else
439  vlib_cli_output (vm, "Thread %d %s", j, w->name);
440  }
441 
442  dt = time_now - nm->time_last_runtime_stats_clear;
444  (vm,
445  "Time %.1f, %f sec internal node vector rate %.2f loops/sec %.2f\n"
446  " vector rates in %.4e, out %.4e, drop %.4e, punt %.4e",
447  dt,
449  internal_node_vector_rates[j],
450  stat_vm->loops_per_second,
451  (f64) n_input / dt,
452  (f64) n_output / dt, (f64) n_drop / dt, (f64) n_punt / dt);
453 
454  if (summary == 0)
455  {
456  vlib_cli_output (vm, "%U", format_vlib_node_stats, stat_vm,
457  0, max);
458  for (i = 0; i < vec_len (nodes); i++)
459  {
460  c =
461  nodes[i]->stats_total.calls -
462  nodes[i]->stats_last_clear.calls;
463  d =
464  nodes[i]->stats_total.suspends -
465  nodes[i]->stats_last_clear.suspends;
466  if (c || d || !brief)
467  {
469  stat_vm, nodes[i], max);
470  }
471  }
472  }
473  vec_free (nodes);
474  }
475  vec_free (stat_vms);
476  vec_free (node_dups);
477  vec_free (internal_node_vector_rates);
478  }
479 
480  return 0;
481 }
482 
483 /* *INDENT-OFF* */
484 VLIB_CLI_COMMAND (show_node_runtime_command, static) = {
485  .path = "show runtime",
486  .short_help = "Show packet processing runtime",
487  .function = show_node_runtime,
488  .is_mp_safe = 1,
489 };
490 /* *INDENT-ON* */
491 
492 static clib_error_t *
494  unformat_input_t * input, vlib_cli_command_t * cmd)
495 {
496  vlib_node_main_t *nm;
497  vlib_node_t *n;
498  int i, j;
499  vlib_main_t **stat_vms = 0, *stat_vm;
501 
502  for (i = 0; i < vec_len (vlib_mains); i++)
503  {
504  stat_vm = vlib_mains[i];
505  if (stat_vm)
506  vec_add1 (stat_vms, stat_vm);
507  }
508 
510 
511  for (j = 0; j < vec_len (stat_vms); j++)
512  {
513  stat_vm = stat_vms[j];
514  nm = &stat_vm->node_main;
515 
516  for (i = 0; i < vec_len (nm->nodes); i++)
517  {
518  n = nm->nodes[i];
519  vlib_node_sync_stats (stat_vm, n);
521 
522  r = vlib_node_get_runtime (stat_vm, n->index);
523  r->max_clock = 0;
524  }
525  /* Note: input/output rates computed using vlib_global_main */
527  }
528 
530 
531  vec_free (stat_vms);
532 
533  return 0;
534 }
535 
536 /* *INDENT-OFF* */
537 VLIB_CLI_COMMAND (clear_node_runtime_command, static) = {
538  .path = "clear runtime",
539  .short_help = "Clear packet processing runtime statistics",
540  .function = clear_node_runtime,
541 };
542 /* *INDENT-ON* */
543 
544 static clib_error_t *
546  vlib_cli_command_t * cmd)
547 {
548  unformat_input_t _line_input, *line_input = &_line_input;
549  clib_error_t *error = 0;
550  vlib_node_main_t *nm = &vm->node_main;
551  vlib_node_t *n;
552  u8 *s = 0, *s2 = 0;
553  u32 i, node_index = ~0, verbose = 0;
554  char *type_str;
555  u8 valid_node_name = 0;
556  u64 cl, ca, v;
557 
558  if (!unformat_user (input, unformat_line_input, line_input))
559  return 0;
560 
561  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
562  {
563  if (unformat (line_input, "index %u", &node_index))
564  ;
565  else if (unformat (line_input, "verbose"))
566  verbose = 1;
567  else
568  if (unformat (line_input, "%U", unformat_vlib_node, vm, &node_index))
569  valid_node_name = 1;
570  else if (!valid_node_name)
571  error = clib_error_return (0, "unknown node name: '%U'",
572  format_unformat_error, line_input);
573  else
574  error = clib_error_return (0, "unknown input '%U'",
575  format_unformat_error, line_input);
576 
577  if (error)
578  break;
579  }
580 
581  unformat_free (line_input);
582 
583  if (error)
584  return error;
585 
586  if (node_index >= vec_len (vm->node_main.nodes))
587  return clib_error_return (0, "please specify valid node");
588 
589  n = vlib_get_node (vm, node_index);
590  vlib_node_sync_stats (vm, n);
591 
592  switch (n->type)
593  {
595  type_str = "internal";
596  break;
598  type_str = "input";
599  break;
601  type_str = "pre-input";
602  break;
604  type_str = "process";
605  break;
606  default:
607  type_str = "unknown";
608  }
609 
610  if (n->sibling_of)
611  s = format (s, ", sibling-of %s", n->sibling_of);
612 
613  vlib_cli_output (vm, "node %v, type %s, state %U, index %d%v\n",
614  n->name, type_str, format_vlib_node_state, vm, n,
615  n->index, s);
616  vec_reset_length (s);
617 
618  if (n->node_fn_registrations)
619  {
621  while (fnr)
622  {
623  if (vec_len (s) == 0)
624  s = format (s, "\n %-15s %=8s %6s",
625  "Name", "Priority", "Active");
626  s = format (s, "\n %-15s %8d %=6s", fnr->name, fnr->priority,
627  fnr->function == n->function ? "yes" : "");
628  fnr = fnr->next_registration;
629  }
630  }
631  else
632  s = format (s, "\n default only");
633  vlib_cli_output (vm, " node function variants:%v\n", s);
634  vec_reset_length (s);
635 
636  for (i = 0; i < vec_len (n->next_nodes); i++)
637  {
638  vlib_node_t *pn;
639  if (n->next_nodes[i] == VLIB_INVALID_NODE_INDEX)
640  continue;
641 
642  pn = vec_elt (nm->nodes, n->next_nodes[i]);
643 
644  if (vec_len (s) == 0)
645  s = format (s, "\n %10s %10s %=30s %8s",
646  "next-index", "node-index", "Node", "Vectors");
647 
648  s = format (s, "\n %=10u %=10u %=30v %=8llu", i, n->next_nodes[i],
649  pn->name, vec_elt (n->n_vectors_by_next_node, i));
650  }
651 
652  if (vec_len (s) == 0)
653  s = format (s, "\n none");
654  vlib_cli_output (vm, "\n next nodes:%v\n", s);
655  vec_reset_length (s);
656 
657  if (n->type == VLIB_NODE_TYPE_INTERNAL)
658  {
659  int j = 0;
660  /* *INDENT-OFF* */
662  vlib_node_t *pn = vlib_get_node (vm, i);
663  if (j++ % 3 == 0)
664  s = format (s, "\n ");
665  s2 = format (s2, "%v (%u)", pn->name, i);
666  s = format (s, "%-35v", s2);
667  vec_reset_length (s2);
668  }
669  /* *INDENT-ON* */
670 
671  if (vec_len (s) == 0)
672  s = format (s, "\n none");
673  vlib_cli_output (vm, "\n known previous nodes:%v\n", s);
674  vec_reset_length (s);
675  vec_free (s2);
676  }
677 
678  if (!verbose)
679  goto done;
680 
681  s = format (s, "\n%8s %=12s %=12s %=12s %=12s %=12s\n", "Thread", "Calls",
682  "Clocks", "Vectors", "Max Clock", "Max Vectors");
683  for (i = 0; i < vec_len (vlib_mains); i++)
684  {
685  n = vlib_get_node (vlib_mains[i], node_index);
687 
691 
692  s = format (s, "%=8u %=12lu %=12lu %=12lu %=12u %=12u\n", i, ca, cl, v,
694  }
695 
696  vlib_cli_output (vm, "%v", s);
697 
698 done:
699 
700  vec_free (s);
701  return 0;
702 }
703 
704 /* *INDENT-OFF* */
705 VLIB_CLI_COMMAND (show_node_command, static) = {
706  .path = "show node",
707  .short_help = "show node [index] <node-name | node-index>",
708  .function = show_node,
709 };
710 
711 static clib_error_t *
713 {
714  unformat_input_t _line_input, *line_input = &_line_input;
715  u32 node_index;
716  vlib_node_t *n;
717  clib_error_t *err = 0;
719  u8 *variant = 0;
720 
721  if (!unformat_user (input, unformat_line_input, line_input))
722  return 0;
723 
724  if (!unformat (line_input, "%U", unformat_vlib_node, vm, &node_index))
725  {
726  err = clib_error_return (0, "please specify valid node name");
727  goto done;
728  }
729 
730  if (!unformat (line_input, "%U", unformat_vlib_node_variant, &variant))
731  {
732  err = clib_error_return (0, "please specify node functional variant");
733  goto done;
734  }
735 
736  n = vlib_get_node (vm, node_index);
737 
738  if (n->node_fn_registrations == 0)
739  {
740  err = clib_error_return (0, "node doesn't have functional variants");
741  goto done;
742  }
743 
744  fnr = n->node_fn_registrations;
745  vec_add1 (variant, 0);
746 
747  while (fnr)
748  {
749  if (!strncmp (fnr->name, (char *) variant, vec_len (variant) - 1))
750  {
751  int i;
752 
753  n->function = fnr->function;
754 
755  for (i = 0; i < vec_len (vlib_mains); i++)
756  {
757  vlib_node_runtime_t *nrt;
758  nrt = vlib_node_get_runtime (vlib_mains[i], n->index);
759  nrt->function = fnr->function;
760  }
761  goto done;
762  }
763  fnr = fnr->next_registration;
764  }
765 
766  err = clib_error_return (0, "node functional variant '%s' not found", variant);
767 
768 done:
769  vec_free (variant);
770  unformat_free (line_input);
771  return err;
772 }
773 
774 /* *INDENT-OFF* */
775 VLIB_CLI_COMMAND (set_node_fn_command, static) = {
776  .path = "set node function",
777  .short_help = "set node function <node-name> <variant-name>",
778  .function = set_node_fn,
779 };
780 /* *INDENT-ON* */
781 
782 /* Dummy function to get us linked in. */
783 void
785 {
786 }
787 
788 /*
789  * fd.io coding-style-patch-verification: ON
790  *
791  * Local Variables:
792  * eval: (c-set-style "gnu")
793  * End:
794  */
u32 * next_nodes
Definition: node.h:335
f64 vlib_get_stat_segment_update_rate(void)
Definition: node_cli.c:304
u32 max_clock
Maximum clock cycle for an invocation.
Definition: node.h:474
static clib_error_t * show_node_graphviz(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: node_cli.c:95
unsigned long u64
Definition: types.h:89
u32 index
Definition: node.h:280
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:334
#define clib_bitmap_foreach(i, ai)
Macro to iterate across set bits in a bitmap.
Definition: bitmap.h:361
u16 flags
Definition: node.h:289
static int node_cmp(void *a1, void *a2)
Definition: node_cli.c:47
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:592
#define VLIB_NODE_FLAG_IS_PUNT
Definition: node.h:298
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
vlib_main_t * vm
Definition: in2out_ed.c:1580
vlib_main_t ** vlib_mains
Definition: buffer.c:332
unsigned char u8
Definition: types.h:56
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
double f64
Definition: types.h:142
u8 state
Definition: node.h:309
vlib_node_function_t * function
Definition: node.h:261
#define vlib_worker_thread_barrier_sync(X)
Definition: threads.h:205
vlib_node_stats_t stats_last_clear
Definition: node.h:274
static clib_error_t * show_node_runtime(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: node_cli.c:310
uword unformat_vlib_tmpfile(unformat_input_t *input, va_list *args)
Definition: format.c:192
vlib_node_function_t * function
Node function to call.
Definition: node.h:468
#define VLIB_INVALID_NODE_INDEX
Definition: node.h:375
static uword clib_bitmap_is_zero(uword *ai)
predicate function; is an entire bitmap empty?
Definition: bitmap.h:57
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:129
vlib_node_t ** nodes
Definition: node.h:680
description fragment has unexpected format
Definition: map.api:433
char * sibling_of
Definition: node.h:338
#define clib_error_return(e, args...)
Definition: error.h:99
struct _vlib_node_fn_registration vlib_node_fn_registration_t
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK
Definition: node.h:565
unsigned int u32
Definition: types.h:88
static clib_error_t * show_node(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: node_cli.c:545
#define VLIB_PROCESS_IS_RUNNING
Definition: node.h:571
unformat_function_t unformat_vlib_node_variant
Definition: node.h:222
u64 max_clock_n
Definition: node.h:238
unformat_function_t unformat_line_input
Definition: format.h:282
static u8 * format_vlib_node_stats(u8 *s, va_list *va)
Definition: node_cli.c:216
Definition: cJSON.c:84
vlib_worker_thread_t * vlib_worker_threads
Definition: threads.c:34
vlib_node_stats_t stats_total
Definition: node.h:270
f64 time_last_runtime_stats_clear
Definition: node.h:744
struct _unformat_input_t unformat_input_t
#define vec_dup(V)
Return copy of vector (no header, no alignment)
Definition: vec.h:429
static clib_error_t * set_node_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: node_cli.c:712
u64 * n_vectors_by_next_node
Definition: node.h:344
u8 * name
Definition: node.h:264
#define UNFORMAT_END_OF_INPUT
Definition: format.h:144
svmdb_client_t * c
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
#define format__(vm__, fd__,...)
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:380
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
Definition: node_funcs.h:115
static u8 * format_vlib_node_state(u8 *s, va_list *va)
Definition: node_cli.c:170
vlib_node_fn_registration_t * node_fn_registrations
Definition: node.h:372
string name[64]
Definition: ip.api:44
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:158
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:696
static clib_error_t * clear_node_runtime(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: node_cli.c:493
void vlib_node_cli_reference(void)
Definition: node_cli.c:784
#define vec_cmp(v1, v2)
Compare two vectors (only applicable to vectors of signed numbers).
Definition: vec.h:991
uword * prev_node_bitmap
Definition: node.h:352
void vlib_node_sync_stats(vlib_main_t *vm, vlib_node_t *n)
Definition: main.c:599
#define vec_elt(v, i)
Get vector value at index i.
#define VLIB_NODE_FLAG_IS_HANDOFF
Definition: node.h:299
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_node_main_t node_main
Definition: main.h:188
u64 uword
Definition: types.h:112
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
Definition: vec.h:1055
static void unformat_free(unformat_input_t *i)
Definition: format.h:162
static clib_error_t * show_node_graph(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: node_cli.c:56
unformat_function_t unformat_vlib_node
Definition: node_funcs.h:1228
#define VLIB_NODE_FLAG_IS_DROP
Definition: node.h:297
u16 flags
Definition: node.h:564
vlib_node_type_t type
Definition: node.h:277
static vlib_process_t * vlib_get_process_from_node(vlib_main_t *vm, vlib_node_t *node)
Definition: node_funcs.h:261
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
Definition: threads.c:1561
vl_api_dhcp_client_state_t state
Definition: dhcp.api:201
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
Definition: node_funcs.h:85
#define VLIB_NODE_FLAG_IS_OUTPUT
Definition: node.h:296
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT
Definition: node.h:566
static f64 vlib_internal_node_vector_rate(vlib_main_t *vm)
Definition: main.h:403
format_function_t format_vlib_node_graph
Definition: node_funcs.h:1221
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:170
uword * non_empty_event_type_bitmap
Definition: node.h:585