summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2008-11-12 00:54:54 -0800
committerDavid S. Miller <davem@davemloft.net>2008-11-12 00:54:54 -0800
commite42ea986e4a4cab4209d982feffcaf50f21e80e3 (patch)
treeda674327f247cf325320caef87df6af5a0af8fd6 /net/core
parent7a9546ee354ec6f23af403992b8c07baa50a23d2 (diff)
downloadop-kernel-dev-e42ea986e4a4cab4209d982feffcaf50f21e80e3.zip
op-kernel-dev-e42ea986e4a4cab4209d982feffcaf50f21e80e3.tar.gz
net: Cleanup of neighbour code
Using read_pnet() and write_pnet() in neighbour code ease the reading of code. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/neighbour.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 500c243..cca6a55 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -531,9 +531,7 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl,
if (!n)
goto out;
-#ifdef CONFIG_NET_NS
- n->net = hold_net(net);
-#endif
+ write_pnet(&n->net, hold_net(net));
memcpy(n->key, pkey, key_len);
n->dev = dev;
if (dev)
@@ -1350,9 +1348,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
dev_hold(dev);
p->dev = dev;
-#ifdef CONFIG_NET_NS
- p->net = hold_net(net);
-#endif
+ write_pnet(&p->net, hold_net(net));
p->sysctl_table = NULL;
write_lock_bh(&tbl->lock);
p->next = tbl->parms.next;
@@ -1407,9 +1403,7 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
unsigned long now = jiffies;
unsigned long phsize;
-#ifdef CONFIG_NET_NS
- tbl->parms.net = &init_net;
-#endif
+ write_pnet(&tbl->parms.net, &init_net);
atomic_set(&tbl->parms.refcnt, 1);
tbl->parms.reachable_time =
neigh_rand_reach_time(tbl->parms.base_reachable_time);
OpenPOWER on IntegriCloud