Commit d46f8dd8 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[PKT_SCHED] SFQ: use net_random

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: default avatarStephen Hemminger <stephen.hemminger@vyatta.com>
Acked-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d3e99483
...@@ -386,7 +386,7 @@ static void sfq_perturbation(unsigned long arg) ...@@ -386,7 +386,7 @@ static void sfq_perturbation(unsigned long arg)
struct Qdisc *sch = (struct Qdisc*)arg; struct Qdisc *sch = (struct Qdisc*)arg;
struct sfq_sched_data *q = qdisc_priv(sch); struct sfq_sched_data *q = qdisc_priv(sch);
get_random_bytes(&q->perturbation, 4); q->perturbation = net_random();
if (q->perturb_period) if (q->perturb_period)
mod_timer(&q->perturb_timer, jiffies + q->perturb_period); mod_timer(&q->perturb_timer, jiffies + q->perturb_period);
...@@ -415,7 +415,7 @@ static int sfq_change(struct Qdisc *sch, struct rtattr *opt) ...@@ -415,7 +415,7 @@ static int sfq_change(struct Qdisc *sch, struct rtattr *opt)
del_timer(&q->perturb_timer); del_timer(&q->perturb_timer);
if (q->perturb_period) { if (q->perturb_period) {
mod_timer(&q->perturb_timer, jiffies + 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); sch_tree_unlock(sch);
return 0; return 0;
...@@ -443,7 +443,7 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt) ...@@ -443,7 +443,7 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
if (opt == NULL) { if (opt == NULL) {
q->quantum = psched_mtu(sch->dev); q->quantum = psched_mtu(sch->dev);
q->perturb_period = 0; q->perturb_period = 0;
get_random_bytes(&q->perturbation, 4); q->perturbation = net_random();
} else { } else {
int err = sfq_change(sch, opt); int err = sfq_change(sch, opt);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment