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

Commit 9b0ed891 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller
Browse files

netem: remove unnecessary 64 bit modulus



Fix compilation on 32 bit platforms (where doing modulus operation
with 64 bit requires extra glibc functions) by truncation.
The jitter for table distribution is limited to a 32 bit value
because random numbers are scaled as 32 bit value.

Also fix some whitespace.

Fixes: 99803171 ("netem: add uapi to express delay and jitter in nanoseconds")
Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bce552fd
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -312,7 +312,7 @@ static bool loss_event(struct netem_sched_data *q)
 * std deviation sigma.  Uses table lookup to approximate the desired
 * distribution, and a uniformly-distributed pseudo-random source.
 */
static s64 tabledist(s64 mu, s64 sigma,
static s64 tabledist(s64 mu, s32 sigma,
		     struct crndstate *state,
		     const struct disttable *dist)
{