[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070515.142821.42775365.davem@davemloft.net>
Date: Tue, 15 May 2007 14:28:21 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: mchan@...adcom.com
Cc: rdreier@...co.com, ak@...e.de, krkumar2@...ibm.com,
netdev@...r.kernel.org
Subject: Re: [RFC] New driver API to speed up small packets xmits
From: "Michael Chan" <mchan@...adcom.com>
Date: Tue, 15 May 2007 15:05:28 -0700
> On Tue, 2007-05-15 at 14:08 -0700, Roland Dreier wrote:
> > > > Well, IPoIB doesn't do netif_wake_queue() until half the device's TX
> > > > queue is free, so we should get batching. However, I'm not sure that
> > > > I can count on a fudge factor ensuring that there's enough space to
> > > > handle everything skb_gso_segment() gives me -- is there any reliable
> > > > way to get an upper bound on how many segments a given gso skb will
> > > > use when it's segmented?
> > >
> > > Take a look at tg3.c. I use (gso_segs * 3) as the upper bound.
> >
> > Thanks for the pointer... I noticed that code, but could you tell me
> > where the "* 3" comes from?
> >
> For each gso_seg, there will be a header and the payload may span 2
> pages for 1500-byte packets. We always assume 1500-byte packets because
> the buggy chips do not support jumbo frames.
Correct.
I think there may be a case where you could see up to 4 segments.
If the user corks the TCP socket, does a sendmsg() (which puts
the data in the per-socket page) then does a sendfile() you'll
see something like:
skb->data IP, TCP, ethernet headers, etc.
page0 sendmsg() data
page1 sendfile
page2 sendfile
Ie. this can happen if the sendfile() part starts near the
end of a page, so it would get split even for a 1500 MTU
frame.
Even more complex variants are possible if the user does
tiny sendfile() requests to different pages within the file.
So in fact it can span up to N pages.
But there is an upper limit defined by the original GSO
frame, and that is controlled by MAX_SKB_FRAGS, so at most
you would see MAX_SKB_FRAGS plus some small constant.
-
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