Re: [PATCH] net: increase skb->users instead of skb_clone()

Junchang Wang
2010-12-16T14:05:03Z

On Thu, Dec 16, 2010 at 1:57 PM, Changli Gao <xiaosuo@gmail.com> wrote:
> In dev_queue_xmit_nit(), we have to clone skbs as we need to mangle skbs,
> however, we don't need to clone skbs for all the packet_types.
>
> Except for the first packet_type, we increase skb->users instead of
> skb_clone().

Hi Changli,
Take af_packet for example, I can't see benefit from this patch.

> +static inline int deliver_skb(struct sk_buff *skb,
> +                             struct packet_type *pt_prev,
> +                             struct net_device *orig_dev)
> +{
> +       atomic_inc(&skb->users);
> +       return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
> +}
The increment call will incur skb_shared() failure in packet_rcv.
In reality, packet_rcv has to clone this packet by itself.

Thanks

--
--Junchang