Date: Sat, 20 Dec 2014 19:41:32 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275964 - head/sys/net80211 Message-ID: <201412201941.sBKJfWKp012531@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Sat Dec 20 19:41:31 2014 New Revision: 275964 URL: https://svnweb.freebsd.org/changeset/base/275964 Log: Document where in scan_task the scan state can change, and potentially deal/log a warning if the scan flags change during one of those race windows. It's highly likely that I need to actually sit down and replace this scan infrastructure at some point. It has some other side effects too - the scan task is a blocking task scheduled in the net80211 taskqueue; so drivers that use this taskqueue have other things not run. Eek. If you see this printf happen then please let me know! Modified: head/sys/net80211/ieee80211_scan.c Modified: head/sys/net80211/ieee80211_scan.c ============================================================================== --- head/sys/net80211/ieee80211_scan.c Sat Dec 20 19:15:10 2014 (r275963) +++ head/sys/net80211/ieee80211_scan.c Sat Dec 20 19:41:31 2014 (r275964) @@ -882,6 +882,9 @@ scan_task(void *arg, int pending) } scanend = ticks + SCAN_PRIVATE(ss)->ss_duration; + + /* XXX scan state can change! Re-validate scan state! */ + IEEE80211_UNLOCK(ic); ic->ic_scan_start(ic); /* notify driver */ IEEE80211_LOCK(ic); @@ -944,6 +947,8 @@ scan_task(void *arg, int pending) ic->ic_scan_curchan(ss, maxdwell); IEEE80211_LOCK(ic); + /* XXX scan state can change! Re-validate scan state! */ + SCAN_PRIVATE(ss)->ss_chanmindwell = ticks + ss->ss_mindwell; /* clear mindwell lock and initial channel change flush */ SCAN_PRIVATE(ss)->ss_iflags &= ~ISCAN_REP; @@ -960,6 +965,7 @@ scan_task(void *arg, int pending) IEEE80211_UNLOCK(ic); ic->ic_scan_end(ic); /* notify driver */ IEEE80211_LOCK(ic); + /* XXX scan state can change! Re-validate scan state! */ /* * Since a cancellation may have occured during one of the @@ -969,10 +975,10 @@ scan_task(void *arg, int pending) ((SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) != 0)) { /* XXX printf? */ if_printf(vap->iv_ifp, - "%s: OOPS! scan cancelled during driver call!\n", + "%s: OOPS! scan cancelled during driver call (1)!\n", __func__); + scandone = 1; } - scandone |= ((SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) != 0); /* * Record scan complete time. Note that we also do @@ -1032,6 +1038,19 @@ scan_task(void *arg, int pending) ticks, ss->ss_mindwell, scanend); /* + * Since a cancellation may have occured during one of the + * driver calls (whilst unlocked), update scandone. + */ + if (scandone == 0 && + ((SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) != 0)) { + /* XXX printf? */ + if_printf(vap->iv_ifp, + "%s: OOPS! scan cancelled during driver call (2)!\n", + __func__); + scandone = 1; + } + + /* * Clear the SCAN bit first in case frames are * pending on the station power save queue. If * we defer this then the dispatch of the frames
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412201941.sBKJfWKp012531>