40 #define vl_api_bridge_domain_details_t_endian vl_noop_handler 41 #define vl_api_bridge_domain_details_t_print vl_noop_handler 44 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 51 #define foreach_vpe_api_msg \ 52 _(L2_XCONNECT_DUMP, l2_xconnect_dump) \ 53 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \ 54 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \ 55 _(L2FIB_FLUSH_ALL, l2fib_flush_all) \ 56 _(L2FIB_FLUSH_INT, l2fib_flush_int) \ 57 _(L2FIB_FLUSH_BD, l2fib_flush_bd) \ 58 _(L2FIB_ADD_DEL, l2fib_add_del) \ 59 _(WANT_L2_MACS_EVENTS, want_l2_macs_events) \ 60 _(L2_FLAGS, l2_flags) \ 61 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \ 62 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \ 63 _(L2_PATCH_ADD_DEL, l2_patch_add_del) \ 64 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \ 65 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \ 66 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \ 67 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \ 68 _(BRIDGE_FLAGS, bridge_flags) \ 69 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \ 70 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) \ 71 _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age) \ 72 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) 76 u32 rx_sw_if_index,
u32 tx_sw_if_index)
81 memset (mp, 0,
sizeof (*mp));
82 mp->_vl_msg_id = ntohs (VL_API_L2_XCONNECT_DETAILS);
107 config = vec_elt_at_index (l2im->configs, swif->sw_if_index);
108 if (config->xconnect)
109 send_l2_xconnect_details (reg, mp->context, swif->sw_if_index,
110 config->output_sw_if_index);
119 vl_api_l2_fib_clear_table_reply_t *rmp;
136 memset (mp, 0,
sizeof (*mp));
137 mp->_vl_msg_id = ntohs (VL_API_L2_FIB_TABLE_DETAILS);
196 vl_api_l2fib_add_del_reply_t *rmp;
203 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
204 goto bad_sw_if_index;
221 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
222 goto bad_sw_if_index;
230 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
231 goto bad_sw_if_index;
244 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
256 vl_api_want_l2_macs_events_reply_t *rmp;
259 u32 pid = ntohl (mp->
pid);
289 rv = VNET_API_ERROR_L2_MACS_EVENT_CLINET_PRESENT;
312 vl_api_l2fib_flush_int_reply_t *rmp;
327 vl_api_l2fib_flush_all_reply_t *rmp;
339 vl_api_l2fib_flush_bd_reply_t *rmp;
345 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
367 bitmap |= L2INPUT_FEAT_LEARN;
370 bitmap |= L2INPUT_FEAT_FWD;
373 bitmap |= L2INPUT_FEAT_FLOOD;
376 bitmap |= L2INPUT_FEAT_UU_FLOOD;
379 bitmap |= L2INPUT_FEAT_ARP_TERM;
399 vl_api_bridge_domain_set_mac_age_reply_t *rmp;
406 rv = VNET_API_ERROR_BD_NOT_MODIFIABLE;
413 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
418 REPLY_MACRO (VL_API_BRIDGE_DOMAIN_SET_MAC_AGE_REPLY);
432 .bd_id = ntohl (mp->
bd_id),
438 vl_api_bridge_domain_add_del_reply_t *rmp;
446 u32 n_sw_ifs,
u32 context)
455 memset (mp, 0,
sizeof (*mp));
456 mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_DETAILS);
467 strncpy ((
char *) mp->
bd_tag, (
char *) bd_config->
bd_tag,
479 sw_ifs->
shg = input_cfg->
shg;
494 u32 bd_id, bd_index, end;
500 bd_id = ntohl (mp->
bd_id);
515 for (; bd_index < end; bd_index++)
520 if (bd_config && (bd_config->
bd_id > 0))
539 rv = VNET_API_ERROR_BD_NOT_MODIFIABLE;
546 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
566 vl_api_l2_interface_vlan_tag_rewrite_reply_t *rmp;
573 vtr_op = ntohl (mp->
vtr_op);
590 rv = VNET_API_ERROR_INVALID_VALUE;
591 goto bad_sw_if_index;
600 REPLY_MACRO (VL_API_L2_INTERFACE_VLAN_TAG_REWRITE_REPLY);
607 vl_api_l2_interface_pbb_tag_rewrite_reply_t *rmp;
615 vtr_op = ntohl (mp->
vtr_op);
626 rv = VNET_API_ERROR_INVALID_VALUE;
627 goto bad_sw_if_index;
636 REPLY_MACRO (VL_API_L2_INTERFACE_PBB_TAG_REWRITE_REPLY);
643 vl_api_sw_interface_set_l2_xconnect_reply_t *rmp;
656 rx_sw_if_index, 0, 0, 0, tx_sw_if_index);
666 REPLY_MACRO (VL_API_SW_INTERFACE_SET_L2_XCONNECT_REPLY);
674 vl_api_sw_interface_set_l2_bridge_reply_t *rmp;
691 rx_sw_if_index, bd_index, bvi, shg, 0);
701 REPLY_MACRO (VL_API_SW_INTERFACE_SET_L2_BRIDGE_REPLY);
708 vl_api_bd_ip_mac_add_del_reply_t *rmp;
716 rv = VNET_API_ERROR_BD_NOT_MODIFIABLE;
723 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
730 rv = VNET_API_ERROR_UNSPECIFIED;
737 u32 sw_if_index,
u32 enable);
744 vl_api_l2_interface_efp_filter_reply_t *rmp;
751 REPLY_MACRO (VL_API_L2_INTERFACE_EFP_FILTER_REPLY);
759 vl_api_l2_patch_add_del_reply_t *rmp;
780 vl_api_sw_interface_set_vpath_reply_t *rmp;
788 sw_if_index, mp->
enable, 0, 0);
790 sw_if_index, mp->
enable, 0, 0);
792 sw_if_index, mp->
enable, 0, 0);
794 sw_if_index, mp->
enable, 0, 0);
808 #define vl_msg_name_crc_list 810 #undef vl_msg_name_crc_list 815 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 816 foreach_vl_msg_name_crc_l2;
826 vl_msg_api_set_handlers(VL_API_##N, #n, \ 827 vl_api_##n##_t_handler, \ 829 vl_api_##n##_t_endian, \ 830 vl_api_##n##_t_print, \ 831 sizeof(vl_api_##n##_t), 1);
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
u32 bd_set_flags(vlib_main_t *vm, u32 bd_index, u32 flags, u32 enable)
Set the learn/forward/flood flags for the bridge domain.
#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.
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)
static void send_l2_xconnect_details(vl_api_registration_t *reg, u32 context, u32 rx_sw_if_index, u32 tx_sw_if_index)
L2 bridge domain request operational state details.
int bd_add_del(l2_bridge_domain_add_del_args_t *a)
struct l2fib_entry_result_t::@243::@245 fields
static void vl_api_l2fib_add_del_t_handler(vl_api_l2fib_add_del_t *mp)
void * vl_msg_api_alloc(int nbytes)
Reply to l2_xconnect_dump.
L2 bridge domain operational state response.
l2learn_main_t l2learn_main
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
L2 bridge domain sw interface operational state response.
#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.
void l2_efp_filter_configure(vnet_main_t *vnet_main, u32 sw_if_index, u32 enable)
Enable/disable the EFP Filter check on the subinterface.
u32 l2fib_del_entry(u8 *mac, u32 bd_index, u32 sw_if_index)
Delete an entry from the l2fib.
uword * bd_index_by_bd_id
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.
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.
static clib_error_t * l2_api_hookup(vlib_main_t *vm)
static void l2fib_add_fwd_entry(u8 *mac, u32 bd_index, u32 sw_if_index, u8 static_mac, u8 bvi_mac)
#define L2FIB_EVENT_MAX_MACS_DEFAULT
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)
static void vl_api_l2_xconnect_dump_t_handler(vl_api_l2_xconnect_dump_t *mp)
u32 bd_add_del_ip_mac(u32 bd_index, u8 *ip_addr, u8 *mac_addr, u8 is_ip6, u8 is_add)
Add/delete IP address to MAC address mapping.
#define vec_free(V)
Free vector's memory (no header).
#define foreach_vpe_api_msg
#define clib_memcpy(a, b, c)
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)
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.
static void l2fib_add_filter_entry(u8 *mac, u32 bd_index)
Register to recive L2 MAC events for leanred 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 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.
L2 interface pbb tag rewrite configure request.
#define vec_foreach(var, vec)
Vector iterator.
Set bridge flags (such as L2_LEARN, L2_FWD, L2_FLOOD, L2_UU_FLOOD, or L2_ARP_TERM bits) 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 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)
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)
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)