aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-11-07 02:34:04 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-11-07 07:11:41 -0500
commitc3e9a353d8fc64a82ab11a07e21902e25e1e96d1 (patch)
tree222e2a21bcceeb22818543029682fc94feb70f9d
parent6a9a025086ac70f0f285365cbaf1df8643266b72 (diff)
[IPV4]: Compact some ifdefs in the fib code.
There are places that check for CONFIG_IP_MULTIPLE_TABLES twice in the same file, but the internals of these #ifdefs can be merged. As a side effect - remove one ifdef from inside a function. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/ip_fib.h15
-rw-r--r--net/ipv4/fib_frontend.c15
2 files changed, 14 insertions, 16 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 8cadc77c7df4..ed514bfb61ba 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -185,6 +185,12 @@ static inline void fib_select_default(const struct flowi *flp, struct fib_result
185} 185}
186 186
187#else /* CONFIG_IP_MULTIPLE_TABLES */ 187#else /* CONFIG_IP_MULTIPLE_TABLES */
188extern void __init fib4_rules_init(void);
189
190#ifdef CONFIG_NET_CLS_ROUTE
191extern u32 fib_rules_tclass(struct fib_result *res);
192#endif
193
188#define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL) 194#define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL)
189#define ip_fib_main_table fib_get_table(RT_TABLE_MAIN) 195#define ip_fib_main_table fib_get_table(RT_TABLE_MAIN)
190 196
@@ -214,15 +220,6 @@ extern __be32 __fib_res_prefsrc(struct fib_result *res);
214/* Exported by fib_hash.c */ 220/* Exported by fib_hash.c */
215extern struct fib_table *fib_hash_init(u32 id); 221extern struct fib_table *fib_hash_init(u32 id);
216 222
217#ifdef CONFIG_IP_MULTIPLE_TABLES
218extern void __init fib4_rules_init(void);
219
220#ifdef CONFIG_NET_CLS_ROUTE
221extern u32 fib_rules_tclass(struct fib_result *res);
222#endif
223
224#endif
225
226static inline void fib_combine_itag(u32 *itag, struct fib_result *res) 223static inline void fib_combine_itag(u32 *itag, struct fib_result *res)
227{ 224{
228#ifdef CONFIG_NET_CLS_ROUTE 225#ifdef CONFIG_NET_CLS_ROUTE
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 60123905dbbf..732d8f088b13 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -59,6 +59,13 @@ struct fib_table *ip_fib_main_table;
59#define FIB_TABLE_HASHSZ 1 59#define FIB_TABLE_HASHSZ 1
60static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; 60static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ];
61 61
62static void __init fib4_rules_init(void)
63{
64 ip_fib_local_table = fib_hash_init(RT_TABLE_LOCAL);
65 hlist_add_head_rcu(&ip_fib_local_table->tb_hlist, &fib_table_hash[0]);
66 ip_fib_main_table = fib_hash_init(RT_TABLE_MAIN);
67 hlist_add_head_rcu(&ip_fib_main_table->tb_hlist, &fib_table_hash[0]);
68}
62#else 69#else
63 70
64#define FIB_TABLE_HASHSZ 256 71#define FIB_TABLE_HASHSZ 256
@@ -905,14 +912,8 @@ void __init ip_fib_init(void)
905 912
906 for (i = 0; i < FIB_TABLE_HASHSZ; i++) 913 for (i = 0; i < FIB_TABLE_HASHSZ; i++)
907 INIT_HLIST_HEAD(&fib_table_hash[i]); 914 INIT_HLIST_HEAD(&fib_table_hash[i]);
908#ifndef CONFIG_IP_MULTIPLE_TABLES 915
909 ip_fib_local_table = fib_hash_init(RT_TABLE_LOCAL);
910 hlist_add_head_rcu(&ip_fib_local_table->tb_hlist, &fib_table_hash[0]);
911 ip_fib_main_table = fib_hash_init(RT_TABLE_MAIN);
912 hlist_add_head_rcu(&ip_fib_main_table->tb_hlist, &fib_table_hash[0]);
913#else
914 fib4_rules_init(); 916 fib4_rules_init();
915#endif
916 917
917 register_netdevice_notifier(&fib_netdev_notifier); 918 register_netdevice_notifier(&fib_netdev_notifier);
918 register_inetaddr_notifier(&fib_inetaddr_notifier); 919 register_inetaddr_notifier(&fib_inetaddr_notifier);