netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 7/7] d80211: getting wrong freq value if we did hardware scan
@ 2006-08-28 20:57 mabbas
  2006-09-21 17:29 ` Jiri Benc
  0 siblings, 1 reply; 3+ messages in thread
From: mabbas @ 2006-08-28 20:57 UTC (permalink / raw)
  To: netdev; +Cc: jbenc

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

In this patch  we search all A-BAND available channels to get the  right 
frequency value. this might not be the right thing to do in beacon 
parsing. Another approach is to have a static array of  the maximum 
A-BAND channel number then we can map from channel to frequency fast. we 
can set the values of this array at run time.  

[-- Attachment #2: d80211-iwlist-fix.patch --]
[-- Type: text/x-patch, Size: 1750 bytes --]


This patch modify d80211 to fix getting wrong frequency value 
for scan implemented in hardware. With harware scan we might get
beacon of a network that is on different channel that in 
local->conf.channel causing set freq to wrong value.
 
Signed-off-by: Mohamed Abbas <mabbas@linux.intel.com>

diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index a933d92..374193e 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -1543,8 +1543,6 @@ #endif
 	bss->channel = channel;
 	bss->freq = local->conf.freq;
 	if (channel != local->conf.channel &&
-	    (local->conf.phymode == MODE_IEEE80211G ||
-	     local->conf.phymode == MODE_IEEE80211B) &&
 	    channel >= 1 && channel <= 14) {
 		static const int freq_list[] = {
 			2412, 2417, 2422, 2427, 2432, 2437, 2442,
@@ -1553,6 +1551,32 @@ #endif
 		/* IEEE 802.11g/b mode can receive packets from neighboring
 		 * channels, so map the channel into frequency. */
 		bss->freq = freq_list[channel - 1];
+
+		if (bss->hw_mode != MODE_IEEE80211G &&
+		    bss->hw_mode != MODE_IEEE80211B) 
+			bss->hw_mode = MODE_IEEE80211G;
+
+	} else if (channel != local->conf.channel ) {
+		int j, i; 
+		int b_found = 0;
+
+		/* not a bg channel search in other mode */
+		for (i = 0; i < local->hw->num_modes; i++) {
+			struct ieee80211_hw_modes *mode = &local->hw->modes[i];
+
+			if ((mode->mode != MODE_IEEE80211G) &&
+			    (mode->mode != MODE_IEEE80211B)){
+				for (j = 0; mode->num_channels; j++)
+				if (mode->channels[j].chan == channel) {
+					bss->freq = mode->channels[j].freq;
+					b_found = 1;
+					bss->hw_mode = mode->mode;
+					break;
+				}
+			}
+			if (b_found)
+				break;
+		}
 	}
 	bss->timestamp = timestamp;
 	bss->last_update = jiffies;

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

* Re: [PATCH 7/7] d80211: getting wrong freq value if we did hardware scan
  2006-08-28 20:57 [PATCH 7/7] d80211: getting wrong freq value if we did hardware scan mabbas
@ 2006-09-21 17:29 ` Jiri Benc
  2006-09-21 17:42   ` mabbas
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Benc @ 2006-09-21 17:29 UTC (permalink / raw)
  To: mabbas; +Cc: netdev

On Mon, 28 Aug 2006 13:57:28 -0700, mabbas wrote:
> diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
> index a933d92..374193e 100644
> --- a/net/d80211/ieee80211_sta.c
> +++ b/net/d80211/ieee80211_sta.c
> @@ -1543,8 +1543,6 @@ #endif
>  	bss->channel = channel;
>  	bss->freq = local->conf.freq;
>  	if (channel != local->conf.channel &&
> -	    (local->conf.phymode == MODE_IEEE80211G ||
> -	     local->conf.phymode == MODE_IEEE80211B) &&
>  	    channel >= 1 && channel <= 14) {

The patch doesn't look correct. As I already wrote, no hackish guessing of
the phymode from channel numbers, please.

Are there any problems with just using rx_status->phymode instead of
local->conf.phymode (other than "drivers don't set that field" as that can
be easily fixed)?

Thanks,

 Jiri

-- 
Jiri Benc
SUSE Labs

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

* Re: [PATCH 7/7] d80211: getting wrong freq value if we did hardware scan
  2006-09-21 17:29 ` Jiri Benc
@ 2006-09-21 17:42   ` mabbas
  0 siblings, 0 replies; 3+ messages in thread
From: mabbas @ 2006-09-21 17:42 UTC (permalink / raw)
  To: Jiri Benc; +Cc: netdev

Jiri Benc wrote:
> On Mon, 28 Aug 2006 13:57:28 -0700, mabbas wrote:
>   
>> diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
>> index a933d92..374193e 100644
>> --- a/net/d80211/ieee80211_sta.c
>> +++ b/net/d80211/ieee80211_sta.c
>> @@ -1543,8 +1543,6 @@ #endif
>>  	bss->channel = channel;
>>  	bss->freq = local->conf.freq;
>>  	if (channel != local->conf.channel &&
>> -	    (local->conf.phymode == MODE_IEEE80211G ||
>> -	     local->conf.phymode == MODE_IEEE80211B) &&
>>  	    channel >= 1 && channel <= 14) {
>>     
>
> The patch doesn't look correct. As I already wrote, no hackish guessing of
> the phymode from channel numbers, please.
>
> Are there any problems with just using rx_status->phymode instead of
> local->conf.phymode (other than "drivers don't set that field" as that can
> be easily fixed)?
>   
Excellent idea here I will fix this patch to use rx_status->phymode if 
set otherwise it will use the default algorithm already exist.
> Thanks,
>
>  Jiri
>
>   

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

end of thread, other threads:[~2006-09-21 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-28 20:57 [PATCH 7/7] d80211: getting wrong freq value if we did hardware scan mabbas
2006-09-21 17:29 ` Jiri Benc
2006-09-21 17:42   ` mabbas

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).