FD.io VPP  v17.01.1-3-gc6833f8
Vector Packet Processing
mpls_lookup.c
Go to the documentation of this file.
1 /*
2  * mpls_lookup.c: MPLS lookup
3  *
4  * Copyright (c) 2012-2014 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #include <vlib/vlib.h>
19 #include <vnet/pg/pg.h>
20 #include <vnet/mpls/mpls.h>
21 #include <vnet/fib/mpls_fib.h>
22 #include <vnet/dpo/load_balance.h>
23 
25 
26 typedef struct {
33 
34 static u8 *
35 format_mpls_lookup_trace (u8 * s, va_list * args)
36 {
37  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
38  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
39  mpls_lookup_trace_t * t = va_arg (*args, mpls_lookup_trace_t *);
40 
41  s = format (s, "MPLS: next [%d], lookup fib index %d, LB index %d hash %d"
42  "label %d eos %d",
43  t->next_index, t->lfib_index, t->lb_index, t->hash,
45  clib_net_to_host_u32(t->label_net_byte_order)),
47  return s;
48 }
49 
50 /*
51  * Compute flow hash.
52  * We'll use it to select which adjacency to use for this flow. And other things.
53  */
56  flow_hash_config_t flow_hash_config)
57 {
58  // FIXME
60 }
61 
62 static inline uword
64  vlib_node_runtime_t * node,
65  vlib_frame_t * from_frame)
66 {
68  u32 n_left_from, next_index, * from, * to_next;
69  mpls_main_t * mm = &mpls_main;
70  u32 cpu_index = os_get_cpu_number();
71 
72  from = vlib_frame_vector_args (from_frame);
73  n_left_from = from_frame->n_vectors;
74  next_index = node->cached_next_index;
75 
76  while (n_left_from > 0)
77  {
78  u32 n_left_to_next;
79 
80  vlib_get_next_frame (vm, node, next_index,
81  to_next, n_left_to_next);
82 
83  while (n_left_from >= 4 && n_left_to_next >= 2)
84  {
85  u32 lbi0, next0, lfib_index0, bi0, hash_c0;
86  const mpls_unicast_header_t * h0;
87  const load_balance_t *lb0;
88  const dpo_id_t *dpo0;
89  vlib_buffer_t * b0;
90  u32 lbi1, next1, lfib_index1, bi1, hash_c1;
91  const mpls_unicast_header_t * h1;
92  const load_balance_t *lb1;
93  const dpo_id_t *dpo1;
94  vlib_buffer_t * b1;
95 
96  /* Prefetch next iteration. */
97  {
98  vlib_buffer_t * p2, * p3;
99 
100  p2 = vlib_get_buffer (vm, from[2]);
101  p3 = vlib_get_buffer (vm, from[3]);
102 
103  vlib_prefetch_buffer_header (p2, STORE);
104  vlib_prefetch_buffer_header (p3, STORE);
105 
106  CLIB_PREFETCH (p2->data, sizeof (h0[0]), STORE);
107  CLIB_PREFETCH (p3->data, sizeof (h0[0]), STORE);
108  }
109 
110  bi0 = to_next[0] = from[0];
111  bi1 = to_next[1] = from[1];
112 
113  from += 2;
114  n_left_from -= 2;
115  to_next += 2;
116  n_left_to_next -= 2;
117 
118  b0 = vlib_get_buffer (vm, bi0);
119  b1 = vlib_get_buffer (vm, bi1);
120  h0 = vlib_buffer_get_current (b0);
121  h1 = vlib_buffer_get_current (b1);
122 
123  lfib_index0 = vec_elt(mm->fib_index_by_sw_if_index,
124  vnet_buffer(b0)->sw_if_index[VLIB_RX]);
125  lfib_index1 = vec_elt(mm->fib_index_by_sw_if_index,
126  vnet_buffer(b1)->sw_if_index[VLIB_RX]);
127 
128  lbi0 = mpls_fib_table_forwarding_lookup (lfib_index0, h0);
129  lbi1 = mpls_fib_table_forwarding_lookup (lfib_index1, h1);
130  lb0 = load_balance_get(lbi0);
131  lb1 = load_balance_get(lbi1);
132 
133  hash_c0 = vnet_buffer(b0)->ip.flow_hash = 0;
134  hash_c1 = vnet_buffer(b1)->ip.flow_hash = 0;
135 
136  if (PREDICT_FALSE(lb0->lb_n_buckets > 1))
137  {
138  hash_c0 = vnet_buffer (b0)->ip.flow_hash =
140  }
141  if (PREDICT_FALSE(lb1->lb_n_buckets > 1))
142  {
143  hash_c1 = vnet_buffer (b1)->ip.flow_hash =
145  }
146 
147  ASSERT (lb0->lb_n_buckets > 0);
148  ASSERT (is_pow2 (lb0->lb_n_buckets));
149  ASSERT (lb1->lb_n_buckets > 0);
150  ASSERT (is_pow2 (lb1->lb_n_buckets));
151 
152  dpo0 = load_balance_get_bucket_i(lb0,
153  (hash_c0 &
154  (lb0->lb_n_buckets_minus_1)));
155  dpo1 = load_balance_get_bucket_i(lb1,
156  (hash_c1 &
157  (lb1->lb_n_buckets_minus_1)));
158 
159  next0 = dpo0->dpoi_next_node;
160  next1 = dpo1->dpoi_next_node;
161 
162  vnet_buffer (b0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
163  vnet_buffer (b1)->ip.adj_index[VLIB_TX] = dpo1->dpoi_index;
164 
166  (cm, cpu_index, lbi0, 1,
167  vlib_buffer_length_in_chain (vm, b0));
169  (cm, cpu_index, lbi1, 1,
170  vlib_buffer_length_in_chain (vm, b1));
171 
172  /*
173  * before we pop the label copy th values we need to maintain.
174  * The label header is in network byte order.
175  * last byte is the TTL.
176  * bits 2 to 4 inclusive are the EXP bits
177  */
178  vnet_buffer (b0)->mpls.ttl = ((char*)h0)[3];
179  vnet_buffer (b0)->mpls.exp = (((char*)h0)[2] & 0xe) >> 1;
180  vnet_buffer (b0)->mpls.first = 1;
181  vnet_buffer (b1)->mpls.ttl = ((char*)h1)[3];
182  vnet_buffer (b1)->mpls.exp = (((char*)h1)[2] & 0xe) >> 1;
183  vnet_buffer (b1)->mpls.first = 1;
184 
185  /*
186  * pop the label that was just used in the lookup
187  */
188  vlib_buffer_advance(b0, sizeof(*h0));
189  vlib_buffer_advance(b1, sizeof(*h1));
190 
192  {
193  mpls_lookup_trace_t *tr = vlib_add_trace (vm, node,
194  b0, sizeof (*tr));
195  tr->next_index = next0;
196  tr->lb_index = lbi0;
197  tr->lfib_index = lfib_index0;
198  tr->hash = hash_c0;
200  }
201 
203  {
204  mpls_lookup_trace_t *tr = vlib_add_trace (vm, node,
205  b1, sizeof (*tr));
206  tr->next_index = next1;
207  tr->lb_index = lbi1;
208  tr->lfib_index = lfib_index1;
209  tr->hash = hash_c1;
211  }
212 
213  vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
214  to_next, n_left_to_next,
215  bi0, bi1, next0, next1);
216  }
217 
218  while (n_left_from > 0 && n_left_to_next > 0)
219  {
220  u32 lbi0, next0, lfib_index0, bi0, hash_c0;
221  const mpls_unicast_header_t * h0;
222  const load_balance_t *lb0;
223  const dpo_id_t *dpo0;
224  vlib_buffer_t * b0;
225 
226  bi0 = from[0];
227  to_next[0] = bi0;
228  from += 1;
229  to_next += 1;
230  n_left_from -= 1;
231  n_left_to_next -= 1;
232 
233  b0 = vlib_get_buffer (vm, bi0);
234  h0 = vlib_buffer_get_current (b0);
235 
236  lfib_index0 = vec_elt(mm->fib_index_by_sw_if_index,
237  vnet_buffer(b0)->sw_if_index[VLIB_RX]);
238 
239  lbi0 = mpls_fib_table_forwarding_lookup(lfib_index0, h0);
240  lb0 = load_balance_get(lbi0);
241 
242  hash_c0 = vnet_buffer(b0)->ip.flow_hash = 0;
243  if (PREDICT_FALSE(lb0->lb_n_buckets > 1))
244  {
245  hash_c0 = vnet_buffer (b0)->ip.flow_hash =
247  }
248 
249  ASSERT (lb0->lb_n_buckets > 0);
250  ASSERT (is_pow2 (lb0->lb_n_buckets));
251 
252  dpo0 = load_balance_get_bucket_i(lb0,
253  (hash_c0 &
254  (lb0->lb_n_buckets_minus_1)));
255 
256  next0 = dpo0->dpoi_next_node;
257  vnet_buffer (b0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
258 
260  (cm, cpu_index, lbi0, 1,
261  vlib_buffer_length_in_chain (vm, b0));
262 
263  /*
264  * before we pop the label copy th values we need to maintain.
265  * The label header is in network byte order.
266  * last byte is the TTL.
267  * bits 2 to 4 inclusive are the EXP bits
268  */
269  vnet_buffer (b0)->mpls.ttl = ((char*)h0)[3];
270  vnet_buffer (b0)->mpls.exp = (((char*)h0)[2] & 0xe) >> 1;
271  vnet_buffer (b0)->mpls.first = 1;
272 
273  /*
274  * pop the label that was just used in the lookup
275  */
276  vlib_buffer_advance(b0, sizeof(*h0));
277 
279  {
280  mpls_lookup_trace_t *tr = vlib_add_trace (vm, node,
281  b0, sizeof (*tr));
282  tr->next_index = next0;
283  tr->lb_index = lbi0;
284  tr->lfib_index = lfib_index0;
285  tr->hash = hash_c0;
287  }
288 
289  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
290  to_next, n_left_to_next,
291  bi0, next0);
292  }
293 
294  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
295  }
297  MPLS_ERROR_PKTS_DECAP, from_frame->n_vectors);
298  return from_frame->n_vectors;
299 }
300 
301 static char * mpls_error_strings[] = {
302 #define mpls_error(n,s) s,
303 #include "error.def"
304 #undef mpls_error
305 };
306 
308  .function = mpls_lookup,
309  .name = "mpls-lookup",
310  /* Takes a vector of packets. */
311  .vector_size = sizeof (u32),
312  .n_errors = MPLS_N_ERROR,
313  .error_strings = mpls_error_strings,
314 
315  .sibling_of = "ip4-lookup",
316 
317  .format_buffer = format_mpls_header,
318  .format_trace = format_mpls_lookup_trace,
319  .unformat_buffer = unformat_mpls_header,
320 };
321 
323 
324 typedef struct {
329 
330 static u8 *
331 format_mpls_load_balance_trace (u8 * s, va_list * args)
332 {
333  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
334  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
336 
337  s = format (s, "MPLS: next [%d], LB index %d hash %d",
338  t->next_index, t->lb_index, t->hash);
339  return s;
340 }
341 
344  vlib_node_runtime_t * node,
345  vlib_frame_t * frame)
346 {
348  u32 n_left_from, n_left_to_next, * from, * to_next;
349  u32 cpu_index = os_get_cpu_number();
350  u32 next;
351 
352  from = vlib_frame_vector_args (frame);
353  n_left_from = frame->n_vectors;
354  next = node->cached_next_index;
355 
356  while (n_left_from > 0)
357  {
358  vlib_get_next_frame (vm, node, next,
359  to_next, n_left_to_next);
360 
361 
362  while (n_left_from >= 4 && n_left_to_next >= 2)
363  {
364  mpls_lookup_next_t next0, next1;
365  const load_balance_t *lb0, *lb1;
366  vlib_buffer_t * p0, *p1;
367  u32 pi0, lbi0, hc0, pi1, lbi1, hc1;
368  const mpls_unicast_header_t *mpls0, *mpls1;
369  const dpo_id_t *dpo0, *dpo1;
370 
371  /* Prefetch next iteration. */
372  {
373  vlib_buffer_t * p2, * p3;
374 
375  p2 = vlib_get_buffer (vm, from[2]);
376  p3 = vlib_get_buffer (vm, from[3]);
377 
378  vlib_prefetch_buffer_header (p2, STORE);
379  vlib_prefetch_buffer_header (p3, STORE);
380 
381  CLIB_PREFETCH (p2->data, sizeof (mpls0[0]), STORE);
382  CLIB_PREFETCH (p3->data, sizeof (mpls0[0]), STORE);
383  }
384 
385  pi0 = to_next[0] = from[0];
386  pi1 = to_next[1] = from[1];
387 
388  from += 2;
389  n_left_from -= 2;
390  to_next += 2;
391  n_left_to_next -= 2;
392 
393  p0 = vlib_get_buffer (vm, pi0);
394  p1 = vlib_get_buffer (vm, pi1);
395 
396  mpls0 = vlib_buffer_get_current (p0);
397  mpls1 = vlib_buffer_get_current (p1);
398  lbi0 = vnet_buffer (p0)->ip.adj_index[VLIB_TX];
399  lbi1 = vnet_buffer (p1)->ip.adj_index[VLIB_TX];
400 
401  lb0 = load_balance_get(lbi0);
402  lb1 = load_balance_get(lbi1);
403 
404  /*
405  * this node is for via FIBs we can re-use the hash value from the
406  * to node if present.
407  * We don't want to use the same hash value at each level in the recursion
408  * graph as that would lead to polarisation
409  */
410  hc0 = vnet_buffer (p0)->ip.flow_hash = 0;
411  hc1 = vnet_buffer (p1)->ip.flow_hash = 0;
412 
413  if (PREDICT_FALSE (lb0->lb_n_buckets > 1))
414  {
415  if (PREDICT_TRUE (vnet_buffer(p0)->ip.flow_hash))
416  {
417  hc0 = vnet_buffer(p0)->ip.flow_hash = vnet_buffer(p0)->ip.flow_hash >> 1;
418  }
419  else
420  {
421  hc0 = vnet_buffer(p0)->ip.flow_hash = mpls_compute_flow_hash(mpls0, hc0);
422  }
423  }
424  if (PREDICT_FALSE (lb1->lb_n_buckets > 1))
425  {
426  if (PREDICT_TRUE (vnet_buffer(p1)->ip.flow_hash))
427  {
428  hc1 = vnet_buffer(p1)->ip.flow_hash = vnet_buffer(p1)->ip.flow_hash >> 1;
429  }
430  else
431  {
432  hc1 = vnet_buffer(p1)->ip.flow_hash = mpls_compute_flow_hash(mpls1, hc1);
433  }
434  }
435 
436  dpo0 = load_balance_get_bucket_i(lb0, hc0 & (lb0->lb_n_buckets_minus_1));
437  dpo1 = load_balance_get_bucket_i(lb1, hc1 & (lb1->lb_n_buckets_minus_1));
438 
439  next0 = dpo0->dpoi_next_node;
440  next1 = dpo1->dpoi_next_node;
441 
442  vnet_buffer (p0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
443  vnet_buffer (p1)->ip.adj_index[VLIB_TX] = dpo1->dpoi_index;
444 
446  (cm, cpu_index, lbi0, 1,
447  vlib_buffer_length_in_chain (vm, p0));
449  (cm, cpu_index, lbi1, 1,
450  vlib_buffer_length_in_chain (vm, p1));
451 
453  {
455  p0, sizeof (*tr));
456  tr->next_index = next0;
457  tr->lb_index = lbi0;
458  tr->hash = hc0;
459  }
460 
461  vlib_validate_buffer_enqueue_x2 (vm, node, next,
462  to_next, n_left_to_next,
463  pi0, pi1, next0, next1);
464  }
465 
466  while (n_left_from > 0 && n_left_to_next > 0)
467  {
468  mpls_lookup_next_t next0;
469  const load_balance_t *lb0;
470  vlib_buffer_t * p0;
471  u32 pi0, lbi0, hc0;
472  const mpls_unicast_header_t *mpls0;
473  const dpo_id_t *dpo0;
474 
475  pi0 = from[0];
476  to_next[0] = pi0;
477  from += 1;
478  to_next += 1;
479  n_left_to_next -= 1;
480  n_left_from -= 1;
481 
482  p0 = vlib_get_buffer (vm, pi0);
483 
484  mpls0 = vlib_buffer_get_current (p0);
485  lbi0 = vnet_buffer (p0)->ip.adj_index[VLIB_TX];
486 
487  lb0 = load_balance_get(lbi0);
488 
489  hc0 = vnet_buffer (p0)->ip.flow_hash = 0;
490  if (PREDICT_FALSE (lb0->lb_n_buckets > 1))
491  {
492  if (PREDICT_TRUE (vnet_buffer(p0)->ip.flow_hash))
493  {
494  hc0 = vnet_buffer(p0)->ip.flow_hash = vnet_buffer(p0)->ip.flow_hash >> 1;
495  }
496  else
497  {
498  hc0 = vnet_buffer(p0)->ip.flow_hash = mpls_compute_flow_hash(mpls0, hc0);
499  }
500  }
501 
502  dpo0 = load_balance_get_bucket_i(lb0, hc0 & (lb0->lb_n_buckets_minus_1));
503 
504  next0 = dpo0->dpoi_next_node;
505  vnet_buffer (p0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
506 
508  (cm, cpu_index, lbi0, 1,
509  vlib_buffer_length_in_chain (vm, p0));
510 
511  vlib_validate_buffer_enqueue_x1 (vm, node, next,
512  to_next, n_left_to_next,
513  pi0, next0);
514  }
515 
516  vlib_put_next_frame (vm, node, next, n_left_to_next);
517  }
518 
519  return frame->n_vectors;
520 }
521 
523  .function = mpls_load_balance,
524  .name = "mpls-load-balance",
525  .vector_size = sizeof (u32),
526  .sibling_of = "mpls-lookup",
527 
528  .format_trace = format_mpls_load_balance_trace,
529 };
530 
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.
Definition: main.c:459
u16 lb_n_buckets
number of buckets in the load-balance.
Definition: load_balance.h:87
vlib_combined_counter_main_t lbm_to_counters
Definition: load_balance.h:45
#define CLIB_UNUSED(x)
Definition: clib.h:79
format_function_t format_mpls_header
Definition: mpls.h:95
#define PREDICT_TRUE(x)
Definition: clib.h:98
static u32 mpls_compute_flow_hash(const mpls_unicast_header_t *hdr, flow_hash_config_t flow_hash_config)
Definition: mpls_lookup.c:55
u32 * fib_index_by_sw_if_index
Definition: mpls.h:65
flow_hash_config_t lb_hash_config
the hash config to use when selecting a bucket.
Definition: load_balance.h:122
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.
Definition: buffer_funcs.h:100
#define always_inline
Definition: clib.h:84
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:194
u16 lb_n_buckets_minus_1
number of buckets in the load-balance - 1.
Definition: load_balance.h:92
static uword mpls_lookup(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: mpls_lookup.c:63
vlib_node_registration_t mpls_lookup_node
(constructor) VLIB_REGISTER_NODE (mpls_lookup_node)
Definition: mpls_lookup.c:24
mpls_lookup_next_t
Definition: mpls.h:138
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:138
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
Definition: load_balance.h:194
uword os_get_cpu_number(void)
Definition: unix-misc.c:224
The FIB DPO provieds;.
Definition: load_balance.h:83
#define PREDICT_FALSE(x)
Definition: clib.h:97
static u32 vnet_mpls_uc_get_label(mpls_label_t label_exp_s_ttl)
Definition: packet.h:77
load_balance_main_t load_balance_main
The one instance of load-balance main.
Definition: load_balance.c:55
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
Definition: buffer_node.h:70
#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.
Definition: buffer_node.h:216
#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).
Definition: node_funcs.h:350
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
Definition: node_funcs.h:1113
u16 n_vectors
Definition: node.h:344
mpls_main_t mpls_main
Definition: mpls.c:25
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:82
unformat_function_t unformat_mpls_header
Definition: mpls.h:110
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:207
vlib_combined_counter_main_t lbm_via_counters
Definition: load_balance.h:46
u16 cached_next_index
Definition: node.h:463
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.
Definition: counter.h:241
#define ASSERT(truth)
unsigned int u32
Definition: types.h:88
#define vnet_buffer(b)
Definition: buffer.h:361
static load_balance_t * load_balance_get(index_t lbi)
Definition: load_balance.h:185
static char * mpls_error_strings[]
Definition: mpls_lookup.c:301
mpls_label_t label_exp_s_ttl
Definition: packet.h:31
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
Definition: lookup.h:160
static uword mpls_load_balance(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: mpls_lookup.c:343
#define VLIB_BUFFER_IS_TRACED
Definition: buffer.h:95
static uword is_pow2(uword x)
Definition: clib.h:266
u64 uword
Definition: types.h:112
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace_funcs.h:55
#define vec_elt(v, i)
Get vector value at index i.
Definition: defs.h:47
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:154
static u32 vnet_mpls_uc_get_s(mpls_label_t label_exp_s_ttl)
Definition: packet.h:87
unsigned char u8
Definition: types.h:56
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:253
A collection of combined counters.
Definition: counter.h:212
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...
Definition: mpls_fib.h:79
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:170
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
Definition: node.h:158
static u8 * format_mpls_load_balance_trace(u8 *s, va_list *args)
Definition: mpls_lookup.c:331
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:143
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:418
u8 data[0]
Packet data.
Definition: buffer.h:158
u16 dpoi_next_node
The next VLIB node to follow.
Definition: dpo.h:150
static u8 * format_mpls_lookup_trace(u8 *s, va_list *args)
Definition: mpls_lookup.c:35
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:85
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:57
Definition: defs.h:46
vlib_node_registration_t mpls_load_balance_node
(constructor) VLIB_REGISTER_NODE (mpls_load_balance_node)
Definition: mpls_lookup.c:522