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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef VNET_LISP_GPE_GID_DICTIONARY_H_
17 #define VNET_LISP_GPE_GID_DICTIONARY_H_
19 #include <vnet/vnet.h>
20 #include <vnet/lisp-cp/lisp_types.h>
21 #include <vppinfra/bihash_24_8.h>
22 #include <vppinfra/bihash_template.h>
24 #define GID_LOOKUP_MISS ((u32)~0)
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)
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)
36 BVT(clib_bihash) ip4_lookup_table;
38 /* bitmap/vector of mask widths to search */
39 uword * ip4_non_empty_dst_address_length_bitmap;
40 u8 * ip4_prefix_lengths_in_search_order;
41 ip4_address_t ip4_fib_masks[33];
42 u32 ip4_prefix_len_refcount[33];
44 /* ip4 lookup table config parameters */
45 u32 ip4_lookup_table_nbuckets;
46 uword ip4_lookup_table_size;
48 BVT(clib_bihash) ip6_lookup_table;
50 /* bitmap/vector of mask widths to search */
51 uword * ip6_non_empty_dst_address_length_bitmap;
52 u8 * ip6_prefix_lengths_in_search_order;
53 ip6_address_t ip6_fib_masks[129];
54 u64 ip6_prefix_len_refcount[129];
56 /* ip6 lookup table config parameters */
57 u32 ip6_lookup_table_nbuckets;
58 uword ip6_lookup_table_size;
63 gid_dictionary_add_del (gid_dictionary_t *db, gid_address_t *key, u32 value,
67 gid_dictionary_lookup (gid_dictionary_t * db, gid_address_t *key);
70 gid_dictionary_init (gid_dictionary_t * db);
72 #endif /* VNET_LISP_GPE_GID_DICTIONARY_H_ */