net80211: reduce code duplication between ieee80211_swscan_cancel_scan()

and ieee80211_swscan_cancel_anyscan()

Tested with:
 * Intel 3945BG, STA mode.
 * RTL8188EU, HOSTAP mode.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5133
This commit is contained in:
Andriy Voskoboinyk 2016-02-29 20:36:00 +00:00
parent d546378bd8
commit 04f91953f3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296227

View File

@ -426,21 +426,18 @@ ieee80211_swscan_bg_scan(const struct ieee80211_scanner *scan,
return (ic->ic_flags & IEEE80211_F_SCAN);
}
/*
* Cancel any scan currently going on for the specified vap.
*/
static void
ieee80211_swscan_cancel_scan(struct ieee80211vap *vap)
cancel_scan(struct ieee80211vap *vap, int any, const char *func)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_scan_state *ss = ic->ic_scan;
IEEE80211_LOCK(ic);
if ((ic->ic_flags & IEEE80211_F_SCAN) &&
ss->ss_vap == vap &&
(any || ss->ss_vap == vap) &&
(SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) == 0) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: cancel %s scan\n", __func__,
"%s: cancel %s scan\n", func,
ss->ss_flags & IEEE80211_SCAN_ACTIVE ?
"active" : "passive");
@ -452,7 +449,7 @@ ieee80211_swscan_cancel_scan(struct ieee80211vap *vap)
} else {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: called; F_SCAN=%d, vap=%s, CANCEL=%d\n",
__func__,
func,
!! (ic->ic_flags & IEEE80211_F_SCAN),
(ss->ss_vap == vap ? "match" : "nomatch"),
!! (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL));
@ -460,37 +457,22 @@ ieee80211_swscan_cancel_scan(struct ieee80211vap *vap)
IEEE80211_UNLOCK(ic);
}
/*
* Cancel any scan currently going on for the specified vap.
*/
static void
ieee80211_swscan_cancel_scan(struct ieee80211vap *vap)
{
cancel_scan(vap, 0, __func__);
}
/*
* Cancel any scan currently going on.
*/
static void
ieee80211_swscan_cancel_anyscan(struct ieee80211vap *vap)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_scan_state *ss = ic->ic_scan;
IEEE80211_LOCK(ic);
if ((ic->ic_flags & IEEE80211_F_SCAN) &&
(SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) == 0) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: cancel %s scan\n", __func__,
ss->ss_flags & IEEE80211_SCAN_ACTIVE ?
"active" : "passive");
/* clear bg scan NOPICK and mark cancel request */
ss->ss_flags &= ~IEEE80211_SCAN_NOPICK;
SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_CANCEL;
/* wake up the scan task */
scan_signal(ss);
} else {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: called; F_SCAN=%d, vap=%s, CANCEL=%d\n",
__func__,
!! (ic->ic_flags & IEEE80211_F_SCAN),
(ss->ss_vap == vap ? "match" : "nomatch"),
!! (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL));
}
IEEE80211_UNLOCK(ic);
cancel_scan(vap, 1, __func__);
}
/*