FIB Interpose Source
[vpp.git] / src / vnet / fib / fib_entry_src_rr.h
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_ENTRY_SRC_RR_H__
17 #define __FIB_ENTRY_SRC_RR_H__
18
19 #include "fib_entry_src.h"
20
21 /*
22  * the flags that an RR sourced entry can inherit from its cover
23  */
24 #define FIB_ENTRY_FLAGS_RR_INHERITED (FIB_ENTRY_FLAG_CONNECTED | \
25                                       FIB_ENTRY_FLAG_ATTACHED)
26
27 /*
28  * fib_entry_src_rr_resolve_via_connected
29  *
30  * Resolve via a connected cover.
31  */
32 void
33 fib_entry_src_rr_resolve_via_connected (fib_entry_src_t *src,
34                                         const fib_entry_t *fib_entry,
35                                         const fib_entry_t *cover);
36
37 /*
38  * use the path-list of the cover, unless it would form a loop.
39  * that is unless the cover is via this entry.
40  * If a loop were to form it would be a 1 level loop (i.e. X via X),
41  * and there would be 2 locks on the path-list; one since its used
42  * by the cover, and 1 from here. The first lock will go when the
43  * cover is removed, the second, and last, when the covered walk
44  * occurs during the cover's removel - this is not a place where
45  * we can handle last lock gone.
46  * In short, don't let the loop form. The usual rules of 'we must
47  * let it form so we know when it breaks' don't apply here, since
48  * the loop will break when the cover changes, and this function
49  * will be called again when that happens.
50  */
51 void
52 fib_entry_src_rr_use_covers_pl (fib_entry_src_t *src,
53                                 const fib_entry_t *fib_entry,
54                                 const fib_entry_t *cover);
55
56
57 /*
58  * fib_entry_src_rr_cover_update
59  *
60  * This entry's cover has changed. This entry
61  * will need to re-inheret.
62  */
63 fib_entry_src_cover_res_t
64 fib_entry_src_rr_cover_change (fib_entry_src_t *src,
65                                const fib_entry_t *fib_entry);
66
67 /*
68  * fib_entry_src_rr_cover_update
69  *
70  * This entry's cover has updated its forwarding info. This entry
71  * will need to re-inheret.
72  */
73 fib_entry_src_cover_res_t
74 fib_entry_src_rr_cover_update (fib_entry_src_t *src,
75                                const fib_entry_t *fib_entry);
76
77 #endif