diff options
author | Joe Perches <joe@perches.com> | 2007-02-22 10:26:32 +0100 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-02-26 20:43:00 +0100 |
commit | 4c3ae4d7e727eac6f6eb23587cef0413734d4ae1 (patch) | |
tree | 9ab908c6b7bf0120a407d9343b15db939d489476 /net/ipv4/multipath_wrandom.c | |
parent | [BRIDGE]: eliminate workqueue for carrier check (diff) | |
download | linux-4c3ae4d7e727eac6f6eb23587cef0413734d4ae1.tar.xz linux-4c3ae4d7e727eac6f6eb23587cef0413734d4ae1.zip |
[IPV4]: Use random32() in net/ipv4/multipath
Removed local random number generator function
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/multipath_wrandom.c')
-rw-r--r-- | net/ipv4/multipath_wrandom.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/net/ipv4/multipath_wrandom.c b/net/ipv4/multipath_wrandom.c index 2bdbb92b450a..57c503694539 100644 --- a/net/ipv4/multipath_wrandom.c +++ b/net/ipv4/multipath_wrandom.c @@ -32,6 +32,7 @@ #include <linux/module.h> #include <linux/mroute.h> #include <linux/init.h> +#include <linux/random.h> #include <net/ip.h> #include <net/protocol.h> #include <linux/skbuff.h> @@ -84,18 +85,6 @@ struct multipath_route { /* state: primarily weight per route information */ static struct multipath_bucket state[MULTIPATH_STATE_SIZE]; -/* interface to random number generation */ -static unsigned int RANDOM_SEED = 93186752; - -static inline unsigned int random(unsigned int ubound) -{ - static unsigned int a = 1588635695, - q = 2, - r = 1117695901; - RANDOM_SEED = a*(RANDOM_SEED % q) - r*(RANDOM_SEED / q); - return RANDOM_SEED % ubound; -} - static unsigned char __multipath_lookup_weight(const struct flowi *fl, const struct rtable *rt) { @@ -193,7 +182,7 @@ static void wrandom_select_route(const struct flowi *flp, /* choose a weighted random candidate */ decision = first; - selector = random(power); + selector = random32() % power; last_power = 0; /* select candidate, adjust GC data and cleanup local state */ |