aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/sched/sch_choke.c9
2 files changed, 2 insertions, 9 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 59fb3db2e713..df3cbdd585c7 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1289,7 +1289,7 @@ static unsigned int fanout_demux_rnd(struct packet_fanout *f,
1289 struct sk_buff *skb, 1289 struct sk_buff *skb,
1290 unsigned int num) 1290 unsigned int num)
1291{ 1291{
1292 return reciprocal_divide(prandom_u32(), num); 1292 return prandom_u32_max(num);
1293} 1293}
1294 1294
1295static unsigned int fanout_demux_rollover(struct packet_fanout *f, 1295static unsigned int fanout_demux_rollover(struct packet_fanout *f,
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;