* [PATCH 3/4 V2] mac80211: add last beacon time in scan list
@ 2008-06-25 12:17 Tomas Winkler
2008-06-25 15:58 ` Pavel Roskin
0 siblings, 1 reply; 7+ messages in thread
From: Tomas Winkler @ 2008-06-25 12:17 UTC (permalink / raw)
To: linville, johannes, yi.zhu; +Cc: linux-wireless, Emmanuel Grumbach
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
This patch adds the interval between the scan results and the last time a
beacon was received in the result of the scan.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
net/mac80211/mlme.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 7b930d1..e76e62a 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -4658,12 +4658,26 @@ ieee80211_sta_scan_result(struct net_device *dev,
char *buf;
buf = kmalloc(30, GFP_ATOMIC);
if (buf) {
+ unsigned long mid_range = (-1) / 2 + 1;
+ unsigned long time_diff;
+
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVCUSTOM;
sprintf(buf, "tsf=%016llx", (unsigned long long)(bss->timestamp));
iwe.u.data.length = strlen(buf);
current_ev = iwe_stream_add_point(current_ev, end_buf,
&iwe, buf);
+ memset(&iwe, 0, sizeof(iwe));
+
+ iwe.cmd = IWEVCUSTOM;
+ time_diff = jiffies - bss->last_update > mid_range ?
+ jiffies - bss->last_update :
+ bss->last_update - jiffies;
+ sprintf(buf, "Last beacon:%dms ago",
+ jiffies_to_msecs(time_diff));
+ iwe.u.data.length = strlen(buf);
+ current_ev = iwe_stream_add_point(current_ev, end_buf,
+ &iwe, buf);
kfree(buf);
}
}
--
1.5.4.1
---------------------------------------------------------------------
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4 V2] mac80211: add last beacon time in scan list
2008-06-25 12:17 [PATCH 3/4 V2] mac80211: add last beacon time in scan list Tomas Winkler
@ 2008-06-25 15:58 ` Pavel Roskin
2008-06-25 16:07 ` drago01
2008-06-25 16:12 ` Johannes Berg
0 siblings, 2 replies; 7+ messages in thread
From: Pavel Roskin @ 2008-06-25 15:58 UTC (permalink / raw)
To: Tomas Winkler
Cc: linville, johannes, yi.zhu, linux-wireless, Emmanuel Grumbach
On Wed, 2008-06-25 at 15:17 +0300, Tomas Winkler wrote:
> From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
>
> This patch adds the interval between the scan results and the last time a
> beacon was received in the result of the scan.
>
> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> ---
> net/mac80211/mlme.c | 14 ++++++++++++++
> 1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 7b930d1..e76e62a 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -4658,12 +4658,26 @@ ieee80211_sta_scan_result(struct net_device *dev,
> char *buf;
> buf = kmalloc(30, GFP_ATOMIC);
> if (buf) {
> + unsigned long mid_range = (-1) / 2 + 1;
What is that? I guess that's where Riemann's zeta function has its
non-trivial roots :-)
> + 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?
> + sprintf(buf, "Last beacon:%dms ago",
> + jiffies_to_msecs(time_diff));
You lost space after the colon for some reason.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4 V2] mac80211: add last beacon time in scan list
2008-06-25 15:58 ` Pavel Roskin
@ 2008-06-25 16:07 ` drago01
2008-06-25 16:12 ` Johannes Berg
1 sibling, 0 replies; 7+ messages in thread
From: drago01 @ 2008-06-25 16:07 UTC (permalink / raw)
To: Pavel Roskin
Cc: Tomas Winkler, linville, johannes, yi.zhu, linux-wireless,
Emmanuel Grumbach
On Wed, Jun 25, 2008 at 5:58 PM, Pavel Roskin <proski@gnu.org> wrote:
>
>> + 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?
what about elapsed_jiffies() in iwl-helpers.h ?...
should be moved to a generic place (include/linux/jiffies.h) so that
other users can access it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4 V2] mac80211: add last beacon time in scan list
2008-06-25 15:58 ` Pavel Roskin
2008-06-25 16:07 ` drago01
@ 2008-06-25 16:12 ` Johannes Berg
2008-06-25 22:26 ` Tomas Winkler
1 sibling, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2008-06-25 16:12 UTC (permalink / raw)
To: Pavel Roskin
Cc: Tomas Winkler, linville, yi.zhu, linux-wireless,
Emmanuel Grumbach
[-- Attachment #1: Type: text/plain, Size: 743 bytes --]
On Wed, 2008-06-25 at 11:58 -0400, Pavel Roskin wrote:
> > + unsigned long mid_range = (-1) / 2 + 1;
>
> What is that? I guess that's where Riemann's zeta function has its
> non-trivial roots :-)
The Pavel hypothesis: "The Riemann hypothesis is correct when calculated
in 32-bit integers" is obviously wrong ;)
> > + 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?
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?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4 V2] mac80211: add last beacon time in scan list
2008-06-25 16:12 ` Johannes Berg
@ 2008-06-25 22:26 ` Tomas Winkler
2008-06-26 2:28 ` Pavel Roskin
0 siblings, 1 reply; 7+ messages in thread
From: Tomas Winkler @ 2008-06-25 22:26 UTC (permalink / raw)
To: Johannes Berg
Cc: Pavel Roskin, linville, yi.zhu, linux-wireless, Emmanuel Grumbach
On Wed, Jun 25, 2008 at 7:12 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2008-06-25 at 11:58 -0400, Pavel Roskin wrote:
>
>> > + unsigned long mid_range = (-1) / 2 + 1;
>>
>> What is that? I guess that's where Riemann's zeta function has its
>> non-trivial roots :-)
>
> The Pavel hypothesis: "The Riemann hypothesis is correct when calculated
> in 32-bit integers" is obviously wrong ;)
>
Welcome to the Desert of the Real
>> > + 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.
> 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?
But I'm good also with the old version as well. Just ACK one
Tomas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4 V2] mac80211: add last beacon time in scan list
2008-06-25 22:26 ` Tomas Winkler
@ 2008-06-26 2:28 ` Pavel Roskin
2008-06-26 13:26 ` Johannes Berg
0 siblings, 1 reply; 7+ messages in thread
From: Pavel Roskin @ 2008-06-26 2:28 UTC (permalink / raw)
To: Tomas Winkler
Cc: Johannes Berg, linville, yi.zhu, linux-wireless,
Emmanuel Grumbach
On Thu, 2008-06-26 at 01:26 +0300, Tomas Winkler wrote:
> On Wed, Jun 25, 2008 at 7:12 PM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > On Wed, 2008-06-25 at 11:58 -0400, Pavel Roskin wrote:
> >
> >> > + unsigned long mid_range = (-1) / 2 + 1;
> >>
> >> What is that? I guess that's where Riemann's zeta function has its
> >> non-trivial roots :-)
>
> >
> > 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.
> >> > + 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.
> > 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4 V2] mac80211: add last beacon time in scan list
2008-06-26 2:28 ` Pavel Roskin
@ 2008-06-26 13:26 ` Johannes Berg
0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2008-06-26 13:26 UTC (permalink / raw)
To: Pavel Roskin
Cc: Tomas Winkler, linville, yi.zhu, linux-wireless,
Emmanuel Grumbach
[-- Attachment #1: Type: text/plain, Size: 557 bytes --]
> > > 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.
That was my mistake, somehow I thought we'd have to account for wraps,
but that was wrong I think.
Let's use v1.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-06-26 13:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-25 12:17 [PATCH 3/4 V2] mac80211: add last beacon time in scan list Tomas Winkler
2008-06-25 15:58 ` Pavel Roskin
2008-06-25 16:07 ` drago01
2008-06-25 16:12 ` Johannes Berg
2008-06-25 22:26 ` Tomas Winkler
2008-06-26 2:28 ` Pavel Roskin
2008-06-26 13:26 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox