summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Dechamplain (cdechamp) <cdechamp@cisco.com>2016-04-05 10:40:38 -0400
committerDave Barach <openvpp@barachs.net>2016-04-28 16:34:32 +0000
commit07aecbb46f345e2ca1da1f159d4460d6758f0f19 (patch)
treea90515b3e4752a16e4ddecdcaa0d304a7fbd23aa
parent60c63c7b537260c88225848bd42f0c34a618671d (diff)
Add ability to set l2_mode_noprot
Change-Id: I3767a1bbe55452600863e145cbc12b114d6d1024 Signed-off-by: Todd Foggoa (tfoggoa) <tfoggoa@cisco.com>
-rw-r--r--vnet/vnet/ethernet/ethernet.h1
-rw-r--r--vnet/vnet/ethernet/node.c35
2 files changed, 36 insertions, 0 deletions
diff --git a/vnet/vnet/ethernet/ethernet.h b/vnet/vnet/ethernet/ethernet.h
index 6f16527c0e3..f519f4f3190 100644
--- a/vnet/vnet/ethernet/ethernet.h
+++ b/vnet/vnet/ethernet/ethernet.h
@@ -355,6 +355,7 @@ ethernet_buffer_get_header (vlib_buffer_t * b)
ethernet_main_t * ethernet_get_main (vlib_main_t * vm);
u32 ethernet_set_flags (vnet_main_t * vnm, u32 hw_if_index, u32 flags);
void ethernet_sw_interface_set_l2_mode (vnet_main_t * vnm, u32 sw_if_index, u32 l2);
+void ethernet_sw_interface_set_l2_mode_noport (vnet_main_t * vnm, u32 sw_if_index, u32 l2);
void ethernet_set_rx_redirect (vnet_main_t * vnm, vnet_hw_interface_t * hi, u32 enable);
int
diff --git a/vnet/vnet/ethernet/node.c b/vnet/vnet/ethernet/node.c
index 7b9924f5cde..e8902fd7410 100644
--- a/vnet/vnet/ethernet/node.c
+++ b/vnet/vnet/ethernet/node.c
@@ -839,6 +839,41 @@ ethernet_sw_interface_set_l2_mode (vnet_main_t * vnm,
return;
}
+/*
+ * Set the L2/L3 mode for the subinterface regardless of port
+ */
+void
+ethernet_sw_interface_set_l2_mode_noport (vnet_main_t * vnm,
+ u32 sw_if_index,
+ u32 l2)
+{
+ subint_config_t *subint;
+ u32 dummy_flags;
+ u32 dummy_unsup;
+
+ /* Find the config for this subinterface */
+ subint = ethernet_sw_interface_get_config (vnm, sw_if_index, &dummy_flags, &dummy_unsup);
+
+ if (subint == 0) {
+ /* unimplemented or not ethernet */
+ goto done;
+ }
+
+ /*
+ * Double check that the config we found is for our interface (or the
+ * interface is down)
+ */
+ ASSERT ((subint->sw_if_index == sw_if_index) | (subint->sw_if_index == ~0));
+
+ if (l2) {
+ subint->flags |= SUBINT_CONFIG_L2;
+ } else {
+ subint->flags &= ~SUBINT_CONFIG_L2;
+ }
+
+ done:
+ return;
+}
static clib_error_t *
ethernet_sw_interface_add_del (vnet_main_t * vnm,