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