42 #define GBP_BD_DBG(...) \ 43 vlib_log_debug (gb_logger, __VA_ARGS__); 48 return (gbd - gbp_bridge_domain_pool);
124 s =
format (s,
"do-not-learn ");
126 s =
format (s,
"uu-fwd-drop ");
128 s =
format (s,
"mcast-drop ");
130 s =
format (s,
"ucast-arp ");
146 s =
format (s,
"[%d] bd:[%d,%d], bvi:%U uu-flood:%U flags:%U locks:%d",
147 gb - gbp_bridge_domain_pool,
190 return (VNET_API_ERROR_BD_NOT_MODIFIABLE);
198 pool_get (gbp_bridge_domain_pool, gb);
199 memset (gb, 0,
sizeof (*gb));
216 if (!(flags & GBP_BD_FLAG_UU_FWD_DROP)
223 if (!(flags & GBP_BD_FLAG_MCAST_DROP)
243 (L2FIB_ENTRY_RESULT_FLAG_STATIC |
244 L2FIB_ENTRY_RESULT_FLAG_BVI));
295 pool_put (gbp_bridge_domain_pool, gb);
315 return (VNET_API_ERROR_NO_SUCH_ENTRY);
349 vnm, &bvi_sw_if_index))
352 vnm, &uu_fwd_sw_if_index))
355 vnm, &bm_flood_sw_if_index))
361 else if (
unformat (input,
"flags %d", &flags))
363 else if (
unformat (input,
"bd %d", &bd_id))
374 if (~0 == bvi_sw_if_index)
380 bm_flood_sw_if_index);
397 .path =
"gbp bridge-domain",
398 .short_help =
"gbp bridge-domain [del] bd <ID> bvi <interface>" 399 " uu-flood <interface> [flags <flags>]",
434 .path =
"show gbp bridge-domain",
435 .short_help =
"show gbp bridge-domain\n",
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
void gbp_bridge_domain_walk(gbp_bridge_domain_cb_t cb, void *ctx)
vlib_log_class_t gb_logger
logger
u32 gb_uu_fwd_sw_if_index
The BD's MAC spine-proxy interface (optional)
#define hash_set(h, key, value)
#define hash_unset(h, key)
vnet_main_t * vnet_get_main(void)
static void gbp_bridge_domain_db_add(gbp_bridge_domain_t *gb)
index_t * gbd_by_bd_index
A bridge Domain Representation.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
unformat_function_t unformat_vnet_sw_interface
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static gbp_bridge_domain_t * gbp_bridge_domain_get(index_t i)
format_function_t format_vnet_sw_if_index_name
index_t gbp_bridge_domain_index(const gbp_bridge_domain_t *gbd)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
enum gbp_bridge_domain_flags_t_ gbp_bridge_domain_flags_t
Bridge Domain Flags.
#define VLIB_INIT_FUNCTION(x)
#define clib_error_return(e, args...)
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.
static void gbp_bridge_domain_lock(index_t i)
static const u8 * vnet_sw_interface_get_hw_address(vnet_main_t *vnm, u32 sw_if_index)
static u8 * format_gbp_bridge_domain_ptr(u8 *s, va_list *args)
int gbp_bridge_domain_add_and_lock(u32 bd_id, gbp_bridge_domain_flags_t flags, u32 bvi_sw_if_index, u32 uu_fwd_sw_if_index, u32 bm_flood_sw_if_index)
void gbp_learn_enable(u32 sw_if_index, gbb_learn_mode_t mode)
static clib_error_t * gbp_bridge_domain_init(vlib_main_t *vm)
#define pool_put(P, E)
Free an object E in pool P.
u32 gb_bd_id
Bridge-domain ID.
static index_t gbp_bridge_domain_find(u32 bd_id)
gbp_bridge_domain_flags_t gb_flags
Flags conttrolling behaviour.
static clib_error_t * gbp_bridge_domain_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static int gbp_bridge_domain_show_one(gbp_bridge_domain_t *gb, void *ctx)
u32 gb_locks
locks/references to the BD so it does not get deleted (from the API) whilst it is still being used ...
u32 gb_bm_flood_sw_if_index
The BD's interface to sned Broadcast and multicast packets.
u32 l2fib_del_entry(const u8 *mac, u32 bd_index, u32 sw_if_index)
Delete an entry from the l2fib.
int(* gbp_bridge_domain_cb_t)(gbp_bridge_domain_t *gb, void *ctx)
u8 * format_gbp_bridge_domain(u8 *s, va_list *args)
static void gbp_bridge_domain_db_remove(gbp_bridge_domain_t *gb)
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.
gbp_bridge_domain_db_t gbp_bridge_domain_db
DB of bridge_domains.
gbp_bridge_domain_t * gbp_bridge_domain_pool
Pool of GBP bridge_domains.
index_t gbp_bridge_domain_find_and_lock(u32 bd_id)
#define VLIB_CLI_COMMAND(x,...)
u32 gb_bvi_sw_if_index
The BD's BVI interface (obligatory)
u8 * format_gbp_bridge_domain_flags(u8 *s, va_list *args)
int gbp_bridge_domain_delete(u32 bd_id)
static vlib_main_t * vlib_get_main(void)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
static clib_error_t * gbp_bridge_domain_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 bd_find_index(bd_main_t *bdm, u32 bd_id)
Get a bridge domain.
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
void gbp_bridge_domain_unlock(index_t index)
bd_flags
Flags that can be changed on a bridge domain.
u32 gbp_bridge_domain_get_bd_id(index_t gbdi)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
enum bd_flags_t_ bd_flags_t