Linux wireless drivers development
 help / color / mirror / Atom feed
* ath5k + AP mode?
@ 2008-12-15 20:41 Krzysztof Halasa
  2008-12-16 17:33 ` Bob Copeland
  0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Halasa @ 2008-12-15 20:41 UTC (permalink / raw)
  To: linux-wireless

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

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

* Re: ath5k + AP mode?
  2008-12-15 20:41 ath5k + AP mode? Krzysztof Halasa
@ 2008-12-16 17:33 ` Bob Copeland
  2008-12-16 19:47   ` Krzysztof Halasa
  2008-12-16 20:27   ` Krzysztof Halasa
  0 siblings, 2 replies; 5+ messages in thread
From: Bob Copeland @ 2008-12-16 17:33 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: linux-wireless

On Mon, Dec 15, 2008 at 3:41 PM, Krzysztof Halasa <khc@pm.waw.pl> 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 %% www.bobcopeland.com

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

* Re: ath5k + AP mode?
  2008-12-16 17:33 ` Bob Copeland
@ 2008-12-16 19:47   ` Krzysztof Halasa
  2008-12-16 20:27   ` Krzysztof Halasa
  1 sibling, 0 replies; 5+ messages in thread
From: Krzysztof Halasa @ 2008-12-16 19:47 UTC (permalink / raw)
  To: Bob Copeland; +Cc: linux-wireless

"Bob Copeland" <bcopeland@gmail.com> 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

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

* Re: ath5k + AP mode?
  2008-12-16 17:33 ` Bob Copeland
  2008-12-16 19:47   ` Krzysztof Halasa
@ 2008-12-16 20:27   ` Krzysztof Halasa
  2008-12-16 20:44     ` Johannes Berg
  1 sibling, 1 reply; 5+ messages in thread
From: Krzysztof Halasa @ 2008-12-16 20:27 UTC (permalink / raw)
  To: Bob Copeland; +Cc: linux-wireless

"Bob Copeland" <bcopeland@gmail.com> 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

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

* Re: ath5k + AP mode?
  2008-12-16 20:27   ` Krzysztof Halasa
@ 2008-12-16 20:44     ` Johannes Berg
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2008-12-16 20:44 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: Bob Copeland, linux-wireless

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

On Tue, 2008-12-16 at 21:27 +0100, Krzysztof Halasa wrote:
> "Bob Copeland" <bcopeland@gmail.com> 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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2008-12-16 20:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-15 20:41 ath5k + AP mode? Krzysztof Halasa
2008-12-16 17:33 ` Bob Copeland
2008-12-16 19:47   ` Krzysztof Halasa
2008-12-16 20:27   ` Krzysztof Halasa
2008-12-16 20:44     ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox