diff options
author | Arnd Bergmann <arnd@arndb.de> | 2015-09-30 13:26:35 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-05 03:16:44 -0700 |
commit | 52f4f91893955c359885d022b2142e2326f020a1 (patch) | |
tree | 147ced546c99ee565357961bbf97a0e852cd7d72 /drivers/net/ppp/ppp_deflate.c | |
parent | e253fb74d66428597bd272b2614e8564b882b14c (diff) | |
download | op-kernel-dev-52f4f91893955c359885d022b2142e2326f020a1.zip op-kernel-dev-52f4f91893955c359885d022b2142e2326f020a1.tar.gz |
mwifiex: avoid gettimeofday in ba_threshold setting
mwifiex_get_random_ba_threshold() uses a complex homegrown implementation
to generate a pseudo-random number from the current time as returned
from do_gettimeofday().
This currently requires two 32-bit divisions plus a couple of other
computations that are eventually discarded as only eight bits of
the microsecond portion are used at all.
We could replace this with a call to get_random_bytes(), but that
might drain the entropy pool too fast if this is called for each
packet.
Instead, this patch converts it to use ktime_get_ns(), which is a
bit faster than do_gettimeofday(), and then uses a similar algorithm
as before, but in a way that takes both the nanosecond and second
portion into account for slightly-more-but-still-not-very-random
pseudorandom number.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Amitkumar Karwar <akarwar@marvell.com>
Cc: Nishant Sarmukadam <nishants@marvell.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ppp/ppp_deflate.c')
0 files changed, 0 insertions, 0 deletions