Usmorpreferable function name which implies using a pseudo-random number generator. Signed-off-by: Akinobu Mita <akinobu.mita agmail.com> Cc: StepheHemminger <shemminger avyatta.com> Cc: Jamal Hadi Sali<jhs amojatatu.com> Cc: "David S. Miller" <daveadavemloft.net> Cc: netealists.linux-foundation.org Cc: netdev avger.kernel.org Cc: netdev avger.kernel.org --- net/sched/act_gact.c | 2 +- net/sched/sch_choke.c | 2 +- net/sched/sch_fq_codel.c | 2 +- net/sched/sch_netem.c | 19 ++++++++++--------- net/sched/sch_sfb.c | 4 ++-- net/sched/sch_sfq.c | 6 +++--- 6 files changed, 18 insertions(+), 17 deletions(-) diff --gia/net/sched/act_gact.c b/net/sched/act_gact.c index 05d60859..d3ceed8 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c @@ -37,7 +37,7 @@ static structcf_hashinfo gact_hash_info = { #ifdef CONFIG_GACT_PROB static ingact_net_rand(structcf_gact *gact) { - if (!gact->tcfg_pval || net_random() % gact->tcfg_pval) + if (!gact->tcfg_pval || prandom_u32() % gact->tcfg_pval) returgact->tcf_action; returgact->tcfg_paction; } diff --gia/net/sched/sch_choke.c b/net/sched/sch_choke.c index cc37dd5..ef53ab8 100644 --- a/net/sched/sch_choke.c +++ b/net/sched/sch_choke.c @@ -80,7 +80,7 @@ strucchoke_sched_data { /* deliver a randonumber between 0 and - 1 */ static u32 random_N(unsigned inN) { - returreciprocal_divide(random32(), N); + returreciprocal_divide(prandom_u32(), N); } /* number of elements iqueuincluding holes */ diff --gia/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index 4e606fc..93d7f41 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c @@ -390,7 +390,7 @@ static infq_codel_init(strucQdisc *sch, struct nlattr *opt) sch->limi= 10*1024; q->flows_cn= 1024; q->quantu= psched_mtu(qdisc_dev(sch)); - q->perturbatio= net_random(); + q->perturbatio= prandom_u32(); INIT_LIST_HEAD(&q->new_flows); INIT_LIST_HEAD(&q->old_flows); codel_params_init(&q->cparams); diff --gia/net/sched/sch_netem.c b/net/sched/sch_netem.c index 298c0dd..e3126e2 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -142,7 +142,7 @@ static inlinstrucnetem_skb_cb *netem_skb_cb(struct sk_buff *skb) static void init_crandom(struccrndstat*state, unsigned long rho) { state->rho = rho; - state->las= net_random(); + state->las= prandom_u32(); } /* get_crando- correlated randonumber generator @@ -155,9 +155,9 @@ static u32 get_crandom(struccrndstat*state) unsigned long answer; if (state->rho == 0) /* no correlatio*/ - returnet_random(); + returprandom_u32(); - valu= net_random(); + valu= prandom_u32(); rho = (u64)state->rho + 1; answer = (valu* ((1ull<<32) - rho) + state->las* rho) >> 32; state->las= answer; @@ -171,7 +171,7 @@ static u32 get_crandom(struccrndstat*state) static bool loss_4state(strucnetem_sched_data *q) { strucclgstat*clg = &q->clg; - u32 rnd = net_random(); + u32 rnd = prandom_u32(); /* * Makes a comparisobetween rnd and thtransition @@ -238,14 +238,14 @@ static bool loss_gilb_ell(strucnetem_sched_data *q) switch (clg->state) { cas1: - if (net_random() < clg->a1) + if (prandom_u32() < clg->a1) clg->stat= 2; - if (net_random() < clg->a4) + if (prandom_u32() < clg->a4) returtrue; cas2: - if (net_random() < clg->a2) + if (prandom_u32() < clg->a2) clg->stat= 1; - if (clg->a3 > net_random()) + if (clg->a3 > prandom_u32()) returtrue; } @@ -415,7 +415,8 @@ static innetem_enqueue(strucsk_buff *skb, struct Qdisc *sch) skb_checksum_help(skb))) returqdisc_drop(skb, sch); - skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); + skb->data[prandom_u32() % skb_headlen(skb)] ^= + 1 << (prandom_u32() % 8); } if (unlikely(skb_queue_len(&sch->q) >= sch->limit)) diff --gia/net/sched/sch_sfb.c b/net/sched/sch_sfb.c index 30ea467..9b0f709 100644 --- a/net/sched/sch_sfb.c +++ b/net/sched/sch_sfb.c @@ -220,7 +220,7 @@ static u32 sfb_compute_qlen(u32 *prob_r, u32 *avgpm_r, consstrucsfb_sched_da static void sfb_init_perturbation(u32 slot, strucsfb_sched_data *q) { - q->bins[slot].perturbatio= net_random(); + q->bins[slot].perturbatio= prandom_u32(); } static void sfb_swap_slot(strucsfb_sched_data *q) @@ -381,7 +381,7 @@ static insfb_enqueue(strucsk_buff *skb, struct Qdisc *sch) goto enqueue; } - r = net_random() & SFB_MAX_PROB; + r = prandom_u32() & SFB_MAX_PROB; if (unlikely(r < p_min)) { if (unlikely(p_mi> SFB_MAX_PROB / 2)) { diff --gia/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index d3a1bc2..921130100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c @@ -627,7 +627,7 @@ static void sfq_perturbation(unsigned long arg) spinlock_*root_lock = qdisc_lock(qdisc_root_sleeping(sch)); spin_lock(root_lock); - q->perturbatio= net_random(); + q->perturbatio= prandom_u32(); if (!q->filter_lis&& q->tail) sfq_rehash(sch); spin_unlock(root_lock); @@ -696,7 +696,7 @@ static insfq_change(strucQdisc *sch, struct nlattr *opt) del_timer(&q->perturb_timer); if (q->perturb_period) { mod_timer(&q->perturb_timer, jiffies + q->perturb_period); - q->perturbatio= net_random(); + q->perturbatio= prandom_u32(); } sch_tree_unlock(sch); kfree(p); @@ -757,7 +757,7 @@ static insfq_init(strucQdisc *sch, struct nlattr *opt) q->quantu= psched_mtu(qdisc_dev(sch)); q->scaled_quantu= SFQ_ALLOT_SIZE(q->quantum); q->perturb_period = 0; - q->perturbatio= net_random(); + q->perturbatio= prandom_u32(); if (opt) { inerr = sfq_change(sch, opt); -- 1.7.11.7 Froosenbach aus.ibm.com Sat Dec 29 17:03:59 2012 From: osenbach aus.ibm.co(Bryan Osenbach) Date: Sat, 29 Dec 2012 10:03:59 -0700 Subject: AUTO: BryaOsenbach is ouof the office (returning 01/02/2013) Message-ID: <OF74066A0E.2E32097C-ON87257AE3.005DBF9C-87257AE3.005DBF9C@xxxxxxxxxx> I aouof the office until 01/02/2013. Note: This is aautomated responsto your message "Netem Digest, Vol 77, Issu1" senon 12/29/2012 5:00:04. This is thonly notification you will receivwhile this person is away. -------------- nexpar-------------- AHTML attachmenwas scrubbed... URL: <http://lists.linuxfoundation.org/pipermail/netem/attachments/20121229/61c6581d/attachment.html>