On Wed, 2013-06-12 at 22:40 +1000, Dave Wiltshire wrote: > In a few different drivers there is a check of (skb_cloned && > !skb_clone_writable) before then using pskb_expand_head to copy the skb > if that is required. There are already some skb_cow_* functions for > other conditions, so added this one and changed the call sites. > > Signed-off-by: Dave Wiltshire <david.wiltshire@xxxxxxx> > --- > include/linux/skbuff.h | 14 ++++++++++++++ > net/core/dev.c | 8 ++------ > net/openvswitch/actions.c | 22 +++++++--------------- > net/sched/act_csum.c | 8 ++------ > net/sched/act_nat.c | 18 +++++------------- > 5 files changed, 30 insertions(+), 40 deletions(-) > > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > index a7393ad..7d18541 100644 > --- a/include/linux/skbuff.h > +++ b/include/linux/skbuff.h > @@ -2154,6 +2154,20 @@ static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom) > } > > /** > + * skb_cow_clone_head This is a missing a short description after the name. Ben. > + * @skb: buffer to cow > + * @len: length up to which to write > + * > + * This function is identical to skb_cow and sb_cow_head except that we > + * replace the skb_cloned check by skb_cloned && !skb_clone_writable. > + * > + */ > +static inline int skb_cow_clone_head(struct sk_buff *skb, unsigned int len) > +{ > + return __skb_cow(skb, 0, skb_cloned(skb) && !skb_clone_writable(skb, len)); > +} [...] -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html