decnet: Move dn_next into decnet route structure.
authorDavid Miller <davem@davemloft.net>
Tue, 28 Nov 2017 20:40:08 +0000 (15:40 -0500)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 Nov 2017 14:54:25 +0000 (09:54 -0500)
Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
include/net/dn_route.h
include/net/dst.h
net/decnet/dn_route.c

index 55df9939bca268106384d10d330615ae091d3aea..342d2503cba5cfc4d9a4912d27543815c1f834e5 100644 (file)
@@ -69,6 +69,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev,
  */
 struct dn_route {
        struct dst_entry dst;
+       struct dn_route __rcu *dn_next;
 
        struct neighbour *n;
 
index 349374750ee7009d47574d652a288fa78c623a37..cc7e8166be0d2bd04610a04878a3583f09835d78 100644 (file)
@@ -102,7 +102,6 @@ struct dst_entry {
        union {
                struct dst_entry        *next;
                struct rt6_info __rcu   *rt6_next;
-               struct dn_route __rcu   *dn_next;
        };
 };
 
index 324cb9f2f55146a46ef78528fa5ac768e22736b9..4b3ca70be7231ac8e36ab5b8041da4d37978bc9b 100644 (file)
@@ -199,11 +199,11 @@ static void dn_dst_check_expire(struct timer_list *unused)
                                                lockdep_is_held(&dn_rt_hash_table[i].lock))) != NULL) {
                        if (atomic_read(&rt->dst.__refcnt) > 1 ||
                            (now - rt->dst.lastuse) < expire) {
-                               rtp = &rt->dst.dn_next;
+                               rtp = &rt->dn_next;
                                continue;
                        }
-                       *rtp = rt->dst.dn_next;
-                       rt->dst.dn_next = NULL;
+                       *rtp = rt->dn_next;
+                       rt->dn_next = NULL;
                        dst_dev_put(&rt->dst);
                        dst_release(&rt->dst);
                }
@@ -233,11 +233,11 @@ static int dn_dst_gc(struct dst_ops *ops)
                                                lockdep_is_held(&dn_rt_hash_table[i].lock))) != NULL) {
                        if (atomic_read(&rt->dst.__refcnt) > 1 ||
                            (now - rt->dst.lastuse) < expire) {
-                               rtp = &rt->dst.dn_next;
+                               rtp = &rt->dn_next;
                                continue;
                        }
-                       *rtp = rt->dst.dn_next;
-                       rt->dst.dn_next = NULL;
+                       *rtp = rt->dn_next;
+                       rt->dn_next = NULL;
                        dst_dev_put(&rt->dst);
                        dst_release(&rt->dst);
                        break;
@@ -333,8 +333,8 @@ static int dn_insert_route(struct dn_route *rt, unsigned int hash, struct dn_rou
                                                lockdep_is_held(&dn_rt_hash_table[hash].lock))) != NULL) {
                if (compare_keys(&rth->fld, &rt->fld)) {
                        /* Put it first */
-                       *rthp = rth->dst.dn_next;
-                       rcu_assign_pointer(rth->dst.dn_next,
+                       *rthp = rth->dn_next;
+                       rcu_assign_pointer(rth->dn_next,
                                           dn_rt_hash_table[hash].chain);
                        rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth);
 
@@ -345,10 +345,10 @@ static int dn_insert_route(struct dn_route *rt, unsigned int hash, struct dn_rou
                        *rp = rth;
                        return 0;
                }
-               rthp = &rth->dst.dn_next;
+               rthp = &rth->dn_next;
        }
 
-       rcu_assign_pointer(rt->dst.dn_next, dn_rt_hash_table[hash].chain);
+       rcu_assign_pointer(rt->dn_next, dn_rt_hash_table[hash].chain);
        rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt);
 
        dst_hold_and_use(&rt->dst, now);
@@ -369,8 +369,8 @@ static void dn_run_flush(struct timer_list *unused)
                        goto nothing_to_declare;
 
                for(; rt; rt = next) {
-                       next = rcu_dereference_raw(rt->dst.dn_next);
-                       RCU_INIT_POINTER(rt->dst.dn_next, NULL);
+                       next = rcu_dereference_raw(rt->dn_next);
+                       RCU_INIT_POINTER(rt->dn_next, NULL);
                        dst_dev_put(&rt->dst);
                        dst_release(&rt->dst);
                }
@@ -1183,6 +1183,7 @@ make_route:
        if (rt == NULL)
                goto e_nobufs;
 
+       rt->dn_next = NULL;
        memset(&rt->fld, 0, sizeof(rt->fld));
        rt->fld.saddr        = oldflp->saddr;
        rt->fld.daddr        = oldflp->daddr;
@@ -1252,7 +1253,7 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowidn *
        if (!(flags & MSG_TRYHARD)) {
                rcu_read_lock_bh();
                for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt;
-                       rt = rcu_dereference_bh(rt->dst.dn_next)) {
+                       rt = rcu_dereference_bh(rt->dn_next)) {
                        if ((flp->daddr == rt->fld.daddr) &&
                            (flp->saddr == rt->fld.saddr) &&
                            (flp->flowidn_mark == rt->fld.flowidn_mark) &&
@@ -1448,6 +1449,7 @@ make_route:
        if (rt == NULL)
                goto e_nobufs;
 
+       rt->dn_next = NULL;
        memset(&rt->fld, 0, sizeof(rt->fld));
        rt->rt_saddr      = fld.saddr;
        rt->rt_daddr      = fld.daddr;
@@ -1529,7 +1531,7 @@ static int dn_route_input(struct sk_buff *skb)
 
        rcu_read_lock();
        for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL;
-           rt = rcu_dereference(rt->dst.dn_next)) {
+           rt = rcu_dereference(rt->dn_next)) {
                if ((rt->fld.saddr == cb->src) &&
                    (rt->fld.daddr == cb->dst) &&
                    (rt->fld.flowidn_oif == 0) &&
@@ -1749,7 +1751,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
                rcu_read_lock_bh();
                for(rt = rcu_dereference_bh(dn_rt_hash_table[h].chain), idx = 0;
                        rt;
-                       rt = rcu_dereference_bh(rt->dst.dn_next), idx++) {
+                       rt = rcu_dereference_bh(rt->dn_next), idx++) {
                        if (idx < s_idx)
                                continue;
                        skb_dst_set(skb, dst_clone(&rt->dst));
@@ -1795,7 +1797,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou
 {
        struct dn_rt_cache_iter_state *s = seq->private;
 
-       rt = rcu_dereference_bh(rt->dst.dn_next);
+       rt = rcu_dereference_bh(rt->dn_next);
        while (!rt) {
                rcu_read_unlock_bh();
                if (--s->bucket < 0)