aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLuca De Cicco <ldecicco@gmail.com>2006-06-12 02:01:59 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-18 00:30:36 -0400
commitb3a92eabe5b67bd207a38ae13dd51f4e08c1f6f7 (patch)
tree511472b1fb5e71e810dd73c9d8b11c12d9aa0efe /net
parentb7d7a9e3c900f0733bf2aabdd41e6dbc70eae94b (diff)
[TCP] Westwood: bandwidth filter startup
The bandwidth estimate filter is now initialized with the first sample in order to have better performances in the case of small file transfers. Signed-off-by: Luca De Cicco <ldecicco@gmail.com> Signed-off-by: Stephen Hemminger <shemminger@dxpl.pdx.osdl.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_westwood.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/net/ipv4/tcp_westwood.c b/net/ipv4/tcp_westwood.c
index 12a2cd976e3a..edf2ee19a8ba 100644
--- a/net/ipv4/tcp_westwood.c
+++ b/net/ipv4/tcp_westwood.c
@@ -82,10 +82,16 @@ static inline u32 westwood_do_filter(u32 a, u32 b)
82 return (((7 * a) + b) >> 3); 82 return (((7 * a) + b) >> 3);
83} 83}
84 84
85static inline void westwood_filter(struct westwood *w, u32 delta) 85static void westwood_filter(struct westwood *w, u32 delta)
86{ 86{
87 w->bw_ns_est = westwood_do_filter(w->bw_ns_est, w->bk / delta); 87 /* If the filter is empty fill it with the first sample of bandwidth */
88 w->bw_est = westwood_do_filter(w->bw_est, w->bw_ns_est); 88 if (w->bw_ns_est == 0 && w->bw_est == 0) {
89 w->bw_ns_est = w->bk / delta;
90 w->bw_est = w->bw_ns_est;
91 } else {
92 w->bw_ns_est = westwood_do_filter(w->bw_ns_est, w->bk / delta);
93 w->bw_est = westwood_do_filter(w->bw_est, w->bw_ns_est);
94 }
89} 95}
90 96
91/* 97/*