FD.io VPP  v20.05.1-6-gf53edbc3b
Vector Packet Processing
fib_entry_src_api.c
Go to the documentation of this file.
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 #include <vnet/fib/fib_entry.h>
17 #include <vnet/fib/fib_entry_src.h>
18 #include <vnet/fib/fib_path_list.h>
19 #include <vnet/fib/fib_path_ext.h>
20 
21 /**
22  * Source initialisation Function
23  */
24 static void
26 {
27 }
28 
29 /**
30  * Source deinitialisation Function
31  */
32 static void
34 {
35 }
36 
37 static void
39  const fib_entry_t *entry,
40  fib_path_list_flags_t pl_flags,
41  const fib_route_path_t *rpaths)
42 {
43  const fib_route_path_t *rpath;
44 
46 
48  rpaths);
49 
50  vec_foreach(rpath, rpaths)
51  {
52  if (NULL != rpath->frp_label_stack)
53  {
55  src->fes_pl,
57  rpath);
58  }
59  }
60 }
61 
62 static void
64  const fib_entry_t *entry,
65  fib_path_list_flags_t pl_flags,
66  const fib_route_path_t *rpaths)
67 {
68  const fib_route_path_t *rpath;
69 
70  if (FIB_NODE_INDEX_INVALID == src->fes_pl)
71  {
72  src->fes_pl =
73  fib_path_list_create((FIB_PATH_LIST_FLAG_SHARED | pl_flags), rpaths);
74  }
75  else
76  {
77  src->fes_pl =
79  (FIB_PATH_LIST_FLAG_SHARED | pl_flags),
80  rpaths);
81  }
82 
83  /*
84  * re-resolve all the path-extensions with the new path-list
85  */
87 
88  /*
89  * if the path has a label we need to add a path extension
90  */
91  vec_foreach(rpath, rpaths)
92  {
93  if (NULL != rpath->frp_label_stack)
94  {
96  src->fes_pl,
98  rpath);
99  }
100  }
101 }
102 
103 static void
105  fib_path_list_flags_t pl_flags,
106  const fib_route_path_t *rpaths)
107 {
108  const fib_route_path_t *rpath;
109 
110  if (FIB_NODE_INDEX_INVALID != src->fes_pl)
111  {
112  src->fes_pl =
114  (FIB_PATH_LIST_FLAG_SHARED | pl_flags),
115  rpaths);
116  /*
117  * remove the path-extension for the path
118  */
119  vec_foreach(rpath, rpaths)
120  {
122  };
123  /*
124  * resolve the remaining extensions
125  */
127  }
128 }
129 
130 static void
132  const fib_entry_t *entry,
135  const dpo_id_t *dpo)
136 {
137  if (FIB_ENTRY_FLAG_NONE != flags)
138  {
140  proto,
142  dpo);
143  }
144 }
145 
146 static void
148 {
150 }
151 
152 const static fib_entry_src_vft_t api_src_vft = {
154  .fesv_deinit = fib_entry_src_api_deinit,
155  .fesv_add = fib_entry_src_api_add,
156  .fesv_remove = fib_entry_src_api_remove,
157  .fesv_path_add = fib_entry_src_api_path_add,
158  .fesv_path_swap = fib_entry_src_api_path_swap,
159  .fesv_path_remove = fib_entry_src_api_path_remove,
160 };
161 
162 void
164 {
166 }
fib_entry_src_init_t fesv_init
An entry in a FIB table.
Definition: fib_entry.h:305
A representation of a path as described by a route producer.
Definition: fib_types.h:490
Virtual function table each FIB entry source will register.
Information related to the source of a FIB entry.
Definition: fib_entry.h:197
An MPLS extension that maintains the path&#39;s outgoing labels,.
Definition: fib_path_ext.h:31
fib_node_index_t fib_path_list_create_special(dpo_proto_t nh_proto, fib_path_list_flags_t flags, const dpo_id_t *dpo)
vl_api_address_t src
Definition: gre.api:54
static void fib_entry_src_api_deinit(fib_entry_src_t *src)
Source deinitialisation Function.
static void fib_entry_src_api_path_add(fib_entry_src_t *src, const fib_entry_t *entry, fib_path_list_flags_t pl_flags, const fib_route_path_t *rpaths)
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
Definition: fib_entry.h:112
static void fib_entry_src_api_remove(fib_entry_src_t *src)
fib_node_index_t fib_path_list_copy_and_path_add(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:170
void fib_path_ext_list_flush(fib_path_ext_list_t *list)
Definition: fib_path_ext.c:448
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
vl_api_ip_proto_t proto
Definition: acl_types.api:50
add paths with [mpls] path extensions
Definition: fib_source.h:203
fib_mpls_label_t * frp_label_stack
The outgoing MPLS label Stack.
Definition: fib_types.h:551
fib_node_index_t fib_path_list_copy_and_path_remove(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
u32 flags
Definition: vhost_user.h:248
fib_path_list_flags_t fib_entry_src_flags_2_path_list_flags(fib_entry_flag_t eflags)
void fib_path_ext_list_remove(fib_path_ext_list_t *list, fib_path_ext_type_t ext_type, const fib_route_path_t *rpath)
Definition: fib_path_ext.c:428
fib_path_ext_t * fib_path_ext_list_push_back(fib_path_ext_list_t *list, fib_node_index_t path_list_index, fib_path_ext_type_t ext_type, const fib_route_path_t *rpath)
Definition: fib_path_ext.c:346
static void fib_entry_src_api_add(fib_entry_src_t *src, const fib_entry_t *entry, fib_entry_flag_t flags, dpo_proto_t proto, const dpo_id_t *dpo)
enum fib_entry_flag_t_ fib_entry_flag_t
fib_node_index_t fes_pl
The path-list created by the source.
Definition: fib_entry.h:206
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:31
static void fib_entry_src_api_path_swap(fib_entry_src_t *src, const fib_entry_t *entry, fib_path_list_flags_t pl_flags, const fib_route_path_t *rpaths)
void fib_path_ext_list_resolve(fib_path_ext_list_t *list, fib_node_index_t path_list_index)
Definition: fib_path_ext.c:416
void fib_entry_src_api_register(void)
static void fib_entry_src_api_init(fib_entry_src_t *src)
Source initialisation Function.
#define vec_foreach(var, vec)
Vector iterator.
fib_path_ext_list_t fes_path_exts
A vector of path extensions.
Definition: fib_entry.h:201
enum fib_path_list_flags_t_ fib_path_list_flags_t
void fib_entry_src_behaviour_register(fib_source_behaviour_t bh, const fib_entry_src_vft_t *vft)
Definition: fib_entry_src.c:61
static void fib_entry_src_api_path_remove(fib_entry_src_t *src, fib_path_list_flags_t pl_flags, const fib_route_path_t *rpaths)
fib_path_ext_t * fib_path_ext_list_insert(fib_path_ext_list_t *list, fib_node_index_t path_list_index, fib_path_ext_type_t ext_type, const fib_route_path_t *rpath)
Definition: fib_path_ext.c:372