FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
mfib_entry_src.h
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 #ifndef __MFIB_ENTRY_SRC_H__
17 #define __MFIB_ENTRY_SRC_H__
18 
19 #include <vnet/mfib/mfib_entry.h>
20 
21 /**
22  * MFIB extensions to each path
23  */
24 typedef struct mfib_path_ext_t_
25 {
29 
30 /**
31  * Flags for the source data
32  */
34  /**
35  * Marker. Add new values after this one.
36  */
38  /**
39  * the source has been added to the entry
40  */
42  /**
43  * Marker. add new entries before this one.
44  */
47 
48 
49 #define MFIB_ENTRY_SRC_ATTRIBUTES { \
50  [MFIB_ENTRY_SRC_ATTRIBUTE_STALE] = "stale", \
51 }
52 
53 #define FOR_EACH_MFIB_SRC_ATTRIBUTE(_item) \
54  for (_item = MFIB_ENTRY_SRC_ATTRIBUTE_FIRST; \
55  _item <= MFIB_ENTRY_SRC_ATTRIBUTE_LAST; \
56  _item++)
57 
58 typedef enum mfib_entry_src_flag_t_ {
61 } __attribute__ ((packed)) mfib_entry_src_flags_t;
62 
63 extern u8 * format_mfib_entry_src_flags(u8 *s, va_list *args);
64 
65 /*
66  * Keep the size of the flags field to 2 bytes, so it
67  * can be placed next to the 2 bytes reference count
68  */
70  "FIB entry flags field size too big");
71 
72 /**
73  * The source of an MFIB entry
74  */
75 typedef struct mfib_entry_src_t_
76 {
77  /**
78  * Which source this is
79  */
81 
82  /**
83  * Route flags
84  */
86 
87  /**
88  * Source flags
89  */
91 
92  /**
93  * The reference count on the entry. this is a u32
94  * since there is no path-list sharing in mfib, so the number
95  * os children could be high.
96  */
98 
99  /**
100  * The path-list of forwarding interfaces
101  */
103 
104  /**
105  * RPF-ID
106  */
108 
109  /**
110  * Hash table of path extensions
111  */
113 
114  /**
115  * Covering entry (if needed)
116  */
117  struct {
120  };
121 
122  /**
123  * The hash table of all interfaces.
124  * This is forwarding time information derived from the paths
125  * and their extensions.
126  */
129 
130 /**
131  * signals from the sources to the caller
132  */
133 typedef enum mfib_src_res_t_
134 {
138 
139 /**
140  * A function provided by each source to be invoked when it is activated
141  */
143 
144 /**
145  * A function provided by each source to be invoked when it is deactivated
146  */
148 
149 /**
150  * A function provided by each source to be invoked when the cover changes
151  */
153 
154 /**
155  * A function provided by each source to be invoked when the cover is updated
156  */
158 
159 /**
160  * Virtual function table provided by each_source
161  */
162 typedef struct mfib_entry_src_vft_t_
163 {
169 
171 
172 extern void mfib_entry_src_deactivate(mfib_entry_t *mfib_entry,
173  mfib_entry_src_t *bsrc);
174 
175 extern void mfib_entry_src_activate(mfib_entry_t *mfib_entry,
176  mfib_entry_src_t *bsrc);
177 
179  mfib_entry_src_t *bsrc);
180 
182  mfib_entry_src_t *bsrc);
183 
184 extern mfib_entry_src_t* mfib_entry_get_best_src(const mfib_entry_t *mfib_entry);
185 
186 extern void mfib_entry_src_module_init(void);
187 extern void mfib_entry_src_rr_module_init(void);
188 
189 #endif
MFIB_SRC_OK
@ MFIB_SRC_OK
Definition: mfib_entry_src.h:135
format_mfib_entry_src_flags
u8 * format_mfib_entry_src_flags(u8 *s, va_list *args)
Definition: mfib_entry.c:106
mfib_entry_src_flags_t
enum mfib_entry_src_flag_t_ mfib_entry_src_flags_t
mfib_path_ext_t_::mfpe_path
fib_node_index_t mfpe_path
Definition: mfib_entry_src.h:27
MFIB_ENTRY_SRC_FLAG_NONE
@ MFIB_ENTRY_SRC_FLAG_NONE
Definition: mfib_entry_src.h:59
mfib_path_ext_t
struct mfib_path_ext_t_ mfib_path_ext_t
MFIB extensions to each path.
mfib_entry_src_vft_t_::mev_activate
mfib_entry_src_activiate_t mev_activate
Definition: mfib_entry_src.h:164
mfib_entry.h
mfib_entry_src_t_::mfes_route_flags
mfib_entry_flags_t mfes_route_flags
Route flags.
Definition: mfib_entry_src.h:85
mfib_path_ext_t_::mfpe_flags
mfib_itf_flags_t mfpe_flags
Definition: mfib_entry_src.h:26
mfib_entry_src_flag_t_
mfib_entry_src_flag_t_
Definition: mfib_entry_src.h:58
mfib_entry_flags_t
enum mfib_entry_flags_t_ mfib_entry_flags_t
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_entry_src_cover_change_t
mfib_src_res_t(* mfib_entry_src_cover_change_t)(mfib_entry_t *, mfib_entry_src_t *)
A function provided by each source to be invoked when the cover changes.
Definition: mfib_entry_src.h:152
mfib_entry_src_t
struct mfib_entry_src_t_ mfib_entry_src_t
The source of an MFIB entry.
mfib_entry_src_cover_update
mfib_src_res_t mfib_entry_src_cover_update(mfib_entry_t *mfib_entry, mfib_entry_src_t *bsrc)
Definition: mfib_entry_src.c:78
MFIB_ENTRY_SRC_ATTRIBUTE_FIRST
@ MFIB_ENTRY_SRC_ATTRIBUTE_FIRST
Marker.
Definition: mfib_entry_src.h:37
mfib_entry_src_t_
The source of an MFIB entry.
Definition: mfib_entry_src.h:75
mfib_entry_src_t_::mfes_flags
mfib_entry_src_flags_t mfes_flags
Source flags.
Definition: mfib_entry_src.h:90
mfib_entry_src_t_::mfes_cover
fib_node_index_t mfes_cover
Definition: mfib_entry_src.h:118
mfib_entry_src_vft_t_::mev_cover_change
mfib_entry_src_cover_change_t mev_cover_change
Definition: mfib_entry_src.h:166
mfib_source_t
enum mfib_source_t_ mfib_source_t
Possible [control plane] sources of MFIB entries.
fib_rpf_id_t
u32 fib_rpf_id_t
An RPF-ID is numerical value that is used RPF validate.
Definition: fib_types.h:421
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_get_best_src
mfib_entry_src_t * mfib_entry_get_best_src(const mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:318
STATIC_ASSERT
STATIC_ASSERT(sizeof(mfib_entry_src_flags_t)<=2, "FIB entry flags field size too big")
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
mfib_entry_src_t_::mfes_ref_count
u32 mfes_ref_count
The reference count on the entry.
Definition: mfib_entry_src.h:97
mfib_entry_src_t_::mfes_itfs
mfib_itf_t * mfes_itfs
The hash table of all interfaces.
Definition: mfib_entry_src.h:127
mfib_itf_flags_t
enum mfib_itf_flags_t_ mfib_itf_flags_t
mfib_entry_src_attribute_t
enum mfib_entry_src_attribute_t_ mfib_entry_src_attribute_t
Flags for the source data.
mfib_src_res_t
enum mfib_src_res_t_ mfib_src_res_t
signals from the sources to the caller
mfib_entry_src_rr_module_init
void mfib_entry_src_rr_module_init(void)
Definition: mfib_entry_src_rr.c:102
mfib_entry_src_activate
void mfib_entry_src_activate(mfib_entry_t *mfib_entry, mfib_entry_src_t *bsrc)
Definition: mfib_entry_src.c:63
mfib_entry_src_cover_update_t
mfib_src_res_t(* mfib_entry_src_cover_update_t)(mfib_entry_t *, mfib_entry_src_t *)
A function provided by each source to be invoked when the cover is updated.
Definition: mfib_entry_src.h:157
mfib_entry_src_cover_change
mfib_src_res_t mfib_entry_src_cover_change(mfib_entry_t *mfib_entry, mfib_entry_src_t *bsrc)
Definition: mfib_entry_src.c:71
mfib_entry_src_t_::mfes_src
mfib_source_t mfes_src
Which source this is.
Definition: mfib_entry_src.h:80
mfib_entry_src_vft_t_::mev_deactivate
mfib_entry_src_deactiviate_t mev_deactivate
Definition: mfib_entry_src.h:165
u32
unsigned int u32
Definition: types.h:88
MFIB_ENTRY_SRC_FLAG_STALE
@ MFIB_ENTRY_SRC_FLAG_STALE
Definition: mfib_entry_src.h:60
MFIB_ENTRY_SRC_ATTRIBUTE_STALE
@ MFIB_ENTRY_SRC_ATTRIBUTE_STALE
the source has been added to the entry
Definition: mfib_entry_src.h:41
mfib_path_ext_t_
MFIB extensions to each path.
Definition: mfib_entry_src.h:24
mfib_entry_t_
An entry in a FIB table.
Definition: mfib_entry.h:32
mfib_entry_src_vft_t_::mev_cover_update
mfib_entry_src_cover_update_t mev_cover_update
Definition: mfib_entry_src.h:167
mfib_entry_src_deactivate
void mfib_entry_src_deactivate(mfib_entry_t *mfib_entry, mfib_entry_src_t *bsrc)
Definition: mfib_entry_src.c:55
mfib_entry_src_vft_t_
Virtual function table provided by each_source.
Definition: mfib_entry_src.h:162
mfib_itf_t_
An interface associated with a particular MFIB entry.
Definition: mfib_itf.h:25
mfib_entry_src_module_init
void mfib_entry_src_module_init(void)
Definition: mfib_entry_src.c:85
u8
unsigned char u8
Definition: types.h:56
mfib_entry_src_register
void mfib_entry_src_register(mfib_source_t, const mfib_entry_src_vft *)
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_SRC_ATTRIBUTE_LAST
@ MFIB_ENTRY_SRC_ATTRIBUTE_LAST
Marker.
Definition: mfib_entry_src.h:45
MFIB_SRC_REEVALUATE
@ MFIB_SRC_REEVALUATE
Definition: mfib_entry_src.h:136
mfib_entry_src_attribute_t_
mfib_entry_src_attribute_t_
Flags for the source data.
Definition: mfib_entry_src.h:33
mfib_src_res_t_
mfib_src_res_t_
signals from the sources to the caller
Definition: mfib_entry_src.h:133
mfib_entry_src_t_::mfes_sibling
u32 mfes_sibling
Definition: mfib_entry_src.h:119
mfib_entry_src_deactiviate_t
void(* mfib_entry_src_deactiviate_t)(mfib_entry_t *, mfib_entry_src_t *)
A function provided by each source to be invoked when it is deactivated.
Definition: mfib_entry_src.h:147
mfib_entry_src_activiate_t
void(* mfib_entry_src_activiate_t)(mfib_entry_t *, mfib_entry_src_t *)
A function provided by each source to be invoked when it is activated.
Definition: mfib_entry_src.h:142
mfib_entry_src_vft
struct mfib_entry_src_vft_t_ mfib_entry_src_vft
Virtual function table provided by each_source.