- vnet_interface_main_t *im = &vnm->interface_main;
- hw_if_index = vxm->free_geneve_tunnel_hw_if_indices
- [vec_len (vxm->free_geneve_tunnel_hw_if_indices) - 1];
- _vec_len (vxm->free_geneve_tunnel_hw_if_indices) -= 1;
-
- hi = vnet_get_hw_interface (vnm, hw_if_index);
- hi->dev_instance = t - vxm->tunnels;
- hi->hw_instance = hi->dev_instance;
-
- /* clear old stats of freed tunnel before reuse */
- sw_if_index = hi->sw_if_index;
- 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);
+ u32 t_idx = t - vxm->tunnels;
+ u8 address[6] =
+ { 0xd0, 0x0b, 0xee, 0xd0, (u8) (t_idx >> 8), (u8) t_idx };
+ clib_error_t *error =
+ ethernet_register_interface (vnm, geneve_device_class.index,
+ t_idx,
+ address, &hw_if_index, 0);
+ if (error)
+ {
+ clib_error_report (error);
+ return VNET_API_ERROR_INVALID_REGISTRATION;
+ }