- vnet_hw_interface_t * hi;
- if (vec_len (vxm->free_vxlan_tunnel_hw_if_indices) > 0)
- {
- vnet_interface_main_t * im = &vnm->interface_main;
- hw_if_index = vxm->free_vxlan_tunnel_hw_if_indices
- [vec_len (vxm->free_vxlan_tunnel_hw_if_indices)-1];
- _vec_len (vxm->free_vxlan_tunnel_hw_if_indices) -= 1;
-
- hi = vnet_get_hw_interface (vnm, hw_if_index);
- hi->dev_instance = dev_instance;
- hi->hw_instance = dev_instance;
-
- sw_if_index = hi->sw_if_index;
- vnet_interface_name_renumber(sw_if_index, user_instance);
-
- /* clear old stats of freed tunnel before reuse */
- vnet_interface_counter_lock(im);
- vlib_zero_combined_counter
- (&im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX], sw_if_index);
- vlib_zero_combined_counter
- (&im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX], sw_if_index);
- vlib_zero_simple_counter
- (&im->sw_if_counters[VNET_INTERFACE_COUNTER_DROP], sw_if_index);
- vnet_interface_counter_unlock(im);
- }
- else
- {
- hw_if_index = vnet_register_interface
- (vnm, vxlan_device_class.index, t - vxm->tunnels,
- vxlan_hw_class.index, t - vxm->tunnels);
- hi = vnet_get_hw_interface (vnm, hw_if_index);
- }
+ t->hw_if_index = vnet_register_interface
+ (vnm, vxlan_device_class.index, dev_instance,
+ vxlan_hw_class.index, dev_instance);
+ vnet_hw_interface_t * hi = vnet_get_hw_interface (vnm, t->hw_if_index);