summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravos <avos@FreeBSD.org>2016-02-29 21:00:10 +0000
committeravos <avos@FreeBSD.org>2016-02-29 21:00:10 +0000
commita6472a41a938c370f52c1972a166c3e73b5332df (patch)
treece7639af168d32d31db487754b9f9579c8225ea7
parent8c7e45d831491811997e5bb9cdb4d4acfb0e7eda (diff)
downloadFreeBSD-src-a6472a41a938c370f52c1972a166c3e73b5332df.zip
FreeBSD-src-a6472a41a938c370f52c1972a166c3e73b5332df.tar.gz
net80211: refactor scan_signal()
- Pass scan state and additional internal flags as a parameters. - Add locked version. Tested with: * Intel 3945BG, STA mode. * RTL8188EU, STA mode. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D5148
-rw-r--r--sys/net80211/ieee80211_scan_sw.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/sys/net80211/ieee80211_scan_sw.c b/sys/net80211/ieee80211_scan_sw.c
index 6058c0d..9171790 100644
--- a/sys/net80211/ieee80211_scan_sw.c
+++ b/sys/net80211/ieee80211_scan_sw.c
@@ -98,7 +98,8 @@ struct scan_state {
static void scan_curchan(struct ieee80211_scan_state *, unsigned long);
static void scan_mindwell(struct ieee80211_scan_state *);
-static void scan_signal(void *);
+static void scan_signal(struct ieee80211_scan_state *, int);
+static void scan_signal_locked(struct ieee80211_scan_state *, int);
static void scan_start(void *, int);
static void scan_curchan_task(void *, int);
static void scan_end(struct ieee80211_scan_state *, int);
@@ -112,10 +113,7 @@ ieee80211_swscan_detach(struct ieee80211com *ic)
struct ieee80211_scan_state *ss = ic->ic_scan;
if (ss != NULL) {
- IEEE80211_LOCK(ic);
- SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_ABORT;
- scan_signal(ss);
- IEEE80211_UNLOCK(ic);
+ scan_signal(ss, ISCAN_ABORT);
ieee80211_draintask(ic, &SCAN_PRIVATE(ss)->ss_scan_start);
taskqueue_drain_timeout(ic->ic_tq,
&SCAN_PRIVATE(ss)->ss_scan_curchan);
@@ -157,10 +155,8 @@ ieee80211_swscan_vdetach(struct ieee80211vap *vap)
IEEE80211_LOCK_ASSERT(ic);
ss = ic->ic_scan;
if (ss != NULL && ss->ss_vap == vap) {
- if (ic->ic_flags & IEEE80211_F_SCAN) {
- SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_ABORT;
- scan_signal(ss);
- }
+ if (ic->ic_flags & IEEE80211_F_SCAN)
+ scan_signal_locked(ss, ISCAN_ABORT);
}
}
@@ -446,11 +442,10 @@ cancel_scan(struct ieee80211vap *vap, int any, const char *func)
ss->ss_flags & IEEE80211_SCAN_ACTIVE ?
"active" : "passive");
- /* clear bg scan NOPICK and mark cancel request */
+ /* clear bg scan NOPICK */
ss->ss_flags &= ~IEEE80211_SCAN_NOPICK;
- SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_CANCEL;
- /* wake up the scan task */
- scan_signal(ss);
+ /* mark cancel request and wake up the scan task */
+ scan_signal_locked(ss, ISCAN_CANCEL);
} else {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: called; F_SCAN=%d, vap=%s, CANCEL=%d\n",
@@ -487,15 +482,12 @@ ieee80211_swscan_cancel_anyscan(struct ieee80211vap *vap)
static void
ieee80211_swscan_scan_next(struct ieee80211vap *vap)
{
- struct ieee80211com *ic = vap->iv_ic;
- struct ieee80211_scan_state *ss = ic->ic_scan;
+ struct ieee80211_scan_state *ss = vap->iv_ic->ic_scan;
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: called\n", __func__);
/* wake up the scan task */
- IEEE80211_LOCK(ic);
- scan_signal(ss);
- IEEE80211_UNLOCK(ic);
+ scan_signal(ss, 0);
}
/*
@@ -511,7 +503,7 @@ ieee80211_swscan_scan_done(struct ieee80211vap *vap)
IEEE80211_LOCK_ASSERT(ic);
ss = ic->ic_scan;
- scan_signal(ss);
+ scan_signal_locked(ss, 0);
}
/*
@@ -569,15 +561,27 @@ scan_curchan(struct ieee80211_scan_state *ss, unsigned long maxdwell)
}
static void
-scan_signal(void *arg)
+scan_signal(struct ieee80211_scan_state *ss, int iflags)
+{
+ struct ieee80211com *ic = ss->ss_ic;
+
+ IEEE80211_UNLOCK_ASSERT(ic);
+
+ IEEE80211_LOCK(ic);
+ scan_signal_locked(ss, iflags);
+ IEEE80211_UNLOCK(ic);
+}
+
+static void
+scan_signal_locked(struct ieee80211_scan_state *ss, int iflags)
{
- struct ieee80211_scan_state *ss = (struct ieee80211_scan_state *) arg;
struct scan_state *ss_priv = SCAN_PRIVATE(ss);
struct timeout_task *scan_task = &ss_priv->ss_scan_curchan;
struct ieee80211com *ic = ss->ss_ic;
IEEE80211_LOCK_ASSERT(ic);
+ ss_priv->ss_iflags |= iflags;
if (ss_priv->ss_iflags & ISCAN_RUNNING) {
if (taskqueue_cancel_timeout(ic->ic_tq, scan_task, NULL) == 0)
taskqueue_enqueue_timeout(ic->ic_tq, scan_task, 0);
@@ -591,13 +595,11 @@ scan_signal(void *arg)
static void
scan_mindwell(struct ieee80211_scan_state *ss)
{
- struct ieee80211com *ic = ss->ss_ic;
+ struct ieee80211vap *vap = ss->ss_vap;
- IEEE80211_DPRINTF(ss->ss_vap, IEEE80211_MSG_SCAN, "%s: called\n", __func__);
+ IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: called\n", __func__);
- IEEE80211_LOCK(ic);
- scan_signal(ss);
- IEEE80211_UNLOCK(ic);
+ scan_signal(ss, 0);
}
static void
OpenPOWER on IntegriCloud