2009-02-22 17:19:36

by Alina Friedrichsen

[permalink] [raw]
Subject: [PATCH v3] mac80211: Give it some time to do the TSF sync

Give slow hardware some time to do the TSF sync, to not run into an IBS=
S merging endless loop in some rarely situations.

Version 2 adds a comment.
Version 3: I had forgotten to change the bracket.
Version 4: No magic number.

Signed-off-by: Alina Friedrichsen <[email protected]>
---
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 1bbfc70..367d2cf 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -29,6 +29,7 @@
#define IEEE80211_IBSS_JOIN_TIMEOUT (7 * HZ)
=20
#define IEEE80211_IBSS_MERGE_INTERVAL (30 * HZ)
+#define IEEE80211_IBSS_MERGE_DELAY 0x400000
#define IEEE80211_IBSS_INACTIVITY_LIMIT (60 * HZ)
=20
#define IEEE80211_IBSS_MAX_STA_ENTRIES 128
@@ -332,6 +333,10 @@ static void ieee80211_rx_bss_info(struct ieee80211=
_sub_if_data *sdata,
jiffies);
#endif
=20
+ /* give slow hardware some time to do the TSF sync */
+ if (rx_timestamp < IEEE80211_IBSS_MERGE_DELAY)
+ goto put_bss;
+
if (beacon_timestamp > rx_timestamp) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG
printk(KERN_DEBUG "%s: beacon TSF higher than "

--=20
Psssst! Schon vom neuen GMX MultiMessenger geh=F6rt? Der kann`s mit all=
en: http://www.gmx.net/de/go/multimessenger01


2009-02-25 03:32:03

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v3] mac80211: Give it some time to do the TSF sync

On Wed, 2009-02-25 at 01:49 +0100, Alina Friedrichsen wrote:
> Hello Johannes!
>
> > Please elaborate on what this does. This uses the assumption that
> > reset_tsf() makes it start at 0, and that then the hardware won't sync
> > up until N seconds etc.
>
> The ath5k and ath9k drivers do so. If a driver/hardware don't, it
> causes other problems. For example ("iwconfig wlan0 essid new_ibss")
> if the sync isn't done before the first beacon is send and the TSF of
> the old IBSS-Network was higher the the TSF of the new one, so the all
> nodes of the new network now sync to the higher TSF of the old
> network.

Right. I just want to see an explanation in the code.

johannes


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2009-02-25 00:52:25

by Alina Friedrichsen

[permalink] [raw]
Subject: Re: [PATCH v3] mac80211: Give it some time to do the TSF sync

P.S.: You can test it with:

root@starbuck:~# echo reset > /sys/kernel/debug/ieee80211/phy0/tsf; cat=
/sys/kernel/debug/ieee80211/phy0/tsf=20
0x0000000000000ca0
root@starbuck:~#=20

--=20
Psssst! Schon vom neuen GMX MultiMessenger geh=F6rt? Der kann`s mit all=
en: http://www.gmx.net/de/go/multimessenger01

2009-02-25 00:49:59

by Alina Friedrichsen

[permalink] [raw]
Subject: Re: [PATCH v3] mac80211: Give it some time to do the TSF sync

Hello Johannes!

> Please elaborate on what this does. This uses the assumption that
> reset_tsf() makes it start at 0, and that then the hardware won't syn=
c
> up until N seconds etc.

The ath5k and ath9k drivers do so. If a driver/hardware don't, it cause=
s other problems. For example ("iwconfig wlan0 essid new_ibss") if the =
sync isn't done before the first beacon is send and the TSF of the old =
IBSS-Network was higher the the TSF of the new one, so the all nodes of=
the new network now sync to the higher TSF of the old network.

Regards
Alina

--=20
Computer Bild Tarifsieger! GMX FreeDSL - Telefonanschluss + DSL
f=FCr nur 17,95 =BF/mtl.!* http://dsl.gmx.de/?ac=3DOM.AD.PD003K11308T45=
69a

2009-02-23 13:46:36

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v3] mac80211: Give it some time to do the TSF sync

"Alina Friedrichsen" <[email protected]> writes:

> Give slow hardware some time to do the TSF sync, to not run into an
> IBSS merging endless loop in some rarely situations.
>
> Version 2 adds a comment.
> Version 3: I had forgotten to change the bracket.
> Version 4: No magic number.

Much better now, thanks. In the future, please write the patch
history...

> Signed-off-by: Alina Friedrichsen <[email protected]>
> ---

... to here (ie after the '---' line) so that they are ignored when
the patch applied. This is easier for John.

Reviewed-by: Kalle Valo <[email protected]>

Disclaimer: I know very little about mac80211 ibss implementation :)

--
Kalle Valo