aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip_fib.h
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2011-08-27 09:43:54 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2011-08-27 10:06:11 -0400
commit7b1bb388bc879ffcc6c69b567816d5c354afe42b (patch)
tree5a217fdfb0b5e5a327bdcd624506337c1ae1fe32 /include/net/ip_fib.h
parent7d754596756240fa918b94cd0c3011c77a638987 (diff)
parent02f8c6aee8df3cdc935e9bdd4f2d020306035dbe (diff)
Merge 'Linux v3.0' into Litmus
Some notes: * Litmus^RT scheduling class is the topmost scheduling class (above stop_sched_class). * scheduler_ipi() function (e.g., in smp_reschedule_interrupt()) may increase IPI latencies. * Added path into schedule() to quickly re-evaluate scheduling decision without becoming preemptive again. This used to be a standard path before the removal of BKL. Conflicts: Makefile arch/arm/kernel/calls.S arch/arm/kernel/smp.c arch/x86/include/asm/unistd_32.h arch/x86/kernel/smp.c arch/x86/kernel/syscall_table_32.S include/linux/hrtimer.h kernel/printk.c kernel/sched.c kernel/sched_fair.c
Diffstat (limited to 'include/net/ip_fib.h')
-rw-r--r--include/net/ip_fib.h83
1 files changed, 44 insertions, 39 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index c93f94edc610..10422ef14e28 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -55,11 +55,13 @@ struct fib_nh {
55 int nh_weight; 55 int nh_weight;
56 int nh_power; 56 int nh_power;
57#endif 57#endif
58#ifdef CONFIG_NET_CLS_ROUTE 58#ifdef CONFIG_IP_ROUTE_CLASSID
59 __u32 nh_tclassid; 59 __u32 nh_tclassid;
60#endif 60#endif
61 int nh_oif; 61 int nh_oif;
62 __be32 nh_gw; 62 __be32 nh_gw;
63 __be32 nh_saddr;
64 int nh_saddr_genid;
63}; 65};
64 66
65/* 67/*
@@ -72,12 +74,13 @@ struct fib_info {
72 struct net *fib_net; 74 struct net *fib_net;
73 int fib_treeref; 75 int fib_treeref;
74 atomic_t fib_clntref; 76 atomic_t fib_clntref;
75 int fib_dead;
76 unsigned fib_flags; 77 unsigned fib_flags;
77 int fib_protocol; 78 unsigned char fib_dead;
79 unsigned char fib_protocol;
80 unsigned char fib_scope;
78 __be32 fib_prefsrc; 81 __be32 fib_prefsrc;
79 u32 fib_priority; 82 u32 fib_priority;
80 u32 fib_metrics[RTAX_MAX]; 83 u32 *fib_metrics;
81#define fib_mtu fib_metrics[RTAX_MTU-1] 84#define fib_mtu fib_metrics[RTAX_MTU-1]
82#define fib_window fib_metrics[RTAX_WINDOW-1] 85#define fib_window fib_metrics[RTAX_WINDOW-1]
83#define fib_rtt fib_metrics[RTAX_RTT-1] 86#define fib_rtt fib_metrics[RTAX_RTT-1]
@@ -86,6 +89,7 @@ struct fib_info {
86#ifdef CONFIG_IP_ROUTE_MULTIPATH 89#ifdef CONFIG_IP_ROUTE_MULTIPATH
87 int fib_power; 90 int fib_power;
88#endif 91#endif
92 struct rcu_head rcu;
89 struct fib_nh fib_nh[0]; 93 struct fib_nh fib_nh[0];
90#define fib_dev fib_nh[0].nh_dev 94#define fib_dev fib_nh[0].nh_dev
91}; 95};
@@ -95,12 +99,15 @@ struct fib_info {
95struct fib_rule; 99struct fib_rule;
96#endif 100#endif
97 101
102struct fib_table;
98struct fib_result { 103struct fib_result {
99 unsigned char prefixlen; 104 unsigned char prefixlen;
100 unsigned char nh_sel; 105 unsigned char nh_sel;
101 unsigned char type; 106 unsigned char type;
102 unsigned char scope; 107 unsigned char scope;
103 struct fib_info *fi; 108 struct fib_info *fi;
109 struct fib_table *table;
110 struct list_head *fa_head;
104#ifdef CONFIG_IP_MULTIPLE_TABLES 111#ifdef CONFIG_IP_MULTIPLE_TABLES
105 struct fib_rule *r; 112 struct fib_rule *r;
106#endif 113#endif
@@ -135,28 +142,37 @@ struct fib_result_nl {
135 142
136#endif /* CONFIG_IP_ROUTE_MULTIPATH */ 143#endif /* CONFIG_IP_ROUTE_MULTIPATH */
137 144
138#define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __fib_res_prefsrc(&res)) 145extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh);
146
147#define FIB_RES_SADDR(net, res) \
148 ((FIB_RES_NH(res).nh_saddr_genid == \
149 atomic_read(&(net)->ipv4.dev_addr_genid)) ? \
150 FIB_RES_NH(res).nh_saddr : \
151 fib_info_update_nh_saddr((net), &FIB_RES_NH(res)))
139#define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw) 152#define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw)
140#define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev) 153#define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev)
141#define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif) 154#define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif)
142 155
156#define FIB_RES_PREFSRC(net, res) ((res).fi->fib_prefsrc ? : \
157 FIB_RES_SADDR(net, res))
158
143struct fib_table { 159struct fib_table {
144 struct hlist_node tb_hlist; 160 struct hlist_node tb_hlist;
145 u32 tb_id; 161 u32 tb_id;
146 int tb_default; 162 int tb_default;
147 unsigned char tb_data[0]; 163 int tb_num_default;
164 unsigned long tb_data[0];
148}; 165};
149 166
150extern int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, 167extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
151 struct fib_result *res); 168 struct fib_result *res, int fib_flags);
152extern int fib_table_insert(struct fib_table *, struct fib_config *); 169extern int fib_table_insert(struct fib_table *, struct fib_config *);
153extern int fib_table_delete(struct fib_table *, struct fib_config *); 170extern int fib_table_delete(struct fib_table *, struct fib_config *);
154extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb, 171extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb,
155 struct netlink_callback *cb); 172 struct netlink_callback *cb);
156extern int fib_table_flush(struct fib_table *table); 173extern int fib_table_flush(struct fib_table *table);
157extern void fib_table_select_default(struct fib_table *table, 174extern void fib_free_table(struct fib_table *tb);
158 const struct flowi *flp, 175
159 struct fib_result *res);
160 176
161 177
162#ifndef CONFIG_IP_MULTIPLE_TABLES 178#ifndef CONFIG_IP_MULTIPLE_TABLES
@@ -179,17 +195,17 @@ static inline struct fib_table *fib_new_table(struct net *net, u32 id)
179 return fib_get_table(net, id); 195 return fib_get_table(net, id);
180} 196}
181 197
182static inline int fib_lookup(struct net *net, const struct flowi *flp, 198static inline int fib_lookup(struct net *net, const struct flowi4 *flp,
183 struct fib_result *res) 199 struct fib_result *res)
184{ 200{
185 struct fib_table *table; 201 struct fib_table *table;
186 202
187 table = fib_get_table(net, RT_TABLE_LOCAL); 203 table = fib_get_table(net, RT_TABLE_LOCAL);
188 if (!fib_table_lookup(table, flp, res)) 204 if (!fib_table_lookup(table, flp, res, FIB_LOOKUP_NOREF))
189 return 0; 205 return 0;
190 206
191 table = fib_get_table(net, RT_TABLE_MAIN); 207 table = fib_get_table(net, RT_TABLE_MAIN);
192 if (!fib_table_lookup(table, flp, res)) 208 if (!fib_table_lookup(table, flp, res, FIB_LOOKUP_NOREF))
193 return 0; 209 return 0;
194 return -ENETUNREACH; 210 return -ENETUNREACH;
195} 211}
@@ -198,11 +214,11 @@ static inline int fib_lookup(struct net *net, const struct flowi *flp,
198extern int __net_init fib4_rules_init(struct net *net); 214extern int __net_init fib4_rules_init(struct net *net);
199extern void __net_exit fib4_rules_exit(struct net *net); 215extern void __net_exit fib4_rules_exit(struct net *net);
200 216
201#ifdef CONFIG_NET_CLS_ROUTE 217#ifdef CONFIG_IP_ROUTE_CLASSID
202extern u32 fib_rules_tclass(struct fib_result *res); 218extern u32 fib_rules_tclass(const struct fib_result *res);
203#endif 219#endif
204 220
205extern int fib_lookup(struct net *n, struct flowi *flp, struct fib_result *res); 221extern int fib_lookup(struct net *n, struct flowi4 *flp, struct fib_result *res);
206 222
207extern struct fib_table *fib_new_table(struct net *net, u32 id); 223extern struct fib_table *fib_new_table(struct net *net, u32 id);
208extern struct fib_table *fib_get_table(struct net *net, u32 id); 224extern struct fib_table *fib_get_table(struct net *net, u32 id);
@@ -212,27 +228,26 @@ extern struct fib_table *fib_get_table(struct net *net, u32 id);
212/* Exported by fib_frontend.c */ 228/* Exported by fib_frontend.c */
213extern const struct nla_policy rtm_ipv4_policy[]; 229extern const struct nla_policy rtm_ipv4_policy[];
214extern void ip_fib_init(void); 230extern void ip_fib_init(void);
215extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 231extern int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
216 struct net_device *dev, __be32 *spec_dst, 232 u8 tos, int oif, struct net_device *dev,
217 u32 *itag, u32 mark); 233 __be32 *spec_dst, u32 *itag);
218extern void fib_select_default(struct net *net, const struct flowi *flp, 234extern void fib_select_default(struct fib_result *res);
219 struct fib_result *res);
220 235
221/* Exported by fib_semantics.c */ 236/* Exported by fib_semantics.c */
222extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 237extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
223extern int fib_sync_down_dev(struct net_device *dev, int force); 238extern int fib_sync_down_dev(struct net_device *dev, int force);
224extern int fib_sync_down_addr(struct net *net, __be32 local); 239extern int fib_sync_down_addr(struct net *net, __be32 local);
240extern void fib_update_nh_saddrs(struct net_device *dev);
225extern int fib_sync_up(struct net_device *dev); 241extern int fib_sync_up(struct net_device *dev);
226extern __be32 __fib_res_prefsrc(struct fib_result *res); 242extern void fib_select_multipath(struct fib_result *res);
227extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
228 243
229/* Exported by fib_{hash|trie}.c */ 244/* Exported by fib_trie.c */
230extern void fib_hash_init(void); 245extern void fib_trie_init(void);
231extern struct fib_table *fib_hash_table(u32 id); 246extern struct fib_table *fib_trie_table(u32 id);
232 247
233static inline void fib_combine_itag(u32 *itag, struct fib_result *res) 248static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)
234{ 249{
235#ifdef CONFIG_NET_CLS_ROUTE 250#ifdef CONFIG_IP_ROUTE_CLASSID
236#ifdef CONFIG_IP_MULTIPLE_TABLES 251#ifdef CONFIG_IP_MULTIPLE_TABLES
237 u32 rtag; 252 u32 rtag;
238#endif 253#endif
@@ -254,16 +269,6 @@ static inline void fib_info_put(struct fib_info *fi)
254 free_fib_info(fi); 269 free_fib_info(fi);
255} 270}
256 271
257static inline void fib_res_put(struct fib_result *res)
258{
259 if (res->fi)
260 fib_info_put(res->fi);
261#ifdef CONFIG_IP_MULTIPLE_TABLES
262 if (res->r)
263 fib_rule_put(res->r);
264#endif
265}
266
267#ifdef CONFIG_PROC_FS 272#ifdef CONFIG_PROC_FS
268extern int __net_init fib_proc_init(struct net *net); 273extern int __net_init fib_proc_init(struct net *net);
269extern void __net_exit fib_proc_exit(struct net *net); 274extern void __net_exit fib_proc_exit(struct net *net);