route.c (5969f71d57928511b9cd8744aaf1ed9bc5e88ea2) | route.c (1294fc4a4868d7e83ff749597fbf4e9d5f4d1aa0) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * ROUTE - implementation of the IP router. 7 * 8 * Version: $Id: route.c,v 1.103 2002/01/12 07:44:09 davem Exp $ --- 245 unchanged lines hidden (view full) --- 254static unsigned rt_hash_mask __read_mostly; 255static unsigned int rt_hash_log __read_mostly; 256static atomic_t rt_genid __read_mostly; 257 258static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); 259#define RT_CACHE_STAT_INC(field) \ 260 (__raw_get_cpu_var(rt_cache_stat).field++) 261 | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * ROUTE - implementation of the IP router. 7 * 8 * Version: $Id: route.c,v 1.103 2002/01/12 07:44:09 davem Exp $ --- 245 unchanged lines hidden (view full) --- 254static unsigned rt_hash_mask __read_mostly; 255static unsigned int rt_hash_log __read_mostly; 256static atomic_t rt_genid __read_mostly; 257 258static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); 259#define RT_CACHE_STAT_INC(field) \ 260 (__raw_get_cpu_var(rt_cache_stat).field++) 261 |
262static unsigned int rt_hash_code(u32 daddr, u32 saddr) | 262static inline unsigned int rt_hash(__be32 daddr, __be32 saddr, int idx) |
263{ | 263{ |
264 return jhash_2words(daddr, saddr, atomic_read(&rt_genid)) | 264 return jhash_3words((__force u32)(__be32)(daddr), 265 (__force u32)(__be32)(saddr), 266 idx, atomic_read(&rt_genid)) |
265 & rt_hash_mask; 266} 267 | 267 & rt_hash_mask; 268} 269 |
268#define rt_hash(daddr, saddr, idx) \ 269 rt_hash_code((__force u32)(__be32)(daddr),\ 270 (__force u32)(__be32)(saddr) ^ ((idx) << 5)) 271 | |
272#ifdef CONFIG_PROC_FS 273struct rt_cache_iter_state { 274 struct seq_net_private p; 275 int bucket; 276 int genid; 277}; 278 279static struct rtable *rt_cache_get_first(struct seq_file *seq) --- 2809 unchanged lines hidden --- | 270#ifdef CONFIG_PROC_FS 271struct rt_cache_iter_state { 272 struct seq_net_private p; 273 int bucket; 274 int genid; 275}; 276 277static struct rtable *rt_cache_get_first(struct seq_file *seq) --- 2809 unchanged lines hidden --- |