40 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 47 #define foreach_vpe_api_msg \ 48 _(L2_XCONNECT_DUMP, l2_xconnect_dump) \ 49 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \ 50 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \ 51 _(L2FIB_ADD_DEL, l2fib_add_del) \ 52 _(L2_FLAGS, l2_flags) \ 53 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \ 54 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \ 55 _(BRIDGE_FLAGS, bridge_flags) \ 56 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \ 57 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) 61 u32 rx_sw_if_index,
u32 tx_sw_if_index)
66 memset (mp, 0,
sizeof (*mp));
67 mp->_vl_msg_id = ntohs (VL_API_L2_XCONNECT_DETAILS);
92 config = vec_elt_at_index (l2im->configs, swif->sw_if_index);
94 send_l2_xconnect_details (q, mp->context, swif->sw_if_index,
95 config->output_sw_if_index);
124 memset (mp, 0,
sizeof (*mp));
125 mp->_vl_msg_id = ntohs (VL_API_L2_FIB_TABLE_ENTRY);
200 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
201 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;
254 if (flags & L2INPUT_FEAT_ ## a) \ 255 rbm = l2input_intf_bitmap_enable (sw_if_index, L2INPUT_FEAT_ ## a, mp->is_set); 276 u32 enable_flags = 0, disable_flags = 0;
326 u32 n_sw_ifs,
u32 context)
331 memset (mp, 0,
sizeof (*mp));
332 mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_DETAILS);
356 memset (mp, 0,
sizeof (*mp));
357 mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_SW_IF_DETAILS);
358 mp->
bd_id = ntohl (bd_id);
382 bd_id = ntohl (mp->
bd_id);
386 for (; bd_index < end; bd_index++)
390 if (bd_config && (bd_config->
bd_id > 0))
421 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
450 vtr_op = ntohl (mp->
vtr_op);
467 rv = VNET_API_ERROR_INVALID_VALUE;
468 goto bad_sw_if_index;
477 REPLY_MACRO (VL_API_L2_INTERFACE_VLAN_TAG_REWRITE_REPLY);
492 vtr_op = ntohl (mp->
vtr_op);
503 rv = VNET_API_ERROR_INVALID_VALUE;
504 goto bad_sw_if_index;
513 REPLY_MACRO (VL_API_L2_INTERFACE_PBB_TAG_REWRITE_REPLY);
523 #define vl_msg_name_crc_list 525 #undef vl_msg_name_crc_list 530 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 531 foreach_vl_msg_name_crc_l2;
541 vl_msg_api_set_handlers(VL_API_##N, #n, \ 542 vl_api_##n##_t_handler, \ 544 vl_api_##n##_t_endian, \ 545 vl_api_##n##_t_print, \ 546 sizeof(vl_api_##n##_t), 1);
static void vl_api_l2_fib_table_dump_t_handler(vl_api_l2_fib_table_dump_t *mp)
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 interface vlan tag rewrite response.
L2 FIB add entry request.
l2_input_config_t * configs
Set bridge flags response.
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.
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
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)
L2 bridge domain sw interface operational state response.
u32 l2fib_del_entry(u64 mac, u32 bd_index)
Delete an entry from the l2fib.
VLIB_API_INIT_FUNCTION(l2_api_hookup)
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
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.
static void vl_api_l2fib_add_del_t_handler(vl_api_l2fib_add_del_t *mp)
struct l2fib_entry_result_t::@150::@152 fields
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.
int bd_delete_bd_index(bd_main_t *bdm, u32 bd_id)
Delete a bridge domain.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#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)
uword * bd_index_by_bd_id
static void send_bridge_domain_details(unix_shared_memory_queue_t *q, l2_bridge_domain_t *bd_config, u32 n_sw_ifs, u32 context)
Dump l2 fib (aka bridge domain) table.
Set L2 flags request !!! TODO - need more info, feature bits in l2_input.h.
L2 fib clear table request, clear all mac entries in the l2 fib.
L2 FIB add entry response.
L2 bridge domain add or delete response.
static clib_error_t * l2_api_hookup(vlib_main_t *vm)
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)
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)
L2 fib clear table response.
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
void * vl_msg_api_alloc(int nbytes)
void l2fib_clear_table(uint keep_static)
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
static void setup_message_id_table(api_main_t *am)
void l2fib_add_entry(u64 mac, u32 bd_index, u32 sw_if_index, u32 static_mac, u32 filter_mac, u32 bvi_mac)
Add an entry to the l2fib.
l2 fib table entry structure
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)
u32 bd_find_or_add_bd_index(bd_main_t *bdm, u32 bd_id)
Get or create a bridge domain.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
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 u64 l2fib_make_key(u8 *mac_address, u16 bd_index)
l2_bridge_domain_t * bd_configs
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.
struct l2fib_entry_key_t::@146::@148 fields
L2 interface pbb tag rewrite response.
#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) request...
vpe_api_main_t vpe_api_main
static void vl_api_l2_interface_pbb_tag_rewrite_t_handler(vl_api_l2_interface_pbb_tag_rewrite_t *mp)
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.