FD.io VPP  v21.01.1
Vector Packet Processing
mfib_entry.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 <vlib/vlib.h>
17 
18 #include <vnet/mfib/mfib_entry.h>
21 #include <vnet/fib/fib_path_list.h>
22 #include <vnet/fib/fib_walk.h>
23 
24 #include <vnet/dpo/drop_dpo.h>
25 #include <vnet/dpo/replicate_dpo.h>
26 
27 /**
28  * the logger
29  */
31 
32 /**
33  * Pool of path extensions
34  */
36 
37 /**
38  * String names for each source
39  */
40 static const char *mfib_source_names[] = MFIB_SOURCE_NAMES;
42 
43 /*
44  * Pool for all fib_entries
45  */
47 
48 static fib_node_t *
50 {
51  return ((fib_node_t*)mfib_entry_get(index));
52 }
53 
54 static fib_protocol_t
55 mfib_entry_get_proto (const mfib_entry_t * mfib_entry)
56 {
57  return (mfib_entry->mfe_prefix.fp_proto);
58 }
59 
62 {
63  switch (mfib_entry->mfe_prefix.fp_proto)
64  {
65  case FIB_PROTOCOL_IP4:
67  case FIB_PROTOCOL_IP6:
69  case FIB_PROTOCOL_MPLS:
70  ASSERT(0);
71  break;
72  }
74 }
75 
76 static u8 *
77 format_mfib_entry_dpo (u8 * s, va_list * args)
78 {
79  index_t fei = va_arg(*args, index_t);
80  CLIB_UNUSED(u32 indent) = va_arg(*args, u32);
81 
82  return (format(s, "%U",
83  format_mfib_entry, fei,
85 }
86 
87 static inline mfib_path_ext_t *
89 {
90  return (pool_elt_at_index(mfib_path_ext_pool, mi));
91 }
92 
93 static u8 *
94 format_mfib_entry_path_ext (u8 * s, va_list * args)
95 {
96  mfib_path_ext_t *path_ext;
97  index_t mpi = va_arg(*args, index_t);
98 
99  path_ext = mfib_entry_path_ext_get(mpi);
100  return (format(s, "path:%d flags:%U",
101  path_ext->mfpe_path,
102  format_mfib_itf_flags, path_ext->mfpe_flags));
103 }
104 
105 u8 *
106 format_mfib_entry_src_flags (u8 *s, va_list *args)
107 {
109  mfib_entry_src_flags_t flag = va_arg(*args, int);
110 
111  if (!flag)
112  {
113  return format(s, "none");
114  }
115 
117  if ((1 << sattr) & flag) {
118  s = format (s, "%s,", mfib_src_attribute_names[sattr]);
119  }
120  }
121 
122  return (s);
123 }
124 
125 u8 *
126 format_mfib_entry (u8 * s, va_list * args)
127 {
128  fib_node_index_t fei, mfi;
129  mfib_entry_t *mfib_entry;
130  mfib_entry_src_t *msrc;
132  int level;
133 
134  fei = va_arg (*args, fib_node_index_t);
135  level = va_arg (*args, int);
136  mfib_entry = mfib_entry_get(fei);
137 
138  s = format (s, "%U", format_mfib_prefix, &mfib_entry->mfe_prefix);
139  s = format (s, ": %U", format_mfib_entry_flags, mfib_entry->mfe_flags);
140 
141  if (level >= MFIB_ENTRY_FORMAT_DETAIL)
142  {
143  fib_node_index_t path_index, mpi;
144 
145  s = format (s, "\n");
146  s = format (s, " fib:%d", mfib_entry->mfe_fib_index);
147  s = format (s, " index:%d", mfib_entry_get_index(mfib_entry));
148  s = format (s, " locks:%d\n", mfib_entry->mfe_node.fn_locks);
149  vec_foreach(msrc, mfib_entry->mfe_srcs)
150  {
151  s = format (s, " src:%s flags:%U locks:%d:",
154  msrc->mfes_ref_count);
155  if (msrc->mfes_cover != FIB_NODE_INDEX_INVALID)
156  {
157  s = format (s, " cover:%d", msrc->mfes_cover);
158  }
159  s = format (s, " %U\n", format_mfib_entry_flags, msrc->mfes_route_flags);
160  if (FIB_NODE_INDEX_INVALID != msrc->mfes_pl)
161  {
162  s = fib_path_list_format(msrc->mfes_pl, s);
163  }
164  s = format (s, " Extensions:\n");
165  hash_foreach(path_index, mpi, msrc->mfes_exts,
166  ({
167  s = format(s, " %U\n", format_mfib_entry_path_ext, mpi);
168  }));
169  s = format (s, " Interface-Forwarding:\n");
170  hash_foreach(sw_if_index, mfi, msrc->mfes_itfs,
171  ({
172  s = format(s, " %U\n", format_mfib_itf, mfi);
173  }));
174  }
175  }
176 
177  s = format(s, "\n Interfaces:");
178  hash_foreach(sw_if_index, mfi, mfib_entry->mfe_itfs,
179  ({
180  s = format(s, "\n %U", format_mfib_itf, mfi);
181  }));
182  if (MFIB_RPF_ID_NONE != mfib_entry->mfe_rpf_id)
183  {
184  s = format(s, "\n RPF-ID:%d", mfib_entry->mfe_rpf_id);
185  }
186  s = format(s, "\n %U-chain\n %U",
190  &mfib_entry->mfe_rep,
191  2);
192  s = format(s, "\n");
193 
194  if (level >= MFIB_ENTRY_FORMAT_DETAIL2)
195  {
196  s = format(s, "\nchildren:");
197  s = fib_node_children_format(mfib_entry->mfe_node.fn_children, s);
198  }
199 
200  return (s);
201 }
202 
203 static mfib_entry_t*
205 {
207  return ((mfib_entry_t*)node);
208 }
209 
210 static int
212  void * v2)
213 {
214  mfib_entry_src_t *esrc1 = v1, *esrc2 = v2;
215 
216  return (esrc1->mfes_src - esrc2->mfes_src);
217 }
218 
219 static void
221  mfib_source_t source)
222 
223 {
224  mfib_entry_src_t esrc = {
226  .mfes_route_flags = MFIB_ENTRY_FLAG_NONE,
227  .mfes_src = source,
228  .mfes_cover = FIB_NODE_INDEX_INVALID,
229  .mfes_sibling = FIB_NODE_INDEX_INVALID,
230  .mfes_ref_count = 1,
231  };
232 
233  vec_add1(mfib_entry->mfe_srcs, esrc);
234  vec_sort_with_function(mfib_entry->mfe_srcs,
236 }
237 
238 static mfib_entry_src_t *
240  mfib_source_t source,
241  u32 *index)
242 
243 {
244  mfib_entry_src_t *esrc;
245  int ii;
246 
247  ii = 0;
248  vec_foreach(esrc, mfib_entry->mfe_srcs)
249  {
250  if (esrc->mfes_src == source)
251  {
252  if (NULL != index)
253  {
254  *index = ii;
255  }
256  return (esrc);
257  }
258  else
259  {
260  ii++;
261  }
262  }
263 
264  return (NULL);
265 }
266 
267 static mfib_entry_src_t *
269  mfib_source_t source)
270 {
271  mfib_entry_src_t *msrc;
272 
273  msrc = mfib_entry_src_find(mfib_entry, source, NULL);
274 
275  if (NULL == msrc)
276  {
277  mfib_entry_src_init(mfib_entry, source);
278  msrc = mfib_entry_src_find(mfib_entry, source, NULL);
279  }
280 
281  return (msrc);
282 }
283 
284 static mfib_entry_src_t *
286  mfib_source_t source,
289 {
290  mfib_entry_src_t *msrc;
291 
292  msrc = mfib_entry_src_find_or_create(mfib_entry, source);
293 
295  msrc->mfes_rpf_id = rpf_id;
297 
298  return (msrc);
299 }
300 
301 static mfib_entry_src_t *
303  mfib_source_t source,
306 {
307  mfib_entry_src_t *msrc;
308 
309  msrc = mfib_entry_src_update(mfib_entry, source, rpf_id, entry_flags);
310 
311  msrc->mfes_ref_count++;
313 
314  return (msrc);
315 }
316 
319 {
320  mfib_entry_src_t *bsrc;
321 
322  /*
323  * the enum of sources is deliberately arranged in priority order
324  */
325  if (0 == vec_len(mfib_entry->mfe_srcs))
326  {
327  bsrc = NULL;
328  }
329  else
330  {
331  bsrc = vec_elt_at_index(mfib_entry->mfe_srcs, 0);
332  }
333 
334  return (bsrc);
335 }
336 
337 static mfib_source_t
339 {
340  mfib_entry_src_t *bsrc;
341 
342  bsrc = mfib_entry_get_best_src(mfib_entry);
343 
344  return (bsrc->mfes_src);
345 }
346 
347 int
349  mfib_source_t source)
350 {
351  mfib_entry_t *mfib_entry;
352 
353  mfib_entry = mfib_entry_get(mfib_entry_index);
354 
355  return (NULL != mfib_entry_src_find(mfib_entry, source, NULL));
356 }
357 
358 int
360  mfib_source_t source)
361 {
362  mfib_entry_t *mfib_entry;
363  mfib_entry_src_t *esrc;
364 
365  mfib_entry = mfib_entry_get(mfib_entry_index);
366 
367  esrc = mfib_entry_src_find(mfib_entry, source, NULL);
368 
369  if (NULL == esrc)
370  {
371  return (0);
372  }
373  else
374  {
375  return (!!(esrc->mfes_flags & MFIB_ENTRY_SRC_FLAG_STALE));
376  }
377 }
378 
379 void
381  mfib_source_t source)
382 {
383  mfib_entry_t *mfib_entry;
384  mfib_entry_src_t *esrc;
385 
386  mfib_entry = mfib_entry_get(fib_entry_index);
387 
388  esrc = mfib_entry_src_find(mfib_entry, source, NULL);
389 
390  if (NULL != esrc)
391  {
393  }
394 }
395 
396 int
398 {
399  return (mfib_prefix_is_host(mfib_entry_get_prefix(mfib_entry_index)));
400 }
401 
402 
403 static void
405 {
407  index_t mfii;
408 
409  hash_foreach(sw_if_index, mfii, msrc->mfes_itfs,
410  ({
411  mfib_itf_delete(mfib_itf_get(mfii));
412  }));
413  hash_free(msrc->mfes_itfs);
414  msrc->mfes_itfs = NULL;
416 }
417 
418 static void
420  mfib_source_t source)
421 
422 {
423  mfib_entry_src_t *msrc;
424  u32 index = ~0;
425 
426  msrc = mfib_entry_src_find(mfib_entry, source, &index);
427 
428  if (NULL != msrc)
429  {
430  ASSERT(0 != msrc->mfes_ref_count);
431  msrc->mfes_ref_count--;
432 
433  if (0 == msrc->mfes_ref_count)
434  {
435  mfib_entry_src_deactivate(mfib_entry, msrc);
436  mfib_entry_src_flush(msrc);
437 
438  vec_del1(mfib_entry->mfe_srcs, index);
439  if (vec_len (mfib_entry->mfe_srcs) > 1)
440  vec_sort_with_function(mfib_entry->mfe_srcs,
442  }
443  }
444 }
445 
446 u32
448  fib_node_type_t child_type,
449  fib_node_index_t child_index)
450 {
452  mfib_entry_index,
453  child_type,
454  child_index));
455 };
456 
457 void
459  u32 sibling_index)
460 {
462  mfib_entry_index,
463  sibling_index);
464 }
465 
466 static mfib_entry_t *
468  const mfib_prefix_t *prefix,
469  fib_node_index_t *mfib_entry_index)
470 {
471  mfib_entry_t *mfib_entry;
472 
473  pool_get_aligned(mfib_entry_pool, mfib_entry, CLIB_CACHE_LINE_BYTES);
474 
475  fib_node_init(&mfib_entry->mfe_node,
477 
478  /*
479  * Some of the members require non-default initialisation
480  * so we also init those that don't and thus save on the call to clib_memset.
481  */
482  mfib_entry->mfe_flags = 0;
483  mfib_entry->mfe_fib_index = fib_index;
484  mfib_entry->mfe_prefix = *prefix;
485  mfib_entry->mfe_srcs = NULL;
486  mfib_entry->mfe_itfs = NULL;
487  mfib_entry->mfe_rpf_id = MFIB_RPF_ID_NONE;
488  mfib_entry->mfe_pl = FIB_NODE_INDEX_INVALID;
489 
490  dpo_reset(&mfib_entry->mfe_rep);
491 
492  *mfib_entry_index = mfib_entry_get_index(mfib_entry);
493 
494  MFIB_ENTRY_DBG(mfib_entry, "alloc");
495 
496  return (mfib_entry);
497 }
498 
499 static inline mfib_path_ext_t *
501  fib_node_index_t path_index)
502 {
503  uword *p;
504 
505  p = hash_get(exts, path_index);
506 
507  if (NULL != p)
508  {
509  return (mfib_entry_path_ext_get(p[0]));
510  }
511 
512  return (NULL);
513 }
514 
515 static mfib_path_ext_t*
517  fib_node_index_t path_index,
518  mfib_itf_flags_t mfi_flags)
519 {
520  mfib_path_ext_t *path_ext;
521 
522  pool_get(mfib_path_ext_pool, path_ext);
523 
524  path_ext->mfpe_flags = mfi_flags;
525  path_ext->mfpe_path = path_index;
526 
527  hash_set(msrc->mfes_exts, path_index,
528  path_ext - mfib_path_ext_pool);
529 
530  return (path_ext);
531 }
532 
533 static void
535  fib_node_index_t path_index)
536 {
537  mfib_path_ext_t *path_ext;
538 
539  path_ext = mfib_entry_path_ext_find(msrc->mfes_exts, path_index);
540 
541  hash_unset(msrc->mfes_exts, path_index);
542  pool_put(mfib_path_ext_pool, path_ext);
543 }
544 
546 {
551 
554  fib_node_index_t path_index,
555  void *arg)
556 {
559 
560  ctx = arg;
561 
562  /*
563  * if the path is not resolved, don't include it.
564  */
565  if (!fib_path_is_resolved(path_index))
566  {
568  }
569 
570  /*
571  * If the path is not forwarding to use it
572  */
573  mfib_path_ext_t *path_ext;
574 
575  path_ext = mfib_entry_path_ext_find(ctx->msrc->mfes_exts,
576  path_index);
577 
578  if (NULL != path_ext &&
579  !(path_ext->mfpe_flags & MFIB_ITF_FLAG_FORWARD))
580  {
582  }
583 
584  switch (ctx->fct)
585  {
588  /*
589  * EOS traffic with no label to stack, we need the IP Adj
590  */
591  vec_add2(ctx->next_hops, nh, 1);
592 
593  nh->path_index = path_index;
594  nh->path_weight = fib_path_get_weight(path_index);
595  fib_path_contribute_forwarding(path_index, ctx->fct, &nh->path_dpo);
596  break;
597 
605  ASSERT(0);
606  break;
607  }
608 
610 }
611 
612 static void
615 {
616  dpo_proto_t dp;
617 
618  dp = fib_proto_to_dpo(mfib_entry_get_proto(mfib_entry));
619 
620  /*
621  * unlink the enty from the previous path list.
622  */
623  if (FIB_NODE_INDEX_INVALID != mfib_entry->mfe_pl)
624  {
626  mfib_entry->mfe_sibling);
627  }
628 
629  if (NULL != msrc)
630  {
632  .next_hops = NULL,
633  .fct = mfib_entry_get_default_chain_type(mfib_entry),
634  .msrc = msrc,
635  };
636 
637  /*
638  * link the entry to the path-list.
639  * The entry needs to be a child so that we receive the back-walk
640  * updates to recalculate forwarding.
641  */
642  mfib_entry->mfe_pl = msrc->mfes_pl;
643  mfib_entry->mfe_flags = msrc->mfes_route_flags;
644  mfib_entry->mfe_itfs = msrc->mfes_itfs;
645  mfib_entry->mfe_rpf_id = msrc->mfes_rpf_id;
646 
647  if (FIB_NODE_INDEX_INVALID != mfib_entry->mfe_pl)
648  {
649  mfib_entry->mfe_sibling =
650  fib_path_list_child_add(mfib_entry->mfe_pl,
652  mfib_entry_get_index(mfib_entry));
653 
654  fib_path_list_walk(mfib_entry->mfe_pl,
656  &ctx);
657  }
658  if (!(MFIB_ENTRY_FLAG_EXCLUSIVE & mfib_entry->mfe_flags))
659  {
660  if (NULL == ctx.next_hops)
661  {
662  /*
663  * no next-hops, stack directly on the drop
664  */
666  &mfib_entry->mfe_rep,
667  drop_dpo_get(dp));
668  }
669  else
670  {
671  /*
672  * each path contirbutes a next-hop. form a replicate
673  * from those choices.
674  */
675  if (!dpo_id_is_valid(&mfib_entry->mfe_rep) ||
676  dpo_is_drop(&mfib_entry->mfe_rep))
677  {
678  dpo_id_t tmp_dpo = DPO_INVALID;
679 
680  dpo_set(&tmp_dpo,
681  DPO_REPLICATE, dp,
682  replicate_create(0, dp));
683 
685  &mfib_entry->mfe_rep,
686  &tmp_dpo);
687 
688  dpo_reset(&tmp_dpo);
689  }
690  replicate_multipath_update(&mfib_entry->mfe_rep,
691  ctx.next_hops);
692  }
693  }
694  else
695  {
696  /*
697  * for exclusive routes the source provided a replicate DPO
698  * which we stashed in the special path list with one path,
699  * so we can stack directly on that.
700  */
701  ASSERT(1 == vec_len(ctx.next_hops));
702 
703  if (NULL != ctx.next_hops)
704  {
706  &mfib_entry->mfe_rep,
707  &ctx.next_hops[0].path_dpo);
708  dpo_reset(&ctx.next_hops[0].path_dpo);
709  vec_free(ctx.next_hops);
710  }
711  else
712  {
714  &mfib_entry->mfe_rep,
715  drop_dpo_get(dp));
716  }
717  }
718  }
719  else
720  {
722  &mfib_entry->mfe_rep,
723  drop_dpo_get(dp));
724  }
725 
726  /*
727  * time for walkies fido.
728  */
729  fib_node_back_walk_ctx_t bw_ctx = {
731  };
732 
734  mfib_entry_get_index(mfib_entry),
735  &bw_ctx);
736 }
737 
738 static fib_node_index_t*
740  const fib_route_path_t *rpaths)
741 {
743 
745 
746  if (FIB_NODE_INDEX_INVALID == msrc->mfes_pl)
747  {
748  /* A non-shared path-list */
750  NULL);
752  }
753 
754  return (fib_path_list_paths_add(msrc->mfes_pl, rpaths));
755 }
756 
757 static fib_node_index_t*
759  const fib_route_path_t *rpaths)
760 {
762 
764 
765  return (fib_path_list_paths_remove(msrc->mfes_pl, rpaths));
766 }
767 
768 static void
770  mfib_source_t old_best)
771 {
772  mfib_entry_src_t *bsrc, *osrc;
773 
774  /*
775  * copy the forwarding data from the bast source
776  */
777  bsrc = mfib_entry_get_best_src(mfib_entry);
778  osrc = mfib_entry_src_find(mfib_entry, old_best, NULL);
779 
780  if (NULL != bsrc)
781  {
782  if (bsrc->mfes_src != old_best)
783  {
784  /*
785  * we are changing from one source to another
786  * deactivate the old, and activate the new
787  */
788  mfib_entry_src_deactivate(mfib_entry, osrc);
789  mfib_entry_src_activate(mfib_entry, bsrc);
790  }
791  }
792  else
793  {
794  mfib_entry_src_deactivate(mfib_entry, osrc);
795  }
796 
797  mfib_entry_stack(mfib_entry, bsrc);
798  mfib_entry_cover_update_notify(mfib_entry);
799 }
800 
801 
804  mfib_source_t source,
805  const mfib_prefix_t *prefix,
808  index_t repi)
809 {
810  fib_node_index_t mfib_entry_index;
811  mfib_entry_t *mfib_entry;
813 
814  mfib_entry = mfib_entry_alloc(fib_index, prefix,
815  &mfib_entry_index);
816  msrc = mfib_entry_src_update(mfib_entry, source,
817  rpf_id, entry_flags);
818 
819  if (INDEX_INVALID != repi)
820  {
821  /*
822  * The source is providing its own replicate DPO.
823  * Create a sepcial path-list to manage it, that way
824  * this entry and the source are equivalent to a normal
825  * entry
826  */
827  fib_node_index_t old_pl_index;
828  dpo_proto_t dp;
829  dpo_id_t dpo = DPO_INVALID;
830 
831  dp = fib_proto_to_dpo(mfib_entry_get_proto(mfib_entry));
832  old_pl_index = msrc->mfes_pl;
833 
834  dpo_set(&dpo, DPO_REPLICATE, dp, repi);
835 
836  msrc->mfes_pl =
839  &dpo);
840 
841  dpo_reset(&dpo);
843  fib_path_list_unlock(old_pl_index);
844  }
845 
847 
848  return (mfib_entry_index);
849 }
850 
851 static int
853 {
854  return (0 == vec_len(mfib_entry->mfe_srcs));
855 }
856 
857 static int
859 {
860  return ((INDEX_INVALID == msrc->mfes_cover &&
862  0 == fib_path_list_get_n_paths(msrc->mfes_pl)) &&
863  (0 == hash_elts(msrc->mfes_itfs)));
864 
865  /* return ((MFIB_ENTRY_FLAG_NONE == msrc->mfes_route_flags) && */
866  /* (0 == fib_path_list_get_n_paths(msrc->mfes_pl)) && */
867  /* (0 == hash_elts(msrc->mfes_itfs))); */
868 }
869 
870 
871 static void
874  mfib_source_t current_best,
875  index_t repi)
876 {
877  if (INDEX_INVALID != repi)
878  {
879  /*
880  * The source is providing its own replicate DPO.
881  * Create a sepcial path-list to manage it, that way
882  * this entry and the source are equivalent to a normal
883  * entry
884  */
885  fib_node_index_t old_pl_index;
886  dpo_proto_t dp;
887  dpo_id_t dpo = DPO_INVALID;
888 
889  dp = fib_proto_to_dpo(mfib_entry_get_proto(mfib_entry));
890  old_pl_index = msrc->mfes_pl;
891 
892  dpo_set(&dpo, DPO_REPLICATE, dp, repi);
893 
894  msrc->mfes_pl =
897  &dpo);
898 
899  dpo_reset(&dpo);
901  fib_path_list_unlock(old_pl_index);
902  }
903 
905  {
906  /*
907  * this source has no interfaces and no flags.
908  * it has nothing left to give - remove it
909  */
910  mfib_entry_src_remove(mfib_entry, msrc->mfes_src);
911  }
912 
913  mfib_entry_recalculate_forwarding(mfib_entry, current_best);
914 }
915 
916 int
918  mfib_source_t source,
921  index_t repi)
922 {
923  mfib_source_t current_best;
924  mfib_entry_t *mfib_entry;
926 
927  mfib_entry = mfib_entry_get(mfib_entry_index);
928  current_best = mfib_entry_get_best_source(mfib_entry);
929 
930  msrc = mfib_entry_src_update_and_lock(mfib_entry, source, rpf_id,
931  entry_flags);
932 
933  mfib_entry_update_i(mfib_entry, msrc, current_best, repi);
934 
935  return (mfib_entry_ok_for_delete(mfib_entry));
936 }
937 
938 int
940  mfib_source_t source,
943  index_t repi)
944 {
945  mfib_source_t current_best;
946  mfib_entry_t *mfib_entry;
948 
949  mfib_entry = mfib_entry_get(mfib_entry_index);
950  current_best = mfib_entry_get_best_source(mfib_entry);
951  msrc = mfib_entry_src_update(mfib_entry, source, rpf_id, entry_flags);
952 
953  mfib_entry_update_i(mfib_entry, msrc, current_best, repi);
954 
955  return (mfib_entry_ok_for_delete(mfib_entry));
956 }
957 
958 static void
961  index_t mi)
962 {
963  hash_set(msrc->mfes_itfs, sw_if_index, mi);
964 }
965 
966 static void
969 {
970  mfib_itf_t *mfi;
971 
972  mfi = mfib_entry_itf_find(msrc->mfes_itfs, sw_if_index);
973 
974  mfib_itf_delete(mfi);
975 
976  hash_unset(msrc->mfes_itfs, sw_if_index);
977 }
978 
979 static int
981 {
982  return (!(rpath->frp_flags & FIB_ROUTE_PATH_BIER_IMP) &&
983  ~0 != rpath->frp_sw_if_index);
984 }
985 
986 void
988  mfib_source_t source,
989  const fib_route_path_t *rpaths)
990 {
991  fib_node_index_t* path_indices, path_index;
992  const fib_route_path_t *rpath;
993  mfib_source_t current_best;
994  mfib_path_ext_t *path_ext;
995  const mfib_prefix_t *pfx;
996  mfib_entry_t *mfib_entry;
998  mfib_itf_flags_t old;
999  u32 ii;
1000 
1001  mfib_entry = mfib_entry_get(mfib_entry_index);
1002  pfx = mfib_entry_get_prefix(mfib_entry_index);
1003  ASSERT(NULL != mfib_entry);
1004  current_best = mfib_entry_get_best_source(mfib_entry);
1005  msrc = mfib_entry_src_find_or_create(mfib_entry, source);
1006 
1007  /*
1008  * add the path to the path-list. If it's a duplicate we'll get
1009  * back the original path.
1010  */
1011  path_indices = mfib_entry_src_paths_add(msrc, rpaths);
1012 
1013  vec_foreach_index(ii, path_indices)
1014  {
1015  path_index = path_indices[ii];
1016  rpath = &rpaths[ii];
1017 
1018  if (FIB_NODE_INDEX_INVALID == path_index)
1019  continue;
1020 
1021  /*
1022  * find the path extension for that path
1023  */
1024  path_ext = mfib_entry_path_ext_find(msrc->mfes_exts, path_index);
1025 
1026  if (NULL == path_ext)
1027  {
1028  old = MFIB_ITF_FLAG_NONE;
1029  path_ext = mfib_path_ext_add(msrc, path_index,
1030  rpath->frp_mitf_flags);
1031  }
1032  else
1033  {
1034  old = path_ext->mfpe_flags;
1035  path_ext->mfpe_flags = rpath->frp_mitf_flags;
1036  }
1037 
1038  /*
1039  * Has the path changed its contribution to the input interface set.
1040  * Which only paths with interfaces can do...
1041  */
1042  if (mfib_entry_path_itf_based(rpath))
1043  {
1044  mfib_itf_t *mfib_itf;
1045 
1046  if (old != rpath->frp_mitf_flags)
1047  {
1048  /*
1049  * change of flag contributions
1050  */
1051  mfib_itf = mfib_entry_itf_find(msrc->mfes_itfs,
1052  rpath->frp_sw_if_index);
1053 
1054  if (NULL == mfib_itf)
1055  {
1056  index_t mfib_itf_i = mfib_itf_create(path_index,
1057  rpath->frp_mitf_flags);
1058  mfib_entry_itf_add(msrc,
1059  rpath->frp_sw_if_index,
1060  mfib_itf_i);
1061 
1062  if (MFIB_ITF_FLAG_ACCEPT & rpath->frp_mitf_flags)
1063  {
1064  /* new accepting interface - add the mac to the driver */
1065  mfib_itf_mac_add(mfib_itf_get(mfib_itf_i), pfx);
1066  }
1067  }
1068  else
1069  {
1070  u8 was_accept = !!(old & MFIB_ITF_FLAG_ACCEPT);
1071  u8 is_accept = !!(rpath->frp_mitf_flags & MFIB_ITF_FLAG_ACCEPT);
1072 
1073  if (mfib_itf_update(mfib_itf,
1074  path_index,
1075  rpath->frp_mitf_flags))
1076  {
1077  /*
1078  * no more interface flags on this path, remove
1079  * from the data-plane set
1080  */
1081  if (was_accept)
1082  {
1083  mfib_itf_mac_del(mfib_itf, pfx);
1084 
1085  }
1086  mfib_entry_itf_remove(msrc, rpath->frp_sw_if_index);
1087  }
1088  else
1089  {
1090  /*
1091  * is there a change to the ACCEPT flag that
1092  * requires us to update hte driver with the
1093  * MAC
1094  */
1095  if (is_accept != was_accept)
1096  {
1097  if (is_accept)
1098  {
1099  mfib_itf_mac_add(mfib_itf, pfx);
1100  }
1101  else if (was_accept)
1102  {
1103  mfib_itf_mac_del(mfib_itf, pfx);
1104  }
1105  }
1106  }
1107  }
1108  }
1109  }
1110  }
1111  vec_free(path_indices);
1112 
1113  mfib_entry_recalculate_forwarding(mfib_entry, current_best);
1114 }
1115 
1116 /*
1117  * mfib_entry_path_remove
1118  *
1119  * remove a path from the entry.
1120  * return the mfib_entry's index if it is still present, INVALID otherwise.
1121  */
1122 int
1124  mfib_source_t source,
1125  const fib_route_path_t *rpaths)
1126 {
1127  fib_node_index_t path_index, *path_indices;
1128  const fib_route_path_t *rpath;
1129  mfib_source_t current_best;
1130  const mfib_prefix_t *pfx;
1131  mfib_entry_t *mfib_entry;
1133  u32 ii;
1134 
1135  mfib_entry = mfib_entry_get(mfib_entry_index);
1136  pfx = mfib_entry_get_prefix(mfib_entry_index);
1137  ASSERT(NULL != mfib_entry);
1138  current_best = mfib_entry_get_best_source(mfib_entry);
1139  msrc = mfib_entry_src_find(mfib_entry, source, NULL);
1140 
1141  if (NULL == msrc)
1142  {
1143  /*
1144  * there are no paths left for this source
1145  */
1146  return (mfib_entry_ok_for_delete(mfib_entry));
1147  }
1148 
1149  /*
1150  * remove the paths from the path-list. If it's not there we'll get
1151  * back an empty vector
1152  */
1153  path_indices = mfib_entry_src_paths_remove(msrc, rpaths);
1154 
1155  vec_foreach_index(ii, path_indices)
1156  {
1157  path_index = path_indices[ii];
1158  rpath = &rpaths[ii];
1159 
1160  if (FIB_NODE_INDEX_INVALID == path_index)
1161  continue;
1162 
1163  /*
1164  * don't need the extension, nor the interface anymore
1165  */
1166  mfib_path_ext_remove(msrc, path_index);
1167  if (mfib_entry_path_itf_based(rpath))
1168  {
1169  u8 was_accept, is_accept;
1170  mfib_itf_t *mfib_itf;
1171 
1172  mfib_itf = mfib_entry_itf_find(msrc->mfes_itfs,
1173  rpath->frp_sw_if_index);
1174  was_accept = !!(MFIB_ITF_FLAG_ACCEPT & mfib_itf->mfi_flags);
1175 
1176  if (mfib_itf_update(mfib_itf,
1177  path_index,
1179  {
1180  if (was_accept)
1181  {
1182  mfib_itf_mac_del(mfib_itf, pfx);
1183  }
1184 
1185  /*
1186  * no more interface flags on this path, remove
1187  * from the data-plane set
1188  */
1189  mfib_entry_itf_remove(msrc, rpath->frp_sw_if_index);
1190  }
1191  else
1192  {
1193  is_accept = !!(MFIB_ITF_FLAG_ACCEPT & mfib_itf->mfi_flags);
1194 
1195  if (was_accept && !is_accept)
1196  {
1197  mfib_itf_mac_del(mfib_itf, pfx);
1198  }
1199  }
1200  }
1201  }
1202  vec_free(path_indices);
1203 
1204  if (mfib_entry_src_ok_for_delete(msrc))
1205  {
1206  /*
1207  * this source has no interfaces and no flags.
1208  * it has nothing left to give - remove it
1209  */
1210  mfib_entry_src_remove(mfib_entry, source);
1211  }
1212 
1213  mfib_entry_recalculate_forwarding(mfib_entry, current_best);
1214 
1215  return (mfib_entry_ok_for_delete(mfib_entry));
1216 }
1217 
1218 /**
1219  * mfib_entry_delete
1220  *
1221  * The source is withdrawing all the paths it provided
1222  */
1223 int
1225  mfib_source_t source)
1226 {
1227  mfib_source_t current_best;
1228  mfib_entry_t *mfib_entry;
1229 
1230  mfib_entry = mfib_entry_get(mfib_entry_index);
1231  current_best = mfib_entry_get_best_source(mfib_entry);
1232  mfib_entry_src_remove(mfib_entry, source);
1233 
1234  mfib_entry_recalculate_forwarding(mfib_entry, current_best);
1235 
1236  return (mfib_entry_ok_for_delete(mfib_entry));
1237 }
1238 
1239 static int
1241  ip4_address_t * a2)
1242 {
1243  /*
1244  * IP addresses are unsiged ints. the return value here needs to be signed
1245  * a simple subtraction won't cut it.
1246  * If the addresses are the same, the sort order is undefiend, so phoey.
1247  */
1248  return ((clib_net_to_host_u32(a1->data_u32) >
1249  clib_net_to_host_u32(a2->data_u32) ) ?
1250  1 : -1);
1251 }
1252 
1253 static int
1254 fib_ip6_address_compare (ip6_address_t * a1,
1255  ip6_address_t * a2)
1256 {
1257  int i;
1258  for (i = 0; i < ARRAY_LEN (a1->as_u16); i++)
1259  {
1260  int cmp = (clib_net_to_host_u16 (a1->as_u16[i]) -
1261  clib_net_to_host_u16 (a2->as_u16[i]));
1262  if (cmp != 0)
1263  return cmp;
1264  }
1265  return 0;
1266 }
1267 
1268 static int
1270  fib_node_index_t mfib_entry_index2)
1271 {
1272  mfib_entry_t *mfib_entry1, *mfib_entry2;
1273  int cmp = 0;
1274 
1275  mfib_entry1 = mfib_entry_get(mfib_entry_index1);
1276  mfib_entry2 = mfib_entry_get(mfib_entry_index2);
1277 
1278  switch (mfib_entry1->mfe_prefix.fp_proto)
1279  {
1280  case FIB_PROTOCOL_IP4:
1281  cmp = fib_ip4_address_compare(&mfib_entry1->mfe_prefix.fp_grp_addr.ip4,
1282  &mfib_entry2->mfe_prefix.fp_grp_addr.ip4);
1283 
1284  if (0 == cmp)
1285  {
1286  cmp = fib_ip4_address_compare(&mfib_entry1->mfe_prefix.fp_src_addr.ip4,
1287  &mfib_entry2->mfe_prefix.fp_src_addr.ip4);
1288  }
1289  break;
1290  case FIB_PROTOCOL_IP6:
1291  cmp = fib_ip6_address_compare(&mfib_entry1->mfe_prefix.fp_grp_addr.ip6,
1292  &mfib_entry2->mfe_prefix.fp_grp_addr.ip6);
1293 
1294  if (0 == cmp)
1295  {
1296  cmp = fib_ip6_address_compare(&mfib_entry1->mfe_prefix.fp_src_addr.ip6,
1297  &mfib_entry2->mfe_prefix.fp_src_addr.ip6);
1298  }
1299  break;
1300  case FIB_PROTOCOL_MPLS:
1301  ASSERT(0);
1302  cmp = 0;
1303  break;
1304  }
1305 
1306  if (0 == cmp) {
1307  cmp = (mfib_entry1->mfe_prefix.fp_len - mfib_entry2->mfe_prefix.fp_len);
1308  }
1309  return (cmp);
1310 }
1311 
1312 int
1313 mfib_entry_cmp_for_sort (void *i1, void *i2)
1314 {
1315  fib_node_index_t *mfib_entry_index1 = i1, *mfib_entry_index2 = i2;
1316 
1317  return (mfib_entry_cmp(*mfib_entry_index1,
1318  *mfib_entry_index2));
1319 }
1320 
1321 static void
1323 {
1324  mfib_entry_t *mfib_entry;
1326 
1327  mfib_entry = mfib_entry_from_fib_node(node);
1328 
1329  dpo_reset(&mfib_entry->mfe_rep);
1330 
1331  MFIB_ENTRY_DBG(mfib_entry, "last-lock");
1332 
1333  vec_foreach(msrc, mfib_entry->mfe_srcs)
1334  {
1335  mfib_entry_src_flush(msrc);
1336  }
1337 
1338  vec_free(mfib_entry->mfe_srcs);
1339 
1340  fib_node_deinit(&mfib_entry->mfe_node);
1341  pool_put(mfib_entry_pool, mfib_entry);
1342 }
1343 
1344 u32
1346 {
1347  mfib_entry_t *mfib_entry;
1348 
1349  mfib_entry = mfib_entry_get(fib_entry_index);
1350 
1351  return (mfib_entry->mfe_rep.dpoi_index);
1352 }
1353 
1354 /*
1355  * mfib_entry_back_walk_notify
1356  *
1357  * A back walk has reach this entry.
1358  */
1362 {
1363  mfib_entry_t *mfib_entry;
1364 
1365  mfib_entry = mfib_entry_from_fib_node(node);
1367  mfib_entry_get_best_source(mfib_entry));
1368 
1369  return (FIB_NODE_BACK_WALK_CONTINUE);
1370 }
1371 
1372 static void
1374 {
1375  fib_show_memory_usage("multicast-Entry",
1376  pool_elts(mfib_entry_pool),
1377  pool_len(mfib_entry_pool),
1378  sizeof(mfib_entry_t));
1379 }
1380 
1381 /*
1382  * The MFIB entry's graph node virtual function table
1383  */
1384 static const fib_node_vft_t mfib_entry_vft = {
1386  .fnv_last_lock = mfib_entry_last_lock_gone,
1387  .fnv_back_walk = mfib_entry_back_walk_notify,
1388  .fnv_mem_show = mfib_entry_show_memory,
1389 };
1390 
1391 void
1393 {
1394  mfib_entry_t *mfib_entry;
1395 
1396  mfib_entry = mfib_entry_get(mfib_entry_index);
1397 
1398  fib_node_lock(&mfib_entry->mfe_node);
1399 }
1400 
1401 void
1403 {
1404  mfib_entry_t *mfib_entry;
1405 
1406  mfib_entry = mfib_entry_get(mfib_entry_index);
1407 
1408  fib_node_unlock(&mfib_entry->mfe_node);
1409 }
1410 
1411 static void
1413 {
1414 }
1415 static void
1417 {
1418 }
1419 
1420 const static dpo_vft_t mfib_entry_dpo_vft = {
1422  .dv_unlock = mfib_entry_dpo_unlock,
1423  .dv_format = format_mfib_entry_dpo,
1424  .dv_mem_show = mfib_entry_show_memory,
1425 };
1426 
1427 const static char* const mfib_entry_ip4_nodes[] =
1428 {
1429  "ip4-mfib-forward-rpf",
1430  NULL,
1431 };
1432 const static char* const mfib_entry_ip6_nodes[] =
1433 {
1434  "ip6-mfib-forward-rpf",
1435  NULL,
1436 };
1437 
1438 const static char* const * const mfib_entry_nodes[DPO_PROTO_NUM] =
1439 {
1442 };
1443 
1444 void
1446 {
1448  dpo_register(DPO_MFIB_ENTRY, &mfib_entry_dpo_vft, mfib_entry_nodes);
1449  mfib_entry_logger = vlib_log_register_class("mfib", "entry");
1450 }
1451 
1454 {
1456  .rpaths = NULL,
1457  };
1458  mfib_entry_t *mfib_entry;
1459  fib_route_path_t *rpath;
1460  mfib_entry_src_t *bsrc;
1461 
1462  mfib_entry = mfib_entry_get(mfib_entry_index);
1463  bsrc = mfib_entry_get_best_src(mfib_entry);
1464 
1465  if (FIB_NODE_INDEX_INVALID != bsrc->mfes_pl)
1466  {
1468  NULL,
1470  &ctx);
1471  }
1472 
1473  vec_foreach(rpath, ctx.rpaths)
1474  {
1475  mfib_itf_t *mfib_itf;
1476 
1477  mfib_itf = mfib_entry_itf_find(bsrc->mfes_itfs,
1478  rpath->frp_sw_if_index);
1479  if (mfib_itf)
1480  {
1481  rpath->frp_mitf_flags = mfib_itf->mfi_flags;
1482  }
1483  }
1484 
1485  return (ctx.rpaths);
1486 }
1487 
1488 const mfib_prefix_t *
1490 {
1491  mfib_entry_t *mfib_entry;
1492 
1493  mfib_entry = mfib_entry_get(mfib_entry_index);
1494 
1495  return (&mfib_entry->mfe_prefix);
1496 }
1497 
1498 u32
1500 {
1501  mfib_entry_t *mfib_entry;
1502 
1503  mfib_entry = mfib_entry_get(mfib_entry_index);
1504 
1505  return (mfib_entry->mfe_fib_index);
1506 }
1507 
1508 const dpo_id_t*
1510 {
1511  mfib_entry_t *mfib_entry;
1512 
1513  mfib_entry = mfib_entry_get(mfib_entry_index);
1514 
1515  return (&mfib_entry->mfe_rep);
1516 }
1517 
1518 void
1522  dpo_id_t *dpo)
1523 {
1524  /*
1525  * An IP mFIB entry can only provide a forwarding chain that
1526  * is the same IP proto as the prefix.
1527  * No use-cases (i know of) for other combinations.
1528  */
1529  mfib_entry_t *mfib_entry;
1530  dpo_proto_t dp;
1531 
1532  mfib_entry = mfib_entry_get(mfib_entry_index);
1533 
1534  dp = fib_proto_to_dpo(mfib_entry->mfe_prefix.fp_proto);
1535 
1536  if (type == mfib_forw_chain_type_from_dpo_proto(dp))
1537  {
1538  replicate_t * rep;
1539 
1540  rep = replicate_get(mfib_entry->mfe_rep.dpoi_index);
1541 
1542  if ((rep->rep_flags & REPLICATE_FLAGS_HAS_LOCAL) &&
1543  (flags & MFIB_ENTRY_FWD_FLAG_NO_LOCAL))
1544  {
1545  /*
1546  * caller does not want the local paths that the entry has
1547  */
1548  dpo_proto_t rep_proto = rep->rep_proto;
1549  dpo_set(dpo, DPO_REPLICATE, rep_proto,
1551  mfib_entry->mfe_rep.dpoi_index));
1552  }
1553  else
1554  {
1555  dpo_copy(dpo, &mfib_entry->mfe_rep);
1556  }
1557  }
1558  else
1559  {
1560  dpo_copy(dpo, drop_dpo_get(dp));
1561  }
1562 }
1563 
1564 /*
1565  * fib_entry_cover_changed
1566  *
1567  * this entry is tracking its cover and that cover has changed.
1568  */
1569 void
1571 {
1572  mfib_entry_t *mfib_entry;
1574  mfib_src_res_t res;
1575 
1576  mfib_entry = mfib_entry_get(mfib_entry_index);
1577  msrc = mfib_entry_get_best_src(mfib_entry);
1578 
1579  res = mfib_entry_src_cover_change(mfib_entry, msrc);
1580 
1581  if (MFIB_SRC_REEVALUATE == res)
1582  {
1583  mfib_entry_recalculate_forwarding(mfib_entry, msrc->mfes_src);
1584  }
1585  MFIB_ENTRY_DBG(mfib_entry, "cover-changed");
1586 }
1587 
1588 /*
1589  * mfib_entry_cover_updated
1590  *
1591  * this entry is tracking its cover and that cover has been updated
1592  * (i.e. its forwarding information has changed).
1593  */
1594 void
1596 {
1597  mfib_entry_t *mfib_entry;
1599  mfib_src_res_t res;
1600 
1601  mfib_entry = mfib_entry_get(mfib_entry_index);
1602  msrc = mfib_entry_get_best_src(mfib_entry);
1603 
1604  res = mfib_entry_src_cover_update(mfib_entry, msrc);
1605 
1606  if (MFIB_SRC_REEVALUATE == res)
1607  {
1608  mfib_entry_recalculate_forwarding(mfib_entry, msrc->mfes_src);
1609  }
1610  MFIB_ENTRY_DBG(mfib_entry, "cover-updated");
1611 }
1612 
1613 u32
1615 {
1616  return (pool_elts(mfib_entry_pool));
1617 }
1618 
1619 static clib_error_t *
1621  unformat_input_t * input,
1622  vlib_cli_command_t * cmd)
1623 {
1624  fib_node_index_t fei;
1625 
1626  if (unformat (input, "%d", &fei))
1627  {
1628  /*
1629  * show one in detail
1630  */
1631  if (!pool_is_free_index(mfib_entry_pool, fei))
1632  {
1633  vlib_cli_output (vm, "%d@%U",
1634  fei,
1635  format_mfib_entry, fei,
1637  }
1638  else
1639  {
1640  vlib_cli_output (vm, "entry %d invalid", fei);
1641  }
1642  }
1643  else
1644  {
1645  /*
1646  * show all
1647  */
1648  vlib_cli_output (vm, "FIB Entries:");
1649  pool_foreach_index (fei, mfib_entry_pool)
1650  {
1651  vlib_cli_output (vm, "%d@%U",
1652  fei,
1653  format_mfib_entry, fei,
1655  }
1656  }
1657 
1658  return (NULL);
1659 }
1660 
1661 /*?
1662  * This commnad displays an entry, or all entries, in the mfib tables indexed by their unique
1663  * numerical indentifier.
1664  ?*/
1665 VLIB_CLI_COMMAND (show_mfib_entry, static) = {
1666  .path = "show mfib entry",
1667  .function = show_mfib_entry_command,
1668  .short_help = "show mfib entry",
1669 };
int mfib_itf_update(mfib_itf_t *mfib_itf, fib_node_index_t path_index, mfib_itf_flags_t mfi_flags)
update an interface from a path.
Definition: mfib_itf.c:67
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
Definition: log.c:338
int fib_path_is_resolved(fib_node_index_t path_index)
Definition: fib_path.c:2670
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:411
Contribute an object that is to be used to forward BIER packets.
Definition: fib_types.h:121
#define MFIB_ENTRY_FORMAT_DETAIL
Definition: mfib_entry.h:111
static const char *const mfib_entry_ip4_nodes[]
Definition: mfib_entry.c:1427
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:136
#define vec_foreach_index(var, v)
Iterate over vector indices.
ip46_address_t fp_src_addr
Definition: mfib_types.h:47
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:112
#define hash_set(h, key, value)
Definition: hash.h:255
static mfib_entry_src_t * mfib_entry_src_find_or_create(mfib_entry_t *mfib_entry, mfib_source_t source)
Definition: mfib_entry.c:268
#define pool_foreach_index(i, v)
Definition: pool.h:569
fib_node_index_t path_index
The index of the FIB path.
Definition: load_balance.h:71
#define CLIB_UNUSED(x)
Definition: clib.h:87
A virtual function table regisitered for a DPO type.
Definition: dpo.h:406
fib_forward_chain_type_t fct
Definition: mfib_entry.c:548
void fib_path_contribute_forwarding(fib_node_index_t path_index, fib_forward_chain_type_t fct, dpo_id_t *dpo)
Definition: fib_path.c:2406
static const char *const *const mfib_entry_nodes[DPO_PROTO_NUM]
Definition: mfib_entry.c:1438
u32 mfib_entry_pool_size(void)
Definition: mfib_entry.c:1614
void fib_path_list_child_remove(fib_node_index_t path_list_index, u32 si)
int mfib_entry_delete(fib_node_index_t mfib_entry_index, mfib_source_t source)
mfib_entry_delete
Definition: mfib_entry.c:1224
enum mfib_entry_flags_t_ mfib_entry_flags_t
#define hash_unset(h, key)
Definition: hash.h:261
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105
fib_node_index_t mfes_cover
A representation of a path as described by a route producer.
Definition: fib_types.h:500
dpo_id_t path_dpo
ID of the Data-path object.
Definition: load_balance.h:66
The FIB DPO provieds;.
Definition: replicate_dpo.h:63
enum mfib_entry_fwd_flags_t_ mfib_entry_fwd_flags_t
Flags to control what is present in the replicate DPO returned when the entry contributes forwarding...
static const char * mfib_src_attribute_names[]
Definition: mfib_entry.c:41
vl_api_fib_path_nh_t nh
Definition: fib_types.api:126
void fib_node_init(fib_node_t *node, fib_node_type_t type)
Definition: fib_node.c:185
u32 frp_mitf_flags
MFIB interface flags.
Definition: fib_types.h:568
static int dpo_id_is_valid(const dpo_id_t *dpoi)
Return true if the DPO object is valid, i.e.
Definition: dpo.h:214
void mfib_entry_unlock(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1402
struct mfib_entry_src_t_ * mfe_srcs
A vector of sources contributing forwarding.
Definition: mfib_entry.h:52
An entry in a FIB table.
Definition: mfib_entry.h:32
A path that resolves via a BIER impostion object.
Definition: fib_types.h:385
u32 mfe_sibling
The sibling index on the path-list.
Definition: mfib_entry.h:62
#define MFIB_SOURCE_NONE
Definition: mfib_types.h:204
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
fib_node_index_t fib_path_list_create_special(dpo_proto_t nh_proto, fib_path_list_flags_t flags, const dpo_id_t *dpo)
#define MFIB_ENTRY_SRC_ATTRIBUTES
vlib_log_class_t mfib_entry_logger
the logger
Definition: mfib_entry.c:30
#define MFIB_SOURCE_NAMES
Definition: mfib_types.h:180
enum mfib_entry_src_flag_t_ mfib_entry_src_flags_t
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
Definition: dpo.c:262
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:41
static void mfib_entry_dpo_unlock(dpo_id_t *dpo)
Definition: mfib_entry.c:1416
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:592
static fib_node_t * mfib_entry_get_node(fib_node_index_t index)
Definition: mfib_entry.c:49
dpo_proto_t rep_proto
The protocol of packets that traverse this REP.
Definition: replicate_dpo.h:80
static fib_node_index_t * mfib_entry_src_paths_remove(mfib_entry_src_t *msrc, const fib_route_path_t *rpaths)
Definition: mfib_entry.c:758
static void mfib_entry_itf_remove(mfib_entry_src_t *msrc, u32 sw_if_index)
Definition: mfib_entry.c:967
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
Definition: vec.h:630
static fib_node_index_t mfib_entry_get_index(const mfib_entry_t *mfe)
Definition: mfib_entry.h:205
void fib_path_list_walk(fib_node_index_t path_list_index, fib_path_list_walk_fn_t func, void *ctx)
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:108
void fib_node_deinit(fib_node_t *node)
Definition: fib_node.c:197
vlib_main_t * vm
Definition: in2out_ed.c:1580
u32 mfib_entry_child_add(fib_node_index_t mfib_entry_index, fib_node_type_t child_type, fib_node_index_t child_index)
Definition: mfib_entry.c:447
static mfib_path_ext_t * mfib_entry_path_ext_find(mfib_path_ext_t *exts, fib_node_index_t path_index)
Definition: mfib_entry.c:500
vl_api_prefix_t prefix
Definition: ip.api:144
static replicate_t * replicate_get(index_t repi)
static const char *const mfib_entry_ip6_nodes[]
Definition: mfib_entry.c:1432
#define MFIB_ENTRY_FORMAT_BRIEF
Definition: mfib_entry.h:110
fib_node_index_t * fib_path_list_paths_add(fib_node_index_t path_list_index, const fib_route_path_t *rpaths)
mfib_itf_t * mfes_itfs
The hash table of all interfaces.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:251
fib_forward_chain_type_t mfib_forw_chain_type_from_dpo_proto(dpo_proto_t proto)
Definition: mfib_types.c:71
void mfib_entry_cover_changed(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1570
u32 fib_path_list_child_add(fib_node_index_t path_list_index, fib_node_type_t child_type, fib_node_index_t child_index)
unsigned char u8
Definition: types.h:56
#define pool_len(p)
Number of elements in pool vector.
Definition: pool.h:139
fib_forward_chain_type_t mfib_entry_get_default_chain_type(const mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:61
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static mfib_entry_t * mfib_entry_from_fib_node(fib_node_t *node)
Definition: mfib_entry.c:204
u32 fib_node_child_add(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_type_t type, fib_node_index_t index)
Definition: fib_node.c:98
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
Definition: fib_node.c:60
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
Definition: drop_dpo.c:25
u8 * format_mfib_entry_flags(u8 *s, va_list *args)
Definition: mfib_types.c:161
enum mfib_source_t_ mfib_source_t
Possible [control plane] sources of MFIB entries.
static mfib_entry_t * mfib_entry_alloc(u32 fib_index, const mfib_prefix_t *prefix, fib_node_index_t *mfib_entry_index)
Definition: mfib_entry.c:467
u32 vlib_log_class_t
Definition: vlib.h:51
static void mfib_entry_recalculate_forwarding(mfib_entry_t *mfib_entry, mfib_source_t old_best)
Definition: mfib_entry.c:769
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:327
u32 frp_sw_if_index
The interface.
Definition: fib_types.h:545
mfib_entry_src_flags_t mfes_flags
Source flags.
#define MFIB_RPF_ID_NONE
Definition: fib_types.h:423
The source of an MFIB entry.
void mfib_itf_mac_del(mfib_itf_t *itf, const mfib_prefix_t *pfx)
Definition: mfib_itf.c:180
void fib_walk_sync(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_back_walk_ctx_t *ctx)
Back walk all the children of a FIB node.
Definition: fib_walk.c:745
mfib_source_t mfes_src
Which source this is.
description fragment has unexpected format
Definition: map.api:433
#define hash_foreach(key_var, value_var, h, body)
Definition: hash.h:442
load_balance_path_t * next_hops
Definition: mfib_entry.c:547
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
index_t replicate_dup(replicate_flags_t flags, index_t repi)
static fib_protocol_t mfib_entry_get_proto(const mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:55
static int mfib_entry_path_itf_based(const fib_route_path_t *rpath)
Definition: mfib_entry.c:980
mfib_prefix_t mfe_prefix
The prefix of the route.
Definition: mfib_entry.h:42
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
void mfib_entry_module_init(void)
Definition: mfib_entry.c:1445
u32 mfib_entry_get_stats_index(fib_node_index_t fib_entry_index)
Definition: mfib_entry.c:1345
void mfib_entry_contribute_forwarding(fib_node_index_t mfib_entry_index, fib_forward_chain_type_t type, mfib_entry_fwd_flags_t flags, dpo_id_t *dpo)
Definition: mfib_entry.c:1519
struct mfib_entry_collect_forwarding_ctx_t_ mfib_entry_collect_forwarding_ctx_t
unsigned int u32
Definition: types.h:88
Contribute an object that is to be used to forward Ethernet packets.
Definition: fib_types.h:140
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
u16 fib_path_get_weight(fib_node_index_t path_index)
Definition: fib_path.c:2231
static mfib_entry_src_t * mfib_entry_src_update(mfib_entry_t *mfib_entry, mfib_source_t source, fib_rpf_id_t rpf_id, mfib_entry_flags_t entry_flags)
Definition: mfib_entry.c:285
u32 mfib_entry_get_fib_index(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1499
void mfib_entry_src_deactivate(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
static mfib_source_t mfib_entry_get_best_source(const mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:338
vl_api_fib_path_type_t type
Definition: fib_types.api:123
u32 rpf_id
Definition: fib_types.api:119
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:170
Contribute an object that is to be used to forward end-of-stack MPLS packets.
Definition: fib_types.h:128
fib_node_bw_reason_flag_t fnbw_reason
The reason/trigger for the backwalk.
Definition: fib_node.h:212
int mfib_entry_update(fib_node_index_t mfib_entry_index, mfib_source_t source, mfib_entry_flags_t entry_flags, fib_rpf_id_t rpf_id, index_t repi)
Definition: mfib_entry.c:939
#define hash_get(h, key)
Definition: hash.h:249
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:546
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
dpo_id_t mfe_rep
The DPO used for forwarding; replicate, drop, etc.
Definition: mfib_entry.h:72
static fib_path_list_walk_rc_t mfib_entry_src_collect_forwarding(fib_node_index_t pl_index, fib_node_index_t path_index, void *arg)
Definition: mfib_entry.c:553
int mfib_entry_path_remove(fib_node_index_t mfib_entry_index, mfib_source_t source, const fib_route_path_t *rpaths)
Definition: mfib_entry.c:1123
static mfib_itf_t * mfib_itf_get(index_t mi)
Get the MFIB interface representation.
Definition: mfib_itf.h:83
u32 mfes_ref_count
The reference count on the entry.
int mfib_entry_is_host(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:397
static void mfib_entry_src_flush(mfib_entry_src_t *msrc)
Definition: mfib_entry.c:404
void fib_node_lock(fib_node_t *node)
Definition: fib_node.c:203
long ctx[MAX_CONNS]
Definition: main.c:144
void mfib_itf_mac_add(mfib_itf_t *itf, const mfib_prefix_t *pfx)
Definition: mfib_itf.c:173
static int fib_ip6_address_compare(ip6_address_t *a1, ip6_address_t *a2)
Definition: mfib_entry.c:1254
struct _unformat_input_t unformat_input_t
int mfib_entry_is_sourced(fib_node_index_t mfib_entry_index, mfib_source_t source)
Definition: mfib_entry.c:348
#define hash_free(h)
Definition: hash.h:310
int mfib_entry_special_add(fib_node_index_t mfib_entry_index, mfib_source_t source, mfib_entry_flags_t entry_flags, fib_rpf_id_t rpf_id, index_t repi)
Definition: mfib_entry.c:917
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:301
fib_node_t mfe_node
Base class.
Definition: mfib_entry.h:37
int mfib_entry_cmp_for_sort(void *i1, void *i2)
Definition: mfib_entry.c:1313
mfib_entry_t * mfib_entry_pool
Definition: mfib_entry.c:46
#define vec_del1(v, i)
Delete the element at index I.
Definition: vec.h:875
void fib_path_list_lock(fib_node_index_t path_list_index)
static mfib_path_ext_t * mfib_entry_path_ext_get(index_t mi)
Definition: mfib_entry.c:88
fib_rpf_id_t mfes_rpf_id
RPF-ID.
u8 * format_mfib_entry_src_flags(u8 *s, va_list *args)
Definition: mfib_entry.c:106
fib_node_type_t fn_type
The node&#39;s type.
Definition: fib_node.h:299
static void mfib_entry_dpo_lock(dpo_id_t *dpo)
Definition: mfib_entry.c:1412
An node in the FIB graph.
Definition: fib_node.h:295
void fib_node_unlock(fib_node_t *node)
Definition: fib_node.c:209
void mfib_entry_lock(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1392
u32 mfe_fib_index
The index of the FIB table this entry is in.
Definition: mfib_entry.h:47
static mfib_entry_t * mfib_entry_get(fib_node_index_t index)
Definition: mfib_entry.h:200
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
Definition: pool.h:245
static mfib_path_ext_t * mfib_path_ext_add(mfib_entry_src_t *msrc, fib_node_index_t path_index, mfib_itf_flags_t mfi_flags)
Definition: mfib_entry.c:516
#define MFIB_ENTRY_DBG(_e, _fmt, _args...)
Definition: mfib_entry.h:100
void replicate_multipath_update(const dpo_id_t *dpo, load_balance_path_t *next_hops)
void mfib_entry_path_update(fib_node_index_t mfib_entry_index, mfib_source_t source, const fib_route_path_t *rpaths)
Definition: mfib_entry.c:987
fib_node_list_t fn_children
Vector of nodes that depend upon/use/share this node.
Definition: fib_node.h:309
static u8 * format_mfib_entry_dpo(u8 *s, va_list *args)
Definition: mfib_entry.c:77
Do not reutrn any local replications in the set.
Definition: mfib_entry.h:183
static mfib_entry_src_t * mfib_entry_src_find(const mfib_entry_t *mfib_entry, mfib_source_t source, u32 *index)
Definition: mfib_entry.c:239
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
Contribute an object that is to be used to forward NSH packets.
Definition: fib_types.h:146
#define FOR_EACH_MFIB_SRC_ATTRIBUTE(_item)
u8 * format_mfib_entry(u8 *s, va_list *args)
Definition: mfib_entry.c:126
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:380
static mfib_itf_t * mfib_entry_itf_find(mfib_itf_t *itfs, u32 sw_if_index)
Definition: mfib_entry.h:212
mfib_itf_flags_t mfi_flags
Forwarding Flags on the entry - checked in the data-path.
Definition: mfib_itf.h:35
static mfib_entry_src_t * mfib_entry_src_update_and_lock(mfib_entry_t *mfib_entry, mfib_source_t source, fib_rpf_id_t rpf_id, mfib_entry_flags_t entry_flags)
Definition: mfib_entry.c:302
fib_node_get_t fnv_get
Definition: fib_node.h:283
u32 fib_path_list_get_n_paths(fib_node_index_t path_list_index)
fib_node_index_t mfes_pl
The path-list of forwarding interfaces.
mfib_itf_t * mfe_itfs
A hash table of interfaces.
Definition: mfib_entry.h:87
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
mfib_entry_flags_t mfe_flags
Route flags.
Definition: mfib_entry.h:77
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:298
#define ARRAY_LEN(x)
Definition: clib.h:67
mfib_path_ext_t * mfes_exts
Hash table of path extensions.
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:186
void fib_path_list_unlock(fib_node_index_t path_list_index)
void mfib_entry_mark(fib_node_index_t fib_entry_index, mfib_source_t source)
Definition: mfib_entry.c:380
index_t replicate_create(u32 n_buckets, dpo_proto_t rep_proto)
static void mfib_entry_itf_add(mfib_entry_src_t *msrc, u32 sw_if_index, index_t mi)
Definition: mfib_entry.c:959
Aggregate type for a prefix.
Definition: mfib_types.h:24
enum mfib_src_res_t_ mfib_src_res_t
signals from the sources to the caller
vlib_main_t vlib_node_runtime_t * node
Definition: in2out_ed.c:1580
Context passed between object during a back walk.
Definition: fib_node.h:208
u32 fib_rpf_id_t
An RPF-ID is numerical value that is used RPF validate.
Definition: fib_types.h:421
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:158
fib_node_index_t mfe_pl
The path-list of which this entry is a child.
Definition: mfib_entry.h:57
int mfib_entry_is_marked(fib_node_index_t mfib_entry_index, mfib_source_t source)
Definition: mfib_entry.c:359
static void mfib_path_ext_remove(mfib_entry_src_t *msrc, fib_node_index_t path_index)
Definition: mfib_entry.c:534
MFIB extensions to each path.
static void mfib_entry_last_lock_gone(fib_node_t *node)
Definition: mfib_entry.c:1322
static uword hash_elts(void *v)
Definition: hash.h:118
#define ASSERT(truth)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:696
static void mfib_entry_update_i(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc, mfib_source_t current_best, index_t repi)
Definition: mfib_entry.c:872
mfib_src_res_t mfib_entry_src_cover_update(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
void mfib_entry_cover_updated(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1595
static void mfib_entry_stack(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
Definition: mfib_entry.c:613
mfib_itf_flags_t mfpe_flags
const dpo_id_t * mfib_entry_contribute_ip_forwarding(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1509
An interface associated with a particular MFIB entry.
Definition: mfib_itf.h:25
static fib_node_index_t * mfib_entry_src_paths_add(mfib_entry_src_t *msrc, const fib_route_path_t *rpaths)
Definition: mfib_entry.c:739
static int mfib_entry_ok_for_delete(mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:852
Path encode context to use when walking a path-list to encode paths.
Definition: fib_path.h:219
static u8 * format_mfib_entry_path_ext(u8 *s, va_list *args)
Definition: mfib_entry.c:94
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
fib_route_path_flags_t frp_flags
flags on the path
Definition: fib_types.h:609
u8 * format_fib_forw_chain_type(u8 *s, va_list *args)
Definition: fib_types.c:49
static int mfib_entry_cmp(fib_node_index_t mfib_entry_index1, fib_node_index_t mfib_entry_index2)
Definition: mfib_entry.c:1269
void fib_node_child_remove(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_index_t sibling_index)
Definition: fib_node.c:123
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
Definition: fib_types.c:343
fib_rpf_id_t mfe_rpf_id
RPF-ID used when the packets ingress not from an interface.
Definition: mfib_entry.h:82
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject.
Definition: dpo.c:148
static clib_error_t * show_mfib_entry_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: mfib_entry.c:1620
fib_route_path_t * rpaths
Definition: fib_path.h:221
index_t mfib_itf_create(fib_node_index_t path_index, mfib_itf_flags_t mfi_flags)
Definition: mfib_itf.c:26
fib_protocol_t fp_proto
protocol type
Definition: mfib_types.h:33
#define DPO_PROTO_NUM
Definition: dpo.h:70
enum fib_path_list_walk_rc_t_ fib_path_list_walk_rc_t
return code to control pat-hlist walk
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:188
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:30
mfib_src_res_t mfib_entry_src_cover_change(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
fib_node_index_t mfpe_path
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 path_weight
weight for the path.
Definition: load_balance.h:76
fib_node_index_t mfib_entry_create(u32 fib_index, mfib_source_t source, const mfib_prefix_t *prefix, fib_rpf_id_t rpf_id, mfib_entry_flags_t entry_flags, index_t repi)
Definition: mfib_entry.c:803
u32 fn_locks
Number of dependents on this node.
Definition: fib_node.h:315
const mfib_prefix_t * mfib_entry_get_prefix(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1489
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:47
static mfib_path_ext_t * mfib_path_ext_pool
Pool of path extensions.
Definition: mfib_entry.c:35
u8 * fib_path_list_format(fib_node_index_t path_list_index, u8 *s)
u64 uword
Definition: types.h:112
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
Definition: vec.h:1055
int mfib_prefix_is_host(const mfib_prefix_t *pfx)
Return true is the prefix is a host prefix.
Definition: mfib_types.c:55
static int fib_ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
Definition: mfib_entry.c:1240
u8 * format_mfib_itf_flags(u8 *s, va_list *args)
Definition: mfib_types.c:181
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:202
u32 index
Definition: flow_types.api:221
One path from an [EU]CMP set that the client wants to add to a load-balance object.
Definition: load_balance.h:62
enum mfib_itf_flags_t_ mfib_itf_flags_t
Definition: mfib_entry.c:545
mfib_entry_flags_t mfes_route_flags
Route flags.
void mfib_entry_src_activate(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
static int mfib_entry_src_ok_for_delete(const mfib_entry_src_t *msrc)
Definition: mfib_entry.c:858
A FIB graph nodes virtual function table.
Definition: fib_node.h:282
static const char * mfib_source_names[]
String names for each source.
Definition: mfib_entry.c:40
static void mfib_entry_src_init(mfib_entry_t *mfib_entry, mfib_source_t source)
Definition: mfib_entry.c:220
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
static fib_node_back_walk_rc_t mfib_entry_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Definition: mfib_entry.c:1360
int dpo_is_drop(const dpo_id_t *dpo)
The Drop DPO will drop all packets, no questions asked.
Definition: drop_dpo.c:33
vl_api_mfib_entry_flags_t entry_flags
Definition: ip.api:307
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:232
void mfib_entry_cover_update_notify(mfib_entry_t *mfib_entry)
#define vec_foreach(var, vec)
Vector iterator.
void mfib_itf_delete(mfib_itf_t *mfi)
Definition: mfib_itf.c:187
mfib_entry_src_t * mfib_entry_get_best_src(const mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:318
static void mfib_entry_show_memory(void)
Definition: mfib_entry.c:1373
void fib_path_list_walk_w_ext(fib_node_index_t path_list_index, const fib_path_ext_list_t *ext_list, fib_path_list_walk_w_ext_fn_t func, void *ctx)
Contribute an object that is to be used to forward non-end-of-stack MPLS packets. ...
Definition: fib_types.h:117
fib_route_path_t * mfib_entry_encode(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1453
replicate_flags_t rep_flags
Flags specifying the replicate properties/behaviour.
Definition: replicate_dpo.h:85
static void mfib_entry_src_remove(mfib_entry_t *mfib_entry, mfib_source_t source)
Definition: mfib_entry.c:419
#define MFIB_ENTRY_FORMAT_DETAIL2
Definition: mfib_entry.h:112
u16 fp_len
The mask length.
Definition: mfib_types.h:28
u8 * fib_node_children_format(fib_node_list_t list, u8 *s)
Definition: fib_node.c:176
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:59
void mfib_entry_child_remove(fib_node_index_t mfib_entry_index, u32 sibling_index)
Definition: mfib_entry.c:458
mfib_entry_src_t * msrc
Definition: mfib_entry.c:549
static int mfib_entry_src_cmp_for_sort(void *v1, void *v2)
Definition: mfib_entry.c:211
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:132
fib_node_index_t * fib_path_list_paths_remove(fib_node_index_t path_list_index, const fib_route_path_t *rpaths)
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
u8 * format_mfib_prefix(u8 *s, va_list *args)
Definition: mfib_types.c:106
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
enum mfib_entry_src_attribute_t_ mfib_entry_src_attribute_t
Flags for the source data.
ip46_address_t fp_grp_addr
The address type is not deriveable from the fp_addr member.
Definition: mfib_types.h:46
fib_path_list_walk_rc_t fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, const fib_path_ext_t *path_ext, void *args)
Definition: fib_path.c:2693
void dpo_stack(dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child-parent relationship.
Definition: dpo.c:521
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:127