Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3a92eab authored by Luca De Cicco's avatar Luca De Cicco Committed by David S. Miller
Browse files

[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: default avatarLuca De Cicco <ldecicco@gmail.com>
Signed-off-by: default avatarStephen Hemminger <shemminger@dxpl.pdx.osdl.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b7d7a9e3
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -82,11 +82,17 @@ 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)
{
	/* 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);
	}
}

/*
 * @westwood_pkts_acked