[RFC 1/1] libertas: new scan logic
Holger Schurig
hs4233 at mail.mn-solutions.de
Tue Dec 4 04:29:55 EST 2007
> Maybe this isn't really a problem in practice, but it looked
> suspicious while reading the patch.
The code with CMD_OPTION_WAITFORRSP blocks while in the
association thread. And this is actually good.
When I replaced this with "0" in my new-scan.patch, I did not
get any scan result while in the initial scan (because of
the "iwconfig eth1 essid BLAH"). Here's an excerpt of what
happened then:
11:24:09 libertas leave: lbs_ret_80211_scan():1638, ret 0
11:24:09 libertas leave: lbs_do_scan():514, ret 0
11:24:09 libertas scan: scan table:
11:24:09 libertas leave: lbs_scan_networks():659, ret 0
11:24:09 libertas leave: lbs_send_specific_ssid_scan():1162, ret 0
11:24:09 libertas enter: lbs_find_ssid_in_list():989
11:24:09 libertas leave: lbs_find_ssid_in_list():1035, found_bss 00000000
11:24:09 libertas assoc: SSID not found; cannot associate
11:24:09 libertas leave: assoc_helper_essid():73, ret 0
11:24:09 libertas leave: assoc_helper_associate():133, ret 0
11:24:09 libertas assoc: ASSOC: association unsuccessful, not connected
11:24:09 libertas assoc: ASSOC: reconfiguration attempt unsuccessful: -1
11:24:09 libertas leave: lbs_association_worker():681
What happened here is that assoc_helper_essid() (which runs in the
assoc thread, AFAIK) called lbs_find_ssid_in_list(), which called
lbs_send_specific_ssid_scan() which called lbs_scan_networks().
Because this was called with fullscan=1, it didn't reschedule
itself, but scanned for all 14 channels at once. That is good,
because we can only associate when have a complete picture of
what APs are out there.
However, lbs_scan_networks() calls lbs_do_scan() to scan for each
of the 4 channels. And with the now removed CMD_OPTION_WAITFORRSP
lbs_do_scan almost immediately returns. Therefore, the debug code
at the end of lbs_scan_networks() that prints "scan table:" and
then the list of all found BSSs doesn't print anything, and
therefore lbs_find_ssid_in_list() returns 0000000 as "best" BSS.
I have two options to fix this: make this again
CMD_OPTION_WAITFORRSP (which I like more, it's conceptually simply).
Or I can call lbs_do_scan() with the fullscan variable, so that there
I can set WAITFORRSP or not, depending on it's meaning.
The "iwlist eth1 scan" works, no matter if I use CMD_OPTION_WAITFORRSP
or not.
> If this is intentional and you feel that it's fine to block
> waiting for the command submission (and response!!), then
> that's OK.
It was not intentional, but now it is --- if that's OK for you.
If you think solution suggestion #2 from above is better: that
would be ok for me, too.
More information about the libertas-dev
mailing list