aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet.am15
-rw-r--r--src/vnet/l2/l2.api229
-rw-r--r--src/vnet/l2/l2_api.c373
-rw-r--r--src/vnet/mpls/mpls.api246
-rw-r--r--src/vnet/mpls/mpls_api.c497
-rw-r--r--src/vnet/sr/sr.api119
-rw-r--r--src/vnet/sr/sr_api.c279
-rw-r--r--src/vnet/vnet_all_api_h.h2
-rw-r--r--src/vpp/api/api.c947
-rw-r--r--src/vpp/api/vpe.api574
10 files changed, 1770 insertions, 1511 deletions
diff --git a/src/vnet.am b/src/vnet.am
index bc0820a3d65..bca56227076 100644
--- a/src/vnet.am
+++ b/src/vnet.am
@@ -498,15 +498,18 @@ libvnet_la_SOURCES += \
vnet/mpls/node.c \
vnet/mpls/interface.c \
vnet/mpls/mpls_tunnel.c \
- vnet/mpls/pg.c
+ vnet/mpls/pg.c \
+ vnet/mpls/mpls_api.c
nobase_include_HEADERS += \
vnet/mpls/mpls.h \
vnet/mpls/mpls_types.h \
vnet/mpls/mpls_tunnel.h \
vnet/mpls/packet.h \
- vnet/mpls/error.def
+ vnet/mpls/error.def \
+ vnet/mpls/mpls.api.h
+API_FILES += vnet/mpls/mpls.api
########################################
# Tunnel protocol: vxlan-gpe
@@ -666,13 +669,17 @@ nobase_include_HEADERS += \
if WITH_IPV6SR
libvnet_la_SOURCES += \
vnet/sr/sr.c \
- vnet/sr/sr_replicate.c
+ vnet/sr/sr_replicate.c \
+ vnet/sr/sr_api.c
endif
nobase_include_HEADERS += \
vnet/sr/sr_packet.h \
vnet/sr/sr_error.def \
- vnet/sr/sr.h
+ vnet/sr/sr.h \
+ vnet/sr/sr.api.h
+
+API_FILES += vnet/sr/sr.api
########################################
# DHCPv6 proxy
diff --git a/src/vnet/l2/l2.api b/src/vnet/l2/l2.api
index 5fce7944b58..5b24f259f68 100644
--- a/src/vnet/l2/l2.api
+++ b/src/vnet/l2/l2.api
@@ -36,3 +36,232 @@ define l2_xconnect_dump
u32 context;
};
+/** \brief l2 fib table entry structure
+ @param bd_id - the l2 fib / bridge domain table id
+ @param mac - the entry's mac address
+ @param sw_if_index - index of the interface
+ @param static_mac - the entry is statically configured.
+ @param filter_mac - the entry is a mac filter entry.
+ @param bvi_mac - the mac address is a bridge virtual interface
+*/
+define l2_fib_table_entry
+{
+ u32 context;
+ u32 bd_id;
+ u64 mac;
+ u32 sw_if_index;
+ u8 static_mac;
+ u8 filter_mac;
+ u8 bvi_mac;
+};
+
+/** \brief Dump l2 fib (aka bridge domain) table
+ @param client_index - opaque cookie to identify the sender
+ @param bd_id - the l2 fib / bridge domain table identifier
+*/
+define l2_fib_table_dump
+{
+ u32 client_index;
+ u32 context;
+ u32 bd_id;
+};
+
+/** \brief L2 fib clear table request, clear all mac entries in the l2 fib
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+*/
+define l2_fib_clear_table
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief L2 fib clear table response
+ @param context - sender context, to match reply w/ request
+ @param retval - return code for the request
+*/
+define l2_fib_clear_table_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
+ @param mac - the entry's mac address
+ @param bd_id - the entry's bridge domain id
+ @param sw_if_index - the interface
+ @param is_add - If non zero add the entry, else delete it
+ @param static_mac -
+ @param filter_mac -
+*/
+define l2fib_add_del
+{
+ u32 client_index;
+ u32 context;
+ u64 mac;
+ u32 bd_id;
+ u32 sw_if_index;
+ u8 is_add;
+ u8 static_mac;
+ u8 filter_mac;
+ u8 bvi_mac;
+};
+
+/** \brief L2 FIB add entry response
+ @param context - sender context, to match reply w/ request
+ @param retval - return code for the add l2fib entry request
+*/
+define l2fib_add_del_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief Set L2 flags request !!! TODO - need more info, feature bits in l2_input.h
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param sw_if_index - interface
+ @param is_set - if non-zero, set the bits, else clear them
+ @param feature_bitmap - non-zero bits to set or clear
+*/
+define l2_flags
+{
+ u32 client_index;
+ u32 context;
+ u32 sw_if_index;
+ u8 is_set;
+ u32 feature_bitmap;
+};
+
+/** \brief Set L2 bits response
+ @param context - sender context, to match reply w/ request
+ @param retval - return code for the set l2 bits request
+*/
+define l2_flags_reply
+{
+ u32 context;
+ i32 retval;
+ u32 resulting_feature_bitmap;
+};
+
+/** \brief L2 bridge domain add or delete request
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param bd_id - the bridge domain to create
+ @param flood - enable/disable bcast/mcast flooding in the bd
+ @param uu_flood - enable/disable uknown unicast flood in the bd
+ @param forward - enable/disable forwarding on all interfaces in the bd
+ @param learn - enable/disable learning on all interfaces in the bd
+ @param arp_term - enable/disable arp termination in the bd
+ @param mac_age - mac aging time in min, 0 for disabled
+ @param is_add - add or delete flag
+*/
+define bridge_domain_add_del
+{
+ u32 client_index;
+ u32 context;
+ u32 bd_id;
+ u8 flood;
+ u8 uu_flood;
+ u8 forward;
+ u8 learn;
+ u8 arp_term;
+ u8 mac_age;
+ u8 is_add;
+};
+
+/** \brief L2 bridge domain add or delete response
+ @param context - sender context, to match reply w/ request
+ @param retval - return code for the set bridge flags request
+*/
+define bridge_domain_add_del_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief L2 bridge domain request operational state details
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param bd_id - the bridge domain id desired or ~0 to request all bds
+*/
+define bridge_domain_dump
+{
+ u32 client_index;
+ u32 context;
+ u32 bd_id;
+};
+
+/** \brief L2 bridge domain operational state response
+ @param bd_id - the bridge domain id
+ @param flood - bcast/mcast flooding state on all interfaces in the bd
+ @param uu_flood - uknown unicast flooding state on all interfaces in the bd
+ @param forward - forwarding state on all interfaces in the bd
+ @param learn - learning state on all interfaces in the bd
+ @param arp_term - arp termination state on all interfaces in the bd
+ @param mac_age - mac aging time in min, 0 for disabled
+ @param n_sw_ifs - number of sw_if_index's in the domain
+*/
+define bridge_domain_details
+{
+ u32 context;
+ u32 bd_id;
+ u8 flood;
+ u8 uu_flood;
+ u8 forward;
+ u8 learn;
+ u8 arp_term;
+ u8 mac_age;
+ u32 bvi_sw_if_index;
+ u32 n_sw_ifs;
+};
+
+/** \brief L2 bridge domain sw interface operational state response
+ @param bd_id - the bridge domain id
+ @param sw_if_index - sw_if_index in the domain
+ @param shg - split horizon group for the interface
+*/
+define bridge_domain_sw_if_details
+{
+ u32 context;
+ u32 bd_id;
+ u32 sw_if_index;
+ u8 shg;
+};
+
+/** \brief Set bridge flags (such as L2_LEARN, L2_FWD, L2_FLOOD,
+ L2_UU_FLOOD, or L2_ARP_TERM) request
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param bd_id - the bridge domain to set the flags for
+ @param is_set - if non-zero, set the flags, else clear them
+ @param feature_bitmap - bits that are non-zero to set or clear
+*/
+define bridge_flags
+{
+ u32 client_index;
+ u32 context;
+ u32 bd_id;
+ u8 is_set;
+ u32 feature_bitmap;
+};
+
+/** \brief Set bridge flags response
+ @param context - sender context, to match reply w/ request
+ @param retval - return code for the set bridge flags request
+ @param resulting_feature_bitmap - the feature bitmap value after the request is implemented
+*/
+define bridge_flags_reply
+{
+ u32 context;
+ i32 retval;
+ u32 resulting_feature_bitmap;
+};
+
+/*
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/l2/l2_api.c b/src/vnet/l2/l2_api.c
index ca4f593f1ec..ef33509c902 100644
--- a/src/vnet/l2/l2_api.c
+++ b/src/vnet/l2/l2_api.c
@@ -23,6 +23,7 @@
#include <vnet/interface.h>
#include <vnet/api_errno.h>
#include <vnet/l2/l2_input.h>
+#include <vnet/l2/l2_fib.h>
#include <vnet/vnet_msg_enum.h>
@@ -42,8 +43,18 @@
#include <vlibapi/api_helper_macros.h>
-#define foreach_vpe_api_msg \
-_(L2_XCONNECT_DUMP, l2_xconnect_dump)
+#define foreach_vpe_api_msg \
+_(L2_XCONNECT_DUMP, l2_xconnect_dump) \
+_(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \
+_(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
+_(L2_FIB_TABLE_ENTRY, l2_fib_table_entry) \
+_(L2FIB_ADD_DEL, l2fib_add_del) \
+_(L2_FLAGS, l2_flags) \
+_(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \
+_(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \
+_(BRIDGE_DOMAIN_DETAILS, bridge_domain_details) \
+_(BRIDGE_DOMAIN_SW_IF_DETAILS, bridge_domain_sw_if_details) \
+_(BRIDGE_FLAGS, bridge_flags)
static void
send_l2_xconnect_details (unix_shared_memory_queue_t * q, u32 context,
@@ -86,9 +97,365 @@ vl_api_l2_xconnect_dump_t_handler (vl_api_l2_xconnect_dump_t * mp)
/* *INDENT-ON* */
}
+static void
+vl_api_l2_fib_clear_table_t_handler (vl_api_l2_fib_clear_table_t * mp)
+{
+ int rv = 0;
+ vl_api_l2_fib_clear_table_reply_t *rmp;
+
+ /* DAW-FIXME: This API should only clear non-static l2fib entries, but
+ * that is not currently implemented. When that TODO is fixed
+ * this call should be changed to pass 1 instead of 0.
+ */
+ l2fib_clear_table (0);
+
+ REPLY_MACRO (VL_API_L2_FIB_CLEAR_TABLE_REPLY);
+}
+
+static void
+send_l2fib_table_entry (vpe_api_main_t * am,
+ unix_shared_memory_queue_t * q,
+ l2fib_entry_key_t * l2fe_key,
+ l2fib_entry_result_t * l2fe_res, u32 context)
+{
+ vl_api_l2_fib_table_entry_t *mp;
+
+ mp = vl_msg_api_alloc (sizeof (*mp));
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = ntohs (VL_API_L2_FIB_TABLE_ENTRY);
+
+ mp->bd_id =
+ ntohl (l2input_main.bd_configs[l2fe_key->fields.bd_index].bd_id);
+
+ mp->mac = l2fib_make_key (l2fe_key->fields.mac, 0);
+ mp->sw_if_index = ntohl (l2fe_res->fields.sw_if_index);
+ mp->static_mac = l2fe_res->fields.static_mac;
+ mp->filter_mac = l2fe_res->fields.filter;
+ mp->bvi_mac = l2fe_res->fields.bvi;
+ mp->context = context;
+
+ vl_msg_api_send_shmem (q, (u8 *) & mp);
+}
+
+static void
+vl_api_l2_fib_table_entry_t_handler (vl_api_l2_fib_table_entry_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+static void
+vl_api_l2_fib_table_dump_t_handler (vl_api_l2_fib_table_dump_t * mp)
+{
+ vpe_api_main_t *am = &vpe_api_main;
+ bd_main_t *bdm = &bd_main;
+ l2fib_entry_key_t *l2fe_key = NULL;
+ l2fib_entry_result_t *l2fe_res = NULL;
+ u32 ni, bd_id = ntohl (mp->bd_id);
+ u32 bd_index;
+ unix_shared_memory_queue_t *q;
+ uword *p;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ return;
+
+ /* see l2fib_table_dump: ~0 means "any" */
+ if (bd_id == ~0)
+ bd_index = ~0;
+ else
+ {
+ p = hash_get (bdm->bd_index_by_bd_id, bd_id);
+ if (p == 0)
+ return;
+
+ bd_index = p[0];
+ }
+
+ l2fib_table_dump (bd_index, &l2fe_key, &l2fe_res);
+
+ vec_foreach_index (ni, l2fe_key)
+ {
+ send_l2fib_table_entry (am, q, vec_elt_at_index (l2fe_key, ni),
+ vec_elt_at_index (l2fe_res, ni), mp->context);
+ }
+ vec_free (l2fe_key);
+ vec_free (l2fe_res);
+}
+
+static void
+vl_api_l2fib_add_del_t_handler (vl_api_l2fib_add_del_t * mp)
+{
+ bd_main_t *bdm = &bd_main;
+ l2input_main_t *l2im = &l2input_main;
+ vl_api_l2fib_add_del_reply_t *rmp;
+ int rv = 0;
+ u64 mac = 0;
+ u32 sw_if_index = ntohl (mp->sw_if_index);
+ u32 bd_id = ntohl (mp->bd_id);
+ u32 bd_index;
+ u32 static_mac;
+ u32 filter_mac;
+ u32 bvi_mac;
+ uword *p;
+
+ mac = mp->mac;
+
+ p = hash_get (bdm->bd_index_by_bd_id, bd_id);
+ if (!p)
+ {
+ rv = VNET_API_ERROR_NO_SUCH_ENTRY;
+ goto bad_sw_if_index;
+ }
+ bd_index = p[0];
+
+ if (mp->is_add)
+ {
+ filter_mac = mp->filter_mac ? 1 : 0;
+ if (filter_mac == 0)
+ {
+ VALIDATE_SW_IF_INDEX (mp);
+ if (vec_len (l2im->configs) <= sw_if_index)
+ {
+ rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
+ goto bad_sw_if_index;
+ }
+ else
+ {
+ l2_input_config_t *config;
+ config = vec_elt_at_index (l2im->configs, sw_if_index);
+ if (config->bridge == 0)
+ {
+ rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
+ goto bad_sw_if_index;
+ }
+ }
+ }
+ static_mac = mp->static_mac ? 1 : 0;
+ bvi_mac = mp->bvi_mac ? 1 : 0;
+ l2fib_add_entry (mac, bd_index, sw_if_index, static_mac, filter_mac,
+ bvi_mac);
+ }
+ else
+ {
+ l2fib_del_entry (mac, bd_index);
+ }
+
+ BAD_SW_IF_INDEX_LABEL;
+
+ REPLY_MACRO (VL_API_L2FIB_ADD_DEL_REPLY);
+}
+
+static void
+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 _
+
+ BAD_SW_IF_INDEX_LABEL;
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2(VL_API_L2_FLAGS_REPLY,
+ ({
+ rmp->resulting_feature_bitmap = ntohl(rbm);
+ }));
+ /* *INDENT-ON* */
+}
+
+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 ();
+ bd_main_t *bdm = &bd_main;
+ vl_api_bridge_domain_add_del_reply_t *rmp;
+ int rv = 0;
+ u32 enable_flags = 0, disable_flags = 0;
+ u32 bd_id = ntohl (mp->bd_id);
+ u32 bd_index;
+
+ if (mp->is_add)
+ {
+ bd_index = bd_find_or_add_bd_index (bdm, bd_id);
+
+ if (mp->flood)
+ enable_flags |= L2_FLOOD;
+ else
+ disable_flags |= L2_FLOOD;
+
+ if (mp->uu_flood)
+ enable_flags |= L2_UU_FLOOD;
+ else
+ disable_flags |= L2_UU_FLOOD;
+
+ if (mp->forward)
+ enable_flags |= L2_FWD;
+ else
+ disable_flags |= L2_FWD;
+
+ if (mp->arp_term)
+ enable_flags |= L2_ARP_TERM;
+ else
+ disable_flags |= L2_ARP_TERM;
+
+ if (mp->learn)
+ enable_flags |= L2_LEARN;
+ else
+ disable_flags |= L2_LEARN;
+
+ if (enable_flags)
+ bd_set_flags (vm, bd_index, enable_flags, 1 /* enable */ );
+
+ if (disable_flags)
+ bd_set_flags (vm, bd_index, disable_flags, 0 /* disable */ );
+
+ bd_set_mac_age (vm, bd_index, mp->mac_age);
+ }
+ else
+ rv = bd_delete_bd_index (bdm, bd_id);
+
+ REPLY_MACRO (VL_API_BRIDGE_DOMAIN_ADD_DEL_REPLY);
+}
+
+static void
+vl_api_bridge_domain_details_t_handler (vl_api_bridge_domain_details_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+static void
+ vl_api_bridge_domain_sw_if_details_t_handler
+ (vl_api_bridge_domain_sw_if_details_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+static void
+send_bridge_domain_details (unix_shared_memory_queue_t * q,
+ l2_bridge_domain_t * bd_config,
+ u32 n_sw_ifs, u32 context)
+{
+ vl_api_bridge_domain_details_t *mp;
+
+ mp = vl_msg_api_alloc (sizeof (*mp));
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_DETAILS);
+ mp->bd_id = ntohl (bd_config->bd_id);
+ mp->flood = bd_feature_flood (bd_config);
+ mp->uu_flood = bd_feature_uu_flood (bd_config);
+ mp->forward = bd_feature_forward (bd_config);
+ mp->learn = bd_feature_learn (bd_config);
+ mp->arp_term = bd_feature_arp_term (bd_config);
+ mp->bvi_sw_if_index = ntohl (bd_config->bvi_sw_if_index);
+ mp->mac_age = bd_config->mac_age;
+ mp->n_sw_ifs = ntohl (n_sw_ifs);
+ mp->context = context;
+
+ vl_msg_api_send_shmem (q, (u8 *) & mp);
+}
+
+static void
+send_bd_sw_if_details (l2input_main_t * l2im,
+ unix_shared_memory_queue_t * q,
+ l2_flood_member_t * member, u32 bd_id, u32 context)
+{
+ vl_api_bridge_domain_sw_if_details_t *mp;
+ l2_input_config_t *input_cfg;
+
+ mp = vl_msg_api_alloc (sizeof (*mp));
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_SW_IF_DETAILS);
+ mp->bd_id = ntohl (bd_id);
+ mp->sw_if_index = ntohl (member->sw_if_index);
+ input_cfg = vec_elt_at_index (l2im->configs, member->sw_if_index);
+ mp->shg = input_cfg->shg;
+ mp->context = context;
+
+ vl_msg_api_send_shmem (q, (u8 *) & mp);
+}
+
+static void
+vl_api_bridge_domain_dump_t_handler (vl_api_bridge_domain_dump_t * mp)
+{
+ bd_main_t *bdm = &bd_main;
+ l2input_main_t *l2im = &l2input_main;
+ unix_shared_memory_queue_t *q;
+ l2_bridge_domain_t *bd_config;
+ u32 bd_id, bd_index;
+ u32 end;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+
+ if (q == 0)
+ return;
+
+ bd_id = ntohl (mp->bd_id);
+
+ bd_index = (bd_id == ~0) ? 0 : bd_find_or_add_bd_index (bdm, bd_id);
+ end = (bd_id == ~0) ? vec_len (l2im->bd_configs) : bd_index + 1;
+ for (; bd_index < end; bd_index++)
+ {
+ bd_config = l2input_bd_config_from_index (l2im, bd_index);
+ /* skip dummy bd_id 0 */
+ if (bd_config && (bd_config->bd_id > 0))
+ {
+ u32 n_sw_ifs;
+ l2_flood_member_t *m;
+
+ n_sw_ifs = vec_len (bd_config->members);
+ send_bridge_domain_details (q, bd_config, n_sw_ifs, mp->context);
+
+ vec_foreach (m, bd_config->members)
+ {
+ send_bd_sw_if_details (l2im, q, m, bd_config->bd_id, mp->context);
+ }
+ }
+ }
+}
+
+static void
+vl_api_bridge_flags_t_handler (vl_api_bridge_flags_t * mp)
+{
+ vlib_main_t *vm = vlib_get_main ();
+ bd_main_t *bdm = &bd_main;
+ vl_api_bridge_flags_reply_t *rmp;
+ int rv = 0;
+ u32 bd_id = ntohl (mp->bd_id);
+ u32 bd_index;
+ u32 flags = ntohl (mp->feature_bitmap);
+ uword *p;
+
+ p = hash_get (bdm->bd_index_by_bd_id, bd_id);
+ if (p == 0)
+ {
+ rv = VNET_API_ERROR_NO_SUCH_ENTRY;
+ goto out;
+ }
+
+ bd_index = p[0];
+
+ bd_set_flags (vm, bd_index, flags, mp->is_set);
+
+out:
+ /* *INDENT-OFF* */
+ REPLY_MACRO2(VL_API_BRIDGE_FLAGS_REPLY,
+ ({
+ rmp->resulting_feature_bitmap = ntohl(flags);
+ }));
+ /* *INDENT-ON* */
+}
/*
- * vpe_api_hookup
+ * l2_api_hookup
* Add vpe's API message handlers to the table.
* vlib has alread mapped shared memory and
* added the client registration handlers.
diff --git a/src/vnet/mpls/mpls.api b/src/vnet/mpls/mpls.api
new file mode 100644
index 00000000000..2e3bfaf53f5
--- /dev/null
+++ b/src/vnet/mpls/mpls.api
@@ -0,0 +1,246 @@
+/*
+ * Copyright (c) 2015-2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** \brief Bind/Unbind an MPLS local label to an IP prefix. i.e. create
+ a per-prefix label entry.
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param mb_mpls_table_id - The MPLS table-id the MPLS entry will be added in
+ @param mb_label - The MPLS label value to bind
+ @param mb_ip_table_id - The IP table-id of the IP prefix to bind to.
+ @param mb_create_table_if_needed - Create either/both tables if required.
+ @param mb_is_bind - Bind or unbind
+ @param mb_is_ip4 - The prefix to bind to is IPv4
+ @param mb_address_length - Length of IP prefix
+ @param mb_address[16] - IP prefix/
+*/
+define mpls_ip_bind_unbind
+{
+ u32 client_index;
+ u32 context;
+ u32 mb_mpls_table_id;
+ u32 mb_label;
+ u32 mb_ip_table_id;
+ u8 mb_create_table_if_needed;
+ u8 mb_is_bind;
+ u8 mb_is_ip4;
+ u8 mb_address_length;
+ u8 mb_address[16];
+};
+
+/** \brief Reply for MPLS IP bind/unbind request
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define mpls_ip_bind_unbind_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief MPLS tunnel Add / del route
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param mt_is_add - Is this a route add or delete
+ @param mt_sw_if_index - The SW interface index of the tunnel to delete
+ @param mt_next_hop_proto_is_ip4 - The next-hop is IPV4
+ @param mt_next_hop_weight - The weight, for UCMP
+ @param mt_next_hop[16] - the nextop address
+ @param mt_next_hop_sw_if_index - the next-hop SW interface
+ @param mt_next_hop_table_id - the next-hop table-id (if appropriate)
+ @param mt_next_hop_n_out_labels - the number of next-hop output labels
+ @param mt_next_hop_out_label_stack - the next-hop output label stack, outer most first
+*/
+define mpls_tunnel_add_del
+{
+ u32 client_index;
+ u32 context;
+ u32 mt_sw_if_index;
+ u8 mt_is_add;
+ u8 mt_l2_only;
+ u8 mt_next_hop_proto_is_ip4;
+ u8 mt_next_hop_weight;
+ u8 mt_next_hop[16];
+ u8 mt_next_hop_n_out_labels;
+ u32 mt_next_hop_sw_if_index;
+ u32 mt_next_hop_table_id;
+ u32 mt_next_hop_out_label_stack[mt_next_hop_n_out_labels];
+};
+
+/** \brief Reply for MPLS tunnel add / del request
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+ @param sw_if_index - SW interface index of the tunnel created
+*/
+define mpls_tunnel_add_del_reply
+{
+ u32 context;
+ i32 retval;
+ u32 sw_if_index;
+};
+
+/** \brief Dump mpls eth tunnel table
+ @param client_index - opaque cookie to identify the sender
+ @param tunnel_index - eth tunnel identifier or -1 in case of all tunnels
+*/
+define mpls_tunnel_dump
+{
+ u32 client_index;
+ u32 context;
+ i32 tunnel_index;
+};
+
+/** \brief mpls eth tunnel operational state response
+ @param tunnel_index - eth tunnel identifier
+ @param intfc_address - interface ipv4 addr
+ @param mask_width - interface ipv4 addr mask
+ @param hw_if_index - interface id
+ @param l2_only -
+ @param tunnel_dst_mac -
+ @param tx_sw_if_index -
+ @param encap_index - reference to mpls label table
+ @param nlabels - number of resolved labels
+ @param labels - resolved labels
+*/
+define mpls_tunnel_details
+{
+ u32 context;
+ u32 tunnel_index;
+ u8 mt_l2_only;
+ u8 mt_sw_if_index;
+ u8 mt_next_hop_proto_is_ip4;
+ u8 mt_next_hop[16];
+ u32 mt_next_hop_sw_if_index;
+ u32 mt_next_hop_table_id;
+ u32 mt_next_hop_n_labels;
+ u32 mt_next_hop_out_labels[mt_next_hop_n_labels];
+};
+
+/** \brief MPLS Route Add / del route
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param mr_label - The MPLS label value
+ @param mr_eos - The End of stack bit
+ @param mr_table_id - The MPLS table-id the route is added in
+ @param mr_classify_table_index - If this is a classify route,
+ this is the classify table index
+ @param mr_create_table_if_needed - If the MPLS or IP tables do not exist,
+ create them
+ @param mr_is_add - Is this a route add or delete
+ @param mr_is_classify - Is this route result a classify
+ @param mr_is_multipath - Is this route update a multipath - i.e. is this
+ a path addition to an existing route
+ @param mr_is_resolve_host - Recurse resolution constraint via a host prefix
+ @param mr_is_resolve_attached - Recurse resolution constraint via attached prefix
+ @param mr_next_hop_proto_is_ip4 - The next-hop is IPV4
+ @param mr_next_hop_weight - The weight, for UCMP
+ @param mr_next_hop[16] - the nextop address
+ @param mr_next_hop_sw_if_index - the next-hop SW interface
+ @param mr_next_hop_table_id - the next-hop table-id (if appropriate)
+ @param mr_next_hop_n_out_labels - the number of labels in the label stack
+ @param mr_next_hop_out_label_stack - the next-hop output label stack, outer most first
+ @param next_hop_via_label - The next-hop is a resolved via a local label
+*/
+define mpls_route_add_del
+{
+ u32 client_index;
+ u32 context;
+ u32 mr_label;
+ u8 mr_eos;
+ u32 mr_table_id;
+ u32 mr_classify_table_index;
+ u8 mr_create_table_if_needed;
+ u8 mr_is_add;
+ u8 mr_is_classify;
+ u8 mr_is_multipath;
+ u8 mr_is_resolve_host;
+ u8 mr_is_resolve_attached;
+ u8 mr_next_hop_proto_is_ip4;
+ u8 mr_next_hop_weight;
+ u8 mr_next_hop[16];
+ u8 mr_next_hop_n_out_labels;
+ u32 mr_next_hop_sw_if_index;
+ u32 mr_next_hop_table_id;
+ u32 mr_next_hop_via_label;
+ u32 mr_next_hop_out_label_stack[mr_next_hop_n_out_labels];
+};
+
+/** \brief Reply for MPLS route add / del request
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define mpls_route_add_del_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief FIB path
+ @param sw_if_index - index of the interface
+ @param weight - The weight, for UCMP
+ @param is_local - local if non-zero, else remote
+ @param is_drop - Drop the packet
+ @param is_unreach - Drop the packet and rate limit send ICMP unreachable
+ @param is_prohibit - Drop the packet and rate limit send ICMP prohibited
+ @param afi - the afi of the next hop, IP46_TYPE_IP4=1, IP46_TYPE_IP6=2
+ @param next_hop[16] - the next hop address
+
+ WARNING: this type is replicated, pending cleanup completion
+
+*/
+typeonly manual_print manual_endian define fib_path2
+{
+ u32 sw_if_index;
+ u32 weight;
+ u8 is_local;
+ u8 is_drop;
+ u8 is_unreach;
+ u8 is_prohibit;
+ u8 afi;
+ u8 next_hop[16];
+};
+
+/** \brief Dump MPLS fib table
+ @param client_index - opaque cookie to identify the sender
+*/
+define mpls_fib_dump
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief mpls FIB table response
+ @param table_id - MPLS fib table id
+ @param s_bit - End-of-stack bit
+ @param label - MPLS label value
+ @param count - the number of fib_path in path
+ @param path - array of of fib_path structures
+*/
+manual_endian manual_print define mpls_fib_details
+{
+ u32 context;
+ u32 table_id;
+ u8 eos_bit;
+ u32 label;
+ u32 count;
+ vl_api_fib_path2_t path[count];
+};
+
+/*
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
+ \ No newline at end of file
diff --git a/src/vnet/mpls/mpls_api.c b/src/vnet/mpls/mpls_api.c
new file mode 100644
index 00000000000..ebbeba698a1
--- /dev/null
+++ b/src/vnet/mpls/mpls_api.c
@@ -0,0 +1,497 @@
+/*
+ *------------------------------------------------------------------
+ * mpls_api.c - mpls api
+ *
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#include <vnet/vnet.h>
+#include <vlibmemory/api.h>
+
+#include <vnet/interface.h>
+#include <vnet/api_errno.h>
+#include <vnet/mpls/mpls.h>
+#include <vnet/mpls/mpls_tunnel.h>
+#include <vnet/fib/fib_table.h>
+#include <vnet/fib/fib_api.h>
+
+#include <vnet/vnet_msg_enum.h>
+
+#define vl_typedefs /* define message structures */
+#include <vnet/vnet_all_api_h.h>
+#undef vl_typedefs
+
+#define vl_endianfun /* define message structures */
+#include <vnet/vnet_all_api_h.h>
+#undef vl_endianfun
+
+/* instantiate all the print functions we know about */
+#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
+#define vl_printfun
+#include <vnet/vnet_all_api_h.h>
+#undef vl_printfun
+
+#include <vlibapi/api_helper_macros.h>
+
+#define foreach_vpe_api_msg \
+_(MPLS_IP_BIND_UNBIND, mpls_ip_bind_unbind) \
+_(MPLS_ROUTE_ADD_DEL, mpls_route_add_del) \
+_(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \
+_(MPLS_TUNNEL_DUMP, mpls_tunnel_dump) \
+_(MPLS_TUNNEL_DETAILS, mpls_tunnel_details) \
+_(MPLS_FIB_DUMP, mpls_fib_dump) \
+_(MPLS_FIB_DETAILS, mpls_fib_details)
+
+extern void stats_dslock_with_hint (int hint, int tag);
+extern void stats_dsunlock (void);
+
+static int
+mpls_ip_bind_unbind_handler (vnet_main_t * vnm,
+ vl_api_mpls_ip_bind_unbind_t * mp)
+{
+ u32 mpls_fib_index, ip_fib_index;
+
+ mpls_fib_index =
+ fib_table_find (FIB_PROTOCOL_MPLS, ntohl (mp->mb_mpls_table_id));
+
+ if (~0 == mpls_fib_index)
+ {
+ if (mp->mb_create_table_if_needed)
+ {
+ mpls_fib_index =
+ fib_table_find_or_create_and_lock (FIB_PROTOCOL_MPLS,
+ ntohl (mp->mb_mpls_table_id));
+ }
+ else
+ return VNET_API_ERROR_NO_SUCH_FIB;
+ }
+
+ ip_fib_index = fib_table_find ((mp->mb_is_ip4 ?
+ FIB_PROTOCOL_IP4 :
+ FIB_PROTOCOL_IP6),
+ ntohl (mp->mb_ip_table_id));
+ if (~0 == ip_fib_index)
+ return VNET_API_ERROR_NO_SUCH_FIB;
+
+ fib_prefix_t pfx = {
+ .fp_len = mp->mb_address_length,
+ };
+
+ if (mp->mb_is_ip4)
+ {
+ pfx.fp_proto = FIB_PROTOCOL_IP4;
+ clib_memcpy (&pfx.fp_addr.ip4, mp->mb_address,
+ sizeof (pfx.fp_addr.ip4));
+ }
+ else
+ {
+ pfx.fp_proto = FIB_PROTOCOL_IP6;
+ clib_memcpy (&pfx.fp_addr.ip6, mp->mb_address,
+ sizeof (pfx.fp_addr.ip6));
+ }
+
+ if (mp->mb_is_bind)
+ fib_table_entry_local_label_add (ip_fib_index, &pfx,
+ ntohl (mp->mb_label));
+ else
+ fib_table_entry_local_label_remove (ip_fib_index, &pfx,
+ ntohl (mp->mb_label));
+
+ return (0);
+}
+
+void
+vl_api_mpls_ip_bind_unbind_t_handler (vl_api_mpls_ip_bind_unbind_t * mp)
+{
+ vl_api_mpls_ip_bind_unbind_reply_t *rmp;
+ vnet_main_t *vnm;
+ int rv;
+
+ vnm = vnet_get_main ();
+ vnm->api_errno = 0;
+
+ rv = mpls_ip_bind_unbind_handler (vnm, mp);
+ rv = (rv == 0) ? vnm->api_errno : rv;
+
+ REPLY_MACRO (VL_API_MPLS_IP_BIND_UNBIND_REPLY);
+}
+
+static int
+mpls_route_add_del_t_handler (vnet_main_t * vnm,
+ vl_api_mpls_route_add_del_t * mp)
+{
+ u32 fib_index, next_hop_fib_index;
+ mpls_label_t *label_stack = NULL;
+ int rv, ii, n_labels;;
+
+ fib_prefix_t pfx = {
+ .fp_len = 21,
+ .fp_proto = FIB_PROTOCOL_MPLS,
+ .fp_eos = mp->mr_eos,
+ .fp_label = ntohl (mp->mr_label),
+ };
+ if (pfx.fp_eos)
+ {
+ if (mp->mr_next_hop_proto_is_ip4)
+ {
+ pfx.fp_payload_proto = DPO_PROTO_IP4;
+ }
+ else
+ {
+ pfx.fp_payload_proto = DPO_PROTO_IP6;
+ }
+ }
+ else
+ {
+ pfx.fp_payload_proto = DPO_PROTO_MPLS;
+ }
+
+ rv = add_del_route_check (FIB_PROTOCOL_MPLS,
+ mp->mr_table_id,
+ mp->mr_next_hop_sw_if_index,
+ dpo_proto_to_fib (pfx.fp_payload_proto),
+ mp->mr_next_hop_table_id,
+ mp->mr_create_table_if_needed,
+ &fib_index, &next_hop_fib_index);
+
+ if (0 != rv)
+ return (rv);
+
+ ip46_address_t nh;
+ memset (&nh, 0, sizeof (nh));
+
+ if (mp->mr_next_hop_proto_is_ip4)
+ memcpy (&nh.ip4, mp->mr_next_hop, sizeof (nh.ip4));
+ else
+ memcpy (&nh.ip6, mp->mr_next_hop, sizeof (nh.ip6));
+
+ n_labels = mp->mr_next_hop_n_out_labels;
+ if (n_labels == 0)
+ ;
+ else if (1 == n_labels)
+ vec_add1 (label_stack, ntohl (mp->mr_next_hop_out_label_stack[0]));
+ else
+ {
+ vec_validate (label_stack, n_labels - 1);
+ for (ii = 0; ii < n_labels; ii++)
+ label_stack[ii] = ntohl (mp->mr_next_hop_out_label_stack[ii]);
+ }
+
+ return (add_del_route_t_handler (mp->mr_is_multipath, mp->mr_is_add, 0, // mp->is_drop,
+ 0, // mp->is_unreach,
+ 0, // mp->is_prohibit,
+ 0, // mp->is_local,
+ mp->mr_is_classify,
+ mp->mr_classify_table_index,
+ mp->mr_is_resolve_host,
+ mp->mr_is_resolve_attached,
+ fib_index, &pfx,
+ mp->mr_next_hop_proto_is_ip4,
+ &nh, ntohl (mp->mr_next_hop_sw_if_index),
+ next_hop_fib_index,
+ mp->mr_next_hop_weight,
+ ntohl (mp->mr_next_hop_via_label),
+ label_stack));
+}
+
+void
+vl_api_mpls_route_add_del_t_handler (vl_api_mpls_route_add_del_t * mp)
+{
+ vl_api_mpls_route_add_del_reply_t *rmp;
+ vnet_main_t *vnm;
+ int rv;
+
+ vnm = vnet_get_main ();
+ vnm->api_errno = 0;
+
+ rv = mpls_route_add_del_t_handler (vnm, mp);
+
+ rv = (rv == 0) ? vnm->api_errno : rv;
+
+ REPLY_MACRO (VL_API_MPLS_ROUTE_ADD_DEL_REPLY);
+}
+
+static void
+vl_api_mpls_tunnel_add_del_t_handler (vl_api_mpls_tunnel_add_del_t * mp)
+{
+ vl_api_mpls_tunnel_add_del_reply_t *rmp;
+ int rv = 0;
+ u32 tunnel_sw_if_index;
+ int ii;
+
+ stats_dslock_with_hint (1 /* release hint */ , 5 /* tag */ );
+
+ if (mp->mt_is_add)
+ {
+ fib_route_path_t rpath, *rpaths = NULL;
+ mpls_label_t *label_stack = NULL;
+
+ memset (&rpath, 0, sizeof (rpath));
+
+ if (mp->mt_next_hop_proto_is_ip4)
+ {
+ rpath.frp_proto = FIB_PROTOCOL_IP4;
+ clib_memcpy (&rpath.frp_addr.ip4,
+ mp->mt_next_hop, sizeof (rpath.frp_addr.ip4));
+ }
+ else
+ {
+ rpath.frp_proto = FIB_PROTOCOL_IP6;
+ clib_memcpy (&rpath.frp_addr.ip6,
+ mp->mt_next_hop, sizeof (rpath.frp_addr.ip6));
+ }
+ rpath.frp_sw_if_index = ntohl (mp->mt_next_hop_sw_if_index);
+
+ for (ii = 0; ii < mp->mt_next_hop_n_out_labels; ii++)
+ vec_add1 (label_stack, ntohl (mp->mt_next_hop_out_label_stack[ii]));
+
+ vec_add1 (rpaths, rpath);
+
+ vnet_mpls_tunnel_add (rpaths, label_stack,
+ mp->mt_l2_only, &tunnel_sw_if_index);
+ vec_free (rpaths);
+ vec_free (label_stack);
+ }
+ else
+ {
+ tunnel_sw_if_index = ntohl (mp->mt_sw_if_index);
+ vnet_mpls_tunnel_del (tunnel_sw_if_index);
+ }
+
+ stats_dsunlock ();
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2(VL_API_MPLS_TUNNEL_ADD_DEL_REPLY,
+ ({
+ rmp->sw_if_index = ntohl(tunnel_sw_if_index);
+ }));
+ /* *INDENT-ON* */
+}
+
+static void
+vl_api_mpls_tunnel_details_t_handler (vl_api_mpls_tunnel_details_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+typedef struct mpls_tunnel_send_walk_ctx_t_
+{
+ unix_shared_memory_queue_t *q;
+ u32 index;
+ u32 context;
+} mpls_tunnel_send_walk_ctx_t;
+
+static void
+send_mpls_tunnel_entry (u32 mti, void *arg)
+{
+ mpls_tunnel_send_walk_ctx_t *ctx;
+ vl_api_mpls_tunnel_details_t *mp;
+ const mpls_tunnel_t *mt;
+ u32 nlabels;
+
+ ctx = arg;
+
+ if (~0 != ctx->index && mti != ctx->index)
+ return;
+
+ mt = mpls_tunnel_get (mti);
+ nlabels = vec_len (mt->mt_label_stack);
+
+ mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32));
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = ntohs (VL_API_MPLS_TUNNEL_DETAILS);
+ mp->context = ctx->context;
+
+ mp->tunnel_index = ntohl (mti);
+ memcpy (mp->mt_next_hop_out_labels,
+ mt->mt_label_stack, nlabels * sizeof (u32));
+
+ // FIXME
+
+ vl_msg_api_send_shmem (ctx->q, (u8 *) & mp);
+}
+
+static void
+vl_api_mpls_tunnel_dump_t_handler (vl_api_mpls_tunnel_dump_t * mp)
+{
+ unix_shared_memory_queue_t *q;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ return;
+
+ mpls_tunnel_send_walk_ctx_t ctx = {
+ .q = q,
+ .index = ntohl (mp->tunnel_index),
+ .context = mp->context,
+ };
+ mpls_tunnel_walk (send_mpls_tunnel_entry, &ctx);
+}
+
+static void
+vl_api_mpls_fib_details_t_handler (vl_api_mpls_fib_details_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+static void
+vl_api_mpls_fib_details_t_endian (vl_api_mpls_fib_details_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+static void
+vl_api_mpls_fib_details_t_print (vl_api_mpls_fib_details_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+static void
+send_mpls_fib_details (vpe_api_main_t * am,
+ unix_shared_memory_queue_t * q,
+ u32 table_id, u32 label, u32 eos,
+ fib_route_path_encode_t * api_rpaths, u32 context)
+{
+ vl_api_mpls_fib_details_t *mp;
+ fib_route_path_encode_t *api_rpath;
+ vl_api_fib_path2_t *fp;
+ int path_count;
+
+ path_count = vec_len (api_rpaths);
+ mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
+ if (!mp)
+ return;
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_DETAILS);
+ mp->context = context;
+
+ mp->table_id = htonl (table_id);
+ mp->eos_bit = eos;
+ mp->label = htonl (label);
+
+ mp->count = htonl (path_count);
+ fp = mp->path;
+ vec_foreach (api_rpath, api_rpaths)
+ {
+ memset (fp, 0, sizeof (*fp));
+ fp->weight = htonl (api_rpath->rpath.frp_weight);
+ fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
+ copy_fib_next_hop (api_rpath, fp);
+ fp++;
+ }
+
+ vl_msg_api_send_shmem (q, (u8 *) & mp);
+}
+
+static void
+vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp)
+{
+ vpe_api_main_t *am = &vpe_api_main;
+ unix_shared_memory_queue_t *q;
+ mpls_main_t *mm = &mpls_main;
+ fib_table_t *fib_table;
+ fib_node_index_t lfei, *lfeip, *lfeis = NULL;
+ mpls_label_t key;
+ fib_prefix_t pfx;
+ u32 fib_index;
+ fib_route_path_encode_t *api_rpaths;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ return;
+
+ /* *INDENT-OFF* */
+ pool_foreach (fib_table, mm->fibs,
+ ({
+ hash_foreach(key, lfei, fib_table->mpls.mf_entries,
+ ({
+ vec_add1(lfeis, lfei);
+ }));
+ }));
+ /* *INDENT-ON* */
+ vec_sort_with_function (lfeis, fib_entry_cmp_for_sort);
+
+ vec_foreach (lfeip, lfeis)
+ {
+ fib_entry_get_prefix (*lfeip, &pfx);
+ fib_index = fib_entry_get_fib_index (*lfeip);
+ fib_table = fib_table_get (fib_index, pfx.fp_proto);
+ api_rpaths = NULL;
+ fib_entry_encode (*lfeip, &api_rpaths);
+ send_mpls_fib_details (am, q,
+ fib_table->ft_table_id,
+ pfx.fp_label, pfx.fp_eos, api_rpaths, mp->context);
+ vec_free (api_rpaths);
+ }
+
+ vec_free (lfeis);
+}
+
+/*
+ * mpls_api_hookup
+ * Add vpe's API message handlers to the table.
+ * vlib has alread mapped shared memory and
+ * added the client registration handlers.
+ * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
+ */
+#define vl_msg_name_crc_list
+#include <vnet/vnet_all_api_h.h>
+#undef vl_msg_name_crc_list
+
+static void
+setup_message_id_table (api_main_t * am)
+{
+#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
+ foreach_vl_msg_name_crc_mpls;
+#undef _
+}
+
+static clib_error_t *
+mpls_api_hookup (vlib_main_t * vm)
+{
+ api_main_t *am = &api_main;
+
+#define _(N,n) \
+ vl_msg_api_set_handlers(VL_API_##N, #n, \
+ vl_api_##n##_t_handler, \
+ vl_noop_handler, \
+ vl_api_##n##_t_endian, \
+ vl_api_##n##_t_print, \
+ sizeof(vl_api_##n##_t), 1);
+ foreach_vpe_api_msg;
+#undef _
+
+ /*
+ * Trace space for 8 MPLS encap labels
+ */
+ am->api_trace_cfg[VL_API_MPLS_TUNNEL_ADD_DEL].size += 8 * sizeof (u32);
+
+ /*
+ * Set up the (msg_name, crc, message-id) table
+ */
+ setup_message_id_table (am);
+
+ return 0;
+}
+
+VLIB_API_INIT_FUNCTION (mpls_api_hookup);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/sr/sr.api b/src/vnet/sr/sr.api
new file mode 100644
index 00000000000..3d017ce58b6
--- /dev/null
+++ b/src/vnet/sr/sr.api
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2015-2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** \brief IPv6 segment routing tunnel add / del request
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param is_add - add the tunnel if non-zero, else delete it
+ @param name[] - tunnel name (len. 64)
+ @param src_address[] -
+ @param dst_address[] -
+ @param dst_mask_width -
+ @param inner_vrf_id -
+ @param outer_vrf_id -
+ @param flags_net_byte_order -
+ @param n_segments -
+ @param n_tags -
+ @param segs_and_tags[] -
+ @param policy_name[] - name of policy to associate this tunnel to (len. 64)
+*/
+define sr_tunnel_add_del
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u8 name[64];
+ u8 src_address[16];
+ u8 dst_address[16];
+ u8 dst_mask_width;
+ u32 inner_vrf_id;
+ u32 outer_vrf_id;
+ u16 flags_net_byte_order;
+ u8 n_segments;
+ u8 n_tags;
+ u8 policy_name[64];
+ u8 segs_and_tags[0];
+};
+
+/** \brief IPv6 segment routing tunnel add / del response
+ @param context - sender context, to match reply w/ request
+ @param retval - return value for request
+*/
+define sr_tunnel_add_del_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief IPv6 segment routing policy add / del request
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param is_add - add the tunnel if non-zero, else delete it
+ @param name[] - policy name (len. 64)
+ @param tunnel_names[] -
+*/
+define sr_policy_add_del
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u8 name[64];
+ u8 tunnel_names[0];
+};
+
+/** \brief IPv6 segment routing policy add / del response
+ @param context - sender context, to match reply w/ request
+ @param retval - return value for request
+
+
+*/
+define sr_policy_add_del_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief IPv6 segment routing multicast map to policy add / del request
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param is_add - add the tunnel if non-zero, else delete it
+ @param multicast_address[] - IP6 multicast address
+ @param policy_name[] = policy name (len.64)
+*/
+define sr_multicast_map_add_del
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u8 multicast_address[16];
+ u8 policy_name[64];
+};
+
+/** \brief IPv6 segment routing multicast map to policy add / del response
+ @param context - sender context, to match reply w/ request
+ @param retval - return value for request
+*/
+define sr_multicast_map_add_del_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/*
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
+ \ No newline at end of file
diff --git a/src/vnet/sr/sr_api.c b/src/vnet/sr/sr_api.c
new file mode 100644
index 00000000000..6c6eb9b6449
--- /dev/null
+++ b/src/vnet/sr/sr_api.c
@@ -0,0 +1,279 @@
+/*
+ *------------------------------------------------------------------
+ * sr_api.c - ipv6 segment routing api
+ *
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#include <vnet/vnet.h>
+#include <vlibmemory/api.h>
+
+#include <vnet/interface.h>
+#include <vnet/api_errno.h>
+#include <vnet/feature/feature.h>
+
+#include <vnet/vnet_msg_enum.h>
+
+#define vl_typedefs /* define message structures */
+#include <vnet/vnet_all_api_h.h>
+#undef vl_typedefs
+
+#define vl_endianfun /* define message structures */
+#include <vnet/vnet_all_api_h.h>
+#undef vl_endianfun
+
+/* instantiate all the print functions we know about */
+#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
+#define vl_printfun
+#include <vnet/vnet_all_api_h.h>
+#undef vl_printfun
+
+#include <vlibapi/api_helper_macros.h>
+
+#define foreach_vpe_api_msg \
+_(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del)
+
+static void vl_api_sr_tunnel_add_del_t_handler
+ (vl_api_sr_tunnel_add_del_t * mp)
+{
+#if IP6SR == 0
+ clib_warning ("unimplemented");
+#else
+ ip6_sr_add_del_tunnel_args_t _a, *a = &_a;
+ int rv = 0;
+ vl_api_sr_tunnel_add_del_reply_t *rmp;
+ ip6_address_t *segments = 0, *seg;
+ ip6_address_t *tags = 0, *tag;
+ ip6_address_t *this_address;
+ int i;
+
+ if (mp->n_segments == 0)
+ {
+ rv = -11;
+ goto out;
+ }
+
+ memset (a, 0, sizeof (*a));
+ a->src_address = (ip6_address_t *) & mp->src_address;
+ a->dst_address = (ip6_address_t *) & mp->dst_address;
+ a->dst_mask_width = mp->dst_mask_width;
+ a->flags_net_byte_order = mp->flags_net_byte_order;
+ a->is_del = (mp->is_add == 0);
+ a->rx_table_id = ntohl (mp->outer_vrf_id);
+ a->tx_table_id = ntohl (mp->inner_vrf_id);
+
+ a->name = format (0, "%s", mp->name);
+ if (!(vec_len (a->name)))
+ a->name = 0;
+
+ a->policy_name = format (0, "%s", mp->policy_name);
+ if (!(vec_len (a->policy_name)))
+ a->policy_name = 0;
+
+ /* Yank segments and tags out of the API message */
+ this_address = (ip6_address_t *) mp->segs_and_tags;
+ for (i = 0; i < mp->n_segments; i++)
+ {
+ vec_add2 (segments, seg, 1);
+ clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
+ this_address++;
+ }
+ for (i = 0; i < mp->n_tags; i++)
+ {
+ vec_add2 (tags, tag, 1);
+ clib_memcpy (tag->as_u8, this_address->as_u8, sizeof (*this_address));
+ this_address++;
+ }
+
+ a->segments = segments;
+ a->tags = tags;
+
+ rv = ip6_sr_add_del_tunnel (a);
+
+out:
+
+ REPLY_MACRO (VL_API_SR_TUNNEL_ADD_DEL_REPLY);
+#endif
+}
+
+static void vl_api_sr_policy_add_del_t_handler
+ (vl_api_sr_policy_add_del_t * mp)
+{
+#if IP6SR == 0
+ clib_warning ("unimplemented");
+#else
+ ip6_sr_add_del_policy_args_t _a, *a = &_a;
+ int rv = 0;
+ vl_api_sr_policy_add_del_reply_t *rmp;
+ int i;
+
+ memset (a, 0, sizeof (*a));
+ a->is_del = (mp->is_add == 0);
+
+ a->name = format (0, "%s", mp->name);
+ if (!(vec_len (a->name)))
+ {
+ rv = VNET_API_ERROR_NO_SUCH_NODE2;
+ goto out;
+ }
+
+ if (!(mp->tunnel_names[0]))
+ {
+ rv = VNET_API_ERROR_NO_SUCH_NODE2;
+ goto out;
+ }
+
+ // start deserializing tunnel_names
+ int num_tunnels = mp->tunnel_names[0]; //number of tunnels
+ u8 *deser_tun_names = mp->tunnel_names;
+ deser_tun_names += 1; //moving along
+
+ u8 *tun_name = 0;
+ int tun_name_len = 0;
+
+ for (i = 0; i < num_tunnels; i++)
+ {
+ tun_name_len = *deser_tun_names;
+ deser_tun_names += 1;
+ vec_resize (tun_name, tun_name_len);
+ memcpy (tun_name, deser_tun_names, tun_name_len);
+ vec_add1 (a->tunnel_names, tun_name);
+ deser_tun_names += tun_name_len;
+ tun_name = 0;
+ }
+
+ rv = ip6_sr_add_del_policy (a);
+
+out:
+
+ REPLY_MACRO (VL_API_SR_POLICY_ADD_DEL_REPLY);
+#endif
+}
+
+static void vl_api_sr_multicast_map_add_del_t_handler
+ (vl_api_sr_multicast_map_add_del_t * mp)
+{
+#if IP6SR == 0
+ clib_warning ("unimplemented");
+#else
+ ip6_sr_add_del_multicastmap_args_t _a, *a = &_a;
+ int rv = 0;
+ vl_api_sr_multicast_map_add_del_reply_t *rmp;
+
+ memset (a, 0, sizeof (*a));
+ a->is_del = (mp->is_add == 0);
+
+ a->multicast_address = (ip6_address_t *) & mp->multicast_address;
+ a->policy_name = format (0, "%s", mp->policy_name);
+
+ if (a->multicast_address == 0)
+ {
+ rv = -1;
+ goto out;
+ }
+
+ if (!(a->policy_name))
+ {
+ rv = -2;
+ goto out;
+ }
+
+#if DPDK > 0 /* Cannot call replicate without DPDK */
+ rv = ip6_sr_add_del_multicastmap (a);
+#else
+ clib_warning ("multicast replication without DPDK not implemented");
+ rv = VNET_API_ERROR_UNIMPLEMENTED;
+#endif /* DPDK */
+
+out:
+
+ REPLY_MACRO (VL_API_SR_MULTICAST_MAP_ADD_DEL_REPLY);
+#endif
+}
+
+/*
+ * sr_api_hookup
+ * Add vpe's API message handlers to the table.
+ * vlib has alread mapped shared memory and
+ * added the client registration handlers.
+ * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
+ */
+#define vl_msg_name_crc_list
+#include <vnet/vnet_all_api_h.h>
+#undef vl_msg_name_crc_list
+
+static void
+setup_message_id_table (api_main_t * am)
+{
+#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
+ foreach_vl_msg_name_crc_sr;
+#undef _
+}
+
+static clib_error_t *
+sr_api_hookup (vlib_main_t * vm)
+{
+ api_main_t *am = &api_main;
+
+#define _(N,n) \
+ vl_msg_api_set_handlers(VL_API_##N, #n, \
+ vl_api_##n##_t_handler, \
+ vl_noop_handler, \
+ vl_api_##n##_t_endian, \
+ vl_api_##n##_t_print, \
+ sizeof(vl_api_##n##_t), 1);
+ foreach_vpe_api_msg;
+#undef _
+
+ /*
+ * Manually register the sr tunnel add del msg, so we trace
+ * enough bytes to capture a typical segment list
+ */
+ vl_msg_api_set_handlers (VL_API_SR_TUNNEL_ADD_DEL,
+ "sr_tunnel_add_del",
+ vl_api_sr_tunnel_add_del_t_handler,
+ vl_noop_handler,
+ vl_api_sr_tunnel_add_del_t_endian,
+ vl_api_sr_tunnel_add_del_t_print, 256, 1);
+
+
+ /*
+ * Manually register the sr policy add del msg, so we trace
+ * enough bytes to capture a typical tunnel name list
+ */
+ vl_msg_api_set_handlers (VL_API_SR_POLICY_ADD_DEL,
+ "sr_policy_add_del",
+ vl_api_sr_policy_add_del_t_handler,
+ vl_noop_handler,
+ vl_api_sr_policy_add_del_t_endian,
+ vl_api_sr_policy_add_del_t_print, 256, 1);
+
+ /*
+ * Set up the (msg_name, crc, message-id) table
+ */
+ setup_message_id_table (am);
+
+ return 0;
+}
+
+VLIB_API_INIT_FUNCTION (sr_api_hookup);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/vnet_all_api_h.h b/src/vnet/vnet_all_api_h.h
index d48e1540592..1024f92ce55 100644
--- a/src/vnet/vnet_all_api_h.h
+++ b/src/vnet/vnet_all_api_h.h
@@ -50,6 +50,8 @@
#include <vnet/ipsec-gre/ipsec_gre.api.h>
#include <vnet/lisp-cp/lisp.api.h>
#include <vnet/lisp-gpe/lisp_gpe.api.h>
+#include <vnet/mpls/mpls.api.h>
+#include <vnet/sr/sr.api.h>
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c
index 46e28e9dc25..3d6905dd655 100644
--- a/src/vpp/api/api.c
+++ b/src/vpp/api/api.c
@@ -52,8 +52,6 @@
#include <vnet/ip/ip.h>
#include <vnet/ip/ip6.h>
#include <vnet/ip/ip6_neighbor.h>
-#include <vnet/mpls/mpls.h>
-#include <vnet/mpls/mpls_tunnel.h>
#include <vnet/dhcp/proxy.h>
#include <vnet/dhcp/client.h>
#if IPV6SR > 0
@@ -119,24 +117,14 @@
#define foreach_vpe_api_msg \
_(WANT_OAM_EVENTS, want_oam_events) \
_(OAM_ADD_DEL, oam_add_del) \
-_(MPLS_ROUTE_ADD_DEL, mpls_route_add_del) \
-_(MPLS_IP_BIND_UNBIND, mpls_ip_bind_unbind) \
_(IS_ADDRESS_REACHABLE, is_address_reachable) \
_(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \
_(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) \
_(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass) \
_(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \
_(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \
-_(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \
-_(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \
-_(BRIDGE_DOMAIN_DETAILS, bridge_domain_details) \
-_(BRIDGE_DOMAIN_SW_IF_DETAILS, bridge_domain_sw_if_details) \
-_(L2FIB_ADD_DEL, l2fib_add_del) \
-_(L2_FLAGS, l2_flags) \
-_(BRIDGE_FLAGS, bridge_flags) \
_(CREATE_VLAN_SUBIF, create_vlan_subif) \
_(CREATE_SUBIF, create_subif) \
-_(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \
_(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \
_(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \
_(VNET_GET_SUMMARY_STATS, vnet_get_summary_stats) \
@@ -159,12 +147,9 @@ _(GET_NODE_INDEX, get_node_index) \
_(ADD_NODE_NEXT, add_node_next) \
_(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel) \
_(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump) \
-_(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \
_(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \
_(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \
_(SHOW_VERSION, show_version) \
-_(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
-_(L2_FIB_TABLE_ENTRY, l2_fib_table_entry) \
_(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel) \
_(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump) \
_(INTERFACE_NAME_RENUMBER, interface_name_renumber) \
@@ -178,15 +163,10 @@ _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \
_(GET_NODE_GRAPH, get_node_graph) \
_(IOAM_ENABLE, ioam_enable) \
_(IOAM_DISABLE, ioam_disable) \
-_(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del) \
_(POLICER_ADD_DEL, policer_add_del) \
_(POLICER_DUMP, policer_dump) \
_(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface) \
_(POLICER_CLASSIFY_DUMP, policer_classify_dump) \
-_(MPLS_TUNNEL_DUMP, mpls_tunnel_dump) \
-_(MPLS_TUNNEL_DETAILS, mpls_tunnel_details) \
-_(MPLS_FIB_DUMP, mpls_fib_dump) \
-_(MPLS_FIB_DETAILS, mpls_fib_details) \
_(CLASSIFY_TABLE_IDS,classify_table_ids) \
_(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface) \
_(CLASSIFY_TABLE_INFO,classify_table_info) \
@@ -411,173 +391,6 @@ VLIB_REGISTER_NODE (vpe_resolver_process_node,static) = {
};
/* *INDENT-ON* */
-static int
-mpls_route_add_del_t_handler (vnet_main_t * vnm,
- vl_api_mpls_route_add_del_t * mp)
-{
- u32 fib_index, next_hop_fib_index;
- mpls_label_t *label_stack = NULL;
- int rv, ii, n_labels;;
-
- fib_prefix_t pfx = {
- .fp_len = 21,
- .fp_proto = FIB_PROTOCOL_MPLS,
- .fp_eos = mp->mr_eos,
- .fp_label = ntohl (mp->mr_label),
- };
- if (pfx.fp_eos)
- {
- if (mp->mr_next_hop_proto_is_ip4)
- {
- pfx.fp_payload_proto = DPO_PROTO_IP4;
- }
- else
- {
- pfx.fp_payload_proto = DPO_PROTO_IP6;
- }
- }
- else
- {
- pfx.fp_payload_proto = DPO_PROTO_MPLS;
- }
-
- rv = add_del_route_check (FIB_PROTOCOL_MPLS,
- mp->mr_table_id,
- mp->mr_next_hop_sw_if_index,
- dpo_proto_to_fib (pfx.fp_payload_proto),
- mp->mr_next_hop_table_id,
- mp->mr_create_table_if_needed,
- &fib_index, &next_hop_fib_index);
-
- if (0 != rv)
- return (rv);
-
- ip46_address_t nh;
- memset (&nh, 0, sizeof (nh));
-
- if (mp->mr_next_hop_proto_is_ip4)
- memcpy (&nh.ip4, mp->mr_next_hop, sizeof (nh.ip4));
- else
- memcpy (&nh.ip6, mp->mr_next_hop, sizeof (nh.ip6));
-
- n_labels = mp->mr_next_hop_n_out_labels;
- if (n_labels == 0)
- ;
- else if (1 == n_labels)
- vec_add1 (label_stack, ntohl (mp->mr_next_hop_out_label_stack[0]));
- else
- {
- vec_validate (label_stack, n_labels - 1);
- for (ii = 0; ii < n_labels; ii++)
- label_stack[ii] = ntohl (mp->mr_next_hop_out_label_stack[ii]);
- }
-
- return (add_del_route_t_handler (mp->mr_is_multipath, mp->mr_is_add, 0, // mp->is_drop,
- 0, // mp->is_unreach,
- 0, // mp->is_prohibit,
- 0, // mp->is_local,
- mp->mr_is_classify,
- mp->mr_classify_table_index,
- mp->mr_is_resolve_host,
- mp->mr_is_resolve_attached,
- fib_index, &pfx,
- mp->mr_next_hop_proto_is_ip4,
- &nh, ntohl (mp->mr_next_hop_sw_if_index),
- next_hop_fib_index,
- mp->mr_next_hop_weight,
- ntohl (mp->mr_next_hop_via_label),
- label_stack));
-}
-
-void
-vl_api_mpls_route_add_del_t_handler (vl_api_mpls_route_add_del_t * mp)
-{
- vl_api_mpls_route_add_del_reply_t *rmp;
- vnet_main_t *vnm;
- int rv;
-
- vnm = vnet_get_main ();
- vnm->api_errno = 0;
-
- rv = mpls_route_add_del_t_handler (vnm, mp);
-
- rv = (rv == 0) ? vnm->api_errno : rv;
-
- REPLY_MACRO (VL_API_MPLS_ROUTE_ADD_DEL_REPLY);
-}
-
-static int
-mpls_ip_bind_unbind_handler (vnet_main_t * vnm,
- vl_api_mpls_ip_bind_unbind_t * mp)
-{
- u32 mpls_fib_index, ip_fib_index;
-
- mpls_fib_index =
- fib_table_find (FIB_PROTOCOL_MPLS, ntohl (mp->mb_mpls_table_id));
-
- if (~0 == mpls_fib_index)
- {
- if (mp->mb_create_table_if_needed)
- {
- mpls_fib_index =
- fib_table_find_or_create_and_lock (FIB_PROTOCOL_MPLS,
- ntohl (mp->mb_mpls_table_id));
- }
- else
- return VNET_API_ERROR_NO_SUCH_FIB;
- }
-
- ip_fib_index = fib_table_find ((mp->mb_is_ip4 ?
- FIB_PROTOCOL_IP4 :
- FIB_PROTOCOL_IP6),
- ntohl (mp->mb_ip_table_id));
- if (~0 == ip_fib_index)
- return VNET_API_ERROR_NO_SUCH_FIB;
-
- fib_prefix_t pfx = {
- .fp_len = mp->mb_address_length,
- };
-
- if (mp->mb_is_ip4)
- {
- pfx.fp_proto = FIB_PROTOCOL_IP4;
- clib_memcpy (&pfx.fp_addr.ip4, mp->mb_address,
- sizeof (pfx.fp_addr.ip4));
- }
- else
- {
- pfx.fp_proto = FIB_PROTOCOL_IP6;
- clib_memcpy (&pfx.fp_addr.ip6, mp->mb_address,
- sizeof (pfx.fp_addr.ip6));
- }
-
- if (mp->mb_is_bind)
- fib_table_entry_local_label_add (ip_fib_index, &pfx,
- ntohl (mp->mb_label));
- else
- fib_table_entry_local_label_remove (ip_fib_index, &pfx,
- ntohl (mp->mb_label));
-
- return (0);
-}
-
-void
-vl_api_mpls_ip_bind_unbind_t_handler (vl_api_mpls_ip_bind_unbind_t * mp)
-{
- vl_api_mpls_route_add_del_reply_t *rmp;
- vnet_main_t *vnm;
- int rv;
-
- vnm = vnet_get_main ();
- vnm->api_errno = 0;
-
- rv = mpls_ip_bind_unbind_handler (vnm, mp);
-
- rv = (rv == 0) ? vnm->api_errno : rv;
-
- REPLY_MACRO (VL_API_MPLS_ROUTE_ADD_DEL_REPLY);
-}
-
static void
vl_api_sw_interface_set_vpath_t_handler (vl_api_sw_interface_set_vpath_t * mp)
{
@@ -691,278 +504,6 @@ static void
}
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 ();
- bd_main_t *bdm = &bd_main;
- vl_api_bridge_domain_add_del_reply_t *rmp;
- int rv = 0;
- u32 enable_flags = 0, disable_flags = 0;
- u32 bd_id = ntohl (mp->bd_id);
- u32 bd_index;
-
- if (mp->is_add)
- {
- bd_index = bd_find_or_add_bd_index (bdm, bd_id);
-
- if (mp->flood)
- enable_flags |= L2_FLOOD;
- else
- disable_flags |= L2_FLOOD;
-
- if (mp->uu_flood)
- enable_flags |= L2_UU_FLOOD;
- else
- disable_flags |= L2_UU_FLOOD;
-
- if (mp->forward)
- enable_flags |= L2_FWD;
- else
- disable_flags |= L2_FWD;
-
- if (mp->arp_term)
- enable_flags |= L2_ARP_TERM;
- else
- disable_flags |= L2_ARP_TERM;
-
- if (mp->learn)
- enable_flags |= L2_LEARN;
- else
- disable_flags |= L2_LEARN;
-
- if (enable_flags)
- bd_set_flags (vm, bd_index, enable_flags, 1 /* enable */ );
-
- if (disable_flags)
- bd_set_flags (vm, bd_index, disable_flags, 0 /* disable */ );
-
- bd_set_mac_age (vm, bd_index, mp->mac_age);
- }
- else
- rv = bd_delete_bd_index (bdm, bd_id);
-
- REPLY_MACRO (VL_API_BRIDGE_DOMAIN_ADD_DEL_REPLY);
-}
-
-static void
-vl_api_bridge_domain_details_t_handler (vl_api_bridge_domain_details_t * mp)
-{
- clib_warning ("BUG");
-}
-
-static void
- vl_api_bridge_domain_sw_if_details_t_handler
- (vl_api_bridge_domain_sw_if_details_t * mp)
-{
- clib_warning ("BUG");
-}
-
-static void
-send_bridge_domain_details (unix_shared_memory_queue_t * q,
- l2_bridge_domain_t * bd_config,
- u32 n_sw_ifs, u32 context)
-{
- vl_api_bridge_domain_details_t *mp;
-
- mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_DETAILS);
- mp->bd_id = ntohl (bd_config->bd_id);
- mp->flood = bd_feature_flood (bd_config);
- mp->uu_flood = bd_feature_uu_flood (bd_config);
- mp->forward = bd_feature_forward (bd_config);
- mp->learn = bd_feature_learn (bd_config);
- mp->arp_term = bd_feature_arp_term (bd_config);
- mp->bvi_sw_if_index = ntohl (bd_config->bvi_sw_if_index);
- mp->mac_age = bd_config->mac_age;
- mp->n_sw_ifs = ntohl (n_sw_ifs);
- mp->context = context;
-
- vl_msg_api_send_shmem (q, (u8 *) & mp);
-}
-
-static void
-send_bd_sw_if_details (l2input_main_t * l2im,
- unix_shared_memory_queue_t * q,
- l2_flood_member_t * member, u32 bd_id, u32 context)
-{
- vl_api_bridge_domain_sw_if_details_t *mp;
- l2_input_config_t *input_cfg;
-
- mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_SW_IF_DETAILS);
- mp->bd_id = ntohl (bd_id);
- mp->sw_if_index = ntohl (member->sw_if_index);
- input_cfg = vec_elt_at_index (l2im->configs, member->sw_if_index);
- mp->shg = input_cfg->shg;
- mp->context = context;
-
- vl_msg_api_send_shmem (q, (u8 *) & mp);
-}
-
-static void
-vl_api_bridge_domain_dump_t_handler (vl_api_bridge_domain_dump_t * mp)
-{
- bd_main_t *bdm = &bd_main;
- l2input_main_t *l2im = &l2input_main;
- unix_shared_memory_queue_t *q;
- l2_bridge_domain_t *bd_config;
- u32 bd_id, bd_index;
- u32 end;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
-
- if (q == 0)
- return;
-
- bd_id = ntohl (mp->bd_id);
-
- bd_index = (bd_id == ~0) ? 0 : bd_find_or_add_bd_index (bdm, bd_id);
- end = (bd_id == ~0) ? vec_len (l2im->bd_configs) : bd_index + 1;
- for (; bd_index < end; bd_index++)
- {
- bd_config = l2input_bd_config_from_index (l2im, bd_index);
- /* skip dummy bd_id 0 */
- if (bd_config && (bd_config->bd_id > 0))
- {
- u32 n_sw_ifs;
- l2_flood_member_t *m;
-
- n_sw_ifs = vec_len (bd_config->members);
- send_bridge_domain_details (q, bd_config, n_sw_ifs, mp->context);
-
- vec_foreach (m, bd_config->members)
- {
- send_bd_sw_if_details (l2im, q, m, bd_config->bd_id, mp->context);
- }
- }
- }
-}
-
-static void
-vl_api_l2fib_add_del_t_handler (vl_api_l2fib_add_del_t * mp)
-{
- bd_main_t *bdm = &bd_main;
- l2input_main_t *l2im = &l2input_main;
- vl_api_l2fib_add_del_reply_t *rmp;
- int rv = 0;
- u64 mac = 0;
- u32 sw_if_index = ntohl (mp->sw_if_index);
- u32 bd_id = ntohl (mp->bd_id);
- u32 bd_index;
- u32 static_mac;
- u32 filter_mac;
- u32 bvi_mac;
- uword *p;
-
- mac = mp->mac;
-
- p = hash_get (bdm->bd_index_by_bd_id, bd_id);
- if (!p)
- {
- rv = VNET_API_ERROR_NO_SUCH_ENTRY;
- goto bad_sw_if_index;
- }
- bd_index = p[0];
-
- if (mp->is_add)
- {
- filter_mac = mp->filter_mac ? 1 : 0;
- if (filter_mac == 0)
- {
- VALIDATE_SW_IF_INDEX (mp);
- if (vec_len (l2im->configs) <= sw_if_index)
- {
- rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
- goto bad_sw_if_index;
- }
- else
- {
- l2_input_config_t *config;
- config = vec_elt_at_index (l2im->configs, sw_if_index);
- if (config->bridge == 0)
- {
- rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
- goto bad_sw_if_index;
- }
- }
- }
- static_mac = mp->static_mac ? 1 : 0;
- bvi_mac = mp->bvi_mac ? 1 : 0;
- l2fib_add_entry (mac, bd_index, sw_if_index, static_mac, filter_mac,
- bvi_mac);
- }
- else
- {
- l2fib_del_entry (mac, bd_index);
- }
-
- BAD_SW_IF_INDEX_LABEL;
-
- REPLY_MACRO (VL_API_L2FIB_ADD_DEL_REPLY);
-}
-
-static void
-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 _
-
- BAD_SW_IF_INDEX_LABEL;
-
- /* *INDENT-OFF* */
- REPLY_MACRO2(VL_API_L2_FLAGS_REPLY,
- ({
- rmp->resulting_feature_bitmap = ntohl(rbm);
- }));
- /* *INDENT-ON* */
-}
-
-static void
-vl_api_bridge_flags_t_handler (vl_api_bridge_flags_t * mp)
-{
- vlib_main_t *vm = vlib_get_main ();
- bd_main_t *bdm = &bd_main;
- vl_api_bridge_flags_reply_t *rmp;
- int rv = 0;
- u32 bd_id = ntohl (mp->bd_id);
- u32 bd_index;
- u32 flags = ntohl (mp->feature_bitmap);
- uword *p;
-
- p = hash_get (bdm->bd_index_by_bd_id, bd_id);
- if (p == 0)
- {
- rv = VNET_API_ERROR_NO_SUCH_ENTRY;
- goto out;
- }
-
- bd_index = p[0];
-
- bd_set_flags (vm, bd_index, flags, mp->is_set);
-
-out:
- /* *INDENT-OFF* */
- REPLY_MACRO2(VL_API_BRIDGE_FLAGS_REPLY,
- ({
- rmp->resulting_feature_bitmap = ntohl(flags);
- }));
- /* *INDENT-ON* */
-}
-
-static void
vl_api_bd_ip_mac_add_del_t_handler (vl_api_bd_ip_mac_add_del_t * mp)
{
bd_main_t *bdm = &bd_main;
@@ -1148,64 +689,6 @@ out:
}
static void
-vl_api_mpls_tunnel_add_del_t_handler (vl_api_mpls_tunnel_add_del_t * mp)
-{
- vl_api_mpls_tunnel_add_del_reply_t *rmp;
- int rv = 0;
- stats_main_t *sm = &stats_main;
- u32 tunnel_sw_if_index;
- int ii;
-
- dslock (sm, 1 /* release hint */ , 5 /* tag */ );
-
- if (mp->mt_is_add)
- {
- fib_route_path_t rpath, *rpaths = NULL;
- mpls_label_t *label_stack = NULL;
-
- memset (&rpath, 0, sizeof (rpath));
-
- if (mp->mt_next_hop_proto_is_ip4)
- {
- rpath.frp_proto = FIB_PROTOCOL_IP4;
- clib_memcpy (&rpath.frp_addr.ip4,
- mp->mt_next_hop, sizeof (rpath.frp_addr.ip4));
- }
- else
- {
- rpath.frp_proto = FIB_PROTOCOL_IP6;
- clib_memcpy (&rpath.frp_addr.ip6,
- mp->mt_next_hop, sizeof (rpath.frp_addr.ip6));
- }
- rpath.frp_sw_if_index = ntohl (mp->mt_next_hop_sw_if_index);
-
- for (ii = 0; ii < mp->mt_next_hop_n_out_labels; ii++)
- vec_add1 (label_stack, ntohl (mp->mt_next_hop_out_label_stack[ii]));
-
- vec_add1 (rpaths, rpath);
-
- vnet_mpls_tunnel_add (rpaths, label_stack,
- mp->mt_l2_only, &tunnel_sw_if_index);
- vec_free (rpaths);
- vec_free (label_stack);
- }
- else
- {
- tunnel_sw_if_index = ntohl (mp->mt_sw_if_index);
- vnet_mpls_tunnel_del (tunnel_sw_if_index);
- }
-
- dsunlock (sm);
-
- /* *INDENT-OFF* */
- REPLY_MACRO2(VL_API_MPLS_TUNNEL_ADD_DEL_REPLY,
- ({
- rmp->sw_if_index = ntohl(tunnel_sw_if_index);
- }));
- /* *INDENT-ON* */
-}
-
-static void
vl_api_proxy_arp_add_del_t_handler (vl_api_proxy_arp_add_del_t * mp)
{
vl_api_proxy_arp_add_del_reply_t *rmp;
@@ -1929,164 +1412,6 @@ vl_api_set_arp_neighbor_limit_t_handler (vl_api_set_arp_neighbor_limit_t * mp)
REPLY_MACRO (VL_API_SET_ARP_NEIGHBOR_LIMIT_REPLY);
}
-static void vl_api_sr_tunnel_add_del_t_handler
- (vl_api_sr_tunnel_add_del_t * mp)
-{
-#if IP6SR == 0
- clib_warning ("unimplemented");
-#else
- ip6_sr_add_del_tunnel_args_t _a, *a = &_a;
- int rv = 0;
- vl_api_sr_tunnel_add_del_reply_t *rmp;
- ip6_address_t *segments = 0, *seg;
- ip6_address_t *tags = 0, *tag;
- ip6_address_t *this_address;
- int i;
-
- if (mp->n_segments == 0)
- {
- rv = -11;
- goto out;
- }
-
- memset (a, 0, sizeof (*a));
- a->src_address = (ip6_address_t *) & mp->src_address;
- a->dst_address = (ip6_address_t *) & mp->dst_address;
- a->dst_mask_width = mp->dst_mask_width;
- a->flags_net_byte_order = mp->flags_net_byte_order;
- a->is_del = (mp->is_add == 0);
- a->rx_table_id = ntohl (mp->outer_vrf_id);
- a->tx_table_id = ntohl (mp->inner_vrf_id);
-
- a->name = format (0, "%s", mp->name);
- if (!(vec_len (a->name)))
- a->name = 0;
-
- a->policy_name = format (0, "%s", mp->policy_name);
- if (!(vec_len (a->policy_name)))
- a->policy_name = 0;
-
- /* Yank segments and tags out of the API message */
- this_address = (ip6_address_t *) mp->segs_and_tags;
- for (i = 0; i < mp->n_segments; i++)
- {
- vec_add2 (segments, seg, 1);
- clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
- this_address++;
- }
- for (i = 0; i < mp->n_tags; i++)
- {
- vec_add2 (tags, tag, 1);
- clib_memcpy (tag->as_u8, this_address->as_u8, sizeof (*this_address));
- this_address++;
- }
-
- a->segments = segments;
- a->tags = tags;
-
- rv = ip6_sr_add_del_tunnel (a);
-
-out:
-
- REPLY_MACRO (VL_API_SR_TUNNEL_ADD_DEL_REPLY);
-#endif
-}
-
-static void vl_api_sr_policy_add_del_t_handler
- (vl_api_sr_policy_add_del_t * mp)
-{
-#if IP6SR == 0
- clib_warning ("unimplemented");
-#else
- ip6_sr_add_del_policy_args_t _a, *a = &_a;
- int rv = 0;
- vl_api_sr_policy_add_del_reply_t *rmp;
- int i;
-
- memset (a, 0, sizeof (*a));
- a->is_del = (mp->is_add == 0);
-
- a->name = format (0, "%s", mp->name);
- if (!(vec_len (a->name)))
- {
- rv = VNET_API_ERROR_NO_SUCH_NODE2;
- goto out;
- }
-
- if (!(mp->tunnel_names[0]))
- {
- rv = VNET_API_ERROR_NO_SUCH_NODE2;
- goto out;
- }
-
- // start deserializing tunnel_names
- int num_tunnels = mp->tunnel_names[0]; //number of tunnels
- u8 *deser_tun_names = mp->tunnel_names;
- deser_tun_names += 1; //moving along
-
- u8 *tun_name = 0;
- int tun_name_len = 0;
-
- for (i = 0; i < num_tunnels; i++)
- {
- tun_name_len = *deser_tun_names;
- deser_tun_names += 1;
- vec_resize (tun_name, tun_name_len);
- memcpy (tun_name, deser_tun_names, tun_name_len);
- vec_add1 (a->tunnel_names, tun_name);
- deser_tun_names += tun_name_len;
- tun_name = 0;
- }
-
- rv = ip6_sr_add_del_policy (a);
-
-out:
-
- REPLY_MACRO (VL_API_SR_POLICY_ADD_DEL_REPLY);
-#endif
-}
-
-static void vl_api_sr_multicast_map_add_del_t_handler
- (vl_api_sr_multicast_map_add_del_t * mp)
-{
-#if IP6SR == 0
- clib_warning ("unimplemented");
-#else
- ip6_sr_add_del_multicastmap_args_t _a, *a = &_a;
- int rv = 0;
- vl_api_sr_multicast_map_add_del_reply_t *rmp;
-
- memset (a, 0, sizeof (*a));
- a->is_del = (mp->is_add == 0);
-
- a->multicast_address = (ip6_address_t *) & mp->multicast_address;
- a->policy_name = format (0, "%s", mp->policy_name);
-
- if (a->multicast_address == 0)
- {
- rv = -1;
- goto out;
- }
-
- if (!(a->policy_name))
- {
- rv = -2;
- goto out;
- }
-
-#if DPDK > 0 /* Cannot call replicate without DPDK */
- rv = ip6_sr_add_del_multicastmap (a);
-#else
- clib_warning ("multicast replication without DPDK not implemented");
- rv = VNET_API_ERROR_UNIMPLEMENTED;
-#endif /* DPDK */
-
-out:
-
- REPLY_MACRO (VL_API_SR_MULTICAST_MAP_ADD_DEL_REPLY);
-#endif
-}
-
#define foreach_classify_add_del_table_field \
_(table_index) \
_(nbuckets) \
@@ -2246,21 +1571,6 @@ static void vl_api_classify_set_interface_l2_tables_t_handler
REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_L2_TABLES_REPLY);
}
-static void
-vl_api_l2_fib_clear_table_t_handler (vl_api_l2_fib_clear_table_t * mp)
-{
- int rv = 0;
- vl_api_l2_fib_clear_table_reply_t *rmp;
-
- /* DAW-FIXME: This API should only clear non-static l2fib entries, but
- * that is not currently implemented. When that TODO is fixed
- * this call should be changed to pass 1 instead of 0.
- */
- l2fib_clear_table (0);
-
- REPLY_MACRO (VL_API_L2_FIB_CLEAR_TABLE_REPLY);
-}
-
extern void l2_efp_filter_configure (vnet_main_t * vnet_main,
u32 sw_if_index, u32 enable);
@@ -2322,76 +1632,6 @@ static void
}
static void
-vl_api_l2_fib_table_entry_t_handler (vl_api_l2_fib_table_entry_t * mp)
-{
- clib_warning ("BUG");
-}
-
-static void
-send_l2fib_table_entry (vpe_api_main_t * am,
- unix_shared_memory_queue_t * q,
- l2fib_entry_key_t * l2fe_key,
- l2fib_entry_result_t * l2fe_res, u32 context)
-{
- vl_api_l2_fib_table_entry_t *mp;
-
- mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_L2_FIB_TABLE_ENTRY);
-
- mp->bd_id =
- ntohl (l2input_main.bd_configs[l2fe_key->fields.bd_index].bd_id);
-
- mp->mac = l2fib_make_key (l2fe_key->fields.mac, 0);
- mp->sw_if_index = ntohl (l2fe_res->fields.sw_if_index);
- mp->static_mac = l2fe_res->fields.static_mac;
- mp->filter_mac = l2fe_res->fields.filter;
- mp->bvi_mac = l2fe_res->fields.bvi;
- mp->context = context;
-
- vl_msg_api_send_shmem (q, (u8 *) & mp);
-}
-
-static void
-vl_api_l2_fib_table_dump_t_handler (vl_api_l2_fib_table_dump_t * mp)
-{
- vpe_api_main_t *am = &vpe_api_main;
- bd_main_t *bdm = &bd_main;
- l2fib_entry_key_t *l2fe_key = NULL;
- l2fib_entry_result_t *l2fe_res = NULL;
- u32 ni, bd_id = ntohl (mp->bd_id);
- u32 bd_index;
- unix_shared_memory_queue_t *q;
- uword *p;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- return;
-
- /* see l2fib_table_dump: ~0 means "any" */
- if (bd_id == ~0)
- bd_index = ~0;
- else
- {
- p = hash_get (bdm->bd_index_by_bd_id, bd_id);
- if (p == 0)
- return;
-
- bd_index = p[0];
- }
-
- l2fib_table_dump (bd_index, &l2fe_key, &l2fe_res);
-
- vec_foreach_index (ni, l2fe_key)
- {
- send_l2fib_table_entry (am, q, vec_elt_at_index (l2fe_key, ni),
- vec_elt_at_index (l2fe_res, ni), mp->context);
- }
- vec_free (l2fe_key);
- vec_free (l2fe_res);
-}
-
-static void
vl_api_show_version_t_handler (vl_api_show_version_t * mp)
{
vl_api_show_version_reply_t *rmp;
@@ -3358,167 +2598,6 @@ vl_api_policer_classify_dump_t_handler (vl_api_policer_classify_dump_t * mp)
}
static void
-vl_api_mpls_tunnel_details_t_handler (vl_api_mpls_fib_details_t * mp)
-{
- clib_warning ("BUG");
-}
-
-typedef struct mpls_tunnel_send_walk_ctx_t_
-{
- unix_shared_memory_queue_t *q;
- u32 index;
- u32 context;
-} mpls_tunnel_send_walk_ctx_t;
-
-static void
-send_mpls_tunnel_entry (u32 mti, void *arg)
-{
- mpls_tunnel_send_walk_ctx_t *ctx;
- vl_api_mpls_tunnel_details_t *mp;
- const mpls_tunnel_t *mt;
- u32 nlabels;
-
- ctx = arg;
-
- if (~0 != ctx->index && mti != ctx->index)
- return;
-
- mt = mpls_tunnel_get (mti);
- nlabels = vec_len (mt->mt_label_stack);
-
- mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32));
- memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_MPLS_TUNNEL_DETAILS);
- mp->context = ctx->context;
-
- mp->tunnel_index = ntohl (mti);
- memcpy (mp->mt_next_hop_out_labels,
- mt->mt_label_stack, nlabels * sizeof (u32));
-
- // FIXME
-
- vl_msg_api_send_shmem (ctx->q, (u8 *) & mp);
-}
-
-static void
-vl_api_mpls_tunnel_dump_t_handler (vl_api_mpls_tunnel_dump_t * mp)
-{
- unix_shared_memory_queue_t *q;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- return;
-
- mpls_tunnel_send_walk_ctx_t ctx = {
- .q = q,
- .index = ntohl (mp->tunnel_index),
- .context = mp->context,
- };
- mpls_tunnel_walk (send_mpls_tunnel_entry, &ctx);
-}
-
-static void
-vl_api_mpls_fib_details_t_handler (vl_api_mpls_fib_details_t * mp)
-{
- clib_warning ("BUG");
-}
-
-static void
-vl_api_mpls_fib_details_t_endian (vl_api_mpls_fib_details_t * mp)
-{
- clib_warning ("BUG");
-}
-
-static void
-vl_api_mpls_fib_details_t_print (vl_api_mpls_fib_details_t * mp)
-{
- clib_warning ("BUG");
-}
-
-static void
-send_mpls_fib_details (vpe_api_main_t * am,
- unix_shared_memory_queue_t * q,
- u32 table_id, u32 label, u32 eos,
- fib_route_path_encode_t * api_rpaths, u32 context)
-{
- vl_api_mpls_fib_details_t *mp;
- fib_route_path_encode_t *api_rpath;
- vl_api_fib_path2_t *fp;
- int path_count;
-
- path_count = vec_len (api_rpaths);
- mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
- if (!mp)
- return;
- memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_DETAILS);
- mp->context = context;
-
- mp->table_id = htonl (table_id);
- mp->eos_bit = eos;
- mp->label = htonl (label);
-
- mp->count = htonl (path_count);
- fp = mp->path;
- vec_foreach (api_rpath, api_rpaths)
- {
- memset (fp, 0, sizeof (*fp));
- fp->weight = htonl (api_rpath->rpath.frp_weight);
- fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
- copy_fib_next_hop (api_rpath, fp);
- fp++;
- }
-
- vl_msg_api_send_shmem (q, (u8 *) & mp);
-}
-
-static void
-vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp)
-{
- vpe_api_main_t *am = &vpe_api_main;
- unix_shared_memory_queue_t *q;
- mpls_main_t *mm = &mpls_main;
- fib_table_t *fib_table;
- fib_node_index_t lfei, *lfeip, *lfeis = NULL;
- mpls_label_t key;
- fib_prefix_t pfx;
- u32 fib_index;
- fib_route_path_encode_t *api_rpaths;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- return;
-
- /* *INDENT-OFF* */
- pool_foreach (fib_table, mm->fibs,
- ({
- hash_foreach(key, lfei, fib_table->mpls.mf_entries,
- ({
- vec_add1(lfeis, lfei);
- }));
- }));
- vec_sort_with_function(lfeis, fib_entry_cmp_for_sort);
-
- vec_foreach(lfeip, lfeis)
- {
- fib_entry_get_prefix(*lfeip, &pfx);
- fib_index = fib_entry_get_fib_index(*lfeip);
- fib_table = fib_table_get(fib_index, pfx.fp_proto);
- api_rpaths = NULL;
- fib_entry_encode(*lfeip, &api_rpaths);
- send_mpls_fib_details (am, q,
- fib_table->ft_table_id,
- pfx.fp_label,
- pfx.fp_eos,
- api_rpaths,
- mp->context);
- vec_free(api_rpaths);
- }
-
- vec_free (lfeis);
-}
-
-static void
vl_api_classify_table_ids_t_handler (vl_api_classify_table_ids_t * mp)
{
unix_shared_memory_queue_t *q;
@@ -4487,32 +3566,8 @@ vpe_api_hookup (vlib_main_t * vm)
#undef _
/*
- * Manually register the sr tunnel add del msg, so we trace
- * enough bytes to capture a typical segment list
- */
- vl_msg_api_set_handlers (VL_API_SR_TUNNEL_ADD_DEL,
- "sr_tunnel_add_del",
- vl_api_sr_tunnel_add_del_t_handler,
- vl_noop_handler,
- vl_api_sr_tunnel_add_del_t_endian,
- vl_api_sr_tunnel_add_del_t_print, 256, 1);
-
-
- /*
- * Manually register the sr policy add del msg, so we trace
- * enough bytes to capture a typical tunnel name list
- */
- vl_msg_api_set_handlers (VL_API_SR_POLICY_ADD_DEL,
- "sr_policy_add_del",
- vl_api_sr_policy_add_del_t_handler,
- vl_noop_handler,
- vl_api_sr_policy_add_del_t_endian,
- vl_api_sr_policy_add_del_t_print, 256, 1);
-
- /*
- * Trace space for 8 MPLS encap labels, classifier mask+match
+ * Trace space for classifier mask+match
*/
- am->api_trace_cfg[VL_API_MPLS_TUNNEL_ADD_DEL].size += 8 * sizeof (u32);
am->api_trace_cfg[VL_API_CLASSIFY_ADD_DEL_TABLE].size += 5 * sizeof (u32x4);
am->api_trace_cfg[VL_API_CLASSIFY_ADD_DEL_SESSION].size
+= 5 * sizeof (u32x4);
diff --git a/src/vpp/api/vpe.api b/src/vpp/api/vpe.api
index 3e4bcdf9134..e784fa01f08 100644
--- a/src/vpp/api/vpe.api
+++ b/src/vpp/api/vpe.api
@@ -22,21 +22,24 @@
/*
* Note: API placement cleanup in progress
* If you're looking for interface APIs, please
- * see .../vnet/vnet/{interface.api,interface_api.c}
- * IP APIs: see .../vnet/vnet/ip/{ip.api, ip_api.c}
- * TAP APIs: see .../vnet/vnet/unix/{tap.api, tap_api.c}
- * VXLAN APIs: see .../vnet/vnet/vxlan/{vxlan.api, vxlan_api.c}
+ * see .../src/vnet/{interface.api,interface_api.c}
+ * IP APIs: see .../src/vnet/ip/{ip.api, ip_api.c}
+ * TAP APIs: see .../src/vnet/unix/{tap.api, tap_api.c}
+ * VXLAN APIs: see .../src/vnet/vxlan/{vxlan.api, vxlan_api.c}
* AF-PACKET APIs: ... see /vnet/devices/af_packet/{af_packet.api, af_packet_api.c}
- * NETMAP APIs: see ... /vnet/vnet/devices/netmap/{netmap.api, netmap_api.c}
+ * NETMAP APIs: see ... /src/vnet/devices/netmap/{netmap.api, netmap_api.c}
* VHOST-USER APIs: see .../vnet/devices/virtio/{vhost_user.api, vhost_user_api.c}
- * VXLAN GPE APIs: see .../vnet/vnet/vxlan-gpe/{vxlan_gpe.api, vxlan_gpe_api.c}
- * GRE APIs: see .../vnet/vnet/gre/{gre.api, gre_api.c}
- * L2TP APIs: see .../vnet/vnet/l2tp/{l2tp.api, l2tp_api.c}
- * BFD APIs: see .../vnet/vnet/bfd/{bfd.api, bfd_api.c}
- * IPSEC APIs: see .../vnet/vnet/ipsec/{ipsec.api, ipsec_api.c}
- * IPSEC-GRE APIs: see .../vnet/vnet/ipsec-gre/{ipsec_gre.api, ipsec_gre_api.c}
- * LISP APIs: see .../vnet/vnet/lisp/{lisp.api, lisp_api.c}
- * LISP-GPE APIs: see .../vnet/vnet/lisp-gpe/{lisp_gpe.api, lisp_gpe_api.c}
+ * VXLAN GPE APIs: see .../src/vnet/vxlan-gpe/{vxlan_gpe.api, vxlan_gpe_api.c}
+ * GRE APIs: see .../src/vnet/gre/{gre.api, gre_api.c}
+ * L2 APIs: see .../src/vnet/l2/{l2.api, l2_api.c}
+ * L2TP APIs: see .../src/vnet/l2tp/{l2tp.api, l2tp_api.c}
+ * BFD APIs: see .../src/vnet/bfd/{bfd.api, bfd_api.c}
+ * IPSEC APIs: see .../src/vnet/ipsec/{ipsec.api, ipsec_api.c}
+ * IPSEC-GRE APIs: see .../src/vnet/ipsec-gre/{ipsec_gre.api, ipsec_gre_api.c}
+ * LISP APIs: see .../src/vnet/lisp/{lisp.api, lisp_api.c}
+ * LISP-GPE APIs: see .../src/vnet/lisp-gpe/{lisp_gpe.api, lisp_gpe_api.c}
+ * MPLS APIs: see .../src/vnet/mpls/{mpls.api, mpls_api.c}
+ * SR APIs: see .../src/vnet/sr/{sr.api, sr_api.c}
* DPDK APIs: ... see /src/vnet/devices/dpdk/{dpdk.api, dpdk_api.c}
*/
@@ -90,231 +93,6 @@ define sw_interface_set_mpls_enable_reply
i32 retval;
};
-/** \brief MPLS Route Add / del route
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param mr_label - The MPLS label value
- @param mr_eos - The End of stack bit
- @param mr_table_id - The MPLS table-id the route is added in
- @param mr_classify_table_index - If this is a classify route,
- this is the classify table index
- @param mr_create_table_if_needed - If the MPLS or IP tables do not exist,
- create them
- @param mr_is_add - Is this a route add or delete
- @param mr_is_classify - Is this route result a classify
- @param mr_is_multipath - Is this route update a multipath - i.e. is this
- a path addition to an existing route
- @param mr_is_resolve_host - Recurse resolution constraint via a host prefix
- @param mr_is_resolve_attached - Recurse resolution constraint via attached prefix
- @param mr_next_hop_proto_is_ip4 - The next-hop is IPV4
- @param mr_next_hop_weight - The weight, for UCMP
- @param mr_next_hop[16] - the nextop address
- @param mr_next_hop_sw_if_index - the next-hop SW interface
- @param mr_next_hop_table_id - the next-hop table-id (if appropriate)
- @param mr_next_hop_n_out_labels - the number of labels in the label stack
- @param mr_next_hop_out_label_stack - the next-hop output label stack, outer most first
- @param next_hop_via_label - The next-hop is a resolved via a local label
-*/
-define mpls_route_add_del
-{
- u32 client_index;
- u32 context;
- u32 mr_label;
- u8 mr_eos;
- u32 mr_table_id;
- u32 mr_classify_table_index;
- u8 mr_create_table_if_needed;
- u8 mr_is_add;
- u8 mr_is_classify;
- u8 mr_is_multipath;
- u8 mr_is_resolve_host;
- u8 mr_is_resolve_attached;
- u8 mr_next_hop_proto_is_ip4;
- u8 mr_next_hop_weight;
- u8 mr_next_hop[16];
- u8 mr_next_hop_n_out_labels;
- u32 mr_next_hop_sw_if_index;
- u32 mr_next_hop_table_id;
- u32 mr_next_hop_via_label;
- u32 mr_next_hop_out_label_stack[mr_next_hop_n_out_labels];
-};
-
-/** \brief Reply for MPLS route add / del request
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define mpls_route_add_del_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief Dump MPLS fib table
- @param client_index - opaque cookie to identify the sender
-*/
-define mpls_fib_dump
-{
- u32 client_index;
- u32 context;
-};
-
-/** \brief FIB path
- @param sw_if_index - index of the interface
- @param weight - The weight, for UCMP
- @param is_local - local if non-zero, else remote
- @param is_drop - Drop the packet
- @param is_unreach - Drop the packet and rate limit send ICMP unreachable
- @param is_prohibit - Drop the packet and rate limit send ICMP prohibited
- @param afi - the afi of the next hop, IP46_TYPE_IP4=1, IP46_TYPE_IP6=2
- @param next_hop[16] - the next hop address
-
- WARNING: this type is replicated, pending cleanup completion
-
-*/
-typeonly manual_print manual_endian define fib_path2
-{
- u32 sw_if_index;
- u32 weight;
- u8 is_local;
- u8 is_drop;
- u8 is_unreach;
- u8 is_prohibit;
- u8 afi;
- u8 next_hop[16];
-};
-
-/** \brief mpls FIB table response
- @param table_id - MPLS fib table id
- @param s_bit - End-of-stack bit
- @param label - MPLS label value
- @param count - the number of fib_path in path
- @param path - array of of fib_path structures
-*/
-manual_endian manual_print define mpls_fib_details
-{
- u32 context;
- u32 table_id;
- u8 eos_bit;
- u32 label;
- u32 count;
- vl_api_fib_path2_t path[count];
-};
-
-/** \brief Bind/Unbind an MPLS local label to an IP prefix. i.e. create
- a per-prefix label entry.
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param mb_mpls_table_id - The MPLS table-id the MPLS entry will be added in
- @param mb_label - The MPLS label value to bind
- @param mb_ip_table_id - The IP table-id of the IP prefix to bind to.
- @param mb_create_table_if_needed - Create either/both tables if required.
- @param mb_is_bind - Bind or unbind
- @param mb_is_ip4 - The prefix to bind to is IPv4
- @param mb_address_length - Length of IP prefix
- @param mb_address[16] - IP prefix/
-*/
-define mpls_ip_bind_unbind
-{
- u32 client_index;
- u32 context;
- u32 mb_mpls_table_id;
- u32 mb_label;
- u32 mb_ip_table_id;
- u8 mb_create_table_if_needed;
- u8 mb_is_bind;
- u8 mb_is_ip4;
- u8 mb_address_length;
- u8 mb_address[16];
-};
-
-/** \brief Reply for MPLS IP bind/unbind request
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define mpls_ip_bind_unbind_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief MPLS tunnel Add / del route
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param mt_is_add - Is this a route add or delete
- @param mt_sw_if_index - The SW interface index of the tunnel to delete
- @param mt_next_hop_proto_is_ip4 - The next-hop is IPV4
- @param mt_next_hop_weight - The weight, for UCMP
- @param mt_next_hop[16] - the nextop address
- @param mt_next_hop_sw_if_index - the next-hop SW interface
- @param mt_next_hop_table_id - the next-hop table-id (if appropriate)
- @param mt_next_hop_n_out_labels - the number of next-hop output labels
- @param mt_next_hop_out_label_stack - the next-hop output label stack, outer most first
-*/
-define mpls_tunnel_add_del
-{
- u32 client_index;
- u32 context;
- u32 mt_sw_if_index;
- u8 mt_is_add;
- u8 mt_l2_only;
- u8 mt_next_hop_proto_is_ip4;
- u8 mt_next_hop_weight;
- u8 mt_next_hop[16];
- u8 mt_next_hop_n_out_labels;
- u32 mt_next_hop_sw_if_index;
- u32 mt_next_hop_table_id;
- u32 mt_next_hop_out_label_stack[mt_next_hop_n_out_labels];
-};
-
-/** \brief Reply for MPLS tunnel add / del request
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
- @param sw_if_index - SW interface index of the tunnel created
-*/
-define mpls_tunnel_add_del_reply
-{
- u32 context;
- i32 retval;
- u32 sw_if_index;
-};
-
-/** \brief Dump mpls eth tunnel table
- @param client_index - opaque cookie to identify the sender
- @param tunnel_index - eth tunnel identifier or -1 in case of all tunnels
-*/
-define mpls_tunnel_dump
-{
- u32 client_index;
- u32 context;
- i32 tunnel_index;
-};
-
-/** \brief mpls eth tunnel operational state response
- @param tunnel_index - eth tunnel identifier
- @param intfc_address - interface ipv4 addr
- @param mask_width - interface ipv4 addr mask
- @param hw_if_index - interface id
- @param l2_only -
- @param tunnel_dst_mac -
- @param tx_sw_if_index -
- @param encap_index - reference to mpls label table
- @param nlabels - number of resolved labels
- @param labels - resolved labels
-*/
-define mpls_tunnel_details
-{
- u32 context;
- u32 tunnel_index;
- u8 mt_l2_only;
- u8 mt_sw_if_index;
- u8 mt_next_hop_proto_is_ip4;
- u8 mt_next_hop[16];
- u32 mt_next_hop_sw_if_index;
- u32 mt_next_hop_table_id;
- u32 mt_next_hop_n_labels;
- u32 mt_next_hop_out_labels[mt_next_hop_n_labels];
-};
-
/** \brief Proxy ARP add / del request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -797,102 +575,6 @@ define l2_patch_add_del_reply
i32 retval;
};
-/** \brief IPv6 segment routing tunnel add / del request
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param is_add - add the tunnel if non-zero, else delete it
- @param name[] - tunnel name (len. 64)
- @param src_address[] -
- @param dst_address[] -
- @param dst_mask_width -
- @param inner_vrf_id -
- @param outer_vrf_id -
- @param flags_net_byte_order -
- @param n_segments -
- @param n_tags -
- @param segs_and_tags[] -
- @param policy_name[] - name of policy to associate this tunnel to (len. 64)
-*/
-define sr_tunnel_add_del
-{
- u32 client_index;
- u32 context;
- u8 is_add;
- u8 name[64];
- u8 src_address[16];
- u8 dst_address[16];
- u8 dst_mask_width;
- u32 inner_vrf_id;
- u32 outer_vrf_id;
- u16 flags_net_byte_order;
- u8 n_segments;
- u8 n_tags;
- u8 policy_name[64];
- u8 segs_and_tags[0];
-};
-
-/** \brief IPv6 segment routing tunnel add / del response
- @param context - sender context, to match reply w/ request
- @param retval - return value for request
-*/
-define sr_tunnel_add_del_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief IPv6 segment routing policy add / del request
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param is_add - add the tunnel if non-zero, else delete it
- @param name[] - policy name (len. 64)
- @param tunnel_names[] -
-*/
-define sr_policy_add_del
-{
- u32 client_index;
- u32 context;
- u8 is_add;
- u8 name[64];
- u8 tunnel_names[0];
-};
-
-/** \brief IPv6 segment routing policy add / del response
- @param context - sender context, to match reply w/ request
- @param retval - return value for request
-*/
-define sr_policy_add_del_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief IPv6 segment routing multicast map to policy add / del request
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param is_add - add the tunnel if non-zero, else delete it
- @param multicast_address[] - IP6 multicast address
- @param policy_name[] = policy name (len.64)
-*/
-define sr_multicast_map_add_del
-{
- u32 client_index;
- u32 context;
- u8 is_add;
- u8 multicast_address[16];
- u8 policy_name[64];
-};
-
-/** \brief IPv6 segment routing multicast map to policy add / del response
- @param context - sender context, to match reply w/ request
- @param retval - return value for request
-*/
-define sr_multicast_map_add_del_reply
-{
- u32 context;
- i32 retval;
-};
-
/** \brief Interface set vpath request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -973,95 +655,6 @@ define sw_interface_set_l2_bridge_reply
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
- @param mac - the entry's mac address
- @param bd_id - the entry's bridge domain id
- @param sw_if_index - the interface
- @param is_add - If non zero add the entry, else delete it
- @param static_mac -
- @param filter_mac -
-*/
-define l2fib_add_del
-{
- u32 client_index;
- u32 context;
- u64 mac;
- u32 bd_id;
- u32 sw_if_index;
- u8 is_add;
- u8 static_mac;
- u8 filter_mac;
- u8 bvi_mac;
-};
-
-/** \brief L2 FIB add entry response
- @param context - sender context, to match reply w/ request
- @param retval - return code for the add l2fib entry request
-*/
-define l2fib_add_del_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief Set L2 flags request !!! TODO - need more info, feature bits in l2_input.h
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param sw_if_index - interface
- @param is_set - if non-zero, set the bits, else clear them
- @param feature_bitmap - non-zero bits to set or clear
-*/
-define l2_flags
-{
- u32 client_index;
- u32 context;
- u32 sw_if_index;
- u8 is_set;
- u32 feature_bitmap;
-};
-
-/** \brief Set L2 bits response
- @param context - sender context, to match reply w/ request
- @param retval - return code for the set l2 bits request
-*/
-define l2_flags_reply
-{
- u32 context;
- i32 retval;
- u32 resulting_feature_bitmap;
-};
-
-/** \brief Set bridge flags (such as L2_LEARN, L2_FWD, L2_FLOOD,
- L2_UU_FLOOD, or L2_ARP_TERM) request
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param bd_id - the bridge domain to set the flags for
- @param is_set - if non-zero, set the flags, else clear them
- @param feature_bitmap - bits that are non-zero to set or clear
-*/
-define bridge_flags
-{
- u32 client_index;
- u32 context;
- u32 bd_id;
- u8 is_set;
- u32 feature_bitmap;
-};
-
-/** \brief Set bridge flags response
- @param context - sender context, to match reply w/ request
- @param retval - return code for the set bridge flags request
- @param resulting_feature_bitmap - the feature bitmap value after the request is implemented
-*/
-define bridge_flags_reply
-{
- u32 context;
- i32 retval;
- u32 resulting_feature_bitmap;
-};
-
/** \brief Set bridge domain ip to mac entry request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -1335,26 +928,6 @@ define dhcp_proxy_config_2_reply
i32 retval;
};
-/** \brief L2 fib clear table request, clear all mac entries in the l2 fib
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
-*/
-define l2_fib_clear_table
-{
- u32 client_index;
- u32 context;
-};
-
-/** \brief L2 fib clear table response
- @param context - sender context, to match reply w/ request
- @param retval - return code for the request
-*/
-define l2_fib_clear_table_reply
-{
- u32 context;
- i32 retval;
-};
-
/** \brief L2 interface ethernet flow point filtering enable/disable request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -1463,36 +1036,6 @@ define show_version_reply
u8 build_directory[256];
};
-/** \brief l2 fib table entry structure
- @param bd_id - the l2 fib / bridge domain table id
- @param mac - the entry's mac address
- @param sw_if_index - index of the interface
- @param static_mac - the entry is statically configured.
- @param filter_mac - the entry is a mac filter entry.
- @param bvi_mac - the mac address is a bridge virtual interface
-*/
-define l2_fib_table_entry
-{
- u32 context;
- u32 bd_id;
- u64 mac;
- u32 sw_if_index;
- u8 static_mac;
- u8 filter_mac;
- u8 bvi_mac;
-};
-
-/** \brief Dump l2 fib (aka bridge domain) table
- @param client_index - opaque cookie to identify the sender
- @param bd_id - the l2 fib / bridge domain table identifier
-*/
-define l2_fib_table_dump
-{
- u32 client_index;
- u32 context;
- u32 bd_id;
-};
-
/* Gross kludge, DGMS */
define interface_name_renumber
{
@@ -1600,91 +1143,6 @@ define ip6_nd_event
u8 mac_ip;
};
-/** \brief L2 bridge domain add or delete request
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param bd_id - the bridge domain to create
- @param flood - enable/disable bcast/mcast flooding in the bd
- @param uu_flood - enable/disable uknown unicast flood in the bd
- @param forward - enable/disable forwarding on all interfaces in the bd
- @param learn - enable/disable learning on all interfaces in the bd
- @param arp_term - enable/disable arp termination in the bd
- @param mac_age - mac aging time in min, 0 for disabled
- @param is_add - add or delete flag
-*/
-define bridge_domain_add_del
-{
- u32 client_index;
- u32 context;
- u32 bd_id;
- u8 flood;
- u8 uu_flood;
- u8 forward;
- u8 learn;
- u8 arp_term;
- u8 mac_age;
- u8 is_add;
-};
-
-/** \brief L2 bridge domain add or delete response
- @param context - sender context, to match reply w/ request
- @param retval - return code for the set bridge flags request
-*/
-define bridge_domain_add_del_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief L2 bridge domain request operational state details
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param bd_id - the bridge domain id desired or ~0 to request all bds
-*/
-define bridge_domain_dump
-{
- u32 client_index;
- u32 context;
- u32 bd_id;
-};
-
-/** \brief L2 bridge domain operational state response
- @param bd_id - the bridge domain id
- @param flood - bcast/mcast flooding state on all interfaces in the bd
- @param uu_flood - uknown unicast flooding state on all interfaces in the bd
- @param forward - forwarding state on all interfaces in the bd
- @param learn - learning state on all interfaces in the bd
- @param arp_term - arp termination state on all interfaces in the bd
- @param mac_age - mac aging time in min, 0 for disabled
- @param n_sw_ifs - number of sw_if_index's in the domain
-*/
-define bridge_domain_details
-{
- u32 context;
- u32 bd_id;
- u8 flood;
- u8 uu_flood;
- u8 forward;
- u8 learn;
- u8 arp_term;
- u8 mac_age;
- u32 bvi_sw_if_index;
- u32 n_sw_ifs;
-};
-
-/** \brief L2 bridge domain sw interface operational state response
- @param bd_id - the bridge domain id
- @param sw_if_index - sw_if_index in the domain
- @param shg - split horizon group for the interface
-*/
-define bridge_domain_sw_if_details
-{
- u32 context;
- u32 bd_id;
- u32 sw_if_index;
- u8 shg;
-};
-
/** \brief DHCP Client config add / del request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request