20 #define foreach_gbp_itf_mode \ 26 #define _(s,v) GBP_ITF_MODE_##s, 83 #define _(s,v,a) [GBP_ITF_L3_FEAT_POS_##s] = a, 89 #define _(s,v,a) [GBP_ITF_L3_FEAT_POS_##s] = v, 100 if (flags & GBP_ITF_L3_FEAT_##a) \ 101 s = format (s, "%s ", b); 299 if (GBP_ITF_MODE_L2 == gi->
gi_mode)
328 memset (gi, 0,
sizeof (*gi));
337 u32 diff_fb, new_fb, *fb, feat;
342 if (NULL == gi || GBP_ITF_MODE_L3 != gi->
gi_mode)
384 u32 diff_fb, new_fb, *fb, feat;
389 if (NULL == gi || GBP_ITF_MODE_L2 != gi->
gi_mode)
430 u32 diff_fb, new_fb, *fb, feat;
435 if (NULL == gi || GBP_ITF_MODE_L2 != gi->
gi_mode)
481 case GBP_ITF_MODE_##a: \ 482 return format(s, "%s", v); 496 return (
format (s,
"unset"));
500 s =
format (s,
"%U locks:%d mode:%U ",
505 if (GBP_ITF_MODE_L2 == gi->
gi_mode)
506 s =
format (s,
"gbp-bd:%d input-feats:[%U] output-feats:[%U]",
511 s =
format (s,
"gbp-rd:%d input-feats:[%U] output-feats:[%U]",
528 return format (s,
"INVALID");
560 .path =
"show gbp interface",
561 .short_help =
"show gbp interface\n",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
void gbp_bridge_domain_itf_add(index_t gbdi, u32 sw_if_index, l2_bd_port_type_t type)
void gbp_bridge_domain_itf_del(index_t gbdi, u32 sw_if_index, l2_bd_port_type_t type)
u32 grd_table_id[FIB_PROTOCOL_IP_MAX]
#define hash_set(h, key, value)
void(* gbp_itf_free_fn_t)(u32 sw_if_index)
#define hash_unset(h, key)
static gbp_itf_hdl_t gbp_itf_mk_hdl(gbp_itf_t *gi)
vnet_main_t * vnet_get_main(void)
gbp_itf_hdl_t gbp_itf_l3_add_and_lock(u32 sw_if_index, index_t gri)
u8 * format_l2_output_features(u8 *s, va_list *args)
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
void gbp_itf_l2_set_output_feature(gbp_itf_hdl_t gh, l2output_feat_masks_t feats)
u32 gi_sw_if_index
The interface this wrapper is managing.
static gbp_itf_t * gbp_itf_pool
gbp_itf_mode_t gi_mode
The mode of the interface.
void gbp_itf_unlock(gbp_itf_hdl_t *gh)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
enum gbp_itf_l3_feat_t_ gbp_itf_l3_feat_t
static gbp_itf_hdl_t gbp_itf_l2_add_and_lock_i(u32 sw_if_index, index_t gbi, gbp_itf_free_fn_t ff)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static const char * gbp_itf_feat_bit_pos_to_arc[]
static u8 * format_gbp_itf_mode(u8 *s, va_list *args)
format_function_t format_vnet_sw_if_index_name
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
#define foreach_set_bit(var, mask, body)
u32 gbp_itf_get_sw_if_index(gbp_itf_hdl_t hdl)
int ip_table_bind(fib_protocol_t fproto, u32 sw_if_index, u32 table_id, u8 is_api)
vl_api_interface_index_t sw_if_index
struct gbp_itf_t_ gbp_itf_t
Attributes and configurations attached to interfaces by GBP.
u8 * format_gbp_itf_l3_feat(u8 *s, va_list *args)
#define foreach_gbp_itf_mode
u32 gi_locks
Number of references to this interface.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void ip4_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
static gbp_itf_t * gbp_itf_find_hdl(gbp_itf_hdl_t gh)
u32 * gi_input_fbs
L2/L3 Features configured by each user.
gbp_itf_hdl_t gbp_itf_l2_add_and_lock_w_free(u32 sw_if_index, index_t gbi, gbp_itf_free_fn_t ff)
static uword * gbp_itf_db
static gbp_itf_t * gbp_itf_get(index_t gii)
void l2output_intf_bitmap_enable(u32 sw_if_index, l2output_feat_masks_t feature_bitmap, u32 enable)
Enable (or disable) the feature in the bitmap for the given interface.
u32 gi_gbi
GBP BD or RD index.
void gbp_itf_hdl_reset(gbp_itf_hdl_t *gh)
bool gbp_itf_hdl_is_valid(gbp_itf_hdl_t gh)
#define pool_free(p)
Free a pool.
gbp_itf_hdl_t gbp_itf_l3_add_and_lock_w_free(u32 sw_if_index, index_t gri, gbp_itf_free_fn_t ff)
Attributes and configurations attached to interfaces by GBP.
gbp_itf_hdl_t gbp_itf_l2_add_and_lock(u32 sw_if_index, index_t gbi)
#define vec_free(V)
Free vector's memory (no header).
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
vl_api_vxlan_gbp_api_tunnel_mode_t mode
#define VLIB_CLI_COMMAND(x,...)
gbp_route_domain_t * gbp_route_domain_get(index_t i)
void gbp_itf_lock(gbp_itf_hdl_t gh)
u8 * format_gbp_itf_hdl(u8 *s, va_list *args)
static const char * gbp_itf_feat_bit_pos_to_feat[]
gbp_itf_hdl_t gbp_itf_l3_add_and_lock_i(u32 sw_if_index, index_t gri, gbp_itf_free_fn_t ff)
static clib_error_t * gbp_itf_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void gbp_itf_l3_set_input_feature(gbp_itf_hdl_t gh, gbp_itf_l3_feat_t feats)
void gbp_itf_l2_set_input_feature(gbp_itf_hdl_t gh, l2input_feat_masks_t feats)
A route Domain Representation.
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
static u8 * format_gbp_itf(u8 *s, va_list *args)
gbp_itf_hdl_t gbp_itf_clone_and_lock(gbp_itf_hdl_t gh)
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
static const gbp_itf_hdl_t GBP_ITF_HDL_INVALID
#define vec_foreach(var, vec)
Vector iterator.
#define pool_foreach_index(i, v, body)
Iterate pool by index.
gbp_itf_free_fn_t gi_free_fn
function to call when the interface is deleted.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
u32 * gi_users
Users of this interface - this is encoded in the user's handle.
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
enum gbp_ift_mode_t_ gbp_itf_mode_t
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)
static gbp_itf_t * gbp_itf_find(u32 sw_if_index)