aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Pfister <ppfister@cisco.com>2016-03-09 18:22:32 +0000
committerGerrit Code Review <gerrit@fd.io>2016-03-11 15:20:48 +0000
commitf00f91a818ff059d162f81a3b424188860091771 (patch)
tree8c22380a83bc9f21295fe34c026198dc901749ff
parentcbf5ec3e41ec90e1ff48ef7246d03c0486a4fa80 (diff)
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 <ppfister@cisco.com>
-rw-r--r--vnet/vnet/ethernet/interface.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/vnet/vnet/ethernet/interface.c b/vnet/vnet/ethernet/interface.c
index 1f7276ee7d8..429530e18ad 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)