aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Pfister <ppfister@cisco.com>2016-10-17 15:58:29 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2016-11-04 12:30:49 +0000
commitd1f3123795162370885d5920c402f76f64e05891 (patch)
tree01737cc3b7a9f60adb576eb9579cd387ba7bf9af
parent638aee3e84649ac9a2e5105ec03fec05f72362bf (diff)
Update tx and output node runtime when recycling interface
When an interface is removed, and another one is created, the nodes from the previous interface are reused. The current code fails when the new interface type differs from the original. It is necessary to update the node runtime, in particular the node function, and the node format function. Jira: VPP-460 Change-Id: I2fc3c609e0173a7f62597230768669039853ab03 Signed-off-by: Pierre Pfister <ppfister@cisco.com> (cherry picked from commit 064f55da7798f3a4c790b656dba71b32a3b82a5c)
-rw-r--r--vnet/vnet/interface.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/vnet/vnet/interface.c b/vnet/vnet/interface.c
index 3a12085da29..68433dac460 100644
--- a/vnet/vnet/interface.c
+++ b/vnet/vnet/interface.c
@@ -711,6 +711,8 @@ vnet_register_interface (vnet_main_t * vnm,
{
vnet_hw_interface_nodes_t *hn;
vnet_interface_output_runtime_t *rt;
+ vlib_node_t *node;
+ vlib_node_runtime_t *nrt;
hn = vec_end (im->deleted_hw_interface_nodes) - 1;
@@ -732,6 +734,22 @@ vnet_register_interface (vnet_main_t * vnm,
rt->sw_if_index = hw->sw_if_index;
rt->dev_instance = hw->dev_instance;
+ /* The new class may differ from the old one.
+ * Functions have to be updated. */
+ node = vlib_get_node (vm, hw->output_node_index);
+ node->function = dev_class->no_flatten_output_chains ?
+ vnet_interface_output_node_no_flatten_multiarch_select () :
+ vnet_interface_output_node_multiarch_select ();
+ node->format_trace = format_vnet_interface_output_trace;
+ nrt = vlib_node_get_runtime (vm, hw->output_node_index);
+ nrt->function = node->function;
+
+ node = vlib_get_node (vm, hw->tx_node_index);
+ node->function = dev_class->tx_function;
+ node->format_trace = dev_class->format_tx_trace;
+ 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;
}