gbp: add anonymous l3-out external interfaces
[vpp.git] / src / plugins / gbp / gbp_ext_itf.h
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 __GBP_EXT_ITF_H__
17 #define __GBP_EXT_ITF_H__
18
19 #include <gbp/gbp.h>
20
21 /**
22  * An external interface maps directly to an oflex L3ExternalInterface.
23  * The special characteristics of an external interface is the way the source
24  * EPG is determined for input packets which, like a recirc interface, is via
25  * a LPM.
26  */
27 typedef struct gpb_ext_itf_t_
28 {
29   /**
30    * The interface
31    */
32   u32 gx_itf;
33
34   /**
35    * The BD this external interface is a member of
36    */
37   index_t gx_bd;
38
39   /**
40    * The RD this external interface is a member of
41    */
42   index_t gx_rd;
43
44   /**
45    * cached FIB indices from the RD
46    */
47   u32 gx_fib_index[DPO_PROTO_NUM];
48
49 } gbp_ext_itf_t;
50
51
52 extern int gbp_ext_itf_add (u32 sw_if_index, u32 bd_id, u32 rd_id);
53 extern int gbp_ext_itf_delete (u32 sw_if_index);
54
55 extern int gbp_ext_itf_anon_add (u32 sw_if_index, u32 bd_id, u32 rd_id);
56 extern int gbp_ext_itf_anon_delete (u32 sw_if_index);
57
58 extern u8 *format_gbp_ext_itf (u8 * s, va_list * args);
59
60 typedef walk_rc_t (*gbp_ext_itf_cb_t) (gbp_ext_itf_t * gbpe, void *ctx);
61 extern void gbp_ext_itf_walk (gbp_ext_itf_cb_t bgpe, void *ctx);
62
63
64 /**
65  * Exposed types for the data-plane
66  */
67 extern gbp_ext_itf_t *gbp_ext_itf_pool;
68 extern index_t *gbp_ext_itf_db;
69
70 always_inline gbp_ext_itf_t *
71 gbp_ext_itf_get (u32 sw_if_index)
72 {
73   return (pool_elt_at_index (gbp_ext_itf_pool, gbp_ext_itf_db[sw_if_index]));
74 }
75
76 #endif
77
78 /*
79  * fd.io coding-style-patch-verification: ON
80  *
81  * Local Variables:
82  * eval: (c-set-style "gnu")
83  * End:
84  */