From 76faddae1159ff9075402ed51b7d752224b2fce7 Mon Sep 17 00:00:00 2001 From: adrian Date: Mon, 8 Jun 2015 00:30:58 +0000 Subject: Remove the start-scan call and re-inline it for now. --- sys/net80211/ieee80211_scan_sw.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'sys/net80211/ieee80211_scan_sw.c') diff --git a/sys/net80211/ieee80211_scan_sw.c b/sys/net80211/ieee80211_scan_sw.c index 22f1cf9..9012619 100644 --- a/sys/net80211/ieee80211_scan_sw.c +++ b/sys/net80211/ieee80211_scan_sw.c @@ -198,17 +198,6 @@ ieee80211_swscan_set_scan_duration(struct ieee80211vap *vap, u_int duration) SCAN_PRIVATE(ss)->ss_duration = duration; } -void -ieee80211_swscan_run_scan_task(struct ieee80211vap *vap) -{ - struct ieee80211com *ic = vap->iv_ic; - struct ieee80211_scan_state *ss = ic->ic_scan; - - IEEE80211_LOCK_ASSERT(ic); - - ieee80211_runtask(ic, &SCAN_PRIVATE(ss)->ss_scan_task); -} - /* * Start a scan unless one is already going. */ @@ -272,7 +261,7 @@ ieee80211_swscan_start_scan_locked(const struct ieee80211_scanner *scan, ic->ic_flags |= IEEE80211_F_SCAN; /* Start scan task */ - ieee80211_swscan_run_scan_task(vap); + ieee80211_runtask(ic, &SCAN_PRIVATE(ss)->ss_scan_task); } return 1; } else { -- cgit v1.1 From e853cb9f9b847e533642a7b078c97c74e454378e Mon Sep 17 00:00:00 2001 From: adrian Date: Mon, 8 Jun 2015 02:35:43 +0000 Subject: Break out the current 802.11 software scan methods into an indirect table. In order for drivers to provide an alternate set of scan methods, these have to finally use an indirection table and all of the calls in ieee80211_scan.c need to use said table. For all existing drivers - this is basically a glorified, KBI-breaking functional no-op. This is also not the final form - too much functionality is currently hiding in ieee80211_scan_sw.c that should be in ieee80211_scan.c. That'll be the target of some follow-up commits. Note: * You have to recompile your kernel/drivers after this - the net80211 KBI has changed. * I'm not yet planning on bumping any versioning - I have a few more things to shuffle around. Tested: * urtwn(4) - STA mode * Intel 7260 in local repo - overriding the methods and table at attach time has the desired effect (ie, all the methods are called, but nothing is ever performed.) --- sys/net80211/ieee80211_scan_sw.c | 99 ++++++++++++++++++++++++---------------- 1 file changed, 60 insertions(+), 39 deletions(-) (limited to 'sys/net80211/ieee80211_scan_sw.c') diff --git a/sys/net80211/ieee80211_scan_sw.c b/sys/net80211/ieee80211_scan_sw.c index 9012619..eb58386 100644 --- a/sys/net80211/ieee80211_scan_sw.c +++ b/sys/net80211/ieee80211_scan_sw.c @@ -102,33 +102,7 @@ static void scan_task(void *, int); MALLOC_DEFINE(M_80211_SCAN, "80211scan", "802.11 scan state"); -void -ieee80211_swscan_attach(struct ieee80211com *ic) -{ - struct scan_state *ss; - - ss = (struct scan_state *) IEEE80211_MALLOC(sizeof(struct scan_state), - M_80211_SCAN, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); - if (ss == NULL) { - ic->ic_scan = NULL; - return; - } - callout_init_mtx(&ss->ss_scan_timer, IEEE80211_LOCK_OBJ(ic), 0); - cv_init(&ss->ss_scan_cv, "scan"); - TASK_INIT(&ss->ss_scan_task, 0, scan_task, ss); - - ic->ic_scan = &ss->base; - ss->base.ss_ic = ic; - - ic->ic_scan_curchan = scan_curchan; - ic->ic_scan_mindwell = scan_mindwell; - - /* - * TODO: all of the non-vap scan calls should be methods! - */ -} - -void +static void ieee80211_swscan_detach(struct ieee80211com *ic) { struct ieee80211_scan_state *ss = ic->ic_scan; @@ -159,7 +133,7 @@ ieee80211_swscan_detach(struct ieee80211com *ic) } } -void +static void ieee80211_swscan_vattach(struct ieee80211vap *vap) { /* nothing to do for now */ @@ -169,7 +143,7 @@ ieee80211_swscan_vattach(struct ieee80211vap *vap) } -void +static void ieee80211_swscan_vdetach(struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; @@ -185,7 +159,7 @@ ieee80211_swscan_vdetach(struct ieee80211vap *vap) } } -void +static void ieee80211_swscan_set_scan_duration(struct ieee80211vap *vap, u_int duration) { struct ieee80211com *ic = vap->iv_ic; @@ -278,7 +252,7 @@ ieee80211_swscan_start_scan_locked(const struct ieee80211_scanner *scan, * * Called without the comlock held; grab the comlock as appropriate. */ -int +static int ieee80211_swscan_start_scan(const struct ieee80211_scanner *scan, struct ieee80211vap *vap, int flags, u_int duration, u_int mindwell, u_int maxdwell, @@ -305,7 +279,7 @@ ieee80211_swscan_start_scan(const struct ieee80211_scanner *scan, * * XXX TODO: split out! */ -int +static int ieee80211_swscan_check_scan(const struct ieee80211_scanner *scan, struct ieee80211vap *vap, int flags, u_int duration, u_int mindwell, u_int maxdwell, @@ -363,7 +337,7 @@ ieee80211_swscan_check_scan(const struct ieee80211_scanner *scan, * Restart a previous scan. If the previous scan completed * then we start again using the existing channel list. */ -int +static int ieee80211_swscan_bg_scan(const struct ieee80211_scanner *scan, struct ieee80211vap *vap, int flags) { @@ -454,7 +428,7 @@ ieee80211_swscan_bg_scan(const struct ieee80211_scanner *scan, /* * Cancel any scan currently going on for the specified vap. */ -void +static void ieee80211_swscan_cancel_scan(struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; @@ -488,7 +462,7 @@ ieee80211_swscan_cancel_scan(struct ieee80211vap *vap) /* * Cancel any scan currently going on. */ -void +static void ieee80211_swscan_cancel_anyscan(struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; @@ -522,7 +496,7 @@ ieee80211_swscan_cancel_anyscan(struct ieee80211vap *vap) * Public access to scan_next for drivers that manage * scanning themselves (e.g. for firmware-based devices). */ -void +static void ieee80211_swscan_scan_next(struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; @@ -540,7 +514,7 @@ ieee80211_swscan_scan_next(struct ieee80211vap *vap) * Public access to scan_next for drivers that are not able to scan single * channels (e.g. for firmware-based devices). */ -void +static void ieee80211_swscan_scan_done(struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; @@ -559,7 +533,7 @@ ieee80211_swscan_scan_done(struct ieee80211vap *vap) * listen for beacons on the channel; if we receive something * then we'll transmit a probe request. */ -void +static void ieee80211_swscan_probe_curchan(struct ieee80211vap *vap, int force) { struct ieee80211com *ic = vap->iv_ic; @@ -887,7 +861,7 @@ done: /* * Process a beacon or probe response frame. */ -void +static void ieee80211_swscan_add_scan(struct ieee80211vap *vap, struct ieee80211_channel *curchan, const struct ieee80211_scanparams *sp, @@ -935,3 +909,50 @@ ieee80211_swscan_add_scan(struct ieee80211vap *vap, } } +static struct ieee80211_scan_methods swscan_methods = { + .sc_attach = ieee80211_swscan_attach, + .sc_detach = ieee80211_swscan_detach, + .sc_vattach = ieee80211_swscan_vattach, + .sc_vdetach = ieee80211_swscan_vdetach, + .sc_set_scan_duration = ieee80211_swscan_set_scan_duration, + .sc_start_scan = ieee80211_swscan_start_scan, + .sc_check_scan = ieee80211_swscan_check_scan, + .sc_bg_scan = ieee80211_swscan_bg_scan, + .sc_cancel_scan = ieee80211_swscan_cancel_scan, + .sc_cancel_anyscan = ieee80211_swscan_cancel_anyscan, + .sc_scan_next = ieee80211_swscan_scan_next, + .sc_scan_done = ieee80211_swscan_scan_done, + .sc_scan_probe_curchan = ieee80211_swscan_probe_curchan, + .sc_add_scan = ieee80211_swscan_add_scan +}; + +/* + * Default scan attach method. + */ +void +ieee80211_swscan_attach(struct ieee80211com *ic) +{ + struct scan_state *ss; + + /* + * Setup the default methods + */ + ic->ic_scan_methods = &swscan_methods; + + /* Allocate initial scan state */ + ss = (struct scan_state *) IEEE80211_MALLOC(sizeof(struct scan_state), + M_80211_SCAN, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); + if (ss == NULL) { + ic->ic_scan = NULL; + return; + } + callout_init_mtx(&ss->ss_scan_timer, IEEE80211_LOCK_OBJ(ic), 0); + cv_init(&ss->ss_scan_cv, "scan"); + TASK_INIT(&ss->ss_scan_task, 0, scan_task, ss); + + ic->ic_scan = &ss->base; + ss->base.ss_ic = ic; + + ic->ic_scan_curchan = scan_curchan; + ic->ic_scan_mindwell = scan_mindwell; +} -- cgit v1.1