KVM: PPC: Add QPR registers
[safe/jmp/linux-2.6] / net / decnet / dn_route.c
index 1d6ca8a..70ebe74 100644 (file)
@@ -66,6 +66,7 @@
 #include <linux/inet.h>
 #include <linux/route.h>
 #include <linux/in_route.h>
+#include <linux/slab.h>
 #include <net/sock.h>
 #include <linux/mm.h>
 #include <linux/proc_fs.h>
@@ -774,7 +775,7 @@ static int dn_rt_bug(struct sk_buff *skb)
 
        kfree_skb(skb);
 
-       return NET_RX_BAD;
+       return NET_RX_DROP;
 }
 
 static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res)
@@ -908,8 +909,8 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
                        dev_put(dev_out);
                        goto out;
                }
-               read_lock(&dev_base_lock);
-               for_each_netdev(&init_net, dev) {
+               rcu_read_lock();
+               for_each_netdev_rcu(&init_net, dev) {
                        if (!dev->dn_ptr)
                                continue;
                        if (!dn_dev_islocal(dev, oldflp->fld_src))
@@ -922,7 +923,7 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
                        dev_out = dev;
                        break;
                }
-               read_unlock(&dev_base_lock);
+               rcu_read_unlock();
                if (dev_out == NULL)
                        goto out;
                dev_hold(dev_out);
@@ -1155,8 +1156,8 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl
 
        if (!(flags & MSG_TRYHARD)) {
                rcu_read_lock_bh();
-               for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt;
-                       rt = rcu_dereference(rt->u.dst.dn_next)) {
+               for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt;
+                       rt = rcu_dereference_bh(rt->u.dst.dn_next)) {
                        if ((flp->fld_dst == rt->fl.fld_dst) &&
                            (flp->fld_src == rt->fl.fld_src) &&
                            (flp->mark == rt->fl.mark) &&
@@ -1517,7 +1518,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
        struct sk_buff *skb;
        struct flowi fl;
 
-       if (net != &init_net)
+       if (!net_eq(net, &init_net))
                return -EINVAL;
 
        memset(&fl, 0, sizeof(fl));
@@ -1602,7 +1603,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
        int h, s_h;
        int idx, s_idx;
 
-       if (net != &init_net)
+       if (!net_eq(net, &init_net))
                return 0;
 
        if (NLMSG_PAYLOAD(cb->nlh, 0) < sizeof(struct rtmsg))
@@ -1618,9 +1619,9 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
                if (h > s_h)
                        s_idx = 0;
                rcu_read_lock_bh();
-               for(rt = rcu_dereference(dn_rt_hash_table[h].chain), idx = 0;
+               for(rt = rcu_dereference_bh(dn_rt_hash_table[h].chain), idx = 0;
                        rt;
-                       rt = rcu_dereference(rt->u.dst.dn_next), idx++) {
+                       rt = rcu_dereference_bh(rt->u.dst.dn_next), idx++) {
                        if (idx < s_idx)
                                continue;
                        skb_dst_set(skb, dst_clone(&rt->u.dst));
@@ -1654,12 +1655,12 @@ static struct dn_route *dn_rt_cache_get_first(struct seq_file *seq)
 
        for(s->bucket = dn_rt_hash_mask; s->bucket >= 0; --s->bucket) {
                rcu_read_lock_bh();
-               rt = dn_rt_hash_table[s->bucket].chain;
+               rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain);
                if (rt)
                        break;
                rcu_read_unlock_bh();
        }
-       return rcu_dereference(rt);
+       return rt;
 }
 
 static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt)
@@ -1674,7 +1675,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou
                rcu_read_lock_bh();
                rt = dn_rt_hash_table[s->bucket].chain;
        }
-       return rcu_dereference(rt);
+       return rcu_dereference_bh(rt);
 }
 
 static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
@@ -1750,7 +1751,7 @@ void __init dn_route_init(void)
        dn_route_timer.expires = jiffies + decnet_dst_gc_interval * HZ;
        add_timer(&dn_route_timer);
 
-       goal = num_physpages >> (26 - PAGE_SHIFT);
+       goal = totalram_pages >> (26 - PAGE_SHIFT);
 
        for(order = 0; (1UL << order) < goal; order++)
                /* NOTHING */;