aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet
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
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')
-rw-r--r--net/decnet/af_decnet.c6
-rw-r--r--net/decnet/dn_neigh.c8
-rw-r--r--net/decnet/dn_nsp_out.c6
-rw-r--r--net/decnet/dn_route.c25
4 files changed, 24 insertions, 21 deletions
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index bccb3887773e..a5e3a593e472 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -1075,6 +1075,7 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags)
1075 int err = 0; 1075 int err = 0;
1076 unsigned char type; 1076 unsigned char type;
1077 long timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK); 1077 long timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK);
1078 struct dst_entry *dst;
1078 1079
1079 lock_sock(sk); 1080 lock_sock(sk);
1080 1081
@@ -1102,8 +1103,9 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags)
1102 } 1103 }
1103 release_sock(sk); 1104 release_sock(sk);
1104 1105
1105 dst_release(xchg(&newsk->sk_dst_cache, skb->dst)); 1106 dst = skb_dst(skb);
1106 skb->dst = NULL; 1107 dst_release(xchg(&newsk->sk_dst_cache, dst));
1108 skb_dst_set(skb, NULL);
1107 1109
1108 DN_SK(newsk)->state = DN_CR; 1110 DN_SK(newsk)->state = DN_CR;
1109 DN_SK(newsk)->addrrem = cb->src_port; 1111 DN_SK(newsk)->addrrem = cb->src_port;
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
index 05b5aa05e50e..923786bd6d01 100644
--- a/net/decnet/dn_neigh.c
+++ b/net/decnet/dn_neigh.c
@@ -204,7 +204,7 @@ static void dn_short_error_report(struct neighbour *neigh, struct sk_buff *skb)
204 204
205static int dn_neigh_output_packet(struct sk_buff *skb) 205static int dn_neigh_output_packet(struct sk_buff *skb)
206{ 206{
207 struct dst_entry *dst = skb->dst; 207 struct dst_entry *dst = skb_dst(skb);
208 struct dn_route *rt = (struct dn_route *)dst; 208 struct dn_route *rt = (struct dn_route *)dst;
209 struct neighbour *neigh = dst->neighbour; 209 struct neighbour *neigh = dst->neighbour;
210 struct net_device *dev = neigh->dev; 210 struct net_device *dev = neigh->dev;
@@ -224,7 +224,7 @@ static int dn_neigh_output_packet(struct sk_buff *skb)
224 224
225static int dn_long_output(struct sk_buff *skb) 225static int dn_long_output(struct sk_buff *skb)
226{ 226{
227 struct dst_entry *dst = skb->dst; 227 struct dst_entry *dst = skb_dst(skb);
228 struct neighbour *neigh = dst->neighbour; 228 struct neighbour *neigh = dst->neighbour;
229 struct net_device *dev = neigh->dev; 229 struct net_device *dev = neigh->dev;
230 int headroom = dev->hard_header_len + sizeof(struct dn_long_packet) + 3; 230 int headroom = dev->hard_header_len + sizeof(struct dn_long_packet) + 3;
@@ -270,7 +270,7 @@ static int dn_long_output(struct sk_buff *skb)
270 270
271static int dn_short_output(struct sk_buff *skb) 271static int dn_short_output(struct sk_buff *skb)
272{ 272{
273 struct dst_entry *dst = skb->dst; 273 struct dst_entry *dst = skb_dst(skb);
274 struct neighbour *neigh = dst->neighbour; 274 struct neighbour *neigh = dst->neighbour;
275 struct net_device *dev = neigh->dev; 275 struct net_device *dev = neigh->dev;
276 int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2; 276 int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2;
@@ -313,7 +313,7 @@ static int dn_short_output(struct sk_buff *skb)
313 */ 313 */
314static int dn_phase3_output(struct sk_buff *skb) 314static int dn_phase3_output(struct sk_buff *skb)
315{ 315{
316 struct dst_entry *dst = skb->dst; 316 struct dst_entry *dst = skb_dst(skb);
317 struct neighbour *neigh = dst->neighbour; 317 struct neighbour *neigh = dst->neighbour;
318 struct net_device *dev = neigh->dev; 318 struct net_device *dev = neigh->dev;
319 int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2; 319 int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2;
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index da04f459337e..a65e929ce76c 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -85,7 +85,7 @@ static void dn_nsp_send(struct sk_buff *skb)
85 dst = sk_dst_check(sk, 0); 85 dst = sk_dst_check(sk, 0);
86 if (dst) { 86 if (dst) {
87try_again: 87try_again:
88 skb->dst = dst; 88 skb_dst_set(skb, dst);
89 dst_output(skb); 89 dst_output(skb);
90 return; 90 return;
91 } 91 }
@@ -582,7 +582,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
582 * to be able to send disc packets out which have no socket 582 * to be able to send disc packets out which have no socket
583 * associations. 583 * associations.
584 */ 584 */
585 skb->dst = dst_clone(dst); 585 skb_dst_set(skb, dst_clone(dst));
586 dst_output(skb); 586 dst_output(skb);
587} 587}
588 588
@@ -611,7 +611,7 @@ void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg,
611 int ddl = 0; 611 int ddl = 0;
612 gfp_t gfp = GFP_ATOMIC; 612 gfp_t gfp = GFP_ATOMIC;
613 613
614 dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl, 614 dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb_dst(skb), ddl,
615 NULL, cb->src_port, cb->dst_port); 615 NULL, cb->src_port, cb->dst_port);
616} 616}
617 617
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 }