Bug 14187

Summary: ath9k does not beacon until a scan is issued
Product: Drivers Reporter: Andrey Yurovsky (andrey)
Component: network-wirelessAssignee: Atheros developers (ath9k-devel)
Status: CLOSED OBSOLETE    
Severity: normal CC: alan, andrey, ath9k-devel, dclark, linville, mcgrof, senthilkumar, sujith
Priority: P1    
Hardware: All   
OS: Linux   
URL: http://patchwork.kernel.org/patch/42996/
Kernel Version: 2.6.30.5 Subsystem:
Regression: No Bisected commit-id:

Description Andrey Yurovsky 2009-09-17 18:24:25 UTC
The ath9k driver does not beacon, at least with interfaces in Mesh Point mode, until the user performs a scan.  We've seen this problem with compat-wireless commit bdc7ad93844c2198ee1dae06423a7a2829e89989 as well.  To reproduce the problem, please:

1) bring up a mesh point, ex:
# iw phy phy0 interface add mesh type mp mesh_id mymesh
# ifconfig mesh up

(now scan on channel 1 and note that no beacons are detected)

2) scan, causing what Javier describes to be reproduced:
# iw dev mesh scan

(now scan on channel 1 and note that the device is beaconing
correctly, at this point you can establish mesh links)

Some details from Javier's investigation into the problem, also available here: http://patchwork.kernel.org/patch/42996/

I reviewed the ath9k looking for ordering
problems in configuring the opmode.  I could not see anything wrong.
The opmode is set to NL80211_IFTYPE_MONITOR (6) when the device is
started, and to NL80211_IFTYPE_MESH_POINT (7) on add_interface.  At
that point beaconing is enabled and there is a new reset.  But I'm new
to this card, so I'm probably overlooking something.

I added the following tags to the code:

                DPRINTF(sc, ATH_DBG_FATAL,
@@ -2207,6 +2208,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
        }

        /* Set the device opmode */
