? o ? x Index: tcp_subr.c =================================================================== RCS file: /cvsroot/src/sys/netinet/tcp_subr.c,v retrieving revision 1.248 diff -u -p -u -r1.248 tcp_subr.c --- tcp_subr.c 8 Sep 2012 02:58:13 -0000 1.248 +++ tcp_subr.c 9 Apr 2013 19:44:17 -0000 @@ -173,11 +173,28 @@ int tcp_do_timestamps = 1; /* RFC1323 ti 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[] = { + 1460, + 1460, + 2920, + 2920, + 4380, + 7300, + 8750, + 10220, + 11680, + 13140, + 14600 +}; int tcp_init_win = TCP_INIT_WIN; int tcp_init_win_local = TCP_INIT_WIN_LOCAL; int tcp_mss_ifmtu = 0; Index: tcp_usrreq.c =================================================================== RCS file: /cvsroot/src/sys/netinet/tcp_usrreq.c,v retrieving revision 1.165 diff -u -p -u -r1.165 tcp_usrreq.c --- tcp_usrreq.c 2 Jun 2012 21:36:47 -0000 1.165 +++ tcp_usrreq.c 9 Apr 2013 19:44:17 -0000 @@ -1600,6 +1600,27 @@ sysctl_tcp_congctl(SYSCTLFN_ARGS) } 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 @@ sysctl_net_inet_tcp_setup2(struct sysctl 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 @@ sysctl_net_inet_tcp_setup2(struct sysctl 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, Index: tcp_var.h =================================================================== RCS file: /cvsroot/src/sys/netinet/tcp_var.h,v retrieving revision 1.169 diff -u -p -u -r1.169 tcp_var.h --- tcp_var.h 2 Feb 2012 19:43:08 -0000 1.169 +++ tcp_var.h 9 Apr 2013 19:44:17 -0000 @@ -613,8 +613,7 @@ struct syn_cache_head { * 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_minmss; /* minimal seg s 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 */