Bug 12315 - Cannot list available channels on ath5k-based R52 with iw phy
Summary: Cannot list available channels on ath5k-based R52 with iw phy
Status: CLOSED CODE_FIX
Alias: None
Product: Networking
Classification: Unclassified
Component: Wireless (show other bugs)
Hardware: All Linux
: P1 low
Assignee: networking_wireless@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-28 08:54 UTC by Simon Farnsworth
Modified: 2009-05-11 15:51 UTC (History)
6 users (show)

See Also:
Kernel Version: 2.6.28-rc9-9238-gf2109d7
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Simon Farnsworth 2008-12-28 08:54:08 UTC
Latest working kernel version:N/A
Earliest failing kernel version:N/A (not a regression)
Distribution: Debian Lenny + self-compiled packages
Hardware Environment:
Intel Atom-based x86-64 motherboard, 2xMikrotik R52 ath5k-based WiFi cards
Software Environment:
libnl1 from Debian Lenny, iw from git, git describe gives v0.9.7-8-g917ce73

Problem Description:
When I try to get a list of supported channels with iw, I get:
# iw phy phy0 info
command failed: No buffer space available (-105)

(my ultimate goal is to get hostapd working, which is currently failing with:
# hostapd -dd hostapd.wlan0
Configuration file: hostapd.wlan0
ctrl_interface_group=0
Opening raw packet socket for ifindex 651949248
BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)
SIOCGIWRANGE: WE(compiled)=22 WE(source)=21 enc_capa=0xf
wlan0: IEEE 802.11 Fetching hardware channel/rate support not supported.
Flushing old station entries
Deauthenticate all stations
Mode: IEEE 802.11a  Channel: 36  Frequency: 0 MHz
Could not set channel for kernel driver
wlan0: Unable to setup interface.

I have added support for AP mode with diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 40c0155..1430a84 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -506,6 +506,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
        hw->wiphy->interface_modes =
                BIT(NL80211_IFTYPE_STATION) |
                BIT(NL80211_IFTYPE_ADHOC) |
