summaryrefslogtreecommitdiffstats
path: root/include/net/neighbour.h
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-26 03:49:59 +0900
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-26 04:39:58 +0900
commit57da52c1e62c6c13875e97de6c69d3156f8416da (patch)
treed29d201367194b64bde3dc38559b66c6bbd92503 /include/net/neighbour.h
parent1218854afa6f659be90b748cf1bc7badee954a35 (diff)
downloadop-kernel-dev-57da52c1e62c6c13875e97de6c69d3156f8416da.zip
op-kernel-dev-57da52c1e62c6c13875e97de6c69d3156f8416da.tar.gz
[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 0622818..8bec0d6 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -38,7 +38,9 @@ struct neighbour;
struct neigh_parms
{
+#ifdef CONFIG_NET_NS
struct net *net;
+#endif
struct net_device *dev;
struct neigh_parms *next;
int (*neigh_setup)(struct neighbour *);
@@ -131,7 +133,9 @@ struct neigh_ops
struct pneigh_entry
{
struct pneigh_entry *next;
+#ifdef CONFIG_NET_NS
struct net *net;
+#endif
struct net_device *dev;
u8 flags;
u8 key[0];
@@ -213,6 +217,17 @@ extern struct neighbour *neigh_event_ns(struct neigh_table *tbl,
extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl);
extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms);
+
+static inline
+struct net *neigh_parms_net(const struct neigh_parms *parms)
+{
+#ifdef CONFIG_NET_NS
+ return parms->net;
+#else
+ return &init_net;
+#endif
+}
+
extern unsigned long neigh_rand_reach_time(unsigned long base);
extern 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,
extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev, int creat);
extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev);
+static inline
+struct net *pneigh_net(const struct pneigh_entry *pneigh)
+{
+#ifdef CONFIG_NET_NS
+ return pneigh->net;
+#else
+ return &init_net;
+#endif
+}
+
extern void neigh_app_ns(struct neighbour *n);
extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie);
extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *));
OpenPOWER on IntegriCloud