netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iproute2: Avoid rounding errors for 100%.
@ 2009-11-03 15:38 hannemann
  2009-11-03 16:19 ` Arnd Hannemann
  0 siblings, 1 reply; 5+ messages in thread
From: hannemann @ 2009-11-03 15:38 UTC (permalink / raw)
  To: shemminger; +Cc: netdev, Arnd Hannemann

From: Arnd Hannemann <hannemann@nets.rwth-aachen.de>

We noticed that a netem reorder percentage of 100% will still get packets reordered.
This patch fixes that.

Signed-off-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
---
 tc/tc_util.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tc/tc_util.c b/tc/tc_util.c
index fe2c7eb..2641f2e 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -363,8 +363,10 @@ int get_percent(__u32 *percent, const char *str)
 		return -1;
 	if (*p && strcmp(p, "%"))
 		return -1;
-
-	*percent = (unsigned) rint(per * max_percent_value);
+	if (per == 1.)
+		*percent = max_percent_value;
+	else
+		*percent = (unsigned) rint(per * max_percent_value);
 	return 0;
 }
 
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] iproute2: Avoid rounding errors for 100%.
  2009-11-03 15:38 [PATCH] iproute2: Avoid rounding errors for 100% hannemann
@ 2009-11-03 16:19 ` Arnd Hannemann
  2009-11-03 17:07   ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Hannemann @ 2009-11-03 16:19 UTC (permalink / raw)
  To: shemminger@osdl.org; +Cc: netdev@vger.kernel.org, Arnd Hannemann

Although the patch makes sense,
it does not fix the bug/effect we were seeing.
A netem reorder percentage of 100% will still get packets reordered.
(if the netem queue is not empty)


hannemann@nets.rwth-aachen.de wrote:
> From: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
> 
> We noticed that a netem reorder percentage of 100% will still get packets reordered.
> This patch fixes that.
> 
> Signed-off-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
> ---
>  tc/tc_util.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tc/tc_util.c b/tc/tc_util.c
> index fe2c7eb..2641f2e 100644
> --- a/tc/tc_util.c
> +++ b/tc/tc_util.c
> @@ -363,8 +363,10 @@ int get_percent(__u32 *percent, const char *str)
>  		return -1;
>  	if (*p && strcmp(p, "%"))
>  		return -1;
> -
> -	*percent = (unsigned) rint(per * max_percent_value);
> +	if (per == 1.)
> +		*percent = max_percent_value;
> +	else
> +		*percent = (unsigned) rint(per * max_percent_value);
>  	return 0;
>  }
>  


-- 
Dipl.-Inform. Arnd Hannemann
RWTH Aachen University
Dept. of Computer Science, Informatik 4
Ahornstr. 55, D-52074 Aachen, Germany
Phone: (+49 241) 80-21423 Fax: (+49 241) 80-22220

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iproute2: Avoid rounding errors for 100%.
  2009-11-03 16:19 ` Arnd Hannemann
@ 2009-11-03 17:07   ` Stephen Hemminger
  2009-11-03 17:19     ` Arnd Hannemann
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2009-11-03 17:07 UTC (permalink / raw)
  To: Arnd Hannemann; +Cc: netdev@vger.kernel.org, Arnd Hannemann

On Tue, 03 Nov 2009 17:19:45 +0100
Arnd Hannemann <hannemann@nets.rwth-aachen.de> wrote:

> Although the patch makes sense,
> it does not fix the bug/effect we were seeing.
> A netem reorder percentage of 100% will still get packets reordered.
> (if the netem queue is not empty)
> 
> 
> hannemann@nets.rwth-aachen.de wrote:
> > From: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
> > 
> > We noticed that a netem reorder percentage of 100% will still get packets reordered.
> > This patch fixes that.
> > 
> > Signed-off-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
> > ---
> >  tc/tc_util.c |    6 ++++--
> >  1 files changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tc/tc_util.c b/tc/tc_util.c
> > index fe2c7eb..2641f2e 100644
> > --- a/tc/tc_util.c
> > +++ b/tc/tc_util.c
> > @@ -363,8 +363,10 @@ int get_percent(__u32 *percent, const char *str)
> >  		return -1;
> >  	if (*p && strcmp(p, "%"))
> >  		return -1;
> > -
> > -	*percent = (unsigned) rint(per * max_percent_value);
> > +	if (per == 1.)
> > +		*percent = max_percent_value;
> > +	else
> > +		*percent = (unsigned) rint(per * max_percent_value);
> >  	return 0;
> >  }
> >  
> 
> 

If you don't want reordering, don't specify reordering?


-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iproute2: Avoid rounding errors for 100%.
  2009-11-03 17:07   ` Stephen Hemminger
