netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH Linux-2.6.7-bk19] prism54 freq to channel incorrect for 5GHz
@ 2004-07-06 15:38 Margit Schubert-While
  2004-07-06 15:50 ` Sam Leffler
  2004-07-07  5:02 ` Jeff Garzik
  0 siblings, 2 replies; 7+ messages in thread
From: Margit Schubert-While @ 2004-07-06 15:38 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev, prism54-devel

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

2004-07-06 Margit Schubert-While <margitsw@t-online.de>

* The frequency to channel conversion is wrong for the 5GHz band
* Although the (known) devices don't/can't use it,
  they do report it. (iwlist ethX freq)

Margit



[-- Attachment #2: chanfreq.patch --]
[-- Type: text/x-diff, Size: 890 bytes --]

diff -Naur linux-2.6.7-02/drivers/net/wireless/prism54/oid_mgt.c linux-2.6.7-03/drivers/net/wireless/prism54/oid_mgt.c
--- linux-2.6.7-02/drivers/net/wireless/prism54/oid_mgt.c	2004-07-01 07:23:52.000000000 +0200
+++ linux-2.6.7-03/drivers/net/wireless/prism54/oid_mgt.c	2004-07-06 17:26:44.000000000 +0200
@@ -28,10 +28,6 @@
 	2447, 2452, 2457, 2462, 2467, 2472, 2484
 };
 
-const int frequency_list_a[] = { 5170, 5180, 5190, 5200, 5210, 5220, 5230,
-	5240, 5260, 5280, 5300, 5320
-};
-
 int
 channel_of_freq(int f)
 {
@@ -41,10 +37,8 @@
 		while ((c < 14) && (f != frequency_list_bg[c]))
 			c++;
 		return (c >= 14) ? 0 : ++c;
-	} else if ((f >= (int) 5170) && (f <= (int) 5320)) {
-		while ((c < 12) && (f != frequency_list_a[c]))
-			c++;
-		return (c >= 12) ? 0 : (c + 37);
+	} else if ((f >= (int) 5000) && (f <= (int) 6000)) {
+		return ( (f - 5000) / 5 );
 	} else
 		return 0;
 }

[-- Attachment #3: Type: text/plain, Size: 151 bytes --]

_______________________________________________
Prism54-devel mailing list
Prism54-devel@prism54.org
http://prism54.org/mailman/listinfo/prism54-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH Linux-2.6.7-bk19] prism54 freq to channel incorrect for 5GHz
@ 2004-07-07  6:31 Margit Schubert-While
  2004-07-07  7:49 ` Bjørn Mork
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Margit Schubert-While @ 2004-07-07  6:31 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev, prism54-devel

Jeff scribeth:
> any comment on Sam's comment ?

Sam was referring to this from the sourceforge madwifi
project :
 * Convert MHz frequency to IEEE channel number.
 */
u_int
ieee80211_mhz2ieee(u_int freq, u_int flags)
{
        if (flags & IEEE80211_CHAN_2GHZ) {      /* 2GHz band */
                if (freq == 2484)
                        return 14;
                if (freq < 2484)
                        return (freq - 2407) / 5;
                else
                        return 15 + ((freq - 2512) / 20);
        } else if (flags & IEEE80211_CHAN_5GHZ) {       /* 5Ghz band */
                return (freq - 5000) / 5;
        } else {                                /* either, guess */
                if (freq == 2484)
                        return 14;
                if (freq < 2484)
                        return (freq - 2407) / 5;
                if (freq < 5000)
                        return 15 + ((freq - 2512) / 20);
                return (freq - 5000) / 5;
        }
}

Mostly, the wirless drivers (airo, orinoco, prism54, etc) have a table for the
freq's.
For something generic, I would suggest something like this :
u_int
ieee80211_freq_to_channel(u_int freq)
{
	/* 2.4 GHz channel 14 */
	if ( freq == 2484 )
		return 14;
	/* 2.4 GHz channels 1 - 13 */
	if ( freq >= 2412 && freq <= 2472 )
		return (freq - 2407) / 5;
	/* 2.4 GHz unofficial channels */
	if ( freq > 2484 && freq < 5000 )
		return 15 + ((freq - 2512) / 20);
	/* 5 GHz channels 0 - 200 */
	if ( freq >= 5000 && freq <= 6000 )
		return (freq - 5000) / 5;
	/* Undefined */
	return 0;
}

Note that AFAIK, the 5GHz WLAN channels start at 34 (5.17 GHz)
(but I am not sure) and I don't know the top limit (except that
it is <= 6GHz). Maybe somebody can shed light on this.
If there is a clear definition, that should be reflected int the code.
And something similar for channel_to_freq.
Apparently Japan is doing something in the 10GHz band -
will have to look for details.

Margit

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

end of thread, other threads:[~2004-07-09  6:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-06 15:38 [PATCH Linux-2.6.7-bk19] prism54 freq to channel incorrect for 5GHz Margit Schubert-While
2004-07-06 15:50 ` Sam Leffler
2004-07-07  5:02 ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2004-07-07  6:31 Margit Schubert-While
2004-07-07  7:49 ` Bjørn Mork
2004-07-08 18:43 ` Vladimir Kondratiev
2004-07-09  6:58 ` Vladimir Kondratiev

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