aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/l2/l2_api.c
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2017-04-04 04:46:32 +0300
committerJohn Lo <loj@cisco.com>2017-04-04 19:00:37 +0000
commitfead670ae0a8323d8cd14e2cfad1fb8c25a48a99 (patch)
tree7e541e98aeee7dee5c7dbd36550ea54896c8a1f6 /src/vnet/l2/l2_api.c
parenta8ed6bd9ded4cbfff01f49571272e59def9f4010 (diff)
BD/API:add bridge_domain_set_mac_age api
Change-Id: Ic2d33b31ba88f6d9602a22439865637d98cf4a33 Signed-off-by: Eyal Bari <ebari@cisco.com>
Diffstat (limited to 'src/vnet/l2/l2_api.c')
-rw-r--r--src/vnet/l2/l2_api.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/vnet/l2/l2_api.c b/src/vnet/l2/l2_api.c
index a985852cec8..ffcc790134e 100644
--- a/src/vnet/l2/l2_api.c
+++ b/src/vnet/l2/l2_api.c
@@ -54,7 +54,8 @@ _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \
_(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \
_(BRIDGE_FLAGS, bridge_flags) \
_(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \
-_(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite)
+_(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) \
+_(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age)
static void
send_l2_xconnect_details (unix_shared_memory_queue_t * q, u32 context,
@@ -244,17 +245,13 @@ vl_api_l2_flags_t_handler (vl_api_l2_flags_t * mp)
{
vl_api_l2_flags_reply_t *rmp;
int rv = 0;
- u32 sw_if_index = ntohl (mp->sw_if_index);
- u32 flags = ntohl (mp->feature_bitmap);
u32 rbm = 0;
VALIDATE_SW_IF_INDEX (mp);
-#define _(a,b) \
- if (flags & L2INPUT_FEAT_ ## a) \
- rbm = l2input_intf_bitmap_enable (sw_if_index, L2INPUT_FEAT_ ## a, mp->is_set);
- foreach_l2input_feat;
-#undef _
+ u32 sw_if_index = ntohl (mp->sw_if_index);
+ u32 flags = ntohl (mp->feature_bitmap) & L2INPUT_VALID_MASK;
+ rbm = l2input_intf_bitmap_enable (sw_if_index, flags, mp->is_set);
BAD_SW_IF_INDEX_LABEL;
@@ -267,6 +264,26 @@ vl_api_l2_flags_t_handler (vl_api_l2_flags_t * mp)
}
static void
+vl_api_bridge_domain_set_mac_age_t_handler (vl_api_bridge_domain_set_mac_age_t
+ * mp)
+{
+ vlib_main_t *vm = vlib_get_main ();
+ bd_main_t *bdm = &bd_main;
+ vl_api_bridge_domain_set_mac_age_reply_t *rmp;
+ int rv = 0;
+ u32 bd_id = ntohl (mp->bd_id);
+ uword *p = hash_get (bdm->bd_index_by_bd_id, bd_id);
+ if (p == 0)
+ {
+ rv = VNET_API_ERROR_NO_SUCH_ENTRY;
+ goto out;
+ }
+ bd_set_mac_age (vm, *p, mp->mac_age);
+out:
+ REPLY_MACRO (VL_API_BRIDGE_DOMAIN_SET_MAC_AGE_REPLY);
+}
+
+static void
vl_api_bridge_domain_add_del_t_handler (vl_api_bridge_domain_add_del_t * mp)
{
vlib_main_t *vm = vlib_get_main ();