freebsd-dev/sys/net80211/ieee80211_scan_sw.h

61 lines
3.0 KiB
C
Raw Normal View History

Refactor and split out the net80211 software scan engine from the rest of the scan API. The eventual aim is to have 'ieee80211_scan.c' have the net80211 and driver facing scan API to start, finish and continue doing scanning while 'ieee80211_swscan.c' implements the software scanner that runs the scan task, handles probe request/reply bits, configures the VAP off-channel, changes channel and does the scanning bits. For NICs that do no scanning at all, the existing code is needed. ath(4) and most of the other NICs (dumb USB ones in particular) do little to no scan offload - it's all done in software. Some NICs may do single channel at a time scanning; I haven't really checked them out in detail. iwn(4), the upcoming 7260 driver stuff, the new Qualcomm Atheros 11ac chipsets and the Atheros mobile/USB full-offload chips all have complete scan engines in firmware. We don't have to drive any of it at all - the firmware just needs to be told what to scan, when to scan, how long to scan. It'll take care of going off channel, pausing TX/RX appropriately, sending sleep notification to the AP, sending probe requests and handling probe responses. It'll do passive/active scan itself. It's almost completely transparent to the network stack - all we see are scan notifications when it finishes scanning each channel and beacons/probe responses when it does its thing. Once it's done we get a final notification that the scan is complete, with some scan results in the message. The iwn(4) NICs handle doing active scanning too as an option and will handle waiting appropriately on 5GHz passive channels before active scanning. There's some more refactoring, tidying up and lock assertions to sprinkle around to tidy this whole thing up before I turn swscan.c into another set of ic methods to override by the driver or alternate scan module. So in theory this is all one big no-op commit. In theory. Tested: * iwn(4) 5200, STA mode * ath(4) 6205, STA mode * ath(4) - various NICs, AP mode
2015-01-06 02:08:45 +00:00
/*-
* Copyright (c) 2015 Adrian Chadd <adrian@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef __NET80211_IEEE80211_SCAN_SW_H__
#define __NET80211_IEEE80211_SCAN_SW_H__
extern void ieee80211_swscan_attach(struct ieee80211com *ic);
extern void ieee80211_swscan_detach(struct ieee80211com *ic);
extern void ieee80211_swscan_vattach(struct ieee80211vap *vap);
extern void ieee80211_swscan_vdetach(struct ieee80211vap *vap);
extern int ieee80211_swscan_start_scan(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[]);
extern void ieee80211_swscan_set_scan_duration(struct ieee80211vap *vap,
u_int duration);
extern void ieee80211_swscan_run_scan_task(struct ieee80211vap *vap);
extern int ieee80211_swscan_check_scan(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[]);
extern int ieee80211_swscan_bg_scan(const struct ieee80211_scanner *scan,
struct ieee80211vap *vap, int flags);
extern void ieee80211_swscan_cancel_scan(struct ieee80211vap *vap);
extern void ieee80211_swscan_cancel_anyscan(struct ieee80211vap *vap);
extern void ieee80211_swscan_scan_next(struct ieee80211vap *vap);
extern void ieee80211_swscan_scan_done(struct ieee80211vap *vap);
extern void ieee80211_swscan_probe_curchan(struct ieee80211vap *vap,
int force);
extern void ieee80211_swscan_add_scan(struct ieee80211vap *vap,
const struct ieee80211_scanparams *sp,
const struct ieee80211_frame *wh,
int subtype, int rssi, int noise);
#endif /* __NET80211_IEEE80211_SCAN_SW_H__ */