FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
gbp_endpoint_group.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 __GBP_ENDPOINT_GROUP_H__
17 #define __GBP_ENDPOINT_GROUP_H__
18 
19 #include <plugins/gbp/gbp_types.h>
20 
21 #include <vnet/fib/fib_types.h>
22 
23 /**
24  * Endpoint Retnetion Policy
25  */
27 {
28  /** Aging timeout for remote endpoints */
31 
32 /**
33  * An Endpoint Group representation
34  */
35 typedef struct gpb_endpoint_group_t_
36 {
37  /**
38  * ID
39  */
41 
42  /**
43  * Sclass. Could be unset => ~0
44  */
46 
47  /**
48  * Bridge-domain ID the EPG is in
49  */
52 
53  /**
54  * route-domain/IP-table ID the EPG is in
55  */
57 
58  /**
59  * Is the EPG an external/NAT
60  */
62 
63  /**
64  * the uplink interface dedicated to the EPG
65  */
67 
68  /**
69  * The DPO used in the L3 path for forwarding internal subnets
70  */
72 
73  /**
74  * Locks/references to this EPG
75  */
77 
78  /**
79  * EP retention policy
80  */
83 
84 /**
85  * EPG DB, key'd on EGP-ID
86  */
88 {
91 
93  u16 sclass,
94  u32 bd_id,
95  u32 rd_id,
96  u32 uplink_sw_if_index,
98  retention);
101 extern void gbp_endpoint_group_unlock (index_t index);
102 extern void gbp_endpoint_group_lock (index_t index);
104 
107  gg, fib_protocol_t fproto);
108 
110  void *ctx);
111 extern void gbp_endpoint_group_walk (gbp_endpoint_group_cb_t bgpe, void *ctx);
112 
113 
114 extern u8 *format_gbp_endpoint_group (u8 * s, va_list * args);
115 
116 /**
117  * DP functions and databases
118  */
121 extern uword *gbp_epg_sclass_db;
122 
125 {
126  uword *p;
127 
128  p = hash_get (gbp_endpoint_group_db.gg_hash_sclass, sclass);
129 
130  if (NULL != p)
131  {
133 
134  gg = pool_elt_at_index (gbp_endpoint_group_pool, p[0]);
135  return (gg->gg_uplink_sw_if_index);
136  }
137  return (~0);
138 }
139 
140 always_inline const dpo_id_t *
142 {
143  uword *p;
144 
145  p = hash_get (gbp_endpoint_group_db.gg_hash_sclass, sclass);
146 
147  if (NULL != p)
148  {
150 
151  gg = pool_elt_at_index (gbp_endpoint_group_pool, p[0]);
152  return (&gg->gg_dpo[fproto]);
153  }
154  return (NULL);
155 }
156 
157 #endif
158 
159 /*
160  * fd.io coding-style-patch-verification: ON
161  *
162  * Local Variables:
163  * eval: (c-set-style "gnu")
164  * End:
165  */
EPG DB, key&#39;d on EGP-ID.
u16 sclass_t
Definition: gbp_types.h:24
void gbp_endpoint_group_walk(gbp_endpoint_group_cb_t bgpe, void *ctx)
#define NULL
Definition: clib.h:58
#define FIB_PROTOCOL_IP_MAX
Definition outside of enum so it does not need to be included in non-defaulted switch statements...
Definition: fib_types.h:58
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:41
int i
u32 rd_id
Definition: gbp.api:270
index_t gg_rd
route-domain/IP-table ID the EPG is in
Endpoint Retnetion Policy.
int gbp_endpoint_group_add_and_lock(vnid_t vnid, u16 sclass, u32 bd_id, u32 rd_id, u32 uplink_sw_if_index, const gbp_endpoint_retention_t *retention)
unsigned char u8
Definition: types.h:56
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
struct gbp_endpoint_retention_t_ gbp_endpoint_retention_t
Endpoint Retnetion Policy.
struct gpb_endpoint_group_t_ gbp_endpoint_group_t
An Endpoint Group representation.
index_t gbp_endpoint_group_find(sclass_t sclass)
gbp_endpoint_group_t * gbp_endpoint_group_pool
Pool of GBP endpoint_groups.
u8 gg_is_ext
Is the EPG an external/NAT.
#define always_inline
Definition: clib.h:98
unsigned int u32
Definition: types.h:88
static const dpo_id_t * gbp_epg_dpo_lookup(sclass_t sclass, fib_protocol_t fproto)
int(* gbp_endpoint_group_cb_t)(gbp_endpoint_group_t *gbpe, void *ctx)
u8 * format_gbp_endpoint_group(u8 *s, va_list *args)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:168
#define hash_get(h, key)
Definition: hash.h:249
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:514
long ctx[MAX_CONNS]
Definition: main.c:144
u32 bd_id
Definition: gbp.api:269
unsigned short u16
Definition: types.h:57
u16 sclass
Definition: gbp.api:118
gbp_endpoint_group_db_t gbp_endpoint_group_db
DP functions and databases.
u32 remote_ep_timeout
Aging timeout for remote endpoints.
An Endpoint Group representation.
gbp_endpoint_group_t * gbp_endpoint_group_get(index_t i)
u32 gbp_endpoint_group_get_bd_id(const gbp_endpoint_group_t *)
static u32 gbp_epg_itf_lookup_sclass(sclass_t sclass)
u32 gg_locks
Locks/references to this EPG.
u32 vnid_t
Definition: gbp_types.h:21
struct gbp_endpoint_group_db_t_ gbp_endpoint_group_db_t
EPG DB, key&#39;d on EGP-ID.
index_t gbp_endpoint_group_get_fib_index(const gbp_endpoint_group_t *gg, fib_protocol_t fproto)
dpo_id_t gg_dpo[FIB_PROTOCOL_IP_MAX]
The DPO used in the L3 path for forwarding internal subnets.
gbp_endpoint_retention_t gg_retention
EP retention policy.
int gbp_endpoint_group_delete(sclass_t sclass)
void gbp_endpoint_group_unlock(index_t index)
void gbp_endpoint_group_lock(index_t index)
uword * gbp_epg_sclass_db
Map sclass to EPG.
u32 gg_uplink_sw_if_index
the uplink interface dedicated to the EPG
u64 uword
Definition: types.h:112
index_t gg_gbd
Bridge-domain ID the EPG is in.