aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vat/api_format.c74
-rw-r--r--src/vnet/l2/l2.api44
-rw-r--r--src/vnet/l2/l2_api.c38
-rw-r--r--src/vpp/api/custom_dump.c26
4 files changed, 180 insertions, 2 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 090d990b9a5..61b8e1d8de4 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -4151,6 +4151,8 @@ _(sw_interface_set_l2_bridge_reply) \
_(bridge_domain_add_del_reply) \
_(sw_interface_set_l2_xconnect_reply) \
_(l2fib_add_del_reply) \
+_(l2fib_flush_int_reply) \
+_(l2fib_flush_bd_reply) \
_(ip_add_del_route_reply) \
_(ip_mroute_add_del_reply) \
_(mpls_route_add_del_reply) \
@@ -4320,6 +4322,8 @@ _(BRIDGE_DOMAIN_DETAILS, bridge_domain_details) \
_(BRIDGE_DOMAIN_SW_IF_DETAILS, bridge_domain_sw_if_details) \
_(BRIDGE_DOMAIN_SET_MAC_AGE_REPLY, bridge_domain_set_mac_age_reply) \
_(L2FIB_ADD_DEL_REPLY, l2fib_add_del_reply) \
+_(L2FIB_FLUSH_INT_REPLY, l2fib_flush_int_reply) \
+_(L2FIB_FLUSH_BD_REPLY, l2fib_flush_bd_reply) \
_(L2_FLAGS_REPLY, l2_flags_reply) \
_(BRIDGE_FLAGS_REPLY, bridge_flags_reply) \
_(TAP_CONNECT_REPLY, tap_connect_reply) \
@@ -5915,6 +5919,70 @@ api_bridge_domain_add_del (vat_main_t * vam)
}
static int
+api_l2fib_flush_bd (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_l2fib_flush_bd_t *mp;
+ u32 bd_id = ~0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "bd_id %d", &bd_id));
+ else
+ break;
+ }
+
+ if (bd_id == ~0)
+ {
+ errmsg ("missing bridge domain");
+ return -99;
+ }
+
+ M (L2FIB_FLUSH_BD, mp);
+
+ mp->bd_id = htonl (bd_id);
+
+ S (mp);
+ W (ret);
+ return ret;
+}
+
+static int
+api_l2fib_flush_int (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_l2fib_flush_int_t *mp;
+ u32 sw_if_index = ~0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "sw_if_index %d", &sw_if_index));
+ else
+ if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index));
+ else
+ break;
+ }
+
+ if (sw_if_index == ~0)
+ {
+ errmsg ("missing interface name or sw_if_index");
+ return -99;
+ }
+
+ M (L2FIB_FLUSH_INT, mp);
+
+ mp->sw_if_index = ntohl (sw_if_index);
+
+ S (mp);
+ W (ret);
+ return ret;
+}
+
+static int
api_l2fib_add_del (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
@@ -18542,15 +18610,17 @@ _(sw_interface_set_l2_xconnect, \
"rx <intfc> | rx_sw_if_index <id> tx <intfc> | tx_sw_if_index <id>\n" \
"enable | disable") \
_(sw_interface_set_l2_bridge, \
- "<intfc> | sw_if_index <id> bd_id <bridge-domain-id>\n" \
+ "{<intfc> | sw_if_index <id>} bd_id <bridge-domain-id>\n" \
"[shg <split-horizon-group>] [bvi]\n" \
"enable | disable") \
-_(bridge_domain_set_mac_age, "bd_id <bridge-domain-id> mac-age 0-255\n")\
+_(bridge_domain_set_mac_age, "bd_id <bridge-domain-id> mac-age 0-255") \
_(bridge_domain_add_del, \
"bd_id <bridge-domain-id> [flood 1|0] [uu-flood 1|0] [forward 1|0] [learn 1|0] [arp-term 1|0] [mac-age 0-255] [del]\n") \
_(bridge_domain_dump, "[bd_id <bridge-domain-id>]\n") \
_(l2fib_add_del, \
"mac <mac-addr> bd_id <bridge-domain-id> [del] | sw_if <intfc> | sw_if_index <id> [static] [filter] [bvi] [count <nn>]\n") \
+_(l2fib_flush_bd, "bd_id <bridge-domain-id>") \
+_(l2fib_flush_int, "<intfc> | sw_if_index <id>") \
_(l2_flags, \
"sw_if <intfc> | sw_if_index <id> [learn] [forward] [uu-flood] [flood]\n") \
_(bridge_flags, \
diff --git a/src/vnet/l2/l2.api b/src/vnet/l2/l2.api
index 81b75858bce..c23eebeca8c 100644
--- a/src/vnet/l2/l2.api
+++ b/src/vnet/l2/l2.api
@@ -86,6 +86,50 @@ define l2_fib_clear_table_reply
i32 retval;
};
+/** \brief L2 FIB flush bridge domain entries
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param bd_id - the entry's bridge domain id
+*/
+define l2fib_flush_bd
+{
+ u32 client_index;
+ u32 context;
+ u32 bd_id;
+};
+
+/** \brief L2 FIB flush bridge domain entries response
+ @param context - sender context, to match reply w/ request
+ @param retval - return code for the request
+*/
+define l2fib_flush_bd_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief L2 FIB flush interface entries
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param bd_id - the entry's bridge domain id
+*/
+define l2fib_flush_int
+{
+ u32 client_index;
+ u32 context;
+ u32 sw_if_index;
+};
+
+/** \brief L2 FIB flush interface entries response
+ @param context - sender context, to match reply w/ request
+ @param retval - return code for the request
+*/
+define l2fib_flush_int_reply
+{
+ u32 context;
+ i32 retval;
+};
+
/** \brief L2 FIB add entry request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
diff --git a/src/vnet/l2/l2_api.c b/src/vnet/l2/l2_api.c
index ffcc790134e..026f1706b84 100644
--- a/src/vnet/l2/l2_api.c
+++ b/src/vnet/l2/l2_api.c
@@ -48,6 +48,8 @@
_(L2_XCONNECT_DUMP, l2_xconnect_dump) \
_(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \
_(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
+_(L2FIB_FLUSH_INT, l2fib_flush_int) \
+_(L2FIB_FLUSH_BD, l2fib_flush_bd) \
_(L2FIB_ADD_DEL, l2fib_add_del) \
_(L2_FLAGS, l2_flags) \
_(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \
@@ -241,6 +243,42 @@ vl_api_l2fib_add_del_t_handler (vl_api_l2fib_add_del_t * mp)
}
static void
+vl_api_l2fib_flush_int_t_handler (vl_api_l2fib_flush_int_t * mp)
+{
+ int rv = 0;
+ vlib_main_t *vm = vlib_get_main ();
+ vl_api_l2fib_flush_int_reply_t *rmp;
+
+ VALIDATE_SW_IF_INDEX (mp);
+
+ u32 sw_if_index = ntohl (mp->sw_if_index);
+ l2fib_flush_int_mac (vm, sw_if_index);
+
+ BAD_SW_IF_INDEX_LABEL;
+ REPLY_MACRO (VL_API_L2FIB_FLUSH_INT_REPLY);
+}
+
+static void
+vl_api_l2fib_flush_bd_t_handler (vl_api_l2fib_flush_bd_t * mp)
+{
+ int rv = 0;
+ vlib_main_t *vm = vlib_get_main ();
+ bd_main_t *bdm = &bd_main;
+ vl_api_l2fib_flush_bd_reply_t *rmp;
+
+ 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;
+ }
+ l2fib_flush_bd_mac (vm, *p);
+out:
+ REPLY_MACRO (VL_API_L2FIB_FLUSH_BD_REPLY);
+}
+
+static void
vl_api_l2_flags_t_handler (vl_api_l2_flags_t * mp)
{
vl_api_l2_flags_reply_t *rmp;
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index b3fd781e585..000fe0d404a 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -298,6 +298,30 @@ static void *vl_api_bridge_domain_dump_t_print
FINISH;
}
+static void *vl_api_l2fib_flush_bd_t_print
+ (vl_api_l2fib_flush_bd_t * mp, void *handle)
+{
+ u8 *s;
+ u32 bd_id = ntohl (mp->bd_id);
+
+ s = format (0, "SCRIPT: l2fib_flush_bd ");
+ s = format (s, "bd_id %d ", bd_id);
+
+ FINISH;
+}
+
+static void *vl_api_l2fib_flush_int_t_print
+ (vl_api_l2fib_flush_int_t * mp, void *handle)
+{
+ u8 *s;
+ u32 sw_if_index = ntohl (mp->sw_if_index);
+
+ s = format (0, "SCRIPT: l2fib_flush_int ");
+ s = format (s, "sw_if_index %d ", sw_if_index);
+
+ FINISH;
+}
+
static void *vl_api_l2fib_add_del_t_print
(vl_api_l2fib_add_del_t * mp, void *handle)
{
@@ -2955,6 +2979,8 @@ _(SR_POLICY_MOD, sr_policy_mod) \
_(SR_POLICY_DEL, sr_policy_del) \
_(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \
_(L2FIB_ADD_DEL, l2fib_add_del) \
+_(L2FIB_FLUSH_BD, l2fib_flush_bd) \
+_(L2FIB_FLUSH_INT, l2fib_flush_int) \
_(L2_FLAGS, l2_flags) \
_(BRIDGE_FLAGS, bridge_flags) \
_(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table) \