vxlan-gbp: Mark APIs as in-progress
[vpp.git] / src / plugins / lisp / lisp-gpe / lisp_gpe_tenant.h
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 #ifndef __LISP_GPE_TENANT_H__
17 #define __LISP_GPE_TENANT_H__
18
19 #include <lisp/lisp-gpe/lisp_gpe.h>
20
21 /**
22  * Refernece counting lock types on the tenant.
23  * When all of these counters drop to zero, we no longer need the tenant.
24  */
25 typedef enum lisp_gpe_tenant_lock_t_
26 {
27   LISP_GPE_TENANT_LOCK_L2_IFACE,
28   LISP_GPE_TENANT_LOCK_L3_IFACE,
29   LISP_GPE_TENANT_LOCK_NUM,
30 } lisp_gpe_tenant_lock_t;
31
32 /**
33  * @brief Representation of the data associated with a LISP overlay tenant
34  *
35  * This object exists to manage the shared resources of the L2 and L3 interface
36  * of a given tenant.
37  */
38 typedef struct lisp_gpe_tenant_t_
39 {
40   /**
41    * The VNI is the identifier of the tenant
42    */
43   u32 lt_vni;
44
45   /**
46    * The tenant can have both L2 and L3 services enabled.
47    */
48   u32 lt_table_id;
49   u32 lt_bd_id;
50
51   /**
52    * The number of locks on the tenant's L3 interface.
53    */
54   u32 lt_locks[LISP_GPE_TENANT_LOCK_NUM];
55
56   /**
57    * The L3 SW interface index
58    */
59   u32 lt_l3_sw_if_index;
60
61   /**
62    * The L2 SW interface index
63    */
64   u32 lt_l2_sw_if_index;
65
66 } lisp_gpe_tenant_t;
67
68 extern u32 lisp_gpe_tenant_find_or_create (u32 vni);
69
70 extern u32 lisp_gpe_tenant_l3_iface_add_or_lock (u32 vni, u32 vrf,
71                                                  u8 with_default_route);
72 extern void lisp_gpe_tenant_l3_iface_unlock (u32 vni);
73
74 extern u32 lisp_gpe_tenant_l2_iface_add_or_lock (u32 vni, u32 vrf);
75 extern void lisp_gpe_tenant_l2_iface_unlock (u32 vni);
76
77 extern const lisp_gpe_tenant_t *lisp_gpe_tenant_get (u32 index);
78
79 extern void lisp_gpe_tenant_flush (void);
80
81 /*
82  * fd.io coding-style-patch-verification: ON
83  *
84  * Local Variables:
85  * eval: (c-set-style "gnu")
86  * End:
87  */
88
89 #endif