netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: kuznet@ms2.inr.ac.ru
Cc: ilpo.jarvinen@helsinki.fi, eric.dumazet@gmail.com,
	leandroal@gmail.com, netdev@vger.kernel.org
Subject: Re: TCP packet size and delivery packet decisions
Date: Sun, 12 Sep 2010 18:23:08 -0700 (PDT)	[thread overview]
Message-ID: <20100912.182308.71115181.davem@davemloft.net> (raw)
In-Reply-To: <20100908121450.GA11412@ms2.inr.ac.ru>

From: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Date: Wed, 8 Sep 2010 16:14:50 +0400

> I do not know actual context, of course. I can guess the situation
> can be like this: "I set window=mss exactly to see only one packet in flight
> all the times. Why the hell linux tries to send two mss/2 sized?" :-)

The context is that a very stupid embedded device takes commands that
are all some specific size (I think it was 75 bytes), and it's
TCP stack sets MSS and window to exactly 75 bytes.

Device will only process the commands sent to it over TCP properly
if they are sent full sized, 75 bytes, by the sending TCP stack.
Linux is the only stack with which the device will not work.

To be honest, at such tiny MSS and window sizes, such packetization
for the sake of SWS done by us is stupid.

Let's be a little bit postmodern and just turn off this stuff using
perhaps a modified version of your idea #1, elide the SWS "window / 2"
logic when "max_window >= 512" or something like that.

It seems to handle every angle:

1) Huge MTU (>= 65535) devices are still covered.

2) For sane ethernet derived MSS and normal large window
   behavior stays the same.

3) When speaking to devices using super tiny windows, it is
   apparent that loss recovery performance is not their primary
   concern. :-)

Therefore, how about the following?

diff --git a/include/net/tcp.h b/include/net/tcp.h
index eaa9582..f8744e0 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -475,7 +475,15 @@ extern unsigned int tcp_current_mss(struct sock *sk);
 /* Bound MSS / TSO packet size with the half of the window */
 static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
 {
-	if (tp->max_window && pktsize > (tp->max_window >> 1))
+	/* When peer uses tiny windows, there is no use in packetizing
+	 * to sub-MSS pieces for the sake of SWS or making sure there
+	 * are enough packets in the pipe for fast recovery.
+	 *
+	 * On the other hand, for extremely large MSS devices, handling
+	 * smaller than MSS windows in this way does make sense.
+	 */
+	if (tp->max_window >= 512 &&
+	    pktsize > (tp->max_window >> 1))
 		return max(tp->max_window >> 1, 68U - tp->tcp_header_len);
 	else
 		return pktsize;

  reply	other threads:[~2010-09-13  1:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTi=_heUejVf-wmEcKd910gVtpD7Hr=cZ_cs2Q8n9@mail.gmail.com>
2010-09-07  4:20 ` TCP packet size and delivery packet decisions ツ Leandro Melo de Sales
2010-09-07  4:36   ` Eric Dumazet
2010-09-07  5:13     ` ツ Leandro Melo de Sales
2010-09-07  5:16       ` David Miller
2010-09-07  5:21         ` ツ Leandro Melo de Sales
2010-09-07  5:30           ` David Miller
2010-09-07  6:02             ` ツ Leandro Melo de Sales
2010-09-07  6:09               ` Eric Dumazet
2010-09-07  7:16                 ` ツ Leandro Melo de Sales
2010-09-07  7:32                   ` Eric Dumazet
2010-09-08 14:01                     ` ツ Leandro Melo de Sales
2010-09-07 11:39             ` Eric Dumazet
2010-09-07 12:15               ` Ilpo Järvinen
2010-09-08  3:18                 ` David Miller
2010-09-08 12:14                   ` Alexey Kuznetsov
2010-09-13  1:23                     ` David Miller [this message]
2010-09-14  9:37                       ` Alexey Kuznetsov
2010-09-15 17:29                         ` David Miller
2010-09-07 16:35               ` David Miller
2010-09-07 16:57               ` Rick Jones
2010-09-08 14:06               ` ツ Leandro Melo de Sales
2010-09-08 15:24                 ` David Miller
2010-09-08 16:03                   ` ツ Leandro Melo de Sales

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=20100912.182308.71115181.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=ilpo.jarvinen@helsinki.fi \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=leandroal@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 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).