@ 2009-11-03 17:19     ` Arnd Hannemann
  2009-11-03 18:05       ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Hannemann @ 2009-11-03 17:19 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev@vger.kernel.org

Stephen Hemminger wrote:
> On Tue, 03 Nov 2009 17:19:45 +0100
> Arnd Hannemann <hannemann@nets.rwth-aachen.de> wrote:
> 
>> Although the patch makes sense,
>> it does not fix the bug/effect we were seeing.
>> A netem reorder percentage of 100% will still get packets reordered.
>> (if the netem queue is not empty)
>>
>>
>> hannemann@nets.rwth-aachen.de wrote:
>>> From: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
>>>
>>> We noticed that a netem reorder percentage of 100% will still get packets reordered.
>>> This patch fixes that.
>>>
>>> Signed-off-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
>>> ---
>>>  tc/tc_util.c |    6 ++++--
>>>  1 files changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tc/tc_util.c b/tc/tc_util.c
>>> index fe2c7eb..2641f2e 100644
>>> --- a/tc/tc_util.c
>>> +++ b/tc/tc_util.c
>>> @@ -363,8 +363,10 @@ int get_percent(__u32 *percent, const char *str)
>>>  		return -1;
>>>  	if (*p && strcmp(p, "%"))
>>>  		return -1;
>>> -
>>> -	*percent = (unsigned) rint(per * max_percent_value);
>>> +	if (per == 1.)
>>> +		*percent = max_percent_value;
>>> +	else
>>> +		*percent = (unsigned) rint(per * max_percent_value);
>>>  	return 0;
>>>  }
>>>  
>>
> 
> If you don't want reordering, don't specify reordering?

Are you arguing against the correctness of my patch?

Regarding, the reordering thingy/bug/effect whatever:
We would like to specify reordering with something like this:
Please delay 1% of the packets with 5ms.

We thought that would be possible with
tc qdisc add dev eth0 root netem delay 5m reorder 99%

But unfortunately it is not. Any better idea?

Best regards,
Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iproute2: Avoid rounding errors for 100%.
  2009-11-03 17:19     ` Arnd Hannemann
@ 2009-11-03 18:05       ` Stephen Hemminger
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2009-11-03 18:05 UTC (permalink / raw)
  To: Arnd Hannemann; +Cc: netdev@vger.kernel.org

On Tue, 03 Nov 2009 18:19:19 +0100
Arnd Hannemann <hannemann@nets.rwth-aachen.de> wrote:

> Stephen Hemminger wrote:
> > On Tue, 03 Nov 2009 17:19:45 +0100
> > Arnd Hannemann <hannemann@nets.rwth-aachen.de> wrote:
> > 
> >> Although the patch makes sense,
> >> it does not fix the bug/effect we were seeing.
> >> A netem reorder percentage of 100% will still get packets reordered.
> >> (if the netem queue is not empty)
> >>
> >>
> >> hannemann@nets.rwth-aachen.de wrote:
> >>> From: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
> >>>
> >>> We noticed that a netem reorder percentage of 100% will still get packets reordered.
> >>> This patch fixes that.
> >>>
> >>> Signed-off-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
> >>> ---
> >>>  tc/tc_util.c |    6 ++++--
> >>>  1 files changed, 4 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/tc/tc_util.c b/tc/tc_util.c
> >>> index fe2c7eb..2641f2e 100644
> >>> --- a/tc/tc_util.c
> >>> +++ b/tc/tc_util.c
> >>> @@ -363,8 +363,10 @@ int get_percent(__u32 *percent, const char *str)
> >>>  		return -1;
> >>>  	if (*p && strcmp(p, "%"))
> >>>  		return -1;
> >>> -
> >>> -	*percent = (unsigned) rint(per * max_percent_value);
> >>> +	if (per == 1.)
> >>> +		*percent = max_percent_value;
> >>> +	else
> >>> +		*percent = (unsigned) rint(per * max_percent_value);
> >>>  	return 0;
> >>>  }
> >>>  
> >>
> > 
> > If you don't want reordering, don't specify reordering?
> 
> Are you arguing against the correctness of my patch?
> 
> Regarding, the reordering thingy/bug/effect whatever:
> We would like to specify reordering with something like this:
> Please delay 1% of the packets with 5ms.
> 
> We thought that would be possible with
> tc qdisc add dev eth0 root netem delay 5m reorder 99%
> 
> But unfortunately it is not. Any better idea?
> 

I think the problem isn't in iproute utilities but in the code inside
netem kernel module. 

-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-03 18:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-03 15:38 [PATCH] iproute2: Avoid rounding errors for 100% hannemann
2009-11-03 16:19 ` Arnd Hannemann
2009-11-03 17:07   ` Stephen Hemminger
2009-11-03 17:19     ` Arnd Hannemann
2009-11-03 18:05       ` Stephen Hemminger

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).