aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/l2/l2_api.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-03-15 02:16:20 -0700
committerJohn Lo <loj@cisco.com>2019-03-21 20:33:30 +0000
commit192b13f96d6b4d1b4cbbb64a3d447329bf2ba900 (patch)
tree44681e508ad2dc06af4518e6f4d0ead6ff35ab77 /src/vnet/l2/l2_api.c
parent1ea74b5df5acfc827ee53fd5cb6bdb40140da0f0 (diff)
BVI Interface
a new dedicated BVI interface as opposed to [re]using a loopback. benefits: - removes ambiguity over the purpose of a loopback interface - TX node dedicated to BVI only functions. Change-Id: I749d6b38440d450ac5b909a28053c75ec9df946a Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/l2/l2_api.c')
-rw-r--r--src/vnet/l2/l2_api.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/vnet/l2/l2_api.c b/src/vnet/l2/l2_api.c
index 059f668d664..f60cd41bb39 100644
--- a/src/vnet/l2/l2_api.c
+++ b/src/vnet/l2/l2_api.c
@@ -27,6 +27,7 @@
#include <vnet/l2/l2_vtr.h>
#include <vnet/l2/l2_learn.h>
#include <vnet/l2/l2_bd.h>
+#include <vnet/l2/l2_bvi.h>
#include <vnet/ip/ip_types_api.h>
#include <vnet/ethernet/ethernet_types_api.h>
@@ -74,7 +75,9 @@ _(BRIDGE_FLAGS, bridge_flags) \
_(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \
_(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) \
_(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age) \
-_(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath)
+_(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) \
+_(BVI_CREATE, bvi_create) \
+_(BVI_DELETE, bvi_delete)
static void
send_l2_xconnect_details (vl_api_registration_t * reg, u32 context,
@@ -993,6 +996,37 @@ vl_api_sw_interface_set_vpath_t_handler (vl_api_sw_interface_set_vpath_t * mp)
REPLY_MACRO (VL_API_SW_INTERFACE_SET_VPATH_REPLY);
}
+static void
+vl_api_bvi_create_t_handler (vl_api_bvi_create_t * mp)
+{
+ vl_api_bvi_create_reply_t *rmp;
+ mac_address_t mac;
+ u32 sw_if_index;
+ int rv;
+
+ mac_address_decode (mp->mac, &mac);
+
+ rv = l2_bvi_create (ntohl (mp->user_instance), &mac, &sw_if_index);
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2(VL_API_BVI_CREATE_REPLY,
+ ({
+ rmp->sw_if_index = ntohl (sw_if_index);
+ }));
+ /* *INDENT-ON* */
+}
+
+static void
+vl_api_bvi_delete_t_handler (vl_api_bvi_delete_t * mp)
+{
+ vl_api_bvi_delete_reply_t *rmp;
+ int rv;
+
+ rv = l2_bvi_delete (ntohl (mp->sw_if_index));
+
+ REPLY_MACRO (VL_API_BVI_DELETE_REPLY);
+}
+
/*
* l2_api_hookup
* Add vpe's API message handlers to the table.