diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-01-15 08:14:20 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-29 00:02:15 +0100 |
commit | 7f9b80529b8a2ad8b3273b15fb444a0e34b760a9 (patch) | |
tree | ba6e38934797952a472970ee97d2131a6a6f29bb /net/ipv4/fib_hash.c | |
parent | [IPV4] fib_trie: size and statistics (diff) | |
download | linux-7f9b80529b8a2ad8b3273b15fb444a0e34b760a9.tar.xz linux-7f9b80529b8a2ad8b3273b15fb444a0e34b760a9.zip |
[IPV4]: fib hash|trie initialization
Initialization of the slab cache's should be done when IP is
initialized to make sure of available memory, and that code can be
marked __init.
Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_hash.c')
-rw-r--r-- | net/ipv4/fib_hash.c | 24 |
1 files changed, 11 insertions, 13 deletions
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 return skb->len; } -struct fib_table *fib_hash_init(u32 id) +void __init fib_hash_init(void) { - struct fib_table *tb; + fn_hash_kmem = kmem_cache_create("ip_fib_hash", sizeof(struct fib_node), + 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); + + fn_alias_kmem = kmem_cache_create("ip_fib_alias", sizeof(struct fib_alias), + 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); + +} - if (fn_hash_kmem == NULL) - fn_hash_kmem = kmem_cache_create("ip_fib_hash", - sizeof(struct fib_node), - 0, SLAB_HWCACHE_ALIGN, - NULL); - - if (fn_alias_kmem == NULL) - fn_alias_kmem = kmem_cache_create("ip_fib_alias", - sizeof(struct fib_alias), - 0, SLAB_HWCACHE_ALIGN, - NULL); +struct fib_table *fib_hash_table(u32 id) +{ + struct fib_table *tb; tb = kmalloc(sizeof(struct fib_table) + sizeof(struct fn_hash), GFP_KERNEL); |