Re: [PATCH 3/4 V2] mac80211: add last beacon time in scan list
From: Pavel Roskin <hidden>
Date: 2008-06-26 02:28:55
On Thu, 2008-06-26 at 01:26 +0300, Tomas Winkler wrote:
On Wed, Jun 25, 2008 at 7:12 PM, Johannes Berg [off-list ref] wrote:quoted
On Wed, 2008-06-25 at 11:58 -0400, Pavel Roskin wrote:quoted
quoted
+ unsigned long mid_range = (-1) / 2 + 1;What is that? I guess that's where Riemann's zeta function has its non-trivial roots :-)quoted
The Pavel hypothesis: "The Riemann hypothesis is correct when calculated in 32-bit integers" is obviously wrong ;)Welcome to the Desert of the Real
Welcome to C. mid_range is 1, as you can easily check.
quoted
quoted
quoted
+ time_diff = jiffies - bss->last_update > mid_range ? + jiffies - bss->last_update : + bss->last_update - jiffies;That's pretty hairy. Do we really lack a function to calculate time difference?This is simplest as you can get under assumption that times are not apart more then 1/2 of UL. It would be overkill to translate it to timeval or anything we have diff function for.
Why would jiffies ever lag behind bss->last_update? When would (bss->last_update - jiffies) make sense? If it makes sense, how about indicating it somehow? It would be a value that decreases over time.
quoted
Actually, come to think of it, isn't just doing the difference as in teh original patch correct in 32-bit unsigned integers? It'll wrap around a bit but that's ok, no?It would make a very recent beacon to be like half an hour old on wraps, wouldn't it?
No. Why would it? Can you give an example? If you are not increasing precision, wraparounds should make no difference. -- Regards, Pavel Roskin