aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/neighbour.h
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-25 14:49:59 -0400
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-25 15:39:58 -0400
commit57da52c1e62c6c13875e97de6c69d3156f8416da (patch)
treed29d201367194b64bde3dc38559b66c6bbd92503 /include/net/neighbour.h
parent1218854afa6f659be90b748cf1bc7badee954a35 (diff)
[NET] NETNS: Omit neigh_parms->net and pneigh_entry->net without CONFIG_NET_NS.
Introduce neigh_parms/pneigh_entry inlines: neigh_parms_net(), pneigh_net(). Without CONFIG_NET_NS, no namespace other than &init_net exists. Let's explicitly define them to help compiler optimizations. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'include/net/neighbour.h')
-rw-r--r--include/net/neighbour.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 062281872064..8bec0d69b270 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -38,7 +38,9 @@ struct neighbour;
38 38
39struct neigh_parms 39struct neigh_parms
40{ 40{
41#ifdef CONFIG_NET_NS
41 struct net *net; 42 struct net *net;
43#endif
42 struct net_device *dev; 44 struct net_device *dev;
43 struct neigh_parms *next; 45 struct neigh_parms *next;
44 int (*neigh_setup)(struct neighbour *); 46 int (*neigh_setup)(struct neighbour *);
@@ -131,7 +133,9 @@ struct neigh_ops
131struct pneigh_entry 133struct pneigh_entry
132{ 134{
133 struct pneigh_entry *next; 135 struct pneigh_entry *next;
136#ifdef CONFIG_NET_NS
134 struct net *net; 137 struct net *net;
138#endif
135 struct net_device *dev; 139 struct net_device *dev;
136 u8 flags; 140 u8 flags;
137 u8 key[0]; 141 u8 key[0];
@@ -213,6 +217,17 @@ extern struct neighbour *neigh_event_ns(struct neigh_table *tbl,
213 217
214extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); 218extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl);
215extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); 219extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms);
220
221static inline
222struct net *neigh_parms_net(const struct neigh_parms *parms)
223{
224#ifdef CONFIG_NET_NS
225 return parms->net;
226#else
227 return &init_net;
228#endif
229}
230
216extern unsigned long neigh_rand_reach_time(unsigned long base); 231extern unsigned long neigh_rand_reach_time(unsigned long base);
217 232
218extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, 233extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
@@ -220,6 +235,16 @@ extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
220extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev, int creat); 235extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev, int creat);
221extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev); 236extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev);
222 237
238static inline
239struct net *pneigh_net(const struct pneigh_entry *pneigh)
240{
241#ifdef CONFIG_NET_NS
242 return pneigh->net;
243#else
244 return &init_net;
245#endif
246}
247
223extern void neigh_app_ns(struct neighbour *n); 248extern void neigh_app_ns(struct neighbour *n);
224extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); 249extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie);
225extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); 250extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *));