aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv4/route.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 193788381a59..d95e48e8d65c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -235,16 +235,25 @@ struct rt_hash_bucket {
235 235
236static spinlock_t *rt_hash_locks; 236static spinlock_t *rt_hash_locks;
237# define rt_hash_lock_addr(slot) &rt_hash_locks[(slot) & (RT_HASH_LOCK_SZ - 1)] 237# define rt_hash_lock_addr(slot) &rt_hash_locks[(slot) & (RT_HASH_LOCK_SZ - 1)]
238# define rt_hash_lock_init() { \ 238
239 int i; \ 239static __init void rt_hash_lock_init(void)
240 rt_hash_locks = kmalloc(sizeof(spinlock_t) * RT_HASH_LOCK_SZ, GFP_KERNEL); \ 240{
241 if (!rt_hash_locks) panic("IP: failed to allocate rt_hash_locks\n"); \ 241 int i;
242 for (i = 0; i < RT_HASH_LOCK_SZ; i++) \ 242
243 spin_lock_init(&rt_hash_locks[i]); \ 243 rt_hash_locks = kmalloc(sizeof(spinlock_t) * RT_HASH_LOCK_SZ,
244 } 244 GFP_KERNEL);
245 if (!rt_hash_locks)
246 panic("IP: failed to allocate rt_hash_locks\n");
247
248 for (i = 0; i < RT_HASH_LOCK_SZ; i++)
249 spin_lock_init(&rt_hash_locks[i]);
250}
245#else 251#else
246# define rt_hash_lock_addr(slot) NULL 252# define rt_hash_lock_addr(slot) NULL
247# define rt_hash_lock_init() 253
254static inline void rt_hash_lock_init(void)
255{
256}
248#endif 257#endif
249 258
250static struct rt_hash_bucket *rt_hash_table; 259static struct rt_hash_bucket *rt_hash_table;