All of lore.kernel.org
 help / color / mirror / Atom feed
From: Octavian Purdila <opurdila@ixiacom.com>
To: Jarek Poplawski <jarkao2@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [RESEND] [PATCH] tcp: fix for splice receive when used with software LRO
Date: Sat, 21 Jun 2008 03:40:48 +0300	[thread overview]
Message-ID: <200806210340.48479.opurdila@ixiacom.com> (raw)
In-Reply-To: <485C27C0.9070005@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 764 bytes --]

On Saturday 21 June 2008, Jarek Poplawski wrote:

> Octavian, since these readability changes later in this thread are quite
> substantial, my proposal is to separate them from this bug fix. I'll need
> more time to check them, but they are probably rather for net-next, while
> the bug fix could probably make to current. If you agree with this try to
> resend this once more as a new thread with David in To or Cc (and maybe
> re-diff this to more current tree). You can add my ack below if you like.
>

Yes, I completely agree. Here is yet another patch which incorporates your 
earlier suggestions, hope I get them right. Minimally tested, rediffed to 
current net-2.6. I'll send this one to David once you acked it.

Thanks for the shepherding :) ,
tavi






[-- Attachment #2: z --]
[-- Type: text/x-diff, Size: 1883 bytes --]

commit 41f5beb8a6e12e0c2588aee82ba68c46baf9d5f2
Author: Octavian Purdila <opurdila@ixiacom.com>
Date:   Sat Jun 21 03:17:10 2008 +0300

    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 1e556d3..d912982 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1290,7 +1290,6 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
 			     unsigned int *total_len,
 			     struct splice_pipe_desc *spd)
 {
-	unsigned int nr_pages = spd->nr_pages;
 	unsigned int poff, plen, len, toff, tlen;
 	int headlen, seg;
 
@@ -1340,7 +1339,7 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
 		 * in going over fragments when the output is full.
 		 */
 		if (spd_fill_page(spd, virt_to_page(p), plen, poff, skb))
-			goto done;
+			goto err;
 
 		tlen -= plen;
 	}
@@ -1370,17 +1369,15 @@ map_frag:
 			break;
 
 		if (spd_fill_page(spd, f->page, plen, poff, skb))
-			break;
+			goto err;
 
 		tlen -= plen;
 	}
 
-done:
-	if (spd->nr_pages - nr_pages) {
-		*offset = 0;
-		*total_len = tlen;
-		return 0;
-	}
+	*offset = toff;
+	*total_len = tlen;
+
+	return 0;
 err:
 	return 1;
 }

  reply	other threads:[~2008-06-21  0:42 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
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 [this message]
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=200806210340.48479.opurdila@ixiacom.com \
    --to=opurdila@ixiacom.com \
    --cc=jarkao2@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.