[Madwifi-devel] Help with 5 and 10 MHz channels in 11g band
Status: Beta
Brought to you by:
otaku
From: Aditya B. <ay...@an...> - 2010-06-24 21:04:31
|
Hi, In my project, I have to work with 5/10 MHz channels in the 11g band. So I changed DEF_REGDMN to FCC5_FCCB in ah_regdomain.c in the SVN branch of MadWifi By printing out the output of ath_hal_init_channels() inside ath_getchannels() in if_ath.c, I found that several channels were given the same channel number. For example see channel 1 in the below output Jun 24 16:55:00 AdLenovoLinux kernel: [25818.825068] MadWifi: ath_getchannels: Channel 1 (2412 MHz) Max Tx Power 20 dBm (hw limited) [20 hw 27 reg] Flags CF_INDOOR CF_OUTDOOR CF_CCK CF_2GHZ Jun 24 16:55:00 AdLenovoLinux kernel: [25818.825073] MadWifi: ath_getchannels: Channel 1 (2412 MHz) Max Tx Power 20 dBm (hw limited) [20 hw 27 reg] Flags CF_INDOOR CF_OUTDOOR CF_OFDM CF_2GHZ Jun 24 16:55:00 AdLenovoLinux kernel: [25818.825077] MadWifi: ath_getchannels: Channel 1 (2412 MHz) Max Tx Power 20 dBm (hw limited) [20 hw 27 reg] Flags CF_INDOOR CF_OUTDOOR CF_OFDM CF_2GHZ CF_HALF_RATE Jun 24 16:55:00 AdLenovoLinux kernel: [25818.825082] MadWifi: ath_getchannels: Channel 1 (2412 MHz) Max Tx Power 20 dBm (hw limited) [20 hw 27 reg] Flags CF_INDOOR CF_OUTDOOR CF_OFDM CF_2GHZ CF_QUARTER_RATE Since I want to use 5/10 MHz channels, I wrote a function calcChannelNumber() that is used by ath_hal_mhz2ieee to calculate channel numbers in the 11g band that replaces the following line return ((int)freq - 2407) / 5; This function is coded as below int calcChannelNumber(u_int freq, u_int flags) { static int adder = 0; static u_int lastFreq = 0; int channelNumber; if(lastFreq == 0) // first time this function is called lastFreq = freq; else if(lastFreq != freq) // frequency has changed { lastFreq = freq; // change the frequency adder += 2; } channelNumber = ((int)freq - 2407) / 5; channelNumber += adder; if(flags & CHANNEL_HALF) channelNumber++; else if(flags & CHANNEL_QUARTER) channelNumber += 2; return channelNumber; } Essentially, this function gives two 20 MHz channels (one with CCK and one with OFDM) the same number and the HALF and QUARTER rate channels consecutive higher numbers. Now the output from the kernel logs looks like this Jun 24 17:00:51 AdLenovoLinux kernel: [26170.690224] MadWifi: ath_getchannels: Channel 1 (2412 MHz) Max Tx Power 20 dBm (hw limited) [20 hw 27 reg] Flags CF_INDOOR CF_OUTDOOR CF_CCK CF_2GHZ Jun 24 17:00:51 AdLenovoLinux kernel: [26170.690228] MadWifi: ath_getchannels: Channel 1 (2412 MHz) Max Tx Power 20 dBm (hw limited) [20 hw 27 reg] Flags CF_INDOOR CF_OUTDOOR CF_OFDM CF_2GHZ Jun 24 17:00:51 AdLenovoLinux kernel: [26170.690232] MadWifi: ath_getchannels: Channel 2 (2412 MHz) Max Tx Power 20 dBm (hw limited) [20 hw 27 reg] Flags CF_INDOOR CF_OUTDOOR CF_OFDM CF_2GHZ CF_HALF_RATE Jun 24 17:00:51 AdLenovoLinux kernel: [26170.690237] MadWifi: ath_getchannels: Channel 3 (2412 MHz) Max Tx Power 20 dBm (hw limited) [20 hw 27 reg] Flags CF_INDOOR CF_OUTDOOR CF_OFDM CF_2GHZ CF_QUARTER_RATE This can also be verified from the output below ayb@AdLenovoLinux:~/scripts$ sudo wlanconfig ath0 list chans Channel 1 : 2412 Mhz 11g Channel 2 : 2412 Mhz 11g Half Channel 3 : 2412 Mhz 11g Quarter Channel 4 : 2417 Mhz 11g Channel 5 : 2417 Mhz 11g Half Channel 6 : 2417 Mhz 11g Quarter Channel 7 : 2422 Mhz 11g Channel 8 : 2422 Mhz 11g Half Channel 9 : 2422 Mhz 11g Quarter Channel 10 : 2427 Mhz 11g Channel 11 : 2427 Mhz 11g Half Channel 12 : 2427 Mhz 11g Quarter Channel 13 : 2432 Mhz 11g ................. Channel 33 : 2462 Mhz 11g Quarter However when I try to configure the AP and STA on any HALF or QUARTER rate 11g channel, the STA cannot associate with the AP and keeps on scanning. In the kernel logs, by adding a few printk's, I found that the ath_hal_reset() function keeps getting called. Can someone help me with this? Am I doing anything wrong or is there a better way to get access to these HALF/QUARTER rate channels? Thanks regards, Aditya Bhave |