Skip to content

Commit

Permalink
[TCP] Westwood: bandwidth filter startup
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luca De Cicco authored and David S. Miller committed Jun 18, 2006
1 parent b7d7a9e commit b3a92ea
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions net/ipv4/tcp_westwood.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,16 @@ static inline u32 westwood_do_filter(u32 a, u32 b)
return (((7 * a) + b) >> 3);
}

static inline void westwood_filter(struct westwood *w, u32 delta)
static void westwood_filter(struct westwood *w, u32 delta)
{
w->bw_ns_est = westwood_do_filter(w->bw_ns_est, w->bk / delta);
w->bw_est = westwood_do_filter(w->bw_est, w->bw_ns_est);
/* If the filter is empty fill it with the first sample of bandwidth */
if (w->bw_ns_est == 0 && w->bw_est == 0) {
w->bw_ns_est = w->bk / delta;
w->bw_est = w->bw_ns_est;
} else {
w->bw_ns_est = westwood_do_filter(w->bw_ns_est, w->bk / delta);
w->bw_est = westwood_do_filter(w->bw_est, w->bw_ns_est);
}
}

/*
Expand Down

0 comments on commit b3a92ea

Please sign in to comment.