FD.io VPP  v21.06-3-gbb25fbf28
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 #include <plugins/gbp/gbp_itf.h>
21 
22 #include <vnet/fib/fib_types.h>
23 
24 /**
25  * Endpoint Retnetion Policy
26  */
28 {
29  /** Aging timeout for remote endpoints */
32 
33 /**
34  * An Endpoint Group representation
35  */
36 typedef struct gpb_endpoint_group_t_
37 {
38  /**
39  * ID
40  */
42 
43  /**
44  * Sclass. Could be unset => ~0
45  */
47 
48  /**
49  * Bridge-domain ID the EPG is in
50  */
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  */
68 
69  /**
70  * The DPO used in the L3 path for forwarding internal subnets
71  */
73 
74  /**
75  * Locks/references to this EPG
76  */
78 
79  /**
80  * EP retention policy
81  */
84 
85 /**
86  * EPG DB, key'd on EGP-ID
87  */
89 {
92 
94  u16 sclass,
95  u32 bd_id,
96  u32 rd_id,
99  retention);
105 
108  gg, fib_protocol_t fproto);
109 
111  void *ctx);
112 extern void gbp_endpoint_group_walk (gbp_endpoint_group_cb_t bgpe, void *ctx);
113 
114 
115 extern u8 *format_gbp_endpoint_group (u8 * s, va_list * args);
116 
117 /**
118  * DP functions and databases
119  */
122 extern uword *gbp_epg_sclass_db;
123 
126 {
127  uword *p;
128 
130 
131  if (NULL != p)
132  {
134 
136  return (gg->gg_uplink_sw_if_index);
137  }
138  return (~0);
139 }
140 
141 always_inline const dpo_id_t *
143 {
144  uword *p;
145 
147 
148  if (NULL != p)
149  {
151 
153  return (&gg->gg_dpo[fproto]);
154  }
155  return (NULL);
156 }
157 
158 #endif
159 
160 /*
161  * fd.io coding-style-patch-verification: ON
162  *
163  * Local Variables:
164  * eval: (c-set-style "gnu")
165  * End:
166  */
gpb_endpoint_group_t_::gg_uplink_itf
gbp_itf_hdl_t gg_uplink_itf
Definition: gbp_endpoint_group.h:67
gbp_endpoint_group_get_bd_id
u32 gbp_endpoint_group_get_bd_id(const gbp_endpoint_group_t *)
Definition: gbp_endpoint_group.c:218
uplink_sw_if_index
vl_api_interface_index_t uplink_sw_if_index
Definition: gbp.api:190
gpb_endpoint_group_t_::gg_vnid
vnid_t gg_vnid
ID.
Definition: gbp_endpoint_group.h:41
gbp_types.h
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
gpb_endpoint_group_t_::gg_is_ext
u8 gg_is_ext
Is the EPG an external/NAT.
Definition: gbp_endpoint_group.h:61
gbp_itf_hdl_t_
Definition: gbp_itf.h:45
gpb_endpoint_group_t_::gg_gbd
index_t gg_gbd
Bridge-domain ID the EPG is in.
Definition: gbp_endpoint_group.h:51
gpb_endpoint_group_t_::gg_sclass
u16 gg_sclass
Sclass.
Definition: gbp_endpoint_group.h:46
gbp_epg_sclass_db
uword * gbp_epg_sclass_db
Map sclass to EPG.
Definition: gbp_endpoint_group.c:41
gbp_endpoint_group_cb_t
int(* gbp_endpoint_group_cb_t)(gbp_endpoint_group_t *gbpe, void *ctx)
Definition: gbp_endpoint_group.h:110
gbp_endpoint_group_t
struct gpb_endpoint_group_t_ gbp_endpoint_group_t
An Endpoint Group representation.
u16
unsigned short u16
Definition: types.h:57
gpb_endpoint_group_t_::gg_uplink_sw_if_index
u32 gg_uplink_sw_if_index
the uplink interface dedicated to the EPG
Definition: gbp_endpoint_group.h:66
gbp_endpoint_group_lock
void gbp_endpoint_group_lock(index_t index)
Definition: gbp_endpoint_group.c:55
vnid_t
u32 vnid_t
Definition: gbp_types.h:21
bd_id
u32 bd_id
Definition: gbp.api:188
FIB_PROTOCOL_IP_MAX
#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:57
fib_types.h
gbp_endpoint_group_find
index_t gbp_endpoint_group_find(sclass_t sclass)
Definition: gbp_endpoint_group.c:67
index_t
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:43
gbp_endpoint_group_db_t_
EPG DB, key'd on EGP-ID.
Definition: gbp_endpoint_group.h:88
uword
u64 uword
Definition: types.h:112
hash_get
#define hash_get(h, key)
Definition: hash.h:249
gbp_endpoint_group_walk
void gbp_endpoint_group_walk(gbp_endpoint_group_cb_t bgpe, void *ctx)
Definition: gbp_endpoint_group.c:239
gpb_endpoint_group_t_
An Endpoint Group representation.
Definition: gbp_endpoint_group.h:36
format_gbp_endpoint_group
u8 * format_gbp_endpoint_group(u8 *s, va_list *args)
Definition: gbp_endpoint_group.c:329
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
gbp_itf.h
gbp_endpoint_group_pool
gbp_endpoint_group_t * gbp_endpoint_group_pool
Pool of GBP endpoint_groups.
Definition: gbp_endpoint_group.c:31
retention
vl_api_gbp_endpoint_retention_t retention
Definition: gbp.api:191
gpb_endpoint_group_t_::gg_dpo
dpo_id_t gg_dpo[FIB_PROTOCOL_IP_MAX]
The DPO used in the L3 path for forwarding internal subnets.
Definition: gbp_endpoint_group.h:72
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
gbp_endpoint_group_get_fib_index
index_t gbp_endpoint_group_get_fib_index(const gbp_endpoint_group_t *gg, fib_protocol_t fproto)
Definition: gbp_endpoint_group.c:228
sclass
u16 sclass
Definition: gbp.api:131
gbp_endpoint_group_delete
int gbp_endpoint_group_delete(sclass_t sclass)
Definition: gbp_endpoint_group.c:199
gbp_endpoint_group_unlock
void gbp_endpoint_group_unlock(index_t index)
Definition: gbp_endpoint_group.c:164
rd_id
u32 rd_id
Definition: gbp.api:35
index
u32 index
Definition: flow_types.api:221
always_inline
#define always_inline
Definition: rdma_mlx5dv.h:23
gpb_endpoint_group_t_::gg_locks
u32 gg_locks
Locks/references to this EPG.
Definition: gbp_endpoint_group.h:77
sclass_t
u16 sclass_t
Definition: gbp_types.h:25
gbp_epg_itf_lookup_sclass
static u32 gbp_epg_itf_lookup_sclass(sclass_t sclass)
Definition: gbp_endpoint_group.h:125
u32
unsigned int u32
Definition: types.h:88
gpb_endpoint_group_t_::gg_retention
gbp_endpoint_retention_t gg_retention
EP retention policy.
Definition: gbp_endpoint_group.h:82
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
gbp_endpoint_retention_t_
Endpoint Retnetion Policy.
Definition: gbp_endpoint_group.h:27
u8
unsigned char u8
Definition: types.h:56
gpb_endpoint_group_t_::gg_rd
index_t gg_rd
route-domain/IP-table ID the EPG is in
Definition: gbp_endpoint_group.h:56
gbp_endpoint_group_get
gbp_endpoint_group_t * gbp_endpoint_group_get(index_t i)
Definition: gbp_endpoint_group.c:49
gbp_epg_dpo_lookup
static const dpo_id_t * gbp_epg_dpo_lookup(sclass_t sclass, fib_protocol_t fproto)
Definition: gbp_endpoint_group.h:142
gbp_endpoint_group_db
gbp_endpoint_group_db_t gbp_endpoint_group_db
DP functions and databases.
Definition: gbp_endpoint_group.c:36
dpo_id_t_
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:172
gbp_endpoint_retention_t_::remote_ep_timeout
u32 remote_ep_timeout
Aging timeout for remote endpoints.
Definition: gbp_endpoint_group.h:30
gbp_endpoint_group_db_t_::gg_hash_sclass
uword * gg_hash_sclass
Definition: gbp_endpoint_group.h:90
gbp_endpoint_group_add_and_lock
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)
Definition: gbp_endpoint_group.c:80
gbp_endpoint_retention_t
struct gbp_endpoint_retention_t_ gbp_endpoint_retention_t
Endpoint Retnetion Policy.
gbp_endpoint_group_db_t
struct gbp_endpoint_group_db_t_ gbp_endpoint_group_db_t
EPG DB, key'd on EGP-ID.