net: replace macros net_random and net_srandom with direct calls to prandom
This patch removes the net_random and net_srandom macros and replaces them with direct calls to the prandom ones. As new commits only seem to use prandom_u32 there is no use to keep them around. This change makes it easier to grep for users of prandom_u32. Signed-off-by: Aruna-Hewapathirane <aruna.hewapathirane@gmail.com> Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
825edac4e7
commit
63862b5bef
@@ -29,7 +29,7 @@ static struct tcf_hashinfo gact_hash_info;
|
||||
#ifdef CONFIG_GACT_PROB
|
||||
static int gact_net_rand(struct tcf_gact *gact)
|
||||
{
|
||||
if (!gact->tcfg_pval || net_random() % gact->tcfg_pval)
|
||||
if (!gact->tcfg_pval || prandom_u32() % gact->tcfg_pval)
|
||||
return gact->tcf_action;
|
||||
return gact->tcfg_paction;
|
||||
}
|
||||
|
@@ -390,7 +390,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
|
||||
sch->limit = 10*1024;
|
||||
q->flows_cnt = 1024;
|
||||
q->quantum = psched_mtu(qdisc_dev(sch));
|
||||
q->perturbation = net_random();
|
||||
q->perturbation = prandom_u32();
|
||||
INIT_LIST_HEAD(&q->new_flows);
|
||||
INIT_LIST_HEAD(&q->old_flows);
|
||||
codel_params_init(&q->cparams);
|
||||
|
@@ -607,7 +607,7 @@ static int hhf_init(struct Qdisc *sch, struct nlattr *opt)
|
||||
|
||||
sch->limit = 1000;
|
||||
q->quantum = psched_mtu(qdisc_dev(sch));
|
||||
q->perturbation = net_random();
|
||||
q->perturbation = prandom_u32();
|
||||
INIT_LIST_HEAD(&q->new_buckets);
|
||||
INIT_LIST_HEAD(&q->old_buckets);
|
||||
|
||||
|
@@ -169,7 +169,7 @@ static inline struct netem_skb_cb *netem_skb_cb(struct sk_buff *skb)
|
||||
static void init_crandom(struct crndstate *state, unsigned long rho)
|
||||
{
|
||||
state->rho = rho;
|
||||
state->last = net_random();
|
||||
state->last = prandom_u32();
|
||||
}
|
||||
|
||||
/* get_crandom - correlated random number generator
|
||||
@@ -182,9 +182,9 @@ static u32 get_crandom(struct crndstate *state)
|
||||
unsigned long answer;
|
||||
|
||||
if (state->rho == 0) /* no correlation */
|
||||
return net_random();
|
||||
return prandom_u32();
|
||||
|
||||
value = net_random();
|
||||
value = prandom_u32();
|
||||
rho = (u64)state->rho + 1;
|
||||
answer = (value * ((1ull<<32) - rho) + state->last * rho) >> 32;
|
||||
state->last = answer;
|
||||
@@ -198,7 +198,7 @@ static u32 get_crandom(struct crndstate *state)
|
||||
static bool loss_4state(struct netem_sched_data *q)
|
||||
{
|
||||
struct clgstate *clg = &q->clg;
|
||||
u32 rnd = net_random();
|
||||
u32 rnd = prandom_u32();
|
||||
|
||||
/*
|
||||
* Makes a comparison between rnd and the transition
|
||||
@@ -264,15 +264,15 @@ static bool loss_gilb_ell(struct netem_sched_data *q)
|
||||
|
||||
switch (clg->state) {
|
||||
case 1:
|
||||
if (net_random() < clg->a1)
|
||||
if (prandom_u32() < clg->a1)
|
||||
clg->state = 2;
|
||||
if (net_random() < clg->a4)
|
||||
if (prandom_u32() < clg->a4)
|
||||
return true;
|
||||
break;
|
||||
case 2:
|
||||
if (net_random() < clg->a2)
|
||||
if (prandom_u32() < clg->a2)
|
||||
clg->state = 1;
|
||||
if (net_random() > clg->a3)
|
||||
if (prandom_u32() > clg->a3)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -457,7 +457,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
|
||||
skb_checksum_help(skb)))
|
||||
return qdisc_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))
|
||||
|
@@ -122,7 +122,7 @@ static bool drop_early(struct Qdisc *sch, u32 packet_size)
|
||||
else
|
||||
local_prob = q->vars.prob;
|
||||
|
||||
rnd = net_random();
|
||||
rnd = prandom_u32();
|
||||
if (rnd < local_prob)
|
||||
return true;
|
||||
|
||||
|
@@ -220,7 +220,7 @@ static u32 sfb_compute_qlen(u32 *prob_r, u32 *avgpm_r, const struct sfb_sched_da
|
||||
|
||||
static void sfb_init_perturbation(u32 slot, struct sfb_sched_data *q)
|
||||
{
|
||||
q->bins[slot].perturbation = net_random();
|
||||
q->bins[slot].perturbation = prandom_u32();
|
||||
}
|
||||
|
||||
static void sfb_swap_slot(struct sfb_sched_data *q)
|
||||
@@ -381,7 +381,7 @@ static int sfb_enqueue(struct sk_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_min > SFB_MAX_PROB / 2)) {
|
||||
|
@@ -629,7 +629,7 @@ static void sfq_perturbation(unsigned long arg)
|
||||
spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch));
|
||||
|
||||
spin_lock(root_lock);
|
||||
q->perturbation = net_random();
|
||||
q->perturbation = prandom_u32();
|
||||
if (!q->filter_list && q->tail)
|
||||
sfq_rehash(sch);
|
||||
spin_unlock(root_lock);
|
||||
@@ -698,7 +698,7 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt)
|
||||
del_timer(&q->perturb_timer);
|
||||
if (q->perturb_period) {
|
||||
mod_timer(&q->perturb_timer, jiffies + q->perturb_period);
|
||||
q->perturbation = net_random();
|
||||
q->perturbation = prandom_u32();
|
||||
}
|
||||
sch_tree_unlock(sch);
|
||||
kfree(p);
|
||||
@@ -759,7 +759,7 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt)
|
||||
q->quantum = psched_mtu(qdisc_dev(sch));
|
||||
q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum);
|
||||
q->perturb_period = 0;
|
||||
q->perturbation = net_random();
|
||||
q->perturbation = prandom_u32();
|
||||
|
||||
if (opt) {
|
||||
int err = sfq_change(sch, opt);
|
||||
|
Reference in New Issue
Block a user