Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] mac80211: Update IBSS beacon timestamp properly
@ 2009-03-03  4:45 Sujith
  2009-03-08 12:52 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Sujith @ 2009-03-03  4:45 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, johannes, Jouni.Malinen

In IBSS mode, the beacon timestamp has to be filled with the
BSS's timestamp when joining, and set to zero when creating
a new BSS.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
---
 net/mac80211/ibss.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index a96ce9d..f4becc1 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -64,7 +64,7 @@ static int __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
 				     const int freq,
 				     const size_t supp_rates_len,
 				     const u8 *supp_rates,
-				     const u16 capability)
+				     const u16 capability, u64 tsf)
 {
 	struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
 	struct ieee80211_local *local = sdata->local;
@@ -127,6 +127,7 @@ static int __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
 	memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN);
 	mgmt->u.beacon.beacon_int =
 		cpu_to_le16(local->hw.conf.beacon_int);
+	mgmt->u.beacon.timestamp = cpu_to_le64(tsf);
 	mgmt->u.beacon.capab_info = cpu_to_le16(capability);
 
 	pos = skb_put(skb, 2 + ifibss->ssid_len);
@@ -199,7 +200,8 @@ static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
 					 bss->cbss.beacon_interval,
 					 bss->cbss.channel->center_freq,
 					 bss->supp_rates_len, bss->supp_rates,
-					 bss->cbss.capability);
+					 bss->cbss.capability,
+					 bss->cbss.tsf);
 }
 
 static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
@@ -502,7 +504,7 @@ static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
 					 bssid, local->hw.conf.beacon_int,
 					 local->hw.conf.channel->center_freq,
 					 sband->n_bitrates, supp_rates,
-					 capability);
+					 capability, 0);
 }
 
 static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
-- 
1.6.1


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

* Re: [PATCH] mac80211: Update IBSS beacon timestamp properly
  2009-03-03  4:45 [PATCH] mac80211: Update IBSS beacon timestamp properly Sujith
@ 2009-03-08 12:52 ` Johannes Berg
  2009-03-08 13:04   ` Sujith
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2009-03-08 12:52 UTC (permalink / raw)
  To: Sujith; +Cc: linville, linux-wireless, Jouni.Malinen

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

On Tue, 2009-03-03 at 10:15 +0530, Sujith wrote:
> In IBSS mode, the beacon timestamp has to be filled with the
> BSS's timestamp when joining, and set to zero when creating
> a new BSS.

I don't quite understand why, do we read it out again at any point?

johannes

> Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
> ---
>  net/mac80211/ibss.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
> index a96ce9d..f4becc1 100644
> --- a/net/mac80211/ibss.c
> +++ b/net/mac80211/ibss.c
> @@ -64,7 +64,7 @@ static int __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
>  				     const int freq,
>  				     const size_t supp_rates_len,
>  				     const u8 *supp_rates,
> -				     const u16 capability)
> +				     const u16 capability, u64 tsf)
>  {
>  	struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
>  	struct ieee80211_local *local = sdata->local;
> @@ -127,6 +127,7 @@ static int __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
>  	memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN);
>  	mgmt->u.beacon.beacon_int =
>  		cpu_to_le16(local->hw.conf.beacon_int);
> +	mgmt->u.beacon.timestamp = cpu_to_le64(tsf);
>  	mgmt->u.beacon.capab_info = cpu_to_le16(capability);
>  
>  	pos = skb_put(skb, 2 + ifibss->ssid_len);
> @@ -199,7 +200,8 @@ static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
>  					 bss->cbss.beacon_interval,
>  					 bss->cbss.channel->center_freq,
>  					 bss->supp_rates_len, bss->supp_rates,
> -					 bss->cbss.capability);
> +					 bss->cbss.capability,
> +					 bss->cbss.tsf);
>  }
>  
>  static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
> @@ -502,7 +504,7 @@ static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
>  					 bssid, local->hw.conf.beacon_int,
>  					 local->hw.conf.channel->center_freq,
>  					 sband->n_bitrates, supp_rates,
> -					 capability);
> +					 capability, 0);
>  }
>  
>  static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] mac80211: Update IBSS beacon timestamp properly
  2009-03-08 12:52 ` Johannes Berg
@ 2009-03-08 13:04   ` Sujith
  2009-03-08 13:08     ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Sujith @ 2009-03-08 13:04 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, linux-wireless, Jouni.Malinen

Johannes Berg wrote:
> On Tue, 2009-03-03 at 10:15 +0530, Sujith wrote:
> > In IBSS mode, the beacon timestamp has to be filled with the
> > BSS's timestamp when joining, and set to zero when creating
> > a new BSS.
> 
> I don't quite understand why, do we read it out again at any point?
> 

Drivers do, when they do a beacon_get(). And the timestamp in the
beacon is used to calculate TBTT.

Sujith

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

* Re: [PATCH] mac80211: Update IBSS beacon timestamp properly
  2009-03-08 13:04   ` Sujith
@ 2009-03-08 13:08     ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2009-03-08 13:08 UTC (permalink / raw)
  To: Sujith; +Cc: linville, linux-wireless, Jouni.Malinen

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

On Sun, 2009-03-08 at 18:34 +0530, Sujith wrote:
> Johannes Berg wrote:
> > On Tue, 2009-03-03 at 10:15 +0530, Sujith wrote:
> > > In IBSS mode, the beacon timestamp has to be filled with the
> > > BSS's timestamp when joining, and set to zero when creating
> > > a new BSS.
> > 
> > I don't quite understand why, do we read it out again at any point?
> > 
> 
> Drivers do, when they do a beacon_get(). And the timestamp in the
> beacon is used to calculate TBTT.

Oh ok.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2009-03-08 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-03  4:45 [PATCH] mac80211: Update IBSS beacon timestamp properly Sujith
2009-03-08 12:52 ` Johannes Berg
2009-03-08 13:04   ` Sujith
2009-03-08 13:08     ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox