FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
fib_table.h
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 #ifndef __FIB_TABLE_H__
17 #define __FIB_TABLE_H__
18 
19 #include <vnet/ip/ip.h>
20 #include <vnet/adj/adj.h>
21 #include <vnet/fib/fib_entry.h>
22 #include <vnet/mpls/mpls.h>
23 #include <vnet/mpls/packet.h>
24 
25 /**
26  * Flags for the source data
27  */
28 typedef enum fib_table_attribute_t_ {
29  /**
30  * Marker. Add new values after this one.
31  */
33  /**
34  * the table is for IP6 link local addresses
35  */
37  /**
38  * the table is currently resync-ing
39  */
41  /**
42  * Marker. add new entries before this one.
43  */
46 
47 #define FIB_TABLE_ATTRIBUTE_MAX (FIB_TABLE_ATTRIBUTE_LAST+1)
48 
49 #define FIB_TABLE_ATTRIBUTES { \
50  [FIB_TABLE_ATTRIBUTE_IP6_LL] = "ip6-ll", \
51  [FIB_TABLE_ATTRIBUTE_RESYNC] = "resync", \
52 }
53 
54 #define FOR_EACH_FIB_TABLE_ATTRIBUTE(_item) \
55  for (_item = FIB_TABLE_ATTRIBUTE_FIRST; \
56  _item < FIB_TABLE_ATTRIBUTE_MAX; \
57  _item++)
58 
59 typedef enum fib_table_flags_t_ {
63 } __attribute__ ((packed)) fib_table_flags_t;
64 
65 extern u8* format_fib_table_flags(u8 *s, va_list *args);
66 
67 /**
68  * @brief
69  * A protocol Independent FIB table
70  */
71 typedef struct fib_table_t_
72 {
73  /**
74  * Which protocol this table serves. Used to switch on the union above.
75  */
77 
78  /**
79  * Table flags
80  */
82 
83  /**
84  * per-source number of locks on the table
85  */
88 
89  /**
90  * Table ID (hash key) for this FIB.
91  */
93 
94  /**
95  * Index into FIB vector.
96  */
98 
99  /**
100  * flow hash configuration
101  */
103 
104  /**
105  * Per-source route counters
106  */
108 
109  /**
110  * Total route counters
111  */
113 
114  /**
115  * Epoch - number of resyncs performed
116  */
118 
119  /**
120  * Table description
121  */
123 } fib_table_t;
124 
125 /**
126  * @brief
127  * Format the description/name of the table
128  */
129 extern u8* format_fib_table_name(u8* s, va_list *ap);
130 
131 /**
132  * @brief
133  * Perfom a longest prefix match in the non-forwarding table
134  *
135  * @param fib_index
136  * The index of the FIB
137  *
138  * @param prefix
139  * The prefix to lookup
140  *
141  * @return
142  * The index of the fib_entry_t for the best match, which may be the default route
143  */
144 extern fib_node_index_t fib_table_lookup(u32 fib_index,
145  const fib_prefix_t *prefix);
146 
147 /**
148  * @brief
149  * Perfom an exact match in the non-forwarding table
150  *
151  * @param fib_index
152  * The index of the FIB
153  *
154  * @param prefix
155  * The prefix to lookup
156  *
157  * @return
158  * The index of the fib_entry_t for the exact match, or INVALID
159  * is there is no match.
160  */
162  const fib_prefix_t *prefix);
163 
164 /**
165  * @brief
166  * Get the less specific (covering) prefix
167  *
168  * @param fib_index
169  * The index of the FIB
170  *
171  * @param prefix
172  * The prefix to lookup
173  *
174  * @return
175  * The index of the less specific fib_entry_t.
176  */
178  const fib_prefix_t *prefix);
179 
180 /**
181  * @brief
182  * Add a 'special' entry to the FIB.
183  * A special entry is an entry that the FIB is not expect to resolve
184  * via the usual mechanisms (i.e. recurisve or neighbour adj DB lookup).
185  * Instead the will link to a DPO valid for the source and/or the flags.
186  * This add is reference counting per-source. So n 'removes' are required
187  * for n 'adds', if the entry is no longer required.
188  * If the source needs to provide non-default forwarding use:
189  * fib_table_entry_special_dpo_add()
190  *
191  * @param fib_index
192  * The index of the FIB
193  *
194  * @param prefix
195  * The prefix to add
196  *
197  * @param source
198  * The ID of the client/source adding the entry.
199  *
200  * @param flags
201  * Flags for the entry.
202  *
203  * @return
204  * the index of the fib_entry_t that is created (or exists already).
205  */
207  const fib_prefix_t *prefix,
208  fib_source_t source,
210 
211 /**
212  * @brief
213  * Add a 'special' entry to the FIB that links to the DPO passed
214  * A special entry is an entry that the FIB is not expect to resolve
215  * via the usual mechanisms (i.e. recurisve or neighbour adj DB lookup).
216  * Instead the client/source provides the DPO to link to.
217  * This add is reference counting per-source. So n 'removes' are required
218  * for n 'adds', if the entry is no longer required.
219  *
220  * @param fib_index
221  * The index of the FIB
222  *
223  * @param prefix
224  * The prefix to add
225  *
226  * @param source
227  * The ID of the client/source adding the entry.
228  *
229  * @param flags
230  * Flags for the entry.
231  *
232  * @param dpo
233  * The DPO to link to.
234  *
235  * @return
236  * the index of the fib_entry_t that is created (or existed already).
237  */
239  const fib_prefix_t *prefix,
240  fib_source_t source,
241  fib_entry_flag_t stype,
242  const dpo_id_t *dpo);
243 
244 /**
245  * @brief
246  * Update a 'special' entry to the FIB that links to the DPO passed
247  * A special entry is an entry that the FIB is not expect to resolve
248  * via the usual mechanisms (i.e. recurisve or neighbour adj DB lookup).
249  * Instead the client/source provides the DPO to link to.
250  * Special entries are add/remove reference counted per-source. So n
251  * 'removes' are required for n 'adds', if the entry is no longer required.
252  * An 'update' is an 'add' if no 'add' has already been called, otherwise an 'add'
253  * is therefore assumed to act on the reference instance of that add.
254  *
255  * @param fib_entry_index
256  * The index of the FIB entry to update
257  *
258  * @param source
259  * The ID of the client/source adding the entry.
260  *
261  * @param flags
262  * Flags for the entry.
263  *
264  * @param dpo
265  * The DPO to link to.
266  *
267  * @return
268  * the index of the fib_entry_t that is created (or existed already).
269  */
271  const fib_prefix_t *prefix,
272  fib_source_t source,
273  fib_entry_flag_t stype,
274  const dpo_id_t *dpo);
275 
276 /**
277  * @brief
278  * Remove a 'special' entry from the FIB.
279  * This add is reference counting per-source. So n 'removes' are required
280  * for n 'adds', if the entry is no longer required.
281  *
282  * @param fib_index
283  * The index of the FIB
284  *
285  * @param prefix
286  * The prefix to remove
287  *
288  * @param source
289  * The ID of the client/source adding the entry.
290  *
291  */
292 extern void fib_table_entry_special_remove(u32 fib_index,
293  const fib_prefix_t *prefix,
294  fib_source_t source);
295 
296 /**
297  * @brief
298  * Add one path to an entry (aka route) in the FIB. If the entry does not
299  * exist, it will be created.
300  * See the documentation for fib_route_path_t for more descirptions of
301  * the path parameters.
302  *
303  * @param fib_index
304  * The index of the FIB
305  *
306  * @param prefix
307  * The prefix for the entry to add
308  *
309  * @param source
310  * The ID of the client/source adding the entry.
311  *
312  * @param flags
313  * Flags for the entry.
314  *
315  * @paran next_hop_proto
316  * The protocol of the next hop. This cannot be derived in the event that
317  * the next hop is all zeros.
318  *
319  * @param next_hop
320  * The address of the next-hop.
321  *
322  * @param sw_if_index
323  * The index of the interface.
324  *
325  * @param next_hop_fib_index,
326  * The fib index of the next-hop for recursive resolution
327  *
328  * @param next_hop_weight
329  * [un]equal cost path weight
330  *
331  * @param next_hop_label_stack
332  * The path's out-going label stack. NULL is there is none.
333  *
334  * @param pf
335  * Flags for the path
336  *
337  * @return
338  * the index of the fib_entry_t that is created (or existed already).
339  */
341  const fib_prefix_t *prefix,
342  fib_source_t source,
344  dpo_proto_t next_hop_proto,
345  const ip46_address_t *next_hop,
346  u32 next_hop_sw_if_index,
347  u32 next_hop_fib_index,
348  u32 next_hop_weight,
349  fib_mpls_label_t *next_hop_label_stack,
351 /**
352  * @brief
353  * Add n paths to an entry (aka route) in the FIB. If the entry does not
354  * exist, it will be created.
355  * See the documentation for fib_route_path_t for more descirptions of
356  * the path parameters.
357  *
358  * @param fib_index
359  * The index of the FIB
360  *
361  * @param prefix
362  * The prefix for the entry to add
363  *
364  * @param source
365  * The ID of the client/source adding the entry.
366  *
367  * @param flags
368  * Flags for the entry.
369  *
370  * @param rpaths
371  * A vector of paths. Not const since they may be modified.
372  *
373  * @return
374  * the index of the fib_entry_t that is created (or existed already).
375  */
377  const fib_prefix_t *prefix,
378  fib_source_t source,
380  fib_route_path_t *rpath);
381 
382 /**
383  * @brief
384  * remove one path to an entry (aka route) in the FIB. If this is the entry's
385  * last path, then the entry will be removed, unless it has other sources.
386  * See the documentation for fib_route_path_t for more descirptions of
387  * the path parameters.
388  *
389  * @param fib_index
390  * The index of the FIB
391  *
392  * @param prefix
393  * The prefix for the entry to add
394  *
395  * @param source
396  * The ID of the client/source adding the entry.
397  *
398  * @paran next_hop_proto
399  * The protocol of the next hop. This cannot be derived in the event that
400  * the next hop is all zeros.
401  *
402  * @param next_hop
403  * The address of the next-hop.
404  *
405  * @param sw_if_index
406  * The index of the interface.
407  *
408  * @param next_hop_fib_index,
409  * The fib index of the next-hop for recursive resolution
410  *
411  * @param next_hop_weight
412  * [un]equal cost path weight
413  *
414  * @param pf
415  * Flags for the path
416  */
417 extern void fib_table_entry_path_remove(u32 fib_index,
418  const fib_prefix_t *prefix,
419  fib_source_t source,
420  dpo_proto_t next_hop_proto,
421  const ip46_address_t *next_hop,
422  u32 next_hop_sw_if_index,
423  u32 next_hop_fib_index,
424  u32 next_hop_weight,
426 
427 /**
428  * @brief
429  * Remove n paths to an entry (aka route) in the FIB. If this is the entry's
430  * last path, then the entry will be removed, unless it has other sources.
431  * See the documentation for fib_route_path_t for more descirptions of
432  * the path parameters.
433  *
434  * @param fib_index
435  * The index of the FIB
436  *
437  * @param prefix
438  * The prefix for the entry to add
439  *
440  * @param source
441  * The ID of the client/source adding the entry.
442  *
443  * @param rpaths
444  * A vector of paths.
445  */
446 extern void fib_table_entry_path_remove2(u32 fib_index,
447  const fib_prefix_t *prefix,
448  fib_source_t source,
450 
451 /**
452  * @brief
453  * Update an entry to have a new set of paths. If the entry does not
454  * exist, it will be created.
455  * The difference between an 'path-add' and an update, is that path-add is
456  * an incremental addition of paths, whereas an update is a wholesale swap.
457  *
458  * @param fib_index
459  * The index of the FIB
460  *
461  * @param prefix
462  * The prefix for the entry to add
463  *
464  * @param source
465  * The ID of the client/source adding the entry.
466  *
467  * @param rpaths
468  * A vector of paths. Not const since they may be modified.
469  *
470  * @return
471  * the index of the fib_entry_t that is created (or existed already).
472  */
474  const fib_prefix_t *prefix,
475  fib_source_t source,
478 
479 /**
480  * @brief
481  * Update the entry to have just one path. If the entry does not
482  * exist, it will be created.
483  * See the documentation for fib_route_path_t for more descirptions of
484  * the path parameters.
485  *
486  * @param fib_index
487  * The index of the FIB
488  *
489  * @param prefix
490  * The prefix for the entry to add
491  *
492  * @param source
493  * The ID of the client/source adding the entry.
494  *
495  * @param flags
496  * Flags for the entry.
497  *
498  * @paran next_hop_proto
499  * The protocol of the next hop. This cannot be derived in the event that
500  * the next hop is all zeros.
501  *
502  * @param next_hop
503  * The address of the next-hop.
504  *
505  * @param sw_if_index
506  * The index of the interface.
507  *
508  * @param next_hop_fib_index,
509  * The fib index of the next-hop for recursive resolution
510  *
511  * @param next_hop_weight
512  * [un]equal cost path weight
513  *
514  * @param next_hop_label_stack
515  * The path's out-going label stack. NULL is there is none.
516  *
517  * @param pf
518  * Flags for the path
519  *
520  * @return
521  * the index of the fib_entry_t that is created (or existed already).
522  */
524  const fib_prefix_t *prefix,
525  fib_source_t source,
527  dpo_proto_t next_hop_proto,
528  const ip46_address_t *next_hop,
529  u32 next_hop_sw_if_index,
530  u32 next_hop_fib_index,
531  u32 next_hop_weight,
532  fib_mpls_label_t *next_hop_label_stack,
534 
535 /**
536  * @brief
537  * Add a MPLS local label for the prefix/route. If the entry does not
538  * exist, it will be created. In theory more than one local label can be
539  * added, but this is not yet supported.
540  *
541  * @param fib_index
542  * The index of the FIB
543  *
544  * @param prefix
545  * The prefix for the entry to which to add the label
546  *
547  * @param label
548  * The MPLS label to add
549  *
550  * @return
551  * the index of the fib_entry_t that is created (or existed already).
552  */
554  const fib_prefix_t *prefix,
556 /**
557  * @brief
558  * remove a MPLS local label for the prefix/route.
559  *
560  * @param fib_index
561  * The index of the FIB
562  *
563  * @param prefix
564  * The prefix for the entry to which to add the label
565  *
566  * @param label
567  * The MPLS label to add
568  */
569 extern void fib_table_entry_local_label_remove(u32 fib_index,
570  const fib_prefix_t *prefix,
572 
573 /**
574  * @brief
575  * Delete a FIB entry. If the entry has no more sources, then it is
576  * removed from the table.
577  *
578  * @param fib_index
579  * The index of the FIB
580  *
581  * @param prefix
582  * The prefix for the entry to remove
583  *
584  * @param source
585  * The ID of the client/source adding the entry.
586  */
587 extern void fib_table_entry_delete(u32 fib_index,
588  const fib_prefix_t *prefix,
589  fib_source_t source);
590 
591 /**
592  * @brief
593  * Delete a FIB entry. If the entry has no more sources, then it is
594  * removed from the table.
595  *
596  * @param entry_index
597  * The index of the FIB entry
598  *
599  * @param source
600  * The ID of the client/source adding the entry.
601  */
602 extern void fib_table_entry_delete_index(fib_node_index_t entry_index,
603  fib_source_t source);
604 
605 /**
606  * @brief
607  * Return the stats index for a FIB entry
608  * @param fib_index
609  * The table's FIB index
610  * @param prefix
611  * The entry's prefix's
612  */
613 extern u32 fib_table_entry_get_stats_index(u32 fib_index,
614  const fib_prefix_t *prefix);
615 
616 /**
617  * @brief
618  * Flush all entries from a table for the source
619  *
620  * @param fib_index
621  * The index of the FIB
622  *
623  * @paran proto
624  * The protocol of the entries in the table
625  *
626  * @param source
627  * the source to flush
628  */
629 extern void fib_table_flush(u32 fib_index,
631  fib_source_t source);
632 
633 /**
634  * @brief
635  * Resync all entries from a table for the source
636  * this is the mark part of the mark and sweep algorithm.
637  * All entries in this FIB that are sourced by 'source' are marked
638  * as stale.
639  *
640  * @param fib_index
641  * The index of the FIB
642  *
643  * @paran proto
644  * The protocol of the entries in the table
645  *
646  * @param source
647  * the source to flush
648  */
649 extern void fib_table_mark(u32 fib_index,
651  fib_source_t source);
652 
653 /**
654  * @brief
655  * Signal that the table has converged, i.e. all updates are complete.
656  * this is the sweep part of the mark and sweep algorithm.
657  * All entries in this FIB that are sourced by 'source' and marked
658  * as stale are flushed.
659  *
660  * @param fib_index
661  * The index of the FIB
662  *
663  * @paran proto
664  * The protocol of the entries in the table
665  *
666  * @param source
667  * the source to flush
668  */
669 extern void fib_table_sweep(u32 fib_index,
671  fib_source_t source);
672 
673 /**
674  * @brief
675  * Get the index of the FIB bound to the interface
676  *
677  * @paran proto
678  * The protocol of the FIB (and thus the entries therein)
679  *
680  * @param sw_if_index
681  * The interface index
682  *
683  * @return fib_index
684  * The index of the FIB
685  */
687  u32 sw_if_index);
688 
689 /**
690  * @brief
691  * Get the Table-ID of the FIB bound to the interface
692  *
693  * @paran proto
694  * The protocol of the FIB (and thus the entries therein)
695  *
696  * @param sw_if_index
697  * The interface index
698  *
699  * @return fib_index
700  * The tableID of the FIB
701  */
703  u32 sw_if_index);
704 
705 /**
706  * @brief
707  * Get the Table-ID of the FIB from protocol and index
708  *
709  * @param fib_index
710  * The FIB index
711  *
712  * @paran proto
713  * The protocol of the FIB (and thus the entries therein)
714  *
715  * @return fib_index
716  * The tableID of the FIB
717  */
719 
720 /**
721  * @brief
722  * Get the index of the FIB for a Table-ID. This DOES NOT create the
723  * FIB if it does not exist.
724  *
725  * @paran proto
726  * The protocol of the FIB (and thus the entries therein)
727  *
728  * @param table-id
729  * The Table-ID
730  *
731  * @return fib_index
732  * The index of the FIB, which may be INVALID.
733  */
735 
736 
737 /**
738  * @brief
739  * Get the index of the FIB for a Table-ID. This DOES create the
740  * FIB if it does not exist.
741  *
742  * @paran proto
743  * The protocol of the FIB (and thus the entries therein)
744  *
745  * @param table-id
746  * The Table-ID
747  *
748  * @return fib_index
749  * The index of the FIB
750  *
751  * @param source
752  * The ID of the client/source.
753  */
755  u32 table_id,
756  fib_source_t source);
757 
758 /**
759  * @brief
760  * Get the index of the FIB for a Table-ID. This DOES create the
761  * FIB if it does not exist.
762  *
763  * @paran proto
764  * The protocol of the FIB (and thus the entries therein)
765  *
766  * @param table-id
767  * The Table-ID
768  *
769  * @return fib_index
770  * The index of the FIB
771  *
772  * @param source
773  * The ID of the client/source.
774  *
775  * @param name
776  * The client is choosing the name they want the table to have
777  */
779  u32 table_id,
780  fib_source_t source,
781  const u8 *name);
782 
783 /**
784  * @brief
785  * Create a new table with no table ID. This means it does not get
786  * added to the hash-table and so can only be found by using the index returned.
787  *
788  * @paran proto
789  * The protocol of the FIB (and thus the entries therein)
790  *
791  * @param fmt
792  * A string to describe the table
793  *
794  * @param source
795  * The ID of the client/source.
796  *
797  * @return fib_index
798  * The index of the FIB
799  */
801  fib_source_t source,
802  const char *const fmt,
803  ...);
804 
805 /**
806  * @brief
807  * Get the flow hash configured used by the table
808  *
809  * @param fib_index
810  * The index of the FIB
811  *
812  * @paran proto
813  * The protocol the packets the flow hash will be calculated for.
814  *
815  * @return The flow hash config
816  */
819 
820 /**
821  * @brief
822  * Get the flow hash configured used by the protocol
823  *
824  * @paran proto
825  * The protocol of the FIB (and thus the entries therein)
826  *
827  * @return The flow hash config
828  */
830 
831 /**
832  * @brief
833  * Set the flow hash configured used by the table
834  *
835  * @param fib_index
836  * The index of the FIB
837  *
838  * @paran proto
839  * The protocol of the FIB (and thus the entries therein)
840  *
841  * @param hash_config
842  * The flow-hash config to set
843  *
844  * @return none
845  */
846 extern void fib_table_set_flow_hash_config(u32 fib_index,
848  flow_hash_config_t hash_config);
849 
850 /**
851  * @brief
852  * Take a reference counting lock on the table
853  *
854  * @param fib_index
855  * The index of the FIB
856  *
857  * @paran proto
858  * The protocol of the FIB (and thus the entries therein)
859  *
860  * @param source
861  * The ID of the client/source.
862  */
863 extern void fib_table_unlock(u32 fib_index,
865  fib_source_t source);
866 
867 /**
868  * @brief
869  * Release a reference counting lock on the table. When the last lock
870  * has gone. the FIB is deleted.
871  *
872  * @param fib_index
873  * The index of the FIB
874  *
875  * @paran proto
876  * The protocol of the FIB (and thus the entries therein)
877  *
878  * @param source
879  * The ID of the client/source.
880  */
881 extern void fib_table_lock(u32 fib_index,
883  fib_source_t source);
884 
885 /**
886  * @brief
887  * Return the number of entries in the FIB added by a given source.
888  *
889  * @param fib_index
890  * The index of the FIB
891  *
892  * @paran proto
893  * The protocol of the FIB (and thus the entries therein)
894  *
895  * @return number of sourced entries.
896  */
897 extern u32 fib_table_get_num_entries(u32 fib_index,
899  fib_source_t source);
900 
901 /**
902  * @brief
903  * Get a pointer to a FIB table
904  */
907 
908 /**
909  * @brief return code controlling how a table walk proceeds
910  */
912 {
913  /**
914  * Continue on to the next entry
915  */
917  /**
918  * Do no traverse down this sub-tree
919  */
921  /**
922  * Stop the walk completely
923  */
926 
927 /**
928  * @brief Call back function when walking entries in a FIB table
929  */
931  void *ctx);
932 
933 /**
934  * @brief Walk all entries in a FIB table
935  * N.B: This is NOT safe to deletes. If you need to delete walk the whole
936  * table and store elements in a vector, then delete the elements
937  */
938 extern void fib_table_walk(u32 fib_index,
941  void *ctx);
942 
943 /**
944  * @brief Walk all entries in a sub-tree FIB table. The 'root' paraneter
945  * is the prefix at the root of the sub-tree.
946  * N.B: This is NOT safe to deletes. If you need to delete walk the whole
947  * table and store elements in a vector, then delete the elements
948  */
949 extern void fib_table_sub_tree_walk(u32 fib_index,
951  const fib_prefix_t *root,
953  void *ctx);
954 
955 /**
956  * @brief format (display) the memory used by the FIB tables
957  */
958 extern u8 *format_fib_table_memory(u8 *s, va_list *args);
959 
960 /**
961  * Debug function
962  */
963 #ifdef CLIB_DEBUG
964 extern void fib_table_assert_empty(const fib_table_t *fib_table);
965 #endif
966 
967 
968 #endif
enum fib_source_t_ fib_source_t
The different sources that can create a route.
void fib_table_mark(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Resync all entries from a table for the source this is the mark part of the mark and sweep algorithm...
Definition: fib_table.c:1434
Continue on to the next entry.
Definition: fib_table.h:916
u8 proto
Definition: acl_types.api:47
fib_protocol_t ft_proto
Which protocol this table serves.
Definition: fib_table.h:76
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:1310
A representation of a path as described by a route producer.
Definition: fib_types.h:485
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, fib_source_t source)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:1156
struct fib_table_t_ fib_table_t
A protocol Independent FIB table.
fib_node_index_t fib_table_lookup(u32 fib_index, const fib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
Definition: fib_table.c:68
u32 mpls_label_t
A label value only, i.e.
Definition: packet.h:26
enum fib_table_flags_t_ fib_table_flags_t
fib_node_index_t fib_table_entry_update_one_path(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_label_stack, fib_route_path_flags_t pf)
Update the entry to have just one path.
Definition: fib_table.c:805
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
Definition: fib_table.c:886
void fib_table_set_flow_hash_config(u32 fib_index, fib_protocol_t proto, flow_hash_config_t hash_config)
Set the flow hash configured used by the table.
Definition: fib_table.c:1055
fib_node_index_t fib_table_entry_special_dpo_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t stype, const dpo_id_t *dpo)
Update a &#39;special&#39; entry to the FIB that links to the DPO passed A special entry is an entry that the...
Definition: fib_table.c:363
vl_api_prefix_t prefix
Definition: ip.api:144
void fib_table_entry_path_remove2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_route_path_t *paths)
Remove n paths to an entry (aka route) in the FIB.
Definition: fib_table.c:640
unsigned char u8
Definition: types.h:56
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
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:1291
u8 * format_fib_table_name(u8 *s, va_list *ap)
Format the description/name of the table.
Definition: fib_table.c:1334
void fib_table_walk(u32 fib_index, fib_protocol_t proto, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a FIB table N.B: This is NOT safe to deletes.
Definition: fib_table.c:1230
u32 fib_table_get_table_id(u32 fib_index, fib_protocol_t proto)
Get the Table-ID of the FIB from protocol and index.
Definition: fib_table.c:1086
fib_node_index_t fib_table_lookup_exact_match(u32 fib_index, const fib_prefix_t *prefix)
Perfom an exact match in the non-forwarding table.
Definition: fib_table.c:97
vl_api_interface_index_t sw_if_index
Definition: gre.api:59
u32 ft_epoch
Epoch - number of resyncs performed.
Definition: fib_table.h:117
Aggregate type for a prefix.
Definition: fib_types.h:203
u32 fib_table_entry_get_stats_index(u32 fib_index, const fib_prefix_t *prefix)
Return the stats index for a FIB entry.
Definition: fib_table.c:922
void fib_table_sub_tree_walk(u32 fib_index, fib_protocol_t proto, const fib_prefix_t *root, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a sub-tree FIB table.
Definition: fib_table.c:1250
u32 fib_table_create_and_lock(fib_protocol_t proto, fib_source_t source, const char *const fmt,...)
Create a new table with no table ID.
Definition: fib_table.c:1175
fib_node_index_t fib_table_entry_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *paths)
Update an entry to have a new set of paths.
Definition: fib_table.c:756
enum fib_route_path_flags_t_ fib_route_path_flags_t
Path flags from the control plane.
unsigned int u32
Definition: types.h:88
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
u32 * ft_locks
per-source number of locks on the table
Definition: fib_table.h:86
fib_node_index_t fib_table_get_less_specific(u32 fib_index, const fib_prefix_t *prefix)
Get the less specific (covering) prefix.
Definition: fib_table.c:133
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
u32 fib_table_get_table_id_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the Table-ID of the FIB bound to the interface.
Definition: fib_table.c:1073
long ctx[MAX_CONNS]
Definition: main.c:144
u32 fib_table_find_or_create_and_lock_w_name(fib_protocol_t proto, u32 table_id, fib_source_t source, const u8 *name)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:1165
void fib_table_assert_empty(const fib_table_t *fib_table)
Debug function.
Definition: fib_entry.c:1718
u32 ft_total_route_counts
Total route counters.
Definition: fib_table.h:112
Configuration for each label value in the output-stack.
Definition: fib_types.h:440
flow_hash_config_t fib_table_get_flow_hash_config(u32 fib_index, fib_protocol_t proto)
Get the flow hash configured used by the table.
Definition: fib_table.c:1005
u32 label
Definition: fib_types.api:25
flow_hash_config_t fib_table_get_default_flow_hash_config(fib_protocol_t proto)
Get the flow hash configured used by the protocol.
Definition: fib_table.c:1016
Stop the walk completely.
Definition: fib_table.h:924
enum fib_table_attribute_t_ fib_table_attribute_t
Flags for the source data.
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a &#39;special&#39; entry from the FIB.
Definition: fib_table.c:424
fib_node_index_t ft_index
Index into FIB vector.
Definition: fib_table.h:97
u32 flags
Definition: vhost_user.h:141
void fib_table_flush(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Flush all entries from a table for the source.
Definition: fib_table.c:1398
u32 ft_table_id
Table ID (hash key) for this FIB.
Definition: fib_table.h:92
u32 ft_flow_hash_config
flow hash configuration
Definition: fib_table.h:102
enum fib_table_walk_rc_t_ fib_table_walk_rc_t
return code controlling how a table walk proceeds
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:1097
u8 * ft_desc
Table description.
Definition: fib_table.h:122
fib_table_flags_t ft_flags
Table flags.
Definition: fib_table.h:81
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
Definition: fib_table.c:29
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:30
string name[64]
Definition: ip.api:44
fib_table_walk_rc_t(* fib_table_walk_fn_t)(fib_node_index_t fei, void *ctx)
Call back function when walking entries in a FIB table.
Definition: fib_table.h:930
enum fib_entry_flag_t_ fib_entry_flag_t
vl_api_fib_path_t paths[n_paths]
Definition: ip.api:146
fib_node_index_t fib_table_entry_path_add2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *rpath)
Add n paths to an entry (aka route) in the FIB.
Definition: fib_table.c:591
u32 fib_table_get_index_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the index of the FIB bound to the interface.
Definition: fib_table.c:989
void fib_table_entry_delete_index(fib_node_index_t entry_index, fib_source_t source)
Delete a FIB entry.
Definition: fib_table.c:910
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
Definition: lookup.h:84
Do no traverse down this sub-tree.
Definition: fib_table.h:920
the table is currently resync-ing
Definition: fib_table.h:40
fib_node_index_t fib_table_entry_special_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags)
Add a &#39;special&#39; entry to the FIB.
Definition: fib_table.c:405
fib_table_flags_t_
Definition: fib_table.h:59
void fib_table_entry_path_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_route_path_flags_t pf)
remove one path to an entry (aka route) in the FIB.
Definition: fib_table.c:722
u32 ft_total_locks
Definition: fib_table.h:87
void fib_table_sweep(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Signal that the table has converged, i.e.
Definition: fib_table.c:1467
void fib_table_entry_local_label_remove(u32 fib_index, const fib_prefix_t *prefix, mpls_label_t label)
remove a MPLS local label for the prefix/route.
Definition: fib_table.c:957
u8 * format_fib_table_memory(u8 *s, va_list *args)
format (display) the memory used by the FIB tables
Definition: fib_table.c:1494
u8 * format_fib_table_flags(u8 *s, va_list *args)
Definition: fib_table.c:1348
the table is for IP6 link local addresses
Definition: fib_table.h:36
u32 * ft_src_route_counts
Per-source route counters.
Definition: fib_table.h:107
fib_table_attribute_t_
Flags for the source data.
Definition: fib_table.h:28
fib_table_walk_rc_t_
return code controlling how a table walk proceeds
Definition: fib_table.h:911
u32 fib_table_get_num_entries(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Return the number of entries in the FIB added by a given source.
Definition: fib_table.c:1322
u32 table_id
Definition: fib_types.api:118
fib_node_index_t fib_table_entry_path_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_label_stack, fib_route_path_flags_t pf)
Add one path to an entry (aka route) in the FIB.
Definition: fib_table.c:549
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 stype, 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:324
fib_node_index_t fib_table_entry_local_label_add(u32 fib_index, const fib_prefix_t *prefix, mpls_label_t label)
Add a MPLS local label for the prefix/route.
Definition: fib_table.c:930
A protocol Independent FIB table.
Definition: fib_table.h:71