[patch 17/31] Fix TCP receiver side SWS handling.

Greg KH
2007-04-11T23:00:55Z

[-- Attachment #1: fix-tcp-receiver-side-sws-handling.patch --]
[-- Type: text/plain, Size: 766 bytes --]

-stable review patch. If anyone has any objections, please let us know.

------------------
From: John Heffner <jheffner@psc.edu>

[TCP]: Do receiver-side SWS avoidance for rcvbuf < MSS.

Signed-off-by: John Heffner <jheffner@psc.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
net/ipv4/tcp_output.c | 3 +++
1 file changed, 3 insertions(+)

--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1607,6 +1607,9 @@ u32 __tcp_select_window(struct sock *sk)
*/
if (window <= free_space - mss || window > free_space)
window = (free_space/mss)*mss;
+ else if (mss == full_space &&
+ free_space > window + full_space/2)
+ window = free_space;
}

return window;

--