/* Pretend to do something.
* FIXME: for unknown reason, it can not call cfg80211_scan_done right
* away after cfg80211_ops->scan(), otherwise netlink client would not
* get message with "scan done". Is it because "scan_routine" and
* cfg80211_ops->scan() may run in concurrent and cfg80211_scan_done()
* called before cfg80211_ops->scan() returns?
*/
msleep(100);
In brief, it's possible that cfg80211_scan_done() (in scan_routine) called before cfg80211_ops->scan() returns, which may lead to a problem that netlink client would not get message with "scan done".
To solve this, I read two different drivers in linux kernel source:
virt_wifi: using shedule_delayed_work() to delay the execution of scan_routine for (Hz * 2) jiffies, which is approximately 2 second.
broadcom FullMAC driver: activate timer when cfg80211_ops->scan() is going to return for 10 sec, and after timer timeout, the kernel will call timer_timerout work which will inform bss which previously scaned by cfg80211_ops->scan() to kernel and finally call cfg80211_scan_done().
I'm not sure that we can take either approch, but I think the broadcom driver's approch is better, because user can call abort while performing cfg80211_ops->scan(), and the broadcom way may not bother the kernel by deleting the timer.
In brief, it's possible that
cfg80211_scan_done()
(in scan_routine) called beforecfg80211_ops->scan()
returns, which may lead to a problem that netlink client would not get message with "scan done". To solve this, I read two different drivers in linux kernel source:shedule_delayed_work()
to delay the execution of scan_routine for (Hz * 2) jiffies, which is approximately 2 second.cfg80211_scan_done()
.I'm not sure that we can take either approch, but I think the broadcom driver's approch is better, because user can call abort while performing
cfg80211_ops->scan()
, and the broadcom way may not bother the kernel by deleting the timer.