51 #define GBP_ENDPOINT_HASH_LEARN_RATE (1e-2) 55 #define GBP_LEARN_DBG(...) \ 56 vlib_log_debug (gbp_learn_main.gl_logger, __VA_ARGS__); 58 #define foreach_gbp_learn \ 63 #define _(sym,str) GBP_LEARN_ERROR_##sym, 70 #define _(sym,string) string, 77 #define _(sym,str) GBP_LEARN_NEXT_##sym, 131 .bd_index = bd_index,
134 .outer_src.ip4 = *outer_src,
135 .outer_dst.ip4 = *outer_dst,
153 .bd_index = bd_index,
156 .outer_src.ip4 = *outer_src,
157 .outer_dst.ip4 = *outer_dst,
172 .bd_index = bd_index,
174 .outer_src.ip4 = *outer_src,
175 .outer_dst.ip4 = *outer_dst,
218 u32 n_left_from, *from, *to_next, next_index, thread_index, seed;
231 while (n_left_from > 0)
237 while (n_left_from > 0 && n_left_to_next > 0)
240 u32 bi0, sw_if_index0, t0, epg0;
247 next0 = GBP_LEARN_NEXT_DROP;
262 L2INPUT_FEAT_GBP_LEARN);
269 if ((
vnet_buffer2 (b0)->gbp.flags & VXLAN_GBP_GPFLAGS_D) ||
291 switch (clib_net_to_host_u16 (eh0->
type))
293 case ETHERNET_TYPE_IP4:
303 &outer_src, &outer_dst);
307 case ETHERNET_TYPE_IP6:
317 &outer_src, &outer_dst);
325 &outer_src, &outer_dst);
350 VXLAN_GBP_GPFLAGS_D);
355 to_next, n_left_to_next,
373 s =
format (s,
"new:%d throttled:%d d-bit:%d mac:%U itf:%d epg:%d",
383 .name =
"gbp-learn-l2",
384 .vector_size =
sizeof (
u32),
394 [GBP_LEARN_NEXT_DROP] =
"error-drop",
442 .fib_index = fib_index,
444 .outer_src.ip4 = *outer_src,
445 .outer_dst.ip4 = *outer_dst,
464 .fib_index = fib_index,
466 .outer_src.ip4 = *outer_src,
467 .outer_dst.ip4 = *outer_dst,
492 u32 n_left_from, *from, *to_next, next_index, thread_index, seed;
505 while (n_left_from > 0)
511 while (n_left_from > 0 && n_left_to_next > 0)
513 u32 bi0, sw_if_index0, t0, epg0, fib_index0;
522 next0 = GBP_LEARN_NEXT_DROP;
562 (&ip6_0->src_address), seed);
567 fib_index0, sw_if_index0, epg0,
568 &outer_src, &outer_dst);
593 ip4_0->src_address.as_u32, seed);
598 fib_index0, sw_if_index0, epg0,
599 &outer_src, &outer_dst);
630 to_next, n_left_to_next,
648 s =
format (s,
"new:%d throttled:%d ip:%U itf:%d epg:%d",
673 .name =
"gbp-learn-ip4",
674 .vector_size =
sizeof (
u32),
683 .arc_name =
"ip4-unicast",
684 .node_name =
"gbp-learn-ip4",
689 .name =
"gbp-learn-ip6",
690 .vector_size =
sizeof (
u32),
699 .arc_name =
"ip6-unicast",
700 .node_name =
"gbp-learn-ip6",
713 "gbp-learn-ip4", sw_if_index, 1, 0, 0);
715 "gbp-learn-ip6", sw_if_index, 1, 0, 0);
727 "gbp-learn-ip4", sw_if_index, 0, 0, 0);
729 "gbp-learn-ip6", sw_if_index, 0, 0, 0);
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
struct gbp_learn_l3_trace_t_ gbp_learn_l3_trace_t
per-packet trace data
static void gbp_learn_l2_cp(const gbp_learn_l2_t *gl2)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
static gbp_bridge_domain_t * gbp_bridge_domain_get_by_bd_index(u32 bd_index)
f64 ge_last_time
The last time a packet from seen from this end point.
A Group Based Policy Endpoint.
VNET_FEATURE_INIT(gbp_learn_ip4, static)
gbp_endpoint_fwd_t ge_fwd
static uword gbp_learn_ip4(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
struct gbp_learn_main_t_ gbp_learn_main_t
Grouping of global data for the GBP source EPG classification feature.
static u8 * format_gbp_learn_l2_trace(u8 *s, va_list *args)
#define clib_memcpy_fast(a, b, c)
static f64 vlib_time_now(vlib_main_t *vm)
index_t gef_itf
The interface on which the EP is connected.
u32 fib_table_get_index_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the index of the FIB bound to the interface.
static uword gbp_learn_ip6(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
A bridge Domain Representation.
void throttle_init(throttle_t *t, u32 n_threads, f64 time)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Grouping of global data for the GBP source EPG classification feature.
static void gbp_learn_ip6_dp(const ip6_address_t *ip, u32 fib_index, u32 sw_if_index, epg_id_t epg, const ip4_address_t *outer_src, const ip4_address_t *outer_dst)
static u32 ip6_address_hash_to_u32(const ip6_address_t *a)
vlib_node_registration_t gbp_learn_ip4_node
(constructor) VLIB_REGISTER_NODE (gbp_learn_ip4_node)
static u32 vnet_l2_feature_next(vlib_buffer_t *b, u32 *next_nodes, u32 feat_bit)
Return the graph node index for the feature corresponding to the next set bit after clearing the curr...
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static gbp_learn_main_t gbp_learn_main
throttle_t gl_l3_throttle
static_always_inline gbp_endpoint_t * gbp_endpoint_find_ip4(const ip4_address_t *ip, u32 fib_index)
static uword gbp_learn_l3(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, fib_protocol_t fproto)
vlib_log_class_t gl_logger
logger - VLIB log class
#define VLIB_INIT_FUNCTION(x)
u32 gl_l2_input_feat_next[32]
Next nodes for L2 output features.
static void gbp_learn_l2_ip6_dp(const u8 *mac, const ip6_address_t *ip, u32 bd_index, u32 sw_if_index, epg_id_t epg, const ip4_address_t *outer_src, const ip4_address_t *outer_dst)
static_always_inline gbp_endpoint_t * gbp_endpoint_find_mac(const u8 *mac, u32 bd_index)
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
static void gbp_learn_l2_dp(const u8 *mac, u32 bd_index, u32 sw_if_index, epg_id_t epg, const ip4_address_t *outer_src, const ip4_address_t *outer_dst)
int gbp_endpoint_update_and_lock(gbp_endpoint_src_t src, u32 sw_if_index, const ip46_address_t *ips, const mac_address_t *mac, index_t gbdi, index_t grdi, epg_id_t epg_id, gbp_endpoint_flags_t flags, const ip46_address_t *tun_src, const ip46_address_t *tun_dst, u32 *handle)
void gbp_learn_enable(u32 sw_if_index, gbb_learn_mode_t mode)
static_always_inline void mac_address_from_bytes(mac_address_t *mac, const u8 *bytes)
static u8 * format_gbp_learn_l3_trace(u8 *s, va_list *args)
static uword gbp_learn_l2(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vlib_node_registration_t gbp_learn_ip6_node
(constructor) VLIB_REGISTER_NODE (gbp_learn_ip6_node)
static u64 throttle_seed(throttle_t *t, u32 thread_index, f64 time_now)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
A throttle Used in the data plane to decide if a given hash should be throttled, i.e.
vlib_thread_main_t vlib_thread_main
gbp_bridge_domain_flags_t gb_flags
Flags conttrolling behaviour.
#define GBP_LEARN_DBG(...)
static_always_inline gbp_endpoint_t * gbp_endpoint_find_ip6(const ip6_address_t *ip, u32 fib_index)
#define VLIB_REGISTER_NODE(x,...)
vlib_node_registration_t gbp_learn_l2_node
(constructor) VLIB_REGISTER_NODE (gbp_learn_l2_node)
enum gbp_learn_mode_t_ gbb_learn_mode_t
static void gbp_learn_ip4_dp(const ip4_address_t *ip, u32 fib_index, u32 sw_if_index, epg_id_t epg, const ip4_address_t *outer_src, const ip4_address_t *outer_dst)
#define vec_free(V)
Free vector's memory (no header).
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static void feat_bitmap_init_next_nodes(vlib_main_t *vm, u32 node_index, u32 num_features, char **feat_names, u32 *next_nodes)
Initialize the feature next-node indexes of a graph node.
static clib_error_t * gbp_learn_init(vlib_main_t *vm)
struct gbp_learn_l2_t_ gbp_learn_l2_t
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
#define ip46_address_set_ip4(ip46, ip)
throttle_t gl_l2_throttle
throttles for the DP leanring
static void gbp_learn_l3_cp(const gbp_learn_l3_t *gl3)
static_always_inline void ip46_address_set_ip6(ip46_address_t *dst, const ip6_address_t *src)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
VLIB_NODE_FUNCTION_MULTIARCH(gbp_learn_l2_node, gbp_learn_l2)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
void gbp_learn_disable(u32 sw_if_index, gbb_learn_mode_t mode)
struct gbp_learn_l3_t_ gbp_learn_l3_t
vl_api_gbp_vxlan_tunnel_mode_t mode
struct gbp_learn_l2_trace_t_ gbp_learn_l2_trace_t
per-packet trace data
u8 * format_mac_address_t(u8 *s, va_list *args)
vl_api_address_t ips[n_ips]
static void gbp_learn_l2_ip4_dp(const u8 *mac, const ip4_address_t *ip, u32 bd_index, u32 sw_if_index, epg_id_t epg, const ip4_address_t *outer_src, const ip4_address_t *outer_dst)
static void gbp_learn_get_outer(const ethernet_header_t *eh0, ip4_address_t *outer_src, ip4_address_t *outer_dst)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
#define GBP_ENDPOINT_HASH_LEARN_RATE
The maximum learning rate per-hashed EP.
#define ip46_address_is_zero(ip46)
static char * gbp_learn_error_strings[]
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
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 foreach_gbp_learn
static int throttle_check(throttle_t *t, u32 thread_index, u64 hash, u64 seed)