From: Lennert Buytenhek <buytenh@wantstofly.org>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, akarkare@marvell.com, nico@cam.org,
herbert@gondor.apana.org.au
Subject: Re: using software TSO on non-TSO capable netdevices
Date: Thu, 31 Jul 2008 03:45:06 +0200 [thread overview]
Message-ID: <20080731014506.GA23402@xi.wantstofly.org> (raw)
In-Reply-To: <20080730.181047.39922732.davem@davemloft.net>
On Wed, Jul 30, 2008 at 06:10:47PM -0700, David Miller wrote:
> > The hacky patch below (on top of 2.6.27-rc1 + stubbing out the
> > sk_can_gso() check) reduces the 1 GiB 1000 Mb/s sendfile test from:
> ...
> > I.e. dramatic CPU time improvements, and some overall speedup as well.
> >
> > I wonder if something like this can be done in a less hacky fashion --
> > the hard part I guess is deciding when to keep coalescing (to reduce
> > CPU overhead) vs. when to push out what has been coalesced so far (in
> > order to keep the pipe filled), and I'm not sure I have good ideas
> > about how to make that decision.
>
> Interesting, I'll take a closer look at this.
>
> Actually your patch is less of a surprise, because one of the issues I
> had to surmount constantly when rewriting the TSO output path was the
> implicit conflict between TSO deferral (to accumulate segments) and
> the nagle logic.
>
> Anyways, thanks, I'll think about this patch and your data and see
> where we can go with that part.
>
> In the mean time could you possibly cook up a cleaned up "use software
> GSO for SG+CSUM capable devices" patch? I think I want to apply it,
> especially since all of the things Herbert and I have suspected is
> completely confirmed by your data and tests.
OK, how about:
From: Lennert Buytenhek <buytenh@wantstofly.org>
Subject: [NET] use software GSO for SG+CSUM capable netdevices
If a netdevice does not support hardware GSO, allowing the stack to
use GSO anyway and then splitting the GSO skb into MSS-sized pieces
as it is handed to the netdevice for transmitting is likely still
a win at least as far as CPU usage is concerned, since it reduces
the number of trips through the output path.
This patch enables the use of GSO on any netdevice that supports SG
and hardware checksumming. If a GSO skb is then sent to a netdevice
that supports SG and checksumming but does not support hardware GSO,
net/core/dev.c:dev_hard_start_xmit() will take care of doing the
necessary GSO segmentation in software.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Index: linux-2.6.27-rc1/include/net/sock.h
===================================================================
--- linux-2.6.27-rc1.orig/include/net/sock.h
+++ linux-2.6.27-rc1/include/net/sock.h
@@ -1085,7 +1085,13 @@ extern struct dst_entry *sk_dst_check(st
static inline int sk_can_gso(const struct sock *sk)
{
- return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
+ int caps = sk->sk_route_caps;
+ int type = sk->sk_gso_type;
+
+ return (caps & NETIF_F_SG) &&
+ (((type == SKB_GSO_TCPV4 || type == SKB_GSO_UDP) &&
+ (caps & NETIF_F_V4_CSUM)) ||
+ (type == SKB_GSO_TCPV6 && (caps & NETIF_F_V6_CSUM)));
}
extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
next prev parent reply other threads:[~2008-07-31 1:45 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-30 23:50 using software TSO on non-TSO capable netdevices Lennert Buytenhek
2008-07-30 23:56 ` David Miller
2008-07-31 0:41 ` Lennert Buytenhek
2008-07-31 1:10 ` David Miller
2008-07-31 1:45 ` Lennert Buytenhek [this message]
2008-07-31 3:54 ` Herbert Xu
2008-07-31 9:45 ` Lennert Buytenhek
2008-07-31 10:55 ` Herbert Xu
2008-07-31 12:37 ` Lennert Buytenhek
2008-07-31 12:59 ` Herbert Xu
2008-08-03 8:23 ` David Miller
2008-07-31 7:34 ` Ilpo Järvinen
2008-07-31 9:50 ` Lennert Buytenhek
2008-07-31 10:27 ` Ilpo Järvinen
2008-07-31 2:29 ` Herbert Xu
2008-07-31 2:36 ` Lennert Buytenhek
2008-07-31 3:03 ` Herbert Xu
2008-07-31 6:55 ` Ilpo Järvinen
2008-07-31 9:39 ` Lennert Buytenhek
2008-07-31 10:14 ` Lennert Buytenhek
2008-07-31 10:16 ` David Miller
2008-07-31 12:25 ` Lennert Buytenhek
2008-07-31 12:35 ` David Miller
2008-07-31 13:19 ` Ben Hutchings
2008-07-31 13:27 ` Herbert Xu
2008-08-03 8:19 ` David Miller
2008-08-03 8:55 ` Herbert Xu
2008-08-07 6:07 ` David Miller
2008-08-07 6:15 ` Herbert Xu
2008-09-12 4:08 ` David Miller
2008-08-07 11:50 ` Lennert Buytenhek
2008-08-07 20:32 ` Rick Jones
2008-08-07 22:44 ` David Miller
2008-07-31 17:00 ` Rick Jones
2008-07-31 17:45 ` Lennert Buytenhek
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=20080731014506.GA23402@xi.wantstofly.org \
--to=buytenh@wantstofly.org \
--cc=akarkare@marvell.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
--cc=nico@cam.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 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).