FD.io VPP  v18.07.1-19-g511ce25
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  * An Endpoint Group representation
25  */
26 typedef struct gpb_endpoint_group_t_
27 {
28  /**
29  * ID
30  */
32 
33  /**
34  * Bridge-domain ID the EPG is in
35  */
37 
38  /**
39  * route-domain/IP-table ID the EPG is in
40  */
42 
43  /**
44  * resulting FIB indices
45  */
47 
48  /**
49  * Is the EPG an external/NAT
50  */
52 
53  /**
54  * the uplink interface dedicated to the EPG
55  */
57 
58  /**
59  * The DPO used in the L3 path for forwarding internal subnets
60  */
63 
64 /**
65  * EPG DB, key'd on EGP-ID
66  */
68 {
71 
72 extern int gbp_endpoint_group_add (epg_id_t epg_id,
73  u32 bd_id,
74  u32 ip4_table_id,
75  u32 ip6_table_id, u32 uplink_sw_if_index);
76 extern void gbp_endpoint_group_delete (epg_id_t epg_id);
77 
79  void *ctx);
80 extern void gbp_endpoint_group_walk (gbp_endpoint_group_cb_t bgpe, void *ctx);
81 
83 
84 /**
85  * DP functions and databases
86  */
89 
92 {
93  uword *p;
94 
95  p = hash_get (gbp_endpoint_group_db.gepg_hash, epg);
96 
97  if (NULL != p)
98  {
100 
101  gepg = pool_elt_at_index (gbp_endpoint_group_pool, p[0]);
102  return (gepg->gepg_uplink_sw_if_index);
103  }
104  return (~0);
105 }
106 
107 always_inline const dpo_id_t *
109 {
110  uword *p;
111 
112  p = hash_get (gbp_endpoint_group_db.gepg_hash, epg);
113 
114  if (NULL != p)
115  {
116  gbp_endpoint_group_t *gepg;
117 
118  gepg = pool_elt_at_index (gbp_endpoint_group_pool, p[0]);
119  return (&gepg->gepg_dpo[fproto]);
120  }
121  return (NULL);
122 }
123 
124 #endif
125 
126 /*
127  * fd.io coding-style-patch-verification: ON
128  *
129  * Local Variables:
130  * eval: (c-set-style "gnu")
131  * End:
132  */
EPG DB, key&#39;d on EGP-ID.
void gbp_endpoint_group_walk(gbp_endpoint_group_cb_t bgpe, void *ctx)
#define NULL
Definition: clib.h:55
u32 gepg_bd
Bridge-domain ID the EPG is in.
#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
unsigned char u8
Definition: types.h:56
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static u32 gbp_epg_itf_lookup(epg_id_t epg)
struct gpb_endpoint_group_t_ gbp_endpoint_group_t
An Endpoint Group representation.
u32 gepg_fib_index[FIB_PROTOCOL_IP_MAX]
resulting FIB indices
gbp_endpoint_group_t * gbp_endpoint_group_pool
Pool of GBP endpoint_groups.
#define always_inline
Definition: clib.h:92
u32 epg_id_t
Definition: gbp_types.h:21
unsigned int u32
Definition: types.h:88
void gbp_endpoint_group_delete(epg_id_t epg_id)
int(* gbp_endpoint_group_cb_t)(gbp_endpoint_group_t *gbpe, void *ctx)
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:464
static const dpo_id_t * gbp_epg_dpo_lookup(epg_id_t epg, fib_protocol_t fproto)
gbp_endpoint_group_db_t gbp_endpoint_group_db
DP functions and databases.
An Endpoint Group representation.
dpo_id_t gepg_dpo[FIB_PROTOCOL_IP_MAX]
The DPO used in the L3 path for forwarding internal subnets.
struct gbp_endpoint_group_db_t_ gbp_endpoint_group_db_t
EPG DB, key&#39;d on EGP-ID.
long ctx[MAX_CONNS]
Definition: main.c:126
u32 gepg_uplink_sw_if_index
the uplink interface dedicated to the EPG
u8 gepg_is_ext
Is the EPG an external/NAT.
u64 uword
Definition: types.h:112
gbp_endpoint_group_t * gbp_endpoint_group_find(epg_id_t epg_id)
u32 gepg_rd[FIB_PROTOCOL_IP_MAX]
route-domain/IP-table ID the EPG is in
int gbp_endpoint_group_add(epg_id_t epg_id, u32 bd_id, u32 ip4_table_id, u32 ip6_table_id, u32 uplink_sw_if_index)