FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
lookup_dpo.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <vnet/ip/ip.h>
17 #include <vnet/dpo/lookup_dpo.h>
19 #include <vnet/mpls/mpls_lookup.h>
20 #include <vnet/fib/fib_table.h>
21 #include <vnet/fib/ip4_fib.h>
22 #include <vnet/fib/ip6_fib.h>
23 #include <vnet/fib/mpls_fib.h>
24 #include <vnet/mfib/mfib_table.h>
25 #include <vnet/mfib/ip4_mfib.h>
26 #include <vnet/mfib/ip6_mfib.h>
27 
28 static const char *const lookup_input_names[] = LOOKUP_INPUTS;
29 static const char *const lookup_cast_names[] = LOOKUP_CASTS;
30 
31 /**
32  * If a packet encounters a lookup DPO more than the many times
33  * then we assume there is a loop in the forward graph and drop the packet
34  */
35 #define MAX_LUKPS_PER_PACKET 4
36 
37 /**
38  * @brief Enumeration of the lookup subtypes
39  */
40 typedef enum lookup_sub_type_t_
41 {
47 #define LOOKUP_SUB_TYPE_NUM (LOOKUP_SUB_TYPE_DST_TABLE_FROM_INTERFACE+1)
48 
49 #define FOR_EACH_LOOKUP_SUB_TYPE(_st) \
50  for (_st = LOOKUP_SUB_TYPE_IP4_SRC; _st < LOOKUP_SUB_TYPE_NUM; _st++)
51 
52 /**
53  * @brief pool of all MPLS Label DPOs
54  */
56 
57 /**
58  * @brief An array of registered DPO type values for the sub-types
59  */
61 
62 static lookup_dpo_t *
64 {
65  lookup_dpo_t *lkd;
66  vlib_main_t *vm;
67  u8 did_barrier_sync;
68 
69  dpo_pool_barrier_sync (vm, lookup_dpo_pool, did_barrier_sync);
71  dpo_pool_barrier_release (vm, did_barrier_sync);
72 
73  return (lkd);
74 }
75 
76 static index_t
78 {
79  return (lkd - lookup_dpo_pool);
80 }
81 
82 static void
85  lookup_cast_t cast,
86  lookup_input_t input,
87  lookup_table_t table_config,
88  dpo_id_t *dpo)
89 {
90  lookup_dpo_t *lkd;
92 
93  lkd = lookup_dpo_alloc();
94  lkd->lkd_fib_index = fib_index;
95  lkd->lkd_proto = proto;
96  lkd->lkd_input = input;
97  lkd->lkd_table = table_config;
98  lkd->lkd_cast = cast;
99 
100  /*
101  * use the input type to select the lookup sub-type
102  */
103  type = 0;
104 
105  switch (input)
106  {
109  break;
111  switch (table_config)
112  {
115  break;
118  break;
119  }
120  if (LOOKUP_MULTICAST == cast)
121  {
123  }
124  }
125 
126  if (0 == type)
127  {
128  dpo_reset(dpo);
129  }
130  else
131  {
132  dpo_set(dpo, type, proto, lookup_dpo_get_index(lkd));
133  }
134 }
135 
136 void
139  lookup_cast_t cast,
140  lookup_input_t input,
141  lookup_table_t table_config,
142  dpo_id_t *dpo)
143 {
144  if (LOOKUP_TABLE_FROM_CONFIG == table_config)
145  {
146  if (LOOKUP_UNICAST == cast)
147  {
148  fib_table_lock(fib_index,
150  FIB_SOURCE_RR);
151  }
152  else
153  {
154  mfib_table_lock(fib_index,
157  }
158  }
159  lookup_dpo_add_or_lock_i(fib_index, proto, cast, input, table_config, dpo);
160 }
161 
162 void
165  lookup_cast_t cast,
166  lookup_input_t input,
167  lookup_table_t table_config,
168  dpo_id_t *dpo)
169 {
171 
172  if (LOOKUP_TABLE_FROM_CONFIG == table_config)
173  {
174  if (LOOKUP_UNICAST == cast)
175  {
176  fib_index =
178  table_id,
179  FIB_SOURCE_RR);
180  }
181  else
182  {
183  fib_index =
185  table_id,
187  }
188  }
189 
190  ASSERT(FIB_NODE_INDEX_INVALID != fib_index);
191  lookup_dpo_add_or_lock_i(fib_index, proto, cast, input, table_config, dpo);
192 }
193 
194 u8*
195 format_lookup_dpo (u8 *s, va_list *args)
196 {
197  index_t index = va_arg (*args, index_t);
198  lookup_dpo_t *lkd;
199 
200  lkd = lookup_dpo_get(index);
201 
203  {
204  s = format(s, "%s,%s lookup in interface's %U table",
208  }
209  else
210  {
211  if (LOOKUP_UNICAST == lkd->lkd_cast)
212  {
213  s = format(s, "%s,%s lookup in %U",
218  }
219  else
220  {
221  s = format(s, "%s,%s lookup in %U",
226  }
227  }
228  return (s);
229 }
230 
231 static void
233 {
234  lookup_dpo_t *lkd;
235 
236  lkd = lookup_dpo_get(dpo->dpoi_index);
237 
238  lkd->lkd_locks++;
239 }
240 
241 static void
243 {
244  lookup_dpo_t *lkd;
245 
246  lkd = lookup_dpo_get(dpo->dpoi_index);
247 
248  lkd->lkd_locks--;
249 
250  if (0 == lkd->lkd_locks)
251  {
253  {
254  if (LOOKUP_UNICAST == lkd->lkd_cast)
255  {
258  FIB_SOURCE_RR);
259  }
260  else
261  {
265  }
266  }
268  }
269 }
270 
271 always_inline void
272 ip4_src_fib_lookup_one (u32 src_fib_index0,
273  const ip4_address_t * addr0,
274  u32 * src_adj_index0)
275 {
276  ip4_fib_mtrie_leaf_t leaf0;
277  ip4_fib_mtrie_t * mtrie0;
278 
279  mtrie0 = &ip4_fib_get (src_fib_index0)->mtrie;
280 
281  leaf0 = ip4_fib_mtrie_lookup_step_one (mtrie0, addr0);
282  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, addr0, 2);
283  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, addr0, 3);
284 
285  src_adj_index0[0] = ip4_fib_mtrie_leaf_get_adj_index (leaf0);
286 }
287 
288 always_inline void
289 ip4_src_fib_lookup_two (u32 src_fib_index0,
290  u32 src_fib_index1,
291  const ip4_address_t * addr0,
292  const ip4_address_t * addr1,
293  u32 * src_adj_index0,
294  u32 * src_adj_index1)
295 {
296  ip4_fib_mtrie_leaf_t leaf0, leaf1;
297  ip4_fib_mtrie_t * mtrie0, * mtrie1;
298 
299  mtrie0 = &ip4_fib_get (src_fib_index0)->mtrie;
300  mtrie1 = &ip4_fib_get (src_fib_index1)->mtrie;
301 
302  leaf0 = ip4_fib_mtrie_lookup_step_one (mtrie0, addr0);
303  leaf1 = ip4_fib_mtrie_lookup_step_one (mtrie1, addr1);
304 
305  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, addr0, 2);
306  leaf1 = ip4_fib_mtrie_lookup_step (mtrie1, leaf1, addr1, 2);
307 
308  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, addr0, 3);
309  leaf1 = ip4_fib_mtrie_lookup_step (mtrie1, leaf1, addr1, 3);
310 
311  src_adj_index0[0] = ip4_fib_mtrie_leaf_get_adj_index (leaf0);
312  src_adj_index1[0] = ip4_fib_mtrie_leaf_get_adj_index (leaf1);
313 }
314 
315 /**
316  * @brief Lookup trace data
317  */
318 typedef struct lookup_trace_t_
319 {
320  union {
321  ip46_address_t addr;
323  };
327 
328 
333  int input_src_addr,
334  int table_from_interface)
335 {
336  u32 n_left_from, next_index, * from, * to_next;
339 
341  n_left_from = from_frame->n_vectors;
342 
343  next_index = node->cached_next_index;
344 
345  while (n_left_from > 0)
346  {
347  u32 n_left_to_next;
348 
349  vlib_get_next_frame(vm, node, next_index, to_next, n_left_to_next);
350 
351  while (n_left_from >= 4 && n_left_to_next > 2)
352  {
353  u32 bi0, lkdi0, lbi0, fib_index0, next0, hash_c0;
354  flow_hash_config_t flow_hash_config0;
355  const ip4_address_t *input_addr0;
356  const load_balance_t *lb0;
357  const lookup_dpo_t * lkd0;
358  const ip4_header_t * ip0;
359  const dpo_id_t *dpo0;
360  vlib_buffer_t * b0;
361  u32 bi1, lkdi1, lbi1, fib_index1, next1, hash_c1;
362  flow_hash_config_t flow_hash_config1;
363  const ip4_address_t *input_addr1;
364  const load_balance_t *lb1;
365  const lookup_dpo_t * lkd1;
366  const ip4_header_t * ip1;
367  const dpo_id_t *dpo1;
368  vlib_buffer_t * b1;
369 
370  /* Prefetch next iteration. */
371  {
372  vlib_buffer_t * p2, * p3;
373 
374  p2 = vlib_get_buffer (vm, from[2]);
375  p3 = vlib_get_buffer (vm, from[3]);
376 
377  vlib_prefetch_buffer_header (p2, LOAD);
378  vlib_prefetch_buffer_header (p3, LOAD);
379 
382  }
383 
384  bi0 = from[0];
385  to_next[0] = bi0;
386  bi1 = from[1];
387  to_next[1] = bi1;
388  from += 2;
389  to_next += 2;
390  n_left_from -= 2;
391  n_left_to_next -= 2;
392 
393  b0 = vlib_get_buffer (vm, bi0);
394  ip0 = vlib_buffer_get_current (b0);
395  b1 = vlib_get_buffer (vm, bi1);
396  ip1 = vlib_buffer_get_current (b1);
397 
398  /* dst lookup was done by ip4 lookup */
399  lkdi0 = vnet_buffer(b0)->ip.adj_index[VLIB_TX];
400  lkdi1 = vnet_buffer(b1)->ip.adj_index[VLIB_TX];
401  lkd0 = lookup_dpo_get(lkdi0);
402  lkd1 = lookup_dpo_get(lkdi1);
403 
404  /*
405  * choose between a lookup using the fib index in the DPO
406  * or getting the FIB index from the interface.
407  */
408  if (table_from_interface)
409  {
410  fib_index0 =
413  fib_index1 =
416  }
417  else
418  {
419  fib_index0 = lkd0->lkd_fib_index;
420  fib_index1 = lkd1->lkd_fib_index;
421  }
422 
423  /*
424  * choose between a source or destination address lookup in the table
425  */
426  if (input_src_addr)
427  {
428  input_addr0 = &ip0->src_address;
429  input_addr1 = &ip1->src_address;
430  }
431  else
432  {
433  input_addr0 = &ip0->dst_address;
434  input_addr1 = &ip1->dst_address;
435  }
436 
437  /* do lookup */
438  ip4_src_fib_lookup_two (fib_index0, fib_index1,
439  input_addr0, input_addr1,
440  &lbi0, &lbi1);
441  lb0 = load_balance_get(lbi0);
442  lb1 = load_balance_get(lbi1);
443 
444  vnet_buffer(b0)->sw_if_index[VLIB_TX] = fib_index0;
445  vnet_buffer(b1)->sw_if_index[VLIB_TX] = fib_index1;
446 
447  /* Use flow hash to compute multipath adjacency. */
448  hash_c0 = vnet_buffer (b0)->ip.flow_hash = 0;
449  hash_c1 = vnet_buffer (b1)->ip.flow_hash = 0;
450 
451  if (PREDICT_FALSE (lb0->lb_n_buckets > 1))
452  {
453  flow_hash_config0 = lb0->lb_hash_config;
454  hash_c0 = vnet_buffer (b0)->ip.flow_hash =
455  ip4_compute_flow_hash (ip0, flow_hash_config0);
456  }
457 
458  if (PREDICT_FALSE (lb1->lb_n_buckets > 1))
459  {
460  flow_hash_config1 = lb1->lb_hash_config;
461  hash_c1 = vnet_buffer (b1)->ip.flow_hash =
462  ip4_compute_flow_hash (ip1, flow_hash_config1);
463  }
464 
465  dpo0 = load_balance_get_bucket_i(lb0,
466  (hash_c0 &
467  (lb0->lb_n_buckets_minus_1)));
468  dpo1 = load_balance_get_bucket_i(lb1,
469  (hash_c1 &
470  (lb1->lb_n_buckets_minus_1)));
471 
472  next0 = dpo0->dpoi_next_node;
473  next1 = dpo1->dpoi_next_node;
474  vnet_buffer(b0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
475  vnet_buffer(b1)->ip.adj_index[VLIB_TX] = dpo1->dpoi_index;
476 
478  (cm, thread_index, lbi0, 1,
481  (cm, thread_index, lbi1, 1,
483 
484  if (!(b0->flags & VNET_BUFFER_F_LOOP_COUNTER_VALID)) {
485  vnet_buffer2(b0)->loop_counter = 0;
486  b0->flags |= VNET_BUFFER_F_LOOP_COUNTER_VALID;
487  }
488  if (!(b1->flags & VNET_BUFFER_F_LOOP_COUNTER_VALID)) {
489  vnet_buffer2(b1)->loop_counter = 0;
490  b1->flags |= VNET_BUFFER_F_LOOP_COUNTER_VALID;
491  }
492 
493  vnet_buffer2(b0)->loop_counter++;
494  vnet_buffer2(b1)->loop_counter++;
495 
496  if (PREDICT_FALSE(vnet_buffer2(b0)->loop_counter > MAX_LUKPS_PER_PACKET))
497  next0 = IP_LOOKUP_NEXT_DROP;
498  if (PREDICT_FALSE(vnet_buffer2(b1)->loop_counter > MAX_LUKPS_PER_PACKET))
499  next1 = IP_LOOKUP_NEXT_DROP;
500 
501  if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED))
502  {
504  b0, sizeof (*tr));
505  tr->fib_index = fib_index0;
506  tr->lbi = lbi0;
507  tr->addr.ip4 = *input_addr0;
508  }
509  if (PREDICT_FALSE(b1->flags & VLIB_BUFFER_IS_TRACED))
510  {
512  b1, sizeof (*tr));
513  tr->fib_index = fib_index1;
514  tr->lbi = lbi1;
515  tr->addr.ip4 = *input_addr1;
516  }
517 
519  to_next, n_left_to_next,
520  bi0, bi1, next0, next1);
521  }
522 
523  while (n_left_from > 0 && n_left_to_next > 0)
524  {
525  u32 bi0, lkdi0, lbi0, fib_index0, next0, hash_c0;
526  flow_hash_config_t flow_hash_config0;
527  const ip4_address_t *input_addr;
528  const load_balance_t *lb0;
529  const lookup_dpo_t * lkd0;
530  const ip4_header_t * ip0;
531  const dpo_id_t *dpo0;
532  vlib_buffer_t * b0;
533 
534  bi0 = from[0];
535  to_next[0] = bi0;
536  from += 1;
537  to_next += 1;
538  n_left_from -= 1;
539  n_left_to_next -= 1;
540 
541  b0 = vlib_get_buffer (vm, bi0);
542  ip0 = vlib_buffer_get_current (b0);
543 
544  /* dst lookup was done by ip4 lookup */
545  lkdi0 = vnet_buffer(b0)->ip.adj_index[VLIB_TX];
546  lkd0 = lookup_dpo_get(lkdi0);
547 
548  /*
549  * choose between a lookup using the fib index in the DPO
550  * or getting the FIB index from the interface.
551  */
552  if (table_from_interface)
553  {
554  fib_index0 =
557  }
558  else
559  {
560  fib_index0 = lkd0->lkd_fib_index;
561  }
562 
563  /*
564  * choose between a source or destination address lookup in the table
565  */
566  if (input_src_addr)
567  {
568  input_addr = &ip0->src_address;
569  }
570  else
571  {
572  input_addr = &ip0->dst_address;
573  }
574 
575  /* do lookup */
576  ip4_src_fib_lookup_one (fib_index0, input_addr, &lbi0);
577  lb0 = load_balance_get(lbi0);
578 
579  vnet_buffer(b0)->sw_if_index[VLIB_TX] = fib_index0;
580 
581  /* Use flow hash to compute multipath adjacency. */
582  hash_c0 = vnet_buffer (b0)->ip.flow_hash = 0;
583 
584  if (PREDICT_FALSE (lb0->lb_n_buckets > 1))
585  {
586  flow_hash_config0 = lb0->lb_hash_config;
587  hash_c0 = vnet_buffer (b0)->ip.flow_hash =
588  ip4_compute_flow_hash (ip0, flow_hash_config0);
589  }
590 
591  dpo0 = load_balance_get_bucket_i(lb0,
592  (hash_c0 &
593  (lb0->lb_n_buckets_minus_1)));
594 
595  next0 = dpo0->dpoi_next_node;
596  vnet_buffer(b0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
597 
599  (cm, thread_index, lbi0, 1,
601 
602  if (!(b0->flags & VNET_BUFFER_F_LOOP_COUNTER_VALID)) {
603  vnet_buffer2(b0)->loop_counter = 0;
604  b0->flags |= VNET_BUFFER_F_LOOP_COUNTER_VALID;
605  }
606 
607  vnet_buffer2(b0)->loop_counter++;
608 
609  if (PREDICT_FALSE(vnet_buffer2(b0)->loop_counter > MAX_LUKPS_PER_PACKET))
610  next0 = IP_LOOKUP_NEXT_DROP;
611 
612  if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED))
613  {
615  b0, sizeof (*tr));
616  tr->fib_index = fib_index0;
617  tr->lbi = lbi0;
618  tr->addr.ip4 = *input_addr;
619  }
620 
622  n_left_to_next, bi0, next0);
623  }
624  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
625  }
626  return from_frame->n_vectors;
627 }
628 
629 static u8 *
630 format_lookup_trace (u8 * s, va_list * args)
631 {
632  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
633  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
634  lookup_trace_t * t = va_arg (*args, lookup_trace_t *);
635  u32 indent = format_get_indent (s);
636  s = format (s, "%U fib-index:%d addr:%U load-balance:%d",
637  format_white_space, indent,
638  t->fib_index,
640  t->lbi);
641  return s;
642 }
643 
647 {
648  return (lookup_dpo_ip4_inline(vm, node, from_frame, 0, 0));
649 }
650 
652  .name = "lookup-ip4-dst",
653  .vector_size = sizeof (u32),
654  .sibling_of = "ip4-lookup",
655  .format_trace = format_lookup_trace,
656 };
657 
661 {
662  return (lookup_dpo_ip4_inline(vm, node, from_frame, 0, 1));
663 }
664 
666  .name = "lookup-ip4-dst-itf",
667  .vector_size = sizeof (u32),
668  .sibling_of = "ip4-lookup",
669  .format_trace = format_lookup_trace,
670 };
671 
675 {
676  return (lookup_dpo_ip4_inline(vm, node, from_frame, 1, 0));
677 }
678 
680  .name = "lookup-ip4-src",
681  .vector_size = sizeof (u32),
682  .format_trace = format_lookup_trace,
683  .sibling_of = "ip4-lookup",
684 };
685 
690  int input_src_addr,
691  int table_from_interface)
692 {
694  u32 n_left_from, next_index, * from, * to_next;
696 
698  n_left_from = from_frame->n_vectors;
699 
700  next_index = node->cached_next_index;
701 
702  while (n_left_from > 0)
703  {
704  u32 n_left_to_next;
705 
706  vlib_get_next_frame(vm, node, next_index, to_next, n_left_to_next);
707 
708  while (n_left_from >= 4 && n_left_to_next > 2)
709  {
710  u32 bi0, lkdi0, lbi0, fib_index0, next0, hash_c0;
711  flow_hash_config_t flow_hash_config0;
712  const ip6_address_t *input_addr0;
713  const load_balance_t *lb0;
714  const lookup_dpo_t * lkd0;
715  const ip6_header_t * ip0;
716  const dpo_id_t *dpo0;
717  vlib_buffer_t * b0;
718  u32 bi1, lkdi1, lbi1, fib_index1, next1, hash_c1;
719  flow_hash_config_t flow_hash_config1;
720  const ip6_address_t *input_addr1;
721  const load_balance_t *lb1;
722  const lookup_dpo_t * lkd1;
723  const ip6_header_t * ip1;
724  const dpo_id_t *dpo1;
725  vlib_buffer_t * b1;
726 
727  /* Prefetch next iteration. */
728  {
729  vlib_buffer_t * p2, * p3;
730 
731  p2 = vlib_get_buffer (vm, from[2]);
732  p3 = vlib_get_buffer (vm, from[3]);
733 
734  vlib_prefetch_buffer_header (p2, LOAD);
735  vlib_prefetch_buffer_header (p3, LOAD);
736 
739  }
740 
741  bi0 = from[0];
742  to_next[0] = bi0;
743  bi1 = from[1];
744  to_next[1] = bi1;
745  from += 2;
746  to_next += 2;
747  n_left_from -= 2;
748  n_left_to_next -= 2;
749 
750  b0 = vlib_get_buffer (vm, bi0);
751  ip0 = vlib_buffer_get_current (b0);
752  b1 = vlib_get_buffer (vm, bi1);
753  ip1 = vlib_buffer_get_current (b1);
754 
755  /* dst lookup was done by ip6 lookup */
756  lkdi0 = vnet_buffer(b0)->ip.adj_index[VLIB_TX];
757  lkdi1 = vnet_buffer(b1)->ip.adj_index[VLIB_TX];
758  lkd0 = lookup_dpo_get(lkdi0);
759  lkd1 = lookup_dpo_get(lkdi1);
760 
761  /*
762  * choose between a lookup using the fib index in the DPO
763  * or getting the FIB index from the interface.
764  */
765  if (table_from_interface)
766  {
767  fib_index0 =
770  fib_index1 =
773  }
774  else
775  {
776  fib_index0 = lkd0->lkd_fib_index;
777  fib_index1 = lkd1->lkd_fib_index;
778  }
779 
780  /*
781  * choose between a source or destination address lookup in the table
782  */
783  if (input_src_addr)
784  {
785  input_addr0 = &ip0->src_address;
786  input_addr1 = &ip1->src_address;
787  }
788  else
789  {
790  input_addr0 = &ip0->dst_address;
791  input_addr1 = &ip1->dst_address;
792  }
793 
794  /* do src lookup */
796  fib_index0,
797  input_addr0);
799  fib_index1,
800  input_addr1);
801  lb0 = load_balance_get(lbi0);
802  lb1 = load_balance_get(lbi1);
803 
804  vnet_buffer(b0)->sw_if_index[VLIB_TX] = fib_index0;
805  vnet_buffer(b1)->sw_if_index[VLIB_TX] = fib_index1;
806 
807  /* Use flow hash to compute multipath adjacency. */
808  hash_c0 = vnet_buffer (b0)->ip.flow_hash = 0;
809  hash_c1 = vnet_buffer (b1)->ip.flow_hash = 0;
810 
811  if (!(b0->flags & VNET_BUFFER_F_LOOP_COUNTER_VALID)) {
812  vnet_buffer2(b0)->loop_counter = 0;
813  b0->flags |= VNET_BUFFER_F_LOOP_COUNTER_VALID;
814  }
815  if (!(b1->flags & VNET_BUFFER_F_LOOP_COUNTER_VALID)) {
816  vnet_buffer2(b1)->loop_counter = 0;
817  b1->flags |= VNET_BUFFER_F_LOOP_COUNTER_VALID;
818  }
819 
820  vnet_buffer2(b0)->loop_counter++;
821  vnet_buffer2(b1)->loop_counter++;
822 
823  if (PREDICT_FALSE(vnet_buffer2(b0)->loop_counter > MAX_LUKPS_PER_PACKET))
824  next0 = IP_LOOKUP_NEXT_DROP;
825  if (PREDICT_FALSE(vnet_buffer2(b1)->loop_counter > MAX_LUKPS_PER_PACKET))
826  next1 = IP_LOOKUP_NEXT_DROP;
827 
828  if (PREDICT_FALSE (lb0->lb_n_buckets > 1))
829  {
830  flow_hash_config0 = lb0->lb_hash_config;
831  hash_c0 = vnet_buffer (b0)->ip.flow_hash =
832  ip6_compute_flow_hash (ip0, flow_hash_config0);
833  }
834 
835  if (PREDICT_FALSE (lb1->lb_n_buckets > 1))
836  {
837  flow_hash_config1 = lb1->lb_hash_config;
838  hash_c1 = vnet_buffer (b1)->ip.flow_hash =
839  ip6_compute_flow_hash (ip1, flow_hash_config1);
840  }
841 
842  dpo0 = load_balance_get_bucket_i(lb0,
843  (hash_c0 &
844  (lb0->lb_n_buckets_minus_1)));
845  dpo1 = load_balance_get_bucket_i(lb1,
846  (hash_c1 &
847  (lb1->lb_n_buckets_minus_1)));
848 
849  next0 = dpo0->dpoi_next_node;
850  next1 = dpo1->dpoi_next_node;
851  vnet_buffer(b0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
852  vnet_buffer(b1)->ip.adj_index[VLIB_TX] = dpo1->dpoi_index;
853 
855  (cm, thread_index, lbi0, 1,
858  (cm, thread_index, lbi1, 1,
860 
861  if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED))
862  {
864  b0, sizeof (*tr));
865  tr->fib_index = fib_index0;
866  tr->lbi = lbi0;
867  tr->addr.ip6 = *input_addr0;
868  }
869  if (PREDICT_FALSE(b1->flags & VLIB_BUFFER_IS_TRACED))
870  {
872  b1, sizeof (*tr));
873  tr->fib_index = fib_index1;
874  tr->lbi = lbi1;
875  tr->addr.ip6 = *input_addr1;
876  }
878  n_left_to_next, bi0, bi1,
879  next0, next1);
880  }
881  while (n_left_from > 0 && n_left_to_next > 0)
882  {
883  u32 bi0, lkdi0, lbi0, fib_index0, next0, hash_c0;
884  flow_hash_config_t flow_hash_config0;
885  const ip6_address_t *input_addr0;
886  const load_balance_t *lb0;
887  const lookup_dpo_t * lkd0;
888  const ip6_header_t * ip0;
889  const dpo_id_t *dpo0;
890  vlib_buffer_t * b0;
891 
892  bi0 = from[0];
893  to_next[0] = bi0;
894  from += 1;
895  to_next += 1;
896  n_left_from -= 1;
897  n_left_to_next -= 1;
898 
899  b0 = vlib_get_buffer (vm, bi0);
900  ip0 = vlib_buffer_get_current (b0);
901 
902  /* dst lookup was done by ip6 lookup */
903  lkdi0 = vnet_buffer(b0)->ip.adj_index[VLIB_TX];
904  lkd0 = lookup_dpo_get(lkdi0);
905 
906  /*
907  * choose between a lookup using the fib index in the DPO
908  * or getting the FIB index from the interface.
909  */
910  if (table_from_interface)
911  {
912  fib_index0 =
915  }
916  else
917  {
918  fib_index0 = lkd0->lkd_fib_index;
919  }
920 
921  /*
922  * choose between a source or destination address lookup in the table
923  */
924  if (input_src_addr)
925  {
926  input_addr0 = &ip0->src_address;
927  }
928  else
929  {
930  input_addr0 = &ip0->dst_address;
931  }
932 
933  /* do src lookup */
935  fib_index0,
936  input_addr0);
937  lb0 = load_balance_get(lbi0);
938 
939  vnet_buffer(b0)->sw_if_index[VLIB_TX] = fib_index0;
940 
941  /* Use flow hash to compute multipath adjacency. */
942  hash_c0 = vnet_buffer (b0)->ip.flow_hash = 0;
943 
944  if (PREDICT_FALSE (lb0->lb_n_buckets > 1))
945  {
946  flow_hash_config0 = lb0->lb_hash_config;
947  hash_c0 = vnet_buffer (b0)->ip.flow_hash =
948  ip6_compute_flow_hash (ip0, flow_hash_config0);
949  }
950 
951  dpo0 = load_balance_get_bucket_i(lb0,
952  (hash_c0 &
953  (lb0->lb_n_buckets_minus_1)));
954 
955  next0 = dpo0->dpoi_next_node;
956  vnet_buffer(b0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
957 
958  if (!(b0->flags & VNET_BUFFER_F_LOOP_COUNTER_VALID)) {
959  vnet_buffer2(b0)->loop_counter = 0;
960  b0->flags |= VNET_BUFFER_F_LOOP_COUNTER_VALID;
961  }
962 
963  vnet_buffer2(b0)->loop_counter++;
964 
965  if (PREDICT_FALSE(vnet_buffer2(b0)->loop_counter > MAX_LUKPS_PER_PACKET))
966  next0 = IP_LOOKUP_NEXT_DROP;
967 
969  (cm, thread_index, lbi0, 1,
971 
972  if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED))
973  {
975  b0, sizeof (*tr));
976  tr->fib_index = fib_index0;
977  tr->lbi = lbi0;
978  tr->addr.ip6 = *input_addr0;
979  }
981  n_left_to_next, bi0, next0);
982  }
983  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
984  }
985  return from_frame->n_vectors;
986 }
987 
991 {
992  return (lookup_dpo_ip6_inline(vm, node, from_frame, 0 /*use src*/, 0));
993 }
994 
996  .name = "lookup-ip6-dst",
997  .vector_size = sizeof (u32),
998  .format_trace = format_lookup_trace,
999  .sibling_of = "ip6-lookup",
1000 };
1001 
1005 {
1006  return (lookup_dpo_ip6_inline(vm, node, from_frame, 0 /*use src*/, 1));
1007 }
1008 
1010  .name = "lookup-ip6-dst-itf",
1011  .vector_size = sizeof (u32),
1012  .format_trace = format_lookup_trace,
1013  .sibling_of = "ip6-lookup",
1014 };
1015 
1019 {
1020  return (lookup_dpo_ip6_inline(vm, node, from_frame, 1, 0));
1021 }
1022 
1024  .name = "lookup-ip6-src",
1025  .vector_size = sizeof (u32),
1026  .format_trace = format_lookup_trace,
1027  .sibling_of = "ip6-lookup",
1028 };
1029 
1034  int table_from_interface)
1035 {
1036  u32 n_left_from, next_index, * from, * to_next;
1039 
1041  n_left_from = from_frame->n_vectors;
1042 
1043  next_index = node->cached_next_index;
1044 
1045  while (n_left_from > 0)
1046  {
1047  u32 n_left_to_next;
1048 
1049  vlib_get_next_frame(vm, node, next_index, to_next, n_left_to_next);
1050 
1051  /* while (n_left_from >= 4 && n_left_to_next >= 2) */
1052  /* } */
1053 
1054  while (n_left_from > 0 && n_left_to_next > 0)
1055  {
1056  u32 bi0, lkdi0, lbi0, fib_index0, next0, hash0;
1057  const mpls_unicast_header_t * hdr0;
1058  const load_balance_t *lb0;
1059  const lookup_dpo_t * lkd0;
1060  const dpo_id_t *dpo0;
1061  vlib_buffer_t * b0;
1062 
1063  bi0 = from[0];
1064  to_next[0] = bi0;
1065  from += 1;
1066  to_next += 1;
1067  n_left_from -= 1;
1068  n_left_to_next -= 1;
1069 
1070  b0 = vlib_get_buffer (vm, bi0);
1071  hdr0 = vlib_buffer_get_current (b0);
1072 
1073  /* dst lookup was done by mpls lookup */
1074  lkdi0 = vnet_buffer(b0)->ip.adj_index[VLIB_TX];
1075  lkd0 = lookup_dpo_get(lkdi0);
1076 
1077  /*
1078  * choose between a lookup using the fib index in the DPO
1079  * or getting the FIB index from the interface.
1080  */
1081  if (table_from_interface)
1082  {
1083  fib_index0 =
1086  }
1087  else
1088  {
1089  fib_index0 = lkd0->lkd_fib_index;
1090  }
1091 
1092  /* do lookup */
1093  lbi0 = mpls_fib_table_forwarding_lookup (fib_index0, hdr0);
1094  lb0 = load_balance_get(lbi0);
1095  dpo0 = load_balance_get_bucket_i(lb0, 0);
1096 
1097  next0 = dpo0->dpoi_next_node;
1098  vnet_buffer(b0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
1099 
1100 
1101  if (MPLS_IS_REPLICATE & lbi0)
1102  {
1104  vnet_buffer (b0)->ip.adj_index[VLIB_TX] =
1105  (lbi0 & ~MPLS_IS_REPLICATE);
1106  }
1107  else
1108  {
1109  lb0 = load_balance_get(lbi0);
1110  ASSERT (lb0->lb_n_buckets > 0);
1111  ASSERT (is_pow2 (lb0->lb_n_buckets));
1112 
1113  if (PREDICT_FALSE(lb0->lb_n_buckets > 1))
1114  {
1115  hash0 = vnet_buffer (b0)->ip.flow_hash =
1118  (lb0,
1119  (hash0 & (lb0->lb_n_buckets_minus_1)));
1120  }
1121  else
1122  {
1123  dpo0 = load_balance_get_bucket_i (lb0, 0);
1124  }
1125  next0 = dpo0->dpoi_next_node;
1126 
1127  vnet_buffer (b0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
1128 
1130  (cm, thread_index, lbi0, 1,
1132  }
1133 
1134  vnet_buffer (b0)->mpls.ttl = ((char*)hdr0)[3];
1135  vnet_buffer (b0)->mpls.exp = (((char*)hdr0)[2] & 0xe) >> 1;
1136  vnet_buffer (b0)->mpls.first = 1;
1137  vlib_buffer_advance(b0, sizeof(*hdr0));
1138 
1139  if (!(b0->flags & VNET_BUFFER_F_LOOP_COUNTER_VALID)) {
1140  vnet_buffer2(b0)->loop_counter = 0;
1141  b0->flags |= VNET_BUFFER_F_LOOP_COUNTER_VALID;
1142  }
1143 
1144  vnet_buffer2(b0)->loop_counter++;
1145 
1146  if (PREDICT_FALSE(vnet_buffer2(b0)->loop_counter > MAX_LUKPS_PER_PACKET))
1147  next0 = MPLS_LOOKUP_NEXT_DROP;
1148 
1149  if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED))
1150  {
1152  b0, sizeof (*tr));
1153  tr->fib_index = fib_index0;
1154  tr->lbi = lbi0;
1155  tr->hdr = *hdr0;
1156  }
1157 
1159  n_left_to_next, bi0, next0);
1160  }
1161  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
1162  }
1163  return from_frame->n_vectors;
1164 }
1165 
1166 static u8 *
1167 format_lookup_mpls_trace (u8 * s, va_list * args)
1168 {
1169  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
1170  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
1171  lookup_trace_t * t = va_arg (*args, lookup_trace_t *);
1172  u32 indent = format_get_indent (s);
1174 
1175  hdr.label_exp_s_ttl = clib_net_to_host_u32(t->hdr.label_exp_s_ttl);
1176 
1177  s = format (s, "%U fib-index:%d hdr:%U load-balance:%d",
1178  format_white_space, indent,
1179  t->fib_index,
1180  format_mpls_header, hdr,
1181  t->lbi);
1182  return s;
1183 }
1184 
1188 {
1189  return (lookup_dpo_mpls_inline(vm, node, from_frame, 0));
1190 }
1191 
1193  .name = "lookup-mpls-dst",
1194  .vector_size = sizeof (u32),
1195  .sibling_of = "mpls-lookup",
1196  .format_trace = format_lookup_mpls_trace,
1197  .n_next_nodes = 0,
1198 };
1199 
1203 {
1204  return (lookup_dpo_mpls_inline(vm, node, from_frame, 1));
1205 }
1206 
1208  .name = "lookup-mpls-dst-itf",
1209  .vector_size = sizeof (u32),
1210  .sibling_of = "mpls-lookup",
1211  .format_trace = format_lookup_mpls_trace,
1212  .n_next_nodes = 0,
1213 };
1214 
1220 
1225  int is_v4)
1226 {
1227  u32 n_left_from, next_index, * from, * to_next;
1228 
1230  n_left_from = from_frame->n_vectors;
1231 
1233 
1234  while (n_left_from > 0)
1235  {
1236  u32 n_left_to_next;
1237 
1238  vlib_get_next_frame(vm, node, next_index, to_next, n_left_to_next);
1239 
1240  /* while (n_left_from >= 4 && n_left_to_next >= 2) */
1241  /* } */
1242 
1243  while (n_left_from > 0 && n_left_to_next > 0)
1244  {
1245  u32 bi0, lkdi0, fib_index0, next0;
1246  const lookup_dpo_t * lkd0;
1247  fib_node_index_t mfei0;
1248  vlib_buffer_t * b0;
1249 
1250  bi0 = from[0];
1251  to_next[0] = bi0;
1252  from += 1;
1253  to_next += 1;
1254  n_left_from -= 1;
1255  n_left_to_next -= 1;
1256 
1257  b0 = vlib_get_buffer (vm, bi0);
1258 
1259  /* dst lookup was done by mpls lookup */
1260  lkdi0 = vnet_buffer(b0)->ip.adj_index[VLIB_TX];
1261  lkd0 = lookup_dpo_get(lkdi0);
1262  fib_index0 = lkd0->lkd_fib_index;
1264 
1265  if (is_v4)
1266  {
1267  ip4_header_t * ip0;
1268 
1269  ip0 = vlib_buffer_get_current (b0);
1270  mfei0 = ip4_mfib_table_lookup(ip4_mfib_get(fib_index0),
1271  &ip0->src_address,
1272  &ip0->dst_address,
1273  64);
1274  if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED))
1275  {
1277  b0, sizeof (*tr));
1278  tr->fib_index = fib_index0;
1279  tr->lbi = mfei0;
1280  tr->addr.ip4 = ip0->dst_address;
1281  }
1282  }
1283  else
1284  {
1285  ip6_header_t * ip0;
1286 
1287  ip0 = vlib_buffer_get_current (b0);
1288  mfei0 = ip6_mfib_table_fwd_lookup(ip6_mfib_get(fib_index0),
1289  &ip0->src_address,
1290  &ip0->dst_address);
1291  if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED))
1292  {
1294  b0, sizeof (*tr));
1295  tr->fib_index = fib_index0;
1296  tr->lbi = mfei0;
1297  tr->addr.ip6 = ip0->dst_address;
1298  }
1299  }
1300 
1301  vnet_buffer (b0)->ip.adj_index[VLIB_TX] = mfei0;
1302 
1303  if (!(b0->flags & VNET_BUFFER_F_LOOP_COUNTER_VALID)) {
1304  vnet_buffer2(b0)->loop_counter = 0;
1305  b0->flags |= VNET_BUFFER_F_LOOP_COUNTER_VALID;
1306  }
1307 
1308  vnet_buffer2(b0)->loop_counter++;
1309 
1310  if (PREDICT_FALSE(vnet_buffer2(b0)->loop_counter > MAX_LUKPS_PER_PACKET))
1312 
1314  n_left_to_next, bi0, next0);
1315  }
1316  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
1317  }
1318  return from_frame->n_vectors;
1319 }
1320 
1324 {
1326 }
1327 
1329  .name = "lookup-ip4-dst-mcast",
1330  .vector_size = sizeof (u32),
1331 
1332  .format_trace = format_lookup_trace,
1333  .n_next_nodes = LOOKUP_IP_DST_MCAST_N_NEXT,
1334  .next_nodes = {
1335  [LOOKUP_IP_DST_MCAST_NEXT_DROP] = "ip4-drop",
1336  [LOOKUP_IP_DST_MCAST_NEXT_RPF] = "ip4-mfib-forward-rpf",
1337  },
1338 };
1339 
1343 {
1345 }
1346 
1348  .name = "lookup-ip6-dst-mcast",
1349  .vector_size = sizeof (u32),
1350 
1351  .format_trace = format_lookup_trace,
1352  .n_next_nodes = LOOKUP_IP_DST_MCAST_N_NEXT,
1353  .next_nodes = {
1354  [LOOKUP_IP_DST_MCAST_NEXT_DROP] = "ip6-drop",
1355  [LOOKUP_IP_DST_MCAST_NEXT_RPF] = "ip6-mfib-forward-rpf",
1356  },
1357 };
1358 
1359 static void
1361 {
1362  fib_show_memory_usage("Lookup",
1365  sizeof(lookup_dpo_t));
1366 }
1367 
1368 const static dpo_vft_t lkd_vft = {
1370  .dv_unlock = lookup_dpo_unlock,
1371  .dv_format = format_lookup_dpo,
1372 };
1375  .dv_unlock = lookup_dpo_unlock,
1376  .dv_format = format_lookup_dpo,
1377  .dv_mem_show = lookup_dpo_mem_show,
1378 };
1379 
1380 const static char* const lookup_src_ip4_nodes[] =
1381 {
1382  "lookup-ip4-src",
1383  NULL,
1384 };
1385 const static char* const lookup_src_ip6_nodes[] =
1386 {
1387  "lookup-ip6-src",
1388  NULL,
1389 };
1390 const static char* const * const lookup_src_nodes[DPO_PROTO_NUM] =
1391 {
1394  [DPO_PROTO_MPLS] = NULL,
1395 };
1396 
1397 const static char* const lookup_dst_ip4_nodes[] =
1398 {
1399  "lookup-ip4-dst",
1400  NULL,
1401 };
1402 const static char* const lookup_dst_ip6_nodes[] =
1403 {
1404  "lookup-ip6-dst",
1405  NULL,
1406 };
1407 const static char* const lookup_dst_mpls_nodes[] =
1408 {
1409  "lookup-mpls-dst",
1410  NULL,
1411 };
1412 const static char* const * const lookup_dst_nodes[DPO_PROTO_NUM] =
1413 {
1417 };
1418 
1419 const static char* const lookup_dst_mcast_ip4_nodes[] =
1420 {
1421  "lookup-ip4-dst-mcast",
1422  NULL,
1423 };
1424 const static char* const lookup_dst_mcast_ip6_nodes[] =
1425 {
1426  "lookup-ip6-dst-mcast",
1427  NULL,
1428 };
1429 const static char* const * const lookup_dst_mcast_nodes[DPO_PROTO_NUM] =
1430 {
1433 };
1434 
1435 const static char* const lookup_dst_from_interface_ip4_nodes[] =
1436 {
1437  "lookup-ip4-dst-itf",
1438  NULL,
1439 };
1440 const static char* const lookup_dst_from_interface_ip6_nodes[] =
1441 {
1442  "lookup-ip6-dst-itf",
1443  NULL,
1444 };
1445 const static char* const lookup_dst_from_interface_mpls_nodes[] =
1446 {
1447  "lookup-mpls-dst-itf",
1448  NULL,
1449 };
1450 const static char* const * const lookup_dst_from_interface_nodes[DPO_PROTO_NUM] =
1451 {
1455 };
1456 
1457 static clib_error_t *
1459  unformat_input_t * input,
1460  vlib_cli_command_t * cmd)
1461 {
1462  index_t lkdi = INDEX_INVALID;
1463 
1464  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
1465  {
1466  if (unformat (input, "%d", &lkdi))
1467  ;
1468  else
1469  break;
1470  }
1471 
1472  if (INDEX_INVALID != lkdi)
1473  {
1475  vlib_cli_output (vm, "no such index %d", lkdi);
1476  else
1477  vlib_cli_output (vm, "%U", format_lookup_dpo, lkdi);
1478  }
1479  else
1480  {
1481  lookup_dpo_t *lkd;
1482 
1484  {
1485  vlib_cli_output (vm, "[@%d] %U",
1486  lookup_dpo_get_index(lkd),
1488  lookup_dpo_get_index(lkd));
1489  }
1490  }
1491 
1492  return 0;
1493 }
1494 
1496  .path = "show lookup-dpo",
1497  .short_help = "show lookup-dpo [<index>]",
1498  .function = lookup_dpo_show,
1499 };
1500 
1501 void
1503 {
1505 
1506  /*
1507  * There are various sorts of lookup; src or dst addr v4 /v6 etc.
1508  * there isn't an object type for each (there is only the lookup_dpo_t),
1509  * but, for performance reasons, there is a data plane function, and hence
1510  * VLIB node for each. VLIB graph node construction is based on DPO types
1511  * so we create sub-types.
1512  */
1521 }
lookup_dst_nodes
const static char *const *const lookup_dst_nodes[DPO_PROTO_NUM]
Definition: lookup_dpo.c:1412
LOOKUP_SUB_TYPE_NUM
#define LOOKUP_SUB_TYPE_NUM
Definition: lookup_dpo.c:47
lookup_dpo_ip4_inline
static uword lookup_dpo_ip4_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, int input_src_addr, int table_from_interface)
Definition: lookup_dpo.c:330
lookup_mpls_dst_itf_node
vlib_node_registration_t lookup_mpls_dst_itf_node
(constructor) VLIB_REGISTER_NODE (lookup_mpls_dst_itf_node)
Definition: lookup_dpo.c:1207
dpo_id_t_::dpoi_next_node
u16 dpoi_next_node
The next VLIB node to follow.
Definition: dpo.h:186
dpo_register_new_type
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
Definition: dpo.c:349
load_balance_t_::lb_n_buckets
u16 lb_n_buckets
number of buckets in the load-balance.
Definition: load_balance.h:116
dpo_id_t_::dpoi_index
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:190
thread_index
u32 thread_index
Definition: nat44_ei_hairpinning.c:492
lookup_mpls_dst_node
vlib_node_registration_t lookup_mpls_dst_node
(constructor) VLIB_REGISTER_NODE (lookup_mpls_dst_node)
Definition: lookup_dpo.c:1192
vlib_prefetch_buffer_header
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:231
ip6_mfib_get
static ip6_mfib_t * ip6_mfib_get(u32 index)
Get the FIB at the given index.
Definition: ip6_mfib.h:101
lookup_src_nodes
const static char *const *const lookup_src_nodes[DPO_PROTO_NUM]
Definition: lookup_dpo.c:1390
ip4_fib_mtrie_leaf_get_adj_index
static u32 ip4_fib_mtrie_leaf_get_adj_index(ip4_fib_mtrie_leaf_t n)
From the stored slot value extract the LB index value.
Definition: ip4_mtrie.h:192
lookup_trace_t_::hdr
mpls_unicast_header_t hdr
Definition: lookup_dpo.c:322
lookup_ip4_src_node
vlib_node_registration_t lookup_ip4_src_node
(constructor) VLIB_REGISTER_NODE (lookup_ip4_src_node)
Definition: lookup_dpo.c:679
replicate_show_command
static vlib_cli_command_t replicate_show_command
(constructor) VLIB_CLI_COMMAND (replicate_show_command)
Definition: lookup_dpo.c:1495
next_index
nat44_ei_hairpin_src_next_t next_index
Definition: nat44_ei_hairpinning.c:412
dpo_proto_t
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
lookup_cast_names
static const char *const lookup_cast_names[]
Definition: lookup_dpo.c:29
load_balance_map.h
vlib_get_buffer
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:111
MFIB_SOURCE_RR
@ MFIB_SOURCE_RR
Definition: mfib_types.h:176
lookup_dpo_get_index
static index_t lookup_dpo_get_index(lookup_dpo_t *lkd)
Definition: lookup_dpo.c:77
lookup_dpo_get
static lookup_dpo_t * lookup_dpo_get(index_t index)
Definition: lookup_dpo.h:127
lookup_dpo_unlock
static void lookup_dpo_unlock(dpo_id_t *dpo)
Definition: lookup_dpo.c:242
ip4_fib_mtrie_lookup_step_one
static ip4_fib_mtrie_leaf_t ip4_fib_mtrie_lookup_step_one(const ip4_fib_mtrie_t *m, const ip4_address_t *dst_address)
Lookup step number 1.
Definition: ip4_mtrie.h:224
pool_get_aligned
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
Definition: pool.h:249
LOOKUP_SUB_TYPE_DST_MCAST
@ LOOKUP_SUB_TYPE_DST_MCAST
Definition: lookup_dpo.c:44
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
load_balance_t_::lb_hash_config
flow_hash_config_t lb_hash_config
the hash config to use when selecting a bucket.
Definition: load_balance.h:161
lookup_ip4_dst_mcast_node
vlib_node_registration_t lookup_ip4_dst_mcast_node
(constructor) VLIB_REGISTER_NODE (lookup_ip4_dst_mcast_node)
Definition: lookup_dpo.c:1328
lookup_dpo_pool
lookup_dpo_t * lookup_dpo_pool
pool of all MPLS Label DPOs
Definition: lookup_dpo.c:55
format_fib_table_name
u8 * format_fib_table_name(u8 *s, va_list *ap)
Format the description/name of the table.
Definition: fib_table.c:1379
lookup_dpo_ip6_inline
static uword lookup_dpo_ip6_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, int input_src_addr, int table_from_interface)
Definition: lookup_dpo.c:687
mfib_table_find_or_create_and_lock
u32 mfib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, mfib_source_t src)
Get the index of the FIB for a Table-ID.
Definition: mfib_table.c:613
ip4_fib_mtrie_t
The mutiway-TRIE.
Definition: ip4_mtrie.h:129
format_lookup_trace
static u8 * format_lookup_trace(u8 *s, va_list *args)
Definition: lookup_dpo.c:630
ip4_fib_mtrie_lookup_step
static ip4_fib_mtrie_leaf_t ip4_fib_mtrie_lookup_step(const ip4_fib_mtrie_t *m, ip4_fib_mtrie_leaf_t current_leaf, const ip4_address_t *dst_address, u32 dst_address_byte_index)
Lookup step.
Definition: ip4_mtrie.h:202
vlib_cli_command_t::path
char * path
Definition: cli.h:96
lookup_dpo_t
A representation of an MPLS label for imposition in the data-path.
Definition: lookup_dpo.h:65
FIB_NODE_INDEX_INVALID
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:30
fib_table.h
lookup_table_t
enum lookup_table_t_ lookup_table_t
Switch to use the packet's source or destination address for lookup.
lkd_vft
const static dpo_vft_t lkd_vft
Definition: lookup_dpo.c:1368
ip4_fib_table_get_index_for_sw_if_index
u32 ip4_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
Definition: pnat_test_stubs.h:21
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
mpls_unicast_header_t
Definition: packet.h:28
VLIB_RX
@ VLIB_RX
Definition: defs.h:46
lookup_trace_t_::fib_index
fib_node_index_t fib_index
Definition: lookup_dpo.c:324
from_frame
vlib_main_t vlib_node_runtime_t vlib_frame_t * from_frame
Definition: esp_encrypt.c:1328
lookup_ip6_dst_itf_node
vlib_node_registration_t lookup_ip6_dst_itf_node
(constructor) VLIB_REGISTER_NODE (lookup_ip6_dst_itf_node)
Definition: lookup_dpo.c:1009
vnet_buffer2
#define vnet_buffer2(b)
Definition: buffer.h:499
unformat_input_t
struct _unformat_input_t unformat_input_t
dpo_pool_barrier_sync
#define dpo_pool_barrier_sync(VM, P, YESNO)
Barrier sync if a dpo pool is about to expand.
Definition: dpo.h:544
vlib_frame_t
Definition: node.h:372
ip4_mfib.h
LOOKUP_MULTICAST
@ LOOKUP_MULTICAST
Definition: lookup_dpo.h:54
vlib_buffer_length_in_chain
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:433
LOOKUP_INPUT_SRC_ADDR
@ LOOKUP_INPUT_SRC_ADDR
Definition: lookup_dpo.h:27
ip4_header_t
Definition: ip4_packet.h:87
lookup_dpo_ip_dst_mcast_inline
static uword lookup_dpo_ip_dst_mcast_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, int is_v4)
Definition: lookup_dpo.c:1222
lookup_dpo_t::lkd_locks
u16 lkd_locks
Number of locks.
Definition: lookup_dpo.h:103
lookup_dst_from_interface_ip6_nodes
const static char *const lookup_dst_from_interface_ip6_nodes[]
Definition: lookup_dpo.c:1440
LOOKUP_IP_DST_MCAST_N_NEXT
@ LOOKUP_IP_DST_MCAST_N_NEXT
Definition: lookup_dpo.c:1218
lookup_ip_dst_mcast_next_t_
lookup_ip_dst_mcast_next_t_
Definition: lookup_dpo.c:1215
ip4_src_fib_lookup_two
static void ip4_src_fib_lookup_two(u32 src_fib_index0, u32 src_fib_index1, const ip4_address_t *addr0, const ip4_address_t *addr1, u32 *src_adj_index0, u32 *src_adj_index1)
Definition: lookup_dpo.c:289
lookup_trace_t_::lbi
index_t lbi
Definition: lookup_dpo.c:325
ip6_mfib.h
format_mpls_header
format_function_t format_mpls_header
Definition: mpls.h:72
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
pool_is_free_index
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:302
lookup_dst_mcast_ip6_nodes
const static char *const lookup_dst_mcast_ip6_nodes[]
Definition: lookup_dpo.c:1424
mpls_fib.h
CLIB_PREFETCH
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:80
mfib_table_lock
void mfib_table_lock(u32 fib_index, fib_protocol_t proto, mfib_source_t source)
Release a reference counting lock on the table.
Definition: mfib_table.c:806
lookup_dpo_show
static clib_error_t * lookup_dpo_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: lookup_dpo.c:1458
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
load_balance_main
load_balance_main_t load_balance_main
The one instance of load-balance main.
Definition: load_balance.c:59
format_lookup_dpo
u8 * format_lookup_dpo(u8 *s, va_list *args)
Definition: lookup_dpo.c:195
vlib_buffer_advance
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:276
load_balance_get_fwd_bucket
static const dpo_id_t * load_balance_get_fwd_bucket(const load_balance_t *lb, u16 bucket)
Definition: load_balance_map.h:94
mpls_fib_table_get_index_for_sw_if_index
static u32 mpls_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
Definition: mpls_fib.h:138
LOOKUP_CASTS
#define LOOKUP_CASTS
Definition: lookup_dpo.h:57
IP_LOOKUP_NEXT_DROP
@ IP_LOOKUP_NEXT_DROP
Adjacency to drop this packet.
Definition: adj.h:53
MPLS_IS_REPLICATE
#define MPLS_IS_REPLICATE
The top bit of the index, which is the result of the MPLS lookup is used to determine if the DPO is a...
Definition: mpls_types.h:66
VLIB_NODE_FN
#define VLIB_NODE_FN(node)
Definition: node.h:202
lookup_dst_from_interface_ip4_nodes
const static char *const lookup_dst_from_interface_ip4_nodes[]
Definition: lookup_dpo.c:1435
ip6_compute_flow_hash
static u32 ip6_compute_flow_hash(const ip6_header_t *ip, flow_hash_config_t flow_hash_config)
Definition: ip6_inlines.h:49
lookup_ip6_src_node
vlib_node_registration_t lookup_ip6_src_node
(constructor) VLIB_REGISTER_NODE (lookup_ip6_src_node)
Definition: lookup_dpo.c:1023
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
vnet_buffer
#define vnet_buffer(b)
Definition: buffer.h:437
lookup_src_ip4_nodes
const static char *const lookup_src_ip4_nodes[]
Definition: lookup_dpo.c:1380
fib_table_find_or_create_and_lock
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, fib_source_t src)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:1165
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
lookup_dst_mcast_nodes
const static char *const *const lookup_dst_mcast_nodes[DPO_PROTO_NUM]
Definition: lookup_dpo.c:1429
vlib_get_thread_index
static_always_inline uword vlib_get_thread_index(void)
Definition: threads.h:208
vlib_frame_vector_args
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:301
unformat_check_input
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:163
flow_hash_config_t
enum flow_hash_config_t_ flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
lookup_dst_ip6_nodes
const static char *const lookup_dst_ip6_nodes[]
Definition: lookup_dpo.c:1402
index_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:43
lookup_dpo_alloc
static lookup_dpo_t * lookup_dpo_alloc(void)
Definition: lookup_dpo.c:63
LOOKUP_UNICAST
@ LOOKUP_UNICAST
Definition: lookup_dpo.h:53
LOOKUP_INPUT_DST_ADDR
@ LOOKUP_INPUT_DST_ADDR
Definition: lookup_dpo.h:28
ip4_mfib_get
static ip4_mfib_t * ip4_mfib_get(u32 index)
Get the FIB at the given index.
Definition: ip4_mfib.h:69
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
fib_show_memory_usage
void fib_show_memory_usage(const char *name, u32 in_use_elts, u32 allocd_elts, size_t size_elt)
Show the memory usage for a type.
Definition: fib_node.c:220
uword
u64 uword
Definition: types.h:112
DPO_LOOKUP
@ DPO_LOOKUP
Definition: dpo.h:113
mpls_lookup_to_replicate_edge
u32 mpls_lookup_to_replicate_edge
The arc/edge from the MPLS lookup node to the MPLS replicate node.
Definition: mpls_lookup.c:28
lookup_dpo_mem_show
static void lookup_dpo_mem_show(void)
Definition: lookup_dpo.c:1360
lookup_dst_mcast_ip4_nodes
const static char *const lookup_dst_mcast_ip4_nodes[]
Definition: lookup_dpo.c:1419
MAX_LUKPS_PER_PACKET
#define MAX_LUKPS_PER_PACKET
If a packet encounters a lookup DPO more than the many times then we assume there is a loop in the fo...
Definition: lookup_dpo.c:35
LOOKUP_SUB_TYPE_DST_TABLE_FROM_INTERFACE
@ LOOKUP_SUB_TYPE_DST_TABLE_FROM_INTERFACE
Definition: lookup_dpo.c:45
dpo_type_t
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type()
lookup_dst_from_interface_mpls_nodes
const static char *const lookup_dst_from_interface_mpls_nodes[]
Definition: lookup_dpo.c:1445
load_balance_get_bucket_i
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
Definition: load_balance.h:229
lookup_dpo_add_or_lock_i
static void lookup_dpo_add_or_lock_i(fib_node_index_t fib_index, dpo_proto_t proto, lookup_cast_t cast, lookup_input_t input, lookup_table_t table_config, dpo_id_t *dpo)
Definition: lookup_dpo.c:83
LOOKUP_SUB_TYPE_SRC
@ LOOKUP_SUB_TYPE_SRC
Definition: lookup_dpo.c:42
lookup_dpo_module_init
void lookup_dpo_module_init(void)
Definition: lookup_dpo.c:1502
ip6_header_t::dst_address
ip6_address_t dst_address
Definition: ip6_packet.h:310
ip4_fib_get
static ip4_fib_t * ip4_fib_get(u32 index)
Get the FIB at the given index.
Definition: ip4_fib.h:113
cm
vnet_feature_config_main_t * cm
Definition: nat44_ei_hairpinning.c:591
mpls_compute_flow_hash
static u32 mpls_compute_flow_hash(const mpls_unicast_header_t *hdr, flow_hash_config_t flow_hash_config)
Definition: mpls_lookup.h:43
lookup_src_ip6_nodes
const static char *const lookup_src_ip6_nodes[]
Definition: lookup_dpo.c:1385
lookup_trace_t_
Lookup trace data.
Definition: lookup_dpo.c:318
lookup_ip6_dst_node
vlib_node_registration_t lookup_ip6_dst_node
(constructor) VLIB_REGISTER_NODE (lookup_ip6_dst_node)
Definition: lookup_dpo.c:995
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
ip6_fib_table_get_index_for_sw_if_index
u32 ip6_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
Definition: ip6_fib.c:353
dpo_vft_t_::dv_lock
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:428
ip4_address_t
Definition: ip4_packet.h:50
LOOKUP_TABLE_FROM_CONFIG
@ LOOKUP_TABLE_FROM_CONFIG
Definition: lookup_dpo.h:41
lookup_trace_t
struct lookup_trace_t_ lookup_trace_t
Lookup trace data.
mfib_table.h
format_lookup_mpls_trace
static u8 * format_lookup_mpls_trace(u8 *s, va_list *args)
Definition: lookup_dpo.c:1167
CLIB_CACHE_LINE_BYTES
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:59
LOOKUP_INPUTS
#define LOOKUP_INPUTS
Definition: lookup_dpo.h:31
mfib_forward_lookup_next_t
enum lookup_ip_dst_mcast_next_t_ mfib_forward_lookup_next_t
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
vlib_cli_output
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:716
ip6_fib_table_fwding_lookup
static u32 ip6_fib_table_fwding_lookup(u32 fib_index, const ip6_address_t *dst)
Definition: ip6_fib.h:115
ip4_header_t::dst_address
ip4_address_t dst_address
Definition: ip4_packet.h:125
mfib_table_unlock
void mfib_table_unlock(u32 fib_index, fib_protocol_t proto, mfib_source_t source)
Take a reference counting lock on the table.
Definition: mfib_table.c:777
lookup_dpo_t::lkd_table
lookup_table_t lkd_table
Switch to use the table index passed, or the table of the input interface.
Definition: lookup_dpo.h:93
ip4_src_fib_lookup_one
static void ip4_src_fib_lookup_one(u32 src_fib_index0, const ip4_address_t *addr0, u32 *src_adj_index0)
Definition: lookup_dpo.c:272
lookup_dpo_t::lkd_cast
lookup_cast_t lkd_cast
Unicast of rmulticast FIB lookup.
Definition: lookup_dpo.h:98
lookup_input_names
static const char *const lookup_input_names[]
Definition: lookup_dpo.c:28
ip4_fib_mtrie_leaf_t
u32 ip4_fib_mtrie_leaf_t
Definition: ip4_mtrie.h:52
mpls_lookup.h
lookup_ip4_dst_node
vlib_node_registration_t lookup_ip4_dst_node
(constructor) VLIB_REGISTER_NODE (lookup_ip4_dst_node)
Definition: lookup_dpo.c:651
lookup_sub_type_t
enum lookup_sub_type_t_ lookup_sub_type_t
Enumeration of the lookup subtypes.
pool_len
#define pool_len(p)
Number of elements in pool vector.
Definition: pool.h:139
vlib_validate_buffer_enqueue_x1
#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:224
index
u32 index
Definition: flow_types.api:221
always_inline
#define always_inline
Definition: rdma_mlx5dv.h:23
load_balance_main_t_::lbm_to_counters
vlib_combined_counter_main_t lbm_to_counters
Definition: load_balance.h:46
LOOKUP_TABLE_FROM_INPUT_INTERFACE
@ LOOKUP_TABLE_FROM_INPUT_INTERFACE
Definition: lookup_dpo.h:40
ip4_header_t::src_address
ip4_address_t src_address
Definition: ip4_packet.h:125
dpo_proto_to_fib
fib_protocol_t dpo_proto_to_fib(dpo_proto_t dpo_proto)
Definition: fib_types.c:359
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
vlib_combined_counter_main_t
A collection of combined counters.
Definition: counter.h:203
format_get_indent
static u32 format_get_indent(u8 *s)
Definition: format.h:72
lookup_dst_ip4_nodes
const static char *const lookup_dst_ip4_nodes[]
Definition: lookup_dpo.c:1397
vlib_put_next_frame
vlib_put_next_frame(vm, node, next_index, 0)
format_ip46_address
format_function_t format_ip46_address
Definition: ip46_address.h:50
DPO_PROTO_IP6
@ DPO_PROTO_IP6
Definition: dpo.h:65
fib_table_lock
void fib_table_lock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Release a reference counting lock on the table.
Definition: fib_table.c:1355
DPO_PROTO_MPLS
@ DPO_PROTO_MPLS
Definition: dpo.h:66
lookup_dpo_sub_types
static dpo_type_t lookup_dpo_sub_types[LOOKUP_SUB_TYPE_NUM]
An array of registered DPO type values for the sub-types.
Definition: lookup_dpo.c:60
ip.h
u32
unsigned int u32
Definition: types.h:88
table_id
u32 table_id
Definition: wireguard.api:102
lookup_ip4_dst_itf_node
vlib_node_registration_t lookup_ip4_dst_itf_node
(constructor) VLIB_REGISTER_NODE (lookup_ip4_dst_itf_node)
Definition: lookup_dpo.c:665
lookup_dpo.h
MPLS_LOOKUP_NEXT_DROP
@ MPLS_LOOKUP_NEXT_DROP
Definition: mpls_lookup.h:35
LOOKUP_SUB_TYPE_DST
@ LOOKUP_SUB_TYPE_DST
Definition: lookup_dpo.c:43
load_balance_get
static load_balance_t * load_balance_get(index_t lbi)
Definition: load_balance.h:220
lookup_dpo_mpls_inline
static uword lookup_dpo_mpls_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, int table_from_interface)
Definition: lookup_dpo.c:1031
lookup_dpo_lock
static void lookup_dpo_lock(dpo_id_t *dpo)
Definition: lookup_dpo.c:232
lookup_input_t
enum lookup_input_t_ lookup_input_t
Switch to use the packet's source or destination address for lookup.
ip4_mfib_table_lookup
fib_node_index_t ip4_mfib_table_lookup(const ip4_mfib_t *mfib, const ip4_address_t *src, const ip4_address_t *grp, u32 len)
The IPv4 Multicast-FIB.
Definition: ip4_mfib.c:241
pool_elts
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:127
lookup_sub_type_t_
lookup_sub_type_t_
Enumeration of the lookup subtypes.
Definition: lookup_dpo.c:40
LOOKUP_IP_DST_MCAST_NEXT_DROP
@ LOOKUP_IP_DST_MCAST_NEXT_DROP
Definition: lookup_dpo.c:1216
lookup_cast_t
enum lookup_cast_t_ lookup_cast_t
Switch to use the packet's source or destination address for lookup.
ip4_compute_flow_hash
static u32 ip4_compute_flow_hash(const ip4_header_t *ip, flow_hash_config_t flow_hash_config)
Definition: ip4_inlines.h:51
ip6_header_t
Definition: ip6_packet.h:294
LOOKUP_IP_DST_MCAST_NEXT_RPF
@ LOOKUP_IP_DST_MCAST_NEXT_RPF
Definition: lookup_dpo.c:1217
mpls_unicast_header_t::label_exp_s_ttl
mpls_label_t label_exp_s_ttl
Definition: packet.h:33
ip6_mfib_table_fwd_lookup
fib_node_index_t ip6_mfib_table_fwd_lookup(const ip6_mfib_t *mfib, const ip6_address_t *src, const ip6_address_t *grp)
Definition: ip6_mfib.c:352
ip4_fib.h
ip6_fib.h
ip6_header_t::src_address
ip6_address_t src_address
Definition: ip6_packet.h:310
vlib_main_t
Definition: main.h:102
lookup_dst_from_interface_nodes
const static char *const *const lookup_dst_from_interface_nodes[DPO_PROTO_NUM]
Definition: lookup_dpo.c:1450
vlib_node_t
Definition: node.h:247
dpo_vft_t_
A virtual function table regisitered for a DPO type.
Definition: dpo.h:423
format_dpo_proto
u8 * format_dpo_proto(u8 *s, va_list *args)
format a DPO protocol
Definition: dpo.c:180
vlib_add_trace
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace.c:628
mpls_fib_table_forwarding_lookup
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:122
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vlib_buffer_get_current
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:257
lookup_dpo_add_or_lock_w_table_id
void lookup_dpo_add_or_lock_w_table_id(u32 table_id, dpo_proto_t proto, lookup_cast_t cast, lookup_input_t input, lookup_table_t table_config, dpo_id_t *dpo)
Definition: lookup_dpo.c:163
vlib_buffer_t::data
u8 data[]
Packet data.
Definition: buffer.h:204
fib_table_unlock
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
Definition: fib_table.c:1336
DPO_PROTO_IP4
@ DPO_PROTO_IP4
Definition: dpo.h:64
FIB_SOURCE_RR
@ FIB_SOURCE_RR
Recursive resolution source.
Definition: fib_source.h:122
lkd_vft_w_mem_show
const static dpo_vft_t lkd_vft_w_mem_show
Definition: lookup_dpo.c:1373
dpo_id_t_
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:172
lookup_dpo_t::lkd_proto
dpo_proto_t lkd_proto
The protocol of the FIB for the lookup, and hence the protocol of the packet.
Definition: lookup_dpo.h:83
lookup_ip6_dst_mcast_node
vlib_node_registration_t lookup_ip6_dst_mcast_node
(constructor) VLIB_REGISTER_NODE (lookup_ip6_dst_mcast_node)
Definition: lookup_dpo.c:1347
IP46_TYPE_ANY
@ IP46_TYPE_ANY
Definition: ip46_address.h:24
load_balance_t_::lb_n_buckets_minus_1
u16 lb_n_buckets_minus_1
number of buckets in the load-balance - 1.
Definition: load_balance.h:121
vlib_validate_buffer_enqueue_x2
#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
ip4_fib_t_::mtrie
ip4_fib_mtrie_t mtrie
Mtrie for fast lookups.
Definition: ip4_fib.h:48
lookup_dpo_t::lkd_fib_index
fib_node_index_t lkd_fib_index
The FIB, or interface from which to get a FIB, in which to perform the next lookup;.
Definition: lookup_dpo.h:77
load_balance_t_
The FIB DPO provieds;.
Definition: load_balance.h:106
dpo_set
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
Definition: dpo.c:188
vlib_node_runtime_t
Definition: node.h:454
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
lookup_dpo_t::lkd_input
lookup_input_t lkd_input
Switch to use src or dst address.
Definition: lookup_dpo.h:88
vlib_cli_command_t
Definition: cli.h:92
format_mfib_table_name
u8 * format_mfib_table_name(u8 *s, va_list *ap)
Format the description/name of the table.
Definition: mfib_table.c:868
from
from
Definition: nat44_ei_hairpinning.c:415
INDEX_INVALID
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:49
is_pow2
static uword is_pow2(uword x)
Definition: clib.h:267
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
vlib_get_next_frame
#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:395
lookup_dpo_add_or_lock_w_fib_index
void lookup_dpo_add_or_lock_w_fib_index(fib_node_index_t fib_index, dpo_proto_t proto, lookup_cast_t cast, lookup_input_t input, lookup_table_t table_config, dpo_id_t *dpo)
Definition: lookup_dpo.c:137
VLIB_TX
@ VLIB_TX
Definition: defs.h:47
dpo_reset
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:234
n_left_from
n_left_from
Definition: nat44_ei_hairpinning.c:416
DPO_PROTO_NUM
#define DPO_PROTO_NUM
Definition: dpo.h:72
lookup_trace_t_::addr
ip46_address_t addr
Definition: lookup_dpo.c:321
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
vlib_increment_combined_counter
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
format_white_space
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:129
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
vlib_buffer_t::flags
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
Definition: buffer.h:133
lookup_dst_mpls_nodes
const static char *const lookup_dst_mpls_nodes[]
Definition: lookup_dpo.c:1407
dpo_register
void dpo_register(dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
For a given DPO type Register:
Definition: dpo.c:329
dpo_pool_barrier_release
#define dpo_pool_barrier_release(VM, YESNO)
Release barrier sync after dpo pool expansion.
Definition: dpo.h:568
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
VLIB_REGISTER_NODE
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169