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 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \ 62 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \ 63 _(BRIDGE_FLAGS, bridge_flags) \ 64 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \ 65 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) \ 66 _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age) 70 u32 rx_sw_if_index,
u32 tx_sw_if_index)
75 memset (mp, 0,
sizeof (*mp));
76 mp->_vl_msg_id = ntohs (VL_API_L2_XCONNECT_DETAILS);
101 config = vec_elt_at_index (l2im->configs, swif->sw_if_index);
102 if (config->xconnect)
103 send_l2_xconnect_details (q, mp->context, swif->sw_if_index,
104 config->output_sw_if_index);
113 vl_api_l2_fib_clear_table_reply_t *rmp;
130 memset (mp, 0,
sizeof (*mp));
131 mp->_vl_msg_id = ntohs (VL_API_L2_FIB_TABLE_DETAILS);
190 vl_api_l2fib_add_del_reply_t *rmp;
197 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
198 goto bad_sw_if_index;
213 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
214 goto bad_sw_if_index;
222 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
223 goto bad_sw_if_index;
246 vl_api_want_l2_macs_events_reply_t *rmp;
249 u32 pid = ntohl (mp->
pid);
279 rv = VNET_API_ERROR_L2_MACS_EVENT_CLINET_PRESENT;
302 vl_api_l2fib_flush_int_reply_t *rmp;
317 vl_api_l2fib_flush_all_reply_t *rmp;
329 vl_api_l2fib_flush_bd_reply_t *rmp;
335 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
357 bitmap |= L2INPUT_FEAT_LEARN;
360 bitmap |= L2INPUT_FEAT_FWD;
363 bitmap |= L2INPUT_FEAT_FLOOD;
366 bitmap |= L2INPUT_FEAT_UU_FLOOD;
369 bitmap |= L2INPUT_FEAT_ARP_TERM;
389 vl_api_bridge_domain_set_mac_age_reply_t *rmp;
396 rv = VNET_API_ERROR_BD_NOT_MODIFIABLE;
403 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
408 REPLY_MACRO (VL_API_BRIDGE_DOMAIN_SET_MAC_AGE_REPLY);
422 .bd_id = ntohl (mp->
bd_id),
428 vl_api_bridge_domain_add_del_reply_t *rmp;
436 u32 n_sw_ifs,
u32 context)
445 memset (mp, 0,
sizeof (*mp));
446 mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_DETAILS);
457 strncpy ((
char *) mp->
bd_tag, (
char *) bd_config->
bd_tag,
469 sw_ifs->
shg = input_cfg->
shg;
505 for (; bd_index < end; bd_index++)
510 if (bd_config && (bd_config->
bd_id > 0))
529 rv = VNET_API_ERROR_BD_NOT_MODIFIABLE;
536 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
556 vl_api_l2_interface_vlan_tag_rewrite_reply_t *rmp;
563 vtr_op = ntohl (mp->
vtr_op);
580 rv = VNET_API_ERROR_INVALID_VALUE;
581 goto bad_sw_if_index;
590 REPLY_MACRO (VL_API_L2_INTERFACE_VLAN_TAG_REWRITE_REPLY);
597 vl_api_l2_interface_pbb_tag_rewrite_reply_t *rmp;
605 vtr_op = ntohl (mp->
vtr_op);
616 rv = VNET_API_ERROR_INVALID_VALUE;
617 goto bad_sw_if_index;
626 REPLY_MACRO (VL_API_L2_INTERFACE_PBB_TAG_REWRITE_REPLY);
636 #define vl_msg_name_crc_list 638 #undef vl_msg_name_crc_list 643 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 644 foreach_vl_msg_name_crc_l2;
654 vl_msg_api_set_handlers(VL_API_##N, #n, \ 655 vl_api_##n##_t_handler, \ 657 vl_api_##n##_t_endian, \ 658 vl_api_##n##_t_print, \ 659 sizeof(vl_api_##n##_t), 1);
static void vl_api_l2_fib_table_dump_t_handler(vl_api_l2_fib_table_dump_t *mp)
static void l2fib_add_fwd_entry(u64 mac, u32 bd_index, u32 sw_if_index, u8 static_mac, u8 bvi_mac)
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.
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_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)
u32 l2fib_del_entry(u64 mac, u32 bd_index)
Delete an entry from the l2fib.
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)
L2 bridge domain request operational state details.
int bd_add_del(l2_bridge_domain_add_del_args_t *a)
static void vl_api_l2fib_add_del_t_handler(vl_api_l2fib_add_del_t *mp)
Reply to l2_xconnect_dump.
static void send_l2_xconnect_details(unix_shared_memory_queue_t *q, u32 context, u32 rx_sw_if_index, u32 tx_sw_if_index)
L2 bridge domain operational state response.
#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.
uword * bd_index_by_bd_id
void * vl_msg_api_alloc(int nbytes)
Dump l2 fib (aka bridge domain) table.
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.
static void l2fib_add_filter_entry(u64 mac, u32 bd_index)
Set interface L2 flags response.
void l2fib_flush_bd_mac(vlib_main_t *vm, u32 bd_index)
Flush all non static MACs in a bridge domain.
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)
#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.
#define BAD_SW_IF_INDEX_LABEL
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
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
static void setup_message_id_table(api_main_t *am)
void l2fib_clear_table(void)
struct l2fib_entry_key_t::@178::@180 fields
#define L2FIB_EVENT_SCAN_DELAY_DEFAULT
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
Register to recive L2 MAC events for leanred and aged MAC.
struct l2fib_entry_result_t::@186::@188 fields
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)
#define L2FIB_EVENT_LEARN_LIMIT_DEFAULT
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)
static void vl_api_bridge_flags_t_handler(vl_api_bridge_flags_t *mp)
vnet_sw_interface_t * sw_interfaces
L2 interface vlan tag rewrite configure request.
static void vl_api_l2fib_flush_all_t_handler(vl_api_l2fib_flush_all_t *mp)
static u64 l2fib_make_key(u8 *mac_address, u16 bd_index)
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)
void l2fib_table_dump(u32 bd_index, l2fib_entry_key_t **l2fe_key, l2fib_entry_result_t **l2fe_res)
L2 interface pbb tag rewrite configure request.
l2learn_main_t l2learn_main
#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.
static void send_bridge_domain_details(l2input_main_t *l2im, unix_shared_memory_queue_t *q, l2_bridge_domain_t *bd_config, u32 n_sw_ifs, u32 context)
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
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)
#define VALIDATE_SW_IF_INDEX(mp)
struct _unix_shared_memory_queue unix_shared_memory_queue_t
static void vl_api_bridge_domain_dump_t_handler(vl_api_bridge_domain_dump_t *mp)
L2 bridge domain add or delete request.