diff options
-rw-r--r-- | include/net/ip_fib.h | 5 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 9 | ||||
-rw-r--r-- | net/ipv4/fib_hash.c | 24 | ||||
-rw-r--r-- | net/ipv4/fib_trie.c | 16 |
4 files changed, 28 insertions, 26 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 025b225181e1..f580542f08ed 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -231,8 +231,9 @@ extern int fib_sync_down(__be32 local, struct net_device *dev, int force); | |||
231 | extern int fib_sync_up(struct net_device *dev); | 231 | extern int fib_sync_up(struct net_device *dev); |
232 | extern __be32 __fib_res_prefsrc(struct fib_result *res); | 232 | extern __be32 __fib_res_prefsrc(struct fib_result *res); |
233 | 233 | ||
234 | /* Exported by fib_hash.c */ | 234 | /* Exported by fib_{hash|trie}.c */ |
235 | extern struct fib_table *fib_hash_init(u32 id); | 235 | extern void fib_hash_init(void); |
236 | extern struct fib_table *fib_hash_table(u32 id); | ||
236 | 237 | ||
237 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) | 238 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) |
238 | { | 239 | { |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 02b5ff73357f..8ddcd3f91a17 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -53,11 +53,11 @@ static int __net_init fib4_rules_init(struct net *net) | |||
53 | { | 53 | { |
54 | struct fib_table *local_table, *main_table; | 54 | struct fib_table *local_table, *main_table; |
55 | 55 | ||
56 | local_table = fib_hash_init(RT_TABLE_LOCAL); | 56 | local_table = fib_hash_table(RT_TABLE_LOCAL); |
57 | if (local_table == NULL) | 57 | if (local_table == NULL) |
58 | return -ENOMEM; | 58 | return -ENOMEM; |
59 | 59 | ||
60 | main_table = fib_hash_init(RT_TABLE_MAIN); | 60 | main_table = fib_hash_table(RT_TABLE_MAIN); |
61 | if (main_table == NULL) | 61 | if (main_table == NULL) |
62 | goto fail; | 62 | goto fail; |
63 | 63 | ||
@@ -83,7 +83,8 @@ struct fib_table *fib_new_table(struct net *net, u32 id) | |||
83 | tb = fib_get_table(net, id); | 83 | tb = fib_get_table(net, id); |
84 | if (tb) | 84 | if (tb) |
85 | return tb; | 85 | return tb; |
86 | tb = fib_hash_init(id); | 86 | |
87 | tb = fib_hash_table(id); | ||
87 | if (!tb) | 88 | if (!tb) |
88 | return NULL; | 89 | return NULL; |
89 | h = id & (FIB_TABLE_HASHSZ - 1); | 90 | h = id & (FIB_TABLE_HASHSZ - 1); |
@@ -1042,6 +1043,8 @@ void __init ip_fib_init(void) | |||
1042 | register_pernet_subsys(&fib_net_ops); | 1043 | register_pernet_subsys(&fib_net_ops); |
1043 | register_netdevice_notifier(&fib_netdev_notifier); | 1044 | register_netdevice_notifier(&fib_netdev_notifier); |
1044 | register_inetaddr_notifier(&fib_inetaddr_notifier); | 1045 | register_inetaddr_notifier(&fib_inetaddr_notifier); |
1046 | |||
1047 | fib_hash_init(); | ||
1045 | } | 1048 | } |
1046 | 1049 | ||
1047 | EXPORT_SYMBOL(inet_addr_type); | 1050 | EXPORT_SYMBOL(inet_addr_type); |
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index 258214f57fba..499522f3b305 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -747,21 +747,19 @@ static int fn_hash_dump(struct fib_table *tb, struct sk_buff *skb, struct netlin | |||
747 | return skb->len; | 747 | return skb->len; |
748 | } | 748 | } |
749 | 749 | ||
750 | struct fib_table *fib_hash_init(u32 id) | 750 | void __init fib_hash_init(void) |
751 | { | 751 | { |
752 | struct fib_table *tb; | 752 | fn_hash_kmem = kmem_cache_create("ip_fib_hash", sizeof(struct fib_node), |
753 | 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); | ||
754 | |||
755 | fn_alias_kmem = kmem_cache_create("ip_fib_alias", sizeof(struct fib_alias), | ||
756 | 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); | ||
757 | |||
758 | } | ||
753 | 759 | ||
754 | if (fn_hash_kmem == NULL) | 760 | struct fib_table *fib_hash_table(u32 id) |
755 | fn_hash_kmem = kmem_cache_create("ip_fib_hash", | 761 | { |
756 | sizeof(struct fib_node), | 762 | struct fib_table *tb; |
757 | 0, SLAB_HWCACHE_ALIGN, | ||
758 | NULL); | ||
759 | |||
760 | if (fn_alias_kmem == NULL) | ||
761 | fn_alias_kmem = kmem_cache_create("ip_fib_alias", | ||
762 | sizeof(struct fib_alias), | ||
763 | 0, SLAB_HWCACHE_ALIGN, | ||
764 | NULL); | ||
765 | 763 | ||
766 | tb = kmalloc(sizeof(struct fib_table) + sizeof(struct fn_hash), | 764 | tb = kmalloc(sizeof(struct fib_table) + sizeof(struct fn_hash), |
767 | GFP_KERNEL); | 765 | GFP_KERNEL); |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index a15cb0d2e113..fbc80d15827b 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1926,19 +1926,19 @@ out: | |||
1926 | return -1; | 1926 | return -1; |
1927 | } | 1927 | } |
1928 | 1928 | ||
1929 | /* Fix more generic FIB names for init later */ | 1929 | void __init fib_hash_init(void) |
1930 | { | ||
1931 | fn_alias_kmem = kmem_cache_create("ip_fib_alias", sizeof(struct fib_alias), | ||
1932 | 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); | ||
1933 | } | ||
1930 | 1934 | ||
1931 | struct fib_table *fib_hash_init(u32 id) | 1935 | |
1936 | /* Fix more generic FIB names for init later */ | ||
1937 | struct fib_table *fib_hash_table(u32 id) | ||
1932 | { | 1938 | { |
1933 | struct fib_table *tb; | 1939 | struct fib_table *tb; |
1934 | struct trie *t; | 1940 | struct trie *t; |
1935 | 1941 | ||
1936 | if (fn_alias_kmem == NULL) | ||
1937 | fn_alias_kmem = kmem_cache_create("ip_fib_alias", | ||
1938 | sizeof(struct fib_alias), | ||
1939 | 0, SLAB_HWCACHE_ALIGN, | ||
1940 | NULL); | ||
1941 | |||
1942 | tb = kmalloc(sizeof(struct fib_table) + sizeof(struct trie), | 1942 | tb = kmalloc(sizeof(struct fib_table) + sizeof(struct trie), |
1943 | GFP_KERNEL); | 1943 | GFP_KERNEL); |
1944 | if (tb == NULL) | 1944 | if (tb == NULL) |