svn commit: r186171 - projects/tcp_ffcaia2008_8.x/sys/netinet
Lawrence Stewart
lstewart at FreeBSD.org
Mon Dec 15 23:08:35 PST 2008
Author: lstewart
Date: Tue Dec 16 07:08:35 2008
New Revision: 186171
URL: http://svn.freebsd.org/changeset/base/186171
Log:
More work on TCP ABC support.
Modified:
projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_input.c
projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_var.h
Modified: projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_input.c
==============================================================================
--- projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_input.c Tue Dec 16 06:01:08 2008 (r186170)
+++ projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_input.c Tue Dec 16 07:08:35 2008 (r186171)
@@ -137,7 +137,7 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet
"Enable RFC 3465 (Appropriate Byte Counting)");
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, abc_l_var, CTLFLAG_RW,
tcp_abc_l_var, 1,
- "Max # segments)");
+ "Cap the max cwnd increment during slow-start to this number of segments");
int tcp_do_ecn = 0;
int tcp_ecn_maxretries = 1;
@@ -2111,23 +2111,53 @@ process_ACK:
/*
* When new data is acked, open the congestion window.
- * If the window gives us less than ssthresh packets
- * in flight, open exponentially (maxseg per packet).
- * Otherwise open linearly: maxseg per window
- * (maxseg^2 / cwnd per packet).
- * If cwnd > maxseg^2, fix the cwnd increment at 1 byte
- * to avoid capping cwnd (as suggested in RFC2581).
+ * Method depends on which congestion control state we're
+ * in (slow start or cong avoid) and if ABC (RFC 3465) is
+ * enabled.
+ *
+ * slow start: cwnd <= ssthresh
+ * cong avoid: cwnd > ssthresh
+ *
+ * slow start and ABC (RFC 3465):
+ * Grow cwnd exponentially by the amount of data
+ * ACKed capping the max increment per ACK to
+ * (abc_l_var * maxseg) bytes.
+ *
+ * slow start without ABC (RFC 2581):
+ * Grow cwnd exponentially by maxseg per ACK.
+ *
+ * cong avoid and ABC (RFC 3465):
+ * Grow cwnd linearly by maxseg per RTT for each
+ * cwnd worth of ACKed data.
+ *
+ * cong avoid without ABC (RFC 2581):
+ * Grow cwnd linearly by approximately maxseg per RTT using
+ * maxseg^2 / cwnd per ACK as the increment.
+ * If cwnd > maxseg^2, fix the cwnd increment at 1 byte to
+ * avoid capping cwnd (as suggested in RFC 2581).
*/
if ((!V_tcp_do_newreno && !(tp->t_flags & TF_SACK_PERMIT)) ||
!IN_FASTRECOVERY(tp)) {
u_int cw = tp->snd_cwnd;
u_int incr = tp->t_maxseg;
- if (V_tcp_do_rfc3465)
+ /* In congestion avoidance? */
+ if (cw > tp->snd_ssthresh) {
+ if (V_tcp_do_rfc3465) {
+ tp->t_bytes_acked += acked;
+ if (tp->t_bytes_acked >= tp->snd_cwnd)
+ tp->t_bytes_acked -= cw;
+ else
+ incr = 0;
+ }
+ else
+ incr = max((incr * incr / cw), 1);
+ /* In slow-start with ABC enabled? */
+ } else if (V_tcp_do_rfc3465)
incr = min(acked,
V_tcp_abc_l_var * tp->t_maxseg);
- else if (cw > tp->snd_ssthresh)
- incr = max((incr * incr / cw), 1);
- tp->snd_cwnd = min(cw+incr, TCP_MAXWIN<<tp->snd_scale);
+ /* ABC is on by default, so (incr == 0) frequently. */
+ if (incr > 0)
+ tp->snd_cwnd = min(cw+incr, TCP_MAXWIN<<tp->snd_scale);
}
SOCKBUF_LOCK(&so->so_snd);
if (acked > so->so_snd.sb_cc) {
Modified: projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_var.h
==============================================================================
--- projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_var.h Tue Dec 16 06:01:08 2008 (r186170)
+++ projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_var.h Tue Dec 16 07:08:35 2008 (r186171)
@@ -213,6 +213,7 @@ struct tcpcb {
void *t_pspare[3]; /* toe usrreqs / toepcb * / congestion algo / vimage / 1 general use */
struct toe_usrreqs *t_tu; /* offload operations vector */
void *t_toe; /* TOE pcb pointer */
+ int t_bytes_acked; /* # bytes acked during current RTT */
};
#define IN_FASTRECOVERY(tp) (tp->t_flags & TF_FASTRECOVERY)
More information about the svn-src-projects
mailing list