]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/multipath_random.c
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
[linux-2.6-omap-h63xx.git] / net / ipv4 / multipath_random.c
index 047e861f06bd42f902865bf52bf2455101dbc244..c312785d14d082af7c30994fa24e2d50f4ac18b4 100644 (file)
@@ -15,7 +15,6 @@
 #include <asm/system.h>
 #include <asm/uaccess.h>
 #include <linux/types.h>
-#include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/timer.h>
 #include <linux/mm.h>
@@ -33,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>
 
 #define MULTIPATH_MAX_CANDIDATES 40
 
-/* 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 void random_select_route(const struct flowi *flp,
                                struct rtable *first,
                                struct rtable **rp)
@@ -85,7 +70,7 @@ static void random_select_route(const struct flowi *flp,
        if (candidate_count > 1) {
                unsigned char i = 0;
                unsigned char candidate_no = (unsigned char)
-                       random(candidate_count);
+                       (random32() % candidate_count);
 
                /* find chosen candidate and adjust GC data for all candidates
                 * to ensure they stay in cache