[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090118.221603.177818343.davem@davemloft.net>
Date: Sun, 18 Jan 2009 22:16:03 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: herbert@...dor.apana.org.au
Cc: w@....eu, jarkao2@...il.com, zbr@...emap.net, dada1@...mosbay.com,
ben@...s.com, mingo@...e.hu, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, jens.axboe@...cle.com
Subject: Re: [PATCH] tcp: splice as many packets as possible at once
From: David Miller <davem@...emloft.net>
Date: Thu, 15 Jan 2009 15:34:49 -0800 (PST)
> From: Herbert Xu <herbert@...dor.apana.org.au>
> Date: Fri, 16 Jan 2009 10:32:05 +1100
>
> > On Thu, Jan 15, 2009 at 03:26:08PM -0800, David Miller wrote:
> > > +static inline struct page *linear_to_page(struct page *page, unsigned int len,
> > > + unsigned int offset)
> > > +{
> > > + struct page *p = alloc_pages(GFP_KERNEL, 0);
> > > +
> > > + if (!p)
> > > + return NULL;
> > > + memcpy(page_address(p) + offset, page_address(page) + offset, len);
> >
> > This won't work very well if skb->head is longer than a page.
> >
> > We'll need to divide it up into individual pages.
>
> Oh yes the same bug I pointed out the other day.
>
> But Willy can test this patch as-is, since he is not using
> jumbo frames in linear SKBs.
Actually, Herbert, it turns out this case should be OK.
Look a level or two higher, at __splice_segment(), it even has a
comment :-)
--------------------
do {
unsigned int flen = min(*len, plen);
/* the linear region may spread across several pages */
flen = min_t(unsigned int, flen, PAGE_SIZE - poff);
if (spd_fill_page(spd, page, flen, poff, skb, linear))
return 1;
__segment_seek(&page, &poff, &plen, flen);
*len -= flen;
} while (*len && plen);
--------------------
That code should work and do what we need.
--
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