diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2014-02-14 06:30:43 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-14 09:15:20 +0400 |
commit | c045a734da4cb6d4665962f252de3d8871136ae9 (patch) | |
tree | b3ddf538461176d277602de09e0b56838c9c387d /net/sched/sch_netem.c | |
parent | 49545a7775e746e4e32d1524801221ffdfe1cc0a (diff) | |
download | linux-c045a734da4cb6d4665962f252de3d8871136ae9.tar.xz |
sch_netem: replace magic numbers with enumerate in GE model
Replace some magic numbers which describe states of GE model
loss generator with enumerate.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_netem.c')
-rw-r--r-- | net/sched/sch_netem.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 4a5eb2841351..4fced67e94c8 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -117,6 +117,11 @@ struct netem_sched_data { LOST_IN_BURST_PERIOD, } _4_state_model; + enum { + GOOD_STATE = 1, + BAD_STATE, + } GE_state_model; + /* Correlated Loss Generation models */ struct clgstate { /* state of the Markov chain */ @@ -272,15 +277,15 @@ static bool loss_gilb_ell(struct netem_sched_data *q) struct clgstate *clg = &q->clg; switch (clg->state) { - case 1: + case GOOD_STATE: if (prandom_u32() < clg->a1) - clg->state = 2; + clg->state = BAD_STATE; if (prandom_u32() < clg->a4) return true; break; - case 2: + case BAD_STATE: if (prandom_u32() < clg->a2) - clg->state = 1; + clg->state = GOOD_STATE; if (prandom_u32() > clg->a3) return true; } |