netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas DICHTEL <nicolas.dichtel@6wind.com>
To: Thomas Graf <tgraf@suug.ch>
Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org
Subject: Re: Question about QOS
Date: Tue, 26 Apr 2005 16:57:32 +0200	[thread overview]
Message-ID: <426E56DC.7000108@6wind.com> (raw)
In-Reply-To: <20050426125955.GT577@postel.suug.ch>

[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]

Thomas Graf wrote:

>* Nicolas DICHTEL <426E06F1.9000105@6wind.com> 2005-04-26 11:16
>  
>
>>I set CONFIG_NET_SCH_CLK_GETTIMEOFDAY in my kernel. The macro 
>>PSCHED_TDIFF_SAFE calculates
>>the difference between two timestamps and uses the function 
>>psched_tod_diff() to do this.
>>If the clock is readjusted (due to ntp for example), this function can 
>>return a negative number
>>(if bound > 1000000) and then the flow is blocked by the kernel. Am I 
>>right ?
>>    
>>
>
>do_gettimeofday takes care of ntp adjustments so we _should_ be safe,
>however, it might be wise to enforce a range of 0..bound instead of
>INT_MIN..bound because qdiscs like red are relying on this. Assuming
>we have a delta of -4 seconds and return -4e6 red will horribly
>crash when acccessing the array with idle_time>>cell_log.
>
>  
>
You can have the same kind of problem with a ingress filter. I propose the
following patch to fix the range to 0..bound

[SCHED] Fix range in psched_tod_diff() to 0..bound

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>


[-- Attachment #2: x.diff --]
[-- Type: text/plain, Size: 456 bytes --]

diff -Nru linux-2.6-a/include/net/pkt_sched.h linux-2.6-b/include/net/pkt_sched.h
--- linux-2.6-a/include/net/pkt_sched.h	2005-04-26 15:45:07.074124664 +0200
+++ linux-2.6-b/include/net/pkt_sched.h	2005-04-26 15:47:26.215971888 +0200
@@ -140,7 +140,7 @@
 	if (bound <= 1000000 || delta_sec > (0x7FFFFFFF/1000000)-1)
 		return bound;
 	delta = delta_sec * 1000000;
-	if (delta > bound)
+	if (delta > bound || delta < 0)
 		delta = bound;
 	return delta;
 }

  reply	other threads:[~2005-04-26 14:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-26  9:16 Question about QOS Nicolas DICHTEL
2005-04-26 12:59 ` Thomas Graf
2005-04-26 14:57   ` Nicolas DICHTEL [this message]
2005-04-26 19:14     ` Thomas Graf
2005-04-27  7:44       ` Nicolas DICHTEL
2005-04-27 11:42         ` Thomas Graf
2005-04-28 19:14           ` David S. Miller
2005-04-29 12:16           ` Patrick McHardy
2005-04-29 12:39             ` Thomas Graf
2005-05-03 21:40             ` David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=426E56DC.7000108@6wind.com \
    --to=nicolas.dichtel@6wind.com \
    --cc=linux-net@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=tgraf@suug.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).