netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] sfq: use net_random
@ 2008-01-19  0:12 Stephen Hemminger
  0 siblings, 0 replies; only message in thread
From: Stephen Hemminger @ 2008-01-19  0:12 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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 <shemminger@vyatta.com>


--- a/net/sched/sch_sfq.c	2008-01-17 09:00:58.000000000 -0800
+++ b/net/sched/sch_sfq.c	2008-01-17 09:03:26.000000000 -0800
@@ -386,7 +386,7 @@ static void sfq_perturbation(unsigned lo
 	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);
@@ -415,7 +415,7 @@ static int sfq_change(struct Qdisc *sch,
 	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;
@@ -443,7 +443,7 @@ static int sfq_init(struct Qdisc *sch, s
 	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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-19  0:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-19  0:12 [PATCH 2/3] sfq: use net_random Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).