diff options
| -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 { | |||
| 117 | LOST_IN_BURST_PERIOD, | 117 | LOST_IN_BURST_PERIOD, |
| 118 | } _4_state_model; | 118 | } _4_state_model; |
| 119 | 119 | ||
| 120 | enum { | ||
| 121 | GOOD_STATE = 1, | ||
| 122 | BAD_STATE, | ||
| 123 | } GE_state_model; | ||
| 124 | |||
| 120 | /* Correlated Loss Generation models */ | 125 | /* Correlated Loss Generation models */ |
| 121 | struct clgstate { | 126 | struct clgstate { |
| 122 | /* state of the Markov chain */ | 127 | /* state of the Markov chain */ |
| @@ -272,15 +277,15 @@ static bool loss_gilb_ell(struct netem_sched_data *q) | |||
| 272 | struct clgstate *clg = &q->clg; | 277 | struct clgstate *clg = &q->clg; |
| 273 | 278 | ||
| 274 | switch (clg->state) { | 279 | switch (clg->state) { |
| 275 | case 1: | 280 | case GOOD_STATE: |
| 276 | if (prandom_u32() < clg->a1) | 281 | if (prandom_u32() < clg->a1) |
| 277 | clg->state = 2; | 282 | clg->state = BAD_STATE; |
| 278 | if (prandom_u32() < clg->a4) | 283 | if (prandom_u32() < clg->a4) |
| 279 | return true; | 284 | return true; |
| 280 | break; | 285 | break; |
| 281 | case 2: | 286 | case BAD_STATE: |
| 282 | if (prandom_u32() < clg->a2) | 287 | if (prandom_u32() < clg->a2) |
| 283 | clg->state = 1; | 288 | clg->state = GOOD_STATE; |
| 284 | if (prandom_u32() > clg->a3) | 289 | if (prandom_u32() > clg->a3) |
| 285 | return true; | 290 | return true; |
| 286 | } | 291 | } |
