Changeset View
Changeset View
Standalone View
Standalone View
sys/net80211/ieee80211_scan_sw.c
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
#include <net80211/ieee80211_scan_sw.h> | #include <net80211/ieee80211_scan_sw.h> | ||||
#include <net/bpf.h> | #include <net/bpf.h> | ||||
struct scan_state { | struct scan_state { | ||||
struct ieee80211_scan_state base; /* public state */ | struct ieee80211_scan_state base; /* public state */ | ||||
u_int ss_iflags; /* flags used internally */ | u_int ss_iflags; /* flags used internally */ | ||||
#define ISCAN_MINDWELL 0x0001 /* min dwell time reached */ | #define ISCAN_MINDWELL 0x0001 /* min dwell time reached */ | ||||
#define ISCAN_DISCARD 0x0002 /* discard rx'd frames */ | #define ISCAN_DISCARD 0x0002 /* discard rx'd frames */ | ||||
#define ISCAN_CANCEL 0x0004 /* cancel current scan */ | #define ISCAN_CANCEL 0x0004 /* cancel current scan */ | ||||
#define ISCAN_ABORT 0x0008 /* end the scan immediately */ | #define ISCAN_ABORT 0x0008 /* end the scan immediately */ | ||||
#define ISCAN_RUNNING 0x0010 /* scan was started */ | #define ISCAN_RUNNING 0x0010 /* scan was started */ | ||||
unsigned long ss_chanmindwell; /* min dwell on curchan */ | unsigned long ss_chanmindwell; /* min dwell on curchan */ | ||||
unsigned long ss_scanend; /* time scan must stop */ | unsigned long ss_scanend; /* time scan must stop */ | ||||
u_int ss_duration; /* duration for next scan */ | u_int ss_duration; /* duration for next scan */ | ||||
struct task ss_scan_start; /* scan start */ | struct task ss_scan_start; /* scan start */ | ||||
struct timeout_task ss_scan_curchan; /* scan execution */ | struct timeout_task ss_scan_curchan; /* scan execution */ | ||||
}; | }; | ||||
#define SCAN_PRIVATE(ss) ((struct scan_state *) ss) | #define SCAN_PRIVATE(ss) ((struct scan_state *) ss) | ||||
/* | /* | ||||
* Amount of time to go off-channel during a background | * Amount of time to go off-channel during a background | ||||
* scan. This value should be large enough to catch most | * scan. This value should be large enough to catch most | ||||
* ap's but short enough that we can return on-channel | * ap's but short enough that we can return on-channel | ||||
* before our listen interval expires. | * before our listen interval expires. | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | ieee80211_swscan_vattach(struct ieee80211vap *vap) | ||||
*/ | */ | ||||
} | } | ||||
static void | static void | ||||
ieee80211_swscan_vdetach(struct ieee80211vap *vap) | ieee80211_swscan_vdetach(struct ieee80211vap *vap) | ||||
{ | { | ||||
struct ieee80211com *ic = vap->iv_ic; | struct ieee80211com *ic = vap->iv_ic; | ||||
struct ieee80211_scan_state *ss; | struct ieee80211_scan_state *ss = ic->ic_scan; | ||||
IEEE80211_LOCK_ASSERT(ic); | IEEE80211_LOCK_ASSERT(ic); | ||||
ss = ic->ic_scan; | |||||
if (ss != NULL && ss->ss_vap == vap) { | if (ss != NULL && ss->ss_vap == vap && | ||||
if (ic->ic_flags & IEEE80211_F_SCAN) | (ic->ic_flags & IEEE80211_F_SCAN)) | ||||
scan_signal_locked(ss, ISCAN_ABORT); | scan_signal_locked(ss, ISCAN_ABORT); | ||||
} | } | ||||
} | |||||
static void | static void | ||||
ieee80211_swscan_set_scan_duration(struct ieee80211vap *vap, u_int duration) | ieee80211_swscan_set_scan_duration(struct ieee80211vap *vap, u_int duration) | ||||
{ | { | ||||
struct ieee80211com *ic = vap->iv_ic; | struct ieee80211com *ic = vap->iv_ic; | ||||
struct ieee80211_scan_state *ss = ic->ic_scan; | struct ieee80211_scan_state *ss = ic->ic_scan; | ||||
IEEE80211_LOCK_ASSERT(ic); | IEEE80211_LOCK_ASSERT(ic); | ||||
▲ Show 20 Lines • Show All 325 Lines • ▼ Show 20 Lines | |||||
* Manually stop a scan that is currently running. | * Manually stop a scan that is currently running. | ||||
* Provided for drivers that are not able to scan single channels | * Provided for drivers that are not able to scan single channels | ||||
* (e.g. for firmware-based devices). | * (e.g. for firmware-based devices). | ||||
*/ | */ | ||||
static void | static void | ||||
ieee80211_swscan_scan_done(struct ieee80211vap *vap) | ieee80211_swscan_scan_done(struct ieee80211vap *vap) | ||||
{ | { | ||||
struct ieee80211com *ic = vap->iv_ic; | struct ieee80211com *ic = vap->iv_ic; | ||||
struct ieee80211_scan_state *ss; | struct ieee80211_scan_state *ss = ic->ic_scan; | ||||
IEEE80211_LOCK_ASSERT(ic); | IEEE80211_LOCK_ASSERT(ic); | ||||
ss = ic->ic_scan; | |||||
scan_signal_locked(ss, 0); | scan_signal_locked(ss, 0); | ||||
} | } | ||||
/* | /* | ||||
* Probe the current channel, if allowed, while scanning. | * Probe the current channel, if allowed, while scanning. | ||||
* If the channel is not marked passive-only then send | * If the channel is not marked passive-only then send | ||||
* a probe request immediately. Otherwise mark state and | * a probe request immediately. Otherwise mark state and | ||||
* listen for beacons on the channel; if we receive something | * listen for beacons on the channel; if we receive something | ||||
Show All 28 Lines | |||||
* Scan curchan. If this is an active scan and the channel | * Scan curchan. If this is an active scan and the channel | ||||
* is not marked passive then send probe request frame(s). | * is not marked passive then send probe request frame(s). | ||||
* Arrange for the channel change after maxdwell ticks. | * Arrange for the channel change after maxdwell ticks. | ||||
*/ | */ | ||||
static void | static void | ||||
scan_curchan(struct ieee80211_scan_state *ss, unsigned long maxdwell) | scan_curchan(struct ieee80211_scan_state *ss, unsigned long maxdwell) | ||||
{ | { | ||||
struct ieee80211vap *vap = ss->ss_vap; | struct ieee80211vap *vap = ss->ss_vap; | ||||
struct ieee80211com *ic = ss->ss_ic; | |||||
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, | IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, | ||||
"%s: calling; maxdwell=%lu\n", | "%s: calling; maxdwell=%lu\n", | ||||
__func__, | __func__, | ||||
maxdwell); | maxdwell); | ||||
IEEE80211_LOCK(vap->iv_ic); | IEEE80211_LOCK(ic); | ||||
if (ss->ss_flags & IEEE80211_SCAN_ACTIVE) | if (ss->ss_flags & IEEE80211_SCAN_ACTIVE) | ||||
ieee80211_probe_curchan(vap, 0); | ieee80211_probe_curchan(vap, 0); | ||||
taskqueue_enqueue_timeout(vap->iv_ic->ic_tq, | taskqueue_enqueue_timeout(ic->ic_tq, | ||||
&SCAN_PRIVATE(ss)->ss_scan_curchan, maxdwell); | &SCAN_PRIVATE(ss)->ss_scan_curchan, maxdwell); | ||||
IEEE80211_UNLOCK(vap->iv_ic); | IEEE80211_UNLOCK(ic); | ||||
} | } | ||||
static void | static void | ||||
scan_signal(struct ieee80211_scan_state *ss, int iflags) | scan_signal(struct ieee80211_scan_state *ss, int iflags) | ||||
{ | { | ||||
struct ieee80211com *ic = ss->ss_ic; | struct ieee80211com *ic = ss->ss_ic; | ||||
IEEE80211_UNLOCK_ASSERT(ic); | IEEE80211_UNLOCK_ASSERT(ic); | ||||
▲ Show 20 Lines • Show All 421 Lines • Show Last 20 Lines |