+       printk("ath9k_add_interface: sc_ah=%p opmode=%d\n", sc->sc_ah,
ic_opmode);
        sc->sc_ah->opmode = ic_opmode;

        /*

And this is the dmesg output after executing

modprobe ath9k debug=0x100
iw phy phy0 interface add mesh type mp mesh_id kangaroo
iw dev mesh set channel 11
ifconfig mesh up

dmesg:
[ 1977.840919] ath9k_start: sc_ah=c7398000 opmode = 6
[ 1977.844540] ath9k_hw_set_operating_mode: 6
[ 1977.844972] ------------[ cut here ]------------
[ 1977.845710] WARNING: at drivers/net/wireless/ath/ath9k/hw.c:1583
ath9k_hw_set_operating_mode+0x36/0xb6 [ath9k]()
[ 1977.846530] Hardware name: Uknown
[ 1977.846890] Modules linked in: ath9k mac80211 ath cfg80211 rfkill
[last unloaded: rfkill]
[ 1977.848896] Pid: 1725, comm: ifconfig Not tainted 2.6.31-rc6-wl #18
[ 1977.849505] Call Trace:
[ 1977.849931]  [<c021f5ea>] warn_slowpath_common+0x60/0x77
[ 1977.850611]  [<c021f60e>] warn_slowpath_null+0xd/0x10
[ 1977.851320]  [<c988e12f>] ath9k_hw_set_operating_mode+0x36/0xb6 [ath9k]
[ 1977.852243]  [<c9890b2b>] ath9k_hw_reset+0x705/0xe8a [ath9k]
[ 1977.852967]  [<c0220034>] ? printk+0x15/0x17
[ 1977.853796]  [<c989f182>] ath9k_start+0xd6/0x1c1 [ath9k]
[ 1977.854764]  [<c9868768>] ieee80211_open+0x1ec/0x4bf [mac80211]
[ 1977.855482]  [<c023217e>] ? __raw_notifier_call_chain+0xe/0x10
[ 1977.856068]  [<c04e5581>] dev_open+0x8a/0xc5
[ 1977.856688]  [<c04e31d0>] dev_change_flags+0x95/0x143
[ 1977.857234]  [<c0527e3e>] devinet_ioctl+0x210/0x45a
[ 1977.857877]  [<c0529d49>] inet_ioctl+0x88/0xa1
[ 1977.858508]  [<c04d6b1f>] ? sock_ioctl+0x0/0x1ee
[ 1977.859016]  [<c04d6ceb>] sock_ioctl+0x1cc/0x1ee
[ 1977.859640]  [<c04d6b1f>] ? sock_ioctl+0x0/0x1ee
[ 1977.860136]  [<c0290a39>] vfs_ioctl+0x19/0x50
[ 1977.860725]  [<c02912dd>] do_vfs_ioctl+0x472/0x4aa
[ 1977.861231]  [<c032575c>] ? selinux_file_ioctl+0x39/0x3d
[ 1977.861892]  [<c0291355>] sys_ioctl+0x40/0x5a
[ 1977.862525]  [<c0202a55>] syscall_call+0x7/0xb
[ 1977.862994] ---[ end trace 7b9c48f5bc2a0542 ]---
[ 1977.867463] ath9k_hw_set_operating_mode: 6
[ 1977.867910] ------------[ cut here ]------------
[ 1977.868702] WARNING: at drivers/net/wireless/ath/ath9k/hw.c:1583
ath9k_hw_set_operating_mode+0x36/0xb6 [ath9k]()
[ 1977.869583] Hardware name: Uknown
[ 1977.869964] Modules linked in: ath9k mac80211 ath cfg80211 rfkill
[last unloaded: rfkill]
[ 1977.872049] Pid: 1725, comm: ifconfig Tainted: G        W  2.6.31-rc6-wl #18
[ 1977.872714] Call Trace:
[ 1977.873149]  [<c021f5ea>] warn_slowpath_common+0x60/0x77
[ 1977.873837]  [<c021f60e>] warn_slowpath_null+0xd/0x10
[ 1977.874631]  [<c988e12f>] ath9k_hw_set_operating_mode+0x36/0xb6 [ath9k]
[ 1977.875331]  [<c988e1bd>] ath9k_hw_setopmode+0xe/0x10 [ath9k]
[ 1977.876326]  [<c98a1ea0>] ath_startrecv+0x96/0xc6 [ath9k]
[ 1977.877261]  [<c989f1c4>] ath9k_start+0x118/0x1c1 [ath9k]
[ 1977.878265]  [<c9868768>] ieee80211_open+0x1ec/0x4bf [mac80211]
[ 1977.879005]  [<c023217e>] ? __raw_notifier_call_chain+0xe/0x10
[ 1977.879737]  [<c04e5581>] dev_open+0x8a/0xc5
[ 1977.880237]  [<c04e31d0>] dev_change_flags+0x95/0x143
[ 1977.880928]  [<c0527e3e>] devinet_ioctl+0x210/0x45a
[ 1977.881604]  [<c0529d49>] inet_ioctl+0x88/0xa1
[ 1977.882110]  [<c04d6b1f>] ? sock_ioctl+0x0/0x1ee
[ 1977.882759]  [<c04d6ceb>] sock_ioctl+0x1cc/0x1ee
[ 1977.883276]  [<c04d6b1f>] ? sock_ioctl+0x0/0x1ee
[ 1977.883941]  [<c0290a39>] vfs_ioctl+0x19/0x50
[ 1977.884597]  [<c02912dd>] do_vfs_ioctl+0x472/0x4aa
[ 1977.885125]  [<c032575c>] ? selinux_file_ioctl+0x39/0x3d
[ 1977.885806]  [<c0291355>] sys_ioctl+0x40/0x5a
[ 1977.886306]  [<c0202a55>] syscall_call+0x7/0xb
[ 1977.886905] ---[ end trace 7b9c48f5bc2a0543 ]---
[ 1978.356622] ath9k_add_interface: sc_ah=c7398000 opmode=7
[ 1978.358378] ath9k: IBSS nexttbtt 4000 intval 1000 (1000)
[ 1978.358531] ath9k: TXDP9 = 7387000 (c7387000)
[ 1978.361738] ath9k_hw_set_operating_mode: 7
[ 1978.362168] ------------[ cut here ]------------
[ 1978.362938] WARNING: at drivers/net/wireless/ath/ath9k/hw.c:1583
ath9k_hw_set_operating_mode+0x36/0xb6 [ath9k]()
[ 1978.363798] Hardware name: Uknown
[ 1978.364173] Modules linked in: ath9k mac80211 ath cfg80211 rfkill
[last unloaded: rfkill]
[ 1978.366162] Pid: 1725, comm: ifconfig Tainted: G        W  2.6.31-rc6-wl #18
[ 1978.366809] Call Trace:
[ 1978.367240]  [<c021f5ea>] warn_slowpath_common+0x60/0x77
[ 1978.367910]  [<c021f60e>] warn_slowpath_null+0xd/0x10
[ 1978.368738]  [<c988e12f>] ath9k_hw_set_operating_mode+0x36/0xb6 [ath9k]
[ 1978.369661]  [<c9890b2b>] ath9k_hw_reset+0x705/0xe8a [ath9k]
[ 1978.370321]  [<c988b4f2>] ? ath9k_ioread32+0x2f/0x32 [ath9k]
[ 1978.371299]  [<c989f316>] ath_set_channel+0xa9/0x135 [ath9k]
[ 1978.372208]  [<c98a0f12>] ath9k_config+0x1c4/0x231 [ath9k]
[ 1978.373135]  [<c985f5f9>] ieee80211_hw_config+0x86/0x8e [mac80211]
[ 1978.374105]  [<c986897d>] ieee80211_open+0x401/0x4bf [mac80211]
[ 1978.374789]  [<c04e5581>] dev_open+0x8a/0xc5
[ 1978.375372]  [<c04e31d0>] dev_change_flags+0x95/0x143
[ 1978.375919]  [<c0527e3e>] devinet_ioctl+0x210/0x45a
[ 1978.376559]  [<c0529d49>] inet_ioctl+0x88/0xa1
[ 1978.377064]  [<c04d6b1f>] ? sock_ioctl+0x0/0x1ee
[ 1978.377690]  [<c04d6ceb>] sock_ioctl+0x1cc/0x1ee
[ 1978.378196]  [<c04d6b1f>] ? sock_ioctl+0x0/0x1ee
[ 1978.378829]  [<c0290a39>] vfs_ioctl+0x19/0x50
[ 1978.379449]  [<c02912dd>] do_vfs_ioctl+0x472/0x4aa
[ 1978.379971]  [<c032575c>] ? selinux_file_ioctl+0x39/0x3d
[ 1978.380628]  [<c0291355>] sys_ioctl+0x40/0x5a
[ 1978.381116]  [<c0202a55>] syscall_call+0x7/0xb
[ 1978.381691] ---[ end trace 7b9c48f5bc2a0544 ]---
[ 1978.384718] ath9k_hw_set_operating_mode: 7
[ 1978.385157] ------------[ cut here ]------------
[ 1978.385944] WARNING: at drivers/net/wireless/ath/ath9k/hw.c:1583
ath9k_hw_set_operating_mode+0x36/0xb6 [ath9k]()
[ 1978.386814] Hardware name: Uknown
[ 1978.387186] Modules linked in: ath9k mac80211 ath cfg80211 rfkill
[last unloaded: rfkill]
[ 1978.389095] Pid: 1725, comm: ifconfig Tainted: G        W  2.6.31-rc6-wl #18
[ 1978.389719] Call Trace:
[ 1978.390143]  [<c021f5ea>] warn_slowpath_common+0x60/0x77
[ 1978.390832]  [<c021f60e>] warn_slowpath_null+0xd/0x10
[ 1978.391675]  [<c988e12f>] ath9k_hw_set_operating_mode+0x36/0xb6 [ath9k]
[ 1978.392609]  [<c988e1bd>] ath9k_hw_setopmode+0xe/0x10 [ath9k]
[ 1978.393262]  [<c98a1ea0>] ath_startrecv+0x96/0xc6 [ath9k]
[ 1978.394299]  [<c989f355>] ath_set_channel+0xe8/0x135 [ath9k]
[ 1978.395230]  [<c98a0f12>] ath9k_config+0x1c4/0x231 [ath9k]
[ 1978.396177]  [<c985f5f9>] ieee80211_hw_config+0x86/0x8e [mac80211]
[ 1978.397187]  [<c986897d>] ieee80211_open+0x401/0x4bf [mac80211]
[ 1978.397940]  [<c04e5581>] dev_open+0x8a/0xc5
[ 1978.398582]  [<c04e31d0>] dev_change_flags+0x95/0x143
[ 1978.399143]  [<c0527e3e>] devinet_ioctl+0x210/0x45a
[ 1978.399787]  [<c0529d49>] inet_ioctl+0x88/0xa1
[ 1978.400429]  [<c04d6b1f>] ? sock_ioctl+0x0/0x1ee
[ 1978.400943]  [<c04d6ceb>] sock_ioctl+0x1cc/0x1ee
[ 1978.401588]  [<c04d6b1f>] ? sock_ioctl+0x0/0x1ee
[ 1978.402104]  [<c0290a39>] vfs_ioctl+0x19/0x50
[ 1978.402715]  [<c02912dd>] do_vfs_ioctl+0x472/0x4aa
[ 1978.403202]  [<c032575c>] ? selinux_file_ioctl+0x39/0x3d
[ 1978.403829]  [<c0291355>] sys_ioctl+0x40/0x5a
[ 1978.404448]  [<c0202a55>] syscall_call+0x7/0xb
[ 1978.404908] ---[ end trace 7b9c48f5bc2a0545 ]---
Comment 1 Luis Chamberlain 2009-12-01 08:11:26 UTC
Can you please test with today's wireless-testing?
Comment 2 Andrey Yurovsky 2009-12-01 18:28:37 UTC
Hi Luis.  I just tried today's wireless-testing and now ath9k will not beacon in mesh mode regardless of whether we scan or not, so the situation is worse.

  -Andrey
Comment 3 Andrey Yurovsky 2009-12-01 18:45:10 UTC
Hi Luis.  What patch or patches are we testing here specifically?  That might help us narrow down the issue.  Also, have you tried testing it yourself and do you see the same behavior?  You just need to bring up an MP interface, there's no need for a real mesh (ie: you can test it on any system with just one piece of hardware).  The original bug report has instructions.  Thanks!

  -Andrey
Comment 4 Andrey Yurovsky 2009-12-01 19:45:59 UTC
Hi Luis, sorry for the confusion but I need to revise comment #2: we don't have a regression in functionality (I can in fact get the ath9k card to beacon by scanning as originally reported, I had accidentally run into an rfkill issue).  

So with today's wireless-testing:
- no beacons when we ifconfig up
- beacons if we ifconfig up and then scan (as before)

Thanks,

  -Andrey
Comment 5 John W. Linville 2009-12-29 20:31:52 UTC
<mcgrof> linville: hey can do you me a favor, can you test commenting on a bug like say http://bugzilla.kernel.org/show_bug.cgi?id=14187 to see if the list gets it
<mcgrof> linville: I am not seeing e-mails to the list when I subscribe ath9k-devel@atheros.com

Well, I can certainly try... :-)