Another "scan handling in mac80211" bug
Hi,
I was just unable to scan again after waking up from s2disk. Luckily I still had some debug output in mac80211 from my previous patch:
[66796.154861] ADDRCONF(NETDEV_UP): wlan0: link is not ready [66796.164133] ieee80211_sta_work [66796.164142] ieee80211_sta_work 2 [66796.178069] wlan0: direct probe to AP XX:XX:XX:XX:XX:XX try 1 [66796.375058] cfg80211_wext_siwscan
Ok, someone (I guess wpa_supplicant) triggered a scan.
[66796.375065] ieee80211_scan [66796.375067] ieee80211_scan: request_scan [66796.375070] ieee80211_request_scan [66796.375073] ieee80211_request_scan queue_work
The scan is not started immediately due to mode == STA.
[66796.375116] ieee80211_sta_work [66796.375120] ieee80211_sta_work 2
Good, the sta_work is executed but does not start the scan (I also had a debug printk in ieee80211_start_scan).
Here's the according part of the code:
1759 if (ifmgd->state != IEEE80211_STA_MLME_DIRECT_PROBE &&
1760 ifmgd->state != IEEE80211_STA_MLME_AUTHENTICATE &&
1761 ifmgd->state != IEEE80211_STA_MLME_ASSOCIATE &&
1762 test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifmgd->request)) {
1763 /*
1764 * The call to ieee80211_start_scan can fail but ieee80211_request_scan
1765 * (which queued ieee80211_sta_work) did not return an error. Thus, call
1766 * ieee80211_scan_failed here if ieee80211_start_scan fails in order to
1767 * notify the scan requester.
1768 */1769 if (ieee80211_start_scan(sdata, local->scan_req))
1770 ieee80211_scan_failed(local);
1771 return;
1772 }
Ok, we are currently in state IEEE80211_STA_MLME_DIRECT_PROBE and as such do not trigger the scan right away. IEEE80211_STA_REQ_SCAN should still be set. Seems still fine to me.
[66796.375329] cfg80211_wext_siwscan EBUSY [66796.376170] ieee80211_sta_work [66796.376174] ieee80211_sta_work 2 [66796.376179] wlan0: direct probe to AP XX:XX:XX:XX:XX:XX try 2 [66796.576063] ieee80211_sta_work [66796.576072] ieee80211_sta_work 2 [66796.576079] wlan0: direct probe to AP XX:XX:XX:XX:XX:XX try 3 [66796.776061] ieee80211_sta_work [66796.776069] ieee80211_sta_work 2 [66796.776076] wlan0: direct probe to AP XX:XX:XX:XX:XX:XX timed out
Hmm, the direct probe timed out, thus the state moves to IEEE80211_STA_MLME_DISABLED but sta_work will only run again when the next association attempt is being made. However, we still have IEEE80211_STA_REQ_SCAN set.
[66816.374308] cfg80211_wext_siwscan EBUSY [66823.901663] cfg80211_wext_siwscan EBUSY
All subsequent scan requests will fail in cfg80211_wext_siwscan as mac80211 did not notify cfg80211 about the scan result.
I guess it should be sufficient to queue one more sta_work after the MLME moves to IEEE80211_STA_MLME_DISABLED state. In case IEEE80211_STA_REQ_SCAN is still set the scan will get started and cfg80211 gets notified about the result.
Does that seem correct?
Thanks,
Helmut
Hi,
Quoted 1 line
I was just unable to scan again after waking up from s2disk.
I think I never had such problems because zd1211 doesn't actually suspend, maybe. Not sure, in any case I always unplug it anyway...
Quoted 36 lines
Luckily I
still had some debug output in mac80211 from my previous patch:[66796.154861] ADDRCONF(NETDEV_UP): wlan0: link is not ready [66796.164133] ieee80211_sta_work [66796.164142] ieee80211_sta_work 2 [66796.178069] wlan0: direct probe to AP XX:XX:XX:XX:XX:XX try 1 [66796.375058] cfg80211_wext_siwscanOk, someone (I guess
wpa_supplicant) triggered a scan.[66796.375065] ieee80211_scan [66796.375067] ieee80211_scan: request_scan [66796.375070] ieee80211_request_scan [66796.375073] ieee80211_request_scan queue_workThe scan is not started immediately due to mode == STA.
[66796.375116] ieee80211_sta_work [66796.375120] ieee80211_sta_work 2Good, the
sta_workis executed but does not start the scan (I also had a debug printk inieee80211_start_scan).Here's the according part of the code:
1759 if (
ifmgd->state!=IEEE80211_STA_MLME_DIRECT_PROBE&&1760 ifmgd->state != IEEE80211_STA_MLME_AUTHENTICATE && 1761 ifmgd->state != IEEE80211_STA_MLME_ASSOCIATE && 1762 test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifmgd->request)) { 1763 /* 1764 * The call to ieee80211_start_scan can fail but ieee80211_request_scan 1765 * (which queued ieee80211_sta_work) did not return an error. Thus, call 1766 * ieee80211_scan_failed here if ieee80211_start_scan fails in order to 1767 * notify the scan requester. 1768 */
Quoted 8 lines
1769 if (
ieee80211_start_scan(sdata, local->scan_req))
1770ieee80211_scan_failed(local);
1771 return;
1772 }Ok, we are currently in state
IEEE80211_STA_MLME_DIRECT_PROBEand as such do not trigger the scan right away.IEEE80211_STA_REQ_SCANshould still be set. Seems still fine to me.
Yeah, seems ok so far.
Quoted 11 lines
[66796.375329] cfg80211_wext_siwscan EBUSY [66796.376170] ieee80211_sta_work [66796.376174] ieee80211_sta_work 2 [66796.376179] wlan0: direct probe to AP XX:XX:XX:XX:XX:XX try 2 [66796.576063] ieee80211_sta_work [66796.576072] ieee80211_sta_work 2 [66796.576079] wlan0: direct probe to AP XX:XX:XX:XX:XX:XX try 3 [66796.776061] ieee80211_sta_work [66796.776069] ieee80211_sta_work 2 [66796.776076] wlan0: direct probe to AP XX:XX:XX:XX:XX:XX timed out
Quoted 4 lines
Hmm, the direct probe timed out, thus the state moves to
IEEE80211_STA_MLME_DISABLEDbutsta_workwill only run again when the next association attempt is being made. However, we still haveIEEE80211_STA_REQ_SCANset.
That's not very good.
Quoted 6 lines
[66816.374308] cfg80211_wext_siwscan EBUSY [66823.901663] cfg80211_wext_siwscan EBUSYAll subsequent scan requests will fail in
cfg80211_wext_siwscanas mac80211 did not notify cfg80211 about the scan result.
Quoted 6 lines
I guess it should be sufficient to queue one more
sta_workafter the MLME moves toIEEE80211_STA_MLME_DISABLEDstate. In caseIEEE80211_STA_REQ_SCANis still set the scan will get started and cfg80211 gets notified about the result.Does that seem correct?
Yes, that seems correct to me. IEEE80211_STA_REQ_RUN not being set will catch the "do nothing with assoc state" part.
johannes
Am Montag, 9. M=E4rz 2009 schrieb Johannes Berg:
[...]
Quoted 1 line
Quoted 1 line
All subsequent scan requests will fail in
cfg80211_wext_siwscanas =
mac80211
Quoted 3 lines
Quoted 3 lines
did not notify cfg80211 about the scan result.
=20
I guess it should be sufficient to queue one moresta_workafter th=
e MLME
Quoted 1 line
Quoted 1 line
moves to
IEEE80211_STA_MLME_DISABLEDstate. In case IEEE80211_STA_R=
EQ_SCAN
Quoted 1 line
Quoted 1 line
is still set the scan will get started and cfg80211 gets notified a=
bout the
Quoted 5 lines
Quoted 3 lines
result.
=20
Does that seem correct?=20
Yes, that seems correct to me.IEEE80211_STA_REQ_RUNnot being set wi=
ll
Quoted 1 line
catch the "do nothing with assoc state" part.
Ok, I'll do some more tests tomorrow and send a patch if it works for m= e.
Helmut
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html