* [PATCH net] netem: fix loss generators
@ 2013-11-22 1:54 Stephen Hemminger
2013-11-27 21:28 ` Hagen Paul Pfeifer
2013-11-28 23:18 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Stephen Hemminger @ 2013-11-22 1:54 UTC (permalink / raw)
To: David Miller, stefano.salsano; +Cc: netdev
Patch from developers of the alternative loss models, downloaded from:
http://netgroup.uniroma2.it/twiki/bin/view.cgi/Main/NetemCLG
We found some bugs in our first implementation.
A first set of bugs is in the function loss_4state:
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.
In the case 3 of the switch statement we need to delete "return
true" if the condition leads us in the state 1, because the state 1 is
a good state.
A second set of bugs is in the function loss_gilb_ell
In both cases of the switch statement we need to add the break
statement, because the two cases are mutually exclusive.
In the case 2, of the switch we change the direction of the inequality to
net_random()>clg->a3, because clg->a3 is h in the GE model and when h
is 0 all packets will be lost.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
--- a/net/sched/sch_netem.c 2013-11-21 17:22:03.655649667 -0800
+++ b/net/sched/sch_netem.c 2013-11-21 17:24:46.438773795 -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;
@@ -235,6 +235,7 @@ static bool loss_4state(struct netem_sch
clg->state = 2;
else if (clg->a3 < rnd && rnd < clg->a2 + clg->a3) {
clg->state = 1;
+ return true;
} else if (clg->a2 + clg->a3 < rnd) {
clg->state = 3;
return true;
@@ -268,11 +269,13 @@ static bool loss_gilb_ell(struct netem_s
clg->state = 2;
if (net_random() < clg->a4)
return true;
+ break;
case 2:
if (net_random() < clg->a2)
clg->state = 1;
- if (clg->a3 > net_random())
+ if (net_random() > clg->a3)
return true;
+ break;
}
return false;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] netem: fix loss generators
2013-11-22 1:54 [PATCH net] netem: fix loss generators Stephen Hemminger
@ 2013-11-27 21:28 ` Hagen Paul Pfeifer
2013-11-28 23:18 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Hagen Paul Pfeifer @ 2013-11-27 21:28 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, stefano.salsano, netdev
[-- Attachment #1: Type: text/plain, Size: 787 bytes --]
* Stephen Hemminger | 2013-11-21 17:54:19 [-0800]:
>Patch from developers of the alternative loss models, downloaded from:
> http://netgroup.uniroma2.it/twiki/bin/view.cgi/Main/NetemCLG
>
>We found some bugs in our first implementation.
>A first set of bugs is in the function loss_4state:
> 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.
> In the case 3 of the switch statement we need to delete "return
> true" if the condition leads us in the state 1, because the state 1 is
> a good state.
I already fixed the former bug[1]. I cc'ed stefano.salsano@uniroma2.it but did
not get any acked-by/tested-by. The second bug still exists.
Hagen
[1] http://www.spinics.net/lists/netdev/msg255165.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] netem: fix loss generators
2013-11-22 1:54 [PATCH net] netem: fix loss generators Stephen Hemminger
2013-11-27 21:28 ` Hagen Paul Pfeifer
@ 2013-11-28 23:18 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2013-11-28 23:18 UTC (permalink / raw)
To: stephen; +Cc: stefano.salsano, netdev
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Thu, 21 Nov 2013 17:54:19 -0800
> Patch from developers of the alternative loss models, downloaded from:
> http://netgroup.uniroma2.it/twiki/bin/view.cgi/Main/NetemCLG
>
> We found some bugs in our first implementation.
> A first set of bugs is in the function loss_4state:
> 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.
> In the case 3 of the switch statement we need to delete "return
> true" if the condition leads us in the state 1, because the state 1 is
> a good state.
>
> A second set of bugs is in the function loss_gilb_ell
> In both cases of the switch statement we need to add the break
> statement, because the two cases are mutually exclusive.
> In the case 2, of the switch we change the direction of the inequality to
> net_random()>clg->a3, because clg->a3 is h in the GE model and when h
> is 0 all packets will be lost.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Stephen, can you adjust this patch to take into account commit:
4a3ad7b3eade08ad1c760aaa4fe06a36f2584939
as Hagen noted?
Thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-28 23:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-22 1:54 [PATCH net] netem: fix loss generators Stephen Hemminger
2013-11-27 21:28 ` Hagen Paul Pfeifer
2013-11-28 23:18 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).