FD.io VPP  v18.04-17-g3a0d853
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 index of the FIB for a Table-ID. This DOES NOT create the
649  * FIB if it does not exist.
650  *
651  * @paran proto
652  * The protocol of the FIB (and thus the entries therein)
653  *
654  * @param table-id
655  * The Table-ID
656  *
657  * @return fib_index
658  * The index of the FIB, which may be INVALID.
659  */
660 extern u32 fib_table_find(fib_protocol_t proto, u32 table_id);
661 
662 
663 /**
664  * @brief
665  * Get the index of the FIB for a Table-ID. This DOES create the
666  * FIB if it does not exist.
667  *
668  * @paran proto
669  * The protocol of the FIB (and thus the entries therein)
670  *
671  * @param table-id
672  * The Table-ID
673  *
674  * @return fib_index
675  * The index of the FIB
676  *
677  * @param source
678  * The ID of the client/source.
679  */
681  u32 table_id,
682  fib_source_t source);
683 
684 /**
685  * @brief
686  * Get the index of the FIB for a Table-ID. This DOES create the
687  * FIB if it does not exist.
688  *
689  * @paran proto
690  * The protocol of the FIB (and thus the entries therein)
691  *
692  * @param table-id
693  * The Table-ID
694  *
695  * @return fib_index
696  * The index of the FIB
697  *
698  * @param source
699  * The ID of the client/source.
700  *
701  * @param name
702  * The client is choosing the name they want the table to have
703  */
705  u32 table_id,
706  fib_source_t source,
707  const u8 *name);
708 
709 /**
710  * @brief
711  * Create a new table with no table ID. This means it does not get
712  * added to the hash-table and so can only be found by using the index returned.
713  *
714  * @paran proto
715  * The protocol of the FIB (and thus the entries therein)
716  *
717  * @param fmt
718  * A string to describe the table
719  *
720  * @param source
721  * The ID of the client/source.
722  *
723  * @return fib_index
724  * The index of the FIB
725  */
727  fib_source_t source,
728  const char *const fmt,
729  ...);
730 
731 /**
732  * @brief
733  * Get the flow hash configured used by the table
734  *
735  * @param fib_index
736  * The index of the FIB
737  *
738  * @paran proto
739  * The protocol the packets the flow hash will be calculated for.
740  *
741  * @return The flow hash config
742  */
744  fib_protocol_t proto);
745 
746 /**
747  * @brief
748  * Get the flow hash configured used by the protocol
749  *
750  * @paran proto
751  * The protocol of the FIB (and thus the entries therein)
752  *
753  * @return The flow hash config
754  */
756 
757 /**
758  * @brief
759  * Set the flow hash configured used by the table
760  *
761  * @param fib_index
762  * The index of the FIB
763  *
764  * @paran proto
765  * The protocol of the FIB (and thus the entries therein)
766  *
767  * @param hash_config
768  * The flow-hash config to set
769  *
770  * @return none
771  */
772 extern void fib_table_set_flow_hash_config(u32 fib_index,
773  fib_protocol_t proto,
774  flow_hash_config_t hash_config);
775 
776 /**
777  * @brief
778  * Take a reference counting lock on the table
779  *
780  * @param fib_index
781  * The index of the FIB
782  *
783  * @paran proto
784  * The protocol of the FIB (and thus the entries therein)
785  *
786  * @param source
787  * The ID of the client/source.
788  */
789 extern void fib_table_unlock(u32 fib_index,
790  fib_protocol_t proto,
791  fib_source_t source);
792 
793 /**
794  * @brief
795  * Release a reference counting lock on the table. When the last lock
796  * has gone. the FIB is deleted.
797  *
798  * @param fib_index
799  * The index of the FIB
800  *
801  * @paran proto
802  * The protocol of the FIB (and thus the entries therein)
803  *
804  * @param source
805  * The ID of the client/source.
806  */
807 extern void fib_table_lock(u32 fib_index,
808  fib_protocol_t proto,
809  fib_source_t source);
810 
811 /**
812  * @brief
813  * Return the number of entries in the FIB added by a given source.
814  *
815  * @param fib_index
816  * The index of the FIB
817  *
818  * @paran proto
819  * The protocol of the FIB (and thus the entries therein)
820  *
821  * @return number of sourced entries.
822  */
823 extern u32 fib_table_get_num_entries(u32 fib_index,
824  fib_protocol_t proto,
825  fib_source_t source);
826 
827 /**
828  * @brief
829  * Get a pointer to a FIB table
830  */
832  fib_protocol_t proto);
833 
834 /**
835  * @brief return code controlling how a table walk proceeds
836  */
838 {
839  /**
840  * Continue on to the next entry
841  */
843  /**
844  * Do no traverse down this sub-tree
845  */
847  /**
848  * Stop the walk completely
849  */
852 
853 /**
854  * @brief Call back function when walking entries in a FIB table
855  */
857  void *ctx);
858 
859 /**
860  * @brief Walk all entries in a FIB table
861  * N.B: This is NOT safe to deletes. If you need to delete walk the whole
862  * table and store elements in a vector, then delete the elements
863  */
864 extern void fib_table_walk(u32 fib_index,
865  fib_protocol_t proto,
867  void *ctx);
868 
869 /**
870  * @brief Walk all entries in a sub-tree FIB table. The 'root' paraneter
871  * is the prefix at the root of the sub-tree.
872  * N.B: This is NOT safe to deletes. If you need to delete walk the whole
873  * table and store elements in a vector, then delete the elements
874  */
875 extern void fib_table_sub_tree_walk(u32 fib_index,
876  fib_protocol_t proto,
877  const fib_prefix_t *root,
879  void *ctx);
880 
881 /**
882  * @brief format (display) the memory used by the FIB tables
883  */
884 extern u8 *format_fib_table_memory(u8 *s, va_list *args);
885 
886 #endif
Continue on to the next entry.
Definition: fib_table.h:842
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:1238
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:1096
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:764
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:845
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:1006
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:338
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:592
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:1209
u8 * format_fib_table_name(u8 *s, va_list *ap)
Format the description/name of the table.
Definition: fib_table.c:1262
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:1169
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:1189
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:1115
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:715
enum fib_route_path_flags_t_ fib_route_path_flags_t
Path flags from the control plane.
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:1024
u16 ft_locks[FIB_TABLE_N_LOCKS]
per-source number of locks on the table
Definition: fib_table.h:84
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:1105
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:956
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:967
#define FIB_SOURCE_MAX
The maximum number of sources.
Definition: fib_entry.h:153
Stop the walk completely.
Definition: fib_table.h:850
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:399
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:1307
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:1037
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:856
enum fib_entry_flag_t_ fib_entry_flag_t
unsigned int u32
Definition: types.h:88
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:548
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:940
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:869
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:846
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:380
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:674
unsigned short u16
Definition: types.h:57
unsigned char u8
Definition: types.h:56
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:908
u8 * format_fib_table_memory(u8 *s, va_list *args)
format (display) the memory used by the FIB tables
Definition: fib_table.c:1330
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:837
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:1250
u32 flags
Definition: vhost-user.h:77
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:514
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:299
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:881
A protocol Independent FIB table.
Definition: fib_table.h:69