43 #define vl_api_bridge_domain_details_t_endian vl_noop_handler 44 #define vl_api_bridge_domain_details_t_print vl_noop_handler 47 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 54 #define foreach_vpe_api_msg \ 55 _(L2_XCONNECT_DUMP, l2_xconnect_dump) \ 56 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \ 57 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \ 58 _(L2FIB_FLUSH_ALL, l2fib_flush_all) \ 59 _(L2FIB_FLUSH_INT, l2fib_flush_int) \ 60 _(L2FIB_FLUSH_BD, l2fib_flush_bd) \ 61 _(L2FIB_ADD_DEL, l2fib_add_del) \ 62 _(WANT_L2_MACS_EVENTS, want_l2_macs_events) \ 63 _(L2_FLAGS, l2_flags) \ 64 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \ 65 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \ 66 _(L2_PATCH_ADD_DEL, l2_patch_add_del) \ 67 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \ 68 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \ 69 _(BD_IP_MAC_FLUSH, bd_ip_mac_flush) \ 70 _(BD_IP_MAC_DUMP, bd_ip_mac_dump) \ 71 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \ 72 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \ 73 _(BRIDGE_FLAGS, bridge_flags) \ 74 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \ 75 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) \ 76 _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age) \ 77 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) 81 u32 rx_sw_if_index,
u32 tx_sw_if_index)
87 mp->_vl_msg_id = ntohs (VL_API_L2_XCONNECT_DETAILS);
112 config = vec_elt_at_index (l2im->configs, swif->sw_if_index);
113 if (config->xconnect)
114 send_l2_xconnect_details (reg, mp->context, swif->sw_if_index,
115 config->output_sw_if_index);
124 vl_api_l2_fib_clear_table_reply_t *rmp;
142 mp->_vl_msg_id = ntohs (VL_API_L2_FIB_TABLE_DETAILS);
149 mp->
static_mac = (l2fib_entry_result_is_set_STATIC (l2fe_res) ? 1 : 0);
150 mp->
filter_mac = (l2fib_entry_result_is_set_FILTER (l2fe_res) ? 1 : 0);
151 mp->
bvi_mac = (l2fib_entry_result_is_set_BVI (l2fe_res) ? 1 : 0);
201 vl_api_l2fib_add_del_reply_t *rmp;
208 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
209 goto bad_sw_if_index;
227 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
228 goto bad_sw_if_index;
236 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
237 goto bad_sw_if_index;
241 flags |= L2FIB_ENTRY_RESULT_FLAG_STATIC;
243 flags |= L2FIB_ENTRY_RESULT_FLAG_BVI;
251 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
263 vl_api_want_l2_macs_events_reply_t *rmp;
266 u32 pid = ntohl (mp->
pid);
296 rv = VNET_API_ERROR_L2_MACS_EVENT_CLINET_PRESENT;
319 vl_api_l2fib_flush_int_reply_t *rmp;
334 vl_api_l2fib_flush_all_reply_t *rmp;
346 vl_api_l2fib_flush_bd_reply_t *rmp;
352 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
374 bitmap |= L2INPUT_FEAT_LEARN;
377 bitmap |= L2INPUT_FEAT_FWD;
380 bitmap |= L2INPUT_FEAT_FLOOD;
383 bitmap |= L2INPUT_FEAT_UU_FLOOD;
386 bitmap |= L2INPUT_FEAT_ARP_TERM;
406 vl_api_bridge_domain_set_mac_age_reply_t *rmp;
413 rv = VNET_API_ERROR_BD_NOT_MODIFIABLE;
420 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
425 REPLY_MACRO (VL_API_BRIDGE_DOMAIN_SET_MAC_AGE_REPLY);
439 .bd_id = ntohl (mp->
bd_id),
445 vl_api_bridge_domain_add_del_reply_t *rmp;
453 u32 n_sw_ifs,
u32 context)
463 mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_DETAILS);
475 strncpy ((
char *) mp->
bd_tag, (
char *) bd_config->
bd_tag,
487 sw_ifs->
shg = input_cfg->
shg;
508 bd_id = ntohl (mp->
bd_id);
523 for (; bd_index < end; bd_index++)
528 if (bd_config && (bd_config->
bd_id > 0))
569 rv = VNET_API_ERROR_BD_NOT_MODIFIABLE;
576 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
596 vl_api_l2_interface_vlan_tag_rewrite_reply_t *rmp;
603 vtr_op = ntohl (mp->
vtr_op);
620 rv = VNET_API_ERROR_INVALID_VALUE;
621 goto bad_sw_if_index;
630 REPLY_MACRO (VL_API_L2_INTERFACE_VLAN_TAG_REWRITE_REPLY);
637 vl_api_l2_interface_pbb_tag_rewrite_reply_t *rmp;
645 vtr_op = ntohl (mp->
vtr_op);
656 rv = VNET_API_ERROR_INVALID_VALUE;
657 goto bad_sw_if_index;
666 REPLY_MACRO (VL_API_L2_INTERFACE_PBB_TAG_REWRITE_REPLY);
673 vl_api_sw_interface_set_l2_xconnect_reply_t *rmp;
698 rv = VNET_API_ERROR_NON_ETHERNET;
701 rv = VNET_API_ERROR_BD_ALREADY_HAS_BVI;
708 REPLY_MACRO (VL_API_SW_INTERFACE_SET_L2_XCONNECT_REPLY);
714 v = clib_net_to_host_u32 (v);
729 return (VNET_API_ERROR_INVALID_VALUE);
737 vl_api_sw_interface_set_l2_bridge_reply_t *rmp;
756 rx_sw_if_index, bd_index, pt, mp->
shg, 0);
766 rv = VNET_API_ERROR_NON_ETHERNET;
769 rv = VNET_API_ERROR_BD_ALREADY_HAS_BVI;
776 REPLY_MACRO (VL_API_SW_INTERFACE_SET_L2_BRIDGE_REPLY);
789 mp->_vl_msg_id = ntohs (VL_API_BD_IP_MAC_DETAILS);
791 mp->
bd_id = ntohl (bd_id);
808 u32 bd_index, start, end;
834 for (bd_index = start; bd_index < end; bd_index++)
842 bd_id = bd_config->
bd_id;
847 send_bd_ip_mac_entry (am, reg, bd_id, 0, (u8 *) &(ip4_addr.as_u8), (u8 *) &mac_addr, mp->context);
852 send_bd_ip_mac_entry (am, reg, bd_id, 1, (u8 *) &(ip6_addr->as_u8), (u8 *) &mac_addr, mp->context);
863 vl_api_bd_ip_mac_add_del_reply_t *rmp;
871 bd_id = ntohl (mp->
bd_id);
875 rv = VNET_API_ERROR_BD_NOT_MODIFIABLE;
882 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
891 rv = VNET_API_ERROR_UNSPECIFIED;
900 vl_api_bd_ip_mac_flush_reply_t *rmp;
906 bd_id = ntohl (mp->
bd_id);
910 rv = VNET_API_ERROR_BD_NOT_MODIFIABLE;
917 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
929 u32 sw_if_index,
u8 enable);
936 vl_api_l2_interface_efp_filter_reply_t *rmp;
946 REPLY_MACRO (VL_API_L2_INTERFACE_EFP_FILTER_REPLY);
954 vl_api_l2_patch_add_del_reply_t *rmp;
975 vl_api_sw_interface_set_vpath_reply_t *rmp;
983 sw_if_index, mp->
enable, 0, 0);
985 sw_if_index, mp->
enable, 0, 0);
987 sw_if_index, mp->
enable, 0, 0);
989 sw_if_index, mp->
enable, 0, 0);
1003 #define vl_msg_name_crc_list 1005 #undef vl_msg_name_crc_list 1010 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 1011 foreach_vl_msg_name_crc_l2;
1021 vl_msg_api_set_handlers(VL_API_##N, #n, \ 1022 vl_api_##n##_t_handler, \ 1024 vl_api_##n##_t_endian, \ 1025 vl_api_##n##_t_print, \ 1026 sizeof(vl_api_##n##_t), 1); 1031 am->
is_mp_safe[VL_API_BRIDGE_DOMAIN_DUMP] = 1;
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static void vl_api_l2_fib_table_dump_t_handler(vl_api_l2_fib_table_dump_t *mp)
#define BAD_RX_SW_IF_INDEX_LABEL
static bd_flags_t bd_flags_decode(vl_api_bd_flags_t v)
#define vec_foreach_index(var, v)
Iterate over vector indices.
L2 FIB add entry request.
l2_input_config_t * configs
Set bridge flags response.
#define VALIDATE_TX_SW_IF_INDEX(mp)
l2 fib table details structure
u32 l2vtr_configure(vlib_main_t *vlib_main, vnet_main_t *vnet_main, u32 sw_if_index, u32 vtr_op, u32 push_dot1q, u32 vtr_tag1, u32 vtr_tag2)
Configure vtag tag rewrite on the given interface.
vl_api_l2_port_type_t port_type
u32 bd_add_del_ip_mac(u32 bd_index, ip46_type_t type, const ip46_address_t *ip, const mac_address_t *mac, u8 is_add)
Add/delete IP address to MAC address mapping.
vnet_main_t * vnet_get_main(void)
static void vl_api_sw_interface_set_l2_bridge_t_handler(vl_api_sw_interface_set_l2_bridge_t *mp)
static void vl_api_l2_patch_add_del_t_handler(vl_api_l2_patch_add_del_t *mp)
static void vl_api_l2_flags_t_handler(vl_api_l2_flags_t *mp)
vnet_interface_main_t interface_main
u32 resulting_feature_bitmap
#define REPLY_MACRO2(t, body)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
VLIB_API_INIT_FUNCTION(l2_api_hookup)
L2 bridge domain set mac age.
l2_flood_member_t * members
static void vl_api_bridge_domain_add_del_t_handler(vl_api_bridge_domain_add_del_t *mp)
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
static void send_l2_xconnect_details(vl_api_registration_t *reg, u32 context, u32 rx_sw_if_index, u32 tx_sw_if_index)
static void vl_api_bd_ip_mac_dump_t_handler(vl_api_bd_ip_mac_dump_t *mp)
enum l2fib_entry_result_flags_t_ l2fib_entry_result_flags_t
L2 bridge domain request operational state details.
int bd_add_del(l2_bridge_domain_add_del_args_t *a)
bridge domain IP to MAC entry details structure
static void vl_api_l2fib_add_del_t_handler(vl_api_l2fib_add_del_t *mp)
void * vl_msg_api_alloc(int nbytes)
#define clib_memcpy(d, s, n)
Reply to l2_xconnect_dump.
vl_api_mac_address_t mac_address
L2 bridge domain operational state response.
l2learn_main_t l2learn_main
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static void vl_api_bd_ip_mac_flush_t_handler(vl_api_bd_ip_mac_flush_t *mp)
struct l2fib_entry_result_t_::@243::@245 fields
L2 bridge domain sw interface operational state response.
#define hash_foreach(key_var, value_var, h, body)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static void vl_api_l2_fib_clear_table_t_handler(vl_api_l2_fib_clear_table_t *mp)
L2 FIB flush bridge domain entries.
static void send_bd_ip_mac_entry(vpe_api_main_t *am, vl_api_registration_t *reg, u32 bd_id, u8 is_ipv6, u8 *ip_address, u8 *mac_address, u32 context)
void l2fib_add_entry(const u8 *mac, u32 bd_index, u32 sw_if_index, l2fib_entry_result_flags_t flags)
Add an entry to the l2fib.
uword * bd_index_by_bd_id
ip46_type_t ip_address_decode(const vl_api_address_t *in, ip46_address_t *out)
Dump l2 fib (aka bridge domain) table.
vnet_api_error_t api_errno
Set interface L2 flags (such as L2_LEARN, L2_FWD, L2_FLOOD, L2_UU_FLOOD, or L2_ARP_TERM bits)...
L2 FIB flush all entries.
L2 fib clear table request, clear all mac entries in the l2 fib.
Set interface L2 flags response.
Set bridge domain ip to mac entry request.
void l2fib_flush_bd_mac(vlib_main_t *vm, u32 bd_index)
Flush all non static MACs in a bridge domain.
enum l2_bd_port_type_t_ l2_bd_port_type_t
static void vl_api_bd_ip_mac_add_del_t_handler(vl_api_bd_ip_mac_add_del_t *mp)
#define BAD_TX_SW_IF_INDEX_LABEL
void l2fib_flush_all_mac(vlib_main_t *vm)
Flush all non static MACs - flushes all valid BDs.
#define hash_foreach_mem(key_var, value_var, h, body)
static clib_error_t * l2_api_hookup(vlib_main_t *vm)
#define L2FIB_EVENT_MAX_MACS_DEFAULT
static u32 bd_is_valid(l2_bridge_domain_t *bd_config)
#define ip46_address_initializer
API main structure, used by both vpp and binary API clients.
u32 l2pbb_configure(vlib_main_t *vlib_main, vnet_main_t *vnet_main, u32 sw_if_index, u32 vtr_op, u8 *b_dmac, u8 *b_smac, u16 b_vlanid, u32 i_sid, u16 vlan_outer_tag)
void bd_set_mac_age(vlib_main_t *vm, u32 bd_index, u8 age)
Set the mac age for the bridge domain.
An API client registration, only in vpp/vlib.
#define BAD_SW_IF_INDEX_LABEL
static void send_bridge_domain_details(l2input_main_t *l2im, vl_api_registration_t *reg, l2_bridge_domain_t *bd_config, u32 n_sw_ifs, u32 context)
u32 l2fib_del_entry(const u8 *mac, u32 bd_index, u32 sw_if_index)
Delete an entry from the l2fib.
static void vl_api_l2_xconnect_dump_t_handler(vl_api_l2_xconnect_dump_t *mp)
#define vec_free(V)
Free vector's memory (no header).
#define foreach_vpe_api_msg
u32 bd_set_flags(vlib_main_t *vm, u32 bd_index, bd_flags_t flags, u32 enable)
Set the learn/forward/flood flags for the bridge domain.
static void setup_message_id_table(api_main_t *am)
void l2fib_clear_table(void)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
#define VALIDATE_RX_SW_IF_INDEX(mp)
Dump bridge domain IP to MAC entries.
void bd_flush_ip_mac(u32 bd_index)
Flush IP address to MAC address mapping tables in a BD.
struct l2fib_entry_key_t::@235::@237 fields
#define L2FIB_EVENT_SCAN_DELAY_DEFAULT
Set L2 XConnect between two interfaces request.
static u32 bd_find_or_add_bd_index(bd_main_t *bdm, u32 bd_id)
Get or create a bridge domain.
Register to receive L2 MAC events for learned and aged MAC.
#define VALIDATE_BD_ID(mp)
static vlib_main_t * vlib_get_main(void)
u32 resulting_feature_bitmap
static void vl_api_l2_interface_vlan_tag_rewrite_t_handler(vl_api_l2_interface_vlan_tag_rewrite_t *mp)
Interface bridge mode request.
#define L2FIB_EVENT_LEARN_LIMIT_DEFAULT
static void vl_api_sw_interface_set_l2_xconnect_t_handler(vl_api_sw_interface_set_l2_xconnect_t *mp)
L2 FIB flush interface entries.
static void vl_api_l2fib_flush_bd_t_handler(vl_api_l2fib_flush_bd_t *mp)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void vl_api_want_l2_macs_events_t_handler(vl_api_want_l2_macs_events_t *mp)
L2 interface ethernet flow point filtering enable/disable request.
static void vl_api_bridge_flags_t_handler(vl_api_bridge_flags_t *mp)
int vnet_l2_patch_add_del(u32 rx_sw_if_index, u32 tx_sw_if_index, int is_add)
vnet_sw_interface_t * sw_interfaces
static void vl_api_l2_interface_efp_filter_t_handler(vl_api_l2_interface_efp_filter_t *mp)
L2 interface vlan tag rewrite configure request.
static void vl_api_l2fib_flush_all_t_handler(vl_api_l2fib_flush_all_t *mp)
l2_bridge_domain_t * bd_configs
static void l2fib_add_filter_entry(const u8 *mac, u32 bd_index)
static void vl_api_bridge_domain_set_mac_age_t_handler(vl_api_bridge_domain_set_mac_age_t *mp)
L2 interface patch add / del request.
void l2fib_table_dump(u32 bd_index, l2fib_entry_key_t **l2fe_key, l2fib_entry_result_t **l2fe_res)
static void send_l2fib_table_entry(vpe_api_main_t *am, vl_api_registration_t *reg, l2fib_entry_key_t *l2fe_key, l2fib_entry_result_t *l2fe_res, u32 context)
Interface set vpath request.
static int l2_bd_port_type_decode(vl_api_l2_port_type_t v, l2_bd_port_type_t *l)
u8 * is_mp_safe
Message is mp safe vector.
L2 interface pbb tag rewrite configure request.
#define vec_foreach(var, vec)
Vector iterator.
Set bridge flags request.
vl_api_bridge_domain_sw_if_t sw_if_details[n_sw_ifs]
u32 bd_find_index(bd_main_t *bdm, u32 bd_id)
Get a bridge domain.
vpe_api_main_t vpe_api_main
void l2_efp_filter_configure(vnet_main_t *vnet_main, u32 sw_if_index, u8 enable)
Enable/disable the EFP Filter check on the subinterface.
void mac_address_decode(const u8 *in, mac_address_t *out)
Conversion functions to/from (decode/encode) API types to VPP internal types.
void l2fib_flush_int_mac(vlib_main_t *vm, u32 sw_if_index)
Flush all non static MACs from an interface.
static void vl_api_l2fib_flush_int_t_handler(vl_api_l2fib_flush_int_t *mp)
Flush bridge domain IP to MAC entries.
static void vl_api_l2_interface_pbb_tag_rewrite_t_handler(vl_api_l2_interface_pbb_tag_rewrite_t *mp)
#define L2LEARN_DEFAULT_LIMIT
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
#define VALIDATE_SW_IF_INDEX(mp)
enum bd_flags_t_ bd_flags_t
static void vl_api_bridge_domain_dump_t_handler(vl_api_bridge_domain_dump_t *mp)
L2 bridge domain add or delete request.
static void vl_api_sw_interface_set_vpath_t_handler(vl_api_sw_interface_set_vpath_t *mp)