FD.io VPP  v21.10.1-2-g0a485f517
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 #define GID_LOOKUP_MISS_L2 ((u64)~0)
26 
27 /* Default size of the ip4 hash table */
28 #define IP4_LOOKUP_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
29 #define IP4_LOOKUP_DEFAULT_HASH_MEMORY_SIZE (32<<20)
30 
31 /* Default size of the ip6 hash table */
32 #define IP6_LOOKUP_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
33 #define IP6_LOOKUP_DEFAULT_HASH_MEMORY_SIZE (32<<20)
34 
35 /* Default size of the MAC hash table */
36 #define MAC_LOOKUP_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
37 #define MAC_LOOKUP_DEFAULT_HASH_MEMORY_SIZE (32<<20)
38 
39 /* Default size of the ARP/NDP hash table */
40 #define ARP_NDP_LOOKUP_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
41 #define ARP_NDP_LOOKUP_DEFAULT_HASH_MEMORY_SIZE (32<<20)
42 
43 /* Default size of the NSH hash table */
44 #define NSH_LOOKUP_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
45 #define NSH_LOOKUP_DEFAULT_HASH_MEMORY_SIZE (32<<20)
46 
47 typedef void (*foreach_subprefix_match_cb_t) (u32, void *);
48 
49 typedef struct
50 {
51  BVT (clib_bihash) ip4_lookup_table;
52 
53  /* bitmap/vector of mask widths to search */
56  ip4_address_t ip4_fib_masks[33];
57  u32 ip4_prefix_len_refcount[33];
58 
59  /* ip4 lookup table config parameters */
64 
65 typedef struct
66 {
67  BVT (clib_bihash) ip6_lookup_table;
68 
69  /* bitmap/vector of mask widths to search */
72  ip6_address_t ip6_fib_masks[129];
73  u64 ip6_prefix_len_refcount[129];
74 
75  /* ip6 lookup table config parameters */
80 
81 typedef struct gid_mac_table
82 {
83  BVT (clib_bihash) mac_lookup_table;
84 
85  /* mac lookup table config parameters */
90 
91 typedef struct gid_nsh_table
92 {
93  BVT (clib_bihash) nsh_lookup_table;
94 
95  /* nsh lookup table config parameters */
100 
101 typedef struct
102 {
103  BVT (clib_bihash) arp_ndp_lookup_table;
108 
109 typedef struct
110 {
111  /** L2 ARP/NDP table */
113 
114  /** NSH lookup table */
116 
117  /** destination IP LPM ip4 lookup table */
119 
120  /** pool of source IP LPM ip4 lookup tables */
122 
123  /** destination IP LPM ip6 lookup table */
125 
126  /** pool of source IP LPM ip6 lookup tables */
128 
129  /** flat source/dest mac lookup table */
131 
133 
134 u32
136  u8 is_add);
137 
140  gid_address_t * src);
141 
143 
144 void
146  foreach_subprefix_match_cb_t cb, void *arg);
147 
148 void
151  cb, void *ht);
152 
153 #endif /* VNET_LISP_GPE_GID_DICTIONARY_H_ */
154 
155 /*
156  * fd.io coding-style-patch-verification: ON
157  *
158  * Local Variables:
159  * eval: (c-set-style "gnu")
160  * End:
161  */
lisp_types.h
bihash_24_8.h
gid_ip4_table_t::ip4_lookup_table_size
uword ip4_lookup_table_size
Definition: gid_dictionary.h:61
gid_mac_table_t
struct gid_mac_table gid_mac_table_t
bihash_template.h
gid_mac_table::mac_lookup_table_nbuckets
u32 mac_lookup_table_nbuckets
Definition: gid_dictionary.h:86
gid_dictionary_init
void gid_dictionary_init(gid_dictionary_t *db)
Definition: gid_dictionary.c:1062
gid_dictionary_add_del
u32 gid_dictionary_add_del(gid_dictionary_t *db, gid_address_t *key, u64 value, u8 is_add)
Definition: gid_dictionary.c:978
gid_ip4_table_t
Definition: gid_dictionary.h:49
gid_dictionary_t::src_ip4_table_pool
gid_ip4_table_t * src_ip4_table_pool
pool of source IP LPM ip4 lookup tables
Definition: gid_dictionary.h:121
gid_nsh_table::nsh_lookup_table_nbuckets
u32 nsh_lookup_table_nbuckets
Definition: gid_dictionary.h:96
gid_ip4_table_t::ip4_lookup_table_nbuckets
u32 ip4_lookup_table_nbuckets
Definition: gid_dictionary.h:60
gid_dictionary_t::dst_ip6_table
gid_ip6_table_t dst_ip6_table
destination IP LPM ip6 lookup table
Definition: gid_dictionary.h:124
eid
typedef eid
Definition: lisp_types.api:59
key
typedef key
Definition: ipsec_types.api:91
gid_dict_foreach_l2_arp_ndp_entry
void gid_dict_foreach_l2_arp_ndp_entry(gid_dictionary_t *db, cb, void *ht)
Definition: gid_dictionary.c:144
foreach_subprefix_match_cb_t
void(* foreach_subprefix_match_cb_t)(u32, void *)
Definition: gid_dictionary.h:47
gid_mac_table
Definition: gid_dictionary.h:81
gid_ip6_table_t::ip6_non_empty_dst_address_length_bitmap
uword * ip6_non_empty_dst_address_length_bitmap
Definition: gid_dictionary.h:70
gid_dictionary_sd_lookup
u32 gid_dictionary_sd_lookup(gid_dictionary_t *db, gid_address_t *dst, gid_address_t *src)
Definition: gid_dictionary.c:443
gid_dictionary_lookup
u64 gid_dictionary_lookup(gid_dictionary_t *db, gid_address_t *key)
Definition: gid_dictionary.c:399
gid_ip4_table_t::count
u32 count
Definition: gid_dictionary.h:62
gid_nsh_table
Definition: gid_dictionary.h:91
uword
u64 uword
Definition: types.h:112
BVT
BVT(clib_bihash)
The table of adjacencies indexed by the rewrite string.
Definition: l2_fib.c:1065
gid_l2_arp_ndp_table_t::arp_ndp_lookup_table_nbuckets
u32 arp_ndp_lookup_table_nbuckets
Definition: gid_dictionary.h:104
src
vl_api_address_t src
Definition: gre.api:54
ip4_address_t
Definition: ip4_packet.h:50
gid_dictionary_t::nsh_table
gid_nsh_table_t nsh_table
NSH lookup table.
Definition: gid_dictionary.h:115
gid_dictionary_t::src_ip6_table_pool
gid_ip6_table_t * src_ip6_table_pool
pool of source IP LPM ip6 lookup tables
Definition: gid_dictionary.h:127
gid_mac_table::BVT
BVT(clib_bihash) mac_lookup_table
gid_ip4_table_t::ip4_prefix_lengths_in_search_order
u8 * ip4_prefix_lengths_in_search_order
Definition: gid_dictionary.h:55
gid_mac_table::mac_lookup_table_size
uword mac_lookup_table_size
Definition: gid_dictionary.h:87
gid_nsh_table::count
u64 count
Definition: gid_dictionary.h:98
u64
unsigned long u64
Definition: types.h:89
gid_ip4_table_t::ip4_non_empty_dst_address_length_bitmap
uword * ip4_non_empty_dst_address_length_bitmap
Definition: gid_dictionary.h:54
u32
unsigned int u32
Definition: types.h:88
gid_nsh_table::nsh_lookup_table_size
uword nsh_lookup_table_size
Definition: gid_dictionary.h:97
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
gid_dictionary_t::arp_ndp_table
gid_l2_arp_ndp_table_t arp_ndp_table
L2 ARP/NDP table.
Definition: gid_dictionary.h:112
gid_ip6_table_t::count
u64 count
Definition: gid_dictionary.h:78
value
u8 value
Definition: qos.api:54
gid_ip6_table_t::ip6_lookup_table_nbuckets
u32 ip6_lookup_table_nbuckets
Definition: gid_dictionary.h:76
gid_l2_arp_ndp_table_t
Definition: gid_dictionary.h:101
gid_dict_foreach_subprefix
void gid_dict_foreach_subprefix(gid_dictionary_t *db, gid_address_t *eid, foreach_subprefix_match_cb_t cb, void *arg)
Definition: gid_dictionary.c:126
gid_ip6_table_t::ip6_lookup_table_size
uword ip6_lookup_table_size
Definition: gid_dictionary.h:77
gid_l2_arp_ndp_table_t::count
u64 count
Definition: gid_dictionary.h:106
u8
unsigned char u8
Definition: types.h:56
gid_mac_table::count
u64 count
Definition: gid_dictionary.h:88
gid_ip6_table_t::ip6_prefix_lengths_in_search_order
u8 * ip6_prefix_lengths_in_search_order
Definition: gid_dictionary.h:71
gid_nsh_table_t
struct gid_nsh_table gid_nsh_table_t
gid_dictionary_t
Definition: gid_dictionary.h:109
gid_address_t
struct _gid_address_t gid_address_t
gid_l2_arp_ndp_table_t::arp_ndp_lookup_table_size
uword arp_ndp_lookup_table_size
Definition: gid_dictionary.h:105
clib_bihash_foreach_key_value_pair_cb
int(* clib_bihash_foreach_key_value_pair_cb)(clib_bihash_kv *kv, void *ctx)
Definition: bihash_doc.h:175
gid_dictionary_t::sd_mac_table
gid_mac_table_t sd_mac_table
flat source/dest mac lookup table
Definition: gid_dictionary.h:130
vnet.h
gid_ip6_table_t
Definition: gid_dictionary.h:65
gid_dictionary_t::dst_ip4_table
gid_ip4_table_t dst_ip4_table
destination IP LPM ip4 lookup table
Definition: gid_dictionary.h:118
gid_nsh_table::BVT
BVT(clib_bihash) nsh_lookup_table