Skip to content

Commit

Permalink
[PKT_SCHED] SFQ: use net_random
Browse files Browse the repository at this point in the history
SFQ doesn't need true random numbers, it is only using them to salt a
hash. Therefore it is better to use net_random() and avoid any
possible problems with depleting the entropy pool.

Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Jan 28, 2008
1 parent d3e9948 commit d46f8dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/sched/sch_sfq.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ static void sfq_perturbation(unsigned long arg)
struct Qdisc *sch = (struct Qdisc*)arg;
struct sfq_sched_data *q = qdisc_priv(sch);

get_random_bytes(&q->perturbation, 4);
q->perturbation = net_random();

if (q->perturb_period)
mod_timer(&q->perturb_timer, jiffies + q->perturb_period);
Expand Down Expand Up @@ -415,7 +415,7 @@ static int sfq_change(struct Qdisc *sch, struct rtattr *opt)
del_timer(&q->perturb_timer);
if (q->perturb_period) {
mod_timer(&q->perturb_timer, jiffies + q->perturb_period);
get_random_bytes(&q->perturbation, 4);
q->perturbation = net_random();
}
sch_tree_unlock(sch);
return 0;
Expand Down Expand Up @@ -443,7 +443,7 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
if (opt == NULL) {
q->quantum = psched_mtu(sch->dev);
q->perturb_period = 0;
get_random_bytes(&q->perturbation, 4);
q->perturbation = net_random();
} else {
int err = sfq_change(sch, opt);
if (err)
Expand Down

0 comments on commit d46f8dd

Please sign in to comment.