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