From f00f91a818ff059d162f81a3b424188860091771 Mon Sep 17 00:00:00 2001 From: Pierre Pfister Date: Wed, 9 Mar 2016 18:22:32 +0000 Subject: Set hardware iface state for loopback interfaces So unless I have missed something, loopback interfaces are spawned hardware-down and never set up. This patch uses the same process as tapcli interfaces by mirroring sw state to hw state. Change-Id: I94198c1c880de773daccbb63ca8d32c4c7e26a74 Signed-off-by: Pierre Pfister --- vnet/vnet/ethernet/interface.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vnet/vnet/ethernet/interface.c b/vnet/vnet/ethernet/interface.c index 1f7276ee..429530e1 100644 --- a/vnet/vnet/ethernet/interface.c +++ b/vnet/vnet/ethernet/interface.c @@ -301,10 +301,20 @@ static u8 * format_simulated_ethernet_name (u8 * s, va_list * args) return format (s, "loop%d", dev_instance); } +static clib_error_t * +simulated_ethernet_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags) +{ + u32 hw_flags = (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ? + VNET_HW_INTERFACE_FLAG_LINK_UP : 0; + vnet_hw_interface_set_flags (vnm, hw_if_index, hw_flags); + return 0; +} + VNET_DEVICE_CLASS (ethernet_simulated_device_class) = { .name = "Loopback", .format_device_name = format_simulated_ethernet_name, .tx_function = simulated_ethernet_interface_tx, + .admin_up_down_function = simulated_ethernet_admin_up_down, }; int vnet_create_loopback_interface (u32 * sw_if_indexp, u8 *mac_address) -- cgit 1.2.3-korg