diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2005-02-27 13:22:57 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2005-02-27 13:22:57 +0000 |
commit | f7ffc60336c3b29374bb88ce7073a563594ed2dc (patch) | |
tree | 2514debb72274d851186531702dee584e82771e9 /sys/netinet/tcp_var.h | |
parent | a458571f1903e5f772b13da17b87d5825a92a8d2 (diff) |
1. tcp_xmit_timer(): remove extra rtt decrement (t_rtttime is 0-based
while t_rtt was 1-based), update callers
2. define and use TCP_RTT_BASE_SHIFT instead of the hardcoded 2.
3. add missing shifts when t_srtt/t_rttvar are used.
4. update the comments: t_srtt uses 5 bits of fraction (not 3)
and t_rttvar uses 4 bits
5. remove obsolete/unused macros TCP_RTT_SCALE and TCP_RTTVAR_SCALE
6. make sure rttmin is not > TCPTV_REXMTMAX
parts from netbsd, ok mcbride, henning
Diffstat (limited to 'sys/netinet/tcp_var.h')
-rw-r--r-- | sys/netinet/tcp_var.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index ccf1a802b97..a7f99f7b4a5 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_var.h,v 1.69 2005/01/10 23:53:49 mcbride Exp $ */ +/* $OpenBSD: tcp_var.h,v 1.70 2005/02/27 13:22:56 markus Exp $ */ /* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */ /* @@ -323,15 +323,14 @@ tcp_reass_unlock(struct tcpcb *tp) * are stored as fixed point numbers scaled by the values below. * For convenience, these scales are also used in smoothing the average * (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed). - * With these scales, srtt has 3 bits to the right of the binary point, - * and thus an "ALPHA" of 0.875. rttvar has 2 bits to the right of the + * With these scales, srtt has 5 bits to the right of the binary point, + * and thus an "ALPHA" of 0.875. rttvar has 4 bits to the right of the * binary point, and is smoothed with an ALPHA of 0.75. */ -#define TCP_RTT_SCALE 8 /* multiplier for srtt; 3 bits frac. */ -#define TCP_RTT_SHIFT 3 /* shift for srtt; 3 bits frac. */ -#define TCP_RTTVAR_SCALE 4 /* multiplier for rttvar; 2 bits */ -#define TCP_RTTVAR_SHIFT 2 /* multiplier for rttvar; 2 bits */ -#define TCP_RTT_MAX (1<<9) /* maximum rtt */ +#define TCP_RTT_SHIFT 3 /* shift for srtt; 5 bits frac. */ +#define TCP_RTTVAR_SHIFT 2 /* shift for rttvar; 4 bits */ +#define TCP_RTT_BASE_SHIFT 2 /* remaining 2 bit shift */ +#define TCP_RTT_MAX (1<<9) /* maximum rtt */ /* * The initial retransmission should happen at rtt + 4 * rttvar. @@ -343,11 +342,11 @@ tcp_reass_unlock(struct tcpcb *tp) * 1.5 tick we need. But, because the bias is * statistical, we have to test that we don't drop below * the minimum feasible timer (which is 2 ticks). - * This macro assumes that the value of TCP_RTTVAR_SCALE + * This macro assumes that the value of (1 << TCP_RTTVAR_SHIFT) * is the same as the multiplier for rttvar. */ #define TCP_REXMTVAL(tp) \ - ((((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar) >> 2) + ((((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar) >> TCP_RTT_BASE_SHIFT) /* * TCP statistics. |