netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@redhat.com>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: netdev@oss.sgi.com
Subject: Re: [PATCH] unclamp tcp receive window if doing dynamic receive sizing
Date: Thu, 10 Jun 2004 21:54:12 -0700	[thread overview]
Message-ID: <20040610215412.09f0a457.davem@redhat.com> (raw)
In-Reply-To: <20040607133056.5ab9e72d@dell_ss3.pdx.osdl.net>


As a followup I've put the following into my tree after discussing
some things with Stephen.  He will do some of his tests to make
sure this fixes things as it should.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/06/10 21:53:15-07:00 davem@nuts.davemloft.net 
#   [TCP]: Receive buffer moderation fixes.
#   
#   1) Make window clamp follow receive buffer growth so it
#      does not limit window advertisements.  Noticed by John
#      Heffner and Stephen Hemminger.
#   2) Fix rcvmem calculation such that tcp_adv_win_scale is
#      taken into account.
# 
# net/ipv4/tcp_input.c
#   2004/06/10 21:52:43-07:00 davem@nuts.davemloft.net +9 -1
#   [TCP]: Receive buffer moderation fixes.
#   
#   1) Make window clamp follow receive buffer growth so it
#      does not limit window advertisements.  Noticed by John
#      Heffner and Stephen Hemminger.
#   
#   2) Fix rcvmem calculation such that tcp_adv_win_scale is
#      taken into account.
# 
diff -Nru a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
--- a/net/ipv4/tcp_input.c	2004-06-10 21:55:14 -07:00
+++ b/net/ipv4/tcp_input.c	2004-06-10 21:55:14 -07:00
@@ -463,6 +463,8 @@
 		tp->rcvq_space.space = space;
 
 		if (sysctl_tcp_moderate_rcvbuf) {
+			int new_clamp = space;
+
 			/* Receive space grows, normalize in order to
 			 * take into account packet headers and sk_buff
 			 * structure overhead.
@@ -472,10 +474,16 @@
 				space = 1;
 			rcvmem = (tp->advmss + MAX_TCP_HEADER +
 				  16 + sizeof(struct sk_buff));
+			while (tcp_win_from_space(rcvmem) < tp->advmss)
+				rcvmem += 128;
 			space *= rcvmem;
 			space = min(space, sysctl_tcp_rmem[2]);
-			if (space > sk->sk_rcvbuf)
+			if (space > sk->sk_rcvbuf) {
 				sk->sk_rcvbuf = space;
+
+				/* Make the window clamp follow along.  */
+				tp->window_clamp = new_clamp;
+			}
 		}
 	}
 	

      parent reply	other threads:[~2004-06-11  4:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-07 20:30 [PATCH] unclamp tcp receive window if doing dynamic receive sizing Stephen Hemminger
2004-06-07 23:17 ` David S. Miller
2004-06-11  4:54 ` David S. Miller [this message]

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=20040610215412.09f0a457.davem@redhat.com \
    --to=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    --cc=shemminger@osdl.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).