blob: 629e47a859a6a063ec2178ef4a8047ace4846185 [file] [log] [blame]
Neale Rannsd792d9c2017-10-21 10:53:20 -07001/*
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 * bier_entry : The BIER entry
17 *
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.
24 *
25 */
26
27#ifndef __BIER_ENTRY_H__
28#define __BIER_ENTRY_H__
29
30#include <vlib/vlib.h>
31#include <vnet/fib/fib_node.h>
32#include <vnet/bier/bier_types.h>
33
34/**
35 * Forward declarations
36 */
37struct bier_route_update_t_;
38struct bier_fmask_db_t_;
39
40/**
41 * The BIER entry
42 *
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.
45 */
46typedef struct bier_entry_t_ {
47 /**
48 * linkage into the FIB graph
49 */
50 fib_node_t be_node;
51
52 /**
53 * The index of the BIER table in which this entry resides
54 */
55 index_t be_bti;
56
57 /**
58 * the bit position this entry represents.
59 * this is the key table insertion
60 */
61 bier_bp_t be_bp;
62
63 /**
64 * the FIB path-list this entry resolves through.
65 * the path-list is itself resoved on the entry's fmasks
66 */
67 fib_node_index_t be_path_list;
68 /**
69 * sibling index on the path list
70 */
71 fib_node_index_t be_sibling_index;
72} bier_entry_t;
73
74extern index_t bier_entry_create(index_t bti,
75 bier_bp_t bp);
76extern void bier_entry_delete(index_t bei);
77
Neale Rannsef90ed02018-09-13 08:45:12 -070078extern void bier_entry_path_update (index_t bei,
79 const fib_route_path_t *rpaths);
80
Neale Rannsd792d9c2017-10-21 10:53:20 -070081extern void bier_entry_path_add(index_t bei,
82 const fib_route_path_t *brp);
83
84extern int bier_entry_path_remove(index_t bei,
85 const fib_route_path_t *brp);
86
87extern u8* format_bier_entry(u8* s, va_list *ap);
88
89extern void bier_entry_contribute_forwarding(index_t bei,
90 dpo_id_t *dpo);
91
92extern bier_entry_t *bier_entry_pool;
93always_inline bier_entry_t* bier_entry_get(index_t bei)
94{
95 return (&bier_entry_pool[bei]);
96}
97#endif