41 #define bier_error(n,s) s, 49 #define foreach_bier_lookup_next \ 50 _(DROP, "bier-drop") \ 51 _(OUTPUT, "bier-output") 54 #define _(s,n) BIER_LOOKUP_NEXT_##s, 61 #define bier_error(n,s) BIER_LOOKUP_ERROR_##n, 84 u32 n_left_from, next_index, * from, * to_next;
91 next_index = BIER_LOOKUP_NEXT_DROP;
93 while (n_left_from > 0)
98 to_next, n_left_to_next);
100 while (n_left_from > 0 && n_left_to_next > 0)
102 u32 next0, bi0, n_bytes, bti0, bfmi0;
105 u16 index, num_buckets;
124 next0 = BIER_LOOKUP_NEXT_DROP;
143 num_buckets = n_bytes /
sizeof(int);
158 for (index = 0; index < num_buckets; index++) {
166 fbs += (((num_buckets - 1) - index) *
195 next0 = BIER_LOOKUP_NEXT_OUTPUT;
204 BIER_LOOKUP_ERROR_FMASK_UNRES, 1);
216 u16 num_cloned, clone;
232 BIER_LOOKUP_ERROR_BUFFER_ALLOCATION_FAILURE, 1);
235 for (clone = 0; clone < num_cloned; clone++)
258 c0->
flags |= VLIB_BUFFER_IS_TRACED;
262 to_next, n_left_to_next,
277 to_next, n_left_to_next);
286 next0 = BIER_LOOKUP_NEXT_DROP;
302 to_next, n_left_to_next,
311 BIER_LOOKUP_ERROR_NONE,
323 s =
format (s,
"BIER: next [%d], tbl:%d BFM:%d",
332 .name =
"bier-lookup",
334 .vector_size =
sizeof (
u32),
342 [BIER_LOOKUP_NEXT_DROP] =
"bier-drop",
343 [BIER_LOOKUP_NEXT_OUTPUT] =
"bier-output",
356 for (thread_index = 0;
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
vlib_node_registration_t bier_lookup_node
(constructor) VLIB_REGISTER_NODE (bier_lookup_node)
struct bier_lookup_trace_t_ bier_lookup_trace_t
Packet trace recoed for a BIER lookup.
static bier_fmask_t * bier_fmask_get(u32 index)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static void bier_bit_string_clear_string(const bier_bit_string_t *src, bier_bit_string_t *dest)
static bier_lookup_main_t bier_lookup_main
Single instance of the lookup main.
static bier_table_t * bier_table_get(index_t bti)
bier_fmask_bits_t bfm_bits
The bits, and their ref counts, that are set on this mask This mask changes as BIER entries link to a...
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
u16 bbs_len
The length of the string in BYTES.
static void vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
static int bier_find_first_bit_string_set(int mask)
A Variable length BitString.
#define VLIB_INIT_FUNCTION(x)
int bier_table_is_main(const bier_table_t *bt)
u32 bier_bp_t
A bit positon as assigned to egress PEs.
bier_hdr_len_id_t bti_hdr_len
The size of the bit string processed by this table.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static const index_t bier_table_fwd_lookup(const bier_table_t *bt, bier_bp_t bp)
void bier_bit_string_clear_bit(bier_bit_string_t *bit_string, bier_bp_t bp)
u32 node_index
Node index.
#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).
Struct maintining the per-worker thread data for BIER lookups.
#define foreach_bier_lookup_next
static uword bier_lookup(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define VLIB_REGISTER_NODE(x,...)
static u16 vlib_buffer_clone(vlib_main_t *vm, u32 src_buffer, u32 *buffers, u16 n_buffers, u16 head_end_offset)
Create multiple clones of buffer and store them in the supplied array.
static_always_inline uword vlib_get_thread_index(void)
#define BIER_BIT_MASK_BITS_PER_INT
u32 bier_hdr_len_id_to_num_buckets(bier_hdr_len_id_t id)
Conversion functions for the enumerated bit-string length values, to bit and bytes.
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.
static void bier_bit_string_init(bier_bit_string_t *bbs, bier_hdr_len_id_t len, bier_bit_mask_bucket_t *buckets)
Packet trace recoed for a BIER lookup.
static u8 * format_bier_lookup_trace(u8 *s, va_list *args)
bier_bit_mask_bucket_t * bbs_buckets
The buckets in the string.
struct bier_lookup_main_t_ bier_lookup_main_t
Struct maintining the per-worker thread data for BIER lookups.
bier_bit_mask_bucket_t bh_bit_string[0]
The variable length bit-string.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
bier_table_id_t bt_id
The identity/key or the table.
A BIER header of variable length The encoding follows: https://tools.ietf.org/html/draft-ietf-bier-mp...
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
A BIER Table is the bit-indexed forwarding table.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
bier_bit_string_t bfmb_input_reset_string
each bit in the mask needs to be reference counted and set/cleared on the 0->1 and 1->0 transitions...
static u32 vlib_num_workers()
clib_error_t * bier_lookup_module_init(vlib_main_t *vm)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
u8 bier_bit_mask_bucket_t
A bucket is a byte.
static char * bier_lookup_error_strings[]
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.