2008-12-15 20:41:16

by Krzysztof Halasa

[permalink] [raw]
Subject: ath5k + AP mode?

Hi,

Is AP mode with ath5k supposed to work?

My hw:
- IPX425 CPU (ARM architecture - in big- or little-endian mode)
- Wistron NeWeb Corp. CM9 a/b/g MiniPCI (AR5001X+, PCI IDs 168c:0013 +
sub 185f:1012).
- hostapd from git (f4f2774a96d91753811e921380856bc859888153)
- linux from git (basically wireless-testing = master-2008-12-12)

Added:
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -505,6 +505,7 @@ ath5k_pci_probe(struct pci_dev *pdev,

hw->wiphy->interface_modes =
BIT(NL80211_IFTYPE_STATION) |
+ BIT(NL80211_IFTYPE_AP) |
BIT(NL80211_IFTYPE_ADHOC) |
BIT(NL80211_IFTYPE_MESH_POINT);

Now:

# ifconfig wlan0 up
# iwlist wlan0 scan
wlan0 Scan completed :
Cell XX (shows many cells)

# ifconfig wlan0 down (is it needed?)
# hostapd -dd /etc/hostapd.conf
Configuration file: /etc/hostapd.conf
ctrl_interface_group=0
Failed to set interface wlan0 to master mode.
nl80211 driver initialization failed.
wlan0: Unable to setup interface.
rmdir[ctrl_interface]: No such file or directory
ELOOP: remaining socket: sock=5 eloop_data=0x57bd8 user_data=(nil) handler=0x32b10

Relevant .config:
CONFIG_WIRELESS=y
CONFIG_CFG80211=y
CONFIG_CFG80211_REG_DEBUG=y
CONFIG_NL80211=y
CONFIG_WIRELESS_EXT=y
CONFIG_WIRELESS_EXT_SYSFS=y
CONFIG_MAC80211=y
CONFIG_MAC80211_RC_PID=y
CONFIG_MAC80211_RC_DEFAULT_PID=y
CONFIG_MAC80211_RC_DEFAULT="pid"
CONFIG_MAC80211_LEDS=y
CONFIG_MAC80211_DEBUG_MENU=y
CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT=y
CONFIG_MAC80211_VERBOSE_DEBUG=y
CONFIG_MAC80211_HT_DEBUG=y
CONFIG_MAC80211_TKIP_DEBUG=y
CONFIG_MAC80211_IBSS_DEBUG=y
CONFIG_MAC80211_VERBOSE_PS_DEBUG=y
CONFIG_MAC80211_VERBOSE_SPECT_MGMT_DEBUG=y

CONFIG_WLAN_80211=y
CONFIG_ATH5K=m
CONFIG_ATH5K_DEBUG=y

Related dmesg:
PCI: enabling device 0000:00:0d.0 (0140 -> 0142)
ath5k 0000:00:0d.0: registered as 'phy0'
phy0: Selected rate control algorithm 'pid'
ath5k phy0: Atheros AR5213A chip found (MAC: 0x59, PHY: 0x43)
ath5k phy0: RF5112B multiband radio found (0x36)
--
Krzysztof Halasa


2008-12-16 20:30:09

by Krzysztof Halasa

[permalink] [raw]
Subject: Re: ath5k + AP mode?

"Bob Copeland" <[email protected]> writes:

>> Failed to set interface wlan0 to master mode.
>> nl80211 driver initialization failed.
>> wlan0: Unable to setup interface.
>
> It's probably worth taking a look at hostapd to see what exactly is failing.
> We should be able to create an IFTYPE_AP interface with your above patch
> applied. No telling whether the rest works.

Well, it seems nl80211_set_master_mode() calls send_and_recv_msgs()
and then nl_recvmsgs(0x58cf0, 0x5b2f8) fails with -95 (-EOPNOTSUPP).

sendmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000},
msg_iov(1)=[{"\x24\x00\x00\x00\x11\x00\x05\x00\x2f\xf5\x47\x49\xd0\x01\x00\x00\x06\x00\x00\x00\x08\x00\x03\x00\x03\x00\x00\x00\x08\x00\x05\x00\x03\x00\x00\x00"..., 36}],
msg_controllen=0, msg_flags=0}, 0) = 36

recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000},
msg_iov(1)=[{"\x24\x00\x00\x00\x02\x00\x00\x00\x5d\xf6\x47\x49\xd7\x01\x00\x00\xa1\xff\xff\xff\x24\x00\x00\x00\x11\x00\x05\x00\x5d\xf6\x47\x49\xd7\x01\x00\x00"..., 4096}],
msg_controllen=0, msg_flags=0}, 0) = 36

$ grep -lr -- -EOPNOTSUPP drivers/net/wireless/ath5k
drivers/net/wireless/ath5k/base.c
drivers/net/wireless/ath5k/pcu.c
but it doesn't seem it's one of those.

Request:
24 00 00 00 len
11 00 type = genl_family_get_id(drv->nl80211)
05 00 flags = NLM_F_REQUEST | NLM_F_ACK
2f f5 47 49 seq
d0 01 00 00 pid

06 00 00 00 NL80211_CMD_SET_INTERFACE

08 00 len
03 00 NL80211_ATTR_IFINDEX
03 00 00 00 if_nametoindex(ifname)

08 00 len
05 00 NL80211_ATTR_IFTYPE
03 00 00 00 NL80211_IFTYPE_AP
--
Krzysztof Halasa

2008-12-16 20:44:18

by Johannes Berg

[permalink] [raw]
Subject: Re: ath5k + AP mode?

On Tue, 2008-12-16 at 21:27 +0100, Krzysztof Halasa wrote:
> "Bob Copeland" <[email protected]> writes:
>
> > It's probably worth taking a look at hostapd to see what exactly is failing.
> > We should be able to create an IFTYPE_AP interface with your above patch
> > applied. No telling whether the rest works.
>
> So the problem is:
> - hostapd requests master mode on "wlan0" using netlink,
> - it gets to nl80211_set_interface(), drv->ops->change_virtual_intf(),
> ieee80211_change_iface() and then to ieee80211_if_change_type().
>
> Then it fails with -EOPNOTSUPP.
>
> int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
> enum nl80211_iftype type)
> {
> ASSERT_RTNL();
>
> if (type == sdata->vif.type)
> return 0;
>
> /* Setting ad-hoc mode on non-IBSS channel is not supported. */
> if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS)
> return -EOPNOTSUPP;
> ^^^^^^^^^^^^^^^^^^^
>
> The flags are set to 6 = IEEE80211_CHAN_NO_IBSS |
> IEEE80211_CHAN_PASSIVE_SCAN
>
> Unfortunately I don't know what does the above mean, except that
> I don't want ad-hoc mode, I want AP instead.
>
> Ideas?

It's a bug. I accidentally introduced it in 00176c7f.

johannes


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2008-12-16 20:30:09

by Krzysztof Halasa

[permalink] [raw]
Subject: Re: ath5k + AP mode?

"Bob Copeland" <[email protected]> writes:

> It's probably worth taking a look at hostapd to see what exactly is failing.
> We should be able to create an IFTYPE_AP interface with your above patch
> applied. No telling whether the rest works.

So the problem is:
- hostapd requests master mode on "wlan0" using netlink,
- it gets to nl80211_set_interface(), drv->ops->change_virtual_intf(),
ieee80211_change_iface() and then to ieee80211_if_change_type().

Then it fails with -EOPNOTSUPP.

int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
enum nl80211_iftype type)
{
ASSERT_RTNL();

if (type == sdata->vif.type)
return 0;

/* Setting ad-hoc mode on non-IBSS channel is not supported. */
if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS)
return -EOPNOTSUPP;
^^^^^^^^^^^^^^^^^^^

The flags are set to 6 = IEEE80211_CHAN_NO_IBSS |
IEEE80211_CHAN_PASSIVE_SCAN

Unfortunately I don't know what does the above mean, except that
I don't want ad-hoc mode, I want AP instead.

Ideas?
--
Krzysztof Halasa

2008-12-16 17:33:29

by Bob Copeland

[permalink] [raw]
Subject: Re: ath5k + AP mode?

On Mon, Dec 15, 2008 at 3:41 PM, Krzysztof Halasa <[email protected]> wrote:
> Hi,
>
> Is AP mode with ath5k supposed to work?

I think it needs some love from interested parties...

> hw->wiphy->interface_modes =
> BIT(NL80211_IFTYPE_STATION) |
> + BIT(NL80211_IFTYPE_AP) |
> BIT(NL80211_IFTYPE_ADHOC) |
> BIT(NL80211_IFTYPE_MESH_POINT);

Definitely needed.

> Failed to set interface wlan0 to master mode.
> nl80211 driver initialization failed.
> wlan0: Unable to setup interface.

It's probably worth taking a look at hostapd to see what exactly is failing.
We should be able to create an IFTYPE_AP interface with your above patch
applied. No telling whether the rest works.

--
Bob Copeland %% http://www.bobcopeland.com