Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: roy.qing.li@gmail.com
Cc: netdev@vger.kernel.org, edumazet@google.com
Subject: Re: [PATCH net-next] core: adjust checks for calling skb_copy_bits in skb_try_coalesce
Date: Thu, 20 Sep 2012 07:20:17 +0200	[thread overview]
Message-ID: <1348118417.31352.52.camel@edumazet-glaptop> (raw)
In-Reply-To: <1348111182-6827-1-git-send-email-roy.qing.li@gmail.com>

On Thu, 2012-09-20 at 11:19 +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> Ensure that frags and frags_list of dst skb are empty if need to call
> skb_copy_bits, or else it will break the data sequence.
> 
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> ---
>  net/core/skbuff.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index fe00d12..f0b9446 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -3455,15 +3455,15 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
>  	if (skb_cloned(to))
>  		return false;
>  
> -	if (len <= skb_tailroom(to)) {
> +	if (skb_has_frag_list(to) || skb_has_frag_list(from))
> +		return false;
> +
> +	if (len <= skb_tailroom(to) && !skb_shinfo(to)->nr_frags) {
>  		BUG_ON(skb_copy_bits(from, 0, skb_put(to, len), len));
>  		*delta_truesize = 0;
>  		return true;
>  	}
>  
> -	if (skb_has_frag_list(to) || skb_has_frag_list(from))
> -		return false;
> -
>  	if (skb_headlen(from) != 0) {
>  		struct page *page;
>  		unsigned int offset;

This is not needed at all.

  reply	other threads:[~2012-09-20  5:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-20  3:19 [PATCH net-next] core: adjust checks for calling skb_copy_bits in skb_try_coalesce roy.qing.li
2012-09-20  5:20 ` Eric Dumazet [this message]
2012-09-20  5:40   ` RongQing Li
2012-09-20  5:53     ` Eric Dumazet
2012-09-20  5:57       ` RongQing Li
2012-09-20  7:00         ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348118417.31352.52.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=roy.qing.li@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox