40 s =
format (s,
"MPLS: next [%d], lookup fib index %d, LB index %d " 67 u32 n_left_from, next_index, * from, * to_next;
75 while (n_left_from > 0)
80 to_next, n_left_to_next);
82 while (n_left_from > 0 && n_left_to_next > 0)
84 u32 lbi0, next0, lfib_index0, bi0, hash_c0;
124 (cm, cpu_index, lbi0, 1,
143 to_next, n_left_to_next,
150 MPLS_ERROR_PKTS_DECAP, from_frame->
n_vectors);
155 #define mpls_error(n,s) s, 162 .name =
"mpls-lookup",
164 .vector_size =
sizeof (
u32),
165 .n_errors = MPLS_N_ERROR,
168 .sibling_of =
"ip4-lookup",
189 s =
format (s,
"MPLS: next [%d], LB index %d ",
200 u32 n_left_from, n_left_to_next, * from, * to_next;
208 while (n_left_from > 0)
211 to_next, n_left_to_next);
214 while (n_left_from > 0 && n_left_to_next > 0)
218 u32 pi0, lbi0, hc0, next0;
242 (cm, cpu_index, lbi0, 1,
256 to_next, n_left_to_next);
271 .name =
"mpls-load-balance",
272 .vector_size =
sizeof (
u32),
273 .sibling_of =
"mpls-lookup",
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.
u16 lb_n_buckets
number of buckets in the load-balance.
ip_lookup_next_t
Common (IP4/IP6) next index stored in adjacency.
vlib_combined_counter_main_t lbm_to_counters
format_function_t format_mpls_header
static u32 mpls_compute_flow_hash(const mpls_unicast_header_t *hdr, flow_hash_config_t flow_hash_config)
u32 * fib_index_by_sw_if_index
flow_hash_config_t lb_hash_config
the hash config to use when selecting a bucket.
struct _vlib_node_registration vlib_node_registration_t
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u16 lb_n_buckets_minus_1
number of buckets in the load-balance - 1.
static uword mpls_lookup(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
vlib_node_registration_t mpls_lookup_node
(constructor) VLIB_REGISTER_NODE (mpls_lookup_node)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
uword os_get_cpu_number(void)
static u32 vnet_mpls_uc_get_label(mpls_label_t label_exp_s_ttl)
load_balance_main_t load_balance_main
The one instance of load-balance main.
#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).
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
unformat_function_t unformat_mpls_header
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
vlib_combined_counter_main_t lbm_via_counters
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
Increment a combined counter.
static load_balance_t * load_balance_get(index_t lbi)
static char * mpls_error_strings[]
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
static uword mpls_load_balance(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define VLIB_BUFFER_IS_TRACED
static uword is_pow2(uword x)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_elt(v, i)
Get vector value at index i.
index_t dpoi_index
the index of objects of that type
static u32 vnet_mpls_uc_get_s(mpls_label_t label_exp_s_ttl)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
A collection of combined counters.
static index_t mpls_fib_table_forwarding_lookup(u32 mpls_fib_index, const mpls_unicast_header_t *hdr)
Lookup a label and EOS bit in the MPLS_FIB table to retrieve the load-balance index to be used for pa...
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
static u8 * format_mpls_load_balance_trace(u8 *s, va_list *args)
#define VLIB_REGISTER_NODE(x,...)
u16 dpoi_next_node
The next VLIB node to follow.
static u8 * format_mpls_lookup_trace(u8 *s, va_list *args)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
vlib_node_registration_t mpls_load_balance_node
(constructor) VLIB_REGISTER_NODE (mpls_load_balance_node)