netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Octavian Purdila <opurdila@ixiacom.com>
Cc: netdev@vger.kernel.org
Subject: Re: [RESEND] [PATCH] tcp: fix for splice receive when used with software LRO
Date: Fri, 20 Jun 2008 06:37:06 +0000	[thread overview]
Message-ID: <20080620063706.GA4009@ff.dom.local> (raw)
In-Reply-To: <200806181907.16584.opurdila@ixiacom.com>

On 18-06-2008 18:07, Octavian Purdila wrote:
...
>     tcp: fix for splice receive when used with software LRO
>     
>     If an skb has nr_frags set to zero but its frag_list is not empty (as
>     it can happen if software LRO is enabled), and a previous
>     tcp_read_sock has consumed the linear part of the skb, then
>     __skb_splice_bits:
>     
>     (a) incorrectly reports an error and
>     
>     (b) forgets to update the offset to account for the linear part
>     
>     Any of the two problems will cause the subsequent __skb_splice_bits
>     call (the one that handles the frag_list skbs) to either skip data,
>     or, if the unadjusted offset is greater then the size of the next skb
>     in the frag_list, make tcp_splice_read loop forever.
>     
>     Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
> 
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 874790b..27cb0d3 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -1198,12 +1198,14 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
>  {
>  	unsigned int nr_pages = spd->nr_pages;
>  	unsigned int poff, plen, len, toff, tlen;
> -	int headlen, seg;
> +	int headlen, seg, error = 0;
>  
>  	toff = *offset;
>  	tlen = *total_len;
> -	if (!tlen)
> +	if (!tlen) {
> +		error = 1;
>  		goto err;
> +	}
>  
>  	/*
>  	 * if the offset is greater than the linear part, go directly to
> @@ -1245,7 +1247,8 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
>  		 * just jump directly to update and return, no point
>  		 * in going over fragments when the output is full.
>  		 */
> -		if (spd_fill_page(spd, virt_to_page(p), plen, poff, skb))
> +		error = spd_fill_page(spd, virt_to_page(p), plen, poff, skb);
> +		if (error)
>  			goto done;
>  
>  		tlen -= plen;
> @@ -1278,7 +1281,8 @@ map_frag:
>  		if (!plen)
>  			break;
>  
> -		if (spd_fill_page(spd, f->page, plen, poff, skb))
> +		error = spd_fill_page(spd, f->page, plen, poff, skb);
> +		if (error)
>  			break;

Hi,

This patch looks fine to me, but I wonder if, btw., this place can't
be optimized a bit, so why can't we simply:

	if (spd_fill_page(spd, f->page, plen, poff, skb))
		goto err;

in both cases, since nothing more can't be filled after this?

Regards,
Jarek P.

  reply	other threads:[~2008-06-20  6:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <485B4ADE.8070102@domat.com.pl>
2008-06-18 16:07 ` [RESEND] [PATCH] tcp: fix for splice receive when used with software LRO Octavian Purdila
2008-06-20  6:37   ` Jarek Poplawski [this message]
2008-06-20 10:09     ` Octavian Purdila
2008-06-20 11:01       ` Jarek Poplawski
2008-06-20 12:39         ` Octavian Purdila
2008-06-20 13:01           ` Jarek Poplawski
2008-06-20 20:44             ` Octavian Purdila
2008-06-22 21:07               ` Jarek Poplawski
2008-06-23  9:50                 ` Octavian Purdila
2008-06-23 20:48                   ` Jarek Poplawski
2008-06-20 21:57       ` Jarek Poplawski
2008-06-21  0:40         ` Octavian Purdila
2008-06-21  8:39           ` Jarek Poplawski
2008-06-21 10:32             ` Octavian Purdila
2008-06-28  0:27   ` David Miller

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=20080620063706.GA4009@ff.dom.local \
    --to=jarkao2@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=opurdila@ixiacom.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;
as well as URLs for NNTP newsgroup(s).