+               BIT(NL80211_IFTYPE_AP) |
                BIT(NL80211_IFTYPE_MESH_POINT);

        hw->extra_tx_headroom = 2;

)
Comment 1 Simon Farnsworth 2008-12-28 10:17:13 UTC
I have a workaround patch:
diff --git a/drivers/net/wireless/ath5k/caps.c b/drivers/net/wireless/ath5k/caps.c
index 150f5ed..eec9d60 100644
--- a/drivers/net/wireless/ath5k/caps.c
+++ b/drivers/net/wireless/ath5k/caps.c
@@ -69,8 +69,8 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)

                if (AR5K_EEPROM_HDR_11A(ee_header)) {
                        /* 4920 */
-                       ah->ah_capabilities.cap_range.range_5ghz_min = 5005;
-                       ah->ah_capabilities.cap_range.range_5ghz_max = 6100;
+                       ah->ah_capabilities.cap_range.range_5ghz_min = 5170;
+                       ah->ah_capabilities.cap_range.range_5ghz_max = 5710;

                        /* Set supported modes */
                        __set_bit(AR5K_MODE_11A,
@@ -88,7 +88,7 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
                                AR5K_EEPROM_HDR_11G(ee_header)) {
                        /* 2312 */
                        ah->ah_capabilities.cap_range.range_2ghz_min = 2412;
-                       ah->ah_capabilities.cap_range.range_2ghz_max = 2732;
+                       ah->ah_capabilities.cap_range.range_2ghz_max = 2482;

                        if (AR5K_EEPROM_HDR_11B(ee_header))
                                __set_bit(AR5K_MODE_11B,
Comment 2 Daniel J Blueman 2009-01-19 11:41:14 UTC
The workaround patch seems to address the 'iw phy phy0 info' command (presumably the request IOCTL doesn't pass enough allocated buffer space for the larger channel list), but doesn't help with the hostapd channel setting.

I have found that commenting out the channel setting in hostapd.conf and using eg 'iwconfig wlan0 channel 11' seems a possible workaround for the hostapd issue.
Comment 3 Simon Farnsworth 2009-01-19 11:47:14 UTC
It works for me with hostapd git. Without the workaround patch, hostapd fails to list possible channels - with it, it can list and set them, both in the 5GHz band, and the 2.4GHz band.
Comment 4 Daniel J Blueman 2009-01-19 11:55:18 UTC
The hostapd (git HEAD/0.6.7) failure I see is:

# ./hostapd hostapd.conf
Configuration file: hostapd.conf
wlan0: IEEE 802.11 Configured channel (11) not found from the channel list of current mode (1) IEEE 802.11g
wlan0: IEEE 802.11 Hardware does not support configured channel
Could not select hw_mode and channel. (-1)
rmdir[ctrl_interface]: No such file or directory

I'm using 2.6.28.1's ath5k with AR5414 hardware and some minimal and seemingly well-known patches to enable AP mode in ath5k and mac80211. What about you?
Comment 5 Simon Farnsworth 2009-01-19 12:08:40 UTC
I'm tracking wireless-testing, with the two patches in this bug applied. My 2.4GHz configuration is:

interface=wlan1
bridge=main-bridge
driver=nl80211
logger_syslog=-1
logger_syslog_level=2
logger_stdout=0
logger_stdout_level=0

dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0

ssid=FarnzPrivate
country_code=GB
ieee80211d=1
hw_mode=g
channel=11

preamble=1
auth_algs=3

Plus auth stuff that's common with the 5GHz configuration
Comment 6 aCaB 2009-03-14 17:49:50 UTC
I can confirm the patch from Simon Farnsworth works.

However this still doesn't make hostapd (git) happy.
All available channels are in fact marked as PASSIVE_SCAN|NO_IBSS:
# ./iw list
Wiphy phy1
        Band 1:
                Frequencies:
                        * 2412 MHz [1] (20.0 dBm) (passive scanning, no IBSS)
                        * 2417 MHz [2] (20.0 dBm) (passive scanning, no IBSS)
                        * 2422 MHz [3] (20.0 dBm) (passive scanning, no IBSS)
                        * 2427 MHz [4] (20.0 dBm) (passive scanning, no IBSS)
[...]

And hostapd doesn't like them (hw_features.c:70):
                for (j = 0; j < feature->num_channels; j++) {
                        /*
                         * Disable all channels that are marked not to allow
                         * IBSS operation or active scanning. In addition,
                         * disable all channels that require radar detection,
                         * since that (in addition to full DFS) is not yet
                         * supported.
                         */
                        if (feature->channels[j].flag &
                            (HOSTAPD_CHAN_NO_IBSS |
                             HOSTAPD_CHAN_PASSIVE_SCAN |
                             HOSTAPD_CHAN_RADAR))
                                feature->channels[j].flag |=
                                        HOSTAPD_CHAN_DISABLED;

Here all the available channels are marked as unavailable.

As a quick hack it is possible to comment out that check to make hostapd happy and working. A better fix is probably to set correct channel flags in ath5k/base.c
Comment 7 Bob Copeland 2009-04-01 14:22:23 UTC
Please try this patch:

http://marc.info/?l=linux-wireless&m=123841474910111&q=raw
Comment 8 Bob Copeland 2009-04-01 14:25:41 UTC
acaB: what regulatory domain are you using?
Comment 9 Simon Farnsworth 2009-04-04 17:30:59 UTC
(In reply to comment #7)
> Please try this patch:
> 
> http://marc.info/?l=linux-wireless&m=123841474910111&q=raw

This patch works on my system, and is as effective as my patch was.

Tested-By: Simon Farnsworth <simon@farnz.org.uk>
Comment 10 aCaB 2009-04-07 18:10:08 UTC
(In reply to comment #8)
> acaB: what regulatory domain are you using?

Sorry I'm unable to do any test ATM as the alix board where the card is plugged in is currently unable to boot after upgrading from 2.6.29-rc8 to 2.6.29.1 :(

I will let you know as soon as I manage to boot again.
Comment 11 aCaB 2009-05-01 17:17:28 UTC
(In reply to comment #7)
> Please try this patch:
> 
> http://marc.info/?l=linux-wireless&m=123841474910111&q=raw

The patch works for iw phy. I now get:
Wiphy phy0
        Band 1:                                
                Frequencies:                   
                        * 2412 MHz [1] (20.0 dBm) (passive scanning, no IBSS)
                        * 2417 MHz [2] (20.0 dBm) (passive scanning, no IBSS)
                        * 2422 MHz [3] (20.0 dBm) (passive scanning, no IBSS)
                        * 2427 MHz [4] (20.0 dBm) (passive scanning, no IBSS)
                        * 2432 MHz [5] (20.0 dBm) (passive scanning, no IBSS)
                        * 2437 MHz [6] (20.0 dBm) (passive scanning, no IBSS)
                        * 2442 MHz [7] (20.0 dBm) (passive scanning, no IBSS)
                        * 2447 MHz [8] (20.0 dBm) (passive scanning, no IBSS)
                        * 2452 MHz [9] (20.0 dBm) (passive scanning, no IBSS)
                        * 2457 MHz [10] (20.0 dBm) (passive scanning, no IBSS)
                        * 2462 MHz [11] (20.0 dBm) (passive scanning, no IBSS)
                        * 2467 MHz [12] (disabled)                            
                        * 2472 MHz [13] (disabled)                            
                        * 2484 MHz [14] (disabled)                            
                Bitrates:                                                     
                        * 1.0 Mbps                                            
                        * 2.0 Mbps (short preamble supported)                 
                        * 5.5 Mbps (short preamble supported)                 
                        * 11.0 Mbps (short preamble supported)                
                        * 6.0 Mbps                                            
                        * 9.0 Mbps                                            
                        * 12.0 Mbps                                           
                        * 18.0 Mbps                                           
                        * 24.0 Mbps                                           
                        * 36.0 Mbps                                           
                        * 48.0 Mbps                                           
                        * 54.0 Mbps                                           
        Band 2:
                Frequencies:
                        * 5180 MHz [36] (disabled)
                        * 5200 MHz [40] (disabled)
                        * 5220 MHz [44] (disabled)
                        * 5240 MHz [48] (disabled)
                        * 5260 MHz [52] (disabled)
                        * 5280 MHz [56] (disabled)
                        * 5300 MHz [60] (disabled)
                        * 5320 MHz [64] (disabled)
                        * 5500 MHz [100] (disabled)
                        * 5520 MHz [104] (disabled)
                        * 5540 MHz [108] (disabled)
                        * 5560 MHz [112] (disabled)
                        * 5580 MHz [116] (disabled)
                        * 5600 MHz [120] (disabled)
                        * 5620 MHz [124] (disabled)
                        * 5640 MHz [128] (disabled)
                        * 5660 MHz [132] (disabled)
                        * 5680 MHz [136] (disabled)
                        * 5700 MHz [140] (disabled)
                        * 5745 MHz [149] (disabled)
                        * 5765 MHz [153] (disabled)
                        * 5785 MHz [157] (disabled)
                        * 5805 MHz [161] (disabled)
                        * 5825 MHz [165] (disabled)
                Bitrates:
                        * 6.0 Mbps
                        * 9.0 Mbps
                        * 12.0 Mbps
                        * 18.0 Mbps
                        * 24.0 Mbps
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
        Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor
                 * mesh point


(In reply to comment #8)
> acaB: what regulatory domain are you using?

loneliness:~# iw reg get
command failed: Operation not supported (-95)


However "reg set" works. I can set it to world or IT or US without any change to the above.
Comment 12 aCaB 2009-05-03 20:11:28 UTC
Another update: I'm now running
+ kernel 2.6.29.2
+ Wireless-testing 5ece8a46f9aeb9d6f80a3c4414f2c27682dc706b
+ this set of 9 patches: https://lists.ath5k.org/pipermail/ath5k-devel/2009-April/002314.html

Everything seems fine now:
- channels are no longer marked passivescan+noibss in iw
- iw reg get and set both work properly
- hostapd works without my crude hack

Thanks!
Comment 13 Bob Copeland 2009-05-08 20:55:44 UTC
Thanks for testing, all.  These patches are all in wireless-testing now so this bug can be closed.

Note You need to log in before you can comment on or make changes to this bug.