[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54CBCE30.1000906@cogentembedded.com>
Date: Fri, 30 Jan 2015 21:32:16 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Pravin B Shelar <pshelar@...ira.com>, davem@...emloft.net
CC: netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 1/6] skbuff: Add skb_list_linearize()
Hello.
On 01/30/2015 02:29 AM, Pravin B Shelar wrote:
> similar to skb_linearize(), this API takes skb list as arg and
> linearize it into one big skb. STT driver patch will use this.
> Signed-off-by: Pravin B Shelar <pshelar@...ira.com>
[...]
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 56db472..d6358a7 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -2329,6 +2329,40 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
> }
> EXPORT_SYMBOL(skb_copy_and_csum_dev);
>
> +int skb_list_linearize(struct sk_buff *head, gfp_t gfp_mask)
> +{
> + struct sk_buff *skb;
> + int tlen = 0;
> + int err;
> +
> + err = skb_linearize(head);
> + if (err)
> + return err;
> +
> + skb = head->next;
> + while (skb) {
> + tlen += skb->len;
> + skb = skb->next;
> + }
for (skb = head->next; skb; skb = skb->next)
tlen += skb->len;
> + err = pskb_expand_head(head, 0, tlen, gfp_mask);
> + if (err)
> + return err;
> +
> + skb = head->next;
> + while (skb) {
> + err = skb_copy_bits(skb, 0, skb_tail_pointer(head), skb->len);
> + if (err)
> + return err;
> + head->tail += skb->len;
> + skb = skb->next;
> + }
Likewise, this can easily be converted into a *for* loop.
[...]
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists