Turn ieee80211_start_scan_locked() into a swscan module private method.

It turns out that ieee80211_start_scan_locked() is only ever called by
the swscan code and it won't likely be required by firmware scanning
implementations.

So, don't bother keeping it in ieee80211_scan.c and it likely won't
become an API call.

Tested:

* Intel 5100, STA mode
* AR5416, STA mode
This commit is contained in:
adrian 2015-05-10 06:59:34 +00:00
parent cbf7ef174d
commit d46813ebcd
3 changed files with 77 additions and 80 deletions

View File

@ -305,80 +305,6 @@ ieee80211_scan_copy_ssid(struct ieee80211vap *vap, struct ieee80211_scan_state *
ss->ss_nssid = nssid;
}
/*
* Start a scan unless one is already going.
*/
int
ieee80211_start_scan_locked(const struct ieee80211_scanner *scan,
struct ieee80211vap *vap, int flags, u_int duration,
u_int mindwell, u_int maxdwell,
u_int nssid, const struct ieee80211_scan_ssid ssids[])
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_scan_state *ss = ic->ic_scan;
IEEE80211_LOCK_ASSERT(ic);
if (ic->ic_flags & IEEE80211_F_CSAPENDING) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: scan inhibited by pending channel change\n", __func__);
} else if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: %s scan, duration %u mindwell %u maxdwell %u, desired mode %s, %s%s%s%s%s%s\n"
, __func__
, flags & IEEE80211_SCAN_ACTIVE ? "active" : "passive"
, duration, mindwell, maxdwell
, ieee80211_phymode_name[vap->iv_des_mode]
, flags & IEEE80211_SCAN_FLUSH ? "flush" : "append"
, flags & IEEE80211_SCAN_NOPICK ? ", nopick" : ""
, flags & IEEE80211_SCAN_NOJOIN ? ", nojoin" : ""
, flags & IEEE80211_SCAN_NOBCAST ? ", nobcast" : ""
, flags & IEEE80211_SCAN_PICK1ST ? ", pick1st" : ""
, flags & IEEE80211_SCAN_ONCE ? ", once" : ""
);
ieee80211_scan_update_locked(vap, scan);
if (ss->ss_ops != NULL) {
if ((flags & IEEE80211_SCAN_NOSSID) == 0)
ieee80211_scan_copy_ssid(vap, ss, nssid, ssids);
/* NB: top 4 bits for internal use */
ss->ss_flags = flags & 0xfff;
if (ss->ss_flags & IEEE80211_SCAN_ACTIVE)
vap->iv_stats.is_scan_active++;
else
vap->iv_stats.is_scan_passive++;
if (flags & IEEE80211_SCAN_FLUSH)
ss->ss_ops->scan_flush(ss);
if (flags & IEEE80211_SCAN_BGSCAN)
ic->ic_flags_ext |= IEEE80211_FEXT_BGSCAN;
/* Set duration for this particular scan */
ieee80211_swscan_set_scan_duration(vap, duration);
ss->ss_next = 0;
ss->ss_mindwell = mindwell;
ss->ss_maxdwell = maxdwell;
/* NB: scan_start must be before the scan runtask */
ss->ss_ops->scan_start(ss, vap);
#ifdef IEEE80211_DEBUG
if (ieee80211_msg_scan(vap))
ieee80211_scan_dump(ss);
#endif /* IEEE80211_DEBUG */
ic->ic_flags |= IEEE80211_F_SCAN;
/* Start scan task */
ieee80211_swscan_run_scan_task(vap);
}
return 1;
} else {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: %s scan already in progress\n", __func__,
ss->ss_flags & IEEE80211_SCAN_ACTIVE ? "active" : "passive");
}
return 0;
}
/*
* Start a scan unless one is already going.
*/

View File

@ -307,10 +307,6 @@ void ieee80211_scan_copy_ssid(struct ieee80211vap *vap,
void ieee80211_scan_dump_probe_beacon(uint8_t subtype, int isnew,
const uint8_t mac[IEEE80211_ADDR_LEN],
const struct ieee80211_scanparams *sp, int rssi);
int ieee80211_start_scan_locked(const struct ieee80211_scanner *scan,
struct ieee80211vap *vap, int flags, u_int duration,
u_int mindwell, u_int maxdwell,
u_int nssid, const struct ieee80211_scan_ssid ssids[]);
void ieee80211_scan_dump(struct ieee80211_scan_state *ss);
#endif /* _NET80211_IEEE80211_SCAN_H_ */

View File

@ -209,6 +209,81 @@ ieee80211_swscan_run_scan_task(struct ieee80211vap *vap)
ieee80211_runtask(ic, &SCAN_PRIVATE(ss)->ss_scan_task);
}
/*
* Start a scan unless one is already going.
*/
static int
ieee80211_swscan_start_scan_locked(const struct ieee80211_scanner *scan,
struct ieee80211vap *vap, int flags, u_int duration,
u_int mindwell, u_int maxdwell,
u_int nssid, const struct ieee80211_scan_ssid ssids[])
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_scan_state *ss = ic->ic_scan;
IEEE80211_LOCK_ASSERT(ic);
if (ic->ic_flags & IEEE80211_F_CSAPENDING) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: scan inhibited by pending channel change\n", __func__);
} else if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: %s scan, duration %u mindwell %u maxdwell %u, desired mode %s, %s%s%s%s%s%s\n"
, __func__
, flags & IEEE80211_SCAN_ACTIVE ? "active" : "passive"
, duration, mindwell, maxdwell
, ieee80211_phymode_name[vap->iv_des_mode]
, flags & IEEE80211_SCAN_FLUSH ? "flush" : "append"
, flags & IEEE80211_SCAN_NOPICK ? ", nopick" : ""
, flags & IEEE80211_SCAN_NOJOIN ? ", nojoin" : ""
, flags & IEEE80211_SCAN_NOBCAST ? ", nobcast" : ""
, flags & IEEE80211_SCAN_PICK1ST ? ", pick1st" : ""
, flags & IEEE80211_SCAN_ONCE ? ", once" : ""
);
ieee80211_scan_update_locked(vap, scan);
if (ss->ss_ops != NULL) {
if ((flags & IEEE80211_SCAN_NOSSID) == 0)
ieee80211_scan_copy_ssid(vap, ss, nssid, ssids);
/* NB: top 4 bits for internal use */
ss->ss_flags = flags & 0xfff;
if (ss->ss_flags & IEEE80211_SCAN_ACTIVE)
vap->iv_stats.is_scan_active++;
else
vap->iv_stats.is_scan_passive++;
if (flags & IEEE80211_SCAN_FLUSH)
ss->ss_ops->scan_flush(ss);
if (flags & IEEE80211_SCAN_BGSCAN)
ic->ic_flags_ext |= IEEE80211_FEXT_BGSCAN;
/* Set duration for this particular scan */
ieee80211_swscan_set_scan_duration(vap, duration);
ss->ss_next = 0;
ss->ss_mindwell = mindwell;
ss->ss_maxdwell = maxdwell;
/* NB: scan_start must be before the scan runtask */
ss->ss_ops->scan_start(ss, vap);
#ifdef IEEE80211_DEBUG
if (ieee80211_msg_scan(vap))
ieee80211_scan_dump(ss);
#endif /* IEEE80211_DEBUG */
ic->ic_flags |= IEEE80211_F_SCAN;
/* Start scan task */
ieee80211_swscan_run_scan_task(vap);
}
return 1;
} else {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: %s scan already in progress\n", __func__,
ss->ss_flags & IEEE80211_SCAN_ACTIVE ? "active" : "passive");
}
return 0;
}
/*
* Start a scan unless one is already going.
*
@ -226,7 +301,7 @@ ieee80211_swscan_start_scan(const struct ieee80211_scanner *scan,
IEEE80211_UNLOCK_ASSERT(ic);
IEEE80211_LOCK(ic);
result = ieee80211_start_scan_locked(scan, vap, flags, duration,
result = ieee80211_swscan_start_scan_locked(scan, vap, flags, duration,
mindwell, maxdwell, nssid, ssids);
IEEE80211_UNLOCK(ic);
@ -289,7 +364,7 @@ ieee80211_swscan_check_scan(const struct ieee80211_scanner *scan,
}
}
}
result = ieee80211_start_scan_locked(scan, vap, flags, duration,
result = ieee80211_swscan_start_scan_locked(scan, vap, flags, duration,
mindwell, maxdwell, nssid, ssids);
return result;