diff options
author | Julian Anastasov <ja@ssi.bg> | 2013-03-21 05:57:58 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-04-01 18:22:53 -0400 |
commit | 932bc4d7a53ba418de67fdab533248df5b36c752 (patch) | |
tree | 19747cdef824180014d98baf8959757d0bae1198 /include/linux/skbuff.h | |
parent | e5c5d22e8dcf7c2d430336cbf8e180bd38e8daf1 (diff) |
net: add skb_dst_set_noref_force
Rename skb_dst_set_noref to __skb_dst_set_noref and
add force flag as suggested by David Miller. The new wrapper
skb_dst_set_noref_force will force dst entries that are not
cached to be attached as skb dst without taking reference
as long as provided dst is reclaimed after RCU grace period.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off by: Hans Schillstrom <hans@schillstrom.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 878e0ee81068..364e2440a7ee 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -575,7 +575,40 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) | |||
575 | skb->_skb_refdst = (unsigned long)dst; | 575 | skb->_skb_refdst = (unsigned long)dst; |
576 | } | 576 | } |
577 | 577 | ||
578 | extern void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst); | 578 | extern void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst, |
579 | bool force); | ||
580 | |||
581 | /** | ||
582 | * skb_dst_set_noref - sets skb dst, hopefully, without taking reference | ||
583 | * @skb: buffer | ||
584 | * @dst: dst entry | ||
585 | * | ||
586 | * Sets skb dst, assuming a reference was not taken on dst. | ||
587 | * If dst entry is cached, we do not take reference and dst_release | ||
588 | * will be avoided by refdst_drop. If dst entry is not cached, we take | ||
589 | * reference, so that last dst_release can destroy the dst immediately. | ||
590 | */ | ||
591 | static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst) | ||
592 | { | ||
593 | __skb_dst_set_noref(skb, dst, false); | ||
594 | } | ||
595 | |||
596 | /** | ||
597 | * skb_dst_set_noref_force - sets skb dst, without taking reference | ||
598 | * @skb: buffer | ||
599 | * @dst: dst entry | ||
600 | * | ||
601 | * Sets skb dst, assuming a reference was not taken on dst. | ||
602 | * No reference is taken and no dst_release will be called. While for | ||
603 | * cached dsts deferred reclaim is a basic feature, for entries that are | ||
604 | * not cached it is caller's job to guarantee that last dst_release for | ||
605 | * provided dst happens when nobody uses it, eg. after a RCU grace period. | ||
606 | */ | ||
607 | static inline void skb_dst_set_noref_force(struct sk_buff *skb, | ||
608 | struct dst_entry *dst) | ||
609 | { | ||
610 | __skb_dst_set_noref(skb, dst, true); | ||
611 | } | ||
579 | 612 | ||
580 | /** | 613 | /** |
581 | * skb_dst_is_noref - Test if skb dst isn't refcounted | 614 | * skb_dst_is_noref - Test if skb dst isn't refcounted |