From 5a59b2bac48611a316adf128bdb0e1e2fe889656 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Mon, 19 Oct 2020 14:47:20 +0000 Subject: ip: Move the IP6 fib into ip6_[m]fib.c Type: improvement reduce the compile time by moving the bihash includes out of ip[46].h Signed-off-by: Neale Ranns Change-Id: I6b9216e10aff1013071f9238b3e1ebbdd205bd80 --- src/vnet/ip/ip6.h | 72 ---------------------------------------------- src/vnet/ip/ip6_forward.c | 46 ----------------------------- src/vnet/ip/ip6_ll_table.c | 3 +- src/vnet/ip/ip_api.c | 2 -- 4 files changed, 1 insertion(+), 122 deletions(-) (limited to 'src/vnet/ip') diff --git a/src/vnet/ip/ip6.h b/src/vnet/ip/ip6.h index ad70b7e98ec..fcb18031a06 100644 --- a/src/vnet/ip/ip6.h +++ b/src/vnet/ip/ip6.h @@ -49,18 +49,9 @@ #include #include #include -#include -#include -#include #include #include -/* - * Default size of the ip6 fib hash table - */ -#define IP6_FIB_DEFAULT_HASH_NUM_BUCKETS (64 * 1024) -#define IP6_FIB_DEFAULT_HASH_MEMORY_SIZE (32<<20) - typedef struct { ip6_address_t addr; @@ -117,67 +108,8 @@ typedef struct uword function_opaque; } ip6_table_bind_callback_t; -/** - * Enumeration of the FIB table instance types - */ -typedef enum ip6_fib_table_instance_type_t_ -{ - /** - * This table stores the routes that are used to forward traffic. - * The key is the prefix, the result the adjacency to forward on. - */ - IP6_FIB_TABLE_FWDING, - /** - * The table that stores ALL routes learned by the DP. - * Some of these routes may not be ready to install in forwarding - * at a given time. - * The key in this table is the prefix, the result is the fib_entry_t - */ - IP6_FIB_TABLE_NON_FWDING, -} ip6_fib_table_instance_type_t; - -#define IP6_FIB_NUM_TABLES (IP6_FIB_TABLE_NON_FWDING+1) - -/** - * A representation of a single IP6 table - */ -typedef struct ip6_fib_table_instance_t_ -{ - /* The hash table */ - clib_bihash_24_8_t ip6_hash; - - /* bitmap / refcounts / vector of mask widths to search */ - uword *non_empty_dst_address_length_bitmap; - u8 *prefix_lengths_in_search_order; - i32 dst_address_length_refcounts[129]; -} ip6_fib_table_instance_t; - -/** - * A representation of a single IP6 mfib table - */ -typedef struct ip6_mfib_table_instance_t_ -{ - /* The hash table */ - clib_bihash_40_8_t ip6_mhash; - - /* bitmap / refcounts / vector of mask widths to search */ - uword *non_empty_dst_address_length_bitmap; - u16 *prefix_lengths_in_search_order; - i32 dst_address_length_refcounts[257]; -} ip6_mfib_table_instance_t; - typedef struct ip6_main_t { - /** - * The two FIB tables; fwding and non-fwding - */ - ip6_fib_table_instance_t ip6_table[IP6_FIB_NUM_TABLES]; - - /** - * the single MFIB table - */ - ip6_mfib_table_instance_t ip6_mtable; - ip_lookup_main_t lookup_main; /* Pool of FIBs. */ @@ -219,10 +151,6 @@ typedef struct ip6_main_t /** Functions to call when interface to table biding changes. */ ip6_table_bind_callback_t *table_bind_callbacks; - /* ip6 lookup table config parameters */ - u32 lookup_table_nbuckets; - uword lookup_table_size; - /* Seed for Jenkins hash used to compute ip6 flow hash. */ u32 flow_hash_seed; diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c index 8c65560c3dd..294f632a6bf 100644 --- a/src/vnet/ip/ip6_forward.c +++ b/src/vnet/ip/ip6_forward.c @@ -2809,24 +2809,6 @@ ip6_lookup_init (vlib_main_t * vm) ip_lookup_init (&im->lookup_main, /* is_ip6 */ 1); - if (im->lookup_table_nbuckets == 0) - im->lookup_table_nbuckets = IP6_FIB_DEFAULT_HASH_NUM_BUCKETS; - - im->lookup_table_nbuckets = 1 << max_log2 (im->lookup_table_nbuckets); - - if (im->lookup_table_size == 0) - im->lookup_table_size = IP6_FIB_DEFAULT_HASH_MEMORY_SIZE; - - clib_bihash_init_24_8 (&(im->ip6_table[IP6_FIB_TABLE_FWDING].ip6_hash), - "ip6 FIB fwding table", - im->lookup_table_nbuckets, im->lookup_table_size); - clib_bihash_init_24_8 (&im->ip6_table[IP6_FIB_TABLE_NON_FWDING].ip6_hash, - "ip6 FIB non-fwding table", - im->lookup_table_nbuckets, im->lookup_table_size); - clib_bihash_init_40_8 (&im->ip6_mtable.ip6_mhash, - "ip6 mFIB table", - im->lookup_table_nbuckets, im->lookup_table_size); - /* Create FIB with index 0 and table id of 0. */ fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, 0, FIB_SOURCE_DEFAULT_ROUTE); @@ -3166,34 +3148,6 @@ VLIB_CLI_COMMAND (set_ip6_classify_command, static) = }; /* *INDENT-ON* */ -static clib_error_t * -ip6_config (vlib_main_t * vm, unformat_input_t * input) -{ - ip6_main_t *im = &ip6_main; - uword heapsize = 0; - u32 tmp; - u32 nbuckets = 0; - - while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) - { - if (unformat (input, "hash-buckets %d", &tmp)) - nbuckets = tmp; - else if (unformat (input, "heap-size %U", - unformat_memory_size, &heapsize)) - ; - else - return clib_error_return (0, "unknown input '%U'", - format_unformat_error, input); - } - - im->lookup_table_nbuckets = nbuckets; - im->lookup_table_size = heapsize; - - return 0; -} - -VLIB_EARLY_CONFIG_FUNCTION (ip6_config, "ip6"); - /* * fd.io coding-style-patch-verification: ON * diff --git a/src/vnet/ip/ip6_ll_table.c b/src/vnet/ip/ip6_ll_table.c index 75489ea08e3..e4010bc43c4 100644 --- a/src/vnet/ip/ip6_ll_table.c +++ b/src/vnet/ip/ip6_ll_table.c @@ -232,7 +232,6 @@ ip6_ll_show_fib (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { count_routes_in_fib_at_prefix_length_arg_t _ca, *ca = &_ca; - ip6_main_t *im6 = &ip6_main; fib_table_t *fib_table; int verbose, matching; ip6_address_t matching_address; @@ -302,7 +301,7 @@ ip6_ll_show_fib (vlib_main_t * vm, if (!verbose) { clib_bihash_24_8_t *h = - &im6->ip6_table[IP6_FIB_TABLE_NON_FWDING].ip6_hash; + &ip6_fib_table[IP6_FIB_TABLE_NON_FWDING].ip6_hash; int len; vlib_cli_output (vm, "%=20s%=16s", "Prefix length", "Count"); diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c index 2f02fa01abf..3f593c6d3ce 100644 --- a/src/vnet/ip/ip_api.c +++ b/src/vnet/ip/ip_api.c @@ -37,8 +37,6 @@ #include #include #include -#include -#include #include #include #include -- cgit 1.2.3-korg