aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/sch_choke.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
index ddd73cb2d7ba..2aee02802c27 100644
--- a/net/sched/sch_choke.c
+++ b/net/sched/sch_choke.c
@@ -14,7 +14,6 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/skbuff.h> 16#include <linux/skbuff.h>
17#include <linux/reciprocal_div.h>
18#include <linux/vmalloc.h> 17#include <linux/vmalloc.h>
19#include <net/pkt_sched.h> 18#include <net/pkt_sched.h>
20#include <net/inet_ecn.h> 19#include <net/inet_ecn.h>
@@ -77,12 +76,6 @@ struct choke_sched_data {
77 struct sk_buff **tab; 76 struct sk_buff **tab;
78}; 77};
79 78
80/* deliver a random number between 0 and N - 1 */
81static u32 random_N(unsigned int N)
82{
83 return reciprocal_divide(prandom_u32(), N);
84}
85
86/* number of elements in queue including holes */ 79/* number of elements in queue including holes */
87static unsigned int choke_len(const struct choke_sched_data *q) 80static unsigned int choke_len(const struct choke_sched_data *q)
88{ 81{
@@ -233,7 +226,7 @@ static struct sk_buff *choke_peek_random(const struct choke_sched_data *q,
233 int retrys = 3; 226 int retrys = 3;
234 227
235 do { 228 do {
236 *pidx = (q->head + random_N(choke_len(q))) & q->tab_mask; 229 *pidx = (q->head + prandom_u32_max(choke_len(q))) & q->tab_mask;
237 skb = q->tab[*pidx]; 230 skb = q->tab[*pidx];
238 if (skb) 231 if (skb)
239 return skb; 232 return skb;