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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 * bier_entry : The BIER entry
18 * The interface to the BIER entry is through a bier_entry_t* rather
19 * than an index. This is becuase the BIER table allocates the entries
20 * in a contiguous array once and only once when the table is created.
21 * this is done for forwarding performance. The entry is thus not subject
22 * to realloc, and does not need to be malloc'd when a route to that
23 * bit-position is first learned.
27 #ifndef __BIER_ENTRY_H__
28 #define __BIER_ENTRY_H__
30 #include <vlib/vlib.h>
31 #include <vnet/fib/fib_node.h>
32 #include <vnet/bier/bier_types.h>
35 * Forward declarations
37 struct bier_route_update_t_;
38 struct bier_fmask_db_t_;
43 * the BIER entry is the representation of a BIER forwarding egress router (BFER)
44 * (or the egress PE) that is assigned a bit position.
46 typedef struct bier_entry_t_ {
48 * linkage into the FIB graph
53 * The index of the BIER table in which this entry resides
58 * the bit position this entry represents.
59 * this is the key table insertion
64 * the FIB path-list this entry resolves through.
65 * the path-list is itself resoved on the entry's fmasks
67 fib_node_index_t be_path_list;
69 * sibling index on the path list
71 fib_node_index_t be_sibling_index;
74 extern index_t bier_entry_create(index_t bti,
76 extern void bier_entry_delete(index_t bei);
78 extern void bier_entry_path_add(index_t bei,
79 const fib_route_path_t *brp);
81 extern int bier_entry_path_remove(index_t bei,
82 const fib_route_path_t *brp);
84 extern u8* format_bier_entry(u8* s, va_list *ap);
86 extern void bier_entry_contribute_forwarding(index_t bei,
89 extern bier_entry_t *bier_entry_pool;
90 always_inline bier_entry_t* bier_entry_get(index_t bei)
92 return (&bier_entry_pool[bei]);