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

* Re: [PATCH Linux-2.6.7-bk19] prism54 freq to channel incorrect for 5GHz
  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
  1 sibling, 0 replies; 7+ messages in thread
From: Sam Leffler @ 2004-07-06 15:50 UTC (permalink / raw)
  To: Margit Schubert-While; +Cc: netdev, jgarzik, prism54-devel

On Tuesday 06 July 2004 08:38 am, Margit Schubert-While wrote:
> 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)

There is known good code to do this in the madwifi net80211 layer.

	Sam

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

* Re: [PATCH Linux-2.6.7-bk19] prism54 freq to channel incorrect for 5GHz
  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
  1 sibling, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2004-07-07  5:02 UTC (permalink / raw)
  To: Margit Schubert-While; +Cc: netdev, prism54-devel

applied.

any comment on Sam's comment?  is there generic code, so that we can 
avoid driver-specific code?

^ 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

* Re: [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
  2004-07-08 18:43 ` Vladimir Kondratiev
  2004-07-09  6:58 ` Vladimir Kondratiev
  2 siblings, 0 replies; 7+ messages in thread
From: Bjørn Mork @ 2004-07-07  7:49 UTC (permalink / raw)
  To: Margit Schubert-While; +Cc: netdev, jgarzik, prism54-devel

margitsw@t-online.de (Margit Schubert-While) writes:

> Note that AFAIK, the 5GHz WLAN channels start at 34 (5.17 GHz)
> (but I am not sure)

802.11a defines all channels 0..200, i.e. all center frequencies from
5 to 6 GHz.  But I don't know any country which allows usage of the 5 GHz 
band below 5150 MHz, and the lowest channel should be at least 20 MHz
from the band edge, so 34 is probably the lowest channel that legally
can be used anywhere (and I believe 36 is the lowest allowed in the US?)

> and I don't know the top limit (except that
> it is <= 6GHz). Maybe somebody can shed light on this.

The highest available frequency (in Europe at least) is 5875 MHz.
Which would make 171 the highest available channel (given a 20 MHz
minimum distance from the center frequency to the band edge).

> Apparently Japan is doing something in the 10GHz band -
> will have to look for details.

That would require a new PHY standard.


Bjørn

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

* Re: [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
@ 2004-07-08 18:43 ` Vladimir Kondratiev
  2004-07-09  6:58 ` Vladimir Kondratiev
  2 siblings, 0 replies; 7+ messages in thread
From: Vladimir Kondratiev @ 2004-07-08 18:43 UTC (permalink / raw)
  To: netdev; +Cc: Margit Schubert-While, jgarzik, prism54-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 07 July 2004 09:31, Margit Schubert-While wrote:
[code skipped]
> 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.
It is not 10 GHz band. They use the same 5 GHz band, exactly same frequencies, 
but channel is twice narrower - 10Mhz instead of 20Mhz as usual 802.11.

In 10Mhz channels, they use 1/2 data rates as well. I.e. 
(6,9,12,18,24,36,48,54) rates replaced by (3,4.5,6,9,12,18,24,27)

For frequencies, there are several documents. I'll try to summarize:

2.4Ghz band (as in code):
in 802.11b standard, 14 channels defined:
freq=channel*5 + 2407, channel=1..13
freq=2484, channel=14

Those "unofficial" frequencies are not defined. BTW, do anyone know document 
desctibing them?

5Ghz band (as in code):

freq=channel*5 + 5000, channel=0..200 (from standard)

For valid channels, 802.11a standard says there are 3 bands (all in US):
1: 36,40,44,48
2: 52,56,60,64
3: 149,153,157,161

TGh (regulation in Europe) adds channels 
100..140 with interval 4

Tgj (japan) spec adds new rules: 10Mhz channels I mentioned above, and channel 
formula:
freq=channel*5+dot11ChannelStartingFrequency; where 
dot11ChannelStartingFrequency may be 4000 or 5000 (as for .11a)
For channels 183 and above, it is 4000, for others - 5000

Valid channels for Japan (note some channels may have both 10 and 20 Mhz 
width, some - only one of them):

20Mhz channels: 184,188,192,196;8,12,16,34,38,42,46
10Mhz channels: 183,184,185,187,188,189;7,8,11

For TGn (high throughput) standard expected to finalize around 2006, wide 
40Mhz channels expected, with maybe some additional attributes.

After describing this whole mess, some points to pay attention:

- - channel number is not enough to determine frequency - there are same numbers  
in 2.4 and 5Ghz bands. 
- - to properly init hardware, channel witdh should be provided as well.

Thus, we probable need to use (channel,band,width) triples or (channel,domain) 
tuples, where (band,width) mapped into domain.

Vladimir
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA7ZXAqxdj7mhC6o0RAje5AJ4rDQLYmUj4QuqZgVRz71eeoq99SgCcCAWm
GQSHPKvBkPgLjbO7mONUyNI=
=hyvM
-----END PGP SIGNATURE-----

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

* Re: [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
  2004-07-08 18:43 ` Vladimir Kondratiev
@ 2004-07-09  6:58 ` Vladimir Kondratiev
  2 siblings, 0 replies; 7+ messages in thread
From: Vladimir Kondratiev @ 2004-07-09  6:58 UTC (permalink / raw)
  To: netdev; +Cc: Margit Schubert-While, jgarzik, prism54-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 07 July 2004 09:31, Margit Schubert-While wrote:
[code skipped]
> 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.
It is not 10 GHz band. They use the same 5 GHz band, exactly same frequencies,
but channel is twice narrower - 10Mhz instead of 20Mhz as usual 802.11.

In 10Mhz channels, they use 1/2 data rates as well. I.e.
(6,9,12,18,24,36,48,54) rates replaced by (3,4.5,6,9,12,18,24,27)

For frequencies, there are several documents. I'll try to summarize:

2.4Ghz band (as in code):
in 802.11b standard, 14 channels defined:
freq=channel*5 + 2407, channel=1..13
freq=2484, channel=14

Those "unofficial" frequencies are not defined. BTW, do anyone know document
desctibing them?

5Ghz band (as in code):

freq=channel*5 + 5000, channel=0..200 (from standard)

For valid channels, 802.11a standard says there are 3 bands (all in US):
1: 36,40,44,48
2: 52,56,60,64
3: 149,153,157,161

TGh (regulation in Europe) adds channels
100..140 with interval 4

Tgj (japan) spec adds new rules: 10Mhz channels I mentioned above, and channel
formula:
freq=channel*5+dot11ChannelStartingFrequency; where
dot11ChannelStartingFrequency may be 4000 or 5000 (as for .11a)
For channels 183 and above, it is 4000, for others - 5000

Valid channels for Japan (note some channels may have both 10 and 20 Mhz
width, some - only one of them):

20Mhz channels: 184,188,192,196;8,12,16,34,38,42,46
10Mhz channels: 183,184,185,187,188,189;7,8,11

For TGn (high throughput) standard expected to finalize around 2006, wide
40Mhz channels expected, with maybe some additional attributes.

After describing this whole mess, some points to pay attention:

- - channel number is not enough to determine frequency - there are same numbers
in 2.4 and 5Ghz bands.
- - to properly init hardware, channel witdh should be provided as well.

Thus, we probable need to use (channel,band,width) triples or (channel,domain)
tuples, where (band,width) mapped into domain.

Vladimir
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA7kIAqxdj7mhC6o0RAgdvAJ9KaF5ciW+EjJP8ITc6nbVQGYV4NgCfYkS/
KnSqVGQxal52x5cPPePphYM=
=CHNv
-----END PGP SIGNATURE-----

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