diff mbox

[net,2/3] netem: fix loss 4 state model

Message ID 20131129110335.0ecaeed8@nehalam.linuxnetplumber.net
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Stephen Hemminger Nov. 29, 2013, 7:03 p.m. UTC
Patch from developers of the alternative loss models, downloaded from:
   http://netgroup.uniroma2.it/twiki/bin/view.cgi/Main/NetemCLG

 "In the case 1 of the switch statement in the if conditions we
   need to add clg->a4 to clg->a1, according to the model."

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Nov. 30, 2013, 5:50 p.m. UTC | #1
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Fri, 29 Nov 2013 11:03:35 -0800

> Patch from developers of the alternative loss models, downloaded from:
>    http://netgroup.uniroma2.it/twiki/bin/view.cgi/Main/NetemCLG
> 
>  "In the case 1 of the switch statement in the if conditions we
>    need to add clg->a4 to clg->a1, according to the model."
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/net/sched/sch_netem.c	2013-11-29 10:55:30.591077393 -0800
+++ b/net/sched/sch_netem.c	2013-11-29 10:58:49.441419081 -0800
@@ -215,10 +215,10 @@  static bool loss_4state(struct netem_sch
 		if (rnd < clg->a4) {
 			clg->state = 4;
 			return true;
-		} else if (clg->a4 < rnd && rnd < clg->a1) {
+		} else if (clg->a4 < rnd && rnd < clg->a1 + clg->a4) {
 			clg->state = 3;
 			return true;
-		} else if (clg->a1 < rnd)
+		} else if (clg->a1 + clg->a4 < rnd)
 			clg->state = 1;
 
 		break;