aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/dn_route.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-06-02 01:19:30 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-03 05:51:04 -0400
commitadf30907d63893e4208dfe3f5c88ae12bc2f25d5 (patch)
tree0f07542bb95de2ad537540868aba6cf87a86e17d /net/decnet/dn_route.c
parent511c3f92ad5b6d9f8f6464be1b4f85f0422be91a (diff)
net: skb->dst accessors
Define three accessors to get/set dst attached to a skb struct dst_entry *skb_dst(const struct sk_buff *skb) void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) void skb_dst_drop(struct sk_buff *skb) This one should replace occurrences of : dst_release(skb->dst) skb->dst = NULL; Delete skb->dst field Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet/dn_route.c')
-rw-r--r--net/decnet/dn_route.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 0cc4394117df..1d6ca8a98dc6 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -678,7 +678,7 @@ out:
678 678
679static int dn_output(struct sk_buff *skb) 679static int dn_output(struct sk_buff *skb)
680{ 680{
681 struct dst_entry *dst = skb->dst; 681 struct dst_entry *dst = skb_dst(skb);
682 struct dn_route *rt = (struct dn_route *)dst; 682 struct dn_route *rt = (struct dn_route *)dst;
683 struct net_device *dev = dst->dev; 683 struct net_device *dev = dst->dev;
684 struct dn_skb_cb *cb = DN_SKB_CB(skb); 684 struct dn_skb_cb *cb = DN_SKB_CB(skb);
@@ -717,7 +717,7 @@ error:
717static int dn_forward(struct sk_buff *skb) 717static int dn_forward(struct sk_buff *skb)
718{ 718{
719 struct dn_skb_cb *cb = DN_SKB_CB(skb); 719 struct dn_skb_cb *cb = DN_SKB_CB(skb);
720 struct dst_entry *dst = skb->dst; 720 struct dst_entry *dst = skb_dst(skb);
721 struct dn_dev *dn_db = dst->dev->dn_ptr; 721 struct dn_dev *dn_db = dst->dev->dn_ptr;
722 struct dn_route *rt; 722 struct dn_route *rt;
723 struct neighbour *neigh = dst->neighbour; 723 struct neighbour *neigh = dst->neighbour;
@@ -730,7 +730,7 @@ static int dn_forward(struct sk_buff *skb)
730 goto drop; 730 goto drop;
731 731
732 /* Ensure that we have enough space for headers */ 732 /* Ensure that we have enough space for headers */
733 rt = (struct dn_route *)skb->dst; 733 rt = (struct dn_route *)skb_dst(skb);
734 header_len = dn_db->use_long ? 21 : 6; 734 header_len = dn_db->use_long ? 21 : 6;
735 if (skb_cow(skb, LL_RESERVED_SPACE(rt->u.dst.dev)+header_len)) 735 if (skb_cow(skb, LL_RESERVED_SPACE(rt->u.dst.dev)+header_len))
736 goto drop; 736 goto drop;
@@ -1392,7 +1392,8 @@ make_route:
1392 goto e_neighbour; 1392 goto e_neighbour;
1393 1393
1394 hash = dn_hash(rt->fl.fld_src, rt->fl.fld_dst); 1394 hash = dn_hash(rt->fl.fld_src, rt->fl.fld_dst);
1395 dn_insert_route(rt, hash, (struct dn_route **)&skb->dst); 1395 dn_insert_route(rt, hash, &rt);
1396 skb_dst_set(skb, &rt->u.dst);
1396 1397
1397done: 1398done:
1398 if (neigh) 1399 if (neigh)
@@ -1424,7 +1425,7 @@ static int dn_route_input(struct sk_buff *skb)
1424 struct dn_skb_cb *cb = DN_SKB_CB(skb); 1425 struct dn_skb_cb *cb = DN_SKB_CB(skb);
1425 unsigned hash = dn_hash(cb->src, cb->dst); 1426 unsigned hash = dn_hash(cb->src, cb->dst);
1426 1427
1427 if (skb->dst) 1428 if (skb_dst(skb))
1428 return 0; 1429 return 0;
1429 1430
1430 rcu_read_lock(); 1431 rcu_read_lock();
@@ -1437,7 +1438,7 @@ static int dn_route_input(struct sk_buff *skb)
1437 (rt->fl.iif == cb->iif)) { 1438 (rt->fl.iif == cb->iif)) {
1438 dst_use(&rt->u.dst, jiffies); 1439 dst_use(&rt->u.dst, jiffies);
1439 rcu_read_unlock(); 1440 rcu_read_unlock();
1440 skb->dst = (struct dst_entry *)rt; 1441 skb_dst_set(skb, (struct dst_entry *)rt);
1441 return 0; 1442 return 0;
1442 } 1443 }
1443 } 1444 }
@@ -1449,7 +1450,7 @@ static int dn_route_input(struct sk_buff *skb)
1449static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, 1450static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
1450 int event, int nowait, unsigned int flags) 1451 int event, int nowait, unsigned int flags)
1451{ 1452{
1452 struct dn_route *rt = (struct dn_route *)skb->dst; 1453 struct dn_route *rt = (struct dn_route *)skb_dst(skb);
1453 struct rtmsg *r; 1454 struct rtmsg *r;
1454 struct nlmsghdr *nlh; 1455 struct nlmsghdr *nlh;
1455 unsigned char *b = skb_tail_pointer(skb); 1456 unsigned char *b = skb_tail_pointer(skb);
@@ -1554,7 +1555,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
1554 err = dn_route_input(skb); 1555 err = dn_route_input(skb);
1555 local_bh_enable(); 1556 local_bh_enable();
1556 memset(cb, 0, sizeof(struct dn_skb_cb)); 1557 memset(cb, 0, sizeof(struct dn_skb_cb));
1557 rt = (struct dn_route *)skb->dst; 1558 rt = (struct dn_route *)skb_dst(skb);
1558 if (!err && -rt->u.dst.error) 1559 if (!err && -rt->u.dst.error)
1559 err = rt->u.dst.error; 1560 err = rt->u.dst.error;
1560 } else { 1561 } else {
@@ -1570,7 +1571,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
1570 skb->dev = NULL; 1571 skb->dev = NULL;
1571 if (err) 1572 if (err)
1572 goto out_free; 1573 goto out_free;
1573 skb->dst = &rt->u.dst; 1574 skb_dst_set(skb, &rt->u.dst);
1574 if (rtm->rtm_flags & RTM_F_NOTIFY) 1575 if (rtm->rtm_flags & RTM_F_NOTIFY)
1575 rt->rt_flags |= RTCF_NOTIFY; 1576 rt->rt_flags |= RTCF_NOTIFY;
1576 1577
@@ -1622,15 +1623,15 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
1622 rt = rcu_dereference(rt->u.dst.dn_next), idx++) { 1623 rt = rcu_dereference(rt->u.dst.dn_next), idx++) {
1623 if (idx < s_idx) 1624 if (idx < s_idx)
1624 continue; 1625 continue;
1625 skb->dst = dst_clone(&rt->u.dst); 1626 skb_dst_set(skb, dst_clone(&rt->u.dst));
1626 if (dn_rt_fill_info(skb, NETLINK_CB(cb->skb).pid, 1627 if (dn_rt_fill_info(skb, NETLINK_CB(cb->skb).pid,
1627 cb->nlh->nlmsg_seq, RTM_NEWROUTE, 1628 cb->nlh->nlmsg_seq, RTM_NEWROUTE,
1628 1, NLM_F_MULTI) <= 0) { 1629 1, NLM_F_MULTI) <= 0) {
1629 dst_release(xchg(&skb->dst, NULL)); 1630 skb_dst_drop(skb);
1630 rcu_read_unlock_bh(); 1631 rcu_read_unlock_bh();
1631 goto done; 1632 goto done;
1632 } 1633 }
1633 dst_release(xchg(&skb->dst, NULL)); 1634 skb_dst_drop(skb);
1634 } 1635 }
1635 rcu_read_unlock_bh(); 1636 rcu_read_unlock_bh();
1636 } 1637 }