Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
vpp-api: Add context to VPPStatsIOError.
[vpp.git]
/
src
/
vlib
/
node.c
diff --git
a/src/vlib/node.c
b/src/vlib/node.c
index
cc1732b
..
69f5051
100644
(file)
--- a/
src/vlib/node.c
+++ b/
src/vlib/node.c
@@
-290,7
+290,7
@@
node_elog_init (vlib_main_t * vm, uword ni)
{
elog_event_type_t t;
{
elog_event_type_t t;
- memset (&t, 0, sizeof (t));
+
clib_
memset (&t, 0, sizeof (t));
/* 2 event types for this node: one when node function is called.
One when it returns. */
/* 2 event types for this node: one when node function is called.
One when it returns. */
@@
-347,8
+347,10
@@
register_node (vlib_main_t * vm, vlib_node_registration_t * r)
ASSERT (r->function != 0);
n = clib_mem_alloc_no_fail (sizeof (n[0]));
ASSERT (r->function != 0);
n = clib_mem_alloc_no_fail (sizeof (n[0]));
- memset (n, 0, sizeof (n[0]));
+
clib_
memset (n, 0, sizeof (n[0]));
n->index = vec_len (nm->nodes);
n->index = vec_len (nm->nodes);
+ n->node_fn_registrations = r->node_fn_registrations;
+ n->protocol_hint = r->protocol_hint;
vec_add1 (nm->nodes, n);
vec_add1 (nm->nodes, n);
@@
-450,7
+452,7
@@
register_node (vlib_main_t * vm, vlib_node_registration_t * r)
clib_panic ("failed to allocate process stack (%d bytes)",
1 << log2_n_stack_bytes);
clib_panic ("failed to allocate process stack (%d bytes)",
1 << log2_n_stack_bytes);
- memset (p, 0, sizeof (p[0]));
+
clib_
memset (p, 0, sizeof (p[0]));
p->log2_n_stack_bytes = log2_n_stack_bytes;
/* Process node's runtime index is really index into process
p->log2_n_stack_bytes = log2_n_stack_bytes;
/* Process node's runtime index is really index into process
@@
-528,7
+530,7
@@
null_node_fn (vlib_main_t * vm,
u16 n_vectors = frame->n_vectors;
vlib_node_increment_counter (vm, node->node_index, 0, n_vectors);
u16 n_vectors = frame->n_vectors;
vlib_node_increment_counter (vm, node->node_index, 0, n_vectors);
- vlib_buffer_free (vm, vlib_frame_args (frame), n_vectors);
+ vlib_buffer_free (vm, vlib_frame_
vector_
args (frame), n_vectors);
vlib_frame_free (vm, node, frame);
return n_vectors;
vlib_frame_free (vm, node, frame);
return n_vectors;
@@
-563,20
+565,20
@@
vlib_register_all_static_nodes (vlib_main_t * vm)
}
}
}
}
-vlib_node_t ***
-vlib_node_get_nodes (vlib_main_t * vm, u32 max_threads, int include_stats)
+void
+vlib_node_get_nodes (vlib_main_t * vm, u32 max_threads, int include_stats,
+ int barrier_sync, vlib_node_t **** node_dupsp,
+ vlib_main_t *** stat_vmsp)
{
vlib_node_main_t *nm = &vm->node_main;
vlib_node_t *n;
{
vlib_node_main_t *nm = &vm->node_main;
vlib_node_t *n;
-
static vlib_node_t ***node_dups
;
+
vlib_node_t ***node_dups = *node_dupsp
;
vlib_node_t **nodes;
vlib_node_t **nodes;
-
static vlib_main_t **stat_vms
;
+
vlib_main_t **stat_vms = *stat_vmsp
;
vlib_main_t *stat_vm;
uword i, j;
u32 threads_to_serialize;
vlib_main_t *stat_vm;
uword i, j;
u32 threads_to_serialize;
- vec_reset_length (node_dups);
-
if (vec_len (stat_vms) == 0)
{
for (i = 0; i < vec_len (vlib_mains); i++)
if (vec_len (stat_vms) == 0)
{
for (i = 0; i < vec_len (vlib_mains); i++)
@@
-589,11
+591,14
@@
vlib_node_get_nodes (vlib_main_t * vm, u32 max_threads, int include_stats)
threads_to_serialize = clib_min (max_threads, vec_len (stat_vms));
threads_to_serialize = clib_min (max_threads, vec_len (stat_vms));
+ vec_validate (node_dups, threads_to_serialize - 1);
+
/*
* Barrier sync across stats scraping.
* Otherwise, the counts will be grossly inaccurate.
*/
/*
* Barrier sync across stats scraping.
* Otherwise, the counts will be grossly inaccurate.
*/
- vlib_worker_thread_barrier_sync (vm);
+ if (barrier_sync)
+ vlib_worker_thread_barrier_sync (vm);
for (j = 0; j < threads_to_serialize; j++)
{
for (j = 0; j < threads_to_serialize; j++)
{
@@
-609,12
+614,17
@@
vlib_node_get_nodes (vlib_main_t * vm, u32 max_threads, int include_stats)
}
}
}
}
- nodes = vec_dup (nm->nodes);
- vec_add1 (node_dups, nodes);
+ nodes = node_dups[j];
+ vec_validate (nodes, vec_len (nm->nodes) - 1);
+ clib_memcpy (nodes, nm->nodes, vec_len (nm->nodes) * sizeof (nodes[0]));
+ node_dups[j] = nodes;
}
}
- vlib_worker_thread_barrier_release (vm);
- return node_dups;
+ if (barrier_sync)
+ vlib_worker_thread_barrier_release (vm);
+
+ *node_dupsp = node_dups;
+ *stat_vmsp = stat_vms;
}
clib_error_t *
}
clib_error_t *