aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
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/core
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/core')
-rw-r--r--net/core/dev.c7
-rw-r--r--net/core/neighbour.c11
-rw-r--r--net/core/skbuff.c4
3 files changed, 10 insertions, 12 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index e2fcc5f10177..34b49a6a22fd 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1693,10 +1693,9 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
1693 * If device doesnt need skb->dst, release it right now while 1693 * If device doesnt need skb->dst, release it right now while
1694 * its hot in this cpu cache 1694 * its hot in this cpu cache
1695 */ 1695 */
1696 if ((dev->priv_flags & IFF_XMIT_DST_RELEASE) && skb->dst) { 1696 if (dev->priv_flags & IFF_XMIT_DST_RELEASE)
1697 dst_release(skb->dst); 1697 skb_dst_drop(skb);
1698 skb->dst = NULL; 1698
1699 }
1700 rc = ops->ndo_start_xmit(skb, dev); 1699 rc = ops->ndo_start_xmit(skb, dev);
1701 if (rc == 0) 1700 if (rc == 0)
1702 txq_trans_update(txq); 1701 txq_trans_update(txq);
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index a1cbce7fdae5..c54229befcfe 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1088,8 +1088,8 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
1088 struct neighbour *n1 = neigh; 1088 struct neighbour *n1 = neigh;
1089 write_unlock_bh(&neigh->lock); 1089 write_unlock_bh(&neigh->lock);
1090 /* On shaper/eql skb->dst->neighbour != neigh :( */ 1090 /* On shaper/eql skb->dst->neighbour != neigh :( */
1091 if (skb->dst && skb->dst->neighbour) 1091 if (skb_dst(skb) && skb_dst(skb)->neighbour)
1092 n1 = skb->dst->neighbour; 1092 n1 = skb_dst(skb)->neighbour;
1093 n1->output(skb); 1093 n1->output(skb);
1094 write_lock_bh(&neigh->lock); 1094 write_lock_bh(&neigh->lock);
1095 } 1095 }
@@ -1182,7 +1182,7 @@ EXPORT_SYMBOL(neigh_compat_output);
1182 1182
1183int neigh_resolve_output(struct sk_buff *skb) 1183int neigh_resolve_output(struct sk_buff *skb)
1184{ 1184{
1185 struct dst_entry *dst = skb->dst; 1185 struct dst_entry *dst = skb_dst(skb);
1186 struct neighbour *neigh; 1186 struct neighbour *neigh;
1187 int rc = 0; 1187 int rc = 0;
1188 1188
@@ -1229,7 +1229,7 @@ EXPORT_SYMBOL(neigh_resolve_output);
1229int neigh_connected_output(struct sk_buff *skb) 1229int neigh_connected_output(struct sk_buff *skb)
1230{ 1230{
1231 int err; 1231 int err;
1232 struct dst_entry *dst = skb->dst; 1232 struct dst_entry *dst = skb_dst(skb);
1233 struct neighbour *neigh = dst->neighbour; 1233 struct neighbour *neigh = dst->neighbour;
1234 struct net_device *dev = neigh->dev; 1234 struct net_device *dev = neigh->dev;
1235 1235
@@ -1298,8 +1298,7 @@ void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
1298 if (time_before(tbl->proxy_timer.expires, sched_next)) 1298 if (time_before(tbl->proxy_timer.expires, sched_next))
1299 sched_next = tbl->proxy_timer.expires; 1299 sched_next = tbl->proxy_timer.expires;
1300 } 1300 }
1301 dst_release(skb->dst); 1301 skb_dst_drop(skb);
1302 skb->dst = NULL;
1303 dev_hold(skb->dev); 1302 dev_hold(skb->dev);
1304 __skb_queue_tail(&tbl->proxy_queue, skb); 1303 __skb_queue_tail(&tbl->proxy_queue, skb);
1305 mod_timer(&tbl->proxy_timer, sched_next); 1304 mod_timer(&tbl->proxy_timer, sched_next);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 8e815e685f28..6adf19ec95cc 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -381,7 +381,7 @@ static void kfree_skbmem(struct sk_buff *skb)
381 381
382static void skb_release_head_state(struct sk_buff *skb) 382static void skb_release_head_state(struct sk_buff *skb)
383{ 383{
384 dst_release(skb->dst); 384 skb_dst_drop(skb);
385#ifdef CONFIG_XFRM 385#ifdef CONFIG_XFRM
386 secpath_put(skb->sp); 386 secpath_put(skb->sp);
387#endif 387#endif
@@ -521,7 +521,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
521 new->transport_header = old->transport_header; 521 new->transport_header = old->transport_header;
522 new->network_header = old->network_header; 522 new->network_header = old->network_header;
523 new->mac_header = old->mac_header; 523 new->mac_header = old->mac_header;
524 new->dst = dst_clone(old->dst); 524 skb_dst_set(new, dst_clone(skb_dst(old)));
525#ifdef CONFIG_XFRM 525#ifdef CONFIG_XFRM
526 new->sp = secpath_get(old->sp); 526 new->sp = secpath_get(old->sp);
527#endif 527#endif