Compare commits

..

2 Commits

Author SHA1 Message Date
Neale Ranns a8f93f87b9 VPP debug image with worker threads hit assert on adding IP route with traffic (VPP-892)
When stacking DPOs the VLIB graph is also updated to add the edge between the nodes, if this edge does not yet exist. This addition should be done with the workers stopped.

Change-Id: I327e4d7d26f0b23eb280f17e4619ff2093ff7940
Signed-off-by: Neale Ranns <nranns@cisco.com>
(cherry picked from commit c02bd03ddf)
2017-06-30 11:56:59 +00:00
Igor Mikhailov (imichail) 65ebc02dc9 vlib: make runtime_data handling thread-local
Change-Id: Ic2f2dc234199a5f882846880cbacff20fc8d477b
Signed-off-by: Igor Mikhailov (imichail) <imichail@cisco.com>
(cherry picked from commit 8249a588e9)
2017-06-22 20:50:37 +00:00
4 changed files with 65 additions and 17 deletions
+20
View File
@@ -151,6 +151,26 @@ vlib_node_runtime_update (vlib_main_t * vm, u32 node_index, u32 next_index)
vlib_worker_thread_barrier_release (vm);
}
uword
vlib_node_get_next (vlib_main_t * vm, uword node_index, uword next_node_index)
{
vlib_node_main_t *nm = &vm->node_main;
vlib_node_t *node;
uword *p;
node = vec_elt (nm->nodes, node_index);
/* Runtime has to be initialized. */
ASSERT (nm->flags & VLIB_NODE_MAIN_RUNTIME_STARTED);
if ((p = hash_get (node->next_slot_by_node, next_node_index)))
{
return p[0];
}
return (~0);
}
/* Add next node to given node in given slot. */
uword
vlib_node_add_next_with_slot (vlib_main_t * vm,
+3
View File
@@ -1052,6 +1052,9 @@ vlib_node_vectors_per_main_loop_as_integer (vlib_main_t * vm, u32 node_index)
void
vlib_frame_free (vlib_main_t * vm, vlib_node_runtime_t * r, vlib_frame_t * f);
/* Return the edge index if present, ~0 otherwise */
uword vlib_node_get_next (vlib_main_t * vm, uword node, uword next_node);
/* Add next node to given node in given slot. */
uword
vlib_node_add_next_with_slot (vlib_main_t * vm,
+16 -1
View File
@@ -316,6 +316,8 @@ dpo_get_next_node (dpo_type_t child_type,
vm = vlib_get_main();
vlib_worker_thread_barrier_sync(vm);
ASSERT(NULL != dpo_nodes[child_type]);
ASSERT(NULL != dpo_nodes[child_type][child_proto]);
ASSERT(NULL != dpo_nodes[parent_type]);
@@ -357,6 +359,8 @@ dpo_get_next_node (dpo_type_t child_type,
}
cc++;
}
vlib_worker_thread_barrier_release(vm);
}
return (dpo_edges[child_type][child_proto][parent_type][parent_proto]);
@@ -434,10 +438,21 @@ dpo_stack_from_node (u32 child_node_index,
parent_node =
vlib_get_node_by_name(vm, (u8*) dpo_nodes[parent_type][parent_proto][0]);
edge = vlib_node_add_next(vm,
edge = vlib_node_get_next(vm,
child_node_index,
parent_node->index);
if (~0 == edge)
{
vlib_worker_thread_barrier_sync(vm);
edge = vlib_node_add_next(vm,
child_node_index,
parent_node->index);
vlib_worker_thread_barrier_release(vm);
}
dpo_stack_i(edge, dpo, parent);
}
+26 -16
View File
@@ -743,7 +743,6 @@ vnet_register_interface (vnet_main_t * vnm,
if (vec_len (im->deleted_hw_interface_nodes) > 0)
{
vnet_hw_interface_nodes_t *hn;
vnet_interface_output_runtime_t *rt;
vlib_node_t *node;
vlib_node_runtime_t *nrt;
@@ -755,17 +754,23 @@ vnet_register_interface (vnet_main_t * vnm,
vlib_node_rename (vm, hw->tx_node_index, "%v", tx_node_name);
vlib_node_rename (vm, hw->output_node_index, "%v", output_node_name);
rt = vlib_node_get_runtime_data (vm, hw->output_node_index);
ASSERT (rt->is_deleted == 1);
rt->is_deleted = 0;
rt->hw_if_index = hw_index;
rt->sw_if_index = hw->sw_if_index;
rt->dev_instance = hw->dev_instance;
/* *INDENT-OFF* */
foreach_vlib_main ({
vnet_interface_output_runtime_t *rt;
rt = vlib_node_get_runtime_data (vm, hw->tx_node_index);
rt->hw_if_index = hw_index;
rt->sw_if_index = hw->sw_if_index;
rt->dev_instance = hw->dev_instance;
rt = vlib_node_get_runtime_data (this_vlib_main, hw->output_node_index);
ASSERT (rt->is_deleted == 1);
rt->is_deleted = 0;
rt->hw_if_index = hw_index;
rt->sw_if_index = hw->sw_if_index;
rt->dev_instance = hw->dev_instance;
rt = vlib_node_get_runtime_data (this_vlib_main, hw->tx_node_index);
rt->hw_if_index = hw_index;
rt->sw_if_index = hw->sw_if_index;
rt->dev_instance = hw->dev_instance;
});
/* *INDENT-ON* */
/* The new class may differ from the old one.
* Functions have to be updated. */
@@ -783,7 +788,6 @@ vnet_register_interface (vnet_main_t * vnm,
nrt = vlib_node_get_runtime (vm, hw->tx_node_index);
nrt->function = node->function;
vlib_worker_thread_node_runtime_update ();
_vec_len (im->deleted_hw_interface_nodes) -= 1;
}
else
@@ -902,11 +906,17 @@ vnet_delete_hw_interface (vnet_main_t * vnm, u32 hw_if_index)
{
vnet_hw_interface_nodes_t *dn;
vnet_interface_output_runtime_t *rt =
vlib_node_get_runtime_data (vm, hw->output_node_index);
/* Mark node runtime as deleted so output node (if called) will drop packets. */
rt->is_deleted = 1;
/* *INDENT-OFF* */
foreach_vlib_main ({
vnet_interface_output_runtime_t *rt =
vlib_node_get_runtime_data (this_vlib_main, hw->output_node_index);
/* Mark node runtime as deleted so output node (if called)
* will drop packets. */
rt->is_deleted = 1;
});
/* *INDENT-ON* */
vlib_node_rename (vm, hw->output_node_index,
"interface-%d-output-deleted", hw_if_index);