27 #define GBP_LEARN_DBG(...) \ 28 vlib_log_debug (gbp_learn_main.gl_logger, __VA_ARGS__); 30 #define foreach_gbp_learn \ 35 #define _(sym,str) GBP_LEARN_ERROR_##sym, 42 #define _(sym,string) string, 49 #define _(sym,str) GBP_LEARN_NEXT_##sym, 208 u32 n_left_from, *from, *to_next, next_index, thread_index, seed;
214 n_left_from =
frame->n_vectors;
221 while (n_left_from > 0)
227 while (n_left_from > 0 && n_left_to_next > 0)
231 u32 bi0, sw_if_index0, t0;
238 next0 = GBP_LEARN_NEXT_DROP;
253 L2INPUT_FEAT_GBP_LEARN);
260 if ((
vnet_buffer2 (b0)->gbp.flags & VXLAN_GBP_GPFLAGS_D) ||
288 switch (clib_net_to_host_u16 (eh0->
type))
290 case ETHERNET_TYPE_IP4:
299 sw_if_index0, sclass0,
300 &outer_src, &outer_dst);
304 case ETHERNET_TYPE_IP6:
313 sw_if_index0, sclass0,
314 &outer_src, &outer_dst);
318 case ETHERNET_TYPE_ARP:
327 sw_if_index0, sclass0,
328 &outer_src, &outer_dst);
334 sw_if_index0, sclass0,
335 &outer_src, &outer_dst);
361 VXLAN_GBP_GPFLAGS_D);
366 to_next, n_left_to_next,
373 return frame->n_vectors;
384 s =
format (s,
"new:%d throttled:%d d-bit:%d mac:%U itf:%d sclass:%d" 395 .name =
"gbp-learn-l2",
396 .vector_size =
sizeof (
u32),
406 [GBP_LEARN_NEXT_DROP] =
"error-drop",
452 .fib_index = fib_index,
474 .fib_index = fib_index,
502 u32 n_left_from, *from, *to_next, next_index, thread_index, seed;
515 while (n_left_from > 0)
521 while (n_left_from > 0 && n_left_to_next > 0)
525 u32 bi0, sw_if_index0, t0, fib_index0;
533 next0 = GBP_LEARN_NEXT_DROP;
574 (&ip6_0->src_address), seed);
579 fib_index0, sw_if_index0, sclass0,
580 &outer_src, &outer_dst);
606 ip4_0->src_address.as_u32, seed);
611 fib_index0, sw_if_index0, sclass0,
612 &outer_src, &outer_dst);
643 to_next, n_left_to_next,
661 s =
format (s,
"new:%d throttled:%d ip:%U itf:%d sclass:%d",
685 .name =
"gbp-learn-ip4",
686 .vector_size =
sizeof (
u32),
693 .arc_name =
"ip4-unicast",
694 .node_name =
"gbp-learn-ip4",
698 .name =
"gbp-learn-ip6",
699 .vector_size =
sizeof (
u32),
706 .arc_name =
"ip6-unicast",
707 .node_name =
"gbp-learn-ip6",
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
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.
vlib_node_registration_t gbp_learn_l2_node
(constructor) VLIB_REGISTER_NODE (gbp_learn_l2_node)
gbp_endpoint_fwd_t ge_fwd
struct gbp_learn_l2_trace_t_ gbp_learn_l2_trace_t
per-packet trace data
struct gbp_learn_l3_t_ gbp_learn_l3_t
#define clib_memcpy_fast(a, b, c)
static f64 vlib_time_now(vlib_main_t *vm)
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.
A bridge Domain Representation.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static void gbp_learn_l3_cp(const gbp_learn_l3_t *gl3)
Grouping of global data for the GBP source EPG classification feature.
static_always_inline void ip46_address_set_ip6(ip46_address_t *dst, const ip6_address_t *src)
#define VLIB_NODE_FN(node)
static u32 ip6_address_hash_to_u32(const ip6_address_t *a)
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...
static void gbp_learn_l2_dp(const u8 *mac, u32 bd_index, u32 sw_if_index, sclass_t sclass, const ip4_address_t *outer_src, const ip4_address_t *outer_dst)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u32 gbp_itf_get_sw_if_index(gbp_itf_hdl_t hdl)
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)
gbp_bridge_domain_flags_t gb_flags
static void gbp_learn_l2_ip4_dp(const u8 *mac, const ip4_address_t *ip, u32 bd_index, u32 sw_if_index, sclass_t sclass, const ip4_address_t *outer_src, const ip4_address_t *outer_dst)
enum gbp_bridge_domain_flags_t_ gbp_bridge_domain_flags_t
Bridge Domain Flags.
u32 gl_l2_input_feat_next[32]
Next nodes for L2 output features.
struct gbp_learn_l3_trace_t_ gbp_learn_l3_trace_t
per-packet trace data
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)
vlib_node_registration_t gbp_learn_ip6_node
(constructor) VLIB_REGISTER_NODE (gbp_learn_ip6_node)
vl_api_fib_path_type_t type
static void gbp_learn_l2_ip6_dp(const u8 *mac, const ip6_address_t *ip, u32 bd_index, u32 sw_if_index, sclass_t sclass, const ip4_address_t *outer_src, const ip4_address_t *outer_dst)
static_always_inline void mac_address_from_bytes(mac_address_t *mac, const u8 *bytes)
vlib_node_registration_t gbp_learn_ip4_node
(constructor) VLIB_REGISTER_NODE (gbp_learn_ip4_node)
static int gbp_endpoint_update_required(const gbp_endpoint_t *ge0, u32 rx_sw_if_index, sclass_t sclass)
static u8 ip46_address_is_zero(const ip46_address_t *ip46)
static void gbp_learn_ip4_dp(const ip4_address_t *ip, u32 fib_index, u32 sw_if_index, sclass_t sclass, const ip4_address_t *outer_src, const ip4_address_t *outer_dst)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static u64 throttle_seed(throttle_t *t, u32 thread_index, f64 time_now)
static u8 * format_gbp_learn_l3_trace(u8 *s, va_list *args)
#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.
sclass_t gef_sclass
Endpoint Group's sclass.
#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).
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, sclass_t sclass, gbp_endpoint_flags_t flags, const ip46_address_t *tun_src, const ip46_address_t *tun_dst, u32 *handle)
gbp_bridge_domain_flags_t gb_flags
Flags conttrolling behaviour.
format_function_t format_ip46_address
static_always_inline gbp_endpoint_t * gbp_endpoint_find_ip6(const ip6_address_t *ip, u32 fib_index)
#define VLIB_REGISTER_NODE(x,...)
static void gbp_learn_get_outer(const ethernet_header_t *eh0, ip4_address_t *outer_src, 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)
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.
vlib_main_t vlib_node_runtime_t * node
static uword gbp_learn_l3(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, fib_protocol_t fproto)
static char * gbp_learn_error_strings[]
u8 * format_gbp_bridge_domain_flags(u8 *s, va_list *args)
throttle_t gl_l2_throttle
throttles for the DP leanring
VNET_FEATURE_INIT(gbp_learn_ip4, static)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
int gbp_endpoint_is_learnt(const gbp_endpoint_t *ge)
gbp_itf_hdl_t gef_itf
The interface on which the EP is connected.
static void gbp_learn_ip6_dp(const ip6_address_t *ip, u32 fib_index, u32 sw_if_index, sclass_t sclass, const ip4_address_t *outer_src, const ip4_address_t *outer_dst)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
static u8 * format_gbp_learn_l2_trace(u8 *s, va_list *args)
VLIB buffer representation.
struct gbp_learn_l2_t_ gbp_learn_l2_t
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define foreach_gbp_learn
#define GBP_LEARN_DBG(...)
u8 * format_mac_address_t(u8 *s, va_list *args)
vl_api_address_t ips[n_ips]
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static void ip46_address_set_ip4(ip46_address_t *ip46, const ip4_address_t *ip)
static int throttle_check(throttle_t *t, u32 thread_index, u64 hash, u64 seed)