aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/dn_route.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-07-18 02:09:49 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-18 02:11:35 -0400
commit69cce1d1404968f78b177a0314f5822d5afdbbfb (patch)
tree26223264fd69ea8078d0013fd5a76eb7aeb04c12 /net/decnet/dn_route.c
parent9cbb7ecbcff85077bb12301aaf4c9b5a56c5993d (diff)
net: Abstract dst->neighbour accesses behind helpers.
dst_{get,set}_neighbour() Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet/dn_route.c')
-rw-r--r--net/decnet/dn_route.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 3b6400d17dc2..9bd45fcb3b8e 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -241,9 +241,11 @@ static int dn_dst_gc(struct dst_ops *ops)
241 */ 241 */
242static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu) 242static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu)
243{ 243{
244 struct neighbour *n = dst_get_neighbour(dst);
244 u32 min_mtu = 230; 245 u32 min_mtu = 230;
245 struct dn_dev *dn = dst->neighbour ? 246 struct dn_dev *dn;
246 rcu_dereference_raw(dst->neighbour->dev->dn_ptr) : NULL; 247
248 dn = n ? rcu_dereference_raw(n->dev->dn_ptr) : NULL;
247 249
248 if (dn && dn->use_long == 0) 250 if (dn && dn->use_long == 0)
249 min_mtu -= 6; 251 min_mtu -= 6;
@@ -708,7 +710,7 @@ out:
708static int dn_to_neigh_output(struct sk_buff *skb) 710static int dn_to_neigh_output(struct sk_buff *skb)
709{ 711{
710 struct dst_entry *dst = skb_dst(skb); 712 struct dst_entry *dst = skb_dst(skb);
711 struct neighbour *n = dst->neighbour; 713 struct neighbour *n = dst_get_neighbour(dst);
712 714
713 return n->output(n, skb); 715 return n->output(n, skb);
714} 716}
@@ -723,7 +725,7 @@ static int dn_output(struct sk_buff *skb)
723 725
724 int err = -EINVAL; 726 int err = -EINVAL;
725 727
726 if ((neigh = dst->neighbour) == NULL) 728 if ((neigh = dst_get_neighbour(dst)) == NULL)
727 goto error; 729 goto error;
728 730
729 skb->dev = dev; 731 skb->dev = dev;
@@ -840,11 +842,11 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res)
840 } 842 }
841 rt->rt_type = res->type; 843 rt->rt_type = res->type;
842 844
843 if (dev != NULL && rt->dst.neighbour == NULL) { 845 if (dev != NULL && dst_get_neighbour(&rt->dst) == NULL) {
844 n = __neigh_lookup_errno(&dn_neigh_table, &rt->rt_gateway, dev); 846 n = __neigh_lookup_errno(&dn_neigh_table, &rt->rt_gateway, dev);
845 if (IS_ERR(n)) 847 if (IS_ERR(n))
846 return PTR_ERR(n); 848 return PTR_ERR(n);
847 rt->dst.neighbour = n; 849 dst_set_neighbour(&rt->dst, n);
848 } 850 }
849 851
850 if (dst_metric(&rt->dst, RTAX_MTU) > rt->dst.dev->mtu) 852 if (dst_metric(&rt->dst, RTAX_MTU) > rt->dst.dev->mtu)
@@ -1151,7 +1153,7 @@ make_route:
1151 rt->rt_dst_map = fld.daddr; 1153 rt->rt_dst_map = fld.daddr;
1152 rt->rt_src_map = fld.saddr; 1154 rt->rt_src_map = fld.saddr;
1153 1155
1154 rt->dst.neighbour = neigh; 1156 dst_set_neighbour(&rt->dst, neigh);
1155 neigh = NULL; 1157 neigh = NULL;
1156 1158
1157 rt->dst.lastuse = jiffies; 1159 rt->dst.lastuse = jiffies;
@@ -1423,7 +1425,7 @@ make_route:
1423 rt->fld.flowidn_iif = in_dev->ifindex; 1425 rt->fld.flowidn_iif = in_dev->ifindex;
1424 rt->fld.flowidn_mark = fld.flowidn_mark; 1426 rt->fld.flowidn_mark = fld.flowidn_mark;
1425 1427
1426 rt->dst.neighbour = neigh; 1428 dst_set_neighbour(&rt->dst, neigh);
1427 rt->dst.lastuse = jiffies; 1429 rt->dst.lastuse = jiffies;
1428 rt->dst.output = dn_rt_bug; 1430 rt->dst.output = dn_rt_bug;
1429 switch (res.type) { 1431 switch (res.type) {