FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
mfib_entry_src_rr.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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 
19 #include <vnet/mfib/mfib_table.h>
20 #include <vnet/fib/fib_path_list.h>
21 
22 static void
24  mfib_entry_src_t *msrc)
25 {
26  mfib_entry_t *cover;
27 
28  /*
29  * remove the depednecy on the covering entry
30  */
32  {
33  cover = mfib_entry_get(msrc->mfes_cover);
36  }
37 
40  msrc->mfes_itfs = NULL;
41  msrc->mfes_exts = NULL;
42 }
43 
44 static void
46  mfib_entry_src_t *msrc)
47 {
48  mfib_entry_src_t *csrc;
49  mfib_entry_t *cover;
50 
52  &mfib_entry->mfe_prefix);
53 
55 
56  cover = mfib_entry_get(msrc->mfes_cover);
57 
58  msrc->mfes_sibling =
59  mfib_entry_cover_track(cover, mfib_entry_get_index(mfib_entry));
60 
61  csrc = mfib_entry_get_best_src(cover);
62 
63  msrc->mfes_pl = csrc->mfes_pl;
65  msrc->mfes_route_flags = csrc->mfes_route_flags;
66  msrc->mfes_itfs = csrc->mfes_itfs;
67  msrc->mfes_exts = csrc->mfes_exts;
68  msrc->mfes_rpf_id = csrc->mfes_rpf_id;
69 }
70 
71 static mfib_src_res_t
73  mfib_entry_src_t *msrc)
74 {
75  mfib_entry_src_rr_deactiviate(mfib_entry, msrc);
76  mfib_entry_src_rr_activiate(mfib_entry, msrc);
77 
78  return (MFIB_SRC_REEVALUATE);
79 }
80 
81 static mfib_src_res_t
83  mfib_entry_src_t *msrc)
84 {
85  /*
86  * path lists are updated (i.e. not shared) in the mfib world,
87  * so there's no need to check for a new one. but we do need to
88  * copy down any new flags and input interfaces
89  */
90  mfib_entry_t *cover;
91 
92  cover = mfib_entry_get(msrc->mfes_cover);
93 
94  msrc->mfes_route_flags = cover->mfe_flags;
95  msrc->mfes_itfs = cover->mfe_itfs;
96  msrc->mfes_rpf_id = cover->mfe_rpf_id;
97 
98  return (MFIB_SRC_REEVALUATE);
99 }
100 
101 void
103 {
104  mfib_entry_src_vft mvft = {
106  .mev_deactivate = mfib_entry_src_rr_deactiviate,
107  .mev_cover_change = mfib_entry_src_rr_cover_change,
108  .mev_cover_update = mfib_entry_src_rr_cover_update,
109  };
110 
112 }
mfib_entry_src_rr_cover_update
static mfib_src_res_t mfib_entry_src_rr_cover_update(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
Definition: mfib_entry_src_rr.c:82
mfib_entry_src_rr_activiate
static void mfib_entry_src_rr_activiate(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
Definition: mfib_entry_src_rr.c:45
mfib_entry_src.h
MFIB_SOURCE_RR
@ MFIB_SOURCE_RR
Definition: mfib_types.h:176
mfib_entry_src_vft_t_::mev_activate
mfib_entry_src_activiate_t mev_activate
Definition: mfib_entry_src.h:164
mfib_entry_t_::mfe_prefix
mfib_prefix_t mfe_prefix
The prefix of the route.
Definition: mfib_entry.h:42
FIB_NODE_INDEX_INVALID
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:30
mfib_entry_src_t_::mfes_route_flags
mfib_entry_flags_t mfes_route_flags
Route flags.
Definition: mfib_entry_src.h:85
mfib_entry_get_index
static fib_node_index_t mfib_entry_get_index(const mfib_entry_t *mfe)
Definition: mfib_entry.h:205
mfib_entry_t_::mfe_fib_index
u32 mfe_fib_index
The index of the FIB table this entry is in.
Definition: mfib_entry.h:47
mfib_entry_src_t_::mfes_pl
fib_node_index_t mfes_pl
The path-list of forwarding interfaces.
Definition: mfib_entry_src.h:102
mfib_table_get_less_specific
fib_node_index_t mfib_table_get_less_specific(u32 fib_index, const mfib_prefix_t *prefix)
Get the less specific (covering) prefix.
Definition: mfib_table.c:129
mfib_entry_src_t_
The source of an MFIB entry.
Definition: mfib_entry_src.h:75
fib_path_list_unlock
void fib_path_list_unlock(fib_node_index_t path_list_index)
Definition: fib_path_list.c:1357
mfib_entry_src_t_::mfes_cover
fib_node_index_t mfes_cover
Definition: mfib_entry_src.h:118
mfib_entry_t_::mfe_itfs
mfib_itf_t * mfe_itfs
A hash table of interfaces.
Definition: mfib_entry.h:87
mfib_entry_get
static mfib_entry_t * mfib_entry_get(fib_node_index_t index)
Definition: mfib_entry.h:200
mfib_entry_src_t_::mfes_exts
mfib_path_ext_t * mfes_exts
Hash table of path extensions.
Definition: mfib_entry_src.h:112
mfib_entry_cover_untrack
void mfib_entry_cover_untrack(mfib_entry_t *cover, u32 tracked_index)
Definition: mfib_entry_cover.c:44
mfib_entry_t_::mfe_flags
mfib_entry_flags_t mfe_flags
Route flags.
Definition: mfib_entry.h:77
mfib_entry_cover_track
u32 mfib_entry_cover_track(mfib_entry_t *cover, fib_node_index_t covered)
Definition: mfib_entry_cover.c:21
mfib_entry_src_t_::mfes_itfs
mfib_itf_t * mfes_itfs
The hash table of all interfaces.
Definition: mfib_entry_src.h:127
mfib_entry_get_best_src
mfib_entry_src_t * mfib_entry_get_best_src(const mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:318
mfib_entry_src_rr_module_init
void mfib_entry_src_rr_module_init(void)
Definition: mfib_entry_src_rr.c:102
mfib_table.h
mfib_src_res_t
enum mfib_src_res_t_ mfib_src_res_t
signals from the sources to the caller
mfib_entry_src_rr_deactiviate
static void mfib_entry_src_rr_deactiviate(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
Definition: mfib_entry_src_rr.c:23
mfib_entry_src_rr_cover_change
static mfib_src_res_t mfib_entry_src_rr_cover_change(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
Definition: mfib_entry_src_rr.c:72
fib_path_list.h
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
mfib_entry_t_
An entry in a FIB table.
Definition: mfib_entry.h:32
mfib_entry_src_vft_t_
Virtual function table provided by each_source.
Definition: mfib_entry_src.h:162
fib_path_list_lock
void fib_path_list_lock(fib_node_index_t path_list_index)
Definition: fib_path_list.c:1344
mfib_entry_src_register
void mfib_entry_src_register(mfib_source_t source, const mfib_entry_src_vft *mvft)
Definition: mfib_entry_src.c:48
mfib_entry_src_t_::mfes_rpf_id
fib_rpf_id_t mfes_rpf_id
RPF-ID.
Definition: mfib_entry_src.h:107
mfib_entry_cover.h
MFIB_SRC_REEVALUATE
@ MFIB_SRC_REEVALUATE
Definition: mfib_entry_src.h:136
mfib_entry_src_t_::mfes_sibling
u32 mfes_sibling
Definition: mfib_entry_src.h:119
mfib_entry_t_::mfe_rpf_id
fib_rpf_id_t mfe_rpf_id
RPF-ID used when the packets ingress not from an interface.
Definition: mfib_entry.h:82