[PATCH] Fix scanning state when sched_scan is stopped explicitly

Dmitry Shmidt dimitrysh
Fri Mar 13 11:16:56 PDT 2015


On Mon, Mar 9, 2015 at 1:17 PM, Arik Nemtsov <arik at wizery.com> wrote:
> On Mon, Mar 9, 2015 at 10:11 PM, Johannes Berg
> <johannes at sipsolutions.net> wrote:
>>
>> On Mon, 2015-03-09 at 13:07 -0700, Dmitry Shmidt wrote:
>>
>> > If you can hint me what this change was about, I'll try to find it.
>> > Meanwhile the only change I see between 3.19 and 3.4 in
>> > __cfg80211_stop_sched_scan() is to use rtnl_lock instead of sched_scan_mtx.
>> > Other than that the logic is the same - send stop command to the driver and send
>> >  NL80211_CMD_SCHED_SCAN_STOPPED back to user space.
>> > And I see (I didn't try 3.19) that it will come "too late".
>>
>> Looks like cfg80211 could do this correctly, but mac80211 insists on
>> doing the scheduled work. Given that locks the RTNL it's not going to be
>> simple to actually implement it.
>>
>
> Is this really about kernel-mode though? wpa_s is single threaded
> (eloop), so even if the notification comes up right away, the event is
> still only queued on the thread..

This is what I see as well.

>
> That said, I think Dmitry's version might hurt some state. It's safer
> to just schedule the scan on the eloop with a very small delay (even
> 0), so that the pending sched-scan event has a chance to get
> processed.

Changing scanning function may affect others, while resetting PNO
state should not. Moreover later EVENT_SCHED_SCAN_STOPPED
will do nothing if sched_scan_timed_out or pno_sched_pending will not
be set.
               if (wpa_s->sched_scan_timed_out) {
                        wpa_supplicant_req_sched_scan(wpa_s);
                } else if (wpa_s->pno_sched_pending) {
                        wpa_s->pno_sched_pending = 0;
                        wpas_start_pno(wpa_s);
                }


>
> Arik



More information about the Hostap mailing list