]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/core/neighbour.c
Merge branch 'linux-next' of git://git.infradead.org/ubi-2.6
[karo-tx-linux.git] / net / core / neighbour.c
index d9bbe010e0ee87e06bfc3b9b608ccf22c900bb60..f66c58df8953e8b3f642830aae5f88230eb3aeec 100644 (file)
@@ -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)
@@ -1329,9 +1327,9 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
                                      struct neigh_table *tbl)
 {
        struct neigh_parms *p, *ref;
-       struct net *net;
+       struct net *net = dev_net(dev);
+       const struct net_device_ops *ops = dev->netdev_ops;
 
-       net = dev_net(dev);
        ref = lookup_neigh_params(tbl, net, 0);
        if (!ref)
                return NULL;
@@ -1343,16 +1341,14 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
                p->reachable_time =
                                neigh_rand_reach_time(p->base_reachable_time);
 
-               if (dev->neigh_setup && dev->neigh_setup(dev, p)) {
+               if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) {
                        kfree(p);
                        return NULL;
                }
 
                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);
@@ -1424,9 +1418,8 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
                panic("cannot create neighbour cache statistics");
 
 #ifdef CONFIG_PROC_FS
-       tbl->pde = proc_create_data(tbl->id, 0, init_net.proc_net_stat,
-                                   &neigh_stat_seq_fops, tbl);
-       if (!tbl->pde)
+       if (!proc_create_data(tbl->id, 0, init_net.proc_net_stat,
+                             &neigh_stat_seq_fops, tbl))
                panic("cannot create neighbour proc dir entry");
 #endif
 
@@ -2421,7 +2414,7 @@ static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos)
        if (*pos == 0)
                return SEQ_START_TOKEN;
 
-       for (cpu = *pos-1; cpu < NR_CPUS; ++cpu) {
+       for (cpu = *pos-1; cpu < nr_cpu_ids; ++cpu) {
                if (!cpu_possible(cpu))
                        continue;
                *pos = cpu+1;
@@ -2436,7 +2429,7 @@ static void *neigh_stat_seq_next(struct seq_file *seq, void *v, loff_t *pos)
        struct neigh_table *tbl = pde->data;
        int cpu;
 
-       for (cpu = *pos; cpu < NR_CPUS; ++cpu) {
+       for (cpu = *pos; cpu < nr_cpu_ids; ++cpu) {
                if (!cpu_possible(cpu))
                        continue;
                *pos = cpu+1;