VPP-171: fix a set of hw interface recycling bugs
Change-Id: I735292bb2176742acab2295f90956c57e6f7ec1c
Signed-off-by: Dave Barach <dave@barachs.net>
diff --git a/vnet/vnet/devices/dpdk/vhost_user.c b/vnet/vnet/devices/dpdk/vhost_user.c
index fd1bd22..1918a8f 100644
--- a/vnet/vnet/devices/dpdk/vhost_user.c
+++ b/vnet/vnet/devices/dpdk/vhost_user.c
@@ -939,7 +939,7 @@
vui->region_addr[i]= -1;
if (r == -1) {
- clib_warning("failed to unmap memory region (errno %d)", errno);
+ clib_unix_warning("failed to unmap memory region");
}
close(vui->region_fd[i]);
}
diff --git a/vnet/vnet/interface.c b/vnet/vnet/interface.c
index 2fb9374..d84c8b0 100644
--- a/vnet/vnet/interface.c
+++ b/vnet/vnet/interface.c
@@ -656,7 +656,16 @@
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;
+ 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;
+
+ vlib_worker_thread_node_runtime_update();
_vec_len (im->deleted_hw_interface_nodes) -= 1;
}
else
diff --git a/vnet/vnet/ip/ip46_cli.c b/vnet/vnet/ip/ip46_cli.c
index 44dde9b..3bb7d76 100644
--- a/vnet/vnet/ip/ip46_cli.c
+++ b/vnet/vnet/ip/ip46_cli.c
@@ -102,6 +102,23 @@
}
static clib_error_t *
+ip_address_delete_cleanup (vnet_main_t * vnm, u32 hw_if_index, u32 is_create)
+{
+ vlib_main_t * vm = vlib_get_main();
+ vnet_hw_interface_t * hw;
+
+ if (is_create)
+ return 0;
+
+ hw = vnet_get_hw_interface (vnm, hw_if_index);
+
+ ip_del_all_interface_addresses (vm, hw->sw_if_index);
+ return 0;
+}
+
+VNET_HW_INTERFACE_ADD_DEL_FUNCTION (ip_address_delete_cleanup);
+
+static clib_error_t *
add_del_ip_address (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)