Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Limit the tcp initial window setting to 10, leav...
details: https://anonhg.NetBSD.org/src/rev/0c6938c2f11f
branches: trunk
changeset: 785994:0c6938c2f11f
user: christos <christos%NetBSD.org@localhost>
date: Wed Apr 10 00:16:03 2013 +0000
description:
Limit the tcp initial window setting to 10, leaving it by default to 4
and simplifying the code in process. Per draft-ietf-initcwnd-08.txt.
diffstat:
sys/netinet/tcp_subr.c | 23 ++++++++++++++++++++---
sys/netinet/tcp_usrreq.c | 29 +++++++++++++++++++++++++----
sys/netinet/tcp_var.h | 6 +++---
3 files changed, 48 insertions(+), 10 deletions(-)
diffs (139 lines):
diff -r e63910d2426d -r 0c6938c2f11f sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c Tue Apr 09 16:39:19 2013 +0000
+++ b/sys/netinet/tcp_subr.c Wed Apr 10 00:16:03 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_subr.c,v 1.248 2012/09/08 02:58:13 msaitoh Exp $ */
+/* $NetBSD: tcp_subr.c,v 1.249 2013/04/10 00:16:03 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.248 2012/09/08 02:58:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.249 2013/04/10 00:16:03 christos Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -173,11 +173,28 @@
int tcp_ack_on_push = 0; /* set to enable immediate ACK-on-PUSH */
int tcp_do_ecn = 0; /* Explicit Congestion Notification */
#ifndef TCP_INIT_WIN
-#define TCP_INIT_WIN 0 /* initial slow start window */
+#define TCP_INIT_WIN 4 /* initial slow start window */
#endif
#ifndef TCP_INIT_WIN_LOCAL
#define TCP_INIT_WIN_LOCAL 4 /* initial slow start window for local nets */
#endif
+/*
+ * Up to 5 we scale linearly, to reach 3 * 1460; then (iw) * 1460.
+ * This is to simulate current behavior for iw == 4
+ */
+int tcp_init_win_max[] = {
+ 1 * 1460,
+ 1 * 1460,
+ 2 * 1460,
+ 2 * 1460,
+ 3 * 1460,
+ 5 * 1460,
+ 6 * 1460,
+ 7 * 1460,
+ 8 * 1460,
+ 9 * 1460,
+ 10 * 1460
+};
int tcp_init_win = TCP_INIT_WIN;
int tcp_init_win_local = TCP_INIT_WIN_LOCAL;
int tcp_mss_ifmtu = 0;
diff -r e63910d2426d -r 0c6938c2f11f sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c Tue Apr 09 16:39:19 2013 +0000
+++ b/sys/netinet/tcp_usrreq.c Wed Apr 10 00:16:03 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_usrreq.c,v 1.165 2012/06/02 21:36:47 dsl Exp $ */
+/* $NetBSD: tcp_usrreq.c,v 1.166 2013/04/10 00:16:03 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -95,7 +95,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.165 2012/06/02 21:36:47 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.166 2013/04/10 00:16:03 christos Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -1600,6 +1600,27 @@
}
static int
+sysctl_tcp_init_win(SYSCTLFN_ARGS)
+{
+ int error;
+ u_int iw;
+ struct sysctlnode node;
+
+ iw = *(u_int *)rnode->sysctl_data;
+ node = *rnode;
+ node.sysctl_data = &iw;
+ node.sysctl_size = sizeof(iw);
+ error = sysctl_lookup(SYSCTLFN_CALL(&node));
+ if (error || newp == NULL)
+ return error;
+
+ if (iw >= __arraycount(tcp_init_win_max))
+ return EINVAL;
+ *(u_int *)rnode->sysctl_data = iw;
+ return 0;
+}
+
+static int
sysctl_tcp_keep(SYSCTLFN_ARGS)
{
int error;
@@ -1732,7 +1753,7 @@
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "init_win",
SYSCTL_DESCR("Initial TCP congestion window"),
- NULL, 0, &tcp_init_win, 0,
+ sysctl_tcp_init_win, 0, &tcp_init_win, 0,
CTL_NET, pf, IPPROTO_TCP, TCPCTL_INIT_WIN, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
@@ -1861,7 +1882,7 @@
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "init_win_local",
SYSCTL_DESCR("Initial TCP window size (in segments)"),
- NULL, 0, &tcp_init_win_local, 0,
+ sysctl_tcp_init_win, 0, &tcp_init_win_local, 0,
CTL_NET, pf, IPPROTO_TCP, TCPCTL_INIT_WIN_LOCAL,
CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
diff -r e63910d2426d -r 0c6938c2f11f sys/netinet/tcp_var.h
--- a/sys/netinet/tcp_var.h Tue Apr 09 16:39:19 2013 +0000
+++ b/sys/netinet/tcp_var.h Wed Apr 10 00:16:03 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_var.h,v 1.169 2012/02/02 19:43:08 tls Exp $ */
+/* $NetBSD: tcp_var.h,v 1.170 2013/04/10 00:16:04 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -613,8 +613,7 @@
* Compute the initial window for slow start.
*/
#define TCP_INITIAL_WINDOW(iw, segsz) \
- (((iw) == 0) ? (min(4 * (segsz), max(2 * (segsz), 4380))) : \
- ((segsz) * (iw)))
+ min((iw) * (segsz), max(2 * (segsz), tcp_init_win_max[(iw)]))
/*
* TCP statistics.
@@ -797,6 +796,7 @@
extern int tcp_msl; /* max segment life */
extern int tcp_init_win; /* initial window */
extern int tcp_init_win_local; /* initial window for local nets */
+extern int tcp_init_win_max[11];/* max sizes for values of tcp_init_win_* */
extern int tcp_mss_ifmtu; /* take MSS from interface, not in_maxmtu */
extern int tcp_compat_42; /* work around ancient broken TCP peers */
extern int tcp_cwm; /* enable Congestion Window Monitoring */
Home |
Main Index |
Thread Index |
Old Index