FD.io VPP  v17.01.1-3-gc6833f8
Vector Packet Processing
gid_dictionary.h
Go to the documentation of this file.
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 VNET_LISP_GPE_GID_DICTIONARY_H_
17 #define VNET_LISP_GPE_GID_DICTIONARY_H_
18 
19 #include <vnet/vnet.h>
21 #include <vppinfra/bihash_24_8.h>
23 
24 #define GID_LOOKUP_MISS ((u32)~0)
25 
26 /* Default size of the ip4 hash table */
27 #define IP4_LOOKUP_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
28 #define IP4_LOOKUP_DEFAULT_HASH_MEMORY_SIZE (32<<20)
29 
30 /* Default size of the ip6 hash table */
31 #define IP6_LOOKUP_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
32 #define IP6_LOOKUP_DEFAULT_HASH_MEMORY_SIZE (32<<20)
33 
34 /* Default size of the MAC hash table */
35 #define MAC_LOOKUP_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
36 #define MAC_LOOKUP_DEFAULT_HASH_MEMORY_SIZE (32<<20)
37 
38 typedef void (*foreach_subprefix_match_cb_t) (u32, void *);
39 
40 typedef struct
41 {
42  BVT (clib_bihash) ip4_lookup_table;
43 
44  /* bitmap/vector of mask widths to search */
47  ip4_address_t ip4_fib_masks[33];
48  u32 ip4_prefix_len_refcount[33];
49 
50  /* ip4 lookup table config parameters */
54 
55 typedef struct
56 {
57  BVT (clib_bihash) ip6_lookup_table;
58 
59  /* bitmap/vector of mask widths to search */
62  ip6_address_t ip6_fib_masks[129];
63  u64 ip6_prefix_len_refcount[129];
64 
65  /* ip6 lookup table config parameters */
69 
70 typedef struct gid_mac_table
71 {
72  BVT (clib_bihash) mac_lookup_table;
73 
74  /* mac lookup table config parameters */
78 
79 typedef struct
80 {
81  /** destination IP LPM ip4 lookup table */
83 
84  /** pool of source IP LPM ip4 lookup tables */
86 
87  /** destination IP LPM ip6 lookup table */
89 
90  /** pool of source IP LPM ip6 lookup tables */
92 
93  /** flat source/dest mac lookup table */
95 
97 
98 u32
100  u8 is_add);
101 
104  gid_address_t * src);
105 
107 
108 void
110  foreach_subprefix_match_cb_t cb, void *arg);
111 
112 #endif /* VNET_LISP_GPE_GID_DICTIONARY_H_ */
113 
114 /*
115  * fd.io coding-style-patch-verification: ON
116  *
117  * Local Variables:
118  * eval: (c-set-style "gnu")
119  * End:
120  */
gid_ip4_table_t * src_ip4_table_pool
pool of source IP LPM ip4 lookup tables
struct gid_mac_table gid_mac_table_t
void gid_dictionary_init(gid_dictionary_t *db)
u32 mac_lookup_table_nbuckets
gid_ip4_table_t dst_ip4_table
destination IP LPM ip4 lookup table
static BVT(clib_bihash)
Definition: adj_nbr.c:26
unsigned long u64
Definition: types.h:89
u32 gid_dictionary_lookup(gid_dictionary_t *db, gid_address_t *key)
u32 gid_dictionary_add_del(gid_dictionary_t *db, gid_address_t *key, u32 value, u8 is_add)
BVT(clib_bihash) mac_lookup_table
gid_ip6_table_t * src_ip6_table_pool
pool of source IP LPM ip6 lookup tables
gid_ip6_table_t dst_ip6_table
destination IP LPM ip6 lookup table
u32 ip4_lookup_table_nbuckets
u32 ip6_lookup_table_nbuckets
u8 * ip6_prefix_lengths_in_search_order
uword ip6_lookup_table_size
u8 * ip4_prefix_lengths_in_search_order
void(* foreach_subprefix_match_cb_t)(u32, void *)
u32 gid_dictionary_sd_lookup(gid_dictionary_t *db, gid_address_t *dst, gid_address_t *src)
struct _gid_address_t gid_address_t
unsigned int u32
Definition: types.h:88
u64 uword
Definition: types.h:112
uword mac_lookup_table_size
uword ip4_lookup_table_size
gid_mac_table_t sd_mac_table
flat source/dest mac lookup table
uword * ip4_non_empty_dst_address_length_bitmap
unsigned char u8
Definition: types.h:56
void gid_dict_foreach_subprefix(gid_dictionary_t *db, gid_address_t *eid, foreach_subprefix_match_cb_t cb, void *arg)
uword * ip6_non_empty_dst_address_length_bitmap