From ce40806e29c94d9ef49c4fa072726d5ef4868fe2 Mon Sep 17 00:00:00 2001 From: thorpej Date: Thu, 30 Apr 1998 18:27:20 +0000 Subject: [PATCH] In the CWM code, don't use the Floyd initial window computation as the burst size allowed, but rather a fixed number of packets, as described in the Internet Draft. Default allowed burst is 4 packets, per the Draft. Make the use of CWM and the allowed burst size tunable via sysctl. --- sys/netinet/tcp_output.c | 13 ++++++------- sys/netinet/tcp_var.h | 12 ++++++++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 207b38bd9151..34d3676bda26 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_output.c,v 1.35 1998/04/29 03:44:12 kml Exp $ */ +/* $NetBSD: tcp_output.c,v 1.36 1998/04/30 18:27:20 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -110,13 +110,12 @@ extern struct mbuf *m_copypack(); #define MAX_TCPOPTLEN 32 /* max # bytes that go in options */ /* - * Knob to enable Congestion Window Monitoring. + * Knob to enable Congestion Window Monitoring, and control the + * the burst size it allows. Default burst is 4 packets, per + * the Internet draft. */ -#ifdef TCP_CWM -int tcp_cwm = 1; -#else int tcp_cwm = 0; -#endif +int tcp_cwm_burstsize = 4; static __inline void tcp_segsize __P((struct tcpcb *, int *, int *)); static __inline void @@ -199,7 +198,7 @@ tcp_output(tp) * been acknowledged (i.e. transmission is idle). */ tp->snd_cwnd = min(tp->snd_cwnd, - TCP_INITIAL_WINDOW(tcp_init_win, txsegsize) + + (tcp_cwm_burstsize * txsegsize) + (tp->snd_nxt - tp->snd_una)); } else { if (idle && tp->t_idle >= tp->t_rxtcur) { diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index feb2edfc30c6..2ca952d6f37d 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_var.h,v 1.44 1998/04/30 17:55:27 thorpej Exp $ */ +/* $NetBSD: tcp_var.h,v 1.45 1998/04/30 18:27:21 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -384,7 +384,9 @@ struct tcpstat { #define TCPCTL_WSCALE 11 /* RFC1323 window scaling */ #define TCPCTL_TSTAMP 12 /* RFC1323 timestamps */ #define TCPCTL_COMPAT_42 13 /* 4.2BSD TCP bug work-arounds */ -#define TCPCTL_MAXID 14 +#define TCPCTL_CWM 14 /* Congestion Window Monitoring */ +#define TCPCTL_CWM_BURSTSIZE 15 /* burst size allowed by CWM */ +#define TCPCTL_MAXID 16 #define TCPCTL_NAMES { \ { 0, 0 }, \ @@ -401,6 +403,8 @@ struct tcpstat { { "win_scale", CTLTYPE_INT }, \ { "timestamps", CTLTYPE_INT }, \ { "compat_42", CTLTYPE_INT }, \ + { "cwm", CTLTYPE_INT }, \ + { "cwm_burstsize", CTLTYPE_INT }, \ } #ifdef _KERNEL @@ -415,6 +419,8 @@ extern int tcp_mssdflt; /* default seg size */ extern int tcp_init_win; /* initial window */ 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 */ +extern int tcp_cwm_burstsize; /* burst size allowed by CWM */ extern int tcp_syn_cache_limit; /* max entries for compressed state engine */ extern int tcp_syn_bucket_limit;/* max entries per hash bucket */ extern int tcp_syn_cache_interval; /* compressed state timer */ @@ -439,6 +445,8 @@ extern u_long syn_cache_count; &tcp_do_win_scale, \ &tcp_do_timestamps, \ &tcp_compat_42, \ + &tcp_cwm, \ + &tcp_cwm_burstsize, \ } int tcp_attach __P((struct socket *));