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

Commit 6c97da14 authored by Leslie Monis's avatar Leslie Monis Committed by David S. Miller
Browse files

net: sched: pie: avoid slow division in drop probability decay



As per RFC 8033, it is sufficient for the drop probability
decay factor to have a value of (1 - 1/64) instead of 98%.
This avoids the need to do slow division.

Suggested-by: default avatarDavid Laight <David.Laight@aculab.com>
Signed-off-by: default avatarLeslie Monis <lesliemonis@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4a8acef7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -429,7 +429,8 @@ static void calculate_probability(struct Qdisc *sch)
	 */

	if (qdelay == 0 && qdelay_old == 0 && update_prob)
		q->vars.prob = 98 * div_u64(q->vars.prob, 100);
		/* Reduce drop probability to 98.4% */
		q->vars.prob -= q->vars.prob / 64u;

	q->vars.qdelay = qdelay;
	q->vars.qlen_old = qlen;