FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
bier_table.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 <vppinfra/vec.h>
17 
18 #include <vnet/bier/bier_table.h>
19 #include <vnet/bier/bier_entry.h>
20 #include <vnet/bier/bier_update.h>
22 #include <vnet/bier/bier_fmask.h>
24 
25 #include <vnet/fib/mpls_fib.h>
26 #include <vnet/mpls/mpls.h>
27 #include <vnet/fib/fib_path_list.h>
28 
29 /**
30  * Memory pool of all the allocated tables
31  */
33 
34 /**
35  * DB store of all BIER tables index by SD/set/hdr-len
36  */
38 
39 /**
40  * The magic number of BIER ECMP tables to create.
41  * The load-balance distribution algorithm will use a power of 2
42  * for the number of buckets, which constrains the choice.
43  */
44 #define BIER_N_ECMP_TABLES 16
45 
46 static inline index_t
48 {
49  return (bt - bier_table_pool);
50 }
51 
52 int
54 {
55  return (BIER_ECMP_TABLE_ID_MAIN == bt->bt_id.bti_ecmp);
56 }
57 
58 /*
59  * Construct the key to use to find a BIER table
60  * in the global hash map
61  */
62 static u32
64 {
65  /*
66  * the set and sub-domain Ids are 8 bit values.
67  * we have space for ECMP table ID and talbe type (SPF/TE)
68  * for later
69  */
70  u32 key = ((id->bti_sub_domain << 24) |
71  (id->bti_set << 16) |
72  (id->bti_ecmp << 8) |
73  (id->bti_hdr_len << 4) |
74  (id->bti_type));
75 
76  return (key);
77 }
78 
79 static void
81  const bier_table_id_t *id,
82  mpls_label_t ll)
83 {
84  u32 num_entries;
85 
87  bt->bt_id = *id;
88  bt->bt_ll = ll;
90 
91  /*
92  * create the lookup table of entries.
93  */
94  if (bier_table_is_main(bt))
95  {
97  num_entries,
100  }
101  else
102  {
104  num_entries,
107  }
108 }
109 
110 static void
112 {
114 
116  bt->bt_id.bti_sub_domain,
117  bt->bt_id.bti_hdr_len));
118 }
119 
120 static void
122 {
123  dpo_id_t dpo = DPO_INVALID;
124 
126 
128 
130  bt->bt_id.bti_sub_domain,
131  bt->bt_id.bti_hdr_len),
132  &dpo);
133 
134  dpo_reset(&dpo);
135 }
136 
137 static void
139 {
140  if (FIB_NODE_INDEX_INVALID != bt->bt_lfei)
141  {
147  }
149 }
150 
151 static void
153 {
154  if (bier_table_is_main(bt))
155  {
156  index_t *bei;
157 
158  if (MPLS_LABEL_INVALID != bt->bt_ll)
159  {
160  bier_table_rm_lfib(bt);
161  }
162  else
163  {
164  bier_table_rm_bift(bt);
165  }
166 
169  /*
170  * unresolve/remove all entries from the table
171  */
172  vec_foreach (bei, bt->bt_entries)
173  {
174  if (INDEX_INVALID != *bei)
175  {
176  bier_entry_delete(*bei);
177  }
178  }
179  vec_free (bt->bt_entries);
180  }
181  else
182  {
183  index_t *bfmi;
184 
185  /*
186  * unlock any fmasks
187  */
188  vec_foreach (bfmi, bt->bt_fmasks)
189  {
190  bier_fmask_unlock(*bfmi);
191  }
192  vec_free(bt->bt_fmasks);
193  }
194 
196  bier_table_mk_key(&bt->bt_id));
197  pool_put(bier_table_pool, bt);
198 }
199 
200 static void
202 {
203  bt->bt_locks++;
204 }
205 
206 static void
208 {
209  bt->bt_locks--;
210 
211  if (0 == bt->bt_locks)
212  {
213  bier_table_destroy(bt);
214  }
215 }
216 
217 void
219 {
220  uword *p;
221  u32 key;
222 
223  key = bier_table_mk_key(bti);
224 
225  p = hash_get (bier_tables_by_key, key);
226 
227  if (NULL != p) {
229  }
230 }
231 
232 static void
234 {
235  /*
236  * Add a new MPLS lfib entry
237  */
238  if (MPLS_LABEL_INVALID != bt->bt_ll) {
239  fib_prefix_t pfx = {
241  .fp_len = 21,
242  .fp_label = bt->bt_ll,
243  .fp_eos = MPLS_EOS,
244  .fp_payload_proto = DPO_PROTO_BIER,
245  };
246  u32 mpls_fib_index;
247  dpo_id_t dpo = DPO_INVALID;
248 
252 
253  /*
254  * stack the entry on the forwarding chain prodcued by the
255  * path-list via the ECMP tables.
256  */
260  &dpo);
261 
262  mpls_fib_index = fib_table_find(FIB_PROTOCOL_MPLS,
264  bt->bt_lfei = fib_table_entry_special_dpo_add(mpls_fib_index,
265  &pfx,
268  &dpo);
269  dpo_reset(&dpo);
270  }
271 }
272 
273 static bier_table_t *
275 {
276  uword *p;
277  u32 key;
278 
279  key = bier_table_mk_key(bti);
280 
281  p = hash_get(bier_tables_by_key, key);
282 
283  if (NULL != p)
284  {
285  return (bier_table_get(p[0]));
286  }
287 
288  return (NULL);
289 }
290 
291 static bier_table_t *
293 {
294  fib_route_path_t *rpaths;
295  fib_node_index_t pli;
296  bier_table_t *bt;
297  int ii;
298 
299  rpaths = NULL;
300  bt = bier_table_get(bti);
301 
302  vec_validate(rpaths, BIER_N_ECMP_TABLES-1);
303 
304  vec_foreach_index(ii, rpaths)
305  {
306  rpaths[ii].frp_bier_tbl = bt->bt_id;
307  rpaths[ii].frp_bier_tbl.bti_ecmp = ii;
309  }
310 
311  /*
312  * no oppotunity to share, this the resolving ECMP tables are unique
313  * to this table.
314  * no need to be a child of the path list, we can do nothing with any
315  * notifications it would generate [not that it will].
316  */
318  fib_path_list_lock(pli);
319 
320  /*
321  * constructing the path-list will have created many more BIER tables,
322  * so this main table will no doubt have re-alloc.
323  */
324  bt = bier_table_get(bti);
325  bt->bt_pl = pli;
326 
327  vec_free(rpaths);
328 
329  return (bt);
330 }
331 
332 index_t
334  mpls_label_t local_label)
335 {
336  bier_table_t *bt;
337  index_t bti;
338 
339  bt = bier_table_find(btid);
340 
341  if (NULL != bt) {
342  /*
343  * modify an existing table.
344  * change the lfib entry to the new local label
345  */
346  if (bier_table_is_main(bt))
347  {
348  /*
349  * remove the mpls-fib or bift entry
350  */
351  if (MPLS_LABEL_INVALID != bt->bt_ll)
352  {
353  bier_table_rm_lfib(bt);
354  }
355  else
356  {
357  bier_table_rm_bift(bt);
358  }
359 
360  /*
361  * reset
362  */
364 
365  /*
366  * add whichever mpls-fib or bift we need
367  */
368  if (local_label != MPLS_LABEL_INVALID)
369  {
370  bt->bt_ll = local_label;
371  bier_table_mk_lfib(bt);
372  }
373  else
374  {
375  bier_table_mk_bift(bt);
376  }
377  }
378  bti = bier_table_get_index(bt);
379  }
380  else
381  {
382  /*
383  * add a new table
384  */
385  u32 key;
386 
387  key = bier_table_mk_key(btid);
388 
389  pool_get_aligned(bier_table_pool, bt, CLIB_CACHE_LINE_BYTES);
390  bier_table_init(bt, btid, local_label);
391 
393  bti = bier_table_get_index(bt);
394 
395  if (bier_table_is_main(bt))
396  {
397  bt = bier_table_mk_ecmp(bti);
398 
399  /*
400  * add whichever mpls-fib or bift we need
401  */
402  if (local_label != MPLS_LABEL_INVALID)
403  {
404  bt->bt_ll = local_label;
405  bier_table_mk_lfib(bt);
406  }
407  else
408  {
409  bier_table_mk_bift(bt);
410  }
411  }
412  }
413 
414  bier_table_lock_i(bt);
415 
416  return (bti);
417 }
418 
419 index_t
421 {
423 }
424 
425 void
427 {
429 }
430 
431 static void
433 {
434 }
435 
436 static void
438 {
439 }
440 
441 static void
443 {
444  fib_show_memory_usage("BIER-table",
445  pool_elts(bier_table_pool),
446  pool_len(bier_table_pool),
447  sizeof(bier_table_t));
448 }
449 static u8 *
450 format_bier_table_dpo (u8 *s, va_list *ap)
451 {
452  index_t bti = va_arg(*ap, index_t);
453  bier_table_t *bt;
454 
455  bt = bier_table_get(bti);
456 
457  return (format(s, "[%U]", format_bier_table_id, &bt->bt_id));
458 }
459 
460 const static dpo_vft_t bier_table_dpo_vft = {
462  .dv_unlock = bier_table_dpo_unlock,
463  .dv_format = format_bier_table_dpo,
464  .dv_mem_show = bier_table_dpo_mem_show,
465 };
466 
467 const static char *const bier_table_mpls_nodes[] =
468 {
469  "bier-input",
470  NULL
471 };
472 const static char * const * const bier_table_nodes[DPO_PROTO_NUM] =
473 {
475 };
476 
477 static clib_error_t *
479 {
480  dpo_register(DPO_BIER_TABLE, &bier_table_dpo_vft, bier_table_nodes);
481 
482  return (NULL);
483 }
484 
486 
487 const bier_table_id_t *
489 {
490  bier_table_t *bt;
491 
492  bt = bier_table_get(bti);
493 
494  return (&bt->bt_id);
495 }
496 
497 static void
499  bier_bp_t bp,
500  index_t bei)
501 {
502  bt->bt_entries[BIER_BP_TO_INDEX(bp)] = bei;
503 }
504 
505 static void
507  bier_bp_t bp)
508 {
510 }
511 
512 void
514  bier_bp_t bp,
515  fib_route_path_t *brps)
516 {
517  index_t bfmi, bti, bei, *bfmip, *bfmis = NULL;
518  fib_route_path_t *brp;
519  bier_table_t *bt;
520 
521  bt = bier_table_find(btid);
522 
523  if (NULL == bt) {
524  return;
525  }
526 
527  bti = bier_table_get_index(bt);
528  bei = bier_table_lookup(bt, bp);
529 
530  /*
531  * set the FIB index in the path to the BIER table index
532  */
533  vec_foreach(brp, brps)
534  {
535  /*
536  * First use the path to find or construct an FMask object
537  * via the next-hop
538  */
539  bfmi = bier_fmask_db_find_or_create_and_lock(bti, brp);
540  vec_add1(bfmis, bfmi);
541 
542  /*
543  * then modify the path to resolve via this fmask object
544  * and use it to resolve the BIER entry.
545  */
547  brp->frp_bier_fmask = bfmi;
548  }
549 
550  if (INDEX_INVALID == bei)
551  {
552  bei = bier_entry_create(bti, bp);
553  bier_table_insert(bt, bp, bei);
554  }
555  bier_entry_path_add(bei, brps);
556 
557  vec_foreach(bfmip, bfmis)
558  {
559  bier_fmask_unlock(*bfmip);
560  }
561  vec_free(bfmis);
562 }
563 
564 void
566  bier_bp_t bp,
567  fib_route_path_t *brps)
568 {
569  fib_route_path_t *brp = NULL;
570  bier_table_t *bt;
571  index_t bei;
572 
573  bt = bier_table_find(bti);
574 
575  if (NULL == bt) {
576  return;
577  }
578 
579  bei = bier_table_lookup(bt, bp);
580 
581  if (INDEX_INVALID == bei)
582  {
583  /* no such entry */
584  return;
585  }
586 
587  vec_foreach(brp, brps)
588  {
590  }
591 
592  if (0 == bier_entry_path_remove(bei, brps))
593  {
594  /* 0 remaining paths */
595  bier_table_remove(bt, bp);
596  bier_entry_delete(bei);
597  }
598 }
599 
600 void
602  dpo_id_t *dpo)
603 {
604  bier_table_t *bt;
605 
606  bt = bier_table_get(bti);
607 
609  {
610  /*
611  * return the load-balance for the ECMP tables
612  */
616  dpo);
617  }
618  else
619  {
621  }
622 }
623 
625 {
627  void *ctx;
629 
632  fib_node_index_t path_index,
633  void *arg)
634 {
636 
637  ctx->fn(fib_path_get_resolving_index(path_index), ctx->ctx);
638  /* continue */
640 }
641 
642 void
645  void *ctx)
646 {
648  .fn = fn,
649  .ctx = ctx,
650  };
651  bier_table_t *bt;
652 
653  bt = bier_table_get(bti);
654 
657  &ewc);
658 }
659 
660 void
662  bier_bp_t bp,
663  index_t bfmi)
664 {
665  bier_table_t *bt;
666 
667  bt = bier_table_get(bti);
668 
669  /*
670  * we hold a lock for fmasks in the table
671  */
672  bier_fmask_lock(bfmi);
674 
675  bt->bt_fmasks[BIER_BP_TO_INDEX(bp)] = bfmi;
676 }
677 
678 u8 *
679 format_bier_table_entry (u8 *s, va_list *ap)
680 {
681  index_t bti = va_arg(*ap, index_t);
682  bier_bp_t bp = va_arg(*ap, bier_bp_t);
683  bier_table_t *bt;
684  bt = bier_table_get(bti);
685 
686  if (bier_table_is_main(bt))
687  {
688  index_t bei;
689 
690  bei = bier_table_lookup(bier_table_get(bti), bp);
691 
692  if (INDEX_INVALID != bei)
693  {
694  s = format(s, "%U", format_bier_entry, bei,
696  }
697  }
698  else
699  {
700  index_t bfmi;
701 
702  bfmi = bier_table_fwd_lookup(bier_table_get(bti), bp);
703 
704  if (INDEX_INVALID != bfmi)
705  {
706  s = format(s, "%U", format_bier_fmask, bfmi,
708  }
709  }
710  return (s);
711 }
712 
713 u8 *
714 format_bier_table (u8 *s, va_list *ap)
715 {
716  index_t bti = va_arg(*ap, index_t);
718  bier_table_t *bt;
719 
720  if (pool_is_free_index(bier_table_pool, bti))
721  {
722  return (format(s, "No BIER table %d", bti));
723  }
724 
725  bt = bier_table_get(bti);
726 
727  s = format(s, "[@%d] bier-table:[%U local-label:%U",
728  bti,
731 
732  if (flags & BIER_SHOW_DETAIL)
733  {
734  s = format(s, " locks:%d", bt->bt_locks);
735  }
736  s = format(s, "]");
737 
738  if (flags & BIER_SHOW_DETAIL)
739  {
740  if (bier_table_is_main(bt))
741  {
742  index_t *bei;
743 
744  vec_foreach (bei, bt->bt_entries)
745  {
746  if (INDEX_INVALID != *bei)
747  {
748  s = format(s, "\n%U", format_bier_entry, *bei, 2);
749  }
750  }
751  }
752  else
753  {
754  u32 ii;
755 
756  vec_foreach_index (ii, bt->bt_fmasks)
757  {
758  if (INDEX_INVALID != bt->bt_fmasks[ii])
759  {
760  s = format(s, "\n bp:%d\n %U", ii,
761  format_bier_fmask, bt->bt_fmasks[ii], 2);
762  }
763  }
764  }
765  }
766 
767  return (s);
768 }
769 
770 void
773 {
774  if (!pool_elts(bier_table_pool))
775  {
776  vlib_cli_output (vm, "No BIER tables");
777  }
778  else
779  {
780  int ii;
781 
782  pool_foreach_index(ii, bier_table_pool,
783  ({
784  vlib_cli_output (vm, "%U", format_bier_table, ii, flags);
785  }));
786  }
787 }
788 
789 void
791  void *ctx)
792 {
793  ASSERT(0);
794 }
795 
796 
797 void
800  void *ctx)
801 {
802  bier_table_t *bt;
803  bier_entry_t *be;
804  index_t *bei;
805 
806  bt = bier_table_find(bti);
807 
808  if (NULL == bt)
809  {
810  return;
811  }
812 
813  vec_foreach (bei, bt->bt_entries)
814  {
815  if (INDEX_INVALID != *bei)
816  {
817  be = bier_entry_get(*bei);
818 
819  fn(bt, be, ctx);
820  }
821  }
822 }
static bier_table_t * bier_table_mk_ecmp(index_t bti)
Definition: bier_table.c:292
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:432
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:181
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:382
Contribute an object that is to be used to forward BIER packets.
Definition: fib_types.h:101
#define vec_foreach_index(var, v)
Iterate over vector indices.
#define hash_set(h, key, value)
Definition: hash.h:254
u8 * format_bier_fmask(u8 *s, va_list *ap)
Definition: bier_fmask.c:329
static void bier_table_mk_bift(bier_table_t *bt)
Definition: bier_table.c:121
A virtual function table regisitered for a DPO type.
Definition: dpo.h:377
#define hash_unset(h, key)
Definition: hash.h:260
void bier_fmask_lock(index_t bfmi)
Definition: bier_fmask.c:253
u32 bier_fmask_db_find_or_create_and_lock(index_t bti, const fib_route_path_t *rpath)
index_t fib_path_get_resolving_index(fib_node_index_t path_index)
Definition: fib_path.c:2048
A representation of a path as described by a route producer.
Definition: fib_types.h:377
#define BIER_N_ECMP_TABLES
The magic number of BIER ECMP tables to create.
Definition: bier_table.c:44
u8 * format_bier_table(u8 *s, va_list *ap)
Definition: bier_table.c:714
u16 bt_locks
Number of locks on the table.
Definition: bier_table.h:58
u8 * format_bier_table_id(u8 *s, va_list *ap)
Format a BIER table ID.
Definition: bier_types.c:193
index_t * bt_fmasks
f-masks in the ECMP table This is a vector sized to the appropriate number of entries given the table...
Definition: bier_table.h:85
enum bier_show_flags_t_ bier_show_flags_t
Flags to control show output.
static const char *const *const bier_table_nodes[DPO_PROTO_NUM]
Definition: bier_table.c:472
static index_t bier_table_get_index(const bier_table_t *bt)
Definition: bier_table.c:47
void bier_entry_delete(index_t bei)
Definition: bier_entry.c:77
#define NULL
Definition: clib.h:55
void bier_table_ecmp_unlock(index_t bti)
Definition: bier_table.c:426
u32 mpls_label_t
A label value only, i.e.
Definition: packet.h:24
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
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:518
index_t bier_entry_create(index_t bti, bier_bp_t bp)
Definition: bier_entry.c:62
void(* bier_table_ecmp_walk_fn_t)(index_t btei, void *ctx)
Types and functions to walk the ECMP tables of a main table.
Definition: bier_table.h:122
A path that resolves via a BIER [ECMP] Table.
Definition: fib_types.h:338
void fib_path_list_walk(fib_node_index_t path_list_index, fib_path_list_walk_fn_t func, void *ctx)
static const char *const bier_table_mpls_nodes[]
Definition: bier_table.c:467
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
static void bier_table_insert(bier_table_t *bt, bier_bp_t bp, index_t bei)
Definition: bier_table.c:498
static bier_entry_t * bier_entry_get(index_t bei)
Definition: bier_entry.h:90
static bier_table_t * bier_table_get(index_t bti)
Definition: bier_table.h:153
bier_table_id_t frp_bier_tbl
A path that resolves via a BIER Table.
Definition: fib_types.h:438
The ID of a table.
Definition: bier_types.h:446
#define pool_len(p)
Number of elements in pool vector.
Definition: pool.h:140
void bier_bift_table_entry_add(bier_bift_id_t id, const dpo_id_t *dpo)
static void bier_table_unlock_i(bier_table_t *bt)
Definition: bier_table.c:207
static uword * bier_tables_by_key
DB store of all BIER tables index by SD/set/hdr-len.
Definition: bier_table.c:37
static bier_table_t * bier_table_find(const bier_table_id_t *bti)
Definition: bier_table.c:274
void(* bier_tables_walk_fn_t)(const bier_table_t *bt, void *ctx)
Types and functions to walk all the BIER Tables.
Definition: bier_table.h:132
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:306
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:111
bier_table_ecmp_id_t bti_ecmp
The SUB/ECMP-ID Constructed by FIB to achieve ECMP between BFR-NBRs.
Definition: bier_types.h:466
void bier_table_contribute_forwarding(index_t bti, dpo_id_t *dpo)
Definition: bier_table.c:601
int bier_table_is_main(const bier_table_t *bt)
Definition: bier_table.c:53
bier_table_set_id_t bti_set
The SET-ID The control plane divdies the bit-position space into sets in the case the max bit-positio...
Definition: bier_types.h:453
Aggregrate type for a prefix.
Definition: fib_types.h:172
bier_bift_id_t bier_bift_id_encode(bier_table_set_id_t set, bier_table_sub_domain_id_t sd, bier_hdr_len_id_t bsl)
Encode a BIFT-ID as per draft-wijnandsxu-bier-non-mpls-bift-encoding-00.txt.
Definition: bier_types.c:164
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
static void bier_table_dpo_unlock(dpo_id_t *dpo)
Definition: bier_table.c:437
static void bier_table_destroy(bier_table_t *bt)
Definition: bier_table.c:152
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:1028
mpls_label_t bt_ll
Save the MPLS local label associated with the table.
Definition: bier_table.h:42
u32 bier_bp_t
A bit positon as assigned to egress PEs.
Definition: bier_types.h:346
index_t frp_bier_fmask
Resolving via a BIER Fmask.
Definition: fib_types.h:454
u32 bier_hdr_len_id_to_num_bits(bier_hdr_len_id_t id)
Definition: bier_types.c:78
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:166
#define hash_get(h, key)
Definition: hash.h:248
static fib_path_list_walk_rc_t bier_table_ecmp_walk_path_list(fib_node_index_t pl_index, fib_node_index_t path_index, void *arg)
Definition: bier_table.c:631
Definition: fib_entry.h:242
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
bier_hdr_len_id_t bti_hdr_len
The size of the bit string processed by this table.
Definition: bier_types.h:471
From the BIER subsystem.
Definition: fib_entry.h:66
index_t bier_table_add_or_lock(const bier_table_id_t *btid, mpls_label_t local_label)
Definition: bier_table.c:333
static void bier_table_remove(bier_table_t *bt, bier_bp_t bp)
Definition: bier_table.c:506
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:271
static const index_t bier_table_fwd_lookup(const bier_table_t *bt, bier_bp_t bp)
Definition: bier_table.h:166
void fib_path_list_lock(fib_node_index_t path_list_index)
void bier_table_route_add(const bier_table_id_t *btid, bier_bp_t bp, fib_route_path_t *brps)
Definition: bier_table.c:513
bier_table_ecmp_walk_fn_t fn
Definition: bier_table.c:626
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:1180
u8 * format_bier_table_entry(u8 *s, va_list *ap)
Definition: bier_table.c:679
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
Definition: pool.h:188
int bier_entry_path_remove(index_t bei, const fib_route_path_t *rpaths)
Definition: bier_entry.c:234
#define MPLS_FIB_DEFAULT_TABLE_ID
Definition: mpls_fib.h:28
static u32 bier_table_mk_key(const bier_table_id_t *id)
Definition: bier_table.c:63
vlib_main_t * vm
Definition: buffer.c:283
void fib_table_entry_delete_index(fib_node_index_t fib_entry_index, fib_source_t source)
Delete a FIB entry.
Definition: fib_table.c:860
#define MPLS_LABEL_INVALID
Definition: mpls_types.h:48
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:336
static const index_t bier_table_lookup(const bier_table_t *bt, bier_bp_t bp)
Definition: bier_table.h:159
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:268
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:182
void fib_path_list_unlock(fib_node_index_t path_list_index)
void bier_table_walk(const bier_table_id_t *bti, bier_table_walk_fn_t fn, void *ctx)
Definition: bier_table.c:798
bier_table_t * bier_table_pool
Memory pool of all the allocated tables.
Definition: bier_table.c:32
fib_node_index_t fib_table_entry_special_dpo_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Add a &#39;special&#39; entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
Definition: fib_table.c:290
fib_node_index_t bt_lfei
The index of the lfib entry created for this table.
Definition: bier_table.h:53
The BIER entry.
Definition: bier_entry.h:46
#define ASSERT(truth)
void bier_table_unlock(const bier_table_id_t *bti)
Definition: bier_table.c:218
static void bier_table_init(bier_table_t *bt, const bier_table_id_t *id, mpls_label_t ll)
Definition: bier_table.c:80
unsigned int u32
Definition: types.h:88
index_t * bt_entries
Entries in the table This is a vector sized to the appropriate number of entries given the table&#39;s su...
Definition: bier_table.h:65
static void bier_table_mk_lfib(bier_table_t *bt)
Definition: bier_table.c:233
const bier_table_id_t * bier_table_get_id(index_t bti)
Definition: bier_table.c:488
static void bier_table_lock_i(bier_table_t *bt)
Definition: bier_table.c:201
index_t bier_table_ecmp_create_and_lock(const bier_table_id_t *btid)
Definition: bier_table.c:420
static void bier_table_dpo_lock(dpo_id_t *dpo)
Definition: bier_table.c:432
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:1087
fib_route_path_flags_t frp_flags
flags on the path
Definition: fib_types.h:469
u8 * format_bier_entry(u8 *s, va_list *ap)
Definition: bier_entry.c:306
fib_node_index_t bt_pl
The path-list used for the ECMP-tables.
Definition: bier_table.h:47
A path that resolves via a BIER F-Mask.
Definition: fib_types.h:334
format_function_t format_mpls_unicast_label
Definition: mpls.h:69
u64 uword
Definition: types.h:112
void(* bier_table_walk_fn_t)(const bier_table_t *bt, const bier_entry_t *be, void *ctx)
Types and functions to walk all the entries in one BIER Table.
Definition: bier_table.h:140
bier_table_id_t bt_id
The identity/key or the table.
Definition: bier_table.h:75
#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
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:30
unsigned char u8
Definition: types.h:56
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:47
void bier_table_route_remove(const bier_table_id_t *bti, bier_bp_t bp, fib_route_path_t *brps)
Definition: bier_table.c:565
A BIER Table is the bit-indexed forwarding table.
Definition: bier_table.h:38
bier_table_sub_domain_id_t bti_sub_domain
The Sub-Domain-ID The control plane has the configuration option to specify multiple domains or topol...
Definition: bier_types.h:460
void bier_table_show_all(vlib_main_t *vm, bier_show_flags_t flags)
Definition: bier_table.c:771
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:193
u32 frp_bier_fib_index
The BIER table to resolve the fmask in.
Definition: fib_types.h:427
static clib_error_t * bier_table_module_init(vlib_main_t *vm)
Definition: bier_table.c:478
void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index, fib_forward_chain_type_t fct, fib_path_list_fwd_flags_t flags, dpo_id_t *dpo)
#define BIER_ECMP_TABLE_ID_MAIN
Definition of the ID of the BIER main table.
Definition: bier_types.h:441
static void bier_table_rm_bift(bier_table_t *bt)
Definition: bier_table.c:111
#define BIER_BP_TO_INDEX(bp)
Definition: bier_types.h:348
void bier_fmask_unlock(index_t bfmi)
Definition: bier_fmask.c:238
void bier_entry_path_add(index_t bei, const fib_route_path_t *rpaths)
Definition: bier_entry.c:164
void bier_bift_table_entry_remove(bier_bift_id_t id)
#define vec_validate_init_empty_aligned(V, I, INIT, A)
Make sure vector is long enough for given index and initialize empty space (no header, alignment alignment)
Definition: vec.h:494
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:228
#define vec_foreach(var, vec)
Vector iterator.
struct bier_table_ecmp_walk_ctx_t_ bier_table_ecmp_walk_ctx_t
void bier_table_ecmp_walk(index_t bti, bier_table_ecmp_walk_fn_t fn, void *ctx)
Definition: bier_table.c:643
void bier_table_ecmp_set_fmask(index_t bti, bier_bp_t bp, index_t bfmi)
Definition: bier_table.c:661
static u8 * format_bier_table_dpo(u8 *s, va_list *ap)
Definition: bier_table.c:450
#define pool_foreach_index(i, v, body)
Iterate pool by index.
Definition: pool.h:480
u32 flags
Definition: vhost-user.h:77
void bier_tables_walk(bier_tables_walk_fn_t fn, void *ctx)
Definition: bier_table.c:790
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:67
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:680
static void bier_table_rm_lfib(bier_table_t *bt)
Definition: bier_table.c:138
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".
static void bier_table_dpo_mem_show(void)
Definition: bier_table.c:442
